@backstage/frontend-plugin-api 0.13.2 → 0.13.4

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 CHANGED
@@ -1,5 +1,30 @@
1
1
  # @backstage/frontend-plugin-api
2
2
 
3
+ ## 0.13.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 5683c85: Bump to latest zod to ensure it has the latest features
8
+
9
+ ## 0.13.3
10
+
11
+ ### Patch Changes
12
+
13
+ - 3bd2a1a: Updated documentation for `createApiRef` to clarify the role of the ID in specifying the owning plugin of an API.
14
+ - 9ccf84e: The following blueprints are being restricted to only be used in app plugin overrides and modules. They are being moved to the `@backstage/plugin-app-react` package and have been deprecated:
15
+
16
+ - `AppRootWrapperBlueprint`
17
+ - `IconBundleBlueprint`
18
+ - `NavContentBlueprint`
19
+ - `RouterBlueprint`
20
+ - `SignInPageBlueprint`
21
+ - `SwappableComponentBlueprint`
22
+ - `ThemeBlueprint`
23
+ - `TranslationBlueprint`
24
+
25
+ - 4554a4e: Added an alpha `PluginWrapperBlueprint` exported from `@backstage/frontend-plugin-api/alpha`, which can install components that will wrap all plugin elements.
26
+ - 872eb91: Upgrade `zod-to-json-schema` to latest version
27
+
3
28
  ## 0.13.2
4
29
 
5
30
  ### Patch Changes
