chore: some renames and supporting both formats
Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
@@ -46,7 +46,10 @@ describe('RouteTracker', () => {
|
||||
caseSensitive: false,
|
||||
children: [MATCH_ALL_ROUTE],
|
||||
appNode: {
|
||||
spec: { extension: { id: 'home.page.index' }, source: { id: 'home' } },
|
||||
spec: {
|
||||
extension: { id: 'home.page.index' },
|
||||
source: { id: 'home' },
|
||||
},
|
||||
} as AppNode,
|
||||
},
|
||||
{
|
||||
|
||||
@@ -49,7 +49,7 @@ export function collectRouteIds(features: FrontendFeature[]): RouteRefsById {
|
||||
}
|
||||
|
||||
for (const [name, ref] of Object.entries(feature.routes)) {
|
||||
const refId = `${feature.pluginId}.${name}`;
|
||||
const refId = `${feature.id}.${name}`;
|
||||
if (routesById.has(refId)) {
|
||||
throw new Error(`Unexpected duplicate route '${refId}'`);
|
||||
}
|
||||
@@ -64,7 +64,7 @@ export function collectRouteIds(features: FrontendFeature[]): RouteRefsById {
|
||||
}
|
||||
}
|
||||
for (const [name, ref] of Object.entries(feature.externalRoutes)) {
|
||||
const refId = `${feature.pluginId}.${name}`;
|
||||
const refId = `${feature.id}.${name}`;
|
||||
if (externalRoutesById.has(refId)) {
|
||||
throw new Error(`Unexpected duplicate external route '${refId}'`);
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ export function resolveAppNodeSpecs(options: {
|
||||
if (pluginExtensions.some(({ id }) => forbidden.has(id))) {
|
||||
const pluginsStr = pluginExtensions
|
||||
.filter(({ id }) => forbidden.has(id))
|
||||
.map(({ source }) => `'${source.pluginId}'`)
|
||||
.map(({ source }) => `'${source.id}'`)
|
||||
.join(', ');
|
||||
const forbiddenStr = [...forbidden].map(id => `'${id}'`).join(', ');
|
||||
throw new Error(
|
||||
@@ -156,7 +156,7 @@ export function resolveAppNodeSpecs(options: {
|
||||
const extensionId = extension.id;
|
||||
const extensionData = data?.[extensionId];
|
||||
if (extensionData) duplicatedExtensionIds.add(extensionId);
|
||||
const pluginId = params.source?.pluginId ?? 'internal';
|
||||
const pluginId = params.source?.id ?? 'internal';
|
||||
const pluginCount = extensionData?.[pluginId] ?? 0;
|
||||
return {
|
||||
...data,
|
||||
|
||||
@@ -100,10 +100,10 @@ function deduplicateFeatures(
|
||||
if (!isInternalFrontendPlugin(feature)) {
|
||||
return true;
|
||||
}
|
||||
if (seenIds.has(feature.pluginId)) {
|
||||
if (seenIds.has(feature.id)) {
|
||||
return false;
|
||||
}
|
||||
seenIds.add(feature.pluginId);
|
||||
seenIds.add(feature.id);
|
||||
return true;
|
||||
})
|
||||
.reverse();
|
||||
@@ -330,7 +330,7 @@ export function createSpecializedApp(options?: {
|
||||
toInternalFrontendPlugin(feature).featureFlags.forEach(flag =>
|
||||
featureFlagApi.registerFlag({
|
||||
name: flag.name,
|
||||
pluginId: feature.pluginId,
|
||||
pluginId: feature.id,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user