diff --git a/.changeset/little-guests-sell.md b/.changeset/little-guests-sell.md new file mode 100644 index 0000000000..91f578ee38 --- /dev/null +++ b/.changeset/little-guests-sell.md @@ -0,0 +1,7 @@ +--- +'@backstage/app-defaults': patch +'@backstage/core-app-api': patch +'@backstage/core-plugin-api': patch +--- + +Internal tweak removing usage of explicit type parameters for the `BackstagePlugin` type. diff --git a/docs/plugins/composability.md b/docs/plugins/composability.md index 1894ce0d0d..2ec9d7a6e5 100644 --- a/docs/plugins/composability.md +++ b/docs/plugins/composability.md @@ -74,7 +74,7 @@ The extension type is a simple one: ```ts export type Extension = { - expose(plugin: BackstagePlugin): T; + expose(plugin: BackstagePlugin): T; }; ``` diff --git a/packages/app-defaults/src/createApp.tsx b/packages/app-defaults/src/createApp.tsx index d85dfa04eb..9d0c01c633 100644 --- a/packages/app-defaults/src/createApp.tsx +++ b/packages/app-defaults/src/createApp.tsx @@ -50,7 +50,7 @@ export function createApp( ...icons, ...options?.icons, }, - plugins: (options?.plugins as BackstagePlugin[]) ?? [], + plugins: (options?.plugins as BackstagePlugin[]) ?? [], themes: options?.themes ?? themes, }); } diff --git a/packages/core-app-api/api-report.md b/packages/core-app-api/api-report.md index 116b33c598..beb0d11201 100644 --- a/packages/core-app-api/api-report.md +++ b/packages/core-app-api/api-report.md @@ -155,7 +155,7 @@ export type AppConfigLoader = () => Promise; // @public export type AppContext = { - getPlugins(): BackstagePlugin[]; + getPlugins(): BackstagePlugin[]; getSystemIcon(key: string): IconComponent | undefined; getComponents(): AppComponents; }; @@ -193,7 +193,7 @@ export type AppOptions = { [key in string]: IconComponent; }; plugins?: Array< - BackstagePlugin & { + BackstagePlugin & { output?(): Array< | { type: 'feature-flag'; @@ -254,7 +254,7 @@ export type AuthApiCreateOptions = { // @public export type BackstageApp = { - getPlugins(): BackstagePlugin[]; + getPlugins(): BackstagePlugin[]; getSystemIcon(key: string): IconComponent | undefined; getProvider(): ComponentType<{}>; getRouter(): ComponentType<{}>; diff --git a/packages/core-app-api/src/app/AppManager.tsx b/packages/core-app-api/src/app/AppManager.tsx index f47ddf676a..72c69f7da4 100644 --- a/packages/core-app-api/src/app/AppManager.tsx +++ b/packages/core-app-api/src/app/AppManager.tsx @@ -82,8 +82,8 @@ import { resolveRouteBindings } from './resolveRouteBindings'; import { BackstageRouteObject } from '../routing/types'; type CompatiblePlugin = - | BackstagePlugin - | (Omit, 'getFeatureFlags'> & { + | BackstagePlugin + | (Omit & { output(): Array<{ type: 'feature-flag'; name: string }>; }); @@ -145,7 +145,7 @@ function useConfigLoader( class AppContextImpl implements AppContext { constructor(private readonly app: AppManager) {} - getPlugins(): BackstagePlugin[] { + getPlugins(): BackstagePlugin[] { return this.app.getPlugins(); } @@ -186,8 +186,8 @@ export class AppManager implements BackstageApp { this.apiFactoryRegistry = new ApiFactoryRegistry(); } - getPlugins(): BackstagePlugin[] { - return Array.from(this.plugins) as BackstagePlugin[]; + getPlugins(): BackstagePlugin[] { + return Array.from(this.plugins) as BackstagePlugin[]; } getSystemIcon(key: string): IconComponent | undefined { @@ -241,7 +241,7 @@ export class AppManager implements BackstageApp { validateRouteParameters(routing.paths, routing.parents); validateRouteBindings( routeBindings, - this.plugins as Iterable>, + this.plugins as Iterable, ); } diff --git a/packages/core-app-api/src/app/types.ts b/packages/core-app-api/src/app/types.ts index ff7a43d0eb..979fb0496e 100644 --- a/packages/core-app-api/src/app/types.ts +++ b/packages/core-app-api/src/app/types.ts @@ -206,7 +206,7 @@ export type AppOptions = { * A list of all plugins to include in the app. */ plugins?: Array< - BackstagePlugin & { + BackstagePlugin & { output?(): Array< { type: 'feature-flag'; name: string } | { type: string } >; // support for old plugins @@ -291,7 +291,7 @@ export type BackstageApp = { /** * Returns all plugins registered for the app. */ - getPlugins(): BackstagePlugin[]; + getPlugins(): BackstagePlugin[]; /** * Get a common or custom icon for this app. @@ -321,7 +321,7 @@ export type AppContext = { /** * Get a list of all plugins that are installed in the app. */ - getPlugins(): BackstagePlugin[]; + getPlugins(): BackstagePlugin[]; /** * Get a common or custom icon for this app. diff --git a/packages/core-app-api/src/plugins/collectors.ts b/packages/core-app-api/src/plugins/collectors.ts index 0f8b65ad62..41b4b00ea3 100644 --- a/packages/core-app-api/src/plugins/collectors.ts +++ b/packages/core-app-api/src/plugins/collectors.ts @@ -18,12 +18,9 @@ import { BackstagePlugin, getComponentData } from '@backstage/core-plugin-api'; import { createCollector } from '../extensions/traversal'; export const pluginCollector = createCollector( - () => new Set>(), + () => new Set(), (acc, node) => { - const plugin = getComponentData>( - node, - 'core.plugin', - ); + const plugin = getComponentData(node, 'core.plugin'); if (plugin) { acc.add(plugin); } diff --git a/packages/core-plugin-api/api-report.md b/packages/core-plugin-api/api-report.md index 5c7e4c989e..1921c1b715 100644 --- a/packages/core-plugin-api/api-report.md +++ b/packages/core-plugin-api/api-report.md @@ -147,7 +147,7 @@ export type AppComponents = { // @public export type AppContext = { - getPlugins(): BackstagePlugin_2[]; + getPlugins(): BackstagePlugin_2[]; getSystemIcon(key: string): IconComponent_2 | undefined; getComponents(): AppComponents; }; @@ -401,7 +401,7 @@ export type ErrorBoundaryFallbackProps = { // @public export type Extension = { - expose(plugin: BackstagePlugin): T; + expose(plugin: BackstagePlugin): T; }; // @public diff --git a/packages/core-plugin-api/src/extensions/extensions.tsx b/packages/core-plugin-api/src/extensions/extensions.tsx index 19da082ee1..efc8e3525d 100644 --- a/packages/core-plugin-api/src/extensions/extensions.tsx +++ b/packages/core-plugin-api/src/extensions/extensions.tsx @@ -225,7 +225,7 @@ export function createReactExtension< 'Component'; return { - expose(plugin: BackstagePlugin) { + expose(plugin: BackstagePlugin) { const Result: any = (props: any) => { const app = useApp(); const { Progress } = app.getComponents(); diff --git a/packages/core-plugin-api/src/plugin/types.ts b/packages/core-plugin-api/src/plugin/types.ts index d639327838..d2dad6f639 100644 --- a/packages/core-plugin-api/src/plugin/types.ts +++ b/packages/core-plugin-api/src/plugin/types.ts @@ -27,7 +27,7 @@ import { AnyApiFactory } from '../apis/system'; * @public */ export type Extension = { - expose(plugin: BackstagePlugin): T; + expose(plugin: BackstagePlugin): T; }; /**