frontend-app-api: add CreateSpecializedAppOptions type

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2025-08-01 09:54:46 +02:00
parent 484e500f49
commit 3d2499f049
4 changed files with 31 additions and 10 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/frontend-app-api': patch
---
Moved `createSpecializedApp` options to a new `CreateSpecializedAppOptions` type.
+7 -4
View File
@@ -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)
@@ -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),
@@ -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';