@backstage/plugin-app 0.2.0-next.0 → 0.2.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +1 -7
  3. package/dist/alpha/appModulePublicSignIn.esm.js +52 -0
  4. package/dist/alpha/appModulePublicSignIn.esm.js.map +1 -0
  5. package/dist/alpha.d.ts +54 -0
  6. package/dist/alpha.esm.js +2 -0
  7. package/dist/alpha.esm.js.map +1 -0
  8. package/dist/apis/DefaultDialogApi.esm.js.map +1 -1
  9. package/dist/apis/SwappableComponentsApi/DefaultSwappableComponentsApi.esm.js +40 -0
  10. package/dist/apis/SwappableComponentsApi/DefaultSwappableComponentsApi.esm.js.map +1 -0
  11. package/dist/defaultApis.esm.js +23 -30
  12. package/dist/defaultApis.esm.js.map +1 -1
  13. package/dist/extensions/AnalyticsApi.esm.js +56 -0
  14. package/dist/extensions/AnalyticsApi.esm.js.map +1 -0
  15. package/dist/extensions/AppLanguageApi.esm.js +1 -1
  16. package/dist/extensions/AppLanguageApi.esm.js.map +1 -1
  17. package/dist/extensions/AppRoot.esm.js.map +1 -1
  18. package/dist/extensions/AppRoutes.esm.js +1 -4
  19. package/dist/extensions/AppRoutes.esm.js.map +1 -1
  20. package/dist/extensions/AppThemeApi.esm.js +1 -1
  21. package/dist/extensions/AppThemeApi.esm.js.map +1 -1
  22. package/dist/extensions/DialogDisplay.esm.js.map +1 -1
  23. package/dist/extensions/FeatureFlagsApi.esm.js +1 -1
  24. package/dist/extensions/FeatureFlagsApi.esm.js.map +1 -1
  25. package/dist/extensions/IconsApi.esm.js +1 -1
  26. package/dist/extensions/IconsApi.esm.js.map +1 -1
  27. package/dist/extensions/LegacyComponentsApi.esm.js +26 -0
  28. package/dist/extensions/LegacyComponentsApi.esm.js.map +1 -0
  29. package/dist/extensions/SwappableComponentsApi.esm.js +40 -0
  30. package/dist/extensions/SwappableComponentsApi.esm.js.map +1 -0
  31. package/dist/extensions/TranslationsApi.esm.js +1 -1
  32. package/dist/extensions/TranslationsApi.esm.js.map +1 -1
  33. package/dist/extensions/components.esm.js +21 -43
  34. package/dist/extensions/components.esm.js.map +1 -1
  35. package/dist/extensions/elements.esm.js +1 -1
  36. package/dist/extensions/elements.esm.js.map +1 -1
  37. package/dist/index.d.ts +143 -63
  38. package/dist/packages/frontend-internal/src/wiring/InternalExtensionDefinition.esm.js +7 -0
  39. package/dist/packages/frontend-internal/src/wiring/InternalExtensionDefinition.esm.js.map +1 -0
  40. package/dist/packages/frontend-internal/src/wiring/InternalFrontendPlugin.esm.js +7 -0
  41. package/dist/packages/frontend-internal/src/wiring/InternalFrontendPlugin.esm.js.map +1 -0
  42. package/dist/packages/frontend-internal/src/wiring/InternalSwappableComponentRef.esm.js +9 -0
  43. package/dist/packages/frontend-internal/src/wiring/InternalSwappableComponentRef.esm.js.map +1 -0
  44. package/dist/packages/opaque-internal/src/OpaqueType.esm.js +103 -0
  45. package/dist/packages/opaque-internal/src/OpaqueType.esm.js.map +1 -0
  46. package/dist/plugin.esm.js +9 -7
  47. package/dist/plugin.esm.js.map +1 -1
  48. package/dist/plugins/app/package.json.esm.js +26 -6
  49. package/dist/plugins/app/package.json.esm.js.map +1 -1
  50. package/package.json +38 -18
  51. package/dist/extensions/ComponentsApi.esm.js +0 -28
  52. package/dist/extensions/ComponentsApi.esm.js.map +0 -1
  53. package/dist/packages/app-defaults/src/defaults/components.esm.js +0 -46
  54. package/dist/packages/app-defaults/src/defaults/components.esm.js.map +0 -1
  55. package/dist/packages/core-app-api/src/apis/implementations/AnalyticsApi/NoOpAnalyticsApi.esm.js +0 -7
  56. package/dist/packages/core-app-api/src/apis/implementations/AnalyticsApi/NoOpAnalyticsApi.esm.js.map +0 -1
  57. package/dist/packages/frontend-app-api/src/apis/implementations/ComponentsApi/DefaultComponentsApi.esm.js +0 -21
  58. package/dist/packages/frontend-app-api/src/apis/implementations/ComponentsApi/DefaultComponentsApi.esm.js.map +0 -1
