From 6a75e00b1410ccc702c5d9928c584836a900fbd4 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Fri, 1 Aug 2025 11:52:48 +0200 Subject: [PATCH] frontend-plugin-api: remove deprecated variant of createFrontendPlugin Signed-off-by: Patrik Oldsberg --- .changeset/eight-sloths-walk.md | 5 +++ packages/frontend-plugin-api/report.api.md | 23 ---------- .../src/wiring/createFrontendPlugin.test.ts | 7 --- .../src/wiring/createFrontendPlugin.ts | 44 +------------------ 4 files changed, 7 insertions(+), 72 deletions(-) create mode 100644 .changeset/eight-sloths-walk.md diff --git a/.changeset/eight-sloths-walk.md b/.changeset/eight-sloths-walk.md new file mode 100644 index 0000000000..666069ce8b --- /dev/null +++ b/.changeset/eight-sloths-walk.md @@ -0,0 +1,5 @@ +--- +'@backstage/frontend-plugin-api': minor +--- + +**BREAKING**: Removed the deprecated `createFrontendPlugin` variant where the plugin ID is passed via an `id` option. To update existing code, switch to using the `pluginId` option instead. diff --git a/packages/frontend-plugin-api/report.api.md b/packages/frontend-plugin-api/report.api.md index cc2f87112a..ae32fd0f50 100644 --- a/packages/frontend-plugin-api/report.api.md +++ b/packages/frontend-plugin-api/report.api.md @@ -817,29 +817,6 @@ export function createFrontendPlugin< MakeSortedExtensionsMap >; -// @public @deprecated (undocumented) -export function createFrontendPlugin< - TId extends string, - TRoutes extends { - [name in string]: RouteRef | SubRouteRef; - } = {}, - TExternalRoutes extends { - [name in string]: ExternalRouteRef; - } = {}, - TExtensions extends readonly ExtensionDefinition[] = [], ->( - options: Omit< - PluginOptions, - 'pluginId' - > & { - id: string; - }, -): FrontendPlugin< - TRoutes, - TExternalRoutes, - MakeSortedExtensionsMap ->; - // @public export function createRouteRef< TParams extends diff --git a/packages/frontend-plugin-api/src/wiring/createFrontendPlugin.test.ts b/packages/frontend-plugin-api/src/wiring/createFrontendPlugin.test.ts index c97c60e89e..46709c9e56 100644 --- a/packages/frontend-plugin-api/src/wiring/createFrontendPlugin.test.ts +++ b/packages/frontend-plugin-api/src/wiring/createFrontendPlugin.test.ts @@ -140,13 +140,6 @@ describe('createFrontendPlugin', () => { expect(String(plugin)).toBe('Plugin{id=test}'); }); - it('should create an empty plugin with deprecated id option', () => { - const plugin = createFrontendPlugin({ id: 'test' }); - - expect(plugin).toBeDefined(); - expect(String(plugin)).toBe('Plugin{id=test}'); - }); - it('should create a plugin with extension instances', async () => { const plugin = createFrontendPlugin({ pluginId: 'test', diff --git a/packages/frontend-plugin-api/src/wiring/createFrontendPlugin.ts b/packages/frontend-plugin-api/src/wiring/createFrontendPlugin.ts index e7a4fabaf9..f0d923d3f9 100644 --- a/packages/frontend-plugin-api/src/wiring/createFrontendPlugin.ts +++ b/packages/frontend-plugin-api/src/wiring/createFrontendPlugin.ts @@ -147,49 +147,9 @@ export function createFrontendPlugin< TRoutes, TExternalRoutes, MakeSortedExtensionsMap ->; -/** - * @public - * @deprecated The `id` option is deprecated, use `pluginId` instead. - */ -export function createFrontendPlugin< - TId extends string, - TRoutes extends { [name in string]: RouteRef | SubRouteRef } = {}, - TExternalRoutes extends { [name in string]: ExternalRouteRef } = {}, - TExtensions extends readonly ExtensionDefinition[] = [], ->( - options: Omit< - PluginOptions, - 'pluginId' - > & { id: string }, -): FrontendPlugin< - TRoutes, - TExternalRoutes, - MakeSortedExtensionsMap ->; -export function createFrontendPlugin< - TId extends string, - TRoutes extends { [name in string]: RouteRef | SubRouteRef } = {}, - TExternalRoutes extends { [name in string]: ExternalRouteRef } = {}, - TExtensions extends readonly ExtensionDefinition[] = [], ->( - options: - | PluginOptions - | (Omit< - PluginOptions, - 'pluginId' - > & { id: string }), -): FrontendPlugin< - TRoutes, - TExternalRoutes, - MakeSortedExtensionsMap > { - const pluginId = 'pluginId' in options ? options.pluginId : options.id; - if (!pluginId) { - throw new Error( - "Either 'id' or 'pluginId' must be provided to createFrontendPlugin", - ); - } + const pluginId = options.pluginId; + const extensions = new Array>(); const extensionDefinitionsById = new Map< string,