@ms-cloudpack/overlay 0.17.40 → 0.17.42
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/dist/browser-esm/782.chunk.js +1 -1
- package/dist/browser-esm/782.chunk.js.map +1 -1
- package/dist/browser-esm/lib/index.js +1 -1
- package/dist/browser-esm/lib/index.js.map +1 -1
- package/lib/components/ErrorDialog/PathError.d.ts.map +1 -1
- package/lib/components/ErrorDialog/PathError.js +9 -5
- package/lib/components/ErrorDialog/PathError.js.map +1 -1
- package/lib/components/ErrorDialog/useErrorEvents.d.ts.map +1 -1
- package/lib/components/ErrorDialog/useErrorEvents.js +1 -2
- package/lib/components/ErrorDialog/useErrorEvents.js.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PathError.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorDialog/PathError.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAIjE,wBAAgB,SAAS,CAAC,KAAK,EAAE,qBAAqB,
|
|
1
|
+
{"version":3,"file":"PathError.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorDialog/PathError.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAIjE,wBAAgB,SAAS,CAAC,KAAK,EAAE,qBAAqB,qBAkErD"}
|
|
@@ -6,9 +6,11 @@ import ChevronDownIcon from '../../images/chevrondown-20.inline.svg';
|
|
|
6
6
|
import { Button } from '../Button/Button.js';
|
|
7
7
|
import { useCloudpack } from '../CloudpackProvider/CloudpackProvider.js';
|
|
8
8
|
export function PathError(props) {
|
|
9
|
-
const [showContent,
|
|
9
|
+
const [showContent, setShowContent] = React.useState(false);
|
|
10
10
|
const { packageName, importPath, issuerUrl, fixable } = props;
|
|
11
11
|
const cloudpack = useCloudpack();
|
|
12
|
+
const prettyImportPath = importPath.replace(/^\.\//, '');
|
|
13
|
+
const prettyImportString = `${packageName}${prettyImportPath === '.' ? '' : `/${prettyImportPath}`}`;
|
|
12
14
|
const editConfig = () => {
|
|
13
15
|
void cloudpack.openConfigEditor.mutate();
|
|
14
16
|
};
|
|
@@ -17,10 +19,10 @@ export function PathError(props) {
|
|
|
17
19
|
};
|
|
18
20
|
return (React.createElement("div", { className: styles.root },
|
|
19
21
|
React.createElement("div", { className: cx(styles.header, styles.error) },
|
|
20
|
-
React.createElement("button", { className: styles.expandButton, onClick: () =>
|
|
22
|
+
React.createElement("button", { className: styles.expandButton, onClick: () => setShowContent(!showContent), "aria-label": showContent ? `Minimize ${prettyImportString}` : `Expand ${prettyImportString}` },
|
|
21
23
|
React.createElement("img", { className: cx(styles.expandIcon, !showContent && styles.collapsed), src: ChevronDownIcon, alt: "Chevron down icon" })),
|
|
22
24
|
React.createElement("img", { className: styles.errorIcon, src: ErrorIcon, alt: "Error icon" }),
|
|
23
|
-
React.createElement("div", { className: styles.title }, `${
|
|
25
|
+
React.createElement("div", { className: styles.title }, `${prettyImportString}`)),
|
|
24
26
|
showContent && (React.createElement(React.Fragment, null,
|
|
25
27
|
React.createElement("div", { className: styles.commands },
|
|
26
28
|
fixable && React.createElement(Button, { onClick: addOverride }, "Add override"),
|
|
@@ -35,9 +37,11 @@ export function PathError(props) {
|
|
|
35
37
|
React.createElement("div", { className: styles.nameValueArea },
|
|
36
38
|
React.createElement("div", { className: styles.name }, "Solution"),
|
|
37
39
|
React.createElement("div", { className: styles.value }, fixable
|
|
38
|
-
? `Remove the path from the import in your source. (Import from "${packageName}" rather than "${
|
|
40
|
+
? `Remove the path from the import in your source. (Import from "${packageName}" rather than "${prettyImportString}")`
|
|
39
41
|
: importPath === '.'
|
|
40
42
|
? `Make sure the package name is valid.`
|
|
41
|
-
:
|
|
43
|
+
: importPath.endsWith('/')
|
|
44
|
+
? `Remove the trailing slash from the import path.`
|
|
45
|
+
: `Import not found on package. Make sure the import path is valid.`)))))));
|
|
42
46
|
}
|
|
43
47
|
//# sourceMappingURL=PathError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PathError.js","sourceRoot":"","sources":["../../../src/components/ErrorDialog/PathError.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,uCAAuC,CAAC;AAC3D,OAAO,SAAS,MAAM,kCAAkC,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,EAAE,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,eAAe,MAAM,wCAAwC,CAAC;AAErE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAEzE,MAAM,UAAU,SAAS,CAAC,KAA4B;IACpD,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAU,KAAK,CAAC,CAAC;IACrE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAC9D,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"PathError.js","sourceRoot":"","sources":["../../../src/components/ErrorDialog/PathError.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,uCAAuC,CAAC;AAC3D,OAAO,SAAS,MAAM,kCAAkC,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,EAAE,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,eAAe,MAAM,wCAAwC,CAAC;AAErE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAEz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og/TaskStatus.module.css';\nimport ErrorIcon from '../../images/error-24.inline.svg';\nimport { default as cx } from 'classnames';\nimport ChevronDownIcon from '../../images/chevrondown-20.inline.svg';\nimport type { UnsupportedErrorEvent } from './useErrorEvents.js';\nimport { Button } from '../Button/Button.js';\nimport { useCloudpack } from '../CloudpackProvider/CloudpackProvider.js';\n\nexport function PathError(props: UnsupportedErrorEvent) {\n const [showContent, setShowContent] = React.useState<boolean>(false);\n const { packageName, importPath, issuerUrl, fixable } = props;\n const cloudpack = useCloudpack();\n const prettyImportPath = importPath.replace(/^\\.\\//, '');\n const prettyImportString = `${packageName}${prettyImportPath === '.' ? '' : `/${prettyImportPath}`}`;\n\n const editConfig = () => {\n void cloudpack.openConfigEditor.mutate();\n };\n\n const addOverride = () => {\n void cloudpack.addPackageOverride.mutate({ packageName, importPath, issuerUrl });\n };\n\n return (\n <div className={styles.root}>\n <div className={cx(styles.header, styles.error)}>\n <button\n className={styles.expandButton}\n onClick={() => setShowContent(!showContent)}\n aria-label={showContent ? `Minimize ${prettyImportString}` : `Expand ${prettyImportString}`}\n >\n <img\n className={cx(styles.expandIcon, !showContent && styles.collapsed)}\n src={ChevronDownIcon}\n alt=\"Chevron down icon\"\n />\n </button>\n <img className={styles.errorIcon} src={ErrorIcon} alt=\"Error icon\" />\n <div className={styles.title}>{`${prettyImportString}`}</div>\n </div>\n {showContent && (\n <>\n <div className={styles.commands}>\n {fixable && <Button onClick={addOverride}>Add override</Button>}\n <Button onClick={editConfig}>Edit config file</Button>\n </div>\n <div className={styles.content}>\n <div className={styles.title}>Details</div>\n\n <div className={styles.nameValueArea}>\n <div className={styles.name}>Problem</div>\n <div className={styles.value}>\n {importPath === '.'\n ? `An unrecognized package \"${packageName}\" was imported.`\n : `Path \"${importPath}\" was imported from package \"${packageName}\" but was not recognized as an exported path.`}\n </div>\n </div>\n <div className={styles.nameValueArea}>\n <div className={styles.name}>Solution</div>\n <div className={styles.value}>\n {fixable\n ? `Remove the path from the import in your source. (Import from \"${packageName}\" rather than \"${prettyImportString}\")`\n : importPath === '.'\n ? `Make sure the package name is valid.`\n : importPath.endsWith('/')\n ? `Remove the trailing slash from the import path.`\n : `Import not found on package. Make sure the import path is valid.`}\n </div>\n </div>\n </div>\n </>\n )}\n </div>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useErrorEvents.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorDialog/useErrorEvents.ts"],"names":[],"mappings":"AAyBA,MAAM,MAAM,qBAAqB,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEvH,eAAO,MAAM,cAAc;iBACqC,qBAAqB,EAAE;
|
|
1
|
+
{"version":3,"file":"useErrorEvents.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorDialog/useErrorEvents.ts"],"names":[],"mappings":"AAyBA,MAAM,MAAM,qBAAqB,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEvH,eAAO,MAAM,cAAc;iBACqC,qBAAqB,EAAE;CA+DtF,CAAC"}
|
|
@@ -19,8 +19,7 @@ export const useErrorEvents = () => {
|
|
|
19
19
|
const match = message.match(errorRegex);
|
|
20
20
|
if (match) {
|
|
21
21
|
const importString = parseImportString(match[1]);
|
|
22
|
-
const { packageName } = importString;
|
|
23
|
-
const importPath = importString.importPath.replace(/^\.\//, '');
|
|
22
|
+
const { packageName, importPath } = importString;
|
|
24
23
|
(async () => {
|
|
25
24
|
const { fixable } = await cloudpack.validatePackageOverride.query({ packageName, importPath, issuerUrl });
|
|
26
25
|
setErrorEvents((prev) => ({
|
|
@@ -1 +1 @@
|
|
|
1
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AC;YAC9C,sBAAsB,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;QACxD,CAAC;QAED,wCAAwC;QACxC,MAAM,CAAC,gBAAgB,CAAC,oBAAoB,EAAE,CAAC,KAA4B,EAAE,EAAE;YAC7E,UAAU,CAAC,KAAK,CAAC,IAAI,sBAAsB,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACpE,CAAC,CAAC,CAAC;QAEH,6CAA6C;QAC7C,KAAK,MAAM,KAAK,IAAI,UAAU,CAAC,kBAAkB,EAAE,CAAC;YAClD,UAAU,CAAC,KAAK,CAAC,IAAI,sBAAsB,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACpE,CAAC;QAED,OAAO,GAAG,EAAE;YACV,YAAY,CAAC,WAAW,EAAE,CAAC;QAC7B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC","sourcesContent":["import { useEffect, useState } from 'react';\nimport { parseImportString } from '@ms-cloudpack/path-string-parsing';\nimport { useCloudpack } from '../CloudpackProvider/CloudpackProvider.js';\nimport { errorEntrySource, type ErrorEntry } from '@ms-cloudpack/api-server/browser';\n\n// Interface with reason as a record.\ninterface ReasonRecord extends PromiseRejectionEvent {\n readonly reason: Record<string, unknown>;\n}\n\n// Interface with message as a string.\ninterface ReasonString extends ReasonRecord {\n readonly reason: { message: string };\n}\n\n// Verify the reason is a record.\nconst reasonIsRecord = (event: PromiseRejectionEvent): event is ReasonRecord => {\n return typeof event.reason === 'object' && !Array.isArray(event.reason) && event.reason !== null;\n};\n\n// Verify the reason has a message which is a string.\nconst hasMessage = (event: PromiseRejectionEvent): event is ReasonString => {\n return reasonIsRecord(event) && typeof event.reason.message === 'string';\n};\n\nexport type UnsupportedErrorEvent = { packageName: string; importPath: string; issuerUrl?: string; fixable?: boolean };\n\nexport const useErrorEvents = () => {\n const [errorEvents, setErrorEvents] = useState<{ unsupported: UnsupportedErrorEvent[] }>({ unsupported: [] });\n const cloudpack = useCloudpack();\n\n useEffect(() => {\n const handleUnsupportedError = (message: string, issuerUrl?: string): void => {\n const errorRegex = /[Mm]odule specifier,? ['\"](.*?)['\"]/;\n const match = message.match(errorRegex);\n\n if (match) {\n const importString = parseImportString(match[1]);\n const { packageName, importPath } = importString;\n\n (async () => {\n const { fixable } = await cloudpack.validatePackageOverride.query({ packageName, importPath, issuerUrl });\n setErrorEvents((prev) => ({\n ...prev,\n unsupported: [...prev.unsupported, { packageName, importPath, issuerUrl: issuerUrl, fixable }],\n }));\n })().catch(() => {\n // no-op\n });\n }\n };\n\n const subscription = cloudpack.onDataChanged.subscribe(errorEntrySource, {\n onData: (data) => {\n if (data) {\n console.error(data);\n handleUnsupportedError(data as ErrorEntry);\n }\n },\n });\n\n const pageErrors = window.__pageErrors;\n\n pageErrors.unregister();\n\n // Append unsupported paths to the list.\n window.addEventListener('error', (event: ErrorEvent) => {\n handleUnsupportedError(event.message, event.filename);\n });\n\n // Handle errors caught before rendering.\n for (const error of pageErrors.uncaughtErrors) {\n handleUnsupportedError(error.message, error.filename);\n }\n\n // Append unsupported paths to the list.\n window.addEventListener('unhandledrejection', (event: PromiseRejectionEvent) => {\n hasMessage(event) && handleUnsupportedError(event.reason.message);\n });\n\n // Handle rejections caught before rendering.\n for (const error of pageErrors.uncaughtRejections) {\n hasMessage(error) && handleUnsupportedError(error.reason.message);\n }\n\n return () => {\n subscription.unsubscribe();\n };\n }, [cloudpack]);\n\n return errorEvents;\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/overlay",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.42",
|
|
4
4
|
"description": "The Cloudpack overlay ux.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"prepack": "cp .npmignore dist/.npmignore"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@ms-cloudpack/api-server": "^0.47.
|
|
33
|
-
"@ms-cloudpack/common-types": "^0.13.
|
|
32
|
+
"@ms-cloudpack/api-server": "^0.47.10",
|
|
33
|
+
"@ms-cloudpack/common-types": "^0.13.4",
|
|
34
34
|
"@ms-cloudpack/common-types-browser": "^0.4.0",
|
|
35
35
|
"@ms-cloudpack/eslint-plugin-internal": "^0.0.1",
|
|
36
|
-
"@ms-cloudpack/path-string-parsing": "^1.2.
|
|
36
|
+
"@ms-cloudpack/path-string-parsing": "^1.2.4",
|
|
37
37
|
"@ms-cloudpack/scripts": "^0.0.1",
|
|
38
38
|
"@types/react": "^18.3.3",
|
|
39
39
|
"@types/react-dom": "^18.3.0",
|