@backstage/frontend-app-api 0.3.0-next.1 → 0.3.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 +45 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +18 -9
- package/dist/index.esm.js.map +1 -1
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,50 @@
|
|
|
1
1
|
# @backstage/frontend-app-api
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 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.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- e28d379e32: Refactor internal extension instance system into an app graph.
|
|
12
|
+
- fdc348d5d3: The options parameter of `createApp` is now optional.
|
|
13
|
+
- 6c2b872153: Add official support for React 18.
|
|
14
|
+
- dc613f9bcf: Updated `app.extensions` configuration schema.
|
|
15
|
+
- 733bd95746: Implement new `AppTreeApi`
|
|
16
|
+
- 685a4c8901: Installed features are now deduplicated both by reference and ID when available. Features passed to `createApp` now override both discovered and loaded features.
|
|
17
|
+
- fa28d4e6df: No longer throw error on invalid input if the child is disabled.
|
|
18
|
+
- bb98953cb9: Register default implementation for the `Translation API` on the new `createApp`.
|
|
19
|
+
- fe6d09953d: Fix for app node output IDs not being serialized correctly.
|
|
20
|
+
- 77f009b35d: Internal updates to match changes in the experimental `@backstage/frontend-plugin-api`.
|
|
21
|
+
- 4d6fa921db: Internal refactor to rename the app graph to app tree
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
- @backstage/core-components@0.13.8
|
|
24
|
+
- @backstage/frontend-plugin-api@0.3.0
|
|
25
|
+
- @backstage/plugin-graphiql@0.3.0
|
|
26
|
+
- @backstage/core-plugin-api@1.8.0
|
|
27
|
+
- @backstage/version-bridge@1.0.7
|
|
28
|
+
- @backstage/core-app-api@1.11.1
|
|
29
|
+
- @backstage/theme@0.4.4
|
|
30
|
+
- @backstage/config@1.1.1
|
|
31
|
+
- @backstage/types@1.1.1
|
|
32
|
+
|
|
33
|
+
## 0.3.0-next.2
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- [#20999](https://github.com/backstage/backstage/pull/20999) [`fdc348d5d3`](https://github.com/backstage/backstage/commit/fdc348d5d30a98b52d8a756daba29d616418da93) Thanks [@Rugvip](https://github.com/Rugvip)! - The options parameter of `createApp` is now optional.
|
|
38
|
+
|
|
39
|
+
- [#20888](https://github.com/backstage/backstage/pull/20888) [`733bd95746`](https://github.com/backstage/backstage/commit/733bd95746b99ad8cdb4a7b87e8dc3e16d3b764a) Thanks [@Rugvip](https://github.com/Rugvip)! - Implement new `AppTreeApi`
|
|
40
|
+
|
|
41
|
+
- [#20999](https://github.com/backstage/backstage/pull/20999) [`fa28d4e6df`](https://github.com/backstage/backstage/commit/fa28d4e6dfcbee2bc8695b7b24289a401df96acd) Thanks [@Rugvip](https://github.com/Rugvip)! - No longer throw error on invalid input if the child is disabled.
|
|
42
|
+
|
|
43
|
+
- Updated dependencies
|
|
44
|
+
- @backstage/core-components@0.13.8-next.2
|
|
45
|
+
- @backstage/frontend-plugin-api@0.3.0-next.2
|
|
46
|
+
- @backstage/plugin-graphiql@0.3.0-next.2
|
|
47
|
+
|
|
3
48
|
## 0.3.0-next.1
|
|
4
49
|
|
|
5
50
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ declare function createExtensionTree(options: {
|
|
|
58
58
|
config: Config;
|
|
59
59
|
}): ExtensionTree;
|
|
60
60
|
/** @public */
|
|
61
|
-
declare function createApp(options
|
|
61
|
+
declare function createApp(options?: {
|
|
62
62
|
features?: (BackstagePlugin | ExtensionOverrides)[];
|
|
63
63
|
configLoader?: () => Promise<ConfigApi>;
|
|
64
64
|
bindRoutes?(context: {
|
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useMemo, useState, useEffect } from 'react';
|
|
2
2
|
import { ConfigReader } from '@backstage/config';
|
|
3
|
-
import { createExtension, createExtensionInput, coreExtensionData, useRouteRef, createThemeExtension } from '@backstage/frontend-plugin-api';
|
|
3
|
+
import { createExtension, createExtensionInput, coreExtensionData, useRouteRef, createThemeExtension, appTreeApiRef } from '@backstage/frontend-plugin-api';
|
|
4
4
|
import { useRoutes, BrowserRouter, useInRouterContext, MemoryRouter, matchRoutes, generatePath, Route } from 'react-router-dom';
|
|
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';
|
|
@@ -2155,7 +2155,9 @@ function instantiateAppNodeTree(rootNode) {
|
|
|
2155
2155
|
}
|
|
2156
2156
|
return [{ id: child.spec.id, instance: childInstance }];
|
|
2157
2157
|
});
|
|
2158
|
-
|
|
2158
|
+
if (instantiatedChildren.length > 0) {
|
|
2159
|
+
instantiatedAttachments.set(input, instantiatedChildren);
|
|
2160
|
+
}
|
|
2159
2161
|
}
|
|
2160
2162
|
node.instance = createAppNodeInstance({
|
|
2161
2163
|
spec: node.spec,
|
|
@@ -2271,11 +2273,11 @@ function createApp(options) {
|
|
|
2271
2273
|
overrideBaseUrlConfigs(defaultConfigLoaderSync())
|
|
2272
2274
|
);
|
|
2273
2275
|
const discoveredFeatures = getAvailableFeatures(config);
|
|
2274
|
-
const loadedFeatures = (_d = await ((_c = options.featureLoader) == null ? void 0 : _c.call(options, { config }))) != null ? _d : [];
|
|
2276
|
+
const loadedFeatures = (_d = await ((_c = options == null ? void 0 : options.featureLoader) == null ? void 0 : _c.call(options, { config }))) != null ? _d : [];
|
|
2275
2277
|
const allFeatures = deduplicateFeatures([
|
|
2276
2278
|
...discoveredFeatures,
|
|
2277
2279
|
...loadedFeatures,
|
|
2278
|
-
...(_e = options.features) != null ? _e : []
|
|
2280
|
+
...(_e = options == null ? void 0 : options.features) != null ? _e : []
|
|
2279
2281
|
]);
|
|
2280
2282
|
const tree = createAppTree({
|
|
2281
2283
|
features: allFeatures,
|
|
@@ -2288,12 +2290,12 @@ function createApp(options) {
|
|
|
2288
2290
|
)
|
|
2289
2291
|
);
|
|
2290
2292
|
const routeIds = collectRouteIds(allFeatures);
|
|
2291
|
-
const App = () => /* @__PURE__ */ React.createElement(ApiProvider, { apis: createApiHolder(tree
|
|
2293
|
+
const App = () => /* @__PURE__ */ React.createElement(ApiProvider, { apis: createApiHolder(tree, config) }, /* @__PURE__ */ React.createElement(AppContextProvider, { appContext }, /* @__PURE__ */ React.createElement(AppThemeProvider, null, /* @__PURE__ */ React.createElement(
|
|
2292
2294
|
RoutingProvider,
|
|
2293
2295
|
{
|
|
2294
2296
|
...extractRouteInfoFromAppNode(tree.root),
|
|
2295
2297
|
routeBindings: resolveRouteBindings(
|
|
2296
|
-
options.bindRoutes,
|
|
2298
|
+
options == null ? void 0 : options.bindRoutes,
|
|
2297
2299
|
config,
|
|
2298
2300
|
routeIds
|
|
2299
2301
|
)
|
|
@@ -2355,14 +2357,14 @@ function createLegacyAppContext(plugins) {
|
|
|
2355
2357
|
}
|
|
2356
2358
|
};
|
|
2357
2359
|
}
|
|
2358
|
-
function createApiHolder(
|
|
2360
|
+
function createApiHolder(tree, configApi) {
|
|
2359
2361
|
var _a, _b, _c, _d;
|
|
2360
2362
|
const factoryRegistry = new ApiFactoryRegistry();
|
|
2361
|
-
const pluginApis = (_b = (_a =
|
|
2363
|
+
const pluginApis = (_b = (_a = tree.root.edges.attachments.get("apis")) == null ? void 0 : _a.map((e) => {
|
|
2362
2364
|
var _a2;
|
|
2363
2365
|
return (_a2 = e.instance) == null ? void 0 : _a2.getData(coreExtensionData.apiFactory);
|
|
2364
2366
|
}).filter((x) => !!x)) != null ? _b : [];
|
|
2365
|
-
const themeExtensions = (_d = (_c =
|
|
2367
|
+
const themeExtensions = (_d = (_c = tree.root.edges.attachments.get("themes")) == null ? void 0 : _c.map((e) => {
|
|
2366
2368
|
var _a2;
|
|
2367
2369
|
return (_a2 = e.instance) == null ? void 0 : _a2.getData(coreExtensionData.theme);
|
|
2368
2370
|
}).filter((x) => !!x)) != null ? _d : [];
|
|
@@ -2405,6 +2407,13 @@ function createApiHolder(core, configApi) {
|
|
|
2405
2407
|
return appIdentityProxy;
|
|
2406
2408
|
}
|
|
2407
2409
|
});
|
|
2410
|
+
factoryRegistry.register("static", {
|
|
2411
|
+
api: appTreeApiRef,
|
|
2412
|
+
deps: {},
|
|
2413
|
+
factory: () => ({
|
|
2414
|
+
getTree: () => ({ tree })
|
|
2415
|
+
})
|
|
2416
|
+
});
|
|
2408
2417
|
factoryRegistry.register("static", {
|
|
2409
2418
|
api: appThemeApiRef,
|
|
2410
2419
|
deps: {},
|