@backstage/frontend-plugin-api 0.17.3-next.1 → 0.18.0-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 +20 -0
- package/dist/alpha.d.ts +1 -2
- package/dist/alpha.esm.js +0 -2
- package/dist/alpha.esm.js.map +1 -1
- package/dist/blueprints/AnalyticsImplementationBlueprint.esm.js +0 -2
- package/dist/blueprints/AnalyticsImplementationBlueprint.esm.js.map +1 -1
- package/dist/blueprints/ApiBlueprint.esm.js +0 -2
- package/dist/blueprints/ApiBlueprint.esm.js.map +1 -1
- package/dist/blueprints/AppRootElementBlueprint.esm.js +0 -2
- package/dist/blueprints/AppRootElementBlueprint.esm.js.map +1 -1
- package/dist/blueprints/PageBlueprint.esm.js +3 -5
- package/dist/blueprints/PageBlueprint.esm.js.map +1 -1
- package/dist/blueprints/PluginHeaderActionBlueprint.esm.js +0 -2
- package/dist/blueprints/PluginHeaderActionBlueprint.esm.js.map +1 -1
- package/dist/blueprints/PluginWrapperBlueprint.esm.js +0 -2
- package/dist/blueprints/PluginWrapperBlueprint.esm.js.map +1 -1
- package/dist/blueprints/SubPageBlueprint.esm.js +3 -5
- package/dist/blueprints/SubPageBlueprint.esm.js.map +1 -1
- package/dist/components/ExtensionBoundary.esm.js +0 -2
- package/dist/components/ExtensionBoundary.esm.js.map +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/schema/assertNoLegacyConfigSchema.esm.js +10 -0
- package/dist/schema/assertNoLegacyConfigSchema.esm.js.map +1 -0
- package/dist/schema/createPortableSchema.esm.js +5 -70
- package/dist/schema/createPortableSchema.esm.js.map +1 -1
- package/dist/schema/optionalStringSchema.esm.js +33 -0
- package/dist/schema/optionalStringSchema.esm.js.map +1 -0
- package/dist/types/{alpha.d-BScvftwR.d.ts → alpha.d-CUDLigYe.d.ts} +1 -192
- package/dist/wiring/createExtension.esm.js +5 -18
- package/dist/wiring/createExtension.esm.js.map +1 -1
- package/dist/wiring/createExtensionBlueprint.esm.js +3 -12
- package/dist/wiring/createExtensionBlueprint.esm.js.map +1 -1
- package/package.json +9 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @backstage/frontend-plugin-api
|
|
2
2
|
|
|
3
|
+
## 0.18.0-next.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 907793c: **BREAKING**: Removed the deprecated `config.schema` option for extensions and extension blueprints. Use the top-level `configSchema` option with Standard Schema-compatible schema values, such as Zod v4.
|
|
8
|
+
|
|
9
|
+
## 0.17.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- a5b2811: Adds `useBreadcrumbEntries` hook, `BreadcrumbEntry` component, and `BreadcrumbsRegistryProvider` for managing breadcrumb trails across the component tree for plugins using new frontend system. Completes wiring so that new frontend system plugin `Pages` and `SubPages` get automatic-population of `PluginHeader` breadcrumbs.
|
|
14
|
+
|
|
15
|
+
- The app plugin's `PageLayout` registers a root breadcrumb for each plugin page and passes the breadcrumb trail to `PluginHeader`
|
|
16
|
+
- `PageBlueprint` automatically wraps each sub-page route element with `BreadcrumbEntry`, so sub-pages contribute to the PluginHeader breadcrumb trail without extra wiring.
|
|
17
|
+
- Plugin authors who need breadcrumbs for internal routes within a sub-page can wrap their route content with `BreadcrumbEntry` manually.
|
|
18
|
+
- `plugin-scaffolder` internal routes have been wrapped as an example
|
|
19
|
+
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
- @backstage/filter-predicates@0.1.4
|
|
22
|
+
|
|
3
23
|
## 0.17.3-next.1
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/alpha.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export { b as AnyRouteRefParams, d as ApiHolder, e as ApiRef, f as AppNode, g as AppNodeEdges, h as AppNodeInstance, i as AppNodeSpec, j as AppTree, C as ConfigurableExtensionDataRef, E as Extension, p as ExtensionAttachTo, q as ExtensionBlueprint, r as ExtensionBlueprintDefineParams, s as ExtensionBlueprintParameters, t as ExtensionBlueprintParams, u as ExtensionDataContainer, v as ExtensionDataRef, w as ExtensionDataValue, x as ExtensionDefinition, y as ExtensionDefinitionAttachTo, z as ExtensionDefinitionParameters, D as ExtensionInput, F as ExternalRouteRef, J as FrontendPlugin, K as FrontendPluginInfo, N as IconElement, O as OverridableExtensionDefinition, R as PluginWrapperApi, S as PluginWrapperBlueprint, T as PluginWrapperDefinition, U as PortableSchema, V as RouteRef, W as SubRouteRef, $ as createExtensionBlueprintParams, a7 as pluginWrapperApiRef } from './types/alpha.d-
|
|
1
|
+
export { b as AnyRouteRefParams, d as ApiHolder, e as ApiRef, f as AppNode, g as AppNodeEdges, h as AppNodeInstance, i as AppNodeSpec, j as AppTree, C as ConfigurableExtensionDataRef, E as Extension, p as ExtensionAttachTo, q as ExtensionBlueprint, r as ExtensionBlueprintDefineParams, s as ExtensionBlueprintParameters, t as ExtensionBlueprintParams, u as ExtensionDataContainer, v as ExtensionDataRef, w as ExtensionDataValue, x as ExtensionDefinition, y as ExtensionDefinitionAttachTo, z as ExtensionDefinitionParameters, D as ExtensionInput, F as ExternalRouteRef, J as FrontendPlugin, K as FrontendPluginInfo, N as IconElement, O as OverridableExtensionDefinition, R as PluginWrapperApi, S as PluginWrapperBlueprint, T as PluginWrapperDefinition, U as PortableSchema, V as RouteRef, W as SubRouteRef, $ as createExtensionBlueprintParams, a7 as pluginWrapperApiRef } from './types/alpha.d-CUDLigYe.js';
|
|
2
2
|
export { StandardSchemaV1 } from '@standard-schema/spec';
|
|
3
3
|
import '@backstage/frontend-plugin-api';
|
|
4
4
|
import 'react';
|
|
5
5
|
import '@backstage/types';
|
|
6
6
|
import '@backstage/filter-predicates';
|
|
7
|
-
import 'zod/v3';
|
package/dist/alpha.esm.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
export { PluginWrapperBlueprint } from './blueprints/PluginWrapperBlueprint.esm.js';
|
|
2
2
|
import './wiring/coreExtensionData.esm.js';
|
|
3
|
-
import 'zod/v3';
|
|
4
|
-
import 'zod-to-json-schema';
|
|
5
3
|
export { createExtensionBlueprintParams } from './wiring/createExtensionBlueprint.esm.js';
|
|
6
4
|
export { pluginWrapperApiRef } from './apis/definitions/PluginWrapperApi.esm.js';
|
|
7
5
|
//# sourceMappingURL=alpha.esm.js.map
|
package/dist/alpha.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alpha.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"alpha.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import '../wiring/coreExtensionData.esm.js';
|
|
2
|
-
import 'zod/v3';
|
|
3
|
-
import 'zod-to-json-schema';
|
|
4
2
|
import { createExtensionDataRef } from '../wiring/createExtensionDataRef.esm.js';
|
|
5
3
|
import { createExtensionBlueprint, createExtensionBlueprintParams } from '../wiring/createExtensionBlueprint.esm.js';
|
|
6
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnalyticsImplementationBlueprint.esm.js","sources":["../../src/blueprints/AnalyticsImplementationBlueprint.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 { AnalyticsImplementation, TypesToApiRefs } from '../apis';\nimport {\n createExtensionBlueprint,\n createExtensionBlueprintParams,\n createExtensionDataRef,\n} from '../wiring';\n\n/**\n * @public\n * @deprecated Use `AnalyticsImplementationFactory` from `@backstage/plugin-app-react` instead.\n */\nexport type AnalyticsImplementationFactory<\n Deps extends { [name in string]: unknown } = {},\n> = {\n deps: TypesToApiRefs<Deps>;\n factory(deps: Deps): AnalyticsImplementation;\n};\n\nconst factoryDataRef =\n createExtensionDataRef<AnalyticsImplementationFactory>().with({\n id: 'core.analytics.factory',\n });\n\n/**\n * Creates analytics implementations.\n *\n * @public\n * @deprecated Use `AnalyticsImplementationBlueprint` from `@backstage/plugin-app-react` instead.\n */\nexport const AnalyticsImplementationBlueprint = createExtensionBlueprint({\n kind: 'analytics',\n attachTo: { id: 'api:app/analytics', input: 'implementations' },\n output: [factoryDataRef],\n dataRefs: {\n factory: factoryDataRef,\n },\n defineParams: <TDeps extends { [name in string]: unknown }>(\n params: AnalyticsImplementationFactory<TDeps>,\n ) => createExtensionBlueprintParams(params as AnalyticsImplementationFactory),\n *factory(params) {\n yield factoryDataRef(params);\n },\n});\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AnalyticsImplementationBlueprint.esm.js","sources":["../../src/blueprints/AnalyticsImplementationBlueprint.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 { AnalyticsImplementation, TypesToApiRefs } from '../apis';\nimport {\n createExtensionBlueprint,\n createExtensionBlueprintParams,\n createExtensionDataRef,\n} from '../wiring';\n\n/**\n * @public\n * @deprecated Use `AnalyticsImplementationFactory` from `@backstage/plugin-app-react` instead.\n */\nexport type AnalyticsImplementationFactory<\n Deps extends { [name in string]: unknown } = {},\n> = {\n deps: TypesToApiRefs<Deps>;\n factory(deps: Deps): AnalyticsImplementation;\n};\n\nconst factoryDataRef =\n createExtensionDataRef<AnalyticsImplementationFactory>().with({\n id: 'core.analytics.factory',\n });\n\n/**\n * Creates analytics implementations.\n *\n * @public\n * @deprecated Use `AnalyticsImplementationBlueprint` from `@backstage/plugin-app-react` instead.\n */\nexport const AnalyticsImplementationBlueprint = createExtensionBlueprint({\n kind: 'analytics',\n attachTo: { id: 'api:app/analytics', input: 'implementations' },\n output: [factoryDataRef],\n dataRefs: {\n factory: factoryDataRef,\n },\n defineParams: <TDeps extends { [name in string]: unknown }>(\n params: AnalyticsImplementationFactory<TDeps>,\n ) => createExtensionBlueprintParams(params as AnalyticsImplementationFactory),\n *factory(params) {\n yield factoryDataRef(params);\n },\n});\n"],"names":[],"mappings":";;;;AAkCA,MAAM,cAAA,GACJ,sBAAA,EAAuD,CAAE,IAAA,CAAK;AAAA,EAC5D,EAAA,EAAI;AACN,CAAC,CAAA;AAQI,MAAM,mCAAmC,wBAAA,CAAyB;AAAA,EACvE,IAAA,EAAM,WAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,mBAAA,EAAqB,OAAO,iBAAA,EAAkB;AAAA,EAC9D,MAAA,EAAQ,CAAC,cAAc,CAAA;AAAA,EACvB,QAAA,EAAU;AAAA,IACR,OAAA,EAAS;AAAA,GACX;AAAA,EACA,YAAA,EAAc,CACZ,MAAA,KACG,8BAAA,CAA+B,MAAwC,CAAA;AAAA,EAC5E,CAAC,QAAQ,MAAA,EAAQ;AACf,IAAA,MAAM,eAAe,MAAM,CAAA;AAAA,EAC7B;AACF,CAAC;;;;"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import '../wiring/coreExtensionData.esm.js';
|
|
2
|
-
import 'zod/v3';
|
|
3
|
-
import 'zod-to-json-schema';
|
|
4
2
|
import { createExtensionDataRef } from '../wiring/createExtensionDataRef.esm.js';
|
|
5
3
|
import { createExtensionBlueprint, createExtensionBlueprintParams } from '../wiring/createExtensionBlueprint.esm.js';
|
|
6
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiBlueprint.esm.js","sources":["../../src/blueprints/ApiBlueprint.ts"],"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 { AnyApiFactory, ApiFactory } from '../apis/system';\nimport { createExtensionBlueprint, createExtensionDataRef } from '../wiring';\nimport { createExtensionBlueprintParams } from '../wiring/createExtensionBlueprint';\n\nconst factoryDataRef = createExtensionDataRef<AnyApiFactory>().with({\n id: 'core.api.factory',\n});\n\n/**\n * Creates utility API extensions.\n *\n * @public\n */\nexport const ApiBlueprint = createExtensionBlueprint({\n kind: 'api',\n attachTo: { id: 'root', input: 'apis' },\n output: [factoryDataRef],\n dataRefs: {\n factory: factoryDataRef,\n },\n defineParams: <\n TApi,\n TImpl extends TApi,\n TDeps extends { [name in string]: unknown },\n >(\n params: ApiFactory<TApi, TImpl, TDeps>,\n ) => createExtensionBlueprintParams(params as AnyApiFactory),\n *factory(params) {\n yield factoryDataRef(params);\n },\n});\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ApiBlueprint.esm.js","sources":["../../src/blueprints/ApiBlueprint.ts"],"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 { AnyApiFactory, ApiFactory } from '../apis/system';\nimport { createExtensionBlueprint, createExtensionDataRef } from '../wiring';\nimport { createExtensionBlueprintParams } from '../wiring/createExtensionBlueprint';\n\nconst factoryDataRef = createExtensionDataRef<AnyApiFactory>().with({\n id: 'core.api.factory',\n});\n\n/**\n * Creates utility API extensions.\n *\n * @public\n */\nexport const ApiBlueprint = createExtensionBlueprint({\n kind: 'api',\n attachTo: { id: 'root', input: 'apis' },\n output: [factoryDataRef],\n dataRefs: {\n factory: factoryDataRef,\n },\n defineParams: <\n TApi,\n TImpl extends TApi,\n TDeps extends { [name in string]: unknown },\n >(\n params: ApiFactory<TApi, TImpl, TDeps>,\n ) => createExtensionBlueprintParams(params as AnyApiFactory),\n *factory(params) {\n yield factoryDataRef(params);\n },\n});\n"],"names":[],"mappings":";;;;AAoBA,MAAM,cAAA,GAAiB,sBAAA,EAAsC,CAAE,IAAA,CAAK;AAAA,EAClE,EAAA,EAAI;AACN,CAAC,CAAA;AAOM,MAAM,eAAe,wBAAA,CAAyB;AAAA,EACnD,IAAA,EAAM,KAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,MAAA,EAAQ,OAAO,MAAA,EAAO;AAAA,EACtC,MAAA,EAAQ,CAAC,cAAc,CAAA;AAAA,EACvB,QAAA,EAAU;AAAA,IACR,OAAA,EAAS;AAAA,GACX;AAAA,EACA,YAAA,EAAc,CAKZ,MAAA,KACG,8BAAA,CAA+B,MAAuB,CAAA;AAAA,EAC3D,CAAC,QAAQ,MAAA,EAAQ;AACf,IAAA,MAAM,eAAe,MAAM,CAAA;AAAA,EAC7B;AACF,CAAC;;;;"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { ExtensionBoundary } from '../components/ExtensionBoundary.esm.js';
|
|
3
3
|
import { coreExtensionData } from '../wiring/coreExtensionData.esm.js';
|
|
4
|
-
import 'zod/v3';
|
|
5
|
-
import 'zod-to-json-schema';
|
|
6
4
|
import { createExtensionBlueprint } from '../wiring/createExtensionBlueprint.esm.js';
|
|
7
5
|
|
|
8
6
|
const AppRootElementBlueprint = createExtensionBlueprint({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppRootElementBlueprint.esm.js","sources":["../../src/blueprints/AppRootElementBlueprint.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 { ExtensionBoundary } from '../components/ExtensionBoundary';\nimport { coreExtensionData, createExtensionBlueprint } from '../wiring';\n\n/**\n * Creates extensions that render a React element at the app root, outside of\n * the app layout. This is useful for example for shared popups and similar.\n *\n * @public\n */\nexport const AppRootElementBlueprint = createExtensionBlueprint({\n kind: 'app-root-element',\n attachTo: { id: 'app/root', input: 'elements' },\n output: [coreExtensionData.reactElement],\n *factory(params: { element: JSX.Element }, { node }) {\n yield coreExtensionData.reactElement(\n <ExtensionBoundary node={node} errorPresentation=\"error-api\">\n {params.element}\n </ExtensionBoundary>,\n );\n },\n});\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AppRootElementBlueprint.esm.js","sources":["../../src/blueprints/AppRootElementBlueprint.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 { ExtensionBoundary } from '../components/ExtensionBoundary';\nimport { coreExtensionData, createExtensionBlueprint } from '../wiring';\n\n/**\n * Creates extensions that render a React element at the app root, outside of\n * the app layout. This is useful for example for shared popups and similar.\n *\n * @public\n */\nexport const AppRootElementBlueprint = createExtensionBlueprint({\n kind: 'app-root-element',\n attachTo: { id: 'app/root', input: 'elements' },\n output: [coreExtensionData.reactElement],\n *factory(params: { element: JSX.Element }, { node }) {\n yield coreExtensionData.reactElement(\n <ExtensionBoundary node={node} errorPresentation=\"error-api\">\n {params.element}\n </ExtensionBoundary>,\n );\n },\n});\n"],"names":[],"mappings":";;;;;AAyBO,MAAM,0BAA0B,wBAAA,CAAyB;AAAA,EAC9D,IAAA,EAAM,kBAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,UAAA,EAAY,OAAO,UAAA,EAAW;AAAA,EAC9C,MAAA,EAAQ,CAAC,iBAAA,CAAkB,YAAY,CAAA;AAAA,EACvC,CAAC,OAAA,CAAQ,MAAA,EAAkC,EAAE,MAAK,EAAG;AACnD,IAAA,MAAM,iBAAA,CAAkB,YAAA;AAAA,0BACrB,iBAAA,EAAA,EAAkB,IAAA,EAAY,iBAAA,EAAkB,WAAA,EAC9C,iBAAO,OAAA,EACV;AAAA,KACF;AAAA,EACF;AACF,CAAC;;;;"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { z } from 'zod/v4';
|
|
3
2
|
import { Routes, Route, Navigate } from 'react-router-dom';
|
|
4
3
|
import { coreExtensionData } from '../wiring/coreExtensionData.esm.js';
|
|
5
|
-
import 'zod/v3';
|
|
6
|
-
import 'zod-to-json-schema';
|
|
7
4
|
import { createExtensionInput } from '../wiring/createExtensionInput.esm.js';
|
|
8
5
|
import { createExtensionBlueprint } from '../wiring/createExtensionBlueprint.esm.js';
|
|
9
6
|
import { ExtensionBoundary } from '../components/ExtensionBoundary.esm.js';
|
|
@@ -35,6 +32,7 @@ import '../components/AppNodeProvider.esm.js';
|
|
|
35
32
|
import '../components/DefaultSwappableComponents.esm.js';
|
|
36
33
|
import { PageLayout } from '../components/PageLayout.esm.js';
|
|
37
34
|
import { BreadcrumbEntry } from '../breadcrumbs/useBreadcrumbEntries.esm.js';
|
|
35
|
+
import { optionalStringSchema } from '../schema/optionalStringSchema.esm.js';
|
|
38
36
|
|
|
39
37
|
function resolveTitleLink(routeResolutionApi, routeRef) {
|
|
40
38
|
if (!routeRef) {
|
|
@@ -66,8 +64,8 @@ const PageBlueprint = createExtensionBlueprint({
|
|
|
66
64
|
coreExtensionData.icon.optional()
|
|
67
65
|
],
|
|
68
66
|
configSchema: {
|
|
69
|
-
path:
|
|
70
|
-
title:
|
|
67
|
+
path: optionalStringSchema,
|
|
68
|
+
title: optionalStringSchema
|
|
71
69
|
},
|
|
72
70
|
*factory(params, { config, node, inputs }) {
|
|
73
71
|
const title = config.title ?? params.title;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageBlueprint.esm.js","sources":["../../src/blueprints/PageBlueprint.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 { z } from 'zod/v4';\nimport { JSX } from 'react';\nimport { Routes, Route, Navigate } from 'react-router-dom';\nimport { IconElement } from '../icons/types';\nimport { RouteRef } from '../routing';\nimport {\n coreExtensionData,\n createExtensionBlueprint,\n createExtensionInput,\n} from '../wiring';\nimport { ExtensionBoundary, PageLayout, PageLayoutTab } from '../components';\nimport { useApi } from '../apis/system';\nimport { BreadcrumbEntry } from '../breadcrumbs';\nimport { routeResolutionApiRef } from '../apis/definitions/RouteResolutionApi';\nimport { pluginHeaderActionsApiRef } from '../apis/definitions/PluginHeaderActionsApi';\nimport { RouteResolutionApi } from '../apis/definitions/RouteResolutionApi';\n\nfunction resolveTitleLink(\n routeResolutionApi: RouteResolutionApi,\n routeRef: RouteRef | undefined,\n): string | undefined {\n if (!routeRef) {\n return undefined;\n }\n try {\n return routeResolutionApi.resolve(routeRef)?.();\n } catch {\n // Route ref may require params not available in the current context\n return undefined;\n }\n}\n\n/**\n * Creates extensions that are routable React page components.\n *\n * @public\n */\nexport const PageBlueprint = createExtensionBlueprint({\n kind: 'page',\n attachTo: { id: 'app/routes', input: 'routes' },\n inputs: {\n pages: createExtensionInput([\n coreExtensionData.routePath,\n coreExtensionData.routeRef.optional(),\n coreExtensionData.reactElement,\n coreExtensionData.title.optional(),\n coreExtensionData.icon.optional(),\n ]),\n },\n output: [\n coreExtensionData.routePath,\n coreExtensionData.reactElement,\n coreExtensionData.routeRef.optional(),\n coreExtensionData.title.optional(),\n coreExtensionData.icon.optional(),\n ],\n configSchema: {\n path: z.string().optional(),\n title: z.string().optional(),\n },\n *factory(\n params: {\n path: string;\n title?: string;\n icon?: IconElement;\n loader?: () => Promise<JSX.Element>;\n routeRef?: RouteRef;\n /**\n * Hide the default plugin page header, making the page fill up all available space.\n */\n noHeader?: boolean;\n },\n { config, node, inputs },\n ) {\n const title = config.title ?? params.title;\n const icon = params.icon;\n const pluginId = node.spec.plugin.pluginId;\n const noHeader = params.noHeader ?? false;\n const resolvedTitle =\n title ?? node.spec.plugin.title ?? node.spec.plugin.pluginId;\n const resolvedIcon = icon ?? node.spec.plugin.icon;\n const titleRouteRef =\n (node.spec.plugin.routes as { root?: RouteRef }).root ?? params.routeRef;\n\n yield coreExtensionData.routePath(config.path ?? params.path);\n if (params.loader) {\n const loader = params.loader;\n const PageContent = () => {\n const routeResolutionApi = useApi(routeResolutionApiRef);\n const titleLink = resolveTitleLink(routeResolutionApi, titleRouteRef);\n const headerActionsApi = useApi(pluginHeaderActionsApiRef);\n const headerActions = headerActionsApi.getPluginHeaderActions(pluginId);\n\n return (\n <PageLayout\n title={resolvedTitle}\n icon={resolvedIcon}\n noHeader={noHeader}\n titleLink={titleLink}\n headerActions={headerActions}\n >\n {ExtensionBoundary.lazy(node, loader)}\n </PageLayout>\n );\n };\n yield coreExtensionData.reactElement(<PageContent />);\n } else if (inputs.pages.length > 0) {\n // Parent page with sub-pages - render header with tabs\n const tabs: PageLayoutTab[] = inputs.pages.map(page => {\n const path = page.get(coreExtensionData.routePath);\n const tabTitle = page.get(coreExtensionData.title);\n const tabIcon = page.get(coreExtensionData.icon);\n return {\n id: path,\n label: tabTitle || path,\n icon: tabIcon,\n href: path,\n };\n });\n\n const PageContent = () => {\n const firstPagePath = inputs.pages[0]?.get(coreExtensionData.routePath);\n const routeResolutionApi = useApi(routeResolutionApiRef);\n const titleLink = resolveTitleLink(routeResolutionApi, titleRouteRef);\n\n const headerActionsApi = useApi(pluginHeaderActionsApiRef);\n const headerActions = headerActionsApi.getPluginHeaderActions(pluginId);\n return (\n <PageLayout\n title={resolvedTitle}\n icon={resolvedIcon}\n tabs={tabs}\n titleLink={titleLink}\n headerActions={headerActions}\n >\n <Routes>\n {firstPagePath && (\n <Route\n index\n element={<Navigate to={firstPagePath} replace />}\n />\n )}\n {inputs.pages.map((page, index) => {\n const path = page.get(coreExtensionData.routePath);\n const tabTitle = page.get(coreExtensionData.title);\n const element = page.get(coreExtensionData.reactElement);\n return (\n <Route\n key={index}\n path={`${path}/*`}\n element={\n <BreadcrumbEntry\n entry={{ label: tabTitle || path, href: path }}\n >\n {element}\n </BreadcrumbEntry>\n }\n />\n );\n })}\n </Routes>\n </PageLayout>\n );\n };\n\n yield coreExtensionData.reactElement(<PageContent />);\n } else {\n const PageContent = () => {\n const routeResolutionApi = useApi(routeResolutionApiRef);\n const titleLink = resolveTitleLink(routeResolutionApi, titleRouteRef);\n const headerActionsApi = useApi(pluginHeaderActionsApiRef);\n const headerActions = headerActionsApi.getPluginHeaderActions(pluginId);\n return (\n <PageLayout\n title={resolvedTitle}\n icon={resolvedIcon}\n titleLink={titleLink}\n headerActions={headerActions}\n />\n );\n };\n yield coreExtensionData.reactElement(<PageContent />);\n }\n if (params.routeRef) {\n yield coreExtensionData.routeRef(params.routeRef);\n }\n if (title) {\n yield coreExtensionData.title(title);\n }\n if (icon) {\n yield coreExtensionData.icon(icon);\n }\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,SAAS,gBAAA,CACP,oBACA,QAAA,EACoB;AACpB,EAAA,IAAI,CAAC,QAAA,EAAU;AACb,IAAA,OAAO,MAAA;AAAA,EACT;AACA,EAAA,IAAI;AACF,IAAA,OAAO,kBAAA,CAAmB,OAAA,CAAQ,QAAQ,CAAA,IAAI;AAAA,EAChD,CAAA,CAAA,MAAQ;AAEN,IAAA,OAAO,MAAA;AAAA,EACT;AACF;AAOO,MAAM,gBAAgB,wBAAA,CAAyB;AAAA,EACpD,IAAA,EAAM,MAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,YAAA,EAAc,OAAO,QAAA,EAAS;AAAA,EAC9C,MAAA,EAAQ;AAAA,IACN,OAAO,oBAAA,CAAqB;AAAA,MAC1B,iBAAA,CAAkB,SAAA;AAAA,MAClB,iBAAA,CAAkB,SAAS,QAAA,EAAS;AAAA,MACpC,iBAAA,CAAkB,YAAA;AAAA,MAClB,iBAAA,CAAkB,MAAM,QAAA,EAAS;AAAA,MACjC,iBAAA,CAAkB,KAAK,QAAA;AAAS,KACjC;AAAA,GACH;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,iBAAA,CAAkB,SAAA;AAAA,I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yright 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 } from 'react';\nimport { Routes, Route, Navigate } from 'react-router-dom';\nimport { IconElement } from '../icons/types';\nimport { RouteRef } from '../routing';\nimport {\n coreExtensionData,\n createExtensionBlueprint,\n createExtensionInput,\n} from '../wiring';\nimport { ExtensionBoundary, PageLayout, PageLayoutTab } from '../components';\nimport { useApi } from '../apis/system';\nimport { BreadcrumbEntry } from '../breadcrumbs';\nimport { routeResolutionApiRef } from '../apis/definitions/RouteResolutionApi';\nimport { pluginHeaderActionsApiRef } from '../apis/definitions/PluginHeaderActionsApi';\nimport { RouteResolutionApi } from '../apis/definitions/RouteResolutionApi';\nimport { optionalStringSchema } from '../schema/optionalStringSchema';\n\nfunction resolveTitleLink(\n routeResolutionApi: RouteResolutionApi,\n routeRef: RouteRef | undefined,\n): string | undefined {\n if (!routeRef) {\n return undefined;\n }\n try {\n return routeResolutionApi.resolve(routeRef)?.();\n } catch {\n // Route ref may require params not available in the current context\n return undefined;\n }\n}\n\n/**\n * Creates extensions that are routable React page components.\n *\n * @public\n */\nexport const PageBlueprint = createExtensionBlueprint({\n kind: 'page',\n attachTo: { id: 'app/routes', input: 'routes' },\n inputs: {\n pages: createExtensionInput([\n coreExtensionData.routePath,\n coreExtensionData.routeRef.optional(),\n coreExtensionData.reactElement,\n coreExtensionData.title.optional(),\n coreExtensionData.icon.optional(),\n ]),\n },\n output: [\n coreExtensionData.routePath,\n coreExtensionData.reactElement,\n coreExtensionData.routeRef.optional(),\n coreExtensionData.title.optional(),\n coreExtensionData.icon.optional(),\n ],\n configSchema: {\n path: optionalStringSchema,\n title: optionalStringSchema,\n },\n *factory(\n params: {\n path: string;\n title?: string;\n icon?: IconElement;\n loader?: () => Promise<JSX.Element>;\n routeRef?: RouteRef;\n /**\n * Hide the default plugin page header, making the page fill up all available space.\n */\n noHeader?: boolean;\n },\n { config, node, inputs },\n ) {\n const title = config.title ?? params.title;\n const icon = params.icon;\n const pluginId = node.spec.plugin.pluginId;\n const noHeader = params.noHeader ?? false;\n const resolvedTitle =\n title ?? node.spec.plugin.title ?? node.spec.plugin.pluginId;\n const resolvedIcon = icon ?? node.spec.plugin.icon;\n const titleRouteRef =\n (node.spec.plugin.routes as { root?: RouteRef }).root ?? params.routeRef;\n\n yield coreExtensionData.routePath(config.path ?? params.path);\n if (params.loader) {\n const loader = params.loader;\n const PageContent = () => {\n const routeResolutionApi = useApi(routeResolutionApiRef);\n const titleLink = resolveTitleLink(routeResolutionApi, titleRouteRef);\n const headerActionsApi = useApi(pluginHeaderActionsApiRef);\n const headerActions = headerActionsApi.getPluginHeaderActions(pluginId);\n\n return (\n <PageLayout\n title={resolvedTitle}\n icon={resolvedIcon}\n noHeader={noHeader}\n titleLink={titleLink}\n headerActions={headerActions}\n >\n {ExtensionBoundary.lazy(node, loader)}\n </PageLayout>\n );\n };\n yield coreExtensionData.reactElement(<PageContent />);\n } else if (inputs.pages.length > 0) {\n // Parent page with sub-pages - render header with tabs\n const tabs: PageLayoutTab[] = inputs.pages.map(page => {\n const path = page.get(coreExtensionData.routePath);\n const tabTitle = page.get(coreExtensionData.title);\n const tabIcon = page.get(coreExtensionData.icon);\n return {\n id: path,\n label: tabTitle || path,\n icon: tabIcon,\n href: path,\n };\n });\n\n const PageContent = () => {\n const firstPagePath = inputs.pages[0]?.get(coreExtensionData.routePath);\n const routeResolutionApi = useApi(routeResolutionApiRef);\n const titleLink = resolveTitleLink(routeResolutionApi, titleRouteRef);\n\n const headerActionsApi = useApi(pluginHeaderActionsApiRef);\n const headerActions = headerActionsApi.getPluginHeaderActions(pluginId);\n return (\n <PageLayout\n title={resolvedTitle}\n icon={resolvedIcon}\n tabs={tabs}\n titleLink={titleLink}\n headerActions={headerActions}\n >\n <Routes>\n {firstPagePath && (\n <Route\n index\n element={<Navigate to={firstPagePath} replace />}\n />\n )}\n {inputs.pages.map((page, index) => {\n const path = page.get(coreExtensionData.routePath);\n const tabTitle = page.get(coreExtensionData.title);\n const element = page.get(coreExtensionData.reactElement);\n return (\n <Route\n key={index}\n path={`${path}/*`}\n element={\n <BreadcrumbEntry\n entry={{ label: tabTitle || path, href: path }}\n >\n {element}\n </BreadcrumbEntry>\n }\n />\n );\n })}\n </Routes>\n </PageLayout>\n );\n };\n\n yield coreExtensionData.reactElement(<PageContent />);\n } else {\n const PageContent = () => {\n const routeResolutionApi = useApi(routeResolutionApiRef);\n const titleLink = resolveTitleLink(routeResolutionApi, titleRouteRef);\n const headerActionsApi = useApi(pluginHeaderActionsApiRef);\n const headerActions = headerActionsApi.getPluginHeaderActions(pluginId);\n return (\n <PageLayout\n title={resolvedTitle}\n icon={resolvedIcon}\n titleLink={titleLink}\n headerActions={headerActions}\n />\n );\n };\n yield coreExtensionData.reactElement(<PageContent />);\n }\n if (params.routeRef) {\n yield coreExtensionData.routeRef(params.routeRef);\n }\n if (title) {\n yield coreExtensionData.title(title);\n }\n if (icon) {\n yield coreExtensionData.icon(icon);\n }\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,SAAS,gBAAA,CACP,oBACA,QAAA,EACoB;AACpB,EAAA,IAAI,CAAC,QAAA,EAAU;AACb,IAAA,OAAO,MAAA;AAAA,EACT;AACA,EAAA,IAAI;AACF,IAAA,OAAO,kBAAA,CAAmB,OAAA,CAAQ,QAAQ,CAAA,IAAI;AAAA,EAChD,CAAA,CAAA,MAAQ;AAEN,IAAA,OAAO,MAAA;AAAA,EACT;AACF;AAOO,MAAM,gBAAgB,wBAAA,CAAyB;AAAA,EACpD,IAAA,EAAM,MAAA;AA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AAO,QAAQ,CAAA;AAAA,IAClD;AACA,IAAA,IAAI,KAAA,EAAO;AACT,MAAA,MAAM,iBAAA,CAAkB,MAAM,KAAK,CAAA;AAAA,IACrC;AACA,IAAA,IAAI,IAAA,EAAM;AACR,MAAA,MAAM,iBAAA,CAAkB,KAAK,IAAI,CAAA;AAAA,IACnC;AAAA,EACF;AACF,CAAC;;;;"}
|
|
@@ -29,8 +29,6 @@ import '../components/AppNodeProvider.esm.js';
|
|
|
29
29
|
import '../components/DefaultSwappableComponents.esm.js';
|
|
30
30
|
import '../components/PageLayout.esm.js';
|
|
31
31
|
import { coreExtensionData } from '../wiring/coreExtensionData.esm.js';
|
|
32
|
-
import 'zod/v3';
|
|
33
|
-
import 'zod-to-json-schema';
|
|
34
32
|
import { createExtensionBlueprint } from '../wiring/createExtensionBlueprint.esm.js';
|
|
35
33
|
|
|
36
34
|
const PluginHeaderActionBlueprint = createExtensionBlueprint({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginHeaderActionBlueprint.esm.js","sources":["../../src/blueprints/PluginHeaderActionBlueprint.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 { lazy as reactLazy } from 'react';\nimport { ExtensionBoundary } from '../components';\nimport { coreExtensionData, createExtensionBlueprint } from '../wiring';\n\n/**\n * Creates extensions that provide plugin-scoped header actions.\n *\n * @remarks\n *\n * These actions are automatically scoped to the plugin that provides them\n * and will appear in the header of all pages belonging to that plugin.\n *\n * @public\n */\nexport const PluginHeaderActionBlueprint = createExtensionBlueprint({\n kind: 'plugin-header-action',\n attachTo: { id: 'api:app/plugin-header-actions', input: 'actions' },\n output: [coreExtensionData.reactElement],\n *factory(params: { loader: () => Promise<JSX.Element> }, { node }) {\n const LazyAction = reactLazy(() =>\n params.loader().then(element => ({ default: () => element })),\n );\n yield coreExtensionData.reactElement(\n <ExtensionBoundary node={node} errorPresentation=\"error-api\">\n <LazyAction />\n </ExtensionBoundary>,\n );\n },\n});\n"],"names":["reactLazy"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PluginHeaderActionBlueprint.esm.js","sources":["../../src/blueprints/PluginHeaderActionBlueprint.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 { lazy as reactLazy } from 'react';\nimport { ExtensionBoundary } from '../components';\nimport { coreExtensionData, createExtensionBlueprint } from '../wiring';\n\n/**\n * Creates extensions that provide plugin-scoped header actions.\n *\n * @remarks\n *\n * These actions are automatically scoped to the plugin that provides them\n * and will appear in the header of all pages belonging to that plugin.\n *\n * @public\n */\nexport const PluginHeaderActionBlueprint = createExtensionBlueprint({\n kind: 'plugin-header-action',\n attachTo: { id: 'api:app/plugin-header-actions', input: 'actions' },\n output: [coreExtensionData.reactElement],\n *factory(params: { loader: () => Promise<JSX.Element> }, { node }) {\n const LazyAction = reactLazy(() =>\n params.loader().then(element => ({ default: () => element })),\n );\n yield coreExtensionData.reactElement(\n <ExtensionBoundary node={node} errorPresentation=\"error-api\">\n <LazyAction />\n </ExtensionBoundary>,\n );\n },\n});\n"],"names":["reactLazy"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BO,MAAM,8BAA8B,wBAAA,CAAyB;AAAA,EAClE,IAAA,EAAM,sBAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,+BAAA,EAAiC,OAAO,SAAA,EAAU;AAAA,EAClE,MAAA,EAAQ,CAAC,iBAAA,CAAkB,YAAY,CAAA;AAAA,EACvC,CAAC,OAAA,CAAQ,MAAA,EAAgD,EAAE,MAAK,EAAG;AACjE,IAAA,MAAM,UAAA,GAAaA,IAAA;AAAA,MAAU,MAC3B,MAAA,CAAO,MAAA,EAAO,CAAE,IAAA,CAAK,cAAY,EAAE,OAAA,EAAS,MAAM,OAAA,EAAQ,CAAE;AAAA,KAC9D;AACA,IAAA,MAAM,iBAAA,CAAkB,YAAA;AAAA,0BACrB,iBAAA,EAAA,EAAkB,IAAA,EAAY,mBAAkB,WAAA,EAC/C,QAAA,kBAAA,GAAA,CAAC,cAAW,CAAA,EACd;AAAA,KACF;AAAA,EACF;AACF,CAAC;;;;"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import '../wiring/coreExtensionData.esm.js';
|
|
2
|
-
import 'zod/v3';
|
|
3
|
-
import 'zod-to-json-schema';
|
|
4
2
|
import { createExtensionDataRef } from '../wiring/createExtensionDataRef.esm.js';
|
|
5
3
|
import { createExtensionBlueprint, createExtensionBlueprintParams } from '../wiring/createExtensionBlueprint.esm.js';
|
|
6
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginWrapperBlueprint.esm.js","sources":["../../src/blueprints/PluginWrapperBlueprint.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 { ComponentType, ReactNode } from 'react';\nimport {\n createExtensionBlueprint,\n createExtensionBlueprintParams,\n createExtensionDataRef,\n} from '../wiring';\n\n/**\n * Defines the structure of a plugin wrapper, optionally including a shared\n * hook value.\n *\n * @remarks\n *\n * When `useWrapperValue` is provided, the hook is called in a single location\n * in the app and the resulting value is forwarded as the `value` prop to the\n * component. The hook obeys the rules of React hooks and is not called until a\n * component from the plugin is rendered.\n *\n * @public\n */\nexport type PluginWrapperDefinition<TValue = unknown | never> = {\n /**\n * Creates a shared value that is forwarded as the `value` prop to the\n * component.\n *\n * @remarks\n *\n * This function obeys the rules of React hooks and is only invoked in a\n * single location in the app. Note that the hook will not be called until a\n * component from the plugin is rendered.\n */\n useWrapperValue?: () => TValue;\n component: ComponentType<{ children: ReactNode; value: TValue }>;\n};\n\nconst wrapperDataRef = createExtensionDataRef<\n () => Promise<PluginWrapperDefinition>\n>().with({ id: 'core.plugin-wrapper.loader' });\n\n/**\n * Creates extensions that wrap plugin extensions with providers.\n *\n * @public\n */\nexport const PluginWrapperBlueprint = createExtensionBlueprint({\n kind: 'plugin-wrapper',\n attachTo: { id: 'api:app/plugin-wrapper', input: 'wrappers' },\n output: [wrapperDataRef],\n dataRefs: {\n wrapper: wrapperDataRef,\n },\n defineParams<TValue = never>(params: {\n loader: () => Promise<PluginWrapperDefinition<TValue>>;\n }) {\n return createExtensionBlueprintParams(\n params as { loader: () => Promise<PluginWrapperDefinition> },\n );\n },\n *factory(params) {\n yield wrapperDataRef(params.loader);\n },\n});\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PluginWrapperBlueprint.esm.js","sources":["../../src/blueprints/PluginWrapperBlueprint.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 { ComponentType, ReactNode } from 'react';\nimport {\n createExtensionBlueprint,\n createExtensionBlueprintParams,\n createExtensionDataRef,\n} from '../wiring';\n\n/**\n * Defines the structure of a plugin wrapper, optionally including a shared\n * hook value.\n *\n * @remarks\n *\n * When `useWrapperValue` is provided, the hook is called in a single location\n * in the app and the resulting value is forwarded as the `value` prop to the\n * component. The hook obeys the rules of React hooks and is not called until a\n * component from the plugin is rendered.\n *\n * @public\n */\nexport type PluginWrapperDefinition<TValue = unknown | never> = {\n /**\n * Creates a shared value that is forwarded as the `value` prop to the\n * component.\n *\n * @remarks\n *\n * This function obeys the rules of React hooks and is only invoked in a\n * single location in the app. Note that the hook will not be called until a\n * component from the plugin is rendered.\n */\n useWrapperValue?: () => TValue;\n component: ComponentType<{ children: ReactNode; value: TValue }>;\n};\n\nconst wrapperDataRef = createExtensionDataRef<\n () => Promise<PluginWrapperDefinition>\n>().with({ id: 'core.plugin-wrapper.loader' });\n\n/**\n * Creates extensions that wrap plugin extensions with providers.\n *\n * @public\n */\nexport const PluginWrapperBlueprint = createExtensionBlueprint({\n kind: 'plugin-wrapper',\n attachTo: { id: 'api:app/plugin-wrapper', input: 'wrappers' },\n output: [wrapperDataRef],\n dataRefs: {\n wrapper: wrapperDataRef,\n },\n defineParams<TValue = never>(params: {\n loader: () => Promise<PluginWrapperDefinition<TValue>>;\n }) {\n return createExtensionBlueprintParams(\n params as { loader: () => Promise<PluginWrapperDefinition> },\n );\n },\n *factory(params) {\n yield wrapperDataRef(params.loader);\n },\n});\n"],"names":[],"mappings":";;;;AAmDA,MAAM,iBAAiB,sBAAA,EAErB,CAAE,KAAK,EAAE,EAAA,EAAI,8BAA8B,CAAA;AAOtC,MAAM,yBAAyB,wBAAA,CAAyB;AAAA,EAC7D,IAAA,EAAM,gBAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,wBAAA,EAA0B,OAAO,UAAA,EAAW;AAAA,EAC5D,MAAA,EAAQ,CAAC,cAAc,CAAA;AAAA,EACvB,QAAA,EAAU;AAAA,IACR,OAAA,EAAS;AAAA,GACX;AAAA,EACA,aAA6B,MAAA,EAE1B;AACD,IAAA,OAAO,8BAAA;AAAA,MACL;AAAA,KACF;AAAA,EACF,CAAA;AAAA,EACA,CAAC,QAAQ,MAAA,EAAQ;AACf,IAAA,MAAM,cAAA,CAAe,OAAO,MAAM,CAAA;AAAA,EACpC;AACF,CAAC;;;;"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { z } from 'zod/v4';
|
|
2
1
|
import { coreExtensionData } from '../wiring/coreExtensionData.esm.js';
|
|
3
|
-
import 'zod/v3';
|
|
4
|
-
import 'zod-to-json-schema';
|
|
5
2
|
import { createExtensionBlueprint } from '../wiring/createExtensionBlueprint.esm.js';
|
|
6
3
|
import { ExtensionBoundary } from '../components/ExtensionBoundary.esm.js';
|
|
7
4
|
import 'react/jsx-runtime';
|
|
@@ -33,6 +30,7 @@ import 'react';
|
|
|
33
30
|
import '../components/AppNodeProvider.esm.js';
|
|
34
31
|
import '../components/DefaultSwappableComponents.esm.js';
|
|
35
32
|
import '../components/PageLayout.esm.js';
|
|
33
|
+
import { optionalStringSchema } from '../schema/optionalStringSchema.esm.js';
|
|
36
34
|
|
|
37
35
|
const SubPageBlueprint = createExtensionBlueprint({
|
|
38
36
|
kind: "sub-page",
|
|
@@ -45,8 +43,8 @@ const SubPageBlueprint = createExtensionBlueprint({
|
|
|
45
43
|
coreExtensionData.icon.optional()
|
|
46
44
|
],
|
|
47
45
|
configSchema: {
|
|
48
|
-
path:
|
|
49
|
-
title:
|
|
46
|
+
path: optionalStringSchema,
|
|
47
|
+
title: optionalStringSchema
|
|
50
48
|
},
|
|
51
49
|
*factory(params, { config, node }) {
|
|
52
50
|
yield coreExtensionData.routePath(config.path ?? params.path);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubPageBlueprint.esm.js","sources":["../../src/blueprints/SubPageBlueprint.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 {
|
|
1
|
+
{"version":3,"file":"SubPageBlueprint.esm.js","sources":["../../src/blueprints/SubPageBlueprint.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 { IconElement } from '../icons/types';\nimport { RouteRef } from '../routing';\nimport { coreExtensionData, createExtensionBlueprint } from '../wiring';\nimport { ExtensionBoundary } from '../components';\nimport { optionalStringSchema } from '../schema/optionalStringSchema';\n\n/**\n * Creates extensions that are sub-page React components attached to a parent page.\n * Sub-pages are rendered as tabs within the parent page's header.\n *\n * @public\n * @example\n * ```tsx\n * const overviewRouteRef = createRouteRef();\n *\n * const mySubPage = SubPageBlueprint.make({\n * attachTo: { id: 'page:my-plugin', input: 'pages' },\n * name: 'overview',\n * params: {\n * path: 'overview',\n * title: 'Overview',\n * routeRef: overviewRouteRef,\n * loader: () => import('./components/Overview').then(m => <m.Overview />),\n * },\n * });\n * ```\n */\nexport const SubPageBlueprint = createExtensionBlueprint({\n kind: 'sub-page',\n attachTo: { relative: { kind: 'page' }, input: 'pages' },\n output: [\n coreExtensionData.routePath,\n coreExtensionData.reactElement,\n coreExtensionData.title,\n coreExtensionData.routeRef.optional(),\n coreExtensionData.icon.optional(),\n ],\n configSchema: {\n path: optionalStringSchema,\n title: optionalStringSchema,\n },\n *factory(\n params: {\n /**\n * The path for this sub-page, relative to the parent page. Must **not** start with '/'.\n *\n * @example 'overview', 'settings', 'details'\n */\n path: string;\n /**\n * The title displayed in the tab for this sub-page.\n */\n title: string;\n /**\n * Optional icon for this sub-page, displayed in the tab.\n */\n icon?: IconElement;\n /**\n * A function that returns a promise resolving to the React element to render.\n * This enables lazy loading of the sub-page content.\n */\n loader: () => Promise<JSX.Element>;\n /**\n * Optional route reference for this sub-page.\n */\n routeRef?: RouteRef;\n },\n { config, node },\n ) {\n yield coreExtensionData.routePath(config.path ?? params.path);\n yield coreExtensionData.title(config.title ?? params.title);\n yield coreExtensionData.reactElement(\n ExtensionBoundary.lazy(node, params.loader),\n );\n if (params.routeRef) {\n yield coreExtensionData.routeRef(params.routeRef);\n }\n if (params.icon) {\n yield coreExtensionData.icon(params.icon);\n }\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CO,MAAM,mBAAmB,wBAAA,CAAyB;AAAA,EACvD,IAAA,EAAM,UAAA;AAAA,EACN,QAAA,EAAU,EAAE,QAAA,EAAU,EAAE,MAAM,MAAA,EAAO,EAAG,OAAO,OAAA,EAAQ;AAAA,EACvD,MAAA,EAAQ;AAAA,IACN,iBAAA,CAAkB,SAAA;AAAA,IAClB,iBAAA,CAAkB,YAAA;AAAA,IAClB,iBAAA,CAAkB,KAAA;AAAA,IAClB,iBAAA,CAAkB,SAAS,QAAA,EAAS;AAAA,IACpC,iBAAA,CAAkB,KAAK,QAAA;AAAS,GAClC;AAAA,EACA,YAAA,EAAc;AAAA,IACZ,IAAA,EAAM,oBAAA;AAAA,IACN,KAAA,EAAO;AAAA,GACT;AAAA,EACA,CAAC,OAAA,CACC,MAAA,EAyBA,EAAE,MAAA,EAAQ,MAAK,EACf;AACA,IAAA,MAAM,iBAAA,CAAkB,SAAA,CAAU,MAAA,CAAO,IAAA,IAAQ,OAAO,IAAI,CAAA;AAC5D,IAAA,MAAM,iBAAA,CAAkB,KAAA,CAAM,MAAA,CAAO,KAAA,IAAS,OAAO,KAAK,CAAA;AAC1D,IAAA,MAAM,iBAAA,CAAkB,YAAA;AAAA,MACtB,iBAAA,CAAkB,IAAA,CAAK,IAAA,EAAM,MAAA,CAAO,MAAM;AAAA,KAC5C;AACA,IAAA,IAAI,OAAO,QAAA,EAAU;AACnB,MAAA,MAAM,iBAAA,CAAkB,QAAA,CAAS,MAAA,CAAO,QAAQ,CAAA;AAAA,IAClD;AACA,IAAA,IAAI,OAAO,IAAA,EAAM;AACf,MAAA,MAAM,iBAAA,CAAkB,IAAA,CAAK,MAAA,CAAO,IAAI,CAAA;AAAA,IAC1C;AAAA,EACF;AACF,CAAC;;;;"}
|
|
@@ -29,8 +29,6 @@ import '../apis/definitions/PluginHeaderActionsApi.esm.js';
|
|
|
29
29
|
import { pluginWrapperApiRef } from '../apis/definitions/PluginWrapperApi.esm.js';
|
|
30
30
|
import { useApi } from '../apis/system/useApi.esm.js';
|
|
31
31
|
import { coreExtensionData } from '../wiring/coreExtensionData.esm.js';
|
|
32
|
-
import 'zod/v3';
|
|
33
|
-
import 'zod-to-json-schema';
|
|
34
32
|
import '../wiring/createExtensionBlueprint.esm.js';
|
|
35
33
|
import { AppNodeProvider } from './AppNodeProvider.esm.js';
|
|
36
34
|
import { Progress } from './DefaultSwappableComponents.esm.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExtensionBoundary.esm.js","sources":["../../src/components/ExtensionBoundary.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 {\n PropsWithChildren,\n ReactNode,\n Suspense,\n useEffect,\n useMemo,\n lazy as reactLazy,\n} from 'react';\nimport { AnalyticsContext, useAnalytics } from '../analytics';\nimport { ErrorDisplayBoundary } from './ErrorDisplayBoundary';\nimport { ErrorApiBoundary } from './ErrorApiBoundary';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { routableExtensionRenderedEvent } from '../../../core-plugin-api/src/analytics/Tracker';\nimport { AppNode, ErrorApi, errorApiRef, useApi } from '../apis';\nimport {\n PluginWrapperApi,\n pluginWrapperApiRef,\n} from '../apis/definitions/PluginWrapperApi';\nimport { coreExtensionData } from '../wiring';\nimport { AppNodeProvider } from './AppNodeProvider';\nimport { Progress } from './DefaultSwappableComponents';\n\nfunction useOptionalErrorApi(): ErrorApi | undefined {\n try {\n return useApi(errorApiRef);\n } catch {\n return undefined;\n }\n}\n\nfunction useOptionalPluginWrapperApi(): PluginWrapperApi | undefined {\n try {\n return useApi(pluginWrapperApiRef);\n } catch {\n return undefined;\n }\n}\ntype RouteTrackerProps = PropsWithChildren<{\n enabled?: boolean;\n}>;\n\nconst RouteTracker = (props: RouteTrackerProps) => {\n const { enabled, children } = props;\n const analytics = useAnalytics();\n\n // This event, never exposed to end-users of the analytics API,\n // helps inform which extension metadata gets associated with a\n // navigation event when the route navigated to is a gathered\n // mountpoint.\n useEffect(() => {\n if (enabled) {\n analytics.captureEvent(routableExtensionRenderedEvent, '');\n }\n }, [analytics, enabled]);\n\n return <>{children}</>;\n};\n\n/** @public */\nexport interface ExtensionBoundaryProps {\n errorPresentation?: 'error-api' | 'error-display';\n node: AppNode;\n children: ReactNode;\n}\n\n/** @public */\nexport function ExtensionBoundary(props: ExtensionBoundaryProps) {\n const { node, children } = props;\n\n const errorApi = useOptionalErrorApi();\n\n const hasRoutePathOutput = Boolean(\n node.instance?.getData(coreExtensionData.routePath),\n );\n\n const plugin = node.spec.plugin;\n const pluginId = plugin.pluginId ?? 'app';\n\n const pluginWrapperApi = useOptionalPluginWrapperApi();\n\n const PluginWrapper = useMemo(() => {\n return pluginWrapperApi?.getPluginWrapper(pluginId);\n }, [pluginWrapperApi, pluginId]);\n\n // Skipping \"routeRef\" attribute in the new system, the extension \"id\" should provide more insight\n const attributes = {\n extensionId: node.spec.id,\n pluginId,\n };\n\n let content = (\n <AnalyticsContext attributes={attributes}>\n <RouteTracker enabled={hasRoutePathOutput}>{children}</RouteTracker>\n </AnalyticsContext>\n );\n\n if (PluginWrapper) {\n content = <PluginWrapper>{content}</PluginWrapper>;\n }\n\n if (props.errorPresentation === 'error-api') {\n content = (\n <ErrorApiBoundary node={node} errorApi={errorApi}>\n {content}\n </ErrorApiBoundary>\n );\n } else {\n content = (\n <ErrorDisplayBoundary plugin={plugin}>{content}</ErrorDisplayBoundary>\n );\n }\n\n return (\n <AppNodeProvider node={node}>\n <Suspense fallback={<Progress />}>{content}</Suspense>\n </AppNodeProvider>\n );\n}\n\n/** @public */\nexport namespace ExtensionBoundary {\n export function lazy(\n appNode: AppNode,\n loader: () => Promise<JSX.Element>,\n ): JSX.Element {\n const ExtensionComponent = reactLazy(() =>\n loader().then(element => ({ default: () => element })),\n );\n return (\n <ExtensionBoundary node={appNode}>\n <ExtensionComponent />\n </ExtensionBoundary>\n );\n }\n\n export function lazyComponent<TProps extends {}>(\n appNode: AppNode,\n loader: () => Promise<(props: TProps) => JSX.Element>,\n ): (props: TProps) => JSX.Element {\n const ExtensionComponent = reactLazy(() =>\n loader().then(Component => ({ default: Component })),\n ) as unknown as React.ComponentType<TProps>;\n\n return (props: TProps) => (\n <ExtensionBoundary node={appNode}>\n <ExtensionComponent {...props} />\n </ExtensionBoundary>\n );\n }\n}\n"],"names":["ExtensionBoundary","lazy","reactLazy"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExtensionBoundary.esm.js","sources":["../../src/components/ExtensionBoundary.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 {\n PropsWithChildren,\n ReactNode,\n Suspense,\n useEffect,\n useMemo,\n lazy as reactLazy,\n} from 'react';\nimport { AnalyticsContext, useAnalytics } from '../analytics';\nimport { ErrorDisplayBoundary } from './ErrorDisplayBoundary';\nimport { ErrorApiBoundary } from './ErrorApiBoundary';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { routableExtensionRenderedEvent } from '../../../core-plugin-api/src/analytics/Tracker';\nimport { AppNode, ErrorApi, errorApiRef, useApi } from '../apis';\nimport {\n PluginWrapperApi,\n pluginWrapperApiRef,\n} from '../apis/definitions/PluginWrapperApi';\nimport { coreExtensionData } from '../wiring';\nimport { AppNodeProvider } from './AppNodeProvider';\nimport { Progress } from './DefaultSwappableComponents';\n\nfunction useOptionalErrorApi(): ErrorApi | undefined {\n try {\n return useApi(errorApiRef);\n } catch {\n return undefined;\n }\n}\n\nfunction useOptionalPluginWrapperApi(): PluginWrapperApi | undefined {\n try {\n return useApi(pluginWrapperApiRef);\n } catch {\n return undefined;\n }\n}\ntype RouteTrackerProps = PropsWithChildren<{\n enabled?: boolean;\n}>;\n\nconst RouteTracker = (props: RouteTrackerProps) => {\n const { enabled, children } = props;\n const analytics = useAnalytics();\n\n // This event, never exposed to end-users of the analytics API,\n // helps inform which extension metadata gets associated with a\n // navigation event when the route navigated to is a gathered\n // mountpoint.\n useEffect(() => {\n if (enabled) {\n analytics.captureEvent(routableExtensionRenderedEvent, '');\n }\n }, [analytics, enabled]);\n\n return <>{children}</>;\n};\n\n/** @public */\nexport interface ExtensionBoundaryProps {\n errorPresentation?: 'error-api' | 'error-display';\n node: AppNode;\n children: ReactNode;\n}\n\n/** @public */\nexport function ExtensionBoundary(props: ExtensionBoundaryProps) {\n const { node, children } = props;\n\n const errorApi = useOptionalErrorApi();\n\n const hasRoutePathOutput = Boolean(\n node.instance?.getData(coreExtensionData.routePath),\n );\n\n const plugin = node.spec.plugin;\n const pluginId = plugin.pluginId ?? 'app';\n\n const pluginWrapperApi = useOptionalPluginWrapperApi();\n\n const PluginWrapper = useMemo(() => {\n return pluginWrapperApi?.getPluginWrapper(pluginId);\n }, [pluginWrapperApi, pluginId]);\n\n // Skipping \"routeRef\" attribute in the new system, the extension \"id\" should provide more insight\n const attributes = {\n extensionId: node.spec.id,\n pluginId,\n };\n\n let content = (\n <AnalyticsContext attributes={attributes}>\n <RouteTracker enabled={hasRoutePathOutput}>{children}</RouteTracker>\n </AnalyticsContext>\n );\n\n if (PluginWrapper) {\n content = <PluginWrapper>{content}</PluginWrapper>;\n }\n\n if (props.errorPresentation === 'error-api') {\n content = (\n <ErrorApiBoundary node={node} errorApi={errorApi}>\n {content}\n </ErrorApiBoundary>\n );\n } else {\n content = (\n <ErrorDisplayBoundary plugin={plugin}>{content}</ErrorDisplayBoundary>\n );\n }\n\n return (\n <AppNodeProvider node={node}>\n <Suspense fallback={<Progress />}>{content}</Suspense>\n </AppNodeProvider>\n );\n}\n\n/** @public */\nexport namespace ExtensionBoundary {\n export function lazy(\n appNode: AppNode,\n loader: () => Promise<JSX.Element>,\n ): JSX.Element {\n const ExtensionComponent = reactLazy(() =>\n loader().then(element => ({ default: () => element })),\n );\n return (\n <ExtensionBoundary node={appNode}>\n <ExtensionComponent />\n </ExtensionBoundary>\n );\n }\n\n export function lazyComponent<TProps extends {}>(\n appNode: AppNode,\n loader: () => Promise<(props: TProps) => JSX.Element>,\n ): (props: TProps) => JSX.Element {\n const ExtensionComponent = reactLazy(() =>\n loader().then(Component => ({ default: Component })),\n ) as unknown as React.ComponentType<TProps>;\n\n return (props: TProps) => (\n <ExtensionBoundary node={appNode}>\n <ExtensionComponent {...props} />\n </ExtensionBoundary>\n );\n }\n}\n"],"names":["ExtensionBoundary","lazy","reactLazy"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,SAAS,mBAAA,GAA4C;AACnD,EAAA,IAAI;AACF,IAAA,OAAO,OAAO,WAAW,CAAA;AAAA,EAC3B,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,MAAA;AAAA,EACT;AACF;AAEA,SAAS,2BAAA,GAA4D;AACnE,EAAA,IAAI;AACF,IAAA,OAAO,OAAO,mBAAmB,CAAA;AAAA,EACnC,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,MAAA;AAAA,EACT;AACF;AAKA,MAAM,YAAA,GAAe,CAAC,KAAA,KAA6B;AACjD,EAAA,MAAM,EAAE,OAAA,EAAS,QAAA,EAAS,GAAI,KAAA;AAC9B,EAAA,MAAM,YAAY,YAAA,EAAa;AAM/B,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,OAAA,EAAS;AACX,MAAA,SAAA,CAAU,YAAA,CAAa,gCAAgC,EAAE,CAAA;AAAA,IAC3D;AAAA,EACF,CAAA,EAAG,CAAC,SAAA,EAAW,OAAO,CAAC,CAAA;AAEvB,EAAA,uCAAU,QAAA,EAAS,CAAA;AACrB,CAAA;AAUO,SAAS,kBAAkB,KAAA,EAA+B;AAC/D,EAAA,MAAM,EAAE,IAAA,EAAM,QAAA,EAAS,GAAI,KAAA;AAE3B,EAAA,MAAM,WAAW,mBAAA,EAAoB;AAErC,EAAA,MAAM,kBAAA,GAAqB,OAAA;AAAA,IACzB,IAAA,CAAK,QAAA,E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;AAAA,CAGO,CAAUA,kBAAAA,KAAV;AACE,EAAA,SAASC,MAAA,CACd,SACA,MAAA,EACa;AACb,IAAA,MAAM,kBAAA,GAAqBC,IAAA;AAAA,MAAU,MACnC,QAAO,CAAE,IAAA,CAAK,cAAY,EAAE,OAAA,EAAS,MAAM,OAAA,EAAQ,CAAE;AAAA,KACvD;AACA,IAAA,2BACGF,kBAAAA,EAAA,EAAkB,MAAM,OAAA,EACvB,QAAA,kBAAA,GAAA,CAAC,sBAAmB,CAAA,EACtB,CAAA;AAAA,EAEJ;AAZO,EAAAA,kBAAAA,CAAS,IAAA,GAAAC,MAAA;AAcT,EAAA,SAAS,aAAA,CACd,SACA,MAAA,EACgC;AAChC,IAAA,MAAM,kBAAA,GAAqBC,IAAA;AAAA,MAAU,MACnC,QAAO,CAAE,IAAA,CAAK,gBAAc,EAAE,OAAA,EAAS,WAAU,CAAE;AAAA,KACrD;AAEA,IAAA,OAAO,CAAC,KAAA,qBACN,GAAA,CAACF,kBAAAA,EAAA,EAAkB,IAAA,EAAM,OAAA,EACvB,QAAA,kBAAA,GAAA,CAAC,kBAAA,EAAA,EAAoB,GAAG,KAAA,EAAO,CAAA,EACjC,CAAA;AAAA,EAEJ;AAbO,EAAAA,kBAAAA,CAAS,aAAA,GAAA,aAAA;AAAA,CAAA,EAfD,iBAAA,KAAA,iBAAA,GAAA,EAAA,CAAA,CAAA;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,13 +2,12 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { ReactNode, JSX as JSX$1, ComponentType, PropsWithChildren } from 'react';
|
|
4
4
|
import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
|
|
5
|
-
import { N as IconElement, V as RouteRef, b as AnyRouteRefParams, W as SubRouteRef, F as ExternalRouteRef, H as FrontendFeature, M as IconComponent, f as AppNode, J as FrontendPlugin, e as ApiRef, d as ApiHolder, X as TypesToApiRefs, c as ApiFactory, A as AnyApiFactory } from './types/alpha.d-
|
|
6
|
-
export { a as AnyApiRef, g as AppNodeEdges, h as AppNodeInstance, i as AppNodeSpec, j as AppTree, k as AppTreeApi, C as ConfigurableExtensionDataRef, l as CreateExtensionBlueprintOptions, m as CreateExtensionOptions, n as CreateFrontendModuleOptions, o as CreateFrontendPluginOptions, E as Extension, p as ExtensionAttachTo, q as ExtensionBlueprint, r as ExtensionBlueprintDefineParams, s as ExtensionBlueprintParameters, t as ExtensionBlueprintParams, u as ExtensionDataContainer, v as ExtensionDataRef, w as ExtensionDataValue, x as ExtensionDefinition, y as ExtensionDefinitionAttachTo, z as ExtensionDefinitionParameters, B as ExtensionFactoryMiddleware, D as ExtensionInput, G as FeatureFlagConfig, I as FrontendModule, K as FrontendPluginInfo, L as FrontendPluginInfoOptions, O as OverridableExtensionDefinition, P as OverridableFrontendPlugin, Q as PluginOptions, R as PluginWrapperApi, S as PluginWrapperBlueprint, T as PluginWrapperDefinition, U as PortableSchema, Y as appTreeApiRef, Z as createExtension, _ as createExtensionBlueprint, $ as createExtensionBlueprintParams, a0 as createExtensionDataRef, a1 as createExtensionInput, a2 as createExternalRouteRef, a3 as createFrontendModule, a4 as createFrontendPlugin, a5 as createRouteRef, a6 as createSubRouteRef, a7 as pluginWrapperApiRef } from './types/alpha.d-
|
|
5
|
+
import { N as IconElement, V as RouteRef, b as AnyRouteRefParams, W as SubRouteRef, F as ExternalRouteRef, H as FrontendFeature, M as IconComponent, f as AppNode, J as FrontendPlugin, e as ApiRef, d as ApiHolder, X as TypesToApiRefs, c as ApiFactory, A as AnyApiFactory } from './types/alpha.d-CUDLigYe.js';
|
|
6
|
+
export { a as AnyApiRef, g as AppNodeEdges, h as AppNodeInstance, i as AppNodeSpec, j as AppTree, k as AppTreeApi, C as ConfigurableExtensionDataRef, l as CreateExtensionBlueprintOptions, m as CreateExtensionOptions, n as CreateFrontendModuleOptions, o as CreateFrontendPluginOptions, E as Extension, p as ExtensionAttachTo, q as ExtensionBlueprint, r as ExtensionBlueprintDefineParams, s as ExtensionBlueprintParameters, t as ExtensionBlueprintParams, u as ExtensionDataContainer, v as ExtensionDataRef, w as ExtensionDataValue, x as ExtensionDefinition, y as ExtensionDefinitionAttachTo, z as ExtensionDefinitionParameters, B as ExtensionFactoryMiddleware, D as ExtensionInput, G as FeatureFlagConfig, I as FrontendModule, K as FrontendPluginInfo, L as FrontendPluginInfoOptions, O as OverridableExtensionDefinition, P as OverridableFrontendPlugin, Q as PluginOptions, R as PluginWrapperApi, S as PluginWrapperBlueprint, T as PluginWrapperDefinition, U as PortableSchema, Y as appTreeApiRef, Z as createExtension, _ as createExtensionBlueprint, $ as createExtensionBlueprintParams, a0 as createExtensionDataRef, a1 as createExtensionInput, a2 as createExternalRouteRef, a3 as createFrontendModule, a4 as createFrontendPlugin, a5 as createRouteRef, a6 as createSubRouteRef, a7 as pluginWrapperApiRef } from './types/alpha.d-CUDLigYe.js';
|
|
7
7
|
import { Observable, JsonValue, Expand, ExpandRecursive } from '@backstage/types';
|
|
8
8
|
import { Config } from '@backstage/config';
|
|
9
9
|
export { StandardSchemaV1 } from '@standard-schema/spec';
|
|
10
10
|
import '@backstage/filter-predicates';
|
|
11
|
-
import 'zod/v3';
|
|
12
11
|
|
|
13
12
|
/**
|
|
14
13
|
* Analytics context envelope.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
function assertNoLegacyConfigSchema(options) {
|
|
2
|
+
if (typeof options.config === "object" && options.config !== null && "schema" in options.config) {
|
|
3
|
+
throw new Error(
|
|
4
|
+
"The `config.schema` option is no longer supported. Migrate to the top-level `configSchema` option with Standard Schema values."
|
|
5
|
+
);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { assertNoLegacyConfigSchema };
|
|
10
|
+
//# sourceMappingURL=assertNoLegacyConfigSchema.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertNoLegacyConfigSchema.esm.js","sources":["../../src/schema/assertNoLegacyConfigSchema.ts"],"sourcesContent":["/*\n * Copyright 2026 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\nexport function assertNoLegacyConfigSchema(options: {\n config?: unknown;\n}): void {\n if (\n typeof options.config === 'object' &&\n options.config !== null &&\n 'schema' in options.config\n ) {\n throw new Error(\n 'The `config.schema` option is no longer supported. Migrate to the ' +\n 'top-level `configSchema` option with Standard Schema values.',\n );\n }\n}\n"],"names":[],"mappings":"AAgBO,SAAS,2BAA2B,OAAA,EAElC;AACP,EAAA,IACE,OAAO,QAAQ,MAAA,KAAW,QAAA,IAC1B,QAAQ,MAAA,KAAW,IAAA,IACnB,QAAA,IAAY,OAAA,CAAQ,MAAA,EACpB;AACA,IAAA,MAAM,IAAI,KAAA;AAAA,MACR;AAAA,KAEF;AAAA,EACF;AACF;;;;"}
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
import { z } from 'zod/v3';
|
|
2
|
-
import zodToJsonSchema from 'zod-to-json-schema';
|
|
3
|
-
|
|
4
|
-
function createDeprecatedConfigSchema(fields) {
|
|
5
|
-
const resolved = {};
|
|
6
|
-
for (const [key, field] of Object.entries(fields)) {
|
|
7
|
-
resolved[key] = resolveZodField(key, field(z));
|
|
8
|
-
}
|
|
9
|
-
return buildPortableSchema(resolved);
|
|
10
|
-
}
|
|
11
1
|
function createConfigSchema(fields) {
|
|
12
2
|
const resolved = {};
|
|
13
3
|
for (const [key, field] of Object.entries(fields)) {
|
|
@@ -15,21 +5,6 @@ function createConfigSchema(fields) {
|
|
|
15
5
|
}
|
|
16
6
|
return buildPortableSchema(resolved);
|
|
17
7
|
}
|
|
18
|
-
function mergePortableSchemas(a, b) {
|
|
19
|
-
if (!a && !b) {
|
|
20
|
-
return void 0;
|
|
21
|
-
}
|
|
22
|
-
if (!a) {
|
|
23
|
-
return b;
|
|
24
|
-
}
|
|
25
|
-
if (!b) {
|
|
26
|
-
return a;
|
|
27
|
-
}
|
|
28
|
-
return buildPortableSchema({
|
|
29
|
-
...a._fields,
|
|
30
|
-
...b._fields
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
8
|
function buildPortableSchema(fields) {
|
|
34
9
|
function parse(input) {
|
|
35
10
|
if (input !== void 0 && input !== null && (typeof input !== "object" || Array.isArray(input))) {
|
|
@@ -38,23 +13,23 @@ function buildPortableSchema(fields) {
|
|
|
38
13
|
);
|
|
39
14
|
}
|
|
40
15
|
const inputObj = input ?? {};
|
|
41
|
-
const
|
|
16
|
+
const result = {};
|
|
42
17
|
const errors = [];
|
|
43
18
|
for (const [key, field] of Object.entries(fields)) {
|
|
44
19
|
const validated = field.validate(inputObj[key]);
|
|
45
20
|
if ("errors" in validated) {
|
|
46
21
|
errors.push(...validated.errors);
|
|
47
22
|
} else if (validated.value !== void 0 || key in inputObj) {
|
|
48
|
-
|
|
23
|
+
result[key] = validated.value;
|
|
49
24
|
}
|
|
50
25
|
}
|
|
51
26
|
if (errors.length > 0) {
|
|
52
27
|
throw new Error(errors.join("; "));
|
|
53
28
|
}
|
|
54
|
-
return
|
|
29
|
+
return result;
|
|
55
30
|
}
|
|
56
31
|
let cached;
|
|
57
|
-
|
|
32
|
+
return {
|
|
58
33
|
parse,
|
|
59
34
|
schema() {
|
|
60
35
|
if (!cached) {
|
|
@@ -63,11 +38,6 @@ function buildPortableSchema(fields) {
|
|
|
63
38
|
return cached;
|
|
64
39
|
}
|
|
65
40
|
};
|
|
66
|
-
Object.defineProperty(result, "_fields", {
|
|
67
|
-
value: fields,
|
|
68
|
-
enumerable: false
|
|
69
|
-
});
|
|
70
|
-
return result;
|
|
71
41
|
}
|
|
72
42
|
function resolveField(key, schema) {
|
|
73
43
|
if (isZodV3Type(schema)) {
|
|
@@ -87,23 +57,6 @@ function resolveField(key, schema) {
|
|
|
87
57
|
`Config schema for field '${key}' is not a valid Standard Schema`
|
|
88
58
|
);
|
|
89
59
|
}
|
|
90
|
-
function resolveZodField(key, schema) {
|
|
91
|
-
const wrapper = z.object({ [key]: schema });
|
|
92
|
-
return {
|
|
93
|
-
validate(value) {
|
|
94
|
-
const result = wrapper.safeParse({ [key]: value });
|
|
95
|
-
if (result.success) {
|
|
96
|
-
return { value: result.data[key] };
|
|
97
|
-
}
|
|
98
|
-
return { errors: result.error.issues.map(formatZodIssue) };
|
|
99
|
-
},
|
|
100
|
-
toJsonSchema() {
|
|
101
|
-
const wholeJsonSchema = zodToJsonSchema(wrapper);
|
|
102
|
-
return wholeJsonSchema.properties?.[key] ?? {};
|
|
103
|
-
},
|
|
104
|
-
required: !schema.isOptional()
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
60
|
function resolveStandardField(key, schema) {
|
|
108
61
|
const required = isFieldRequired(schema);
|
|
109
62
|
return {
|
|
@@ -167,19 +120,6 @@ function isFieldRequired(schema) {
|
|
|
167
120
|
}
|
|
168
121
|
return (result.issues?.length ?? 0) > 0;
|
|
169
122
|
}
|
|
170
|
-
function formatZodIssue(issue) {
|
|
171
|
-
if (issue.code === "invalid_union" && issue.unionErrors?.[0]?.issues?.[0]) {
|
|
172
|
-
return formatZodIssue(issue.unionErrors[0].issues[0]);
|
|
173
|
-
}
|
|
174
|
-
let message = issue.message;
|
|
175
|
-
if (message === "Required") {
|
|
176
|
-
message = "Missing required value";
|
|
177
|
-
}
|
|
178
|
-
if (issue.path.length) {
|
|
179
|
-
message += ` at '${issue.path.join(".")}'`;
|
|
180
|
-
}
|
|
181
|
-
return message;
|
|
182
|
-
}
|
|
183
123
|
function formatStandardIssue(fieldKey, issue) {
|
|
184
124
|
let message = issue.message;
|
|
185
125
|
if (message === "Required") {
|
|
@@ -190,11 +130,6 @@ function formatStandardIssue(fieldKey, issue) {
|
|
|
190
130
|
).join(".")}` : fieldKey;
|
|
191
131
|
return `${message} at '${path}'`;
|
|
192
132
|
}
|
|
193
|
-
function warnConfigSchemaPropDeprecation(callSite) {
|
|
194
|
-
console.warn(
|
|
195
|
-
`DEPRECATION WARNING: The \`config.schema\` option for extension config is deprecated. Use the \`configSchema\` option instead with Standard Schema values, for example \`configSchema: { title: z.string() }\` using the \`zod\` v4 package (\`zod@^4.0.0\`). Declared at ${callSite}`
|
|
196
|
-
);
|
|
197
|
-
}
|
|
198
133
|
|
|
199
|
-
export { createConfigSchema
|
|
134
|
+
export { createConfigSchema };
|
|
200
135
|
//# sourceMappingURL=createPortableSchema.esm.js.map
|