Move ExtensionFactoryMiddleware from frontend-plugin-api to frontend-app-api
The `ExtensionFactoryMiddleware` type is only used by the app-level wiring and has been moved to `@backstage/frontend-app-api` as its canonical location. The type is preserved in `@backstage/frontend-plugin-api` with a `@deprecated` tag pointing to the new location. All internal usages have been updated to import from the new location. Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com> Made-with: Cursor
This commit is contained in:
@@ -4,10 +4,13 @@
|
||||
|
||||
```ts
|
||||
import { ApiHolder } from '@backstage/core-plugin-api';
|
||||
import { ApiHolder as ApiHolder_2 } from '@backstage/frontend-plugin-api';
|
||||
import { AppNode } from '@backstage/frontend-plugin-api';
|
||||
import { AppTree } from '@backstage/frontend-plugin-api';
|
||||
import { ConfigApi } from '@backstage/core-plugin-api';
|
||||
import { ExtensionFactoryMiddleware } from '@backstage/frontend-plugin-api';
|
||||
import { ExtensionDataContainer } from '@backstage/frontend-plugin-api';
|
||||
import { ExtensionDataRef } from '@backstage/frontend-plugin-api';
|
||||
import { ExtensionDataValue } from '@backstage/frontend-plugin-api';
|
||||
import { ExternalRouteRef } from '@backstage/frontend-plugin-api';
|
||||
import { FrontendFeature } from '@backstage/frontend-plugin-api';
|
||||
import { FrontendPlugin } from '@backstage/frontend-plugin-api';
|
||||
@@ -177,6 +180,18 @@ export type CreateSpecializedAppOptions = {
|
||||
};
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type ExtensionFactoryMiddleware = (
|
||||
originalFactory: (contextOverrides?: {
|
||||
config?: JsonObject;
|
||||
}) => ExtensionDataContainer<ExtensionDataRef>,
|
||||
context: {
|
||||
node: AppNode;
|
||||
apis: ApiHolder_2;
|
||||
config?: JsonObject;
|
||||
},
|
||||
) => Iterable<ExtensionDataValue<any, any>>;
|
||||
|
||||
// @public
|
||||
export type FrontendPluginInfoResolver = (ctx: {
|
||||
packageJson(): Promise<JsonObject | undefined>;
|
||||
|
||||
@@ -19,7 +19,6 @@ import {
|
||||
Extension,
|
||||
ExtensionDataRef,
|
||||
ExtensionDefinition,
|
||||
ExtensionFactoryMiddleware,
|
||||
ExtensionInput,
|
||||
PortableSchema,
|
||||
ResolvedExtensionInput,
|
||||
@@ -29,6 +28,7 @@ import {
|
||||
createExtensionInput,
|
||||
createFrontendPlugin,
|
||||
} from '@backstage/frontend-plugin-api';
|
||||
import { ExtensionFactoryMiddleware } from '../wiring/types';
|
||||
import {
|
||||
createAppNodeInstance,
|
||||
instantiateAppNodeTree,
|
||||
|
||||
@@ -18,10 +18,10 @@ import {
|
||||
ApiHolder,
|
||||
ExtensionDataContainer,
|
||||
ExtensionDataRef,
|
||||
ExtensionFactoryMiddleware,
|
||||
ExtensionInput,
|
||||
ResolvedExtensionInputs,
|
||||
} from '@backstage/frontend-plugin-api';
|
||||
import { ExtensionFactoryMiddleware } from '../wiring/types';
|
||||
import mapValues from 'lodash/mapValues';
|
||||
import { AppNode, AppNodeInstance } from '@backstage/frontend-plugin-api';
|
||||
// eslint-disable-next-line @backstage/no-relative-monorepo-imports
|
||||
|
||||
@@ -29,9 +29,9 @@ import {
|
||||
createApiFactory,
|
||||
routeResolutionApiRef,
|
||||
AppNode,
|
||||
ExtensionFactoryMiddleware,
|
||||
FrontendFeature,
|
||||
} from '@backstage/frontend-plugin-api';
|
||||
import { ExtensionFactoryMiddleware } from './types';
|
||||
import {
|
||||
AnyApiFactory,
|
||||
ApiHolder,
|
||||
|
||||
@@ -20,3 +20,4 @@ export {
|
||||
} from './createSpecializedApp';
|
||||
export { type FrontendPluginInfoResolver } from './createPluginInfoAttacher';
|
||||
export { type AppError, type AppErrorTypes } from './createErrorCollector';
|
||||
export { type ExtensionFactoryMiddleware } from './types';
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2025 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 { JsonObject } from '@backstage/types';
|
||||
import {
|
||||
ApiHolder,
|
||||
AppNode,
|
||||
ExtensionDataContainer,
|
||||
ExtensionDataRef,
|
||||
ExtensionDataValue,
|
||||
} from '@backstage/frontend-plugin-api';
|
||||
|
||||
/** @public */
|
||||
export type ExtensionFactoryMiddleware = (
|
||||
originalFactory: (contextOverrides?: {
|
||||
config?: JsonObject;
|
||||
}) => ExtensionDataContainer<ExtensionDataRef>,
|
||||
context: {
|
||||
node: AppNode;
|
||||
apis: ApiHolder;
|
||||
config?: JsonObject;
|
||||
},
|
||||
) => Iterable<ExtensionDataValue<any, any>>;
|
||||
Reference in New Issue
Block a user