@backstage/frontend-defaults 0.2.5-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 +17 -0
- package/dist/createApp.esm.js.map +1 -1
- package/dist/createPublicSignInApp.esm.js +3 -53
- package/dist/createPublicSignInApp.esm.js.map +1 -1
- package/dist/index.d.ts +5 -41
- package/dist/resolution.esm.js +1 -18
- package/dist/resolution.esm.js.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @backstage/frontend-defaults
|
|
2
2
|
|
|
3
|
+
## 0.3.0-next.2
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 76832a9: **BREAKING**: Removed the deprecated `CreateAppFeatureLoader` and support for it in other APIs. Switch existing usage to use the newer `createFrontendFeatureLoader` from `@backstage/frontend-plugin-api` instead.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 22de964: Deprecated `createPublicSignInApp`, which has been replaced by the new `appModulePublicSignIn` from `@backstage/plugin-app/alpha` instead.
|
|
12
|
+
- e4ddf22: Internal update to align with new blueprint parameter naming in the new frontend system.
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
- @backstage/frontend-plugin-api@0.11.0-next.1
|
|
15
|
+
- @backstage/frontend-app-api@0.12.0-next.2
|
|
16
|
+
- @backstage/plugin-app@0.2.0-next.1
|
|
17
|
+
- @backstage/config@1.3.3
|
|
18
|
+
- @backstage/errors@1.2.7
|
|
19
|
+
|
|
3
20
|
## 0.2.5-next.1
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createApp.esm.js","sources":["../src/createApp.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JSX, lazy, ReactNode, Suspense } from 'react';\nimport {\n ConfigApi,\n coreExtensionData,\n ExtensionFactoryMiddleware,\n FrontendFeature,\n FrontendFeatureLoader,\n} from '@backstage/frontend-plugin-api';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { defaultConfigLoaderSync } from '../../core-app-api/src/app/defaultConfigLoader';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { overrideBaseUrlConfigs } from '../../core-app-api/src/app/overrideBaseUrlConfigs';\nimport { ConfigReader } from '@backstage/config';\nimport {\n CreateAppRouteBinder,\n createSpecializedApp,\n FrontendPluginInfoResolver,\n} from '@backstage/frontend-app-api';\nimport appPlugin from '@backstage/plugin-app';\nimport { discoverAvailableFeatures } from './discovery';\nimport { resolveAsyncFeatures } from './resolution';\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"createApp.esm.js","sources":["../src/createApp.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JSX, lazy, ReactNode, Suspense } from 'react';\nimport {\n ConfigApi,\n coreExtensionData,\n ExtensionFactoryMiddleware,\n FrontendFeature,\n FrontendFeatureLoader,\n} from '@backstage/frontend-plugin-api';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { defaultConfigLoaderSync } from '../../core-app-api/src/app/defaultConfigLoader';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { overrideBaseUrlConfigs } from '../../core-app-api/src/app/overrideBaseUrlConfigs';\nimport { ConfigReader } from '@backstage/config';\nimport {\n CreateAppRouteBinder,\n createSpecializedApp,\n FrontendPluginInfoResolver,\n} from '@backstage/frontend-app-api';\nimport appPlugin from '@backstage/plugin-app';\nimport { discoverAvailableFeatures } from './discovery';\nimport { resolveAsyncFeatures } from './resolution';\n\n/**\n * Options for {@link createApp}.\n *\n * @public\n */\nexport interface CreateAppOptions {\n features?: (FrontendFeature | FrontendFeatureLoader)[];\n configLoader?: () => Promise<{ config: ConfigApi }>;\n bindRoutes?(context: { bind: CreateAppRouteBinder }): void;\n /**\n * The component to render while loading the app (waiting for config, features, etc)\n *\n * Is the text \"Loading...\" by default.\n * If set to \"null\" then no loading fallback component is rendered. *\n */\n loadingComponent?: ReactNode;\n extensionFactoryMiddleware?:\n | ExtensionFactoryMiddleware\n | ExtensionFactoryMiddleware[];\n pluginInfoResolver?: FrontendPluginInfoResolver;\n flags?: { allowUnknownExtensionConfig?: boolean };\n}\n\n/**\n * Creates a new Backstage frontend app instance. See https://backstage.io/docs/frontend-system/building-apps/index\n *\n * @public\n */\nexport function createApp(options?: CreateAppOptions): {\n createRoot(): JSX.Element;\n} {\n let suspenseFallback = options?.loadingComponent;\n if (suspenseFallback === undefined) {\n suspenseFallback = 'Loading...';\n }\n\n async function appLoader() {\n const config =\n (await options?.configLoader?.().then(c => c.config)) ??\n ConfigReader.fromConfigs(\n overrideBaseUrlConfigs(defaultConfigLoaderSync()),\n );\n\n const { features: discoveredFeaturesAndLoaders } =\n discoverAvailableFeatures(config);\n const { features: loadedFeatures } = await resolveAsyncFeatures({\n config,\n features: [...discoveredFeaturesAndLoaders, ...(options?.features ?? [])],\n });\n\n const app = createSpecializedApp({\n config,\n features: [appPlugin, ...loadedFeatures],\n bindRoutes: options?.bindRoutes,\n extensionFactoryMiddleware: options?.extensionFactoryMiddleware,\n pluginInfoResolver: options?.pluginInfoResolver,\n flags: options?.flags,\n });\n\n const rootEl = app.tree.root.instance!.getData(\n coreExtensionData.reactElement,\n );\n\n return { default: () => rootEl };\n }\n\n return {\n createRoot() {\n const LazyApp = lazy(appLoader);\n return (\n <Suspense fallback={suspenseFallback}>\n <LazyApp />\n </Suspense>\n );\n },\n };\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAkEO,SAAS,UAAU,OAExB,EAAA;AACA,EAAA,IAAI,mBAAmB,OAAS,EAAA,gBAAA;AAChC,EAAA,IAAI,qBAAqB,KAAW,CAAA,EAAA;AAClC,IAAmB,gBAAA,GAAA,YAAA;AAAA;AAGrB,EAAA,eAAe,SAAY,GAAA;AACzB,IAAM,MAAA,MAAA,GACH,MAAM,OAAA,EAAS,YAAe,IAAA,CAAE,KAAK,CAAK,CAAA,KAAA,CAAA,CAAE,MAAM,CAAA,IACnD,YAAa,CAAA,WAAA;AAAA,MACX,sBAAA,CAAuB,yBAAyB;AAAA,KAClD;AAEF,IAAA,MAAM,EAAE,QAAA,EAAU,4BAA6B,EAAA,GAC7C,0BAA0B,MAAM,CAAA;AAClC,IAAA,MAAM,EAAE,QAAA,EAAU,cAAe,EAAA,GAAI,MAAM,oBAAqB,CAAA;AAAA,MAC9D,MAAA;AAAA,MACA,QAAA,EAAU,CAAC,GAAG,4BAAA,EAA8B,GAAI,OAAS,EAAA,QAAA,IAAY,EAAG;AAAA,KACzE,CAAA;AAED,IAAA,MAAM,MAAM,oBAAqB,CAAA;AAAA,MAC/B,MAAA;AAAA,MACA,QAAU,EAAA,CAAC,SAAW,EAAA,GAAG,cAAc,CAAA;AAAA,MACvC,YAAY,OAAS,EAAA,UAAA;AAAA,MACrB,4BAA4B,OAAS,EAAA,0BAAA;AAAA,MACrC,oBAAoB,OAAS,EAAA,kBAAA;AAAA,MAC7B,OAAO,OAAS,EAAA;AAAA,KACjB,CAAA;AAED,IAAA,MAAM,MAAS,GAAA,GAAA,CAAI,IAAK,CAAA,IAAA,CAAK,QAAU,CAAA,OAAA;AAAA,MACrC,iBAAkB,CAAA;AAAA,KACpB;AAEA,IAAO,OAAA,EAAE,OAAS,EAAA,MAAM,MAAO,EAAA;AAAA;AAGjC,EAAO,OAAA;AAAA,IACL,UAAa,GAAA;AACX,MAAM,MAAA,OAAA,GAAU,KAAK,SAAS,CAAA;AAC9B,MAAA,2BACG,QAAS,EAAA,EAAA,QAAA,EAAU,gBAClB,EAAA,QAAA,kBAAA,GAAA,CAAC,WAAQ,CACX,EAAA,CAAA;AAAA;AAEJ,GACF;AACF;;;;"}
|
|
@@ -1,62 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createFrontendModule, coreExtensionData, useApi, identityApiRef } from '@backstage/frontend-plugin-api';
|
|
3
|
-
import { useAsync, useMountEffect } from '@react-hookz/web';
|
|
1
|
+
import { appModulePublicSignIn } from '@backstage/plugin-app/alpha';
|
|
4
2
|
import { createApp } from './createApp.esm.js';
|
|
5
|
-
import appPlugin from '@backstage/plugin-app';
|
|
6
3
|
|
|
7
|
-
function InternalCookieAuthRedirect() {
|
|
8
|
-
const identityApi = useApi(identityApiRef);
|
|
9
|
-
const [state, actions] = useAsync(async () => {
|
|
10
|
-
const { token } = await identityApi.getCredentials();
|
|
11
|
-
if (!token) {
|
|
12
|
-
throw new Error("Expected Backstage token in sign-in response");
|
|
13
|
-
}
|
|
14
|
-
return token;
|
|
15
|
-
});
|
|
16
|
-
useMountEffect(actions.execute);
|
|
17
|
-
if (state.status === "error" && state.error) {
|
|
18
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
19
|
-
"An error occurred: ",
|
|
20
|
-
state.error.message
|
|
21
|
-
] });
|
|
22
|
-
}
|
|
23
|
-
if (state.status === "success" && state.result) {
|
|
24
|
-
return /* @__PURE__ */ jsxs(
|
|
25
|
-
"form",
|
|
26
|
-
{
|
|
27
|
-
ref: (form) => form?.submit(),
|
|
28
|
-
action: window.location.href,
|
|
29
|
-
method: "POST",
|
|
30
|
-
style: { visibility: "hidden" },
|
|
31
|
-
children: [
|
|
32
|
-
/* @__PURE__ */ jsx("input", { type: "hidden", name: "type", value: "sign-in" }),
|
|
33
|
-
/* @__PURE__ */ jsx("input", { type: "hidden", name: "token", value: state.result }),
|
|
34
|
-
/* @__PURE__ */ jsx("input", { type: "submit", value: "Continue" })
|
|
35
|
-
]
|
|
36
|
-
}
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
4
|
function createPublicSignInApp(options) {
|
|
42
5
|
return createApp({
|
|
43
6
|
...options,
|
|
44
|
-
features: [
|
|
45
|
-
...options?.features ?? [],
|
|
46
|
-
// This is a rather than app plugin override in order for it to take precedence over any supplied app plugin override
|
|
47
|
-
createFrontendModule({
|
|
48
|
-
pluginId: "app",
|
|
49
|
-
extensions: [
|
|
50
|
-
appPlugin.getExtension("app/layout").override({
|
|
51
|
-
factory: () => [
|
|
52
|
-
coreExtensionData.reactElement(/* @__PURE__ */ jsx(InternalCookieAuthRedirect, {}))
|
|
53
|
-
]
|
|
54
|
-
})
|
|
55
|
-
]
|
|
56
|
-
})
|
|
57
|
-
]
|
|
7
|
+
features: [...options?.features ?? [], appModulePublicSignIn]
|
|
58
8
|
});
|
|
59
9
|
}
|
|
60
10
|
|
|
61
|
-
export {
|
|
11
|
+
export { createPublicSignInApp };
|
|
62
12
|
//# sourceMappingURL=createPublicSignInApp.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPublicSignInApp.esm.js","sources":["../src/createPublicSignInApp.tsx"],"sourcesContent":["/*\n * Copyright
|
|
1
|
+
{"version":3,"file":"createPublicSignInApp.esm.js","sources":["../src/createPublicSignInApp.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { appModulePublicSignIn } from '@backstage/plugin-app/alpha';\nimport { CreateAppOptions, createApp } from './createApp';\n\n/**\n * @public\n * @deprecated Use {@link @backstage/plugin-app/alpha#appModulePublicSignIn} instead.\n */\nexport function createPublicSignInApp(options?: CreateAppOptions) {\n return createApp({\n ...options,\n features: [...(options?.features ?? []), appModulePublicSignIn],\n });\n}\n"],"names":[],"mappings":";;;AAuBO,SAAS,sBAAsB,OAA4B,EAAA;AAChE,EAAA,OAAO,SAAU,CAAA;AAAA,IACf,GAAG,OAAA;AAAA,IACH,UAAU,CAAC,GAAI,SAAS,QAAY,IAAA,IAAK,qBAAqB;AAAA,GAC/D,CAAA;AACH;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,36 +1,16 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, JSX } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { FrontendFeature, FrontendFeatureLoader, ConfigApi, ExtensionFactoryMiddleware } from '@backstage/frontend-plugin-api';
|
|
4
4
|
import { CreateAppRouteBinder, FrontendPluginInfoResolver } from '@backstage/frontend-app-api';
|
|
5
5
|
import { Config } from '@backstage/config';
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* A source of dynamically loaded frontend features.
|
|
9
|
-
*
|
|
10
|
-
* @public
|
|
11
|
-
* @deprecated Use the {@link @backstage/frontend-plugin-api#createFrontendFeatureLoader} function instead.
|
|
12
|
-
*/
|
|
13
|
-
interface CreateAppFeatureLoader {
|
|
14
|
-
/**
|
|
15
|
-
* Returns name of this loader. suitable for showing to users.
|
|
16
|
-
*/
|
|
17
|
-
getLoaderName(): string;
|
|
18
|
-
/**
|
|
19
|
-
* Loads a number of features dynamically.
|
|
20
|
-
*/
|
|
21
|
-
load(options: {
|
|
22
|
-
config: ConfigApi;
|
|
23
|
-
}): Promise<{
|
|
24
|
-
features: FrontendFeature[];
|
|
25
|
-
}>;
|
|
26
|
-
}
|
|
27
7
|
/**
|
|
28
8
|
* Options for {@link createApp}.
|
|
29
9
|
*
|
|
30
10
|
* @public
|
|
31
11
|
*/
|
|
32
12
|
interface CreateAppOptions {
|
|
33
|
-
features?: (FrontendFeature | FrontendFeatureLoader
|
|
13
|
+
features?: (FrontendFeature | FrontendFeatureLoader)[];
|
|
34
14
|
configLoader?: () => Promise<{
|
|
35
15
|
config: ConfigApi;
|
|
36
16
|
}>;
|
|
@@ -60,24 +40,8 @@ declare function createApp(options?: CreateAppOptions): {
|
|
|
60
40
|
};
|
|
61
41
|
|
|
62
42
|
/**
|
|
63
|
-
* Creates an app that is suitable for the public sign-in page, for use in the `index-public-experimental.tsx` file.
|
|
64
|
-
*
|
|
65
|
-
* @remarks
|
|
66
|
-
*
|
|
67
|
-
* This app has an override for the `app/layout` extension, which means that
|
|
68
|
-
* most extension typically installed in an app will be ignored. However, you
|
|
69
|
-
* can still for example install API and root element extensions.
|
|
70
|
-
*
|
|
71
|
-
* A typical setup of this app will only install a custom sign-in page.
|
|
72
|
-
*
|
|
73
|
-
* @example
|
|
74
|
-
* ```ts
|
|
75
|
-
* const app = createPublicSignInApp({
|
|
76
|
-
* features: [signInPageModule],
|
|
77
|
-
* });
|
|
78
|
-
* ```
|
|
79
|
-
*
|
|
80
43
|
* @public
|
|
44
|
+
* @deprecated Use {@link @backstage/plugin-app/alpha#appModulePublicSignIn} instead.
|
|
81
45
|
*/
|
|
82
46
|
declare function createPublicSignInApp(options?: CreateAppOptions): {
|
|
83
47
|
createRoot(): react.JSX.Element;
|
|
@@ -93,9 +57,9 @@ declare function discoverAvailableFeatures(config: Config): {
|
|
|
93
57
|
/** @public */
|
|
94
58
|
declare function resolveAsyncFeatures(options: {
|
|
95
59
|
config: Config;
|
|
96
|
-
features?: (FrontendFeature | FrontendFeatureLoader
|
|
60
|
+
features?: (FrontendFeature | FrontendFeatureLoader)[];
|
|
97
61
|
}): Promise<{
|
|
98
62
|
features: FrontendFeature[];
|
|
99
63
|
}>;
|
|
100
64
|
|
|
101
|
-
export { type
|
|
65
|
+
export { type CreateAppOptions, createApp, createPublicSignInApp, discoverAvailableFeatures, resolveAsyncFeatures };
|
package/dist/resolution.esm.js
CHANGED
|
@@ -2,23 +2,6 @@ import { stringifyError } from '@backstage/errors';
|
|
|
2
2
|
import { isInternalFrontendFeatureLoader } from './frontend-plugin-api/src/wiring/createFrontendFeatureLoader.esm.js';
|
|
3
3
|
|
|
4
4
|
async function resolveAsyncFeatures(options) {
|
|
5
|
-
const features = [];
|
|
6
|
-
for (const item of options?.features ?? []) {
|
|
7
|
-
if ("load" in item) {
|
|
8
|
-
try {
|
|
9
|
-
const result = await item.load({ config: options.config });
|
|
10
|
-
features.push(...result.features);
|
|
11
|
-
} catch (e) {
|
|
12
|
-
throw new Error(
|
|
13
|
-
`Failed to read frontend features from loader '${item.getLoaderName()}', ${stringifyError(
|
|
14
|
-
e
|
|
15
|
-
)}`
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
} else {
|
|
19
|
-
features.push(item);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
5
|
const loadedFeatures = [];
|
|
23
6
|
const alreadyMetFeatureLoaders = [];
|
|
24
7
|
const maxRecursionDepth = 5;
|
|
@@ -53,7 +36,7 @@ async function resolveAsyncFeatures(options) {
|
|
|
53
36
|
}
|
|
54
37
|
}
|
|
55
38
|
}
|
|
56
|
-
await applyFeatureLoaders(features, 1);
|
|
39
|
+
await applyFeatureLoaders(options.features ?? [], 1);
|
|
57
40
|
return { features: loadedFeatures };
|
|
58
41
|
}
|
|
59
42
|
function isBackstageFeatureLoader(obj) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolution.esm.js","sources":["../src/resolution.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Config } from '@backstage/config';\nimport { stringifyError } from '@backstage/errors';\nimport {\n FrontendFeature,\n FrontendFeatureLoader,\n} from '@backstage/frontend-plugin-api';\
|
|
1
|
+
{"version":3,"file":"resolution.esm.js","sources":["../src/resolution.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Config } from '@backstage/config';\nimport { stringifyError } from '@backstage/errors';\nimport {\n FrontendFeature,\n FrontendFeatureLoader,\n} from '@backstage/frontend-plugin-api';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { isInternalFrontendFeatureLoader } from '../../frontend-plugin-api/src/wiring/createFrontendFeatureLoader';\n\n/** @public */\nexport async function resolveAsyncFeatures(options: {\n config: Config;\n features?: (FrontendFeature | FrontendFeatureLoader)[];\n}): Promise<{ features: FrontendFeature[] }> {\n const loadedFeatures: FrontendFeature[] = [];\n const alreadyMetFeatureLoaders: FrontendFeatureLoader[] = [];\n const maxRecursionDepth = 5;\n\n async function applyFeatureLoaders(\n featuresOrLoaders: (FrontendFeature | FrontendFeatureLoader)[],\n recursionDepth: number,\n ) {\n if (featuresOrLoaders.length === 0) {\n return;\n }\n\n for (const featureOrLoader of featuresOrLoaders) {\n if (isBackstageFeatureLoader(featureOrLoader)) {\n if (alreadyMetFeatureLoaders.some(l => l === featureOrLoader)) {\n continue;\n }\n if (isInternalFrontendFeatureLoader(featureOrLoader)) {\n if (recursionDepth > maxRecursionDepth) {\n throw new Error(\n `Maximum feature loading recursion depth (${maxRecursionDepth}) reached for the feature loader ${featureOrLoader.description}`,\n );\n }\n alreadyMetFeatureLoaders.push(featureOrLoader);\n let result: (FrontendFeature | FrontendFeatureLoader)[];\n try {\n result = await featureOrLoader.loader({ config: options.config });\n } catch (e) {\n throw new Error(\n `Failed to read frontend features from loader ${\n featureOrLoader.description\n }: ${stringifyError(e)}`,\n );\n }\n await applyFeatureLoaders(result, recursionDepth + 1);\n }\n } else {\n loadedFeatures.push(featureOrLoader);\n }\n }\n }\n\n await applyFeatureLoaders(options.features ?? [], 1);\n\n return { features: loadedFeatures };\n}\n\nexport function isBackstageFeatureLoader(\n obj: unknown,\n): obj is FrontendFeatureLoader {\n return (\n obj !== null &&\n typeof obj === 'object' &&\n '$$type' in obj &&\n obj.$$type === '@backstage/FrontendFeatureLoader'\n );\n}\n"],"names":[],"mappings":";;;AA0BA,eAAsB,qBAAqB,OAGE,EAAA;AAC3C,EAAA,MAAM,iBAAoC,EAAC;AAC3C,EAAA,MAAM,2BAAoD,EAAC;AAC3D,EAAA,MAAM,iBAAoB,GAAA,CAAA;AAE1B,EAAe,eAAA,mBAAA,CACb,mBACA,cACA,EAAA;AACA,IAAI,IAAA,iBAAA,CAAkB,WAAW,CAAG,EAAA;AAClC,MAAA;AAAA;AAGF,IAAA,KAAA,MAAW,mBAAmB,iBAAmB,EAAA;AAC/C,MAAI,IAAA,wBAAA,CAAyB,eAAe,CAAG,EAAA;AAC7C,QAAA,IAAI,wBAAyB,CAAA,IAAA,CAAK,CAAK,CAAA,KAAA,CAAA,KAAM,eAAe,CAAG,EAAA;AAC7D,UAAA;AAAA;AAEF,QAAI,IAAA,+BAAA,CAAgC,eAAe,CAAG,EAAA;AACpD,UAAA,IAAI,iBAAiB,iBAAmB,EAAA;AACtC,YAAA,MAAM,IAAI,KAAA;AAAA,cACR,CAA4C,yCAAA,EAAA,iBAAiB,CAAoC,iCAAA,EAAA,eAAA,CAAgB,WAAW,CAAA;AAAA,aAC9H;AAAA;AAEF,UAAA,wBAAA,CAAyB,KAAK,eAAe,CAAA;AAC7C,UAAI,IAAA,MAAA;AACJ,UAAI,IAAA;AACF,YAAA,MAAA,GAAS,MAAM,eAAgB,CAAA,MAAA,CAAO,EAAE,MAAQ,EAAA,OAAA,CAAQ,QAAQ,CAAA;AAAA,mBACzD,CAAG,EAAA;AACV,YAAA,MAAM,IAAI,KAAA;AAAA,cACR,gDACE,eAAgB,CAAA,WAClB,CAAK,EAAA,EAAA,cAAA,CAAe,CAAC,CAAC,CAAA;AAAA,aACxB;AAAA;AAEF,UAAM,MAAA,mBAAA,CAAoB,MAAQ,EAAA,cAAA,GAAiB,CAAC,CAAA;AAAA;AACtD,OACK,MAAA;AACL,QAAA,cAAA,CAAe,KAAK,eAAe,CAAA;AAAA;AACrC;AACF;AAGF,EAAA,MAAM,mBAAoB,CAAA,OAAA,CAAQ,QAAY,IAAA,IAAI,CAAC,CAAA;AAEnD,EAAO,OAAA,EAAE,UAAU,cAAe,EAAA;AACpC;AAEO,SAAS,yBACd,GAC8B,EAAA;AAC9B,EACE,OAAA,GAAA,KAAQ,QACR,OAAO,GAAA,KAAQ,YACf,QAAY,IAAA,GAAA,IACZ,IAAI,MAAW,KAAA,kCAAA;AAEnB;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/frontend-defaults",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0-next.2",
|
|
4
4
|
"backstage": {
|
|
5
5
|
"role": "web-library"
|
|
6
6
|
},
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@backstage/config": "1.3.3",
|
|
35
35
|
"@backstage/errors": "1.2.7",
|
|
36
|
-
"@backstage/frontend-app-api": "0.
|
|
37
|
-
"@backstage/frontend-plugin-api": "0.11.0-next.
|
|
38
|
-
"@backstage/plugin-app": "0.2.0-next.
|
|
36
|
+
"@backstage/frontend-app-api": "0.12.0-next.2",
|
|
37
|
+
"@backstage/frontend-plugin-api": "0.11.0-next.1",
|
|
38
|
+
"@backstage/plugin-app": "0.2.0-next.1",
|
|
39
39
|
"@react-hookz/web": "^24.0.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@backstage/cli": "0.
|
|
42
|
+
"@backstage/cli": "0.34.0-next.1",
|
|
43
43
|
"@backstage/core-plugin-api": "1.10.9",
|
|
44
44
|
"@backstage/test-utils": "1.7.11-next.0",
|
|
45
45
|
"@testing-library/jest-dom": "^6.0.0",
|