diff --git a/.changeset/shiny-books-search.md b/.changeset/shiny-books-search.md new file mode 100644 index 0000000000..1d743565b9 --- /dev/null +++ b/.changeset/shiny-books-search.md @@ -0,0 +1,5 @@ +--- +'@backstage/frontend-app-api': minor +--- + +The app no longer provides the `AppContext` from `@backstage/core-plugin-api`. Components that require this context to be available should use the `compatWrapper` helper from `@backstage/core-compat-api`. diff --git a/packages/frontend-app-api/src/wiring/createApp.tsx b/packages/frontend-app-api/src/wiring/createApp.tsx index f58dfb3159..74812a5acd 100644 --- a/packages/frontend-app-api/src/wiring/createApp.tsx +++ b/packages/frontend-app-api/src/wiring/createApp.tsx @@ -35,13 +35,10 @@ import { CoreNav } from '../extensions/CoreNav'; import { AnyApiFactory, ApiHolder, - AppComponents, - AppContext, appThemeApiRef, ConfigApi, configApiRef, IconComponent, - BackstagePlugin as LegacyBackstagePlugin, featureFlagsApiRef, attachComponentData, identityApiRef, @@ -61,8 +58,6 @@ import { AppThemeProvider } from '../../../core-app-api/src/app/AppThemeProvider // eslint-disable-next-line @backstage/no-relative-monorepo-imports import { AppIdentityProxy } from '../../../core-app-api/src/apis/implementations/IdentityApi/AppIdentityProxy'; // eslint-disable-next-line @backstage/no-relative-monorepo-imports -import { AppContextProvider } from '../../../core-app-api/src/app/AppContext'; -// eslint-disable-next-line @backstage/no-relative-monorepo-imports import { LocalStorageFeatureFlags } from '../../../core-app-api/src/apis/implementations/FeatureFlagsApi/LocalStorageFeatureFlags'; // eslint-disable-next-line @backstage/no-relative-monorepo-imports import { defaultConfigLoaderSync } from '../../../core-app-api/src/app/defaultConfigLoader'; @@ -75,11 +70,7 @@ import { I18nextTranslationApi } from '../../../core-app-api/src/apis/implementa // eslint-disable-next-line @backstage/no-relative-monorepo-imports import { resolveExtensionDefinition } from '../../../frontend-plugin-api/src/wiring/resolveExtensionDefinition'; // eslint-disable-next-line @backstage/no-relative-monorepo-imports -import { - apis as defaultApis, - components as defaultComponents, - icons as defaultIcons, -} from '../../../app-defaults/src/defaults'; +import { apis as defaultApis } from '../../../app-defaults/src/defaults'; import { Route } from 'react-router-dom'; import { SidebarItem } from '@backstage/core-components'; import { DarkTheme, LightTheme } from '../extensions/themes'; @@ -100,7 +91,6 @@ import { DefaultNotFoundErrorPageComponent, } from '../extensions/components'; import { AppNode } from '@backstage/frontend-plugin-api'; -import { toLegacyPlugin } from '../routing/toLegacyPlugin'; import { InternalAppContext } from './InternalAppContext'; import { CoreRouter } from '../extensions/CoreRouter'; // eslint-disable-next-line @backstage/no-relative-monorepo-imports @@ -315,12 +305,6 @@ export function createSpecializedApp(options?: { config, }); - const appContext = createLegacyAppContext( - features.filter( - (f): f is BackstagePlugin => f.$$type === '@backstage/BackstagePlugin', - ), - ); - const appIdentityProxy = new AppIdentityProxy(); const apiHolder = createApiHolder(tree, config, appIdentityProxy); @@ -353,17 +337,15 @@ export function createSpecializedApp(options?: { const App = () => ( - - - - - {rootEl} - - - - + + + + {rootEl} + + + ); @@ -374,28 +356,6 @@ export function createSpecializedApp(options?: { }; } -function createLegacyAppContext(plugins: BackstagePlugin[]): AppContext { - return { - getPlugins(): LegacyBackstagePlugin[] { - return plugins.map(toLegacyPlugin); - }, - - getSystemIcon(key: string): IconComponent | undefined { - return key in defaultIcons - ? defaultIcons[key as keyof typeof defaultIcons] - : undefined; - }, - - getSystemIcons(): Record { - return defaultIcons; - }, - - getComponents(): AppComponents { - return defaultComponents; - }, - }; -} - function createApiHolder( tree: AppTree, configApi: ConfigApi,