refactor(frontend-app-api): converting default apis into extensions
Signed-off-by: Camila Belo <camilaibs@gmail.com>
This commit is contained in:
@@ -103,6 +103,8 @@ import { toInternalBackstagePlugin } from '../../../frontend-plugin-api/src/wiri
|
||||
import { toInternalExtensionOverrides } from '../../../frontend-plugin-api/src/wiring/createExtensionOverrides';
|
||||
import { DefaultComponentsApi } from '../apis/implementations/ComponentsApi';
|
||||
|
||||
const DefaultApis = defaultApis.map(factory => createApiExtension({ factory }));
|
||||
|
||||
export const builtinExtensions = [
|
||||
Core,
|
||||
CoreRouter,
|
||||
@@ -114,6 +116,7 @@ export const builtinExtensions = [
|
||||
DefaultNotFoundErrorPageComponent,
|
||||
LightTheme,
|
||||
DarkTheme,
|
||||
...DefaultApis,
|
||||
].map(def => resolveExtensionDefinition(def));
|
||||
|
||||
/** @public */
|
||||
@@ -388,14 +391,7 @@ function createApiHolder(
|
||||
(x): x is typeof createTranslationExtension.translationDataRef.T => !!x,
|
||||
) ?? [];
|
||||
|
||||
const apis = new Map<string, AnyApiFactory>();
|
||||
|
||||
// removing duplicates by id, overriding the default one with the plugin one
|
||||
for (const factory of [...defaultApis, ...pluginApis]) {
|
||||
apis.set(factory.api.id, factory);
|
||||
}
|
||||
|
||||
for (const factory of apis.values()) {
|
||||
for (const factory of pluginApis) {
|
||||
factoryRegistry.register('default', factory);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user