Incorporated the feedback.
Signed-off-by: bnechyporenko <bnechyporenko@bol.com>
This commit is contained in:
@@ -50,7 +50,7 @@ export function createApp(
|
||||
...icons,
|
||||
...options?.icons,
|
||||
},
|
||||
plugins: (options?.plugins as BackstagePlugin<any, any, any>[]) ?? [],
|
||||
plugins: (options?.plugins as BackstagePlugin[]) ?? [],
|
||||
themes: options?.themes ?? themes,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ export type AppConfigLoader = () => Promise<AppConfig[]>;
|
||||
|
||||
// @public
|
||||
export type AppContext = {
|
||||
getPlugins(): BackstagePlugin<any, any, any>[];
|
||||
getPlugins(): BackstagePlugin[];
|
||||
getSystemIcon(key: string): IconComponent | undefined;
|
||||
getComponents(): AppComponents;
|
||||
};
|
||||
@@ -254,7 +254,7 @@ export type AuthApiCreateOptions = {
|
||||
|
||||
// @public
|
||||
export type BackstageApp = {
|
||||
getPlugins(): BackstagePlugin<any, any, any>[];
|
||||
getPlugins(): BackstagePlugin[];
|
||||
getSystemIcon(key: string): IconComponent | undefined;
|
||||
getProvider(): ComponentType<{}>;
|
||||
getRouter(): ComponentType<{}>;
|
||||
|
||||
@@ -82,8 +82,8 @@ import { resolveRouteBindings } from './resolveRouteBindings';
|
||||
import { BackstageRouteObject } from '../routing/types';
|
||||
|
||||
type CompatiblePlugin =
|
||||
| BackstagePlugin<any, any, any>
|
||||
| (Omit<BackstagePlugin<any, any, any>, 'getFeatureFlags'> & {
|
||||
| BackstagePlugin
|
||||
| (Omit<BackstagePlugin, 'getFeatureFlags'> & {
|
||||
output(): Array<{ type: 'feature-flag'; name: string }>;
|
||||
});
|
||||
|
||||
@@ -145,7 +145,7 @@ function useConfigLoader(
|
||||
class AppContextImpl implements AppContext {
|
||||
constructor(private readonly app: AppManager) {}
|
||||
|
||||
getPlugins(): BackstagePlugin<any, any, any>[] {
|
||||
getPlugins(): BackstagePlugin[] {
|
||||
return this.app.getPlugins();
|
||||
}
|
||||
|
||||
@@ -186,8 +186,8 @@ export class AppManager implements BackstageApp {
|
||||
this.apiFactoryRegistry = new ApiFactoryRegistry();
|
||||
}
|
||||
|
||||
getPlugins(): BackstagePlugin<any, any, any>[] {
|
||||
return Array.from(this.plugins) as BackstagePlugin<any, any, any>[];
|
||||
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<BackstagePlugin<any, any, any>>,
|
||||
this.plugins as Iterable<BackstagePlugin>,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -291,7 +291,7 @@ export type BackstageApp = {
|
||||
/**
|
||||
* Returns all plugins registered for the app.
|
||||
*/
|
||||
getPlugins(): BackstagePlugin<any, any, any>[];
|
||||
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<any, any, any>[];
|
||||
getPlugins(): BackstagePlugin[];
|
||||
|
||||
/**
|
||||
* Get a common or custom icon for this app.
|
||||
|
||||
@@ -18,12 +18,9 @@ import { BackstagePlugin, getComponentData } from '@backstage/core-plugin-api';
|
||||
import { createCollector } from '../extensions/traversal';
|
||||
|
||||
export const pluginCollector = createCollector(
|
||||
() => new Set<BackstagePlugin<any, any, any>>(),
|
||||
() => new Set<BackstagePlugin>(),
|
||||
(acc, node) => {
|
||||
const plugin = getComponentData<BackstagePlugin<any, any, any>>(
|
||||
node,
|
||||
'core.plugin',
|
||||
);
|
||||
const plugin = getComponentData<BackstagePlugin>(node, 'core.plugin');
|
||||
if (plugin) {
|
||||
acc.add(plugin);
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ export type AppComponents = {
|
||||
|
||||
// @public
|
||||
export type AppContext = {
|
||||
getPlugins(): BackstagePlugin_2<any, any, any>[];
|
||||
getPlugins(): BackstagePlugin_2[];
|
||||
getSystemIcon(key: string): IconComponent_2 | undefined;
|
||||
getComponents(): AppComponents;
|
||||
};
|
||||
@@ -404,7 +404,7 @@ export type ErrorBoundaryFallbackProps = {
|
||||
|
||||
// @public
|
||||
export type Extension<T> = {
|
||||
expose(plugin: BackstagePlugin<any, any, any>): T;
|
||||
expose(plugin: BackstagePlugin): T;
|
||||
};
|
||||
|
||||
// @public
|
||||
@@ -639,7 +639,7 @@ export type PluginFeatureFlagConfig = {
|
||||
name: string;
|
||||
};
|
||||
|
||||
// @public
|
||||
// @alpha
|
||||
export interface PluginOptionsProviderProps {
|
||||
// (undocumented)
|
||||
children: ReactNode;
|
||||
|
||||
@@ -226,7 +226,7 @@ export function createReactExtension<
|
||||
'Component';
|
||||
|
||||
return {
|
||||
expose(plugin: BackstagePlugin<any, any, any>) {
|
||||
expose(plugin: BackstagePlugin) {
|
||||
const Result: any = (props: any) => {
|
||||
const app = useApp();
|
||||
const { Progress } = app.getComponents();
|
||||
|
||||
@@ -27,7 +27,7 @@ const contextKey: string = 'plugin-context';
|
||||
/**
|
||||
* Properties for the PluginProvider component.
|
||||
*
|
||||
* @public
|
||||
* @alpha
|
||||
*/
|
||||
export interface PluginOptionsProviderProps {
|
||||
children: ReactNode;
|
||||
@@ -44,7 +44,7 @@ export const PluginProvider = ({
|
||||
plugin,
|
||||
}: PluginOptionsProviderProps): JSX.Element => {
|
||||
const { Provider } = createVersionedContext<{
|
||||
1: { plugin: BackstagePlugin<any, any, any> | undefined };
|
||||
1: { plugin: BackstagePlugin | undefined };
|
||||
}>(contextKey);
|
||||
|
||||
return (
|
||||
|
||||
@@ -27,7 +27,7 @@ import { AnyApiFactory } from '../apis';
|
||||
* @public
|
||||
*/
|
||||
export type Extension<T> = {
|
||||
expose(plugin: BackstagePlugin<any, any, any>): T;
|
||||
expose(plugin: BackstagePlugin): T;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user