@backstage/frontend-defaults 0.3.5 → 0.3.6
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,16 @@
|
|
|
1
1
|
# @backstage/frontend-defaults
|
|
2
2
|
|
|
3
|
+
## 0.3.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 98f35b4: The `API_FACTORY_CONFLICT` error is now treated as a warning and will not prevent the app from starting.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/frontend-app-api@0.14.1
|
|
10
|
+
- @backstage/frontend-plugin-api@0.13.4
|
|
11
|
+
- @backstage/core-components@0.18.6
|
|
12
|
+
- @backstage/plugin-app@0.3.5
|
|
13
|
+
|
|
3
14
|
## 0.3.5
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -5,7 +5,8 @@ const DEFAULT_WARNING_CODES = [
|
|
|
5
5
|
"EXTENSION_IGNORED",
|
|
6
6
|
"INVALID_EXTENSION_CONFIG_KEY",
|
|
7
7
|
"EXTENSION_INPUT_DATA_IGNORED",
|
|
8
|
-
"EXTENSION_OUTPUT_IGNORED"
|
|
8
|
+
"EXTENSION_OUTPUT_IGNORED",
|
|
9
|
+
"API_FACTORY_CONFLICT"
|
|
9
10
|
];
|
|
10
11
|
function AppErrorItem(props) {
|
|
11
12
|
const { context } = props.error;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maybeCreateErrorPage.esm.js","sources":["../src/maybeCreateErrorPage.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 { FrontendPluginInfo } from '@backstage/frontend-plugin-api';\nimport { JSX, useEffect, useState } from 'react';\nimport { AppError, AppErrorTypes } from '@backstage/frontend-app-api';\n\nconst DEFAULT_WARNING_CODES: Array<keyof AppErrorTypes> = [\n 'EXTENSION_IGNORED',\n 'INVALID_EXTENSION_CONFIG_KEY',\n 'EXTENSION_INPUT_DATA_IGNORED',\n 'EXTENSION_OUTPUT_IGNORED',\n];\n\nfunction AppErrorItem(props: { error: AppError }): JSX.Element {\n const { context } = props.error;\n\n const node = 'node' in context ? context.node : undefined;\n const extensionId =\n 'extensionId' in context ? context.extensionId : node?.spec.id;\n const routeId = 'routeId' in context ? context.routeId : undefined;\n const plugin = 'plugin' in context ? context.plugin : node?.spec.plugin;\n const pluginId = plugin?.id ?? 'N/A';\n\n const [info, setInfo] = useState<FrontendPluginInfo | undefined>(undefined);\n useEffect(() => {\n plugin?.info().then(setInfo, error => {\n // eslint-disable-next-line no-console\n console.error(`Failed to load info for plugin ${plugin.id}: ${error}`);\n });\n }, [plugin]);\n\n return (\n <div>\n <b>{props.error.code}</b>: {props.error.message}\n <pre style={{ marginLeft: '1rem' }}>\n {extensionId && <div>extensionId: {extensionId}</div>}\n {routeId && <div>routeId: {routeId}</div>}\n {pluginId && <div>pluginId: {pluginId}</div>}\n {info && (\n <div>\n package: {info.packageName}@{info.version}\n </div>\n )}\n </pre>\n </div>\n );\n}\n\nfunction AppErrorPage(props: { errors: AppError[] }): JSX.Element {\n return (\n <div style={{ margin: '1rem' }}>\n <h2>App startup failed</h2>\n {props.errors.map((error, index) => (\n <AppErrorItem error={error} key={index} />\n ))}\n </div>\n );\n}\n\n/**\n * If there are any unrecoverable errors in the app, this will return an error page in the form of a JSX element.\n *\n * If there are any recoverable errors, they will always be logged as warnings in the console.\n * @public\n */\nexport function maybeCreateErrorPage(\n app: { errors?: AppError[] },\n options?: {\n warningCodes?: Array<keyof AppErrorTypes>;\n },\n): JSX.Element | undefined {\n if (!app.errors) {\n return undefined;\n }\n\n const errors = new Array<AppError>();\n const warnings = new Array<AppError>();\n\n const warningCodes = new Set(options?.warningCodes ?? DEFAULT_WARNING_CODES);\n for (const error of app.errors) {\n if (warningCodes.has(error.code)) {\n warnings.push(error);\n } else {\n errors.push(error);\n }\n }\n\n if (warnings.length > 0) {\n // eslint-disable-next-line no-console\n console.warn('App startup encountered warnings:');\n for (const warning of warnings) {\n // eslint-disable-next-line no-console\n console.warn(`${warning.code}: ${warning.message}`);\n }\n }\n\n if (errors.length === 0) {\n return undefined;\n }\n\n return <AppErrorPage errors={errors} />;\n}\n"],"names":[],"mappings":";;;AAoBA,MAAM,qBAAA,GAAoD;AAAA,EACxD,mBAAA;AAAA,EACA,8BAAA;AAAA,EACA,8BAAA;AAAA,EACA;AACF,CAAA;AAEA,SAAS,aAAa,KAAA,EAAyC;AAC7D,EAAA,MAAM,EAAE,OAAA,EAAQ,GAAI,KAAA,CAAM,KAAA;AAE1B,EAAA,MAAM,IAAA,GAAO,MAAA,IAAU,OAAA,GAAU,OAAA,CAAQ,IAAA,GAAO,MAAA;AAChD,EAAA,MAAM,cACJ,aAAA,IAAiB,OAAA,GAAU,OAAA,CAAQ,WAAA,GAAc,MAAM,IAAA,CAAK,EAAA;AAC9D,EAAA,MAAM,OAAA,GAAU,SAAA,IAAa,OAAA,GAAU,OAAA,CAAQ,OAAA,GAAU,MAAA;AACzD,EAAA,MAAM,SAAS,QAAA,IAAY,OAAA,GAAU,OAAA,CAAQ,MAAA,GAAS,MAAM,IAAA,CAAK,MAAA;AACjE,EAAA,MAAM,QAAA,GAAW,QAAQ,EAAA,IAAM,KAAA;AAE/B,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,SAAyC,MAAS,CAAA;AAC1E,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,MAAA,EAAQ,IAAA,EAAK,CAAE,IAAA,CAAK,OAAA,E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["/*\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 { FrontendPluginInfo } from '@backstage/frontend-plugin-api';\nimport { JSX, useEffect, useState } from 'react';\nimport { AppError, AppErrorTypes } from '@backstage/frontend-app-api';\n\nconst DEFAULT_WARNING_CODES: Array<keyof AppErrorTypes> = [\n 'EXTENSION_IGNORED',\n 'INVALID_EXTENSION_CONFIG_KEY',\n 'EXTENSION_INPUT_DATA_IGNORED',\n 'EXTENSION_OUTPUT_IGNORED',\n 'API_FACTORY_CONFLICT',\n];\n\nfunction AppErrorItem(props: { error: AppError }): JSX.Element {\n const { context } = props.error;\n\n const node = 'node' in context ? context.node : undefined;\n const extensionId =\n 'extensionId' in context ? context.extensionId : node?.spec.id;\n const routeId = 'routeId' in context ? context.routeId : undefined;\n const plugin = 'plugin' in context ? context.plugin : node?.spec.plugin;\n const pluginId = plugin?.id ?? 'N/A';\n\n const [info, setInfo] = useState<FrontendPluginInfo | undefined>(undefined);\n useEffect(() => {\n plugin?.info().then(setInfo, error => {\n // eslint-disable-next-line no-console\n console.error(`Failed to load info for plugin ${plugin.id}: ${error}`);\n });\n }, [plugin]);\n\n return (\n <div>\n <b>{props.error.code}</b>: {props.error.message}\n <pre style={{ marginLeft: '1rem' }}>\n {extensionId && <div>extensionId: {extensionId}</div>}\n {routeId && <div>routeId: {routeId}</div>}\n {pluginId && <div>pluginId: {pluginId}</div>}\n {info && (\n <div>\n package: {info.packageName}@{info.version}\n </div>\n )}\n </pre>\n </div>\n );\n}\n\nfunction AppErrorPage(props: { errors: AppError[] }): JSX.Element {\n return (\n <div style={{ margin: '1rem' }}>\n <h2>App startup failed</h2>\n {props.errors.map((error, index) => (\n <AppErrorItem error={error} key={index} />\n ))}\n </div>\n );\n}\n\n/**\n * If there are any unrecoverable errors in the app, this will return an error page in the form of a JSX element.\n *\n * If there are any recoverable errors, they will always be logged as warnings in the console.\n * @public\n */\nexport function maybeCreateErrorPage(\n app: { errors?: AppError[] },\n options?: {\n warningCodes?: Array<keyof AppErrorTypes>;\n },\n): JSX.Element | undefined {\n if (!app.errors) {\n return undefined;\n }\n\n const errors = new Array<AppError>();\n const warnings = new Array<AppError>();\n\n const warningCodes = new Set(options?.warningCodes ?? DEFAULT_WARNING_CODES);\n for (const error of app.errors) {\n if (warningCodes.has(error.code)) {\n warnings.push(error);\n } else {\n errors.push(error);\n }\n }\n\n if (warnings.length > 0) {\n // eslint-disable-next-line no-console\n console.warn('App startup encountered warnings:');\n for (const warning of warnings) {\n // eslint-disable-next-line no-console\n console.warn(`${warning.code}: ${warning.message}`);\n }\n }\n\n if (errors.length === 0) {\n return undefined;\n }\n\n return <AppErrorPage errors={errors} />;\n}\n"],"names":[],"mappings":";;;AAoBA,MAAM,qBAAA,GAAoD;AAAA,EACxD,mBAAA;AAAA,EACA,8BAAA;AAAA,EACA,8BAAA;AAAA,EACA,0BAAA;AAAA,EACA;AACF,CAAA;AAEA,SAAS,aAAa,KAAA,EAAyC;AAC7D,EAAA,MAAM,EAAE,OAAA,EAAQ,GAAI,KAAA,CAAM,KAAA;AAE1B,EAAA,MAAM,IAAA,GAAO,MAAA,IAAU,OAAA,GAAU,OAAA,CAAQ,IAAA,GAAO,MAAA;AAChD,EAAA,MAAM,cACJ,aAAA,IAAiB,OAAA,GAAU,OAAA,CAAQ,WAAA,GAAc,MAAM,IAAA,CAAK,EAAA;AAC9D,EAAA,MAAM,OAAA,GAAU,SAAA,IAAa,OAAA,GAAU,OAAA,CAAQ,OAAA,GAAU,MAAA;AACzD,EAAA,MAAM,SAAS,QAAA,IAAY,OAAA,GAAU,OAAA,CA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AA;AAAA,IACpD;AAAA,EACF;AAEA,EAAA,IAAI,MAAA,CAAO,WAAW,CAAA,EAAG;AACvB,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,uBAAO,GAAA,CAAC,gBAAa,MAAA,EAAgB,CAAA;AACvC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/frontend-defaults",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"backstage": {
|
|
5
5
|
"role": "web-library"
|
|
6
6
|
},
|
|
@@ -32,16 +32,16 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@backstage/config": "^1.3.6",
|
|
35
|
-
"@backstage/core-components": "^0.18.
|
|
35
|
+
"@backstage/core-components": "^0.18.6",
|
|
36
36
|
"@backstage/errors": "^1.2.7",
|
|
37
|
-
"@backstage/frontend-app-api": "^0.14.
|
|
38
|
-
"@backstage/frontend-plugin-api": "^0.13.
|
|
39
|
-
"@backstage/plugin-app": "^0.3.
|
|
37
|
+
"@backstage/frontend-app-api": "^0.14.1",
|
|
38
|
+
"@backstage/frontend-plugin-api": "^0.13.4",
|
|
39
|
+
"@backstage/plugin-app": "^0.3.5",
|
|
40
40
|
"@react-hookz/web": "^24.0.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@backstage/cli": "^0.35.
|
|
44
|
-
"@backstage/core-plugin-api": "^1.12.
|
|
43
|
+
"@backstage/cli": "^0.35.3",
|
|
44
|
+
"@backstage/core-plugin-api": "^1.12.2",
|
|
45
45
|
"@backstage/test-utils": "^1.7.14",
|
|
46
46
|
"@testing-library/jest-dom": "^6.0.0",
|
|
47
47
|
"@testing-library/react": "^16.0.0",
|