@@ -0,0 +1,71 @@
1
+ import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
2
+ import { ComponentType, ReactNode } from 'react';
3
+
4
+ /**
5
+ * Creates extensions that wrap plugin extensions with providers.
6
+ *
7
+ * @alpha
8
+ */
9
+ declare const PluginWrapperBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
10
+ kind: "plugin-wrapper";
11
+ params: (params: {
12
+ loader: () => Promise<{
13
+ component: ComponentType<{
14
+ children: ReactNode;
15
+ }>;
16
+ }>;
17
+ }) => _backstage_frontend_plugin_api.ExtensionBlueprintParams<{
18
+ loader: () => Promise<{
19
+ component: ComponentType<{
20
+ children: ReactNode;
21
+ }>;
22
+ }>;
23
+ }>;
24
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<() => Promise<{
25
+ component: ComponentType<{
26
+ children: ReactNode;
27
+ }>;
28
+ }>, "core.plugin-wrapper.loader", {}>;
29
+ inputs: {};
30
+ config: {};
31
+ configInput: {};
32
+ dataRefs: {
33
+ wrapper: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<() => Promise<{
34
+ component: ComponentType<{
35
+ children: ReactNode;
36
+ }>;
37
+ }>, "core.plugin-wrapper.loader", {}>;
38
+ };
39
+ }>;
40
+
41
+ /**
42
+ * The Plugin Wrapper API is used to wrap plugin extensions with providers,
43
+ * plugins should generally use `ExtensionBoundary` instead.
44
+ *
45
+ * @remarks
46
+ *
47
+ * This API is primarily intended for internal use by the Backstage frontend
48
+ * system, but can be used for advanced use-cases. If you do override it, be
49
+ * sure to include the default implementation as well.
50
+ *
51
+ * @alpha
52
+ */
53
+ type PluginWrapperApi = {
54
+ /**
55
+ * Returns a wrapper component for a specific plugin, or undefined if no
56
+ * wrappers exist. Do not use this API directly, instead use
57
+ * `ExtensionBoundary` to wrap your plugin components if needed.
58
+ */
59
+ getPluginWrapper(pluginId: string): ComponentType<{
60
+ children: ReactNode;
61
+ }> | undefined;
62
+ };
63
+ /**
64
+ * The API reference of {@link PluginWrapperApi}.
65
+ *
66
+ * @alpha
67
+ */
68
+ declare const pluginWrapperApiRef: _backstage_frontend_plugin_api.ApiRef<PluginWrapperApi>;
69
+
70
+ export { PluginWrapperBlueprint, pluginWrapperApiRef };
71
+ export type { PluginWrapperApi };
@@ -0,0 +1,3 @@
1
+ export { PluginWrapperBlueprint } from './blueprints/PluginWrapperBlueprint.esm.js';
2
+ export { pluginWrapperApiRef } from './apis/definitions/PluginWrapperApi.esm.js';
3
+ //# sourceMappingURL=alpha.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alpha.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,8 @@
1
+ import { createApiRef } from '@backstage/frontend-plugin-api';
2
+
3
+ const pluginWrapperApiRef = createApiRef({
4
+ id: "core.plugin-wrapper.alpha"
5
+ });
6
+
7
+ export { pluginWrapperApiRef };
8
+ //# sourceMappingURL=PluginWrapperApi.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PluginWrapperApi.esm.js","sources":["../../../src/apis/definitions/PluginWrapperApi.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 { ComponentType, ReactNode } from 'react';\nimport { createApiRef } from '@backstage/frontend-plugin-api';\n\n/**\n * The Plugin Wrapper API is used to wrap plugin extensions with providers,\n * plugins should generally use `ExtensionBoundary` instead.\n *\n * @remarks\n *\n * This API is primarily intended for internal use by the Backstage frontend\n * system, but can be used for advanced use-cases. If you do override it, be\n * sure to include the default implementation as well.\n *\n * @alpha\n */\nexport type PluginWrapperApi = {\n /**\n * Returns a wrapper component for a specific plugin, or undefined if no\n * wrappers exist. Do not use this API directly, instead use\n * `ExtensionBoundary` to wrap your plugin components if needed.\n */\n getPluginWrapper(\n pluginId: string,\n ): ComponentType<{ children: ReactNode }> | undefined;\n};\n\n/**\n * The API reference of {@link PluginWrapperApi}.\n *\n * @alpha\n */\nexport const pluginWrapperApiRef = createApiRef<PluginWrapperApi>({\n id: 'core.plugin-wrapper.alpha',\n});\n"],"names":[],"mappings":";;AA+CO,MAAM,sBAAsB,YAAA,CAA+B;AAAA,EAChE,EAAA,EAAI;AACN,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ApiRef.esm.js","sources":["../../../src/apis/system/ApiRef.ts"],"sourcesContent":["/*\n * Copyright 2020 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 type { ApiRef } from './types';\n\n/**\n * API reference configuration - holds an ID of the referenced API.\n *\n * @public\n */\nexport type ApiRefConfig = {\n id: string;\n};\n\nclass ApiRefImpl<T> implements ApiRef<T> {\n constructor(private readonly config: ApiRefConfig) {\n const valid = config.id\n .split('.')\n .flatMap(part => part.split('-'))\n .every(part => part.match(/^[a-z][a-z0-9]*$/));\n if (!valid) {\n throw new Error(\n `API id must only contain period separated lowercase alphanum tokens with dashes, got '${config.id}'`,\n );\n }\n }\n\n get id(): string {\n return this.config.id;\n }\n\n // Utility for getting type of an api, using `typeof apiRef.T`\n get T(): T {\n throw new Error(`tried to read ApiRef.T of ${this}`);\n }\n\n toString() {\n return `apiRef{${this.config.id}}`;\n }\n}\n\n/**\n * Creates a reference to an API.\n *\n * @param config - The descriptor of the API to reference.\n * @returns An API reference.\n * @public\n */\nexport function createApiRef<T>(config: ApiRefConfig): ApiRef<T> {\n return new ApiRefImpl<T>(config);\n}\n"],"names":[],"mappings":"AA2BA,MAAM,UAAA,CAAmC;AAAA,EACvC,YAA6B,MAAA,EAAsB;AAAtB,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA;AAC3B,IAAA,MAAM,QAAQ,MAAA,CAAO,EAAA,CAClB,MAAM,GAAG,CAAA,CACT,QAAQ,CAAA,IAAA,KAAQ,IAAA,CAAK,KAAA,CAAM,GAAG,CAAC,CAAA,CAC/B,KAAA,CAAM,UAAQ,IAAA,CAAK,KAAA,CAAM,kBAAkB,CAAC,CAAA;AAC/C,IAAA,IAAI,CAAC,KAAA,EAAO;AACV,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAA,sFAAA,EAAyF,OAAO,EAAE,CAAA,CAAA;AAAA,OACpG;AAAA,IACF;AAAA,EACF;AAAA,EAEA,IAAI,EAAA,GAAa;AACf,IAAA,OAAO,KAAK,MAAA,CAAO,EAAA;AAAA,EACrB;AAAA;AAAA,EAGA,IAAI,CAAA,GAAO;AACT,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,0BAAA,EAA6B,IAAI,CAAA,CAAE,CAAA;AAAA,EACrD;AAAA,EAEA,QAAA,GAAW;AACT,IAAA,OAAO,CAAA,OAAA,EAAU,IAAA,CAAK,MAAA,CAAO,EAAE,CAAA,CAAA,CAAA;AAAA,EACjC;AACF;AASO,SAAS,aAAgB,MAAA,EAAiC;AAC/D,EAAA,OAAO,IAAI,WAAc,MAAM,CAAA;AACjC;;;;"}
1
+ {"version":3,"file":"ApiRef.esm.js","sources":["../../../src/apis/system/ApiRef.ts"],"sourcesContent":["/*\n * Copyright 2020 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 type { ApiRef } from './types';\n\n/**\n * API reference configuration - holds an ID of the referenced API.\n *\n * @public\n */\nexport type ApiRefConfig = {\n id: string;\n};\n\nclass ApiRefImpl<T> implements ApiRef<T> {\n constructor(private readonly config: ApiRefConfig) {\n const valid = config.id\n .split('.')\n .flatMap(part => part.split('-'))\n .every(part => part.match(/^[a-z][a-z0-9]*$/));\n if (!valid) {\n throw new Error(\n `API id must only contain period separated lowercase alphanum tokens with dashes, got '${config.id}'`,\n );\n }\n }\n\n get id(): string {\n return this.config.id;\n }\n\n // Utility for getting type of an api, using `typeof apiRef.T`\n get T(): T {\n throw new Error(`tried to read ApiRef.T of ${this}`);\n }\n\n toString() {\n return `apiRef{${this.config.id}}`;\n }\n}\n\n/**\n * Creates a reference to an API. The provided `id` is a stable identifier for\n * the API implementation.\n *\n * @remarks\n *\n * The frontend system infers the owning plugin for an API from the `id`. The\n * recommended pattern is `plugin.<plugin-id>.*` (for example,\n * `plugin.catalog.entity-presentation`). This ensures that other plugins can't\n * mistakenly override your API implementation.\n *\n * @param config - The descriptor of the API to reference.\n * @returns An API reference.\n * @public\n */\nexport function createApiRef<T>(config: ApiRefConfig): ApiRef<T> {\n return new ApiRefImpl<T>(config);\n}\n"],"names":[],"mappings":"AA2BA,MAAM,UAAA,CAAmC;AAAA,EACvC,YAA6B,MAAA,EAAsB;AAAtB,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA;AAC3B,IAAA,MAAM,QAAQ,MAAA,CAAO,EAAA,CAClB,MAAM,GAAG,CAAA,CACT,QAAQ,CAAA,IAAA,KAAQ,IAAA,CAAK,KAAA,CAAM,GAAG,CAAC,CAAA,CAC/B,KAAA,CAAM,UAAQ,IAAA,CAAK,KAAA,CAAM,kBAAkB,CAAC,CAAA;AAC/C,IAAA,IAAI,CAAC,KAAA,EAAO;AACV,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAA,sFAAA,EAAyF,OAAO,EAAE,CAAA,CAAA;AAAA,OACpG;AAAA,IACF;AAAA,EACF;AAAA,EAEA,IAAI,EAAA,GAAa;AACf,IAAA,OAAO,KAAK,MAAA,CAAO,EAAA;AAAA,EACrB;AAAA;AAAA,EAGA,IAAI,CAAA,GAAO;AACT,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,0BAAA,EAA6B,IAAI,CAAA,CAAE,CAAA;AAAA,EACrD;AAAA,EAEA,QAAA,GAAW;AACT,IAAA,OAAO,CAAA,OAAA,EAAU,IAAA,CAAK,MAAA,CAAO,EAAE,CAAA,CAAA,CAAA;AAAA,EACjC;AACF;AAiBO,SAAS,aAAgB,MAAA,EAAiC;AAC/D,EAAA,OAAO,IAAI,WAAc,MAAM,CAAA;AACjC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"AppRootWrapperBlueprint.esm.js","sources":["../../src/blueprints/AppRootWrapperBlueprint.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 { ReactNode } from 'react';\nimport { createExtensionBlueprint, createExtensionDataRef } from '../wiring';\n\nconst componentDataRef = createExtensionDataRef<\n (props: { children: ReactNode }) => JSX.Element | null\n>().with({ id: 'app.root.wrapper' });\n\n/**\n * Creates a extensions that render a React wrapper at the app root, enclosing\n * the app layout. This is useful for example for adding global React contexts\n * and similar.\n *\n * @public\n */\nexport const AppRootWrapperBlueprint = createExtensionBlueprint({\n kind: 'app-root-wrapper',\n attachTo: { id: 'app/root', input: 'wrappers' },\n output: [componentDataRef],\n dataRefs: {\n component: componentDataRef,\n },\n *factory(params: {\n /** @deprecated use the `component` parameter instead */\n Component?: [error: 'Use the `component` parameter instead'];\n component: (props: { children: ReactNode }) => JSX.Element | null;\n }) {\n yield componentDataRef(params.component);\n },\n});\n"],"names":[],"mappings":";;;;;;AAmBA,MAAM,mBAAmB,sBAAA,EAEvB,CAAE,KAAK,EAAE,EAAA,EAAI,oBAAoB,CAAA;AAS5B,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,gBAAgB,CAAA;AAAA,EACzB,QAAA,EAAU;AAAA,IACR,SAAA,EAAW;AAAA,GACb;AAAA,EACA,CAAC,QAAQ,MAAA,EAIN;AACD,IAAA,MAAM,gBAAA,CAAiB,OAAO,SAAS,CAAA;AAAA,EACzC;AACF,CAAC;;;;"}
1
+ {"version":3,"file":"AppRootWrapperBlueprint.esm.js","sources":["../../src/blueprints/AppRootWrapperBlueprint.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 { ReactNode } from 'react';\nimport { createExtensionBlueprint, createExtensionDataRef } from '../wiring';\n\nconst componentDataRef = createExtensionDataRef<\n (props: { children: ReactNode }) => JSX.Element | null\n>().with({ id: 'app.root.wrapper' });\n\n/**\n * Creates a extensions that render a React wrapper at the app root, enclosing\n * the app layout. This is useful for example for adding global React contexts\n * and similar.\n *\n * @public\n * @deprecated Use {@link @backstage/plugin-app-react#AppRootWrapperBlueprint} instead.\n * If you were using this blueprint to provide a context for your plugin,\n * use `PluginWrapperBlueprint` from `@backstage/frontend-plugin-api/alpha` instead.\n */\nexport const AppRootWrapperBlueprint = createExtensionBlueprint({\n kind: 'app-root-wrapper',\n attachTo: { id: 'app/root', input: 'wrappers' },\n output: [componentDataRef],\n dataRefs: {\n component: componentDataRef,\n },\n *factory(params: {\n /** @deprecated use the `component` parameter instead */\n Component?: [error: 'Use the `component` parameter instead'];\n component: (props: { children: ReactNode }) => JSX.Element | null;\n }) {\n yield componentDataRef(params.component);\n },\n});\n"],"names":[],"mappings":";;;;;;AAmBA,MAAM,mBAAmB,sBAAA,EAEvB,CAAE,KAAK,EAAE,EAAA,EAAI,oBAAoB,CAAA;AAY5B,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,gBAAgB,CAAA;AAAA,EACzB,QAAA,EAAU;AAAA,IACR,SAAA,EAAW;AAAA,GACb;AAAA,EACA,CAAC,QAAQ,MAAA,EAIN;AACD,IAAA,MAAM,gBAAA,CAAiB,OAAO,SAAS,CAAA;AAAA,EACzC;AACF,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"IconBundleBlueprint.esm.js","sources":["../../src/blueprints/IconBundleBlueprint.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 { IconComponent } from '../icons';\nimport { createExtensionBlueprint, createExtensionDataRef } from '../wiring';\n\nconst iconsDataRef = createExtensionDataRef<{\n [key in string]: IconComponent;\n}>().with({ id: 'core.icons' });\n\n/** @public */\nexport const IconBundleBlueprint = createExtensionBlueprint({\n kind: 'icon-bundle',\n attachTo: { id: 'api:app/icons', input: 'icons' },\n output: [iconsDataRef],\n factory: (params: { icons: { [key in string]: IconComponent } }) => [\n iconsDataRef(params.icons),\n ],\n dataRefs: {\n icons: iconsDataRef,\n },\n});\n"],"names":[],"mappings":";;;;;;AAmBA,MAAM,eAAe,sBAAA,EAElB,CAAE,KAAK,EAAE,EAAA,EAAI,cAAc,CAAA;AAGvB,MAAM,sBAAsB,wBAAA,CAAyB;AAAA,EAC1D,IAAA,EAAM,aAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,eAAA,EAAiB,OAAO,OAAA,EAAQ;AAAA,EAChD,MAAA,EAAQ,CAAC,YAAY,CAAA;AAAA,EACrB,OAAA,EAAS,CAAC,MAAA,KAA0D;AAAA,IAClE,YAAA,CAAa,OAAO,KAAK;AAAA,GAC3B;AAAA,EACA,QAAA,EAAU;AAAA,IACR,KAAA,EAAO;AAAA;AAEX,CAAC;;;;"}
1
+ {"version":3,"file":"IconBundleBlueprint.esm.js","sources":["../../src/blueprints/IconBundleBlueprint.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 { IconComponent } from '../icons';\nimport { createExtensionBlueprint, createExtensionDataRef } from '../wiring';\n\nconst iconsDataRef = createExtensionDataRef<{\n [key in string]: IconComponent;\n}>().with({ id: 'core.icons' });\n\n/**\n * @public\n * @deprecated Use {@link @backstage/plugin-app-react#IconBundleBlueprint} instead.\n */\nexport const IconBundleBlueprint = createExtensionBlueprint({\n kind: 'icon-bundle',\n attachTo: { id: 'api:app/icons', input: 'icons' },\n output: [iconsDataRef],\n factory: (params: { icons: { [key in string]: IconComponent } }) => [\n iconsDataRef(params.icons),\n ],\n dataRefs: {\n icons: iconsDataRef,\n },\n});\n"],"names":[],"mappings":";;;;;;AAmBA,MAAM,eAAe,sBAAA,EAElB,CAAE,KAAK,EAAE,EAAA,EAAI,cAAc,CAAA;AAMvB,MAAM,sBAAsB,wBAAA,CAAyB;AAAA,EAC1D,IAAA,EAAM,aAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,eAAA,EAAiB,OAAO,OAAA,EAAQ;AAAA,EAChD,MAAA,EAAQ,CAAC,YAAY,CAAA;AAAA,EACrB,OAAA,EAAS,CAAC,MAAA,KAA0D;AAAA,IAClE,YAAA,CAAa,OAAO,KAAK;AAAA,GAC3B;AAAA,EACA,QAAA,EAAU;AAAA,IACR,KAAA,EAAO;AAAA;AAEX,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"NavContentBlueprint.esm.js","sources":["../../src/blueprints/NavContentBlueprint.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 { IconComponent, RouteRef } from '@backstage/frontend-plugin-api';\nimport { createExtensionBlueprint, createExtensionDataRef } from '../wiring';\n\n/**\n * The props for the {@link NavContentComponent}.\n *\n * @public\n */\nexport interface NavContentComponentProps {\n /**\n * The nav items available to the component. These are all the items created\n * with the {@link NavItemBlueprint} in the app.\n *\n * In addition to the original properties from the nav items, these also\n * include a resolved route path as `to`, and duplicated `title` as `text` to\n * simplify rendering.\n */\n items: Array<{\n // Original props from nav items\n icon: IconComponent;\n title: string;\n routeRef: RouteRef<undefined>;\n\n // Additional props to simplify item rendering\n to: string;\n text: string;\n }>;\n}\n\n/**\n * A component that renders the nav bar content, to be passed to the {@link NavContentBlueprint}.\n *\n * @public\n */\nexport type NavContentComponent = (\n props: NavContentComponentProps,\n) => JSX.Element | null;\n\nconst componentDataRef = createExtensionDataRef<NavContentComponent>().with({\n id: 'core.nav-content.component',\n});\n\n/**\n * Creates an extension that replaces the entire nav bar with your own component.\n *\n * @public\n */\nexport const NavContentBlueprint = createExtensionBlueprint({\n kind: 'nav-content',\n attachTo: { id: 'app/nav', input: 'content' },\n output: [componentDataRef],\n dataRefs: {\n component: componentDataRef,\n },\n *factory(params: { component: NavContentComponent }) {\n yield componentDataRef(params.component);\n },\n});\n"],"names":[],"mappings":";;;;;;AAsDA,MAAM,gBAAA,GAAmB,sBAAA,EAA4C,CAAE,IAAA,CAAK;AAAA,EAC1E,EAAA,EAAI;AACN,CAAC,CAAA;AAOM,MAAM,sBAAsB,wBAAA,CAAyB;AAAA,EAC1D,IAAA,EAAM,aAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,SAAA,EAAW,OAAO,SAAA,EAAU;AAAA,EAC5C,MAAA,EAAQ,CAAC,gBAAgB,CAAA;AAAA,EACzB,QAAA,EAAU;AAAA,IACR,SAAA,EAAW;AAAA,GACb;AAAA,EACA,CAAC,QAAQ,MAAA,EAA4C;AACnD,IAAA,MAAM,gBAAA,CAAiB,OAAO,SAAS,CAAA;AAAA,EACzC;AACF,CAAC;;;;"}
1
+ {"version":3,"file":"NavContentBlueprint.esm.js","sources":["../../src/blueprints/NavContentBlueprint.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 { IconComponent, RouteRef } from '@backstage/frontend-plugin-api';\nimport { createExtensionBlueprint, createExtensionDataRef } from '../wiring';\n\n/**\n * The props for the {@link NavContentComponent}.\n *\n * @public\n */\nexport interface NavContentComponentProps {\n /**\n * The nav items available to the component. These are all the items created\n * with the {@link NavItemBlueprint} in the app.\n *\n * In addition to the original properties from the nav items, these also\n * include a resolved route path as `to`, and duplicated `title` as `text` to\n * simplify rendering.\n */\n items: Array<{\n // Original props from nav items\n icon: IconComponent;\n title: string;\n routeRef: RouteRef<undefined>;\n\n // Additional props to simplify item rendering\n to: string;\n text: string;\n }>;\n}\n\n/**\n * A component that renders the nav bar content, to be passed to the {@link NavContentBlueprint}.\n *\n * @public\n */\nexport type NavContentComponent = (\n props: NavContentComponentProps,\n) => JSX.Element | null;\n\nconst componentDataRef = createExtensionDataRef<NavContentComponent>().with({\n id: 'core.nav-content.component',\n});\n\n/**\n * Creates an extension that replaces the entire nav bar with your own component.\n *\n * @public\n * @deprecated Use {@link @backstage/plugin-app-react#NavContentBlueprint} instead.\n */\nexport const NavContentBlueprint = createExtensionBlueprint({\n kind: 'nav-content',\n attachTo: { id: 'app/nav', input: 'content' },\n output: [componentDataRef],\n dataRefs: {\n component: componentDataRef,\n },\n *factory(params: { component: NavContentComponent }) {\n yield componentDataRef(params.component);\n },\n});\n"],"names":[],"mappings":";;;;;;AAsDA,MAAM,gBAAA,GAAmB,sBAAA,EAA4C,CAAE,IAAA,CAAK;AAAA,EAC1E,EAAA,EAAI;AACN,CAAC,CAAA;AAQM,MAAM,sBAAsB,wBAAA,CAAyB;AAAA,EAC1D,IAAA,EAAM,aAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,SAAA,EAAW,OAAO,SAAA,EAAU;AAAA,EAC5C,MAAA,EAAQ,CAAC,gBAAgB,CAAA;AAAA,EACzB,QAAA,EAAU;AAAA,IACR,SAAA,EAAW;AAAA,GACb;AAAA,EACA,CAAC,QAAQ,MAAA,EAA4C;AACnD,IAAA,MAAM,gBAAA,CAAiB,OAAO,SAAS,CAAA;AAAA,EACzC;AACF,CAAC;;;;"}
@@ -0,0 +1,24 @@
1
+ import '../wiring/coreExtensionData.esm.js';
2
+ import 'zod';
3
+ import 'zod-to-json-schema';
4
+ import { createExtensionDataRef } from '../wiring/createExtensionDataRef.esm.js';
5
+ import { createExtensionBlueprint, createExtensionBlueprintParams } from '../wiring/createExtensionBlueprint.esm.js';
6
+
7
+ const wrapperDataRef = createExtensionDataRef().with({ id: "core.plugin-wrapper.loader" });
8
+ const PluginWrapperBlueprint = createExtensionBlueprint({
9
+ kind: "plugin-wrapper",
10
+ attachTo: { id: "api:app/plugin-wrapper", input: "wrappers" },
11
+ output: [wrapperDataRef],
12
+ dataRefs: {
13
+ wrapper: wrapperDataRef
14
+ },
15
+ defineParams(params) {
16
+ return createExtensionBlueprintParams(params);
17
+ },
18
+ *factory(params) {
19
+ yield wrapperDataRef(params.loader);
20
+ }
21
+ });
22
+
23
+ export { PluginWrapperBlueprint };
24
+ //# sourceMappingURL=PluginWrapperBlueprint.esm.js.map
@@ -0,0 +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\nconst wrapperDataRef = createExtensionDataRef<\n () => Promise<{ component: ComponentType<{ children: ReactNode }> }>\n>().with({ id: 'core.plugin-wrapper.loader' });\n\n/**\n * Creates extensions that wrap plugin extensions with providers.\n *\n * @alpha\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(params: {\n loader: () => Promise<{\n component: ComponentType<{ children: ReactNode }>;\n }>;\n }) {\n return createExtensionBlueprintParams(params);\n },\n *factory(params) {\n yield wrapperDataRef(params.loader);\n },\n});\n"],"names":[],"mappings":";;;;;;AAuBA,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,aAAa,MAAA,EAIV;AACD,IAAA,OAAO,+BAA+B,MAAM,CAAA;AAAA,EAC9C,CAAA;AAAA,EACA,CAAC,QAAQ,MAAA,EAAQ;AACf,IAAA,MAAM,cAAA,CAAe,OAAO,MAAM,CAAA;AAAA,EACpC;AACF,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"RouterBlueprint.esm.js","sources":["../../src/blueprints/RouterBlueprint.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 { ReactNode } from 'react';\nimport { createExtensionBlueprint, createExtensionDataRef } from '../wiring';\n\nconst componentDataRef = createExtensionDataRef<\n (props: { children: ReactNode }) => JSX.Element | null\n>().with({ id: 'app.router.wrapper' });\n\n/** @public */\nexport const RouterBlueprint = createExtensionBlueprint({\n kind: 'app-router-component',\n attachTo: { id: 'app/root', input: 'router' },\n output: [componentDataRef],\n dataRefs: {\n component: componentDataRef,\n },\n *factory(params: {\n /** @deprecated use the `component` parameter instead */\n Component?: [error: 'Use the `component` parameter instead'];\n component: (props: { children: ReactNode }) => JSX.Element | null;\n }) {\n yield componentDataRef(params.component);\n },\n});\n"],"names":[],"mappings":";;;;;;AAmBA,MAAM,mBAAmB,sBAAA,EAEvB,CAAE,KAAK,EAAE,EAAA,EAAI,sBAAsB,CAAA;AAG9B,MAAM,kBAAkB,wBAAA,CAAyB;AAAA,EACtD,IAAA,EAAM,sBAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,UAAA,EAAY,OAAO,QAAA,EAAS;AAAA,EAC5C,MAAA,EAAQ,CAAC,gBAAgB,CAAA;AAAA,EACzB,QAAA,EAAU;AAAA,IACR,SAAA,EAAW;AAAA,GACb;AAAA,EACA,CAAC,QAAQ,MAAA,EAIN;AACD,IAAA,MAAM,gBAAA,CAAiB,OAAO,SAAS,CAAA;AAAA,EACzC;AACF,CAAC;;;;"}
1
+ {"version":3,"file":"RouterBlueprint.esm.js","sources":["../../src/blueprints/RouterBlueprint.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 { ReactNode } from 'react';\nimport { createExtensionBlueprint, createExtensionDataRef } from '../wiring';\n\nconst componentDataRef = createExtensionDataRef<\n (props: { children: ReactNode }) => JSX.Element | null\n>().with({ id: 'app.router.wrapper' });\n\n/**\n * @public\n * @deprecated Use {@link @backstage/plugin-app-react#RouterBlueprint} instead.\n */\nexport const RouterBlueprint = createExtensionBlueprint({\n kind: 'app-router-component',\n attachTo: { id: 'app/root', input: 'router' },\n output: [componentDataRef],\n dataRefs: {\n component: componentDataRef,\n },\n *factory(params: {\n /** @deprecated use the `component` parameter instead */\n Component?: [error: 'Use the `component` parameter instead'];\n component: (props: { children: ReactNode }) => JSX.Element | null;\n }) {\n yield componentDataRef(params.component);\n },\n});\n"],"names":[],"mappings":";;;;;;AAmBA,MAAM,mBAAmB,sBAAA,EAEvB,CAAE,KAAK,EAAE,EAAA,EAAI,sBAAsB,CAAA;AAM9B,MAAM,kBAAkB,wBAAA,CAAyB;AAAA,EACtD,IAAA,EAAM,sBAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,UAAA,EAAY,OAAO,QAAA,EAAS;AAAA,EAC5C,MAAA,EAAQ,CAAC,gBAAgB,CAAA;AAAA,EACzB,QAAA,EAAU;AAAA,IACR,SAAA,EAAW;AAAA,GACb;AAAA,EACA,CAAC,QAAQ,MAAA,EAIN;AACD,IAAA,MAAM,gBAAA,CAAiB,OAAO,SAAS,CAAA;AAAA,EACzC;AACF,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"SignInPageBlueprint.esm.js","sources":["../../src/blueprints/SignInPageBlueprint.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, lazy, ReactNode } from 'react';\nimport { createExtensionBlueprint, createExtensionDataRef } from '../wiring';\nimport { ExtensionBoundary } from '../components';\nimport { IdentityApi } from '../apis';\n\n/**\n * Props for the `SignInPage` component.\n *\n * @public\n */\nexport type SignInPageProps = {\n /**\n * Set the IdentityApi on successful sign-in. This should only be called once.\n */\n onSignInSuccess(identityApi: IdentityApi): void;\n\n /**\n * The children to render.\n */\n children?: ReactNode;\n};\n\nconst componentDataRef = createExtensionDataRef<\n ComponentType<SignInPageProps>\n>().with({ id: 'core.sign-in-page.component' });\n\n/**\n * Creates an extension that replaces the sign in page.\n *\n * @public\n */\nexport const SignInPageBlueprint = createExtensionBlueprint({\n kind: 'sign-in-page',\n attachTo: { id: 'app/root', input: 'signInPage' },\n output: [componentDataRef],\n dataRefs: {\n component: componentDataRef,\n },\n *factory(\n {\n loader,\n }: {\n loader: () => Promise<ComponentType<SignInPageProps>>;\n },\n { node },\n ) {\n const ExtensionComponent = lazy(() =>\n loader().then(component => ({ default: component })),\n );\n\n yield componentDataRef(props => (\n <ExtensionBoundary node={node}>\n <ExtensionComponent {...props} />\n </ExtensionBoundary>\n ));\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAM,mBAAmB,sBAAA,EAEvB,CAAE,KAAK,EAAE,EAAA,EAAI,+BAA+B,CAAA;AAOvC,MAAM,sBAAsB,wBAAA,CAAyB;AAAA,EAC1D,IAAA,EAAM,cAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,UAAA,EAAY,OAAO,YAAA,EAAa;AAAA,EAChD,MAAA,EAAQ,CAAC,gBAAgB,CAAA;AAAA,EACzB,QAAA,EAAU;AAAA,IACR,SAAA,EAAW;AAAA,GACb;AAAA,EACA,CAAC,OAAA,CACC;AAAA,IACE;AAAA,GACF,EAGA,EAAE,IAAA,EAAK,EACP;AACA,IAAA,MAAM,kBAAA,GAAqB,IAAA;AAAA,MAAK,MAC9B,QAAO,CAAE,IAAA,CAAK,gBAAc,EAAE,OAAA,EAAS,WAAU,CAAE;AAAA,KACrD;AAEA,IAAA,MAAM,gBAAA,CAAiB,CAAA,KAAA,qBACrB,GAAA,CAAC,iBAAA,EAAA,EAAkB,IAAA,EACjB,8BAAC,kBAAA,EAAA,EAAoB,GAAG,KAAA,EAAO,CAAA,EACjC,CACD,CAAA;AAAA,EACH;AACF,CAAC;;;;"}
1
+ {"version":3,"file":"SignInPageBlueprint.esm.js","sources":["../../src/blueprints/SignInPageBlueprint.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, lazy, ReactNode } from 'react';\nimport { createExtensionBlueprint, createExtensionDataRef } from '../wiring';\nimport { ExtensionBoundary } from '../components';\nimport { IdentityApi } from '../apis';\n\n/**\n * Props for the `SignInPage` component.\n *\n * @public\n */\nexport type SignInPageProps = {\n /**\n * Set the IdentityApi on successful sign-in. This should only be called once.\n */\n onSignInSuccess(identityApi: IdentityApi): void;\n\n /**\n * The children to render.\n */\n children?: ReactNode;\n};\n\nconst componentDataRef = createExtensionDataRef<\n ComponentType<SignInPageProps>\n>().with({ id: 'core.sign-in-page.component' });\n\n/**\n * Creates an extension that replaces the sign in page.\n *\n * @public\n * @deprecated Use {@link @backstage/plugin-app-react#SignInPageBlueprint} instead.\n */\nexport const SignInPageBlueprint = createExtensionBlueprint({\n kind: 'sign-in-page',\n attachTo: { id: 'app/root', input: 'signInPage' },\n output: [componentDataRef],\n dataRefs: {\n component: componentDataRef,\n },\n *factory(\n {\n loader,\n }: {\n loader: () => Promise<ComponentType<SignInPageProps>>;\n },\n { node },\n ) {\n const ExtensionComponent = lazy(() =>\n loader().then(component => ({ default: component })),\n );\n\n yield componentDataRef(props => (\n <ExtensionBoundary node={node}>\n <ExtensionComponent {...props} />\n </ExtensionBoundary>\n ));\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAM,mBAAmB,sBAAA,EAEvB,CAAE,KAAK,EAAE,EAAA,EAAI,+BAA+B,CAAA;AAQvC,MAAM,sBAAsB,wBAAA,CAAyB;AAAA,EAC1D,IAAA,EAAM,cAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,UAAA,EAAY,OAAO,YAAA,EAAa;AAAA,EAChD,MAAA,EAAQ,CAAC,gBAAgB,CAAA;AAAA,EACzB,QAAA,EAAU;AAAA,IACR,SAAA,EAAW;AAAA,GACb;AAAA,EACA,CAAC,OAAA,CACC;AAAA,IACE;AAAA,GACF,EAGA,EAAE,IAAA,EAAK,EACP;AACA,IAAA,MAAM,kBAAA,GAAqB,IAAA;AAAA,MAAK,MAC9B,QAAO,CAAE,IAAA,CAAK,gBAAc,EAAE,OAAA,EAAS,WAAU,CAAE;AAAA,KACrD;AAEA,IAAA,MAAM,gBAAA,CAAiB,CAAA,KAAA,qBACrB,GAAA,CAAC,iBAAA,EAAA,EAAkB,IAAA,EACjB,8BAAC,kBAAA,EAAA,EAAoB,GAAG,KAAA,EAAO,CAAA,EACjC,CACD,CAAA;AAAA,EACH;AACF,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"SwappableComponentBlueprint.esm.js","sources":["../../src/blueprints/SwappableComponentBlueprint.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 */\nimport { SwappableComponentRef } from '../components';\nimport {\n createExtensionBlueprint,\n createExtensionBlueprintParams,\n createExtensionDataRef,\n} from '../wiring';\n\nexport const componentDataRef = createExtensionDataRef<{\n ref: SwappableComponentRef;\n loader:\n | (() => (props: {}) => JSX.Element | null)\n | (() => Promise<(props: {}) => JSX.Element | null>);\n}>().with({ id: 'core.swappableComponent' });\n\n/**\n * Blueprint for creating swappable components from a SwappableComponentRef and a loader\n *\n * @public\n */\nexport const SwappableComponentBlueprint = createExtensionBlueprint({\n kind: 'component',\n attachTo: { id: 'api:app/swappable-components', input: 'components' },\n output: [componentDataRef],\n dataRefs: {\n component: componentDataRef,\n },\n defineParams<Ref extends SwappableComponentRef<any>>(params: {\n component: Ref extends SwappableComponentRef<\n any,\n infer IExternalComponentProps\n >\n ? { ref: Ref } & ((props: IExternalComponentProps) => JSX.Element | null)\n : never;\n loader: Ref extends SwappableComponentRef<infer IInnerComponentProps, any>\n ?\n | (() => (props: IInnerComponentProps) => JSX.Element | null)\n | (() => Promise<(props: IInnerComponentProps) => JSX.Element | null>)\n : never;\n }) {\n return createExtensionBlueprintParams(params);\n },\n factory: params => [\n componentDataRef({\n ref: params.component.ref,\n loader: params.loader,\n }),\n ],\n});\n"],"names":[],"mappings":";;;;;;AAsBO,MAAM,mBAAmB,sBAAA,EAK7B,CAAE,KAAK,EAAE,EAAA,EAAI,2BAA2B;AAOpC,MAAM,8BAA8B,wBAAA,CAAyB;AAAA,EAClE,IAAA,EAAM,WAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,8BAAA,EAAgC,OAAO,YAAA,EAAa;AAAA,EACpE,MAAA,EAAQ,CAAC,gBAAgB,CAAA;AAAA,EACzB,QAAA,EAAU;AAAA,IACR,SAAA,EAAW;AAAA,GACb;AAAA,EACA,aAAqD,MAAA,EAYlD;AACD,IAAA,OAAO,+BAA+B,MAAM,CAAA;AAAA,EAC9C,CAAA;AAAA,EACA,SAAS,CAAA,MAAA,KAAU;AAAA,IACjB,gBAAA,CAAiB;AAAA,MACf,GAAA,EAAK,OAAO,SAAA,CAAU,GAAA;AAAA,MACtB,QAAQ,MAAA,CAAO;AAAA,KAChB;AAAA;AAEL,CAAC;;;;"}
1
+ {"version":3,"file":"SwappableComponentBlueprint.esm.js","sources":["../../src/blueprints/SwappableComponentBlueprint.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 */\nimport { SwappableComponentRef } from '../components';\nimport {\n createExtensionBlueprint,\n createExtensionBlueprintParams,\n createExtensionDataRef,\n} from '../wiring';\n\nexport const componentDataRef = createExtensionDataRef<{\n ref: SwappableComponentRef;\n loader:\n | (() => (props: {}) => JSX.Element | null)\n | (() => Promise<(props: {}) => JSX.Element | null>);\n}>().with({ id: 'core.swappableComponent' });\n\n/**\n * Blueprint for creating swappable components from a SwappableComponentRef and a loader\n *\n * @public\n * @deprecated Use {@link @backstage/plugin-app-react#SwappableComponentBlueprint} instead.\n */\nexport const SwappableComponentBlueprint = createExtensionBlueprint({\n kind: 'component',\n attachTo: { id: 'api:app/swappable-components', input: 'components' },\n output: [componentDataRef],\n dataRefs: {\n component: componentDataRef,\n },\n defineParams<Ref extends SwappableComponentRef<any>>(params: {\n component: Ref extends SwappableComponentRef<\n any,\n infer IExternalComponentProps\n >\n ? { ref: Ref } & ((props: IExternalComponentProps) => JSX.Element | null)\n : never;\n loader: Ref extends SwappableComponentRef<infer IInnerComponentProps, any>\n ?\n | (() => (props: IInnerComponentProps) => JSX.Element | null)\n | (() => Promise<(props: IInnerComponentProps) => JSX.Element | null>)\n : never;\n }) {\n return createExtensionBlueprintParams(params);\n },\n factory: params => [\n componentDataRef({\n ref: params.component.ref,\n loader: params.loader,\n }),\n ],\n});\n"],"names":[],"mappings":";;;;;;AAsBO,MAAM,mBAAmB,sBAAA,EAK7B,CAAE,KAAK,EAAE,EAAA,EAAI,2BAA2B;AAQpC,MAAM,8BAA8B,wBAAA,CAAyB;AAAA,EAClE,IAAA,EAAM,WAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,8BAAA,EAAgC,OAAO,YAAA,EAAa;AAAA,EACpE,MAAA,EAAQ,CAAC,gBAAgB,CAAA;AAAA,EACzB,QAAA,EAAU;AAAA,IACR,SAAA,EAAW;AAAA,GACb;AAAA,EACA,aAAqD,MAAA,EAYlD;AACD,IAAA,OAAO,+BAA+B,MAAM,CAAA;AAAA,EAC9C,CAAA;AAAA,EACA,SAAS,CAAA,MAAA,KAAU;AAAA,IACjB,gBAAA,CAAiB;AAAA,MACf,GAAA,EAAK,OAAO,SAAA,CAAU,GAAA;AAAA,MACtB,QAAQ,MAAA,CAAO;AAAA,KAChB;AAAA;AAEL,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeBlueprint.esm.js","sources":["../../src/blueprints/ThemeBlueprint.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 { AppTheme } from '../apis/definitions/AppThemeApi';\nimport { createExtensionBlueprint, createExtensionDataRef } from '../wiring';\n\nconst themeDataRef = createExtensionDataRef<AppTheme>().with({\n id: 'core.theme.theme',\n});\n\n/**\n * Creates an extension that adds/replaces an app theme.\n *\n * @public\n */\nexport const ThemeBlueprint = createExtensionBlueprint({\n kind: 'theme',\n attachTo: { id: 'api:app/app-theme', input: 'themes' },\n output: [themeDataRef],\n dataRefs: {\n theme: themeDataRef,\n },\n factory: ({ theme }: { theme: AppTheme }) => [themeDataRef(theme)],\n});\n"],"names":[],"mappings":";;;;;;AAmBA,MAAM,YAAA,GAAe,sBAAA,EAAiC,CAAE,IAAA,CAAK;AAAA,EAC3D,EAAA,EAAI;AACN,CAAC,CAAA;AAOM,MAAM,iBAAiB,wBAAA,CAAyB;AAAA,EACrD,IAAA,EAAM,OAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,mBAAA,EAAqB,OAAO,QAAA,EAAS;AAAA,EACrD,MAAA,EAAQ,CAAC,YAAY,CAAA;AAAA,EACrB,QAAA,EAAU;AAAA,IACR,KAAA,EAAO;AAAA,GACT;AAAA,EACA,OAAA,EAAS,CAAC,EAAE,KAAA,OAAiC,CAAC,YAAA,CAAa,KAAK,CAAC;AACnE,CAAC;;;;"}
1
+ {"version":3,"file":"ThemeBlueprint.esm.js","sources":["../../src/blueprints/ThemeBlueprint.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 { AppTheme } from '../apis/definitions/AppThemeApi';\nimport { createExtensionBlueprint, createExtensionDataRef } from '../wiring';\n\nconst themeDataRef = createExtensionDataRef<AppTheme>().with({\n id: 'core.theme.theme',\n});\n\n/**\n * Creates an extension that adds/replaces an app theme.\n *\n * @public\n * @deprecated Use {@link @backstage/plugin-app-react#ThemeBlueprint} instead.\n */\nexport const ThemeBlueprint = createExtensionBlueprint({\n kind: 'theme',\n attachTo: { id: 'api:app/app-theme', input: 'themes' },\n output: [themeDataRef],\n dataRefs: {\n theme: themeDataRef,\n },\n factory: ({ theme }: { theme: AppTheme }) => [themeDataRef(theme)],\n});\n"],"names":[],"mappings":";;;;;;AAmBA,MAAM,YAAA,GAAe,sBAAA,EAAiC,CAAE,IAAA,CAAK;AAAA,EAC3D,EAAA,EAAI;AACN,CAAC,CAAA;AAQM,MAAM,iBAAiB,wBAAA,CAAyB;AAAA,EACrD,IAAA,EAAM,OAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,mBAAA,EAAqB,OAAO,QAAA,EAAS;AAAA,EACrD,MAAA,EAAQ,CAAC,YAAY,CAAA;AAAA,EACrB,QAAA,EAAU;AAAA,IACR,KAAA,EAAO;AAAA,GACT;AAAA,EACA,OAAA,EAAS,CAAC,EAAE,KAAA,OAAiC,CAAC,YAAA,CAAa,KAAK,CAAC;AACnE,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TranslationBlueprint.esm.js","sources":["../../src/blueprints/TranslationBlueprint.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 { createExtensionBlueprint, createExtensionDataRef } from '../wiring';\nimport { TranslationMessages, TranslationResource } from '../translation';\n\nconst translationDataRef = createExtensionDataRef<\n TranslationResource | TranslationMessages\n>().with({ id: 'core.translation.translation' });\n\n/**\n * Creates an extension that adds translations to your app.\n *\n * @public\n */\nexport const TranslationBlueprint = createExtensionBlueprint({\n kind: 'translation',\n attachTo: { id: 'api:app/translations', input: 'translations' },\n output: [translationDataRef],\n dataRefs: {\n translation: translationDataRef,\n },\n factory: ({\n resource,\n }: {\n resource: TranslationResource | TranslationMessages;\n }) => [translationDataRef(resource)],\n});\n"],"names":[],"mappings":";;;;;;AAmBA,MAAM,qBAAqB,sBAAA,EAEzB,CAAE,KAAK,EAAE,EAAA,EAAI,gCAAgC,CAAA;AAOxC,MAAM,uBAAuB,wBAAA,CAAyB;AAAA,EAC3D,IAAA,EAAM,aAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,sBAAA,EAAwB,OAAO,cAAA,EAAe;AAAA,EAC9D,MAAA,EAAQ,CAAC,kBAAkB,CAAA;AAAA,EAC3B,QAAA,EAAU;AAAA,IACR,WAAA,EAAa;AAAA,GACf;AAAA,EACA,SAAS,CAAC;AAAA,IACR;AAAA,GACF,KAEM,CAAC,kBAAA,CAAmB,QAAQ,CAAC;AACrC,CAAC;;;;"}
1
+ {"version":3,"file":"TranslationBlueprint.esm.js","sources":["../../src/blueprints/TranslationBlueprint.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 { createExtensionBlueprint, createExtensionDataRef } from '../wiring';\nimport { TranslationMessages, TranslationResource } from '../translation';\n\nconst translationDataRef = createExtensionDataRef<\n TranslationResource | TranslationMessages\n>().with({ id: 'core.translation.translation' });\n\n/**\n * Creates an extension that adds translations to your app.\n *\n * @public\n * @deprecated Use {@link @backstage/plugin-app-react#TranslationBlueprint} instead.\n */\nexport const TranslationBlueprint = createExtensionBlueprint({\n kind: 'translation',\n attachTo: { id: 'api:app/translations', input: 'translations' },\n output: [translationDataRef],\n dataRefs: {\n translation: translationDataRef,\n },\n factory: ({\n resource,\n }: {\n resource: TranslationResource | TranslationMessages;\n }) => [translationDataRef(resource)],\n});\n"],"names":[],"mappings":";;;;;;AAmBA,MAAM,qBAAqB,sBAAA,EAEzB,CAAE,KAAK,EAAE,EAAA,EAAI,gCAAgC,CAAA;AAQxC,MAAM,uBAAuB,wBAAA,CAAyB;AAAA,EAC3D,IAAA,EAAM,aAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,sBAAA,EAAwB,OAAO,cAAA,EAAe;AAAA,EAC9D,MAAA,EAAQ,CAAC,kBAAkB,CAAA;AAAA,EAC3B,QAAA,EAAU;AAAA,IACR,WAAA,EAAa;AAAA,GACf;AAAA,EACA,SAAS,CAAC;AAAA,IACR;AAAA,GACF,KAEM,CAAC,kBAAA,CAAmB,QAAQ,CAAC;AACrC,CAAC;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { jsx, Fragment } from 'react/jsx-runtime';
2
- import { lazy, Suspense, useEffect } from 'react';
2
+ import { lazy, useMemo, Suspense, useEffect } from 'react';
3
3
  import { AnalyticsContext } from '../analytics/AnalyticsContext.esm.js';
4
4
  import { useAnalytics } from '../analytics/useAnalytics.esm.js';
5
5
  import { ErrorDisplayBoundary } from './ErrorDisplayBoundary.esm.js';
@@ -25,6 +25,7 @@ import '../apis/definitions/StorageApi.esm.js';
25
25
  import '../apis/definitions/AnalyticsApi.esm.js';
26
26
  import '../apis/definitions/TranslationApi.esm.js';
27
27
  import { useApi } from '../apis/system/useApi.esm.js';
28
+ import { pluginWrapperApiRef } from '../apis/definitions/PluginWrapperApi.esm.js';
28
29
  import { coreExtensionData } from '../wiring/coreExtensionData.esm.js';
29
30
  import 'zod';
30
31
  import 'zod-to-json-schema';
@@ -39,6 +40,13 @@ function useOptionalErrorApi() {
39
40
  return void 0;
40
41
  }
41
42
  }
43
+ function useOptionalPluginWrapperApi() {
44
+ try {
45
+ return useApi(pluginWrapperApiRef);
46
+ } catch {
47
+ return void 0;
48
+ }
49
+ }
42
50
  const RouteTracker = (props) => {
43
51
  const { enabled, children } = props;
44
52
  const analytics = useAnalytics();
@@ -56,11 +64,19 @@ function ExtensionBoundary(props) {
56
64
  node.instance?.getData(coreExtensionData.routePath)
57
65
  );
58
66
  const plugin = node.spec.plugin;
67
+ const pluginId = plugin.id ?? "app";
68
+ const pluginWrapperApi = useOptionalPluginWrapperApi();
69
+ const PluginWrapper = useMemo(() => {
70
+ return pluginWrapperApi?.getPluginWrapper(pluginId);
71
+ }, [pluginWrapperApi, pluginId]);
59
72
  const attributes = {
60
73
  extensionId: node.spec.id,
61
- pluginId: plugin.id ?? "app"
74
+ pluginId
62
75
  };
63
76
  let content = /* @__PURE__ */ jsx(AnalyticsContext, { attributes, children: /* @__PURE__ */ jsx(RouteTracker, { enabled: hasRoutePathOutput, children }) });
77
+ if (PluginWrapper) {
78
+ content = /* @__PURE__ */ jsx(PluginWrapper, { children: content });
79
+ }
64
80
  if (props.errorPresentation === "error-api") {
65
81
  content = /* @__PURE__ */ jsx(ErrorApiBoundary, { node, errorApi, children: content });
66
82
  } else {
@@ -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 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 { 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\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\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: plugin.id ?? 'app',\n };\n\n let content = (\n <AnalyticsContext attributes={attributes}>\n <RouteTracker enabled={hasRoutePathOutput}>{children}</RouteTracker>\n </AnalyticsContext>\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":"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"}
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.id ?? '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":"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"}
package/dist/index.d.ts CHANGED
@@ -1323,7 +1323,15 @@ type ApiRefConfig = {
1323
1323
  id: string;
1324
1324
  };
1325
1325
  /**
1326
- * Creates a reference to an API.
1326
+ * Creates a reference to an API. The provided `id` is a stable identifier for
1327
+ * the API implementation.
1328
+ *
1329
+ * @remarks
1330
+ *
1331
+ * The frontend system infers the owning plugin for an API from the `id`. The
1332
+ * recommended pattern is `plugin.<plugin-id>.*` (for example,
1333
+ * `plugin.catalog.entity-presentation`). This ensures that other plugins can't
1334
+ * mistakenly override your API implementation.
1327
1335
  *
1328
1336
  * @param config - The descriptor of the API to reference.
1329
1337
  * @returns An API reference.
@@ -3188,6 +3196,9 @@ declare const AppRootElementBlueprint: _backstage_frontend_plugin_api.ExtensionB
3188
3196
  * and similar.
3189
3197
  *
3190
3198
  * @public
3199
+ * @deprecated Use {@link @backstage/plugin-app-react#AppRootWrapperBlueprint} instead.
3200
+ * If you were using this blueprint to provide a context for your plugin,
3201
+ * use `PluginWrapperBlueprint` from `@backstage/frontend-plugin-api/alpha` instead.
3191
3202
  */
3192
3203
  declare const AppRootWrapperBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
3193
3204
  kind: "app-root-wrapper";
@@ -3211,7 +3222,10 @@ declare const AppRootWrapperBlueprint: _backstage_frontend_plugin_api.ExtensionB
3211
3222
  };
3212
3223
  }>;
3213
3224
 
3214
- /** @public */
3225
+ /**
3226
+ * @public
3227
+ * @deprecated Use {@link @backstage/plugin-app-react#IconBundleBlueprint} instead.
3228
+ */
3215
3229
  declare const IconBundleBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
3216
3230
  kind: "icon-bundle";
3217
3231
  params: {
@@ -3262,6 +3276,7 @@ type NavContentComponent = (props: NavContentComponentProps) => JSX.Element | nu
3262
3276
  * Creates an extension that replaces the entire nav bar with your own component.
3263
3277
  *
3264
3278
  * @public
3279
+ * @deprecated Use {@link @backstage/plugin-app-react#NavContentBlueprint} instead.
3265
3280
  */
3266
3281
  declare const NavContentBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
3267
3282
  kind: "nav-content";
@@ -3335,7 +3350,10 @@ declare const PageBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
3335
3350
  dataRefs: never;
3336
3351
  }>;
3337
3352
 
3338
- /** @public */
3353
+ /**
3354
+ * @public
3355
+ * @deprecated Use {@link @backstage/plugin-app-react#RouterBlueprint} instead.
3356
+ */
3339
3357
  declare const RouterBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
3340
3358
  kind: "app-router-component";
3341
3359
  params: {
@@ -3377,6 +3395,7 @@ type SignInPageProps = {
3377
3395
  * Creates an extension that replaces the sign in page.
3378
3396
  *
3379
3397
  * @public
3398
+ * @deprecated Use {@link @backstage/plugin-app-react#SignInPageBlueprint} instead.
3380
3399
  */
3381
3400
  declare const SignInPageBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
3382
3401
  kind: "sign-in-page";
@@ -3396,6 +3415,7 @@ declare const SignInPageBlueprint: _backstage_frontend_plugin_api.ExtensionBluep
3396
3415
  * Creates an extension that adds/replaces an app theme.
3397
3416
  *
3398
3417
  * @public
3418
+ * @deprecated Use {@link @backstage/plugin-app-react#ThemeBlueprint} instead.
3399
3419
  */
3400
3420
  declare const ThemeBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
3401
3421
  kind: "theme";
@@ -3415,6 +3435,7 @@ declare const ThemeBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<
3415
3435
  * Creates an extension that adds translations to your app.
3416
3436
  *
3417
3437
  * @public
3438
+ * @deprecated Use {@link @backstage/plugin-app-react#TranslationBlueprint} instead.
3418
3439
  */
3419
3440
  declare const TranslationBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
3420
3441
  kind: "translation";
@@ -3438,6 +3459,7 @@ declare const TranslationBlueprint: _backstage_frontend_plugin_api.ExtensionBlue
3438
3459
  * Blueprint for creating swappable components from a SwappableComponentRef and a loader
3439
3460
  *
3440
3461
  * @public
3462
+ * @deprecated Use {@link @backstage/plugin-app-react#SwappableComponentBlueprint} instead.
3441
3463
  */
3442
3464
  declare const SwappableComponentBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
3443
3465
  kind: "component";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/frontend-plugin-api",
3
- "version": "0.13.2",
3
+ "version": "0.13.4",
4
4
  "backstage": {
5
5
  "role": "web-library"
6
6
  },
@@ -20,12 +20,20 @@
20
20
  "types": "./dist/index.d.ts",
21
21
  "default": "./dist/index.esm.js"
22
22
  },
23
+ "./alpha": {
24
+ "import": "./dist/alpha.esm.js",
25
+ "types": "./dist/alpha.d.ts",
26
+ "default": "./dist/alpha.esm.js"
27
+ },
23
28
  "./package.json": "./package.json"
24
29
  },
25
30
  "main": "./dist/index.esm.js",
26
31
  "types": "./dist/index.d.ts",
27
32
  "typesVersions": {
28
33
  "*": {
34
+ "alpha": [
35
+ "dist/alpha.d.ts"
36
+ ],
29
37
  "package.json": [
30
38
  "package.json"
31
39
  ]
@@ -47,14 +55,14 @@
47
55
  "@backstage/errors": "^1.2.7",
48
56
  "@backstage/types": "^1.2.2",
49
57
  "@backstage/version-bridge": "^1.0.11",
50
- "zod": "^3.22.4",
51
- "zod-to-json-schema": "^3.21.4"
58
+ "zod": "^3.25.76",
59
+ "zod-to-json-schema": "^3.25.1"
52
60
  },
53
61
  "devDependencies": {
54
- "@backstage/cli": "^0.35.0",
62
+ "@backstage/cli": "^0.35.3",
55
63
  "@backstage/config": "^1.3.6",
56
- "@backstage/frontend-app-api": "^0.13.3",
57
- "@backstage/frontend-test-utils": "^0.4.2",
64
+ "@backstage/frontend-app-api": "^0.14.1",
65
+ "@backstage/frontend-test-utils": "^0.4.5",
58
66
  "@backstage/test-utils": "^1.7.14",
59
67
  "@testing-library/jest-dom": "^6.0.0",
60
68
  "@testing-library/react": "^16.0.0",