@backstage/frontend-plugin-api 0.8.0-next.2 → 0.9.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.
Files changed (27) hide show
  1. package/CHANGELOG.md +150 -0
  2. package/dist/apis/definitions/AppTreeApi.esm.js.map +1 -1
  3. package/dist/blueprints/IconBundleBlueprint.esm.js +0 -6
  4. package/dist/blueprints/IconBundleBlueprint.esm.js.map +1 -1
  5. package/dist/components/ErrorBoundary.esm.js.map +1 -1
  6. package/dist/frontend-internal/src/wiring/InternalExtensionDefinition.esm.js +7 -16
  7. package/dist/frontend-internal/src/wiring/InternalExtensionDefinition.esm.js.map +1 -1
  8. package/dist/frontend-internal/src/wiring/InternalFrontendPlugin.esm.js +9 -0
  9. package/dist/frontend-internal/src/wiring/InternalFrontendPlugin.esm.js.map +1 -0
  10. package/dist/index.d.ts +30 -197
  11. package/dist/index.esm.js +1 -2
  12. package/dist/index.esm.js.map +1 -1
  13. package/dist/opaque-internal/src/OpaqueType.esm.js +103 -0
  14. package/dist/opaque-internal/src/OpaqueType.esm.js.map +1 -0
  15. package/dist/wiring/createExtension.esm.js +27 -25
  16. package/dist/wiring/createExtension.esm.js.map +1 -1
  17. package/dist/wiring/createExtensionBlueprint.esm.js +20 -15
  18. package/dist/wiring/createExtensionBlueprint.esm.js.map +1 -1
  19. package/dist/wiring/createFrontendModule.esm.js +2 -2
  20. package/dist/wiring/createFrontendModule.esm.js.map +1 -1
  21. package/dist/wiring/createFrontendPlugin.esm.js +13 -9
  22. package/dist/wiring/createFrontendPlugin.esm.js.map +1 -1
  23. package/dist/wiring/resolveExtensionDefinition.esm.js +2 -2
  24. package/dist/wiring/resolveExtensionDefinition.esm.js.map +1 -1
  25. package/package.json +8 -8
  26. package/dist/wiring/createExtensionOverrides.esm.js +0 -22
  27. package/dist/wiring/createExtensionOverrides.esm.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,155 @@
1
1
  # @backstage/frontend-plugin-api
2
2
 
