@backstage/frontend-app-api 0.3.0-next.2 → 0.3.1-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -0
- package/dist/index.d.ts +15 -1
- package/dist/index.esm.js +72 -59
- package/dist/index.esm.js.map +1 -1
- package/package.json +9 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,52 @@
|
|
|
1
1
|
# @backstage/frontend-app-api
|
|
2
2
|
|
|
3
|
+
## 0.3.1-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 60d6eb544e: Removed `@backstage/plugin-graphiql` dependency.
|
|
8
|
+
- 9ad4039efa: Bringing over apis from core-plugin-api
|
|
9
|
+
- b8cb7804c8: Added `createSpecializedApp`, which is a synchronous version of `createApp` where config and features already need to be loaded.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
- @backstage/core-plugin-api@1.8.1-next.0
|
|
12
|
+
- @backstage/core-components@0.13.9-next.0
|
|
13
|
+
- @backstage/theme@0.5.0-next.0
|
|
14
|
+
- @backstage/frontend-plugin-api@0.3.1-next.0
|
|
15
|
+
- @backstage/core-app-api@1.11.2-next.0
|
|
16
|
+
- @backstage/config@1.1.1
|
|
17
|
+
- @backstage/types@1.1.1
|
|
18
|
+
- @backstage/version-bridge@1.0.7
|
|
19
|
+
|
|
20
|
+
## 0.3.0
|
|
21
|
+
|
|
22
|
+
### Minor Changes
|
|
23
|
+
|
|
24
|
+
- 68fc9dc60e: Added the ability to configure bound routes through `app.routes.bindings`. The routing system used by `createApp` has been replaced by one that only supports route refs of the new format from `@backstage/frontend-plugin-api`. The requirement for route refs to have the same ID as their associated extension has been removed.
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- e28d379e32: Refactor internal extension instance system into an app graph.
|
|
29
|
+
- fdc348d5d3: The options parameter of `createApp` is now optional.
|
|
30
|
+
- 6c2b872153: Add official support for React 18.
|
|
31
|
+
- dc613f9bcf: Updated `app.extensions` configuration schema.
|
|
32
|
+
- 733bd95746: Implement new `AppTreeApi`
|
|
33
|
+
- 685a4c8901: Installed features are now deduplicated both by reference and ID when available. Features passed to `createApp` now override both discovered and loaded features.
|
|
34
|
+
- fa28d4e6df: No longer throw error on invalid input if the child is disabled.
|
|
35
|
+
- bb98953cb9: Register default implementation for the `Translation API` on the new `createApp`.
|
|
36
|
+
- fe6d09953d: Fix for app node output IDs not being serialized correctly.
|
|
37
|
+
- 77f009b35d: Internal updates to match changes in the experimental `@backstage/frontend-plugin-api`.
|
|
38
|
+
- 4d6fa921db: Internal refactor to rename the app graph to app tree
|
|
39
|
+
- Updated dependencies
|
|
40
|
+
- @backstage/core-components@0.13.8
|
|
41
|
+
- @backstage/frontend-plugin-api@0.3.0
|
|
42
|
+
- @backstage/plugin-graphiql@0.3.0
|
|
43
|
+
- @backstage/core-plugin-api@1.8.0
|
|
44
|
+
- @backstage/version-bridge@1.0.7
|
|
45
|
+
- @backstage/core-app-api@1.11.1
|
|
46
|
+
- @backstage/theme@0.4.4
|
|
47
|
+
- @backstage/config@1.1.1
|
|
48
|
+
- @backstage/types@1.1.1
|
|
49
|
+
|
|
3
50
|
## 0.3.0-next.2
|
|
4
51
|
|
|
5
52
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -70,5 +70,19 @@ declare function createApp(options?: {
|
|
|
70
70
|
}): {
|
|
71
71
|
createRoot(): JSX.Element;
|
|
72
72
|
};
|
|
73
|
+
/**
|
|
74
|
+
* Synchronous version of {@link createApp}, expecting all features and
|
|
75
|
+
* config to have been loaded already.
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
78
|
+
declare function createSpecializedApp(options?: {
|
|
79
|
+
features?: (BackstagePlugin | ExtensionOverrides)[];
|
|
80
|
+
config?: ConfigApi;
|
|
81
|
+
bindRoutes?(context: {
|
|
82
|
+
bind: AppRouteBinder;
|
|
83
|
+
}): void;
|
|
84
|
+
}): {
|
|
85
|
+
createRoot(): JSX.Element;
|
|
86
|
+
};
|
|
73
87
|
|
|
74
|
-
export { AppRouteBinder, ExtensionTree, ExtensionTreeNode, createApp, createExtensionTree };
|
|
88
|
+
export { AppRouteBinder, ExtensionTree, ExtensionTreeNode, createApp, createExtensionTree, createSpecializedApp };
|
package/dist/index.esm.js
CHANGED
|
@@ -5,7 +5,7 @@ import { useRoutes, BrowserRouter, useInRouterContext, MemoryRouter, matchRoutes
|
|
|
5
5
|
import { SidebarPage, sidebarConfig, Sidebar, SidebarDivider, useSidebarOpenState, Link, SidebarItem, Progress, ErrorPage, ErrorPanel } from '@backstage/core-components';
|
|
6
6
|
import { makeStyles } from '@material-ui/core';
|
|
7
7
|
import { useApi, appThemeApiRef, FeatureFlagState, createApiFactory, discoveryApiRef, configApiRef, alertApiRef, analyticsApiRef, errorApiRef, storageApiRef, fetchApiRef, identityApiRef, oauthRequestApiRef, googleAuthApiRef, microsoftAuthApiRef, githubAuthApiRef, oktaAuthApiRef, gitlabAuthApiRef, oneloginAuthApiRef, bitbucketAuthApiRef, bitbucketServerAuthApiRef, atlassianAuthApiRef, attachComponentData, featureFlagsApiRef } from '@backstage/core-plugin-api';
|
|
8
|
-
import { UrlPatternDiscovery, AlertApiForwarder, NoOpAnalyticsApi, ErrorAlerter, ErrorApiForwarder, UnhandledErrorForwarder, WebStorage, createFetchApi, FetchMiddlewares, OAuthRequestManager, GoogleAuth, MicrosoftAuth, GithubAuth, OktaAuth, GitlabAuth, OneLoginAuth, BitbucketAuth, BitbucketServerAuth, AtlassianAuth,
|
|
8
|
+
import { UrlPatternDiscovery, AlertApiForwarder, NoOpAnalyticsApi, ErrorAlerter, ErrorApiForwarder, UnhandledErrorForwarder, WebStorage, createFetchApi, FetchMiddlewares, OAuthRequestManager, GoogleAuth, MicrosoftAuth, GithubAuth, OktaAuth, GitlabAuth, OneLoginAuth, BitbucketAuth, BitbucketServerAuth, AtlassianAuth, ApiFactoryRegistry, AppThemeSelector, ApiResolver, ApiProvider } from '@backstage/core-app-api';
|
|
9
9
|
import useObservable from 'react-use/lib/useObservable';
|
|
10
10
|
import { createVersionedContext, createVersionedValueMap, getOrCreateGlobalSingleton } from '@backstage/version-bridge';
|
|
11
11
|
import ObservableImpl from 'zen-observable';
|
|
@@ -1327,6 +1327,37 @@ const DarkTheme = createThemeExtension({
|
|
|
1327
1327
|
Provider: ({ children }) => /* @__PURE__ */ React.createElement(UnifiedThemeProvider, { theme: themes.dark, children })
|
|
1328
1328
|
});
|
|
1329
1329
|
|
|
1330
|
+
const legacyPluginStore = getOrCreateGlobalSingleton(
|
|
1331
|
+
"legacy-plugin-compatibility-store",
|
|
1332
|
+
() => /* @__PURE__ */ new WeakMap()
|
|
1333
|
+
);
|
|
1334
|
+
function toLegacyPlugin(plugin) {
|
|
1335
|
+
let legacy = legacyPluginStore.get(plugin);
|
|
1336
|
+
if (legacy) {
|
|
1337
|
+
return legacy;
|
|
1338
|
+
}
|
|
1339
|
+
const errorMsg = "Not implemented in legacy plugin compatibility layer";
|
|
1340
|
+
const notImplemented = () => {
|
|
1341
|
+
throw new Error(errorMsg);
|
|
1342
|
+
};
|
|
1343
|
+
legacy = {
|
|
1344
|
+
getId() {
|
|
1345
|
+
return plugin.id;
|
|
1346
|
+
},
|
|
1347
|
+
get routes() {
|
|
1348
|
+
return {};
|
|
1349
|
+
},
|
|
1350
|
+
get externalRoutes() {
|
|
1351
|
+
return {};
|
|
1352
|
+
},
|
|
1353
|
+
getApis: notImplemented,
|
|
1354
|
+
getFeatureFlags: notImplemented,
|
|
1355
|
+
provide: notImplemented
|
|
1356
|
+
};
|
|
1357
|
+
legacyPluginStore.set(plugin, legacy);
|
|
1358
|
+
return legacy;
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1330
1361
|
const MATCH_ALL_ROUTE = {
|
|
1331
1362
|
caseSensitive: false,
|
|
1332
1363
|
path: "*",
|
|
@@ -2274,35 +2305,16 @@ function createApp(options) {
|
|
|
2274
2305
|
);
|
|
2275
2306
|
const discoveredFeatures = getAvailableFeatures(config);
|
|
2276
2307
|
const loadedFeatures = (_d = await ((_c = options == null ? void 0 : options.featureLoader) == null ? void 0 : _c.call(options, { config }))) != null ? _d : [];
|
|
2277
|
-
const
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
}
|
|
2287
|
-
const appContext = createLegacyAppContext(
|
|
2288
|
-
allFeatures.filter(
|
|
2289
|
-
(f) => f.$$type === "@backstage/BackstagePlugin"
|
|
2290
|
-
)
|
|
2291
|
-
);
|
|
2292
|
-
const routeIds = collectRouteIds(allFeatures);
|
|
2293
|
-
const App = () => /* @__PURE__ */ React.createElement(ApiProvider, { apis: createApiHolder(tree, config) }, /* @__PURE__ */ React.createElement(AppContextProvider, { appContext }, /* @__PURE__ */ React.createElement(AppThemeProvider, null, /* @__PURE__ */ React.createElement(
|
|
2294
|
-
RoutingProvider,
|
|
2295
|
-
{
|
|
2296
|
-
...extractRouteInfoFromAppNode(tree.root),
|
|
2297
|
-
routeBindings: resolveRouteBindings(
|
|
2298
|
-
options == null ? void 0 : options.bindRoutes,
|
|
2299
|
-
config,
|
|
2300
|
-
routeIds
|
|
2301
|
-
)
|
|
2302
|
-
},
|
|
2303
|
-
/* @__PURE__ */ React.createElement(BrowserRouter, null, tree.root.instance.getData(coreExtensionData.reactElement))
|
|
2304
|
-
))));
|
|
2305
|
-
return { default: App };
|
|
2308
|
+
const app = createSpecializedApp({
|
|
2309
|
+
config,
|
|
2310
|
+
features: [
|
|
2311
|
+
...discoveredFeatures,
|
|
2312
|
+
...loadedFeatures,
|
|
2313
|
+
...(_e = options == null ? void 0 : options.features) != null ? _e : []
|
|
2314
|
+
],
|
|
2315
|
+
bindRoutes: options == null ? void 0 : options.bindRoutes
|
|
2316
|
+
}).createRoot();
|
|
2317
|
+
return { default: () => app };
|
|
2306
2318
|
}
|
|
2307
2319
|
return {
|
|
2308
2320
|
createRoot() {
|
|
@@ -2311,35 +2323,36 @@ function createApp(options) {
|
|
|
2311
2323
|
}
|
|
2312
2324
|
};
|
|
2313
2325
|
}
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
)
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2326
|
+
function createSpecializedApp(options) {
|
|
2327
|
+
const {
|
|
2328
|
+
features: duplicatedFeatures = [],
|
|
2329
|
+
config = new ConfigReader({}, "empty-config")
|
|
2330
|
+
} = options != null ? options : {};
|
|
2331
|
+
const features = deduplicateFeatures(duplicatedFeatures);
|
|
2332
|
+
const tree = createAppTree({
|
|
2333
|
+
features,
|
|
2334
|
+
builtinExtensions,
|
|
2335
|
+
config
|
|
2336
|
+
});
|
|
2337
|
+
const appContext = createLegacyAppContext(
|
|
2338
|
+
features.filter(
|
|
2339
|
+
(f) => f.$$type === "@backstage/BackstagePlugin"
|
|
2340
|
+
)
|
|
2341
|
+
);
|
|
2342
|
+
const apiHolder = createApiHolder(tree, config);
|
|
2343
|
+
const routeInfo = extractRouteInfoFromAppNode(tree.root);
|
|
2344
|
+
const routeBindings = resolveRouteBindings(
|
|
2345
|
+
options == null ? void 0 : options.bindRoutes,
|
|
2346
|
+
config,
|
|
2347
|
+
collectRouteIds(features)
|
|
2348
|
+
);
|
|
2349
|
+
const rootEl = tree.root.instance.getData(coreExtensionData.reactElement);
|
|
2350
|
+
const App = () => /* @__PURE__ */ React.createElement(ApiProvider, { apis: apiHolder }, /* @__PURE__ */ React.createElement(AppContextProvider, { appContext }, /* @__PURE__ */ React.createElement(AppThemeProvider, null, /* @__PURE__ */ React.createElement(RoutingProvider, { ...routeInfo, routeBindings }, /* @__PURE__ */ React.createElement(BrowserRouter, null, rootEl)))));
|
|
2351
|
+
return {
|
|
2352
|
+
createRoot() {
|
|
2353
|
+
return /* @__PURE__ */ React.createElement(App, null);
|
|
2354
|
+
}
|
|
2340
2355
|
};
|
|
2341
|
-
legacyPluginStore.set(plugin, legacy);
|
|
2342
|
-
return legacy;
|
|
2343
2356
|
}
|
|
2344
2357
|
function createLegacyAppContext(plugins) {
|
|
2345
2358
|
return {
|
|
@@ -2460,5 +2473,5 @@ function createApiHolder(tree, configApi) {
|
|
|
2460
2473
|
return new ApiResolver(factoryRegistry);
|
|
2461
2474
|
}
|
|
2462
2475
|
|
|
2463
|
-
export { createApp, createExtensionTree };
|
|
2476
|
+
export { createApp, createExtensionTree, createSpecializedApp };
|
|
2464
2477
|
//# sourceMappingURL=index.esm.js.map
|