From c36e0b980bc455521bb250020df7e17b36ac8291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Wed, 13 Dec 2023 16:15:22 +0100 Subject: [PATCH] rename to CreateAppRouteBinder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .changeset/slimy-geese-camp.md | 5 ++++ packages/frontend-app-api/api-report.md | 28 +++++++++---------- .../frontend-app-api/src/routing/index.ts | 2 +- .../src/routing/resolveRouteBindings.ts | 6 ++-- .../frontend-app-api/src/wiring/createApp.tsx | 6 ++-- 5 files changed, 26 insertions(+), 21 deletions(-) create mode 100644 .changeset/slimy-geese-camp.md diff --git a/.changeset/slimy-geese-camp.md b/.changeset/slimy-geese-camp.md new file mode 100644 index 0000000000..b3fa09e2d8 --- /dev/null +++ b/.changeset/slimy-geese-camp.md @@ -0,0 +1,5 @@ +--- +'@backstage/frontend-app-api': patch +--- + +Renamed `AppRouteBinder` to `CreateAppRouteBinder` diff --git a/packages/frontend-app-api/api-report.md b/packages/frontend-app-api/api-report.md index 3ca51f6331..ad3afa27a4 100644 --- a/packages/frontend-app-api/api-report.md +++ b/packages/frontend-app-api/api-report.md @@ -13,8 +13,20 @@ import { JSX as JSX_2 } from 'react'; import { RouteRef } from '@backstage/frontend-plugin-api'; import { SubRouteRef } from '@backstage/frontend-plugin-api'; +// @public (undocumented) +export function createApp(options?: { + features?: (BackstagePlugin | ExtensionOverrides)[]; + configLoader?: () => Promise; + bindRoutes?(context: { bind: CreateAppRouteBinder }): void; + featureLoader?: (ctx: { + config: ConfigApi; + }) => Promise<(BackstagePlugin | ExtensionOverrides)[]>; +}): { + createRoot(): JSX_2.Element; +}; + // @public -export type AppRouteBinder = < +export type CreateAppRouteBinder = < TExternalRoutes extends { [name: string]: ExternalRouteRef; }, @@ -26,18 +38,6 @@ export type AppRouteBinder = < >, ) => void; -// @public (undocumented) -export function createApp(options?: { - features?: (BackstagePlugin | ExtensionOverrides)[]; - configLoader?: () => Promise; - bindRoutes?(context: { bind: AppRouteBinder }): void; - featureLoader?: (ctx: { - config: ConfigApi; - }) => Promise<(BackstagePlugin | ExtensionOverrides)[]>; -}): { - createRoot(): JSX_2.Element; -}; - // @public (undocumented) export function createExtensionTree(options: { config: Config }): ExtensionTree; @@ -45,7 +45,7 @@ export function createExtensionTree(options: { config: Config }): ExtensionTree; export function createSpecializedApp(options?: { features?: (BackstagePlugin | ExtensionOverrides)[]; config?: ConfigApi; - bindRoutes?(context: { bind: AppRouteBinder }): void; + bindRoutes?(context: { bind: CreateAppRouteBinder }): void; }): { createRoot(): JSX_2.Element; }; diff --git a/packages/frontend-app-api/src/routing/index.ts b/packages/frontend-app-api/src/routing/index.ts index 8c26a732d3..fedbad0261 100644 --- a/packages/frontend-app-api/src/routing/index.ts +++ b/packages/frontend-app-api/src/routing/index.ts @@ -14,4 +14,4 @@ * limitations under the License. */ -export { type AppRouteBinder } from './resolveRouteBindings'; +export { type CreateAppRouteBinder } from './resolveRouteBindings'; diff --git a/packages/frontend-app-api/src/routing/resolveRouteBindings.ts b/packages/frontend-app-api/src/routing/resolveRouteBindings.ts index f5a2e5bd94..18ea9f9bd8 100644 --- a/packages/frontend-app-api/src/routing/resolveRouteBindings.ts +++ b/packages/frontend-app-api/src/routing/resolveRouteBindings.ts @@ -64,7 +64,7 @@ type TargetRouteMap< * * @public */ -export type AppRouteBinder = < +export type CreateAppRouteBinder = < TExternalRoutes extends { [name: string]: ExternalRouteRef }, >( externalRoutes: TExternalRoutes, @@ -76,14 +76,14 @@ export type AppRouteBinder = < /** @internal */ export function resolveRouteBindings( - bindRoutes: ((context: { bind: AppRouteBinder }) => void) | undefined, + bindRoutes: ((context: { bind: CreateAppRouteBinder }) => void) | undefined, config: Config, routesById: RouteRefsById, ): Map { const result = new Map(); if (bindRoutes) { - const bind: AppRouteBinder = ( + const bind: CreateAppRouteBinder = ( externalRoutes, targetRoutes: { [name: string]: RouteRef | SubRouteRef }, ) => { diff --git a/packages/frontend-app-api/src/wiring/createApp.tsx b/packages/frontend-app-api/src/wiring/createApp.tsx index c1c1e3e283..dc6feb9b90 100644 --- a/packages/frontend-app-api/src/wiring/createApp.tsx +++ b/packages/frontend-app-api/src/wiring/createApp.tsx @@ -80,7 +80,7 @@ import { appLanguageApiRef, translationApiRef, } from '@backstage/core-plugin-api/alpha'; -import { AppRouteBinder } from '../routing'; +import { CreateAppRouteBinder } from '../routing'; import { RoutingProvider } from '../routing/RoutingProvider'; import { resolveRouteBindings } from '../routing/resolveRouteBindings'; import { collectRouteIds } from '../routing/collectRouteIds'; @@ -239,7 +239,7 @@ function deduplicateFeatures( export function createApp(options?: { features?: (BackstagePlugin | ExtensionOverrides)[]; configLoader?: () => Promise; - bindRoutes?(context: { bind: AppRouteBinder }): void; + bindRoutes?(context: { bind: CreateAppRouteBinder }): void; featureLoader?: (ctx: { config: ConfigApi; }) => Promise<(BackstagePlugin | ExtensionOverrides)[]>; @@ -289,7 +289,7 @@ export function createApp(options?: { export function createSpecializedApp(options?: { features?: (BackstagePlugin | ExtensionOverrides)[]; config?: ConfigApi; - bindRoutes?(context: { bind: AppRouteBinder }): void; + bindRoutes?(context: { bind: CreateAppRouteBinder }): void; }): { createRoot(): JSX.Element } { const { features: duplicatedFeatures = [],