@@ -0,0 +1,103 @@
1
+ class OpaqueType {
2
+ /**
3
+ * Creates a new opaque type.
4
+ *
5
+ * @param options.type The type identifier of the opaque type
6
+ * @param options.versions The available versions of the opaque type
7
+ * @returns A new opaque type helper
8
+ */
9
+ static create(options) {
10
+ return new OpaqueType(options.type, new Set(options.versions));
11
+ }
12
+ #type;
13
+ #versions;
14
+ constructor(type, versions) {
15
+ this.#type = type;
16
+ this.#versions = versions;
17
+ }
18
+ /**
19
+ * The internal version of the opaque type, used like this: `typeof MyOpaqueType.TPublic`
20
+ *
21
+ * @remarks
22
+ *
23
+ * This property is only useful for type checking, its runtime value is `undefined`.
24
+ */
25
+ TPublic = void 0;
26
+ /**
27
+ * The internal version of the opaque type, used like this: `typeof MyOpaqueType.TInternal`
28
+ *
29
+ * @remarks
30
+ *
31
+ * This property is only useful for type checking, its runtime value is `undefined`.
32
+ */
33
+ TInternal = void 0;
34
+ /**
35
+ * @param value Input value expected to be an instance of this opaque type
36
+ * @returns True if the value matches this opaque type
37
+ */
38
+ isType = (value) => {
39
+ return this.#isThisInternalType(value);
40
+ };
41
+ /**
42
+ * @param value Input value expected to be an instance of this opaque type
43
+ * @throws If the value is not an instance of this opaque type or is of an unsupported version
44
+ * @returns The internal version of the opaque type
45
+ */
46
+ toInternal = (value) => {
47
+ if (!this.#isThisInternalType(value)) {
48
+ throw new TypeError(
49
+ `Invalid opaque type, expected '${this.#type}', but got '${this.#stringifyUnknown(value)}'`
50
+ );
51
+ }
52
+ if (!this.#versions.has(value.version)) {
53
+ const versions = Array.from(this.#versions).map(this.#stringifyVersion);
54
+ if (versions.length > 1) {
55
+ versions[versions.length - 1] = `or ${versions[versions.length - 1]}`;
56
+ }
57
+ const expected = versions.length > 2 ? versions.join(", ") : versions.join(" ");
58
+ throw new TypeError(
59
+ `Invalid opaque type instance, got version ${this.#stringifyVersion(
60
+ value.version
61
+ )}, expected ${expected}`
62
+ );
63
+ }
64
+ return value;
65
+ };
66
+ /**
67
+ * Creates an instance of the opaque type, returning the public type.
68
+ *
69
+ * @param version The version of the instance to create
70
+ * @param value The remaining public and internal properties of the instance
71
+ * @returns An instance of the opaque type
72
+ */
73
+ createInstance(version, props) {
74
+ return Object.assign(props, {
75
+ $$type: this.#type,
76
+ ...version && { version }
77
+ });
78
+ }
79
+ #isThisInternalType(value) {
80
+ if (value === null || typeof value !== "object") {
81
+ return false;
82
+ }
83
+ return value.$$type === this.#type;
84
+ }
85
+ #stringifyUnknown(value) {
86
+ if (typeof value !== "object") {
87
+ return `<${typeof value}>`;
88
+ }
89
+ if (value === null) {
90
+ return "<null>";
91
+ }
92
+ if ("$$type" in value) {
93
+ return String(value.$$type);
94
+ }
95
+ return String(value);
96
+ }
97
+ #stringifyVersion = (version) => {
98
+ return version ? `'${version}'` : "undefined";
99
+ };
100
+ }
101
+
102
+ export { OpaqueType };
103
+ //# sourceMappingURL=OpaqueType.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpaqueType.esm.js","sources":["../../../../../../packages/opaque-internal/src/OpaqueType.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\n// TODO(Rugvip): This lives here temporarily, but should be moved to a more\n// central location. It's useful for backend packages too so we'll need to have\n// it in a common package, but it might also be that we want to make it\n// available publicly too in which case it would make sense to have this be part\n// of @backstage/version-bridge. The problem with exporting it from there is\n// that it would need to be very stable at that point, so it might be a bit\n// early to put it there already.\n\n/**\n * A helper for working with opaque types.\n */\nexport class OpaqueType<\n T extends {\n public: { $$type: string };\n versions: { version: string | undefined };\n },\n> {\n /**\n * Creates a new opaque type.\n *\n * @param options.type The type identifier of the opaque type\n * @param options.versions The available versions of the opaque type\n * @returns A new opaque type helper\n */\n static create<\n T extends {\n public: { $$type: string };\n versions: { version: string | undefined };\n },\n >(options: {\n type: T['public']['$$type'];\n versions: Array<T['versions']['version']>;\n }) {\n return new OpaqueType<T>(options.type, new Set(options.versions));\n }\n\n #type: string;\n #versions: Set<string | undefined>;\n\n private constructor(type: string, versions: Set<string | undefined>) {\n this.#type = type;\n this.#versions = versions;\n }\n\n /**\n * The internal version of the opaque type, used like this: `typeof MyOpaqueType.TPublic`\n *\n * @remarks\n *\n * This property is only useful for type checking, its runtime value is `undefined`.\n */\n TPublic: T['public'] = undefined as any;\n\n /**\n * The internal version of the opaque type, used like this: `typeof MyOpaqueType.TInternal`\n *\n * @remarks\n *\n * This property is only useful for type checking, its runtime value is `undefined`.\n */\n TInternal: T['public'] & T['versions'] = undefined as any;\n\n /**\n * @param value Input value expected to be an instance of this opaque type\n * @returns True if the value matches this opaque type\n */\n isType = (value: unknown): value is T['public'] => {\n return this.#isThisInternalType(value);\n };\n\n /**\n * @param value Input value expected to be an instance of this opaque type\n * @throws If the value is not an instance of this opaque type or is of an unsupported version\n * @returns The internal version of the opaque type\n */\n toInternal = (value: unknown): T['public'] & T['versions'] => {\n if (!this.#isThisInternalType(value)) {\n throw new TypeError(\n `Invalid opaque type, expected '${\n this.#type\n }', but got '${this.#stringifyUnknown(value)}'`,\n );\n }\n\n if (!this.#versions.has(value.version)) {\n const versions = Array.from(this.#versions).map(this.#stringifyVersion);\n if (versions.length > 1) {\n versions[versions.length - 1] = `or ${versions[versions.length - 1]}`;\n }\n const expected =\n versions.length > 2 ? versions.join(', ') : versions.join(' ');\n throw new TypeError(\n `Invalid opaque type instance, got version ${this.#stringifyVersion(\n value.version,\n )}, expected ${expected}`,\n );\n }\n\n return value;\n };\n\n /**\n * Creates an instance of the opaque type, returning the public type.\n *\n * @param version The version of the instance to create\n * @param value The remaining public and internal properties of the instance\n * @returns An instance of the opaque type\n */\n createInstance<\n TVersion extends T['versions']['version'],\n TPublic extends T['public'],\n >(\n version: TVersion,\n props: Omit<T['public'], '$$type'> &\n (T['versions'] extends infer UVersion\n ? UVersion extends { version: TVersion }\n ? Omit<UVersion, 'version'>\n : never\n : never) &\n Object, // & Object to allow for object properties too, e.g. toString()\n ): TPublic {\n return Object.assign(props as object, {\n $$type: this.#type,\n ...(version && { version }),\n }) as unknown as TPublic;\n }\n\n #isThisInternalType(value: unknown): value is T['public'] & T['versions'] {\n if (value === null || typeof value !== 'object') {\n return false;\n }\n return (value as T['public']).$$type === this.#type;\n }\n\n #stringifyUnknown(value: unknown) {\n if (typeof value !== 'object') {\n return `<${typeof value}>`;\n }\n if (value === null) {\n return '<null>';\n }\n if ('$$type' in value) {\n return String(value.$$type);\n }\n return String(value);\n }\n\n #stringifyVersion = (version: string | undefined) => {\n return version ? `'${version}'` : 'undefined';\n };\n}\n"],"names":[],"mappings":"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"}
@@ -6,14 +6,15 @@ import { AppNav } from './extensions/AppNav.esm.js';
6
6
  import { AppRoot } from './extensions/AppRoot.esm.js';
