Merge pull request #33148 from backstage/rugvip/move-extensionFactoryMiddleware-to-frontend-app-api

Move `ExtensionFactoryMiddleware` from frontend-plugin-api to frontend-app-api
This commit is contained in:
Patrik Oldsberg
2026-03-05 13:56:01 +01:00
committed by GitHub
12 changed files with 73 additions and 8 deletions
@@ -0,0 +1,5 @@
---
'@backstage/frontend-app-api': patch
---
Added the `ExtensionFactoryMiddleware` type as a public export.
@@ -0,0 +1,5 @@
---
'@backstage/frontend-plugin-api': patch
---
Deprecated the `ExtensionFactoryMiddleware` type, which has been moved to `@backstage/frontend-app-api`.
+16 -1
View File
@@ -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';
@@ -176,6 +179,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>>;
+1 -1
View File
@@ -8,7 +8,7 @@ import { AppErrorTypes } from '@backstage/frontend-app-api';
import { Config } from '@backstage/config';
import { ConfigApi } from '@backstage/frontend-plugin-api';
import { CreateAppRouteBinder } from '@backstage/frontend-app-api';
import { ExtensionFactoryMiddleware } from '@backstage/frontend-plugin-api';
import { ExtensionFactoryMiddleware } from '@backstage/frontend-app-api';
import { FrontendFeature } from '@backstage/frontend-plugin-api';
import { FrontendFeatureLoader } from '@backstage/frontend-plugin-api';
import { FrontendPluginInfoResolver } from '@backstage/frontend-app-api';
+1 -1
View File
@@ -18,7 +18,6 @@ import { JSX, lazy, ReactNode, Suspense } from 'react';
import {
ConfigApi,
coreExtensionData,
ExtensionFactoryMiddleware,
FrontendFeature,
FrontendFeatureLoader,
} from '@backstage/frontend-plugin-api';
@@ -31,6 +30,7 @@ import { ConfigReader } from '@backstage/config';
import {
CreateAppRouteBinder,
createSpecializedApp,
ExtensionFactoryMiddleware,
FrontendPluginInfoResolver,
} from '@backstage/frontend-app-api';
import appPlugin from '@backstage/plugin-app';
+1 -1
View File
@@ -1215,7 +1215,7 @@ export type ExtensionDefinitionParameters = {
params?: object | ExtensionBlueprintDefineParams;
};
// @public (undocumented)
// @public @deprecated (undocumented)
export type ExtensionFactoryMiddleware = (
originalFactory: (contextOverrides?: {
config?: JsonObject;
@@ -60,7 +60,10 @@ export type ExtensionDataContainer<UExtensionData extends ExtensionDataRef> =
: never;
};
/** @public */
/**
* @public
* @deprecated Moved to {@link @backstage/frontend-app-api#ExtensionFactoryMiddleware}
*/
export type ExtensionFactoryMiddleware = (
originalFactory: (contextOverrides?: {
config?: JsonObject;