From 3d2499f0491f3f153b32858dcf3473b20c9bf1bd Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Fri, 1 Aug 2025 09:54:46 +0200 Subject: [PATCH] frontend-app-api: add CreateSpecializedAppOptions type Signed-off-by: Patrik Oldsberg --- .changeset/violet-weeks-trade.md | 5 +++++ packages/frontend-app-api/report.api.md | 11 ++++++---- .../src/wiring/createSpecializedApp.tsx | 20 ++++++++++++++----- packages/frontend-app-api/src/wiring/index.ts | 5 ++++- 4 files changed, 31 insertions(+), 10 deletions(-) create mode 100644 .changeset/violet-weeks-trade.md diff --git a/.changeset/violet-weeks-trade.md b/.changeset/violet-weeks-trade.md new file mode 100644 index 0000000000..32b425dbf2 --- /dev/null +++ b/.changeset/violet-weeks-trade.md @@ -0,0 +1,5 @@ +--- +'@backstage/frontend-app-api': patch +--- + +Moved `createSpecializedApp` options to a new `CreateSpecializedAppOptions` type. diff --git a/packages/frontend-app-api/report.api.md b/packages/frontend-app-api/report.api.md index 7228777561..f121640e0a 100644 --- a/packages/frontend-app-api/report.api.md +++ b/packages/frontend-app-api/report.api.md @@ -28,7 +28,13 @@ export type CreateAppRouteBinder = < ) => void; // @public -export function createSpecializedApp(options?: { +export function createSpecializedApp(options?: CreateSpecializedAppOptions): { + apis: ApiHolder; + tree: AppTree; +}; + +// @public +export type CreateSpecializedAppOptions = { features?: FrontendFeature_2[]; config?: ConfigApi; bindRoutes?(context: { bind: CreateAppRouteBinder }): void; @@ -40,9 +46,6 @@ export function createSpecializedApp(options?: { allowUnknownExtensionConfig?: boolean; }; pluginInfoResolver?: FrontendPluginInfoResolver; -}): { - apis: ApiHolder; - tree: AppTree; }; // @public @deprecated (undocumented) diff --git a/packages/frontend-app-api/src/wiring/createSpecializedApp.tsx b/packages/frontend-app-api/src/wiring/createSpecializedApp.tsx index 51b0f14250..bc4c9fd866 100644 --- a/packages/frontend-app-api/src/wiring/createSpecializedApp.tsx +++ b/packages/frontend-app-api/src/wiring/createSpecializedApp.tsx @@ -199,13 +199,11 @@ class RouteResolutionApiProxy implements RouteResolutionApi { } /** - * Creates an empty app without any default features. This is a low-level API is - * intended for use in tests or specialized setups. Typically you want to use - * `createApp` from `@backstage/frontend-defaults` instead. + * Options for `createSpecializedApp`. * * @public */ -export function createSpecializedApp(options?: { +export type CreateSpecializedAppOptions = { features?: FrontendFeature[]; config?: ConfigApi; bindRoutes?(context: { bind: CreateAppRouteBinder }): void; @@ -215,7 +213,19 @@ export function createSpecializedApp(options?: { | ExtensionFactoryMiddleware[]; flags?: { allowUnknownExtensionConfig?: boolean }; pluginInfoResolver?: FrontendPluginInfoResolver; -}): { apis: ApiHolder; tree: AppTree } { +}; + +/** + * Creates an empty app without any default features. This is a low-level API is + * intended for use in tests or specialized setups. Typically you want to use + * `createApp` from `@backstage/frontend-defaults` instead. + * + * @public + */ +export function createSpecializedApp(options?: CreateSpecializedAppOptions): { + apis: ApiHolder; + tree: AppTree; +} { const config = options?.config ?? new ConfigReader({}, 'empty-config'); const features = deduplicateFeatures(options?.features ?? []).map( createPluginInfoAttacher(config, options?.pluginInfoResolver), diff --git a/packages/frontend-app-api/src/wiring/index.ts b/packages/frontend-app-api/src/wiring/index.ts index fc52dcb7a1..782569a3ff 100644 --- a/packages/frontend-app-api/src/wiring/index.ts +++ b/packages/frontend-app-api/src/wiring/index.ts @@ -14,6 +14,9 @@ * limitations under the License. */ -export { createSpecializedApp } from './createSpecializedApp'; +export { + createSpecializedApp, + type CreateSpecializedAppOptions, +} from './createSpecializedApp'; export { type FrontendPluginInfoResolver } from './createPluginInfoAttacher'; export * from './types';