3
+ ## 0.9.0-next.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 4a5ba19: Removed deprecated `namespace` option from `createExtension` and `createExtensionBlueprint`, including `.make` and `.makeWithOverides`, it's no longer necessary and will use the `pluginId` instead.
8
+
9
+ Removed deprecated `createExtensionOverrides` this should be replaced with `createFrontendModule` instead.
10
+
11
+ Removed deprecated `BackstagePlugin` type, use `FrontendPlugin` type instead from this same package.
12
+
13
+ - bfd4bec: **BREAKING PRODUCERS**: The `IconComponent` no longer accepts `fontSize="default"`. This has effectively been removed from Material-UI since its last two major versions, and has not worked properly for them in a long time.
14
+
15
+ This change should not have an effect on neither users of MUI4 nor MUI5/6, since the updated interface should still let you send the respective `SvgIcon` types into interfaces where relevant (e.g. as app icons).
16
+
17
+ ### Patch Changes
18
+
19
+ - 873e424: Internal refactor of usage of opaque types.
20
+ - 323aae8: It is now possible to override the blueprint parameters when overriding an extension created from a blueprint:
21
+
22
+ ```ts
23
+ const myExtension = MyBlueprint.make({
24
+ params: {
25
+ myParam: 'myDefault',
26
+ },
27
+ });
28
+
29
+ const myOverride = myExtension.override({
30
+ params: {
31
+ myParam: 'myOverride',
32
+ },
33
+ });
34
+ const myFactoryOverride = myExtension.override({
35
+ factory(origFactory) {
36
+ return origFactory({
37
+ params: {
38
+ myParam: 'myOverride',
39
+ },
40
+ });
41
+ },
42
+ });
43
+ ```
44
+
45
+ The provided parameters will be merged with the original parameters of the extension.
46
+
47
+ - Updated dependencies
48
+ - @backstage/core-components@0.15.1-next.0
49
+ - @backstage/core-plugin-api@1.10.0-next.0
50
+ - @backstage/types@1.1.1
51
+ - @backstage/version-bridge@1.0.9
52
+
53
+ ## 0.8.0
54
+
55
+ ### Minor Changes
56
+
57
+ - 5446061: **BREAKING**: Removed support for "v1" extensions. This means that it is no longer possible to declare inputs and outputs as objects when using `createExtension`. In addition, all extension creators except for `createComponentExtension` have been removed, use the equivalent blueprint instead. See the [1.30 migration documentation](https://backstage.io/docs/frontend-system/architecture/migrations/#130) for more information on this change.
58
+ - fec8b57: **BREAKING**: Updated the type parameters for `ExtensionDefinition` and `ExtensionBlueprint` to only have a single object parameter. The base type parameter is exported as `ExtensionDefinitionParameters` and `ExtensionBlueprintParameters` respectively. This is shipped as an immediate breaking change as we expect usage of these types to be rare, and it does not affect the runtime behavior of the API.
59
+
60
+ This is a breaking change as it changes the type parameters. Existing usage can generally be updated as follows:
61
+
62
+ - `ExtensionDefinition<any>` -> `ExtensionDefinition`
63
+ - `ExtensionDefinition<any, any>` -> `ExtensionDefinition`
64
+ - `ExtensionDefinition<TConfig>` -> `ExtensionDefinition<{ config: TConfig }>`
65
+ - `ExtensionDefinition<TConfig, TConfigInput>` -> `ExtensionDefinition<{ config: TConfig, configInput: TConfigInput }>`
66
+
67
+ If you need to infer the parameter you can use `ExtensionDefinitionParameters`, for example:
68
+
69
+ ```ts
70
+ import {
71
+ ExtensionDefinition,
72
+ ExtensionDefinitionParameters,
73
+ } from '@backstage/frontend-plugin-api';
74
+
75
+ function myUtility<T extends ExtensionDefinitionParameters>(
76
+ ext: ExtensionDefinition<T>,
77
+ ): T['config'] {
78
+ // ...
79
+ }
80
+ ```
81
+
82
+ The same patterns apply to `ExtensionBlueprint`.
83
+
84
+ This change is made to improve the readability of API references and ability to evolve the type parameters in the future.
85
+
86
+ ### Patch Changes
87
+
88
+ - 2bb9517: Introduce the `@backstage/plugin-app` package to hold all of the built-in extensions for easy consumption and overriding.
89
+ - c816e2d: Added `createFrontendModule` as a replacement for `createExtensionOverrides`, which is now deprecated.
90
+
91
+ Deprecated the `BackstagePlugin` and `FrontendFeature` type in favor of `FrontendPlugin` and `FrontendFeature` from `@backstage/frontend-app-api` respectively.
92
+
93
+ - 52f9c5a: Deprecated the `namespace` option for `createExtensionBlueprint` and `createExtension`, these are no longer required and will default to the `pluginId` instead.
94
+
95
+ You can migrate some of your extensions that use `createExtensionOverrides` to using `createFrontendModule` instead and providing a `pluginId` there.
96
+
97
+ ```ts
98
+ // Before
99
+ createExtensionOverrides({
100
+ extensions: [
101
+ createExtension({
102
+ name: 'my-extension',
103
+ namespace: 'my-namespace',
104
+ kind: 'test',
105
+ ...
106
+ })
107
+ ],
108
+ });
109
+
110
+ // After
111
+ createFrontendModule({
112
+ pluginId: 'my-namespace',
113
+ extensions: [
114
+ createExtension({
115
+ name: 'my-extension',
116
+ kind: 'test',
117
+ ...
118
+ })
119
+ ],
120
+ });
121
+ ```
122
+
123
+ - f3a2b91: Moved several implementations of built-in APIs from being hardcoded in the app to instead be provided as API extensions. This moves all API-related inputs from the `app` extension to the respective API extensions. For example, extensions created with `ThemeBlueprint` are now attached to the `themes` input of `api:app-theme` rather than the `app` extension.
124
+ - 836127c: Updated dependency `@testing-library/react` to `^16.0.0`.
125
+ - 948d431: Removing deprecated `namespace` parameter in favour of `pluginId` instead
126
+ - 043d7cd: Internal refactor
127
+ - 220f4f7: Remove unnecessary config object on IconBundleBlueprint
128
+ - 2a61422: The `factory` option is no longer required when overriding an extension.
129
+ - 98850de: Added support for defining `replaces` in `createExtensionInput` which will allow extensions to redirect missing `attachTo` points to an input of the created extension.
130
+
131
+ ```ts
132
+ export const AppThemeApi = ApiBlueprint.makeWithOverrides({
133
+ name: 'app-theme',
134
+ inputs: {
135
+ themes: createExtensionInput([ThemeBlueprint.dataRefs.theme], {
136
+ // attachTo: { id: 'app', input: 'themes'} will be redirected to this input instead
137
+ replaces: [{ id: 'app', input: 'themes' }],
138
+ }),
139
+ },
140
+ factory: () {
141
+ ...
142
+ }
143
+ });
144
+ ```
145
+
146
+ - 4a66456: A new `apis` parameter has been added to `factory` for extensions. This is a way to access utility APIs without being coupled to the React context.
147
+ - Updated dependencies
148
+ - @backstage/core-components@0.15.0
149
+ - @backstage/core-plugin-api@1.9.4
150
+ - @backstage/version-bridge@1.0.9
151
+ - @backstage/types@1.1.1
152
+
3
153
  ## 0.8.0-next.2
4
154
 
5
155
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"AppTreeApi.esm.js","sources":["../../../src/apis/definitions/AppTreeApi.ts"],"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 { createApiRef } from '@backstage/core-plugin-api';\nimport { BackstagePlugin, Extension, ExtensionDataRef } from '../../wiring';\n\n/**\n * The specification for this {@link AppNode} in the {@link AppTree}.\n *\n * @public\n * @remarks\n *\n * The specifications for a collection of app nodes is all the information needed\n * to build the tree and instantiate the nodes.\n */\nexport interface AppNodeSpec {\n readonly id: string;\n readonly attachTo: { id: string; input: string };\n readonly extension: Extension<unknown, unknown>;\n readonly disabled: boolean;\n readonly config?: unknown;\n readonly source?: BackstagePlugin;\n}\n\n/**\n * The connections from this {@link AppNode} to other nodes.\n *\n * @public\n * @remarks\n *\n * The app node edges are resolved based on the app node specs, regardless of whether\n * adjacent nodes are disabled or not. If no parent attachment is present or\n */\nexport interface AppNodeEdges {\n readonly attachedTo?: { node: AppNode; input: string };\n readonly attachments: ReadonlyMap<string, AppNode[]>;\n}\n\n/**\n * The instance of this {@link AppNode} in the {@link AppTree}.\n *\n * @public\n * @remarks\n *\n * The app node instance is created when the `factory` function of an extension is called.\n * Instances will only be present for nodes in the app that are connected to the root\n * node and not disabled\n */\nexport interface AppNodeInstance {\n /** Returns a sequence of all extension data refs that were output by this instance */\n getDataRefs(): Iterable<ExtensionDataRef<unknown>>;\n /** Get the output data for a single extension data ref */\n getData<T>(ref: ExtensionDataRef<T>): T | undefined;\n}\n\n/**\n * A node in the {@link AppTree}.\n *\n * @public\n */\nexport interface AppNode {\n /** The specification for how this node should be instantiated */\n readonly spec: AppNodeSpec;\n /** The edges from this node to other nodes in the app tree */\n readonly edges: AppNodeEdges;\n /** The instance of this node, if it was instantiated */\n readonly instance?: AppNodeInstance;\n}\n\n/**\n * The app tree containing all {@link AppNode}s of the app.\n *\n * @public\n */\nexport interface AppTree {\n /** The root node of the app */\n readonly root: AppNode;\n /** A map of all nodes in the app by ID, including orphaned or disabled nodes */\n readonly nodes: ReadonlyMap<string /* id */, AppNode>;\n /** A sequence of all nodes with a parent that is not reachable from the app root node */\n readonly orphans: Iterable<AppNode>;\n}\n\n/**\n * The API for interacting with the {@link AppTree}.\n *\n * @public\n */\nexport interface AppTreeApi {\n /**\n * Get the {@link AppTree} for the app.\n */\n getTree(): { tree: AppTree };\n}\n\n/**\n * The `ApiRef` of {@link AppTreeApi}.\n *\n * @public\n */\nexport const appTreeApiRef = createApiRef<AppTreeApi>({ id: 'core.app-tree' });\n"],"names":[],"mappings":";;AAiHO,MAAM,aAAgB,GAAA,YAAA,CAAyB,EAAE,EAAA,EAAI,iBAAiB;;;;"}
1
+ {"version":3,"file":"AppTreeApi.esm.js","sources":["../../../src/apis/definitions/AppTreeApi.ts"],"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 { createApiRef } from '@backstage/core-plugin-api';\nimport { FrontendPlugin, Extension, ExtensionDataRef } from '../../wiring';\n\n/**\n * The specification for this {@link AppNode} in the {@link AppTree}.\n *\n * @public\n * @remarks\n *\n * The specifications for a collection of app nodes is all the information needed\n * to build the tree and instantiate the nodes.\n */\nexport interface AppNodeSpec {\n readonly id: string;\n readonly attachTo: { id: string; input: string };\n readonly extension: Extension<unknown, unknown>;\n readonly disabled: boolean;\n readonly config?: unknown;\n readonly source?: FrontendPlugin;\n}\n\n/**\n * The connections from this {@link AppNode} to other nodes.\n *\n * @public\n * @remarks\n *\n * The app node edges are resolved based on the app node specs, regardless of whether\n * adjacent nodes are disabled or not. If no parent attachment is present or\n */\nexport interface AppNodeEdges {\n readonly attachedTo?: { node: AppNode; input: string };\n readonly attachments: ReadonlyMap<string, AppNode[]>;\n}\n\n/**\n * The instance of this {@link AppNode} in the {@link AppTree}.\n *\n * @public\n * @remarks\n *\n * The app node instance is created when the `factory` function of an extension is called.\n * Instances will only be present for nodes in the app that are connected to the root\n * node and not disabled\n */\nexport interface AppNodeInstance {\n /** Returns a sequence of all extension data refs that were output by this instance */\n getDataRefs(): Iterable<ExtensionDataRef<unknown>>;\n /** Get the output data for a single extension data ref */\n getData<T>(ref: ExtensionDataRef<T>): T | undefined;\n}\n\n/**\n * A node in the {@link AppTree}.\n *\n * @public\n */\nexport interface AppNode {\n /** The specification for how this node should be instantiated */\n readonly spec: AppNodeSpec;\n /** The edges from this node to other nodes in the app tree */\n readonly edges: AppNodeEdges;\n /** The instance of this node, if it was instantiated */\n readonly instance?: AppNodeInstance;\n}\n\n/**\n * The app tree containing all {@link AppNode}s of the app.\n *\n * @public\n */\nexport interface AppTree {\n /** The root node of the app */\n readonly root: AppNode;\n /** A map of all nodes in the app by ID, including orphaned or disabled nodes */\n readonly nodes: ReadonlyMap<string /* id */, AppNode>;\n /** A sequence of all nodes with a parent that is not reachable from the app root node */\n readonly orphans: Iterable<AppNode>;\n}\n\n/**\n * The API for interacting with the {@link AppTree}.\n *\n * @public\n */\nexport interface AppTreeApi {\n /**\n * Get the {@link AppTree} for the app.\n */\n getTree(): { tree: AppTree };\n}\n\n/**\n * The `ApiRef` of {@link AppTreeApi}.\n *\n * @public\n */\nexport const appTreeApiRef = createApiRef<AppTreeApi>({ id: 'core.app-tree' });\n"],"names":[],"mappings":";;AAiHO,MAAM,aAAgB,GAAA,YAAA,CAAyB,EAAE,EAAA,EAAI,iBAAiB;;;;"}
@@ -9,12 +9,6 @@ const IconBundleBlueprint = createExtensionBlueprint({
9
9
  kind: "icon-bundle",
10
10
  attachTo: { id: "api:app/icons", input: "icons" },
11
11
  output: [iconsDataRef],
12
- config: {
13
- schema: {
14
- icons: (z) => z.string().default("blob"),
15
- test: (z) => z.string()
16
- }
17
- },
18
12
  factory: (params) => [
19
13
  iconsDataRef(params.icons)
20
14
  ],
@@ -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 config: {\n schema: {\n icons: z => z.string().default('blob'),\n test: z => z.string(),\n },\n },\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,sBAElB,EAAA,CAAE,KAAK,EAAE,EAAA,EAAI,cAAc,CAAA,CAAA;AAGvB,MAAM,sBAAsB,wBAAyB,CAAA;AAAA,EAC1D,IAAM,EAAA,aAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,eAAA,EAAiB,OAAO,OAAQ,EAAA;AAAA,EAChD,MAAA,EAAQ,CAAC,YAAY,CAAA;AAAA,EACrB,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA;AAAA,MACN,OAAO,CAAK,CAAA,KAAA,CAAA,CAAE,MAAO,EAAA,CAAE,QAAQ,MAAM,CAAA;AAAA,MACrC,IAAA,EAAM,CAAK,CAAA,KAAA,CAAA,CAAE,MAAO,EAAA;AAAA,KACtB;AAAA,GACF;AAAA,EACA,OAAA,EAAS,CAAC,MAA0D,KAAA;AAAA,IAClE,YAAA,CAAa,OAAO,KAAK,CAAA;AAAA,GAC3B;AAAA,EACA,QAAU,EAAA;AAAA,IACR,KAAO,EAAA,YAAA;AAAA,GACT;AACF,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/** @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,sBAElB,EAAA,CAAE,KAAK,EAAE,EAAA,EAAI,cAAc,CAAA,CAAA;AAGvB,MAAM,sBAAsB,wBAAyB,CAAA;AAAA,EAC1D,IAAM,EAAA,aAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,eAAA,EAAiB,OAAO,OAAQ,EAAA;AAAA,EAChD,MAAA,EAAQ,CAAC,YAAY,CAAA;AAAA,EACrB,OAAA,EAAS,CAAC,MAA0D,KAAA;AAAA,IAClE,YAAA,CAAa,OAAO,KAAK,CAAA;AAAA,GAC3B;AAAA,EACA,QAAU,EAAA;AAAA,IACR,KAAO,EAAA,YAAA;AAAA,GACT;AACF,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorBoundary.esm.js","sources":["../../src/components/ErrorBoundary.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 React, { Component, ComponentType, PropsWithChildren } from 'react';\nimport { BackstagePlugin } from '../wiring';\nimport { CoreErrorBoundaryFallbackProps } from '../types';\n\ntype ErrorBoundaryProps = PropsWithChildren<{\n plugin?: BackstagePlugin;\n Fallback: ComponentType<CoreErrorBoundaryFallbackProps>;\n}>;\ntype ErrorBoundaryState = { error?: Error };\n\n/** @internal */\nexport class ErrorBoundary extends Component<\n ErrorBoundaryProps,\n ErrorBoundaryState\n> {\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n state: ErrorBoundaryState = { error: undefined };\n\n handleErrorReset = () => {\n this.setState({ error: undefined });\n };\n\n render() {\n const { error } = this.state;\n const { plugin, children, Fallback } = this.props;\n\n if (error) {\n return (\n <Fallback\n plugin={plugin}\n error={error}\n resetError={this.handleErrorReset}\n />\n );\n }\n\n return children;\n }\n}\n"],"names":[],"mappings":";;AA2BO,MAAM,sBAAsB,SAGjC,CAAA;AAAA,EACA,OAAO,yBAAyB,KAAc,EAAA;AAC5C,IAAA,OAAO,EAAE,KAAM,EAAA,CAAA;AAAA,GACjB;AAAA,EAEA,KAAA,GAA4B,EAAE,KAAA,EAAO,KAAU,CAAA,EAAA,CAAA;AAAA,EAE/C,mBAAmB,MAAM;AACvB,IAAA,IAAA,CAAK,QAAS,CAAA,EAAE,KAAO,EAAA,KAAA,CAAA,EAAW,CAAA,CAAA;AAAA,GACpC,CAAA;AAAA,EAEA,MAAS,GAAA;AACP,IAAM,MAAA,EAAE,KAAM,EAAA,GAAI,IAAK,CAAA,KAAA,CAAA;AACvB,IAAA,MAAM,EAAE,MAAA,EAAQ,QAAU,EAAA,QAAA,KAAa,IAAK,CAAA,KAAA,CAAA;AAE5C,IAAA,IAAI,KAAO,EAAA;AACT,MACE,uBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,QAAA;AAAA,QAAA;AAAA,UACC,MAAA;AAAA,UACA,KAAA;AAAA,UACA,YAAY,IAAK,CAAA,gBAAA;AAAA,SAAA;AAAA,OACnB,CAAA;AAAA,KAEJ;AAEA,IAAO,OAAA,QAAA,CAAA;AAAA,GACT;AACF;;;;"}
1
+ {"version":3,"file":"ErrorBoundary.esm.js","sources":["../../src/components/ErrorBoundary.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 React, { Component, ComponentType, PropsWithChildren } from 'react';\nimport { FrontendPlugin } from '../wiring';\nimport { CoreErrorBoundaryFallbackProps } from '../types';\n\ntype ErrorBoundaryProps = PropsWithChildren<{\n plugin?: FrontendPlugin;\n Fallback: ComponentType<CoreErrorBoundaryFallbackProps>;\n}>;\ntype ErrorBoundaryState = { error?: Error };\n\n/** @internal */\nexport class ErrorBoundary extends Component<\n ErrorBoundaryProps,\n ErrorBoundaryState\n> {\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n state: ErrorBoundaryState = { error: undefined };\n\n handleErrorReset = () => {\n this.setState({ error: undefined });\n };\n\n render() {\n const { error } = this.state;\n const { plugin, children, Fallback } = this.props;\n\n if (error) {\n return (\n <Fallback\n plugin={plugin}\n error={error}\n resetError={this.handleErrorReset}\n />\n );\n }\n\n return children;\n }\n}\n"],"names":[],"mappings":";;AA2BO,MAAM,sBAAsB,SAGjC,CAAA;AAAA,EACA,OAAO,yBAAyB,KAAc,EAAA;AAC5C,IAAA,OAAO,EAAE,KAAM,EAAA,CAAA;AAAA,GACjB;AAAA,EAEA,KAAA,GAA4B,EAAE,KAAA,EAAO,KAAU,CAAA,EAAA,CAAA;AAAA,EAE/C,mBAAmB,MAAM;AACvB,IAAA,IAAA,CAAK,QAAS,CAAA,EAAE,KAAO,EAAA,KAAA,CAAA,EAAW,CAAA,CAAA;AAAA,GACpC,CAAA;AAAA,EAEA,MAAS,GAAA;AACP,IAAM,MAAA,EAAE,KAAM,EAAA,GAAI,IAAK,CAAA,KAAA,CAAA;AACvB,IAAA,MAAM,EAAE,MAAA,EAAQ,QAAU,EAAA,QAAA,KAAa,IAAK,CAAA,KAAA,CAAA;AAE5C,IAAA,IAAI,KAAO,EAAA;AACT,MACE,uBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,QAAA;AAAA,QAAA;AAAA,UACC,MAAA;AAAA,UACA,KAAA;AAAA,UACA,YAAY,IAAK,CAAA,gBAAA;AAAA,SAAA;AAAA,OACnB,CAAA;AAAA,KAEJ;AAEA,IAAO,OAAA,QAAA,CAAA;AAAA,GACT;AACF;;;;"}
@@ -1,18 +1,9 @@
1
- function toInternalExtensionDefinition(overrides) {
2
- const internal = overrides;
3
- if (internal.$$type !== "@backstage/ExtensionDefinition") {
4
- throw new Error(
5
- `Invalid extension definition instance, bad type '${internal.$$type}'`
6
- );
7
- }
8
- const version = internal.version;
9
- if (version !== "v1" && version !== "v2") {
10
- throw new Error(
11
- `Invalid extension definition instance, bad version '${version}'`
12
- );
13
- }
14
- return internal;
15
- }
1
+ import { OpaqueType } from '../../../opaque-internal/src/OpaqueType.esm.js';
16
2
 
17
- export { toInternalExtensionDefinition };
3
+ const OpaqueExtensionDefinition = OpaqueType.create({
4
+ type: "@backstage/ExtensionDefinition",
5
+ versions: ["v1", "v2"]
6
+ });
7
+
8
+ export { OpaqueExtensionDefinition };
18
9
  //# sourceMappingURL=InternalExtensionDefinition.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"InternalExtensionDefinition.esm.js","sources":["../../../../../frontend-internal/src/wiring/InternalExtensionDefinition.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 {\n AnyExtensionDataRef,\n ApiHolder,\n AppNode,\n ExtensionDataValue,\n ExtensionDefinition,\n ExtensionDefinitionParameters,\n ExtensionInput,\n PortableSchema,\n ResolvedExtensionInputs,\n} from '@backstage/frontend-plugin-api';\n\nexport type InternalExtensionDefinition<\n T extends ExtensionDefinitionParameters = ExtensionDefinitionParameters,\n> = ExtensionDefinition<T> & {\n readonly kind?: string;\n readonly namespace?: string;\n readonly name?: string;\n readonly attachTo: { id: string; input: string };\n readonly disabled: boolean;\n readonly configSchema?: PortableSchema<T['config'], T['configInput']>;\n} & (\n | {\n readonly version: 'v1';\n readonly inputs: {\n [inputName in string]: {\n $$type: '@backstage/ExtensionInput';\n extensionData: {\n [name in string]: AnyExtensionDataRef;\n };\n config: { optional: boolean; singleton: boolean };\n };\n };\n readonly output: {\n [name in string]: AnyExtensionDataRef;\n };\n factory(context: {\n node: AppNode;\n apis: ApiHolder;\n config: object;\n inputs: {\n [inputName in string]: unknown;\n };\n }): {\n [inputName in string]: unknown;\n };\n }\n | {\n readonly version: 'v2';\n readonly inputs: {\n [inputName in string]: ExtensionInput<\n AnyExtensionDataRef,\n { optional: boolean; singleton: boolean }\n >;\n };\n readonly output: Array<AnyExtensionDataRef>;\n factory(context: {\n node: AppNode;\n apis: ApiHolder;\n config: object;\n inputs: ResolvedExtensionInputs<{\n [inputName in string]: ExtensionInput<\n AnyExtensionDataRef,\n { optional: boolean; singleton: boolean }\n >;\n }>;\n }): Iterable<ExtensionDataValue<any, any>>;\n }\n );\n\n/** @internal */\nexport function toInternalExtensionDefinition<\n T extends ExtensionDefinitionParameters,\n>(overrides: ExtensionDefinition<T>): InternalExtensionDefinition<T> {\n const internal = overrides as InternalExtensionDefinition<T>;\n if (internal.$$type !== '@backstage/ExtensionDefinition') {\n throw new Error(\n `Invalid extension definition instance, bad type '${internal.$$type}'`,\n );\n }\n const version = internal.version;\n if (version !== 'v1' && version !== 'v2') {\n throw new Error(\n `Invalid extension definition instance, bad version '${version}'`,\n );\n }\n return internal;\n}\n"],"names":[],"mappings":"AAuFO,SAAS,8BAEd,SAAmE,EAAA;AACnE,EAAA,MAAM,QAAW,GAAA,SAAA,CAAA;AACjB,EAAI,IAAA,QAAA,CAAS,WAAW,gCAAkC,EAAA;AACxD,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,iDAAA,EAAoD,SAAS,MAAM,CAAA,CAAA,CAAA;AAAA,KACrE,CAAA;AAAA,GACF;AACA,EAAA,MAAM,UAAU,QAAS,CAAA,OAAA,CAAA;AACzB,EAAI,IAAA,OAAA,KAAY,IAAQ,IAAA,OAAA,KAAY,IAAM,EAAA;AACxC,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,uDAAuD,OAAO,CAAA,CAAA,CAAA;AAAA,KAChE,CAAA;AAAA,GACF;AACA,EAAO,OAAA,QAAA,CAAA;AACT;;;;"}
1
+ {"version":3,"file":"InternalExtensionDefinition.esm.js","sources":["../../../../../frontend-internal/src/wiring/InternalExtensionDefinition.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 {\n AnyExtensionDataRef,\n ApiHolder,\n AppNode,\n ExtensionDataValue,\n ExtensionDefinition,\n ExtensionDefinitionParameters,\n ExtensionInput,\n PortableSchema,\n ResolvedExtensionInputs,\n} from '@backstage/frontend-plugin-api';\nimport { OpaqueType } from '@internal/opaque';\n\nexport const OpaqueExtensionDefinition = OpaqueType.create<{\n public: ExtensionDefinition<ExtensionDefinitionParameters>;\n versions:\n | {\n readonly version: 'v1';\n readonly kind?: string;\n readonly namespace?: string;\n readonly name?: string;\n readonly attachTo: { id: string; input: string };\n readonly disabled: boolean;\n readonly configSchema?: PortableSchema<any, any>;\n readonly inputs: {\n [inputName in string]: {\n $$type: '@backstage/ExtensionInput';\n extensionData: {\n [name in string]: AnyExtensionDataRef;\n };\n config: { optional: boolean; singleton: boolean };\n };\n };\n readonly output: {\n [name in string]: AnyExtensionDataRef;\n };\n factory(context: {\n node: AppNode;\n apis: ApiHolder;\n config: object;\n inputs: {\n [inputName in string]: unknown;\n };\n }): {\n [inputName in string]: unknown;\n };\n }\n | {\n readonly version: 'v2';\n readonly kind?: string;\n readonly namespace?: string;\n readonly name?: string;\n readonly attachTo: { id: string; input: string };\n readonly disabled: boolean;\n readonly configSchema?: PortableSchema<any, any>;\n readonly inputs: {\n [inputName in string]: ExtensionInput<\n AnyExtensionDataRef,\n { optional: boolean; singleton: boolean }\n >;\n };\n readonly output: Array<AnyExtensionDataRef>;\n factory(context: {\n node: AppNode;\n apis: ApiHolder;\n config: object;\n inputs: ResolvedExtensionInputs<{\n [inputName in string]: ExtensionInput<\n AnyExtensionDataRef,\n { optional: boolean; singleton: boolean }\n >;\n }>;\n }): Iterable<ExtensionDataValue<any, any>>;\n };\n}>({\n type: '@backstage/ExtensionDefinition',\n versions: ['v1', 'v2'],\n});\n"],"names":[],"mappings":";;AA6Ba,MAAA,yBAAA,GAA4B,WAAW,MA6DjD,CAAA;AAAA,EACD,IAAM,EAAA,gCAAA;AAAA,EACN,QAAA,EAAU,CAAC,IAAA,EAAM,IAAI,CAAA;AACvB,CAAC;;;;"}
@@ -0,0 +1,9 @@
1
+ import { OpaqueType } from '../../../opaque-internal/src/OpaqueType.esm.js';
2
+
3
+ const OpaqueFrontendPlugin = OpaqueType.create({
4
+ type: "@backstage/FrontendPlugin",
5
+ versions: ["v1"]
6
+ });
7
+
8
+ export { OpaqueFrontendPlugin };
9
+ //# sourceMappingURL=InternalFrontendPlugin.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InternalFrontendPlugin.esm.js","sources":["../../../../../frontend-internal/src/wiring/InternalFrontendPlugin.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 {\n Extension,\n FeatureFlagConfig,\n FrontendPlugin,\n} from '@backstage/frontend-plugin-api';\nimport { OpaqueType } from '@internal/opaque';\n\nexport const OpaqueFrontendPlugin = OpaqueType.create<{\n public: FrontendPlugin;\n versions: {\n readonly version: 'v1';\n readonly extensions: Extension<unknown>[];\n readonly featureFlags: FeatureFlagConfig[];\n };\n}>({\n type: '@backstage/FrontendPlugin',\n versions: ['v1'],\n});\n"],"names":[],"mappings":";;AAuBa,MAAA,oBAAA,GAAuB,WAAW,MAO5C,CAAA;AAAA,EACD,IAAM,EAAA,2BAAA;AAAA,EACN,QAAA,EAAU,CAAC,IAAI,CAAA;AACjB,CAAC;;;;"}