core-plugin-api: allow unknown plugin outputs for backwards compatibility
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -35,6 +35,7 @@ import {
|
||||
BootErrorPageProps,
|
||||
ErrorBoundaryFallbackProps,
|
||||
} from './types';
|
||||
import { BackstagePlugin } from '@backstage/core-plugin-api';
|
||||
|
||||
/**
|
||||
* The default config loader, which expects that config is available at compile-time
|
||||
@@ -171,7 +172,7 @@ export function createApp(options?: AppOptions) {
|
||||
return new PrivateAppImpl({
|
||||
apis,
|
||||
icons,
|
||||
plugins,
|
||||
plugins: plugins as BackstagePlugin<any, any>[],
|
||||
components,
|
||||
themes,
|
||||
configLoader,
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
RouteRef,
|
||||
SubRouteRef,
|
||||
ExternalRouteRef,
|
||||
PluginOutput,
|
||||
} from '@backstage/core-plugin-api';
|
||||
import { AppConfig } from '@backstage/config';
|
||||
import { AppIcons } from './icons';
|
||||
@@ -131,6 +132,21 @@ export type AppRouteBinder = <
|
||||
>,
|
||||
) => void;
|
||||
|
||||
// Output from newer or older plugin API versions that might not be supported by
|
||||
// this version of the app API, but we don't want to break at the type checking level.
|
||||
// We only use this more permissive type for the `createApp` options, as we otherwise
|
||||
// want to stick to using the type for the outputs that we know about in this version
|
||||
// of the app api.
|
||||
type UnknownPluginOutput = {
|
||||
type: string;
|
||||
};
|
||||
export type BackstagePluginWithAnyOutput = Omit<
|
||||
BackstagePlugin<any, any>,
|
||||
'output'
|
||||
> & {
|
||||
output(): (PluginOutput | UnknownPluginOutput)[];
|
||||
};
|
||||
|
||||
export type AppOptions = {
|
||||
/**
|
||||
* A collection of ApiFactories to register in the application to either
|
||||
@@ -146,7 +162,7 @@ export type AppOptions = {
|
||||
/**
|
||||
* A list of all plugins to include in the app.
|
||||
*/
|
||||
plugins?: BackstagePlugin<any, any>[];
|
||||
plugins?: BackstagePluginWithAnyOutput[];
|
||||
|
||||
/**
|
||||
* Supply components to the app to override the default ones.
|
||||
|
||||
Reference in New Issue
Block a user