@backstage/frontend-plugin-api 0.8.0-next.2 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,105 @@
1
1
  # @backstage/frontend-plugin-api
2
2
 
3
+ ## 0.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 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.
8
+ - 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.
9
+
10
+ This is a breaking change as it changes the type parameters. Existing usage can generally be updated as follows:
11
+
12
+ - `ExtensionDefinition<any>` -> `ExtensionDefinition`
13
+ - `ExtensionDefinition<any, any>` -> `ExtensionDefinition`
14
+ - `ExtensionDefinition<TConfig>` -> `ExtensionDefinition<{ config: TConfig }>`
15
+ - `ExtensionDefinition<TConfig, TConfigInput>` -> `ExtensionDefinition<{ config: TConfig, configInput: TConfigInput }>`
16
+
17
+ If you need to infer the parameter you can use `ExtensionDefinitionParameters`, for example:
18
+
19
+ ```ts
20
+ import {
21
+ ExtensionDefinition,
22
+ ExtensionDefinitionParameters,
23
+ } from '@backstage/frontend-plugin-api';
24
+
25
+ function myUtility<T extends ExtensionDefinitionParameters>(
26
+ ext: ExtensionDefinition<T>,
27
+ ): T['config'] {
28
+ // ...
29
+ }
30
+ ```
31
+
32
+ The same patterns apply to `ExtensionBlueprint`.
33
+
34
+ This change is made to improve the readability of API references and ability to evolve the type parameters in the future.
35
+
36
+ ### Patch Changes
37
+
38
+ - 2bb9517: Introduce the `@backstage/plugin-app` package to hold all of the built-in extensions for easy consumption and overriding.
39
+ - c816e2d: Added `createFrontendModule` as a replacement for `createExtensionOverrides`, which is now deprecated.
40
+
41
+ Deprecated the `BackstagePlugin` and `FrontendFeature` type in favor of `FrontendPlugin` and `FrontendFeature` from `@backstage/frontend-app-api` respectively.
42
+
43
+ - 52f9c5a: Deprecated the `namespace` option for `createExtensionBlueprint` and `createExtension`, these are no longer required and will default to the `pluginId` instead.
44
+
45
+ You can migrate some of your extensions that use `createExtensionOverrides` to using `createFrontendModule` instead and providing a `pluginId` there.
46
+
47
+ ```ts
48
+ // Before
49
+ createExtensionOverrides({
50
+ extensions: [
51
+ createExtension({
52
+ name: 'my-extension',
53
+ namespace: 'my-namespace',
54
+ kind: 'test',
55
+ ...
56
+ })
57
+ ],
58
+ });
59
+
60
+ // After
61
+ createFrontendModule({
62
+ pluginId: 'my-namespace',
63
+ extensions: [
64
+ createExtension({
65
+ name: 'my-extension',
66
+ kind: 'test',
67
+ ...
68
+ })
69
+ ],
70
+ });
71
+ ```
72
+
73
+ - 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.
74
+ - 836127c: Updated dependency `@testing-library/react` to `^16.0.0`.
75
+ - 948d431: Removing deprecated `namespace` parameter in favour of `pluginId` instead
76
+ - 043d7cd: Internal refactor
77
+ - 220f4f7: Remove unnecessary config object on IconBundleBlueprint
78
+ - 2a61422: The `factory` option is no longer required when overriding an extension.
79
+ - 98850de: Added support for defining `replaces` in `createExtensionInput` which will allow extensions to redirect missing `attachTo` points to an input of the created extension.
80
+
81
+ ```ts
82
+ export const AppThemeApi = ApiBlueprint.makeWithOverrides({
83
+ name: 'app-theme',
84
+ inputs: {
85
+ themes: createExtensionInput([ThemeBlueprint.dataRefs.theme], {
86
+ // attachTo: { id: 'app', input: 'themes'} will be redirected to this input instead
87
+ replaces: [{ id: 'app', input: 'themes' }],
88
+ }),
89
+ },
90
+ factory: () {
91
+ ...
92
+ }
93
+ });
94
+ ```
95
+
96
+ - 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.
97
+ - Updated dependencies
98
+ - @backstage/core-components@0.15.0
99
+ - @backstage/core-plugin-api@1.9.4
100
+ - @backstage/version-bridge@1.0.9
101
+ - @backstage/types@1.1.1
102
+
3
103
  ## 0.8.0-next.2
4
104
 
5
105
  ### Patch Changes
@@ -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;;;;"}
package/dist/index.d.ts CHANGED
@@ -1313,14 +1313,8 @@ declare const IconBundleBlueprint: ExtensionBlueprint<{
1313
1313
  [x: string]: IconComponent;
1314
1314
  }, "core.icons", {}>;
1315
1315
  inputs: {};
1316
- config: {
1317
- icons: string;
1318
- test: string;
1319
- };
1320
- configInput: {
1321
- test: string;
1322
- icons?: string | undefined;
1323
- };
1316
+ config: {};
1317
+ configInput: {};
1324
1318
  dataRefs: {
1325
1319
  icons: ConfigurableExtensionDataRef<{
1326
1320
  [x: string]: IconComponent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/frontend-plugin-api",
3
- "version": "0.8.0-next.2",
3
+ "version": "0.8.0",
4
4
  "backstage": {
5
5
  "role": "web-library"
6
6
  },
@@ -31,10 +31,10 @@
31
31
  "test": "backstage-cli package test"
32
32
  },
33
33
  "dependencies": {
34
- "@backstage/core-components": "^0.14.11-next.1",
35
- "@backstage/core-plugin-api": "^1.9.4-next.0",
34
+ "@backstage/core-components": "^0.15.0",
35
+ "@backstage/core-plugin-api": "^1.9.4",
36
36
  "@backstage/types": "^1.1.1",
37
- "@backstage/version-bridge": "^1.0.9-next.0",
37
+ "@backstage/version-bridge": "^1.0.9",
38
38
  "@material-ui/core": "^4.12.4",
39
39
  "@types/react": "^16.13.1 || ^17.0.0 || ^18.0.0",
40
40
  "lodash": "^4.17.21",
@@ -42,10 +42,10 @@
42
42
  "zod-to-json-schema": "^3.21.4"
43
43
  },
44
44
  "devDependencies": {
45
- "@backstage/cli": "^0.27.1-next.2",
46
- "@backstage/frontend-app-api": "^0.9.0-next.2",
47
- "@backstage/frontend-test-utils": "^0.2.0-next.2",
48
- "@backstage/test-utils": "^1.6.0-next.1",
45
+ "@backstage/cli": "^0.27.1",
46
+ "@backstage/frontend-app-api": "^0.9.0",
47
+ "@backstage/frontend-test-utils": "^0.2.0",
48
+ "@backstage/test-utils": "^1.6.0",
49
49
  "@testing-library/jest-dom": "^6.0.0",
50
50
  "@testing-library/react": "^16.0.0",
51
51
  "history": "^5.3.0"