7
7
  import { AppRoutes } from './extensions/AppRoutes.esm.js';
8
8
  import { AppThemeApi, DarkTheme, LightTheme } from './extensions/AppThemeApi.esm.js';
9
- import { ComponentsApi } from './extensions/ComponentsApi.esm.js';
9
+ import { SwappableComponentsApi } from './extensions/SwappableComponentsApi.esm.js';
10
+ import { LegacyComponentsApi } from './extensions/LegacyComponentsApi.esm.js';
10
11
  import { IconsApi } from './extensions/IconsApi.esm.js';
11
12
  import { FeatureFlagsApi } from './extensions/FeatureFlagsApi.esm.js';
12
13
  import { TranslationsApi } from './extensions/TranslationsApi.esm.js';
13
14
  import { DefaultSignInPage } from './extensions/DefaultSignInPage.esm.js';
14
15
  import { dialogDisplayAppRootElement } from './extensions/DialogDisplay.esm.js';
15
- import { DefaultProgressComponent, DefaultNotFoundErrorPageComponent, DefaultErrorBoundaryComponent } from './extensions/components.esm.js';
16
16
  import { oauthRequestDialogAppRootElement, alertDisplayAppRootElement } from './extensions/elements.esm.js';
17
+ import { Progress, NotFoundErrorPage, ErrorDisplay } from './extensions/components.esm.js';
17
18
  import { apis } from './defaultApis.esm.js';
18
19
 
