diff --git a/.changeset/shiny-carpets-worry.md b/.changeset/shiny-carpets-worry.md new file mode 100644 index 0000000000..f1c3bbe292 --- /dev/null +++ b/.changeset/shiny-carpets-worry.md @@ -0,0 +1,9 @@ +--- +'@backstage/frontend-plugin-api': patch +'@backstage/frontend-test-utils': patch +'@backstage/frontend-app-api': patch +'@backstage/core-compat-api': patch +'@backstage/plugin-search-react': patch +--- + +Removing superfluous `namespace` parameter in favour of `pluginId` instead diff --git a/packages/core-compat-api/api-report.md b/packages/core-compat-api/api-report.md index e61ee451d9..ddb3bc6bf4 100644 --- a/packages/core-compat-api/api-report.md +++ b/packages/core-compat-api/api-report.md @@ -9,12 +9,12 @@ import { AnalyticsEvent } from '@backstage/core-plugin-api'; import { AnalyticsEvent as AnalyticsEvent_2 } from '@backstage/frontend-plugin-api'; import { AnyRouteRefParams } from '@backstage/core-plugin-api'; import { BackstagePlugin } from '@backstage/core-plugin-api'; -import { BackstagePlugin as BackstagePlugin_2 } from '@backstage/frontend-plugin-api'; import { ComponentType } from 'react'; import { ExtensionDefinition } from '@backstage/frontend-plugin-api'; import { ExtensionOverrides } from '@backstage/frontend-plugin-api'; import { ExternalRouteRef } from '@backstage/core-plugin-api'; import { ExternalRouteRef as ExternalRouteRef_2 } from '@backstage/frontend-plugin-api'; +import { FrontendModule } from '@backstage/frontend-plugin-api'; import { FrontendPlugin } from '@backstage/frontend-plugin-api'; import { default as React_2 } from 'react'; import { ReactNode } from 'react'; @@ -29,7 +29,7 @@ export function compatWrapper(element: ReactNode): React_2.JSX.Element; // @public (undocumented) export function convertLegacyApp( rootElement: React_2.JSX.Element, -): (FrontendPlugin | ExtensionOverrides)[]; +): (FrontendPlugin | FrontendModule | ExtensionOverrides)[]; // @public (undocumented) export function convertLegacyPageExtension( @@ -46,7 +46,7 @@ export function convertLegacyPlugin( options: { extensions: ExtensionDefinition[]; }, -): BackstagePlugin_2; +): FrontendPlugin; // @public export function convertLegacyRouteRef( diff --git a/packages/core-compat-api/src/collectLegacyRoutes.test.tsx b/packages/core-compat-api/src/collectLegacyRoutes.test.tsx index 4c2acd35a6..0319628b14 100644 --- a/packages/core-compat-api/src/collectLegacyRoutes.test.tsx +++ b/packages/core-compat-api/src/collectLegacyRoutes.test.tsx @@ -73,7 +73,7 @@ describe('collectLegacyRoutes', () => { defaultConfig: {}, }, { - id: 'api:plugin.scoringdata.service', + id: 'api:score-card/plugin.scoringdata.service', attachTo: { id: 'root', input: 'apis' }, disabled: false, }, @@ -89,7 +89,7 @@ describe('collectLegacyRoutes', () => { defaultConfig: {}, }, { - id: 'api:plugin.stackstorm.service', + id: 'api:stackstorm/plugin.stackstorm.service', attachTo: { id: 'root', input: 'apis' }, disabled: false, }, @@ -111,7 +111,7 @@ describe('collectLegacyRoutes', () => { defaultConfig: {}, }, { - id: 'api:plugin.puppetdb.service', + id: 'api:puppetDb/plugin.puppetdb.service', attachTo: { id: 'root', input: 'apis' }, disabled: false, }, @@ -209,7 +209,7 @@ describe('collectLegacyRoutes', () => { disabled: false, }, { - id: 'api:plugin.catalog.service', + id: 'api:catalog/plugin.catalog.service', attachTo: { id: 'root', input: 'apis', @@ -218,7 +218,7 @@ describe('collectLegacyRoutes', () => { disabled: false, }, { - id: 'api:catalog-react.starred-entities', + id: 'api:catalog/catalog-react.starred-entities', attachTo: { id: 'root', input: 'apis', @@ -227,7 +227,7 @@ describe('collectLegacyRoutes', () => { disabled: false, }, { - id: 'api:plugin.catalog.entity-presentation', + id: 'api:catalog/plugin.catalog.entity-presentation', attachTo: { id: 'root', input: 'apis', @@ -241,7 +241,7 @@ describe('collectLegacyRoutes', () => { id: 'score-card', extensions: [ { - id: 'api:plugin.scoringdata.service', + id: 'api:score-card/plugin.scoringdata.service', attachTo: { id: 'root', input: 'apis' }, disabled: false, }, diff --git a/packages/core-compat-api/src/collectLegacyRoutes.tsx b/packages/core-compat-api/src/collectLegacyRoutes.tsx index 197c245278..43e66ce859 100644 --- a/packages/core-compat-api/src/collectLegacyRoutes.tsx +++ b/packages/core-compat-api/src/collectLegacyRoutes.tsx @@ -269,7 +269,7 @@ export function collectLegacyRoutes( ...extensions, ...Array.from(plugin.getApis()).map(factory => ApiBlueprint.make({ - namespace: factory.api.id, + name: factory.api.id, params: { factory }, }), ), diff --git a/packages/core-compat-api/src/compatWrapper/compatWrapper.test.tsx b/packages/core-compat-api/src/compatWrapper/compatWrapper.test.tsx index bee379a792..fe4770a08c 100644 --- a/packages/core-compat-api/src/compatWrapper/compatWrapper.test.tsx +++ b/packages/core-compat-api/src/compatWrapper/compatWrapper.test.tsx @@ -74,7 +74,7 @@ describe('BackwardsCompatProvider', () => { ); expect(screen.getByTestId('ctx').textContent).toMatchInlineSnapshot(` - "plugins: app + "plugins: test, app components: NotFoundErrorPage, BootErrorPage, Progress, Router, ErrorBoundaryFallback icons: brokenImage, catalog, scaffolder, techdocs, search, chat, dashboard, docs, email, github, group, help, kind:api, kind:component, kind:domain, kind:group, kind:location, kind:system, kind:user, kind:resource, kind:template, user, warning" `); diff --git a/packages/core-compat-api/src/convertLegacyApp.test.tsx b/packages/core-compat-api/src/convertLegacyApp.test.tsx index b76a6c2d71..224ab46221 100644 --- a/packages/core-compat-api/src/convertLegacyApp.test.tsx +++ b/packages/core-compat-api/src/convertLegacyApp.test.tsx @@ -65,7 +65,7 @@ describe('convertLegacyApp', () => { defaultConfig: {}, }, { - id: 'api:plugin.scoringdata.service', + id: 'api:score-card/plugin.scoringdata.service', attachTo: { id: 'root', input: 'apis' }, disabled: false, }, @@ -81,7 +81,7 @@ describe('convertLegacyApp', () => { defaultConfig: {}, }, { - id: 'api:plugin.stackstorm.service', + id: 'api:stackstorm/plugin.stackstorm.service', attachTo: { id: 'root', input: 'apis' }, disabled: false, }, @@ -103,7 +103,7 @@ describe('convertLegacyApp', () => { defaultConfig: {}, }, { - id: 'api:plugin.puppetdb.service', + id: 'api:puppetDb/plugin.puppetdb.service', attachTo: { id: 'root', input: 'apis' }, disabled: false, }, diff --git a/packages/core-compat-api/src/convertLegacyApp.ts b/packages/core-compat-api/src/convertLegacyApp.ts index 2729664941..3f35c78408 100644 --- a/packages/core-compat-api/src/convertLegacyApp.ts +++ b/packages/core-compat-api/src/convertLegacyApp.ts @@ -22,12 +22,13 @@ import React, { isValidElement, } from 'react'; import { - ExtensionOverrides, + FrontendModule, FrontendPlugin, coreExtensionData, createExtension, + ExtensionOverrides, createExtensionInput, - createExtensionOverrides, + createFrontendModule, } from '@backstage/frontend-plugin-api'; import { getComponentData } from '@backstage/core-plugin-api'; import { collectLegacyRoutes } from './collectLegacyRoutes'; @@ -61,7 +62,7 @@ function selectChildren( /** @public */ export function convertLegacyApp( rootElement: React.JSX.Element, -): (FrontendPlugin | ExtensionOverrides)[] { +): (FrontendPlugin | FrontendModule | ExtensionOverrides)[] { if (getComponentData(rootElement, 'core.type') === 'FlatRoutes') { return collectLegacyRoutes(rootElement); } @@ -104,7 +105,6 @@ export function convertLegacyApp( const [routesEl] = routesEls; const CoreLayoutOverride = createExtension({ - namespace: 'app', name: 'layout', attachTo: { id: 'app', input: 'root' }, inputs: { @@ -127,7 +127,6 @@ export function convertLegacyApp( }, }); const CoreNavOverride = createExtension({ - namespace: 'app', name: 'nav', attachTo: { id: 'app/layout', input: 'nav' }, output: [], @@ -139,7 +138,8 @@ export function convertLegacyApp( return [ ...collectedRoutes, - createExtensionOverrides({ + createFrontendModule({ + pluginId: 'app', extensions: [CoreLayoutOverride, CoreNavOverride], }), ]; diff --git a/packages/core-compat-api/src/convertLegacyPlugin.test.tsx b/packages/core-compat-api/src/convertLegacyPlugin.test.tsx index 3d5b001c61..01266a35b7 100644 --- a/packages/core-compat-api/src/convertLegacyPlugin.test.tsx +++ b/packages/core-compat-api/src/convertLegacyPlugin.test.tsx @@ -84,7 +84,7 @@ describe('convertLegacyPlugin', () => { }); expect(internalConverted.featureFlags).toEqual([{ name: 'test-flag' }]); expect(internalConverted.extensions.map(e => e.id)).toEqual([ - 'api:plugin.test.client', + 'api:test/plugin.test.client', 'page:test', ]); }); diff --git a/packages/core-compat-api/src/convertLegacyPlugin.ts b/packages/core-compat-api/src/convertLegacyPlugin.ts index bf5759f214..5fd5e585e6 100644 --- a/packages/core-compat-api/src/convertLegacyPlugin.ts +++ b/packages/core-compat-api/src/convertLegacyPlugin.ts @@ -18,7 +18,7 @@ import { BackstagePlugin as LegacyBackstagePlugin } from '@backstage/core-plugin import { ApiBlueprint, ExtensionDefinition, - BackstagePlugin as NewBackstagePlugin, + FrontendPlugin as NewBackstagePlugin, createFrontendPlugin, } from '@backstage/frontend-plugin-api'; import { convertLegacyRouteRefs } from './convertLegacyRouteRef'; @@ -29,7 +29,7 @@ export function convertLegacyPlugin( options: { extensions: ExtensionDefinition[] }, ): NewBackstagePlugin { const apiExtensions = Array.from(legacyPlugin.getApis()).map(factory => - ApiBlueprint.make({ namespace: factory.api.id, params: { factory } }), + ApiBlueprint.make({ name: factory.api.id, params: { factory } }), ); return createFrontendPlugin({ id: legacyPlugin.getId(), diff --git a/packages/frontend-app-api/src/extensions/Root.ts b/packages/frontend-app-api/src/extensions/Root.ts index 3b1c237e7a..66c4db3140 100644 --- a/packages/frontend-app-api/src/extensions/Root.ts +++ b/packages/frontend-app-api/src/extensions/Root.ts @@ -22,7 +22,6 @@ import { } from '@backstage/frontend-plugin-api'; export const Root = createExtension({ - namespace: 'root', attachTo: { id: 'ignored', input: 'ignored' }, inputs: { app: createExtensionInput([coreExtensionData.reactElement], { diff --git a/packages/frontend-app-api/src/routing/extractRouteInfoFromAppNode.test.ts b/packages/frontend-app-api/src/routing/extractRouteInfoFromAppNode.test.ts index 4e1c37e9a0..7ffe64d6d7 100644 --- a/packages/frontend-app-api/src/routing/extractRouteInfoFromAppNode.test.ts +++ b/packages/frontend-app-api/src/routing/extractRouteInfoFromAppNode.test.ts @@ -89,7 +89,9 @@ function routeInfoFromExtensions(extensions: ExtensionDefinition[]) { 'root', resolveAppNodeSpecs({ features: [appPlugin, plugin], - builtinExtensions: [resolveExtensionDefinition(Root)], + builtinExtensions: [ + resolveExtensionDefinition(Root, { namespace: 'root' }), + ], parameters: readAppExtensionsConfig(new MockConfigApi({})), forbidden: new Set(['root']), }), diff --git a/packages/frontend-app-api/src/tree/instantiateAppNodeTree.test.ts b/packages/frontend-app-api/src/tree/instantiateAppNodeTree.test.ts index 06d412b30e..f24a9e17f3 100644 --- a/packages/frontend-app-api/src/tree/instantiateAppNodeTree.test.ts +++ b/packages/frontend-app-api/src/tree/instantiateAppNodeTree.test.ts @@ -667,7 +667,6 @@ describe('instantiateAppNodeTree', () => { describe('v2', () => { const simpleExtension = resolveExtensionDefinition( createExtension({ - namespace: 'app', name: 'test', attachTo: { id: 'ignored', input: 'ignored' }, output: [testDataRef, otherDataRef.optional()], @@ -684,6 +683,7 @@ describe('instantiateAppNodeTree', () => { ]; }, }), + { namespace: 'app' }, ); function mirrorInputs(ctx: { @@ -750,7 +750,6 @@ describe('instantiateAppNodeTree', () => { makeSpec( resolveExtensionDefinition( createExtension({ - namespace: 'root-node', attachTo: { id: 'ignored', input: 'ignored' }, inputs: { test: createExtensionInput([testDataRef]), @@ -758,6 +757,7 @@ describe('instantiateAppNodeTree', () => { output: [inputMirrorDataRef], factory: mirrorInputs, }), + { namespace: 'root-node' }, ), ), makeSpec(simpleExtension, { @@ -790,7 +790,6 @@ describe('instantiateAppNodeTree', () => { ...makeSpec( resolveExtensionDefinition( createExtension({ - namespace: 'root-node', attachTo: { id: 'ignored', input: 'ignored' }, inputs: { test: createExtensionInput([testDataRef]), @@ -798,6 +797,7 @@ describe('instantiateAppNodeTree', () => { output: [inputMirrorDataRef], factory: mirrorInputs, }), + { namespace: 'root-node' }, ), ), }, @@ -873,7 +873,6 @@ describe('instantiateAppNodeTree', () => { node: makeNode( resolveExtensionDefinition( createExtension({ - namespace: 'app', name: 'test', attachTo: { id: 'ignored', input: 'ignored' }, inputs: { @@ -897,6 +896,7 @@ describe('instantiateAppNodeTree', () => { output: [inputMirrorDataRef], factory: mirrorInputs, }), + { namespace: 'app' }, ), ), }); @@ -946,7 +946,6 @@ describe('instantiateAppNodeTree', () => { node: makeNode( resolveExtensionDefinition( createExtension({ - namespace: 'app', name: 'test', attachTo: { id: 'ignored', input: 'ignored' }, output: [testDataRef], @@ -956,6 +955,7 @@ describe('instantiateAppNodeTree', () => { throw error; }, }), + { namespace: 'app' }, ), ), attachments: new Map(), @@ -972,7 +972,6 @@ describe('instantiateAppNodeTree', () => { node: makeNode( resolveExtensionDefinition( createExtension({ - namespace: 'app', name: 'test', attachTo: { id: 'ignored', input: 'ignored' }, output: [testDataRef, testDataRef], @@ -980,6 +979,7 @@ describe('instantiateAppNodeTree', () => { return [testDataRef('test'), testDataRef('test2')]; }, }), + { namespace: 'app' }, ), ), attachments: new Map(), @@ -996,7 +996,6 @@ describe('instantiateAppNodeTree', () => { node: makeNode( resolveExtensionDefinition( createExtension({ - namespace: 'app', name: 'test', attachTo: { id: 'ignored', input: 'ignored' }, output: [testDataRef], @@ -1004,6 +1003,7 @@ describe('instantiateAppNodeTree', () => { return [] as any; }, }), + { namespace: 'app' }, ), ), attachments: new Map(), @@ -1021,7 +1021,6 @@ describe('instantiateAppNodeTree', () => { resolveExtensionDefinition( // @ts-expect-error createExtension({ - namespace: 'app', name: 'test', attachTo: { id: 'ignored', input: 'ignored' }, output: [], // Output not declared @@ -1029,6 +1028,7 @@ describe('instantiateAppNodeTree', () => { return [testDataRef('test')] as any; }, }), + { namespace: 'app' }, ), ), attachments: new Map(), @@ -1045,7 +1045,6 @@ describe('instantiateAppNodeTree', () => { node: makeNode( resolveExtensionDefinition( createExtension({ - namespace: 'app', name: 'test', attachTo: { id: 'ignored', input: 'ignored' }, inputs: { @@ -1056,6 +1055,7 @@ describe('instantiateAppNodeTree', () => { output: [], factory: () => [], }), + { namespace: 'app' }, ), ), attachments: new Map(), @@ -1090,7 +1090,6 @@ describe('instantiateAppNodeTree', () => { node: makeNode( resolveExtensionDefinition( createExtension({ - namespace: 'app', name: 'parent', attachTo: { id: 'ignored', input: 'ignored' }, inputs: { @@ -1099,6 +1098,7 @@ describe('instantiateAppNodeTree', () => { output: [], factory: () => [], }), + { namespace: 'app' }, ), ), }), @@ -1129,12 +1129,12 @@ describe('instantiateAppNodeTree', () => { node: makeNode( resolveExtensionDefinition( createExtension({ - namespace: 'app', name: 'parent', attachTo: { id: 'ignored', input: 'ignored' }, output: [], factory: () => [], }), + { namespace: 'app' }, ), ), }), @@ -1162,7 +1162,6 @@ describe('instantiateAppNodeTree', () => { node: makeNode( resolveExtensionDefinition( createExtension({ - namespace: 'app', name: 'test', attachTo: { id: 'ignored', input: 'ignored' }, inputs: { @@ -1173,6 +1172,7 @@ describe('instantiateAppNodeTree', () => { output: [], factory: () => [], }), + { namespace: 'app' }, ), ), }), @@ -1197,7 +1197,6 @@ describe('instantiateAppNodeTree', () => { node: makeNode( resolveExtensionDefinition( createExtension({ - namespace: 'app', name: 'test', attachTo: { id: 'ignored', input: 'ignored' }, inputs: { @@ -1209,6 +1208,7 @@ describe('instantiateAppNodeTree', () => { output: [], factory: () => [], }), + { namespace: 'app' }, ), ), }), @@ -1227,7 +1227,6 @@ describe('instantiateAppNodeTree', () => { node: makeNode( resolveExtensionDefinition( createExtension({ - namespace: 'app', name: 'test', attachTo: { id: 'ignored', input: 'ignored' }, inputs: { @@ -1238,6 +1237,7 @@ describe('instantiateAppNodeTree', () => { output: [], factory: () => [], }), + { namespace: 'app' }, ), ), }), diff --git a/packages/frontend-app-api/src/wiring/createSpecializedApp.tsx b/packages/frontend-app-api/src/wiring/createSpecializedApp.tsx index 27f1d52822..612befc597 100644 --- a/packages/frontend-app-api/src/wiring/createSpecializedApp.tsx +++ b/packages/frontend-app-api/src/wiring/createSpecializedApp.tsx @@ -206,7 +206,9 @@ export function createSpecializedApp(options?: { 'root', resolveAppNodeSpecs({ features, - builtinExtensions: [resolveExtensionDefinition(Root)], + builtinExtensions: [ + resolveExtensionDefinition(Root, { namespace: 'root' }), + ], parameters: readAppExtensionsConfig(config), forbidden: new Set(['root']), }), diff --git a/packages/frontend-defaults/src/createApp.test.tsx b/packages/frontend-defaults/src/createApp.test.tsx index 1954554816..2890700653 100644 --- a/packages/frontend-defaults/src/createApp.test.tsx +++ b/packages/frontend-defaults/src/createApp.test.tsx @@ -284,9 +284,9 @@ describe('createApp', () => { components [ - - - + + + ] diff --git a/packages/frontend-plugin-api/api-report.md b/packages/frontend-plugin-api/api-report.md index 276ca190a6..75d91d28f0 100644 --- a/packages/frontend-plugin-api/api-report.md +++ b/packages/frontend-plugin-api/api-report.md @@ -454,7 +454,7 @@ export function createComponentExtension(options: { >; }; kind: 'component'; - namespace: string; + namespace: undefined; name: string; }>; diff --git a/packages/frontend-plugin-api/src/blueprints/ApiBlueprint.test.ts b/packages/frontend-plugin-api/src/blueprints/ApiBlueprint.test.ts index 800eb5d7b1..519b7a4d1a 100644 --- a/packages/frontend-plugin-api/src/blueprints/ApiBlueprint.test.ts +++ b/packages/frontend-plugin-api/src/blueprints/ApiBlueprint.test.ts @@ -31,7 +31,7 @@ describe('ApiBlueprint', () => { params: { factory, }, - namespace: 'test', + name: 'test', }); expect(extension).toMatchInlineSnapshot(` @@ -47,8 +47,8 @@ describe('ApiBlueprint', () => { "factory": [Function], "inputs": {}, "kind": "api", - "name": undefined, - "namespace": "test", + "name": "test", + "namespace": undefined, "output": [ [Function], ], @@ -72,7 +72,7 @@ describe('ApiBlueprint', () => { inputs: { test: createExtensionInput([ApiBlueprint.dataRefs.factory]), }, - namespace: api.id, + name: api.id, factory(originalFactory, { config: _config, inputs: _inputs }) { return originalFactory({ factory: createApiFactory({ @@ -122,8 +122,8 @@ describe('ApiBlueprint', () => { }, }, "kind": "api", - "name": undefined, - "namespace": "test", + "name": "test", + "namespace": undefined, "output": [ [Function], ], diff --git a/packages/frontend-plugin-api/src/blueprints/AppRootWrapperBlueprint.test.tsx b/packages/frontend-plugin-api/src/blueprints/AppRootWrapperBlueprint.test.tsx index cda0085fec..f9214121ce 100644 --- a/packages/frontend-plugin-api/src/blueprints/AppRootWrapperBlueprint.test.tsx +++ b/packages/frontend-plugin-api/src/blueprints/AppRootWrapperBlueprint.test.tsx @@ -72,7 +72,6 @@ describe('AppRootWrapperBlueprint', () => { it('should render the complex component wrapper', async () => { const extension = AppRootWrapperBlueprint.makeWithOverrides({ - name: 'test', config: { schema: { name: z => z.string(), diff --git a/packages/frontend-plugin-api/src/blueprints/RouterBlueprint.test.tsx b/packages/frontend-plugin-api/src/blueprints/RouterBlueprint.test.tsx index 3062d6d9de..ab6bb1eb1f 100644 --- a/packages/frontend-plugin-api/src/blueprints/RouterBlueprint.test.tsx +++ b/packages/frontend-plugin-api/src/blueprints/RouterBlueprint.test.tsx @@ -59,7 +59,6 @@ describe('RouterBlueprint', () => { it('should work with simple options', async () => { const extension = RouterBlueprint.make({ - namespace: 'test', params: { Component: ({ children }) => ( @@ -86,7 +85,6 @@ describe('RouterBlueprint', () => { it('should work with complex options and props', async () => { const extension = RouterBlueprint.makeWithOverrides({ - namespace: 'test', name: 'test', config: { schema: { @@ -115,9 +113,8 @@ describe('RouterBlueprint', () => { config: { name: 'Robin' }, }).add( createExtension({ - namespace: 'test', attachTo: { - id: 'app-router-component:test/test', + id: 'app-router-component:test', input: 'children', }, output: [coreExtensionData.reactElement], diff --git a/packages/frontend-plugin-api/src/blueprints/SignInPageBlueprint.test.tsx b/packages/frontend-plugin-api/src/blueprints/SignInPageBlueprint.test.tsx index 2637873930..a85b5e6f39 100644 --- a/packages/frontend-plugin-api/src/blueprints/SignInPageBlueprint.test.tsx +++ b/packages/frontend-plugin-api/src/blueprints/SignInPageBlueprint.test.tsx @@ -57,7 +57,6 @@ describe('SignInPageBlueprint', () => { const MockSignInPage = () =>
; const extension = SignInPageBlueprint.make({ - name: 'test', params: { loader: async () => () => }, }); diff --git a/packages/frontend-plugin-api/src/extensions/createComponentExtension.tsx b/packages/frontend-plugin-api/src/extensions/createComponentExtension.tsx index c8fa907bc8..ca8f1f807b 100644 --- a/packages/frontend-plugin-api/src/extensions/createComponentExtension.tsx +++ b/packages/frontend-plugin-api/src/extensions/createComponentExtension.tsx @@ -33,8 +33,7 @@ export function createComponentExtension(options: { }) { return createExtension({ kind: 'component', - namespace: options.ref.id, - name: options.name, + name: options.ref.id, attachTo: { id: 'api:app/components', input: 'components' }, disabled: options.disabled, output: [createComponentExtension.componentDataRef], diff --git a/packages/frontend-plugin-api/src/wiring/createExtension.test.ts b/packages/frontend-plugin-api/src/wiring/createExtension.test.ts index 68478a756e..5e8aa1c57a 100644 --- a/packages/frontend-plugin-api/src/wiring/createExtension.test.ts +++ b/packages/frontend-plugin-api/src/wiring/createExtension.test.ts @@ -31,7 +31,6 @@ function unused(..._any: any[]) {} describe('createExtension', () => { it('should create an extension with a simple output', () => { const baseConfig = { - namespace: 'test', attachTo: { id: 'root', input: 'default' }, output: [stringDataRef], }; @@ -41,7 +40,7 @@ describe('createExtension', () => { return [stringDataRef('bar')]; }, }); - expect(extension).toMatchObject({ version: 'v2', namespace: 'test' }); + expect(extension).toMatchObject({ version: 'v2' }); // Member arrow function declaration createExtension({ @@ -161,7 +160,6 @@ describe('createExtension', () => { it('should create an extension with a some optional output', () => { const baseConfig = { - namespace: 'test', attachTo: { id: 'root', input: 'default' }, output: [stringDataRef, numberDataRef.optional()], }; @@ -169,7 +167,7 @@ describe('createExtension', () => { ...baseConfig, factory: () => [stringDataRef('bar')], }); - expect(extension).toMatchObject({ version: 'v2', namespace: 'test' }); + expect(extension).toMatchObject({ version: 'v2' }); createExtension({ ...baseConfig, @@ -206,7 +204,6 @@ describe('createExtension', () => { it('should create an extension with input', () => { const extension = createExtension({ - namespace: 'test', attachTo: { id: 'root', input: 'default' }, inputs: { mixed: createExtensionInput([stringDataRef, numberDataRef.optional()]), @@ -250,15 +247,14 @@ describe('createExtension', () => { return [stringDataRef('bar')]; }, }); - expect(extension).toMatchObject({ version: 'v2', namespace: 'test' }); + expect(extension).toMatchObject({ version: 'v2' }); expect(String(extension)).toBe( - 'ExtensionDefinition{namespace=test,attachTo=root@default}', + 'ExtensionDefinition{attachTo=root@default}', ); }); it('should create an extension with config', () => { const extension = createExtension({ - namespace: 'test', attachTo: { id: 'root', input: 'default' }, config: { schema: { @@ -284,9 +280,9 @@ describe('createExtension', () => { return [stringDataRef('bar')]; }, }); - expect(extension).toMatchObject({ version: 'v2', namespace: 'test' }); + expect(extension).toMatchObject({ version: 'v2' }); expect(String(extension)).toBe( - 'ExtensionDefinition{namespace=test,attachTo=root@default}', + 'ExtensionDefinition{attachTo=root@default}', ); expect( @@ -330,7 +326,6 @@ describe('createExtension', () => { expect( // @ts-expect-error createExtension({ - namespace: 'test', attachTo: { id: 'root', input: 'default' }, output: [stringDataRef, numberDataRef], factory() { @@ -342,7 +337,6 @@ describe('createExtension', () => { expect( // @ts-expect-error createExtension({ - namespace: 'test', attachTo: { id: 'root', input: 'default' }, output: [stringDataRef, numberDataRef], factory() { @@ -354,7 +348,6 @@ describe('createExtension', () => { // Duplicate output, we won't attempt to handle this a compile time and instead error out at runtime expect( createExtension({ - namespace: 'test', attachTo: { id: 'root', input: 'default' }, output: [stringDataRef], factory() { @@ -366,7 +359,6 @@ describe('createExtension', () => { expect( // @ts-expect-error createExtension({ - namespace: 'test', attachTo: { id: 'root', input: 'default' }, output: [stringDataRef], factory() { @@ -377,7 +369,6 @@ describe('createExtension', () => { expect( createExtension({ - namespace: 'test', attachTo: { id: 'root', input: 'default' }, output: [stringDataRef, numberDataRef], factory() { @@ -388,7 +379,6 @@ describe('createExtension', () => { expect( createExtension({ - namespace: 'test', attachTo: { id: 'root', input: 'default' }, output: [stringDataRef, numberDataRef.optional()], factory() { @@ -399,7 +389,6 @@ describe('createExtension', () => { expect( createExtension({ - namespace: 'test', attachTo: { id: 'root', input: 'default' }, output: [stringDataRef, numberDataRef.optional()], factory() { @@ -413,7 +402,6 @@ describe('createExtension', () => { expect( // @ts-expect-error createExtension({ - namespace: 'test', attachTo: { id: 'root', input: 'default' }, output: [stringDataRef, numberDataRef], *factory() { @@ -425,7 +413,6 @@ describe('createExtension', () => { expect( // @ts-expect-error createExtension({ - namespace: 'test', attachTo: { id: 'root', input: 'default' }, output: [stringDataRef, numberDataRef], *factory() { @@ -437,7 +424,6 @@ describe('createExtension', () => { // Duplicate output, we won't attempt to handle this a compile time and instead error out at runtime expect( createExtension({ - namespace: 'test', attachTo: { id: 'root', input: 'default' }, output: [stringDataRef], *factory() { @@ -450,7 +436,6 @@ describe('createExtension', () => { expect( // @ts-expect-error createExtension({ - namespace: 'test', attachTo: { id: 'root', input: 'default' }, output: [stringDataRef], *factory() { @@ -462,7 +447,6 @@ describe('createExtension', () => { expect( createExtension({ - namespace: 'test', attachTo: { id: 'root', input: 'default' }, output: [stringDataRef, numberDataRef], *factory() { @@ -474,7 +458,6 @@ describe('createExtension', () => { expect( createExtension({ - namespace: 'test', attachTo: { id: 'root', input: 'default' }, output: [stringDataRef, numberDataRef.optional()], *factory() { @@ -486,7 +469,6 @@ describe('createExtension', () => { expect( createExtension({ - namespace: 'test', attachTo: { id: 'root', input: 'default' }, output: [stringDataRef, numberDataRef.optional()], *factory() { @@ -499,7 +481,6 @@ describe('createExtension', () => { it('should support new form of inputs', () => { expect( createExtension({ - namespace: 'test', attachTo: { id: 'root', input: 'default' }, inputs: { header: createExtensionInput([stringDataRef.optional()], { @@ -534,7 +515,6 @@ describe('createExtension', () => { describe('overrides', () => { it('should allow overriding of config and merging', () => { const testExtension = createExtension({ - namespace: 'test', attachTo: { id: 'root', input: 'blob' }, output: [stringDataRef], config: { @@ -563,7 +543,6 @@ describe('createExtension', () => { it('should allow overriding of outputs', () => { const testExtension = createExtension({ - namespace: 'test', attachTo: { id: 'root', input: 'blob' }, output: [stringDataRef], inputs: { @@ -603,7 +582,6 @@ describe('createExtension', () => { it('should allow overriding the factory function and calling the original factory', () => { const testExtension = createExtension({ - namespace: 'test', attachTo: { id: 'root', input: 'blob' }, output: [stringDataRef], config: { @@ -635,7 +613,6 @@ describe('createExtension', () => { it('should allow overriding the returned values from the parent factory', () => { const testExtension = createExtension({ kind: 'thing', - namespace: 'test', attachTo: { id: 'root', input: 'default' }, output: [stringDataRef, numberDataRef], config: { @@ -666,7 +643,6 @@ describe('createExtension', () => { it('should work functionally with overrides', () => { const testExtension = createExtension({ kind: 'thing', - namespace: 'test', attachTo: { id: 'root', input: 'default' }, output: [stringDataRef], config: { diff --git a/packages/frontend-test-utils/src/app/createExtensionTester.test.tsx b/packages/frontend-test-utils/src/app/createExtensionTester.test.tsx index 582bbeed00..a6265ae3ac 100644 --- a/packages/frontend-test-utils/src/app/createExtensionTester.test.tsx +++ b/packages/frontend-test-utils/src/app/createExtensionTester.test.tsx @@ -30,7 +30,6 @@ const stringDataRef = createExtensionDataRef().with({ describe('createExtensionTester', () => { it('should return the correct dataRef when called', () => { const extension = createExtension({ - namespace: 'test', attachTo: { id: 'ignored', input: 'ignored' }, output: [stringDataRef], factory: () => [stringDataRef('test-text')], @@ -43,7 +42,6 @@ describe('createExtensionTester', () => { it('should throw an error if trying to access an instance not provided to the tester', () => { const extension = createExtension({ - namespace: 'test', name: 'e1', attachTo: { id: 'ignored', input: 'ignored' }, output: [stringDataRef], @@ -51,7 +49,6 @@ describe('createExtensionTester', () => { }); const extension2 = createExtension({ - namespace: 'test', name: 'e2', attachTo: { id: 'ignored', input: 'ignored' }, output: [stringDataRef], @@ -61,13 +58,12 @@ describe('createExtensionTester', () => { const tester = createExtensionTester(extension); expect(() => tester.query(extension2)).toThrow( - "Extension with ID 'test/e2' not found, please make sure it's added to the tester", + "Extension with ID 'e2' not found, please make sure it's added to the tester", ); }); it('should throw an error if trying to access an instance which is not part of the tree', () => { const extension = createExtension({ - namespace: 'test', name: 'e1', attachTo: { id: 'ignored', input: 'ignored' }, output: [stringDataRef], @@ -75,7 +71,6 @@ describe('createExtensionTester', () => { }); const extension2 = createExtension({ - namespace: 'test', name: 'e2', attachTo: { id: 'ignored', input: 'ignored' }, output: [stringDataRef], @@ -85,7 +80,7 @@ describe('createExtensionTester', () => { const tester = createExtensionTester(extension).add(extension2); expect(() => tester.query(extension2)).toThrow( - "Extension with ID 'test/e2' has not been instantiated, because it is not part of the test subject's extension tree", + "Extension with ID 'e2' has not been instantiated, because it is not part of the test subject's extension tree", ); }); @@ -99,7 +94,6 @@ describe('createExtensionTester', () => { }); const extension = createExtension({ - namespace: 'test', name: 'e1', attachTo: { id: 'ignored', input: 'ignored' }, output: [stringDataRef, internalRef.optional()], @@ -129,7 +123,6 @@ describe('createExtensionTester', () => { }); const extension = createExtension({ - namespace: 'test', name: 'e1', inputs: { ignored: createExtensionInput([stringDataRef]), @@ -140,9 +133,8 @@ describe('createExtensionTester', () => { }); const extraExtension = createExtension({ - namespace: 'test', name: 'e2', - attachTo: { id: 'test/e1', input: 'ignored' }, + attachTo: { id: 'e1', input: 'ignored' }, output: [stringDataRef, internalRef.optional()], factory: () => [stringDataRef('test-text')], }); diff --git a/packages/frontend-test-utils/src/app/renderInTestApp.tsx b/packages/frontend-test-utils/src/app/renderInTestApp.tsx index fae67a260c..e53566a118 100644 --- a/packages/frontend-test-utils/src/app/renderInTestApp.tsx +++ b/packages/frontend-test-utils/src/app/renderInTestApp.tsx @@ -25,7 +25,6 @@ import { ConfigReader } from '@backstage/config'; import { JsonObject } from '@backstage/types'; import { createExtension, - createExtensionOverrides, ExtensionDefinition, coreExtensionData, RouteRef, @@ -33,6 +32,7 @@ import { IconComponent, RouterBlueprint, NavItemBlueprint, + createFrontendPlugin, } from '@backstage/frontend-plugin-api'; import appPlugin from '@backstage/plugin-app'; @@ -136,7 +136,6 @@ export function renderInTestApp( ): RenderResult { const extensions: Array = [ createExtension({ - namespace: 'test', attachTo: { id: 'app/routes', input: 'routes' }, output: [coreExtensionData.reactElement, coreExtensionData.routePath], factory: () => { @@ -147,7 +146,6 @@ export function renderInTestApp( }, }), RouterBlueprint.make({ - namespace: 'test', params: { Component: ({ children }) => {children}, }, @@ -182,10 +180,11 @@ export function renderInTestApp( } const features: FrontendFeature[] = [ - appPluginOverride, - createExtensionOverrides({ + createFrontendPlugin({ + id: 'test', extensions, }), + appPluginOverride, ]; if (options?.features) { diff --git a/plugins/app/api-report.md b/plugins/app/api-report.md index fbf77debb4..6f2e6e0463 100644 --- a/plugins/app/api-report.md +++ b/plugins/app/api-report.md @@ -29,30 +29,6 @@ const appPlugin: FrontendPlugin< {}, {}, { - [x: `component:app/${string}`]: ExtensionDefinition<{ - config: {}; - configInput: {}; - output: ConfigurableExtensionDataRef< - { - ref: ComponentRef; - impl: ComponentType; - }, - 'core.component.component', - {} - >; - inputs: { - [x: string]: ExtensionInput< - AnyExtensionDataRef, - { - optional: boolean; - singleton: boolean; - } - >; - }; - kind: 'component'; - namespace: string; - name: string; - }>; app: ExtensionDefinition<{ config: {}; configInput: {}; diff --git a/plugins/search-react/src/alpha/blueprints/SearchResultListItemBlueprint.test.tsx b/plugins/search-react/src/alpha/blueprints/SearchResultListItemBlueprint.test.tsx index b50ca9e55a..6b8f75d70c 100644 --- a/plugins/search-react/src/alpha/blueprints/SearchResultListItemBlueprint.test.tsx +++ b/plugins/search-react/src/alpha/blueprints/SearchResultListItemBlueprint.test.tsx @@ -87,7 +87,7 @@ describe('SearchResultListItemBlueprint', () => { }); const mockSearchPage = PageBlueprint.makeWithOverrides({ - namespace: 'search', + name: 'search', inputs: { items: createExtensionInput([searchResultListItemDataRef]), },