@@ -4,4 +4,4 @@
|
||||
|
||||
Added `createFrontendModule` as a replacement for `createExtensionOverrides`, which is now deprecated.
|
||||
|
||||
Deprecated the `BackstagePlugin` type in favor of `FrontendPlugin`.
|
||||
Deprecated the `BackstagePlugin` and `FrontendFeature` type in favor of `FrontendPlugin` and `FrontendFeature` from `@backstage/frontend-app-api` respectively.
|
||||
|
||||
@@ -12,9 +12,10 @@ 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 { FrontendFeature } from '@backstage/frontend-plugin-api';
|
||||
import { FrontendPlugin } from '@backstage/frontend-plugin-api';
|
||||
import { default as React_2 } from 'react';
|
||||
import { ReactNode } from 'react';
|
||||
import { RouteRef } from '@backstage/core-plugin-api';
|
||||
@@ -28,7 +29,7 @@ export function compatWrapper(element: ReactNode): React_2.JSX.Element;
|
||||
// @public (undocumented)
|
||||
export function convertLegacyApp(
|
||||
rootElement: React_2.JSX.Element,
|
||||
): FrontendFeature[];
|
||||
): (FrontendPlugin | ExtensionOverrides)[];
|
||||
|
||||
// @public (undocumented)
|
||||
export function convertLegacyPageExtension(
|
||||
|
||||
@@ -268,7 +268,10 @@ export function collectLegacyRoutes(
|
||||
extensions: [
|
||||
...extensions,
|
||||
...Array.from(plugin.getApis()).map(factory =>
|
||||
ApiBlueprint.make({ namespace: factory.api.id, params: { factory } }),
|
||||
ApiBlueprint.make({
|
||||
namespace: factory.api.id,
|
||||
params: { factory },
|
||||
}),
|
||||
),
|
||||
],
|
||||
routes: convertLegacyRouteRefs(plugin.routes ?? {}),
|
||||
|
||||
@@ -22,7 +22,8 @@ import React, {
|
||||
isValidElement,
|
||||
} from 'react';
|
||||
import {
|
||||
FrontendFeature,
|
||||
ExtensionOverrides,
|
||||
FrontendPlugin,
|
||||
coreExtensionData,
|
||||
createExtension,
|
||||
createExtensionInput,
|
||||
@@ -60,7 +61,7 @@ function selectChildren(
|
||||
/** @public */
|
||||
export function convertLegacyApp(
|
||||
rootElement: React.JSX.Element,
|
||||
): FrontendFeature[] {
|
||||
): (FrontendPlugin | ExtensionOverrides)[] {
|
||||
if (getComponentData(rootElement, 'core.type') === 'FlatRoutes') {
|
||||
return collectLegacyRoutes(rootElement);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
```ts
|
||||
import { ConfigApi } from '@backstage/core-plugin-api';
|
||||
import { ExternalRouteRef } from '@backstage/frontend-plugin-api';
|
||||
import { FrontendFeature } from '@backstage/frontend-plugin-api';
|
||||
import { FrontendModule } from '@backstage/frontend-plugin-api';
|
||||
import { FrontendPlugin } from '@backstage/frontend-plugin-api';
|
||||
import { JSX as JSX_2 } from 'react';
|
||||
import { ReactNode } from 'react';
|
||||
import { RouteRef } from '@backstage/frontend-plugin-api';
|
||||
@@ -52,4 +53,15 @@ export function createSpecializedApp(options?: {
|
||||
}): {
|
||||
createRoot(): JSX_2.Element;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type FrontendFeature =
|
||||
| FrontendPlugin
|
||||
| FrontendModule
|
||||
| {
|
||||
$$type: '@backstage/ExtensionOverrides';
|
||||
}
|
||||
| {
|
||||
$$type: '@backstage/BackstagePlugin';
|
||||
};
|
||||
```
|
||||
|
||||
@@ -18,7 +18,6 @@ import {
|
||||
RouteRef,
|
||||
SubRouteRef,
|
||||
ExternalRouteRef,
|
||||
FrontendFeature,
|
||||
} from '@backstage/frontend-plugin-api';
|
||||
// eslint-disable-next-line @backstage/no-relative-monorepo-imports
|
||||
import {
|
||||
@@ -31,6 +30,7 @@ import { toInternalExternalRouteRef } from '../../../frontend-plugin-api/src/rou
|
||||
import { toInternalSubRouteRef } from '../../../frontend-plugin-api/src/routing/SubRouteRef';
|
||||
// eslint-disable-next-line @backstage/no-relative-monorepo-imports
|
||||
import { isInternalFrontendPlugin } from '../../../frontend-plugin-api/src/wiring/createFrontendPlugin';
|
||||
import { FrontendFeature } from '../wiring';
|
||||
|
||||
/** @internal */
|
||||
export interface RouteRefsById {
|
||||
|
||||
@@ -14,11 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {
|
||||
Extension,
|
||||
ExtensionOverrides,
|
||||
FrontendFeature,
|
||||
} from '@backstage/frontend-plugin-api';
|
||||
import { Extension, ExtensionOverrides } from '@backstage/frontend-plugin-api';
|
||||
// eslint-disable-next-line @backstage/no-relative-monorepo-imports
|
||||
import { toInternalExtensionOverrides } from '../../../frontend-plugin-api/src/wiring/createExtensionOverrides';
|
||||
import { ExtensionParameters } from './readAppExtensionsConfig';
|
||||
@@ -30,6 +26,7 @@ import {
|
||||
} from '../../../frontend-plugin-api/src/wiring/createFrontendPlugin';
|
||||
// eslint-disable-next-line @backstage/no-relative-monorepo-imports
|
||||
import { toInternalExtension } from '../../../frontend-plugin-api/src/wiring/resolveExtensionDefinition';
|
||||
import { FrontendFeature } from '../wiring';
|
||||
|
||||
/** @internal */
|
||||
export function resolveAppNodeSpecs(options: {
|
||||
|
||||
@@ -22,7 +22,6 @@ import {
|
||||
AppTreeApi,
|
||||
appTreeApiRef,
|
||||
coreExtensionData,
|
||||
FrontendFeature,
|
||||
RouteRef,
|
||||
ExternalRouteRef,
|
||||
SubRouteRef,
|
||||
@@ -85,6 +84,7 @@ import { ApiRegistry } from '../../../core-app-api/src/apis/system/ApiRegistry';
|
||||
import { AppIdentityProxy } from '../../../core-app-api/src/apis/implementations/IdentityApi/AppIdentityProxy';
|
||||
import { BackstageRouteObject } from '../routing/types';
|
||||
import appPlugin from '@backstage/plugin-app';
|
||||
import { FrontendFeature } from './types';
|
||||
|
||||
function deduplicateFeatures(
|
||||
allFeatures: FrontendFeature[],
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import { Config, ConfigReader } from '@backstage/config';
|
||||
import { FrontendFeature } from '@backstage/frontend-plugin-api';
|
||||
import { FrontendFeature } from '@backstage/frontend-app-api';
|
||||
|
||||
interface DiscoveryGlobal {
|
||||
modules: Array<{ name: string; export?: string; default: unknown }>;
|
||||
|
||||
@@ -19,3 +19,4 @@ export {
|
||||
createSpecializedApp,
|
||||
type CreateAppFeatureLoader,
|
||||
} from './createApp';
|
||||
export * from './types';
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright 2024 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { FrontendModule, FrontendPlugin } from '@backstage/frontend-plugin-api';
|
||||
|
||||
/** @public */
|
||||
export type FrontendFeature =
|
||||
| FrontendPlugin
|
||||
| FrontendModule
|
||||
// TODO(blam): This is just forwards backwards compatibility, remove after v1.31.0
|
||||
| { $$type: '@backstage/ExtensionOverrides' }
|
||||
| { $$type: '@backstage/BackstagePlugin' };
|
||||
@@ -749,7 +749,20 @@ export function createExternalRouteRef<
|
||||
export function createFrontendModule<
|
||||
TId extends string,
|
||||
TExtensions extends readonly ExtensionDefinition[] = [],
|
||||
>(options: FrontendModuleOptions<TId, TExtensions>): FrontendModule;
|
||||
>(options: CreateFrontendModuleOptions<TId, TExtensions>): FrontendModule;
|
||||
|
||||
// @public (undocumented)
|
||||
export interface CreateFrontendModuleOptions<
|
||||
TPluginId extends string,
|
||||
TExtensions extends readonly ExtensionDefinition[],
|
||||
> {
|
||||
// (undocumented)
|
||||
extensions?: TExtensions;
|
||||
// (undocumented)
|
||||
featureFlags?: FeatureFlagConfig[];
|
||||
// (undocumented)
|
||||
pluginId: TPluginId;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export function createFrontendPlugin<
|
||||
@@ -1232,11 +1245,8 @@ export { FetchApi };
|
||||
|
||||
export { fetchApiRef };
|
||||
|
||||
// @public (undocumented)
|
||||
export type FrontendFeature =
|
||||
| FrontendPlugin
|
||||
| FrontendModule
|
||||
| ExtensionOverrides;
|
||||
// @public @deprecated (undocumented)
|
||||
export type FrontendFeature = FrontendPlugin | ExtensionOverrides;
|
||||
|
||||
// @public (undocumented)
|
||||
export interface FrontendModule {
|
||||
@@ -1246,19 +1256,6 @@ export interface FrontendModule {
|
||||
readonly pluginId: string;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export interface FrontendModuleOptions<
|
||||
TPluginId extends string,
|
||||
TExtensions extends readonly ExtensionDefinition[],
|
||||
> {
|
||||
// (undocumented)
|
||||
extensions?: TExtensions;
|
||||
// (undocumented)
|
||||
featureFlags?: FeatureFlagConfig[];
|
||||
// (undocumented)
|
||||
pluginId: TPluginId;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export interface FrontendPlugin<
|
||||
TRoutes extends AnyRoutes = AnyRoutes,
|
||||
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
import { FeatureFlagConfig } from './types';
|
||||
|
||||
/** @public */
|
||||
export interface FrontendModuleOptions<
|
||||
export interface CreateFrontendModuleOptions<
|
||||
TPluginId extends string,
|
||||
TExtensions extends readonly ExtensionDefinition[],
|
||||
> {
|
||||
@@ -52,7 +52,7 @@ export interface InternalFrontendModule extends FrontendModule {
|
||||
export function createFrontendModule<
|
||||
TId extends string,
|
||||
TExtensions extends readonly ExtensionDefinition[] = [],
|
||||
>(options: FrontendModuleOptions<TId, TExtensions>): FrontendModule {
|
||||
>(options: CreateFrontendModuleOptions<TId, TExtensions>): FrontendModule {
|
||||
const { pluginId } = options;
|
||||
|
||||
const extensions = new Array<Extension<any>>();
|
||||
|
||||
@@ -51,7 +51,6 @@ export type BackstagePlugin<
|
||||
TExternalRoutes extends AnyExternalRoutes = AnyExternalRoutes,
|
||||
TExtensionMap extends { [id in string]: ExtensionDefinition } = {},
|
||||
> = FrontendPlugin<TRoutes, TExternalRoutes, TExtensionMap>;
|
||||
|
||||
/** @public */
|
||||
export interface PluginOptions<
|
||||
TId extends string,
|
||||
|
||||
@@ -46,7 +46,7 @@ export {
|
||||
export {
|
||||
createFrontendModule,
|
||||
type FrontendModule,
|
||||
type FrontendModuleOptions,
|
||||
type CreateFrontendModuleOptions,
|
||||
} from './createFrontendModule';
|
||||
export {
|
||||
createExtensionOverrides,
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
import { ExternalRouteRef, RouteRef, SubRouteRef } from '../routing';
|
||||
import { ExtensionDefinition } from './createExtension';
|
||||
import { FrontendModule } from './createFrontendModule';
|
||||
import { FrontendPlugin } from './createFrontendPlugin';
|
||||
|
||||
/**
|
||||
@@ -47,8 +46,8 @@ export interface ExtensionOverrides {
|
||||
readonly $$type: '@backstage/ExtensionOverrides';
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export type FrontendFeature =
|
||||
| FrontendPlugin
|
||||
| FrontendModule
|
||||
| ExtensionOverrides;
|
||||
/**
|
||||
* @public
|
||||
* @deprecated import from {@link @backstage/frontend-app-api#FrontendFeature} instead
|
||||
*/
|
||||
export type FrontendFeature = FrontendPlugin | ExtensionOverrides;
|
||||
|
||||
@@ -14,7 +14,7 @@ import { ErrorWithContext } from '@backstage/test-utils';
|
||||
import { ExtensionDataRef } from '@backstage/frontend-plugin-api';
|
||||
import { ExtensionDefinition } from '@backstage/frontend-plugin-api';
|
||||
import { ExtensionDefinitionParameters } from '@backstage/frontend-plugin-api';
|
||||
import { FrontendFeature } from '@backstage/frontend-plugin-api';
|
||||
import { FrontendFeature } from '@backstage/frontend-app-api';
|
||||
import { JsonObject } from '@backstage/types';
|
||||
import { MockConfigApi } from '@backstage/test-utils';
|
||||
import { MockErrorApi } from '@backstage/test-utils';
|
||||
|
||||
@@ -16,7 +16,10 @@
|
||||
|
||||
import React from 'react';
|
||||
import { Link, MemoryRouter } from 'react-router-dom';
|
||||
import { createSpecializedApp } from '@backstage/frontend-app-api';
|
||||
import {
|
||||
createSpecializedApp,
|
||||
FrontendFeature,
|
||||
} from '@backstage/frontend-app-api';
|
||||
import { RenderResult, render } from '@testing-library/react';
|
||||
import { ConfigReader } from '@backstage/config';
|
||||
import { JsonObject } from '@backstage/types';
|
||||
@@ -30,7 +33,6 @@ import {
|
||||
IconComponent,
|
||||
RouterBlueprint,
|
||||
NavItemBlueprint,
|
||||
FrontendFeature,
|
||||
} from '@backstage/frontend-plugin-api';
|
||||
import appPlugin from '@backstage/plugin-app';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user