19
20
  const appPlugin = createFrontendPlugin({
@@ -30,17 +31,18 @@ const appPlugin = createFrontendPlugin({
30
31
  AppThemeApi,
31
32
  DarkTheme,
32
33
  LightTheme,
33
- ComponentsApi,
34
+ SwappableComponentsApi,
34
35
  IconsApi,
35
36
  FeatureFlagsApi,
36
37
  TranslationsApi,
37
- DefaultProgressComponent,
38
- DefaultNotFoundErrorPageComponent,
39
- DefaultErrorBoundaryComponent,
40
38
  DefaultSignInPage,
41
39
  oauthRequestDialogAppRootElement,
42
40
  alertDisplayAppRootElement,
43
- dialogDisplayAppRootElement
41
+ dialogDisplayAppRootElement,
42
+ Progress,
43
+ NotFoundErrorPage,
44
+ ErrorDisplay,
45
+ LegacyComponentsApi
44
46
  ]
45
47
  });
46
48
 
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.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 { createFrontendPlugin } from '@backstage/frontend-plugin-api';\nimport {\n App,\n AppLanguageApi,\n AppLayout,\n AppNav,\n AppRoot,\n AppRoutes,\n AppThemeApi,\n DarkTheme,\n LightTheme,\n ComponentsApi,\n IconsApi,\n FeatureFlagsApi,\n TranslationsApi,\n DefaultProgressComponent,\n DefaultNotFoundErrorPageComponent,\n DefaultErrorBoundaryComponent,\n oauthRequestDialogAppRootElement,\n alertDisplayAppRootElement,\n DefaultSignInPage,\n dialogDisplayAppRootElement,\n} from './extensions';\nimport { apis } from './defaultApis';\n\n/** @public */\nexport const appPlugin = createFrontendPlugin({\n pluginId: 'app',\n info: { packageJson: () => import('../package.json') },\n extensions: [\n ...apis,\n App,\n AppLanguageApi,\n AppLayout,\n AppNav,\n AppRoot,\n AppRoutes,\n AppThemeApi,\n DarkTheme,\n LightTheme,\n ComponentsApi,\n IconsApi,\n FeatureFlagsApi,\n TranslationsApi,\n DefaultProgressComponent,\n DefaultNotFoundErrorPageComponent,\n DefaultErrorBoundaryComponent,\n DefaultSignInPage,\n oauthRequestDialogAppRootElement,\n alertDisplayAppRootElement,\n dialogDisplayAppRootElement,\n ],\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AA0CO,MAAM,YAAY,oBAAqB,CAAA;AAAA,EAC5C,QAAU,EAAA,KAAA;AAAA,EACV,MAAM,EAAE,WAAA,EAAa,MAAM,OAAO,mCAAiB,CAAE,EAAA;AAAA,EACrD,UAAY,EAAA;AAAA,IACV,GAAG,IAAA;AAAA,IACH,GAAA;AAAA,IACA,cAAA;AAAA,IACA,SAAA;AAAA,IACA,MAAA;AAAA,IACA,OAAA;AAAA,IACA,SAAA;AAAA,IACA,WAAA;AAAA,IACA,SAAA;AAAA,IACA,UAAA;AAAA,IACA,aAAA;AAAA,IACA,QAAA;AAAA,IACA,eAAA;AAAA,IACA,eAAA;AAAA,IACA,wBAAA;AAAA,IACA,iCAAA;AAAA,IACA,6BAAA;AAAA,IACA,iBAAA;AAAA,IACA,gCAAA;AAAA,IACA,0BAAA;AAAA,IACA;AAAA;AAEJ,CAAC;;;;"}
1
+ {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.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 { createFrontendPlugin } from '@backstage/frontend-plugin-api';\nimport {\n App,\n AppLanguageApi,\n AppLayout,\n AppNav,\n AppRoot,\n AppRoutes,\n AppThemeApi,\n DarkTheme,\n LightTheme,\n SwappableComponentsApi,\n IconsApi,\n FeatureFlagsApi,\n TranslationsApi,\n oauthRequestDialogAppRootElement,\n alertDisplayAppRootElement,\n DefaultSignInPage,\n dialogDisplayAppRootElement,\n Progress,\n NotFoundErrorPage,\n ErrorDisplay,\n LegacyComponentsApi,\n} from './extensions';\nimport { apis } from './defaultApis';\n\n/** @public */\nexport const appPlugin = createFrontendPlugin({\n pluginId: 'app',\n info: { packageJson: () => import('../package.json') },\n extensions: [\n ...apis,\n App,\n AppLanguageApi,\n AppLayout,\n AppNav,\n AppRoot,\n AppRoutes,\n AppThemeApi,\n DarkTheme,\n LightTheme,\n SwappableComponentsApi,\n IconsApi,\n FeatureFlagsApi,\n TranslationsApi,\n DefaultSignInPage,\n oauthRequestDialogAppRootElement,\n alertDisplayAppRootElement,\n dialogDisplayAppRootElement,\n Progress,\n NotFoundErrorPage,\n ErrorDisplay,\n LegacyComponentsApi,\n ],\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AA2CO,MAAM,YAAY,oBAAqB,CAAA;AAAA,EAC5C,QAAU,EAAA,KAAA;AAAA,EACV,MAAM,EAAE,WAAA,EAAa,MAAM,OAAO,mCAAiB,CAAE,EAAA;AAAA,EACrD,UAAY,EAAA;AAAA,IACV,GAAG,IAAA;AAAA,IACH,GAAA;AAAA,IACA,cAAA;AAAA,IACA,SAAA;AAAA,IACA,MAAA;AAAA,IACA,OAAA;AAAA,IACA,SAAA;AAAA,IACA,WAAA;AAAA,IACA,SAAA;AAAA,IACA,UAAA;AAAA,IACA,sBAAA;AAAA,IACA,QAAA;AAAA,IACA,eAAA;AAAA,IACA,eAAA;AAAA,IACA,iBAAA;AAAA,IACA,gCAAA;AAAA,IACA,0BAAA;AAAA,IACA,2BAAA;AAAA,IACA,QAAA;AAAA,IACA,iBAAA;AAAA,IACA,YAAA;AAAA,IACA;AAAA;AAEJ,CAAC;;;;"}
@@ -1,5 +1,5 @@
1
1
  var name = "@backstage/plugin-app";
2
- var version = "0.2.0-next.0";
2
+ var version = "0.2.0-next.2";
3
3
  var backstage = {
4
4
  role: "frontend-plugin",
5
5
  pluginId: "app",
@@ -10,9 +10,7 @@ var backstage = {
10
10
  ]
11
11
  };
12
12
  var publishConfig = {
13
- access: "public",
14
- main: "dist/index.esm.js",
15
- types: "dist/index.d.ts"
13
+ access: "public"
16
14
  };
17
15
  var repository = {
18
16
  type: "git",
@@ -21,8 +19,23 @@ var repository = {
21
19
  };
22
20
  var license = "Apache-2.0";
23
21
  var sideEffects = false;
22
+ var exports = {
23
+ ".": "./src/index.ts",
24
+ "./alpha": "./src/alpha/index.ts",
25
+ "./package.json": "./package.json"
26
+ };
24
27
  var main = "src/index.ts";
25
28
  var types = "src/index.ts";
29
+ var typesVersions = {
30
+ "*": {
31
+ alpha: [
32
+ "src/alpha/index.ts"
33
+ ],
34
+ "package.json": [
35
+ "package.json"
36
+ ]
37
+ }
38
+ };
26
39
  var files = [
27
40
  "dist"
28
41
  ];
@@ -43,15 +56,20 @@ var dependencies = {
43
56
  "@backstage/plugin-permission-react": "workspace:^",
44
57
  "@backstage/theme": "workspace:^",
45
58
  "@backstage/types": "workspace:^",
59
+ "@backstage/version-bridge": "workspace:^",
46
60
  "@material-ui/core": "^4.9.13",
47
61
  "@material-ui/icons": "^4.9.1",
48
62
  "@material-ui/lab": "^4.0.0-alpha.61",
49
- "react-use": "^17.2.4"
63
+ "@react-hookz/web": "^24.0.0",
64
+ "react-use": "^17.2.4",
65
+ zod: "^3.22.4"
50
66
  };
51
67
  var devDependencies = {
52
68
  "@backstage/cli": "workspace:^",
53
69
  "@backstage/dev-utils": "workspace:^",
70
+ "@backstage/frontend-defaults": "workspace:^",
54
71
  "@backstage/frontend-test-utils": "workspace:^",
72
+ "@backstage/test-utils": "workspace:^",
55
73
  "@testing-library/jest-dom": "^6.0.0",
56
74
  "@testing-library/react": "^16.0.0",
57
75
  "@testing-library/user-event": "^14.0.0",
@@ -80,8 +98,10 @@ var _package = {
80
98
  repository: repository,
81
99
  license: license,
82
100
  sideEffects: sideEffects,
101
+ exports: exports,
83
102
  main: main,
84
103
  types: types,
104
+ typesVersions: typesVersions,
85
105
  files: files,
86
106
  scripts: scripts,
87
107
  dependencies: dependencies,
@@ -90,5 +110,5 @@ var _package = {
90
110
  peerDependenciesMeta: peerDependenciesMeta
91
111
  };
92
112
 
93
- export { backstage, _package as default, dependencies, devDependencies, files, license, main, name, peerDependencies, peerDependenciesMeta, publishConfig, repository, scripts, sideEffects, types, version };
113
+ export { backstage, _package as default, dependencies, devDependencies, exports, files, license, main, name, peerDependencies, peerDependenciesMeta, publishConfig, repository, scripts, sideEffects, types, typesVersions, version };
94
114
  //# sourceMappingURL=package.json.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"package.json.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"package.json.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-app",
3
- "version": "0.2.0-next.0",
3
+ "version": "0.2.0-next.2",
4
4
  "backstage": {
5
5
  "role": "frontend-plugin",
6
6
  "pluginId": "app",
@@ -14,9 +14,7 @@
14
14
  }
15
15
  },
16
16
  "publishConfig": {
17
- "access": "public",
18
- "main": "dist/index.esm.js",
19
- "types": "dist/index.d.ts"
17
+ "access": "public"
20
18
  },
21
19
  "repository": {
22
20
  "type": "git",
@@ -25,8 +23,32 @@
25
23
  },
26
24
  "license": "Apache-2.0",
27
25
  "sideEffects": false,
28
- "main": "dist/index.esm.js",
29
- "types": "dist/index.d.ts",
26
+ "exports": {
27
+ ".": {
28
+ "backstage": "@backstage/FrontendPlugin",
29
+ "import": "./dist/index.esm.js",
30
+ "types": "./dist/index.d.ts",
31
+ "default": "./dist/index.esm.js"
32
+ },
33
+ "./alpha": {
34
+ "import": "./dist/alpha.esm.js",
35
+ "types": "./dist/alpha.d.ts",
36
+ "default": "./dist/alpha.esm.js"
37
+ },
38
+ "./package.json": "./package.json"
39
+ },
40
+ "main": "./dist/index.esm.js",
41
+ "types": "./dist/index.d.ts",
42
+ "typesVersions": {
43
+ "*": {
44
+ "alpha": [
45
+ "dist/alpha.d.ts"
46
+ ],
47
+ "package.json": [
48
+ "package.json"
49
+ ]
50
+ }
51
+ },
30
52
  "files": [
31
53
  "dist"
32
54
  ],
@@ -40,22 +62,27 @@
40
62
  "test": "backstage-cli package test"
41
63
  },
42
64
  "dependencies": {
43
- "@backstage/core-components": "0.17.5-next.0",
65
+ "@backstage/core-components": "0.17.5-next.2",
44
66
  "@backstage/core-plugin-api": "1.10.9",
45
- "@backstage/frontend-plugin-api": "0.11.0-next.0",
67
+ "@backstage/frontend-plugin-api": "0.11.0-next.2",
46
68
  "@backstage/integration-react": "1.2.9",
47
69
  "@backstage/plugin-permission-react": "0.4.36",
48
70
  "@backstage/theme": "0.6.8-next.0",
49
71
  "@backstage/types": "1.2.1",
72
+ "@backstage/version-bridge": "1.0.11",
50
73
  "@material-ui/core": "^4.9.13",
51
74
  "@material-ui/icons": "^4.9.1",
52
75
  "@material-ui/lab": "^4.0.0-alpha.61",
53
- "react-use": "^17.2.4"
76
+ "@react-hookz/web": "^24.0.0",
77
+ "react-use": "^17.2.4",
78
+ "zod": "^3.22.4"
54
79
  },
55
80
  "devDependencies": {
56
- "@backstage/cli": "0.33.2-next.0",
81
+ "@backstage/cli": "0.34.0-next.2",
57
82
  "@backstage/dev-utils": "1.1.13-next.1",
58
- "@backstage/frontend-test-utils": "0.3.5-next.1",
83
+ "@backstage/frontend-defaults": "0.3.0-next.3",
84
+ "@backstage/frontend-test-utils": "0.3.5-next.2",
85
+ "@backstage/test-utils": "1.7.11-next.0",
59
86
  "@testing-library/jest-dom": "^6.0.0",
60
87
  "@testing-library/react": "^16.0.0",
61
88
  "@testing-library/user-event": "^14.0.0",
@@ -76,12 +103,5 @@
76
103
  "optional": true
77
104
  }
78
105
  },
79
- "typesVersions": {
80
- "*": {
81
- "package.json": [
82
- "package.json"
83
- ]
84
- }
85
- },
86
106
  "module": "./dist/index.esm.js"
87
107
  }
@@ -1,28 +0,0 @@
1
- import { ApiBlueprint, createExtensionInput, createComponentExtension, componentsApiRef } from '@backstage/frontend-plugin-api';
2
- import { DefaultComponentsApi } from '../packages/frontend-app-api/src/apis/implementations/ComponentsApi/DefaultComponentsApi.esm.js';
3
-
4
- const ComponentsApi = ApiBlueprint.makeWithOverrides({
5
- name: "components",
6
- inputs: {
7
- components: createExtensionInput(
8
- [createComponentExtension.componentDataRef],
9
- { replaces: [{ id: "app", input: "components" }] }
10
- )
11
- },
12
- factory: (originalFactory, { inputs }) => {
13
- return originalFactory(
14
- (define) => define({
15
- api: componentsApiRef,
16
- deps: {},
17
- factory: () => DefaultComponentsApi.fromComponents(
18
- inputs.components.map(
19
- (i) => i.get(createComponentExtension.componentDataRef)
20
- )
21
- )
22
- })
23
- );
24
- }
25
- });
26
-
27
- export { ComponentsApi };
28
- //# sourceMappingURL=ComponentsApi.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ComponentsApi.esm.js","sources":["../../src/extensions/ComponentsApi.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 {\n createComponentExtension,\n createExtensionInput,\n ApiBlueprint,\n componentsApiRef,\n} from '@backstage/frontend-plugin-api';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { DefaultComponentsApi } from '../../../../packages/frontend-app-api/src/apis/implementations/ComponentsApi';\n\n/**\n * Contains the shareable components installed into the app.\n */\nexport const ComponentsApi = ApiBlueprint.makeWithOverrides({\n name: 'components',\n inputs: {\n components: createExtensionInput(\n [createComponentExtension.componentDataRef],\n { replaces: [{ id: 'app', input: 'components' }] },\n ),\n },\n factory: (originalFactory, { inputs }) => {\n return originalFactory(define =>\n define({\n api: componentsApiRef,\n deps: {},\n factory: () =>\n DefaultComponentsApi.fromComponents(\n inputs.components.map(i =>\n i.get(createComponentExtension.componentDataRef),\n ),\n ),\n }),\n );\n },\n});\n"],"names":[],"mappings":";;;AA4Ba,MAAA,aAAA,GAAgB,aAAa,iBAAkB,CAAA;AAAA,EAC1D,IAAM,EAAA,YAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,UAAY,EAAA,oBAAA;AAAA,MACV,CAAC,yBAAyB,gBAAgB,CAAA;AAAA,MAC1C,EAAE,UAAU,CAAC,EAAE,IAAI,KAAO,EAAA,KAAA,EAAO,YAAa,EAAC,CAAE;AAAA;AACnD,GACF;AAAA,EACA,OAAS,EAAA,CAAC,eAAiB,EAAA,EAAE,QAAa,KAAA;AACxC,IAAO,OAAA,eAAA;AAAA,MAAgB,YACrB,MAAO,CAAA;AAAA,QACL,GAAK,EAAA,gBAAA;AAAA,QACL,MAAM,EAAC;AAAA,QACP,OAAA,EAAS,MACP,oBAAqB,CAAA,cAAA;AAAA,UACnB,OAAO,UAAW,CAAA,GAAA;AAAA,YAAI,CACpB,CAAA,KAAA,CAAA,CAAE,GAAI,CAAA,wBAAA,CAAyB,gBAAgB;AAAA;AACjD;AACF,OACH;AAAA,KACH;AAAA;AAEJ,CAAC;;;;"}
@@ -1,46 +0,0 @@
1
- import { jsx, Fragment } from 'react/jsx-runtime';
2
- import Button from '@material-ui/core/Button';
3
- import { Progress, ErrorPage, ErrorPanel } from '@backstage/core-components';
4
- import { BrowserRouter, useInRouterContext, MemoryRouter } from 'react-router-dom';
5
-
6
- function OptionallyWrapInRouter({ children }) {
7
- if (useInRouterContext()) {
8
- return /* @__PURE__ */ jsx(Fragment, { children });
9
- }
10
- return /* @__PURE__ */ jsx(MemoryRouter, { children });
11
- }
12
- const DefaultNotFoundPage = () => /* @__PURE__ */ jsx(ErrorPage, { status: "404", statusMessage: "PAGE NOT FOUND" });
13
- const DefaultBootErrorPage = ({ step, error }) => {
14
- let message = "";
15
- if (step === "load-config") {
16
- message = `The configuration failed to load, someone should have a look at this error: ${error.message}`;
17
- } else if (step === "load-chunk") {
18
- message = `Lazy loaded chunk failed to load, try to reload the page: ${error.message}`;
19
- }
20
- return /* @__PURE__ */ jsx(OptionallyWrapInRouter, { children: /* @__PURE__ */ jsx(ErrorPage, { statusMessage: message, stack: error.stack }) });
21
- };
22
- const DefaultErrorBoundaryFallback = ({
23
- error,
24
- resetError,
25
- plugin
26
- }) => {
27
- return /* @__PURE__ */ jsx(
28
- ErrorPanel,
29
- {
30
- title: `Error in ${plugin?.getId()}`,
31
- defaultExpanded: true,
32
- error,
33
- children: /* @__PURE__ */ jsx(Button, { variant: "outlined", onClick: resetError, children: "Retry" })
34
- }
35
- );
36
- };
37
- const components = {
38
- Progress,
39
- Router: BrowserRouter,
40
- NotFoundErrorPage: DefaultNotFoundPage,
41
- BootErrorPage: DefaultBootErrorPage,
42
- ErrorBoundaryFallback: DefaultErrorBoundaryFallback
43
- };
44
-
45
- export { OptionallyWrapInRouter, components };
46
- //# sourceMappingURL=components.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"components.esm.js","sources":["../../../../../../../packages/app-defaults/src/defaults/components.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 Button from '@material-ui/core/Button';\nimport { ErrorPanel, Progress, ErrorPage } from '@backstage/core-components';\nimport {\n MemoryRouter,\n useInRouterContext,\n BrowserRouter,\n} from 'react-router-dom';\nimport {\n AppComponents,\n BootErrorPageProps,\n ErrorBoundaryFallbackProps,\n} from '@backstage/core-plugin-api';\n\nexport function OptionallyWrapInRouter({ children }: { children: ReactNode }) {\n if (useInRouterContext()) {\n return <>{children}</>;\n }\n return <MemoryRouter>{children}</MemoryRouter>;\n}\n\nconst DefaultNotFoundPage = () => (\n <ErrorPage status=\"404\" statusMessage=\"PAGE NOT FOUND\" />\n);\n\nconst DefaultBootErrorPage = ({ step, error }: BootErrorPageProps) => {\n let message = '';\n if (step === 'load-config') {\n message = `The configuration failed to load, someone should have a look at this error: ${error.message}`;\n } else if (step === 'load-chunk') {\n message = `Lazy loaded chunk failed to load, try to reload the page: ${error.message}`;\n }\n // TODO: figure out a nicer way to handle routing on the error page, when it can be done.\n return (\n <OptionallyWrapInRouter>\n <ErrorPage statusMessage={message} stack={error.stack} />\n </OptionallyWrapInRouter>\n );\n};\n\nconst DefaultErrorBoundaryFallback = ({\n error,\n resetError,\n plugin,\n}: ErrorBoundaryFallbackProps) => {\n return (\n <ErrorPanel\n title={`Error in ${plugin?.getId()}`}\n defaultExpanded\n error={error}\n >\n <Button variant=\"outlined\" onClick={resetError}>\n Retry\n </Button>\n </ErrorPanel>\n );\n};\n\n/**\n * Creates a set of default components to pass along to {@link @backstage/core-app-api#createSpecializedApp}.\n *\n * @public\n */\nexport const components: AppComponents = {\n Progress,\n Router: BrowserRouter,\n NotFoundErrorPage: DefaultNotFoundPage,\n BootErrorPage: DefaultBootErrorPage,\n ErrorBoundaryFallback: DefaultErrorBoundaryFallback,\n};\n"],"names":[],"mappings":";;;;;AA8BgB,SAAA,sBAAA,CAAuB,EAAE,QAAA,EAAqC,EAAA;AAC5E,EAAA,IAAI,oBAAsB,EAAA;AACxB,IAAA,uCAAU,QAAS,EAAA,CAAA;AAAA;AAErB,EAAO,uBAAA,GAAA,CAAC,gBAAc,QAAS,EAAA,CAAA;AACjC;AAEA,MAAM,sBAAsB,sBAC1B,GAAA,CAAC,aAAU,MAAO,EAAA,KAAA,EAAM,eAAc,gBAAiB,EAAA,CAAA;AAGzD,MAAM,oBAAuB,GAAA,CAAC,EAAE,IAAA,EAAM,OAAgC,KAAA;AACpE,EAAA,IAAI,OAAU,GAAA,EAAA;AACd,EAAA,IAAI,SAAS,aAAe,EAAA;AAC1B,IAAU,OAAA,GAAA,CAAA,4EAAA,EAA+E,MAAM,OAAO,CAAA,CAAA;AAAA,GACxG,MAAA,IAAW,SAAS,YAAc,EAAA;AAChC,IAAU,OAAA,GAAA,CAAA,0DAAA,EAA6D,MAAM,OAAO,CAAA,CAAA;AAAA;AAGtF,EACE,uBAAA,GAAA,CAAC,0BACC,QAAC,kBAAA,GAAA,CAAA,SAAA,EAAA,EAAU,eAAe,OAAS,EAAA,KAAA,EAAO,KAAM,CAAA,KAAA,EAAO,CACzD,EAAA,CAAA;AAEJ,CAAA;AAEA,MAAM,+BAA+B,CAAC;AAAA,EACpC,KAAA;AAAA,EACA,UAAA;AAAA,EACA;AACF,CAAkC,KAAA;AAChC,EACE,uBAAA,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,KAAO,EAAA,CAAA,SAAA,EAAY,MAAQ,EAAA,KAAA,EAAO,CAAA,CAAA;AAAA,MAClC,eAAe,EAAA,IAAA;AAAA,MACf,KAAA;AAAA,MAEA,8BAAC,MAAO,EAAA,EAAA,OAAA,EAAQ,UAAW,EAAA,OAAA,EAAS,YAAY,QAEhD,EAAA,OAAA,EAAA;AAAA;AAAA,GACF;AAEJ,CAAA;AAOO,MAAM,UAA4B,GAAA;AAAA,EACvC,QAAA;AAAA,EACA,MAAQ,EAAA,aAAA;AAAA,EACR,iBAAmB,EAAA,mBAAA;AAAA,EACnB,aAAe,EAAA,oBAAA;AAAA,EACf,qBAAuB,EAAA;AACzB;;;;"}
@@ -1,7 +0,0 @@
1
- class NoOpAnalyticsApi {
2
- captureEvent(_event) {
3
- }
4
- }
5
-
6
- export { NoOpAnalyticsApi };
7
- //# sourceMappingURL=NoOpAnalyticsApi.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NoOpAnalyticsApi.esm.js","sources":["../../../../../../../../../packages/core-app-api/src/apis/implementations/AnalyticsApi/NoOpAnalyticsApi.ts"],"sourcesContent":["/*\n * Copyright 2021 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 { AnalyticsApi, AnalyticsEvent } from '@backstage/core-plugin-api';\n\n/**\n * Base implementation for the AnalyticsApi that does nothing.\n *\n * @public\n */\nexport class NoOpAnalyticsApi implements AnalyticsApi {\n captureEvent(_event: AnalyticsEvent): void {}\n}\n"],"names":[],"mappings":"AAsBO,MAAM,gBAAyC,CAAA;AAAA,EACpD,aAAa,MAA8B,EAAA;AAAA;AAC7C;;;;"}
@@ -1,21 +0,0 @@
1
- class DefaultComponentsApi {
2
- #components;
3
- static fromComponents(components) {
4
- return new DefaultComponentsApi(
5
- new Map(components.map((entry) => [entry.ref.id, entry.impl]))
6
- );
7
- }
8
- constructor(components) {
9
- this.#components = components;
10
- }
11
- getComponent(ref) {
12
- const impl = this.#components.get(ref.id);
13
- if (!impl) {
14
- throw new Error(`No implementation found for component ref ${ref}`);
15
- }
16
- return impl;
17
- }
18
- }
19
-
20
- export { DefaultComponentsApi };
21
- //# sourceMappingURL=DefaultComponentsApi.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DefaultComponentsApi.esm.js","sources":["../../../../../../../../../packages/frontend-app-api/src/apis/implementations/ComponentsApi/DefaultComponentsApi.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 { ComponentType } from 'react';\nimport {\n ComponentRef,\n ComponentsApi,\n createComponentExtension,\n} from '@backstage/frontend-plugin-api';\n\n/**\n * Implementation for the {@linkComponentApi}\n *\n * @internal\n */\nexport class DefaultComponentsApi implements ComponentsApi {\n #components: Map<string, ComponentType<any>>;\n\n static fromComponents(\n components: Array<typeof createComponentExtension.componentDataRef.T>,\n ) {\n return new DefaultComponentsApi(\n new Map(components.map(entry => [entry.ref.id, entry.impl])),\n );\n }\n\n constructor(components: Map<string, any>) {\n this.#components = components;\n }\n\n getComponent<T extends {}>(ref: ComponentRef<T>): ComponentType<T> {\n const impl = this.#components.get(ref.id);\n if (!impl) {\n throw new Error(`No implementation found for component ref ${ref}`);\n }\n return impl;\n }\n}\n"],"names":[],"mappings":"AA4BO,MAAM,oBAA8C,CAAA;AAAA,EACzD,WAAA;AAAA,EAEA,OAAO,eACL,UACA,EAAA;AACA,IAAA,OAAO,IAAI,oBAAA;AAAA,MACT,IAAI,GAAA,CAAI,UAAW,CAAA,GAAA,CAAI,CAAS,KAAA,KAAA,CAAC,KAAM,CAAA,GAAA,CAAI,EAAI,EAAA,KAAA,CAAM,IAAI,CAAC,CAAC;AAAA,KAC7D;AAAA;AACF,EAEA,YAAY,UAA8B,EAAA;AACxC,IAAA,IAAA,CAAK,WAAc,GAAA,UAAA;AAAA;AACrB,EAEA,aAA2B,GAAwC,EAAA;AACjE,IAAA,MAAM,IAAO,GAAA,IAAA,CAAK,WAAY,CAAA,GAAA,CAAI,IAAI,EAAE,CAAA;AACxC,IAAA,IAAI,CAAC,IAAM,EAAA;AACT,MAAA,MAAM,IAAI,KAAA,CAAM,CAA6C,0CAAA,EAAA,GAAG,CAAE,CAAA,CAAA;AAAA;AAEpE,IAAO,OAAA,IAAA;AAAA;AAEX;;;;"}