@backstage/frontend-app-api 0.3.0-next.1 → 0.3.0-next.2
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 +15 -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 +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @backstage/frontend-app-api
|
|
2
2
|
|
|
3
|
+
## 0.3.0-next.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#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.
|
|
8
|
+
|
|
9
|
+
- [#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`
|
|
10
|
+
|
|
11
|
+
- [#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.
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
- @backstage/core-components@0.13.8-next.2
|
|
15
|
+
- @backstage/frontend-plugin-api@0.3.0-next.2
|
|
16
|
+
- @backstage/plugin-graphiql@0.3.0-next.2
|
|
17
|
+
|
|
3
18
|
## 0.3.0-next.1
|
|
4
19
|
|
|
5
20
|
### 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: {},
|