@backstage/core-app-api 1.8.1-next.0 → 1.8.1
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 +13 -0
- package/config.d.ts +39 -0
- package/dist/index.esm.js +33 -12
- package/dist/index.esm.js.map +1 -1
- package/package.json +6 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @backstage/core-app-api
|
|
2
2
|
|
|
3
|
+
## 1.8.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 12adfbc8fe2d: Fixed a bug that prevented accurate plugin and route data from being applied to `navigate` analytics events when users visited pages constructed with `<EntityLayout>`, `<TabbedLayout>`, and similar components that are used to gather one or more routable extensions under a given path.
|
|
8
|
+
- ac677bc30ae0: Expose discovery.endpoints configuration to use FrontendHostDiscovery
|
|
9
|
+
- 74b216ee4e50: Add `PropsWithChildren` to usages of `ComponentType`, in preparation for React 18 where the children are no longer implicit.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
- @backstage/core-plugin-api@1.5.2
|
|
12
|
+
- @backstage/types@1.1.0
|
|
13
|
+
- @backstage/config@1.0.8
|
|
14
|
+
- @backstage/version-bridge@1.0.4
|
|
15
|
+
|
|
3
16
|
## 1.8.1-next.0
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/config.d.ts
CHANGED
|
@@ -122,4 +122,43 @@ export interface Config {
|
|
|
122
122
|
* @visibility frontend
|
|
123
123
|
*/
|
|
124
124
|
enableExperimentalRedirectFlow?: boolean;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Discovery options.
|
|
128
|
+
*
|
|
129
|
+
* @visibility frontend
|
|
130
|
+
*/
|
|
131
|
+
discovery?: {
|
|
132
|
+
/**
|
|
133
|
+
* Endpoints
|
|
134
|
+
*
|
|
135
|
+
* A list of target baseUrls and the associated plugins.
|
|
136
|
+
*
|
|
137
|
+
* @visibility frontend
|
|
138
|
+
*/
|
|
139
|
+
endpoints?: Array<{
|
|
140
|
+
/**
|
|
141
|
+
* The target baseUrl to use for the plugin
|
|
142
|
+
*
|
|
143
|
+
* Can be either a string or an object with internal and external keys. (Internal is used for the backend, external for the frontend)
|
|
144
|
+
* Targets with `{{pluginId}}` or `{{ pluginId }} in the url will be replaced with the pluginId.
|
|
145
|
+
*
|
|
146
|
+
* @visibility frontend
|
|
147
|
+
*/
|
|
148
|
+
target:
|
|
149
|
+
| string
|
|
150
|
+
| {
|
|
151
|
+
/**
|
|
152
|
+
* @visibility frontend
|
|
153
|
+
*/
|
|
154
|
+
external: string;
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Array of plugins which use the target baseUrl.
|
|
158
|
+
*
|
|
159
|
+
* @visibility frontend
|
|
160
|
+
*/
|
|
161
|
+
plugins: Array<string>;
|
|
162
|
+
}>;
|
|
163
|
+
};
|
|
125
164
|
}
|
package/dist/index.esm.js
CHANGED
|
@@ -2009,12 +2009,11 @@ function isReactRouterBeta() {
|
|
|
2009
2009
|
}
|
|
2010
2010
|
|
|
2011
2011
|
const getExtensionContext = (pathname, routes) => {
|
|
2012
|
-
var _a;
|
|
2013
2012
|
try {
|
|
2014
2013
|
const matches = matchRoutes(routes, { pathname });
|
|
2015
2014
|
const routeMatch = matches == null ? void 0 : matches.filter((match) => {
|
|
2016
|
-
var
|
|
2017
|
-
return ((
|
|
2015
|
+
var _a;
|
|
2016
|
+
return ((_a = match == null ? void 0 : match.route.routeRefs) == null ? void 0 : _a.size) > 0;
|
|
2018
2017
|
}).pop();
|
|
2019
2018
|
const routeObject = routeMatch == null ? void 0 : routeMatch.route;
|
|
2020
2019
|
if (!routeObject) {
|
|
@@ -2024,6 +2023,10 @@ const getExtensionContext = (pathname, routes) => {
|
|
|
2024
2023
|
if (routeObject.routeRefs.size === 1) {
|
|
2025
2024
|
routeRef = routeObject.routeRefs.values().next().value;
|
|
2026
2025
|
}
|
|
2026
|
+
let plugin;
|
|
2027
|
+
if (routeObject.plugins.size === 1) {
|
|
2028
|
+
plugin = routeObject.plugins.values().next().value;
|
|
2029
|
+
}
|
|
2027
2030
|
const params = Object.entries(
|
|
2028
2031
|
(routeMatch == null ? void 0 : routeMatch.params) || {}
|
|
2029
2032
|
).reduce((acc, [key, value]) => {
|
|
@@ -2034,8 +2037,9 @@ const getExtensionContext = (pathname, routes) => {
|
|
|
2034
2037
|
}, {});
|
|
2035
2038
|
return {
|
|
2036
2039
|
extension: "App",
|
|
2037
|
-
pluginId: (
|
|
2040
|
+
pluginId: (plugin == null ? void 0 : plugin.getId()) || "root",
|
|
2038
2041
|
...routeRef ? { routeRef: routeRef.id } : {},
|
|
2042
|
+
_routeNodeType: routeObject.element,
|
|
2039
2043
|
params
|
|
2040
2044
|
};
|
|
2041
2045
|
} catch {
|
|
@@ -2252,7 +2256,8 @@ const MATCH_ALL_ROUTE = {
|
|
|
2252
2256
|
path: "*",
|
|
2253
2257
|
element: "match-all",
|
|
2254
2258
|
// These elements aren't used, so we add in a bit of debug information
|
|
2255
|
-
routeRefs: /* @__PURE__ */ new Set()
|
|
2259
|
+
routeRefs: /* @__PURE__ */ new Set(),
|
|
2260
|
+
plugins: /* @__PURE__ */ new Set()
|
|
2256
2261
|
};
|
|
2257
2262
|
function stringifyNode(node) {
|
|
2258
2263
|
var _a, _b;
|
|
@@ -2262,6 +2267,13 @@ function stringifyNode(node) {
|
|
|
2262
2267
|
}
|
|
2263
2268
|
return String(anyNode);
|
|
2264
2269
|
}
|
|
2270
|
+
const pluginSet = (plugin) => {
|
|
2271
|
+
const set = /* @__PURE__ */ new Set();
|
|
2272
|
+
if (plugin) {
|
|
2273
|
+
set.add(plugin);
|
|
2274
|
+
}
|
|
2275
|
+
return set;
|
|
2276
|
+
};
|
|
2265
2277
|
function collectSubTree(node, entries = new Array()) {
|
|
2266
2278
|
Children.forEach(node, (element) => {
|
|
2267
2279
|
if (!isValidElement(element)) {
|
|
@@ -2283,7 +2295,7 @@ const routingV2Collector = createCollector(
|
|
|
2283
2295
|
objects: new Array()
|
|
2284
2296
|
}),
|
|
2285
2297
|
(acc, node, parent, ctx) => {
|
|
2286
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2298
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
2287
2299
|
if (ctx == null ? void 0 : ctx.isElementAncestor) {
|
|
2288
2300
|
return ctx;
|
|
2289
2301
|
}
|
|
@@ -2322,7 +2334,7 @@ const routingV2Collector = createCollector(
|
|
|
2322
2334
|
routeRefs: /* @__PURE__ */ new Set(),
|
|
2323
2335
|
caseSensitive: Boolean((_d = node.props) == null ? void 0 : _d.caseSensitive),
|
|
2324
2336
|
children: [MATCH_ALL_ROUTE],
|
|
2325
|
-
|
|
2337
|
+
plugins: /* @__PURE__ */ new Set()
|
|
2326
2338
|
};
|
|
2327
2339
|
parentChildren.push(newObj);
|
|
2328
2340
|
return {
|
|
@@ -2349,7 +2361,7 @@ const routingV2Collector = createCollector(
|
|
|
2349
2361
|
routeRefs: /* @__PURE__ */ new Set([routeRef]),
|
|
2350
2362
|
caseSensitive: Boolean((_e = node.props) == null ? void 0 : _e.caseSensitive),
|
|
2351
2363
|
children: [MATCH_ALL_ROUTE],
|
|
2352
|
-
plugin
|
|
2364
|
+
plugins: pluginSet(plugin)
|
|
2353
2365
|
};
|
|
2354
2366
|
parentChildren.push(newObj);
|
|
2355
2367
|
acc.paths.set(routeRef, path);
|
|
@@ -2371,6 +2383,13 @@ const routingV2Collector = createCollector(
|
|
|
2371
2383
|
);
|
|
2372
2384
|
}
|
|
2373
2385
|
(_f = ctx == null ? void 0 : ctx.obj) == null ? void 0 : _f.routeRefs.add(mountPoint);
|
|
2386
|
+
const mountPointPlugin = getComponentData(
|
|
2387
|
+
node,
|
|
2388
|
+
"core.plugin"
|
|
2389
|
+
);
|
|
2390
|
+
if (mountPointPlugin) {
|
|
2391
|
+
(_g = ctx == null ? void 0 : ctx.obj) == null ? void 0 : _g.plugins.add(mountPointPlugin);
|
|
2392
|
+
}
|
|
2374
2393
|
acc.paths.set(mountPoint, ctx.gatherPath);
|
|
2375
2394
|
acc.parents.set(mountPoint, ctx == null ? void 0 : ctx.gatherRouteRef);
|
|
2376
2395
|
return {
|
|
@@ -2440,9 +2459,11 @@ const routingV1Collector = createCollector(
|
|
|
2440
2459
|
element: "mounted",
|
|
2441
2460
|
routeRefs: /* @__PURE__ */ new Set([routeRef]),
|
|
2442
2461
|
children: [MATCH_ALL_ROUTE],
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2462
|
+
plugins: pluginSet(
|
|
2463
|
+
getComponentData(
|
|
2464
|
+
node.props.element,
|
|
2465
|
+
"core.plugin"
|
|
2466
|
+
)
|
|
2446
2467
|
)
|
|
2447
2468
|
};
|
|
2448
2469
|
parentChildren.push(currentObj);
|
|
@@ -2468,7 +2489,7 @@ const routingV1Collector = createCollector(
|
|
|
2468
2489
|
element: "gathered",
|
|
2469
2490
|
routeRefs: /* @__PURE__ */ new Set(),
|
|
2470
2491
|
children: [MATCH_ALL_ROUTE],
|
|
2471
|
-
|
|
2492
|
+
plugins: ((_e = ctx == null ? void 0 : ctx.obj) == null ? void 0 : _e.plugins) || /* @__PURE__ */ new Set()
|
|
2472
2493
|
};
|
|
2473
2494
|
parentChildren.push(currentObj);
|
|
2474
2495
|
}
|