@shuvi/error-overlay 1.0.54 → 1.0.56
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/lib/client.js +6 -6
- package/lib/iframe-bundle.js +40 -50
- package/lib/middleware/helper/createOriginalStackFrame.d.ts +1 -1
- package/lib/middleware/helper/createOriginalStackFrame.js +7 -8
- package/lib/middleware/helper/findOriginalSourcePositionAndContent.js +2 -3
- package/lib/middleware/helper/getModuleById.js +1 -2
- package/lib/middleware/helper/getOriginalStackFrame.js +2 -3
- package/lib/middleware/helper/getSourceById.d.ts +1 -1
- package/lib/middleware/helper/getSourceById.js +2 -3
- package/lib/middleware/helper/getSourceMapUrl.js +1 -2
- package/lib/middleware/helper/getSourcePath.js +1 -2
- package/lib/middleware/launchEditorMiddleware.js +1 -2
- package/lib/middleware/stackFrameMiddleware.js +3 -4
- package/lib/view/ErrorOverlay.d.ts +1 -1
- package/lib/view/components/Dialog/Dialog.d.ts +1 -1
- package/lib/view/components/Dialog/Dialog.js +1 -1
- package/lib/view/components/Dialog/DialogBody.d.ts +1 -1
- package/lib/view/components/Dialog/DialogBody.js +1 -1
- package/lib/view/components/Dialog/DialogContent.d.ts +1 -1
- package/lib/view/components/Dialog/DialogContent.js +1 -1
- package/lib/view/components/Dialog/DialogHeader.d.ts +1 -1
- package/lib/view/components/Dialog/DialogHeader.js +1 -1
- package/lib/view/components/Errors/CallStackFrame/CallStackFrame.d.ts +1 -1
- package/lib/view/components/Errors/CallStackFrame/CallStackFrame.js +1 -1
- package/lib/view/components/Errors/CodeFrame/CodeFrame.d.ts +1 -1
- package/lib/view/components/Errors/CodeFrame/CodeFrame.js +2 -2
- package/lib/view/components/Errors/Errors.d.ts +1 -1
- package/lib/view/components/Errors/Errors.js +1 -1
- package/lib/view/components/Icons/ArrowLeftIcon.d.ts +0 -1
- package/lib/view/components/Icons/ArrowLeftIcon.js +1 -1
- package/lib/view/components/Icons/ArrowRightIcon.d.ts +0 -1
- package/lib/view/components/Icons/ArrowRightIcon.js +1 -1
- package/lib/view/components/Icons/CloseIcon.d.ts +0 -1
- package/lib/view/components/Icons/CloseIcon.js +1 -1
- package/lib/view/components/Icons/ExternalLinkIcon.d.ts +0 -1
- package/lib/view/components/Icons/ExternalLinkIcon.js +1 -1
- package/lib/view/components/Icons/WarningIcon.d.ts +0 -1
- package/lib/view/components/Icons/WarningIcon.js +1 -1
- package/lib/view/components/NavigationBar/NavigationBar.d.ts +1 -1
- package/lib/view/components/NavigationBar/NavigationBar.js +1 -1
- package/lib/view/components/Overlay/Overlay.d.ts +1 -1
- package/lib/view/components/Overlay/Overlay.js +1 -1
- package/lib/view/components/Overlay/body-locker.js +2 -3
- package/lib/view/components/ShadowPortal.d.ts +1 -1
- package/lib/view/components/Terminal/Terminal.d.ts +1 -1
- package/lib/view/components/Terminal/Terminal.js +2 -2
- package/lib/view/components/Toast/Toast.d.ts +1 -1
- package/lib/view/components/Toast/Toast.js +1 -1
- package/lib/view/container/BuildError.d.ts +1 -1
- package/lib/view/container/BuildError.js +1 -1
- package/lib/view/container/RuntimeError.d.ts +2 -2
- package/lib/view/container/RuntimeError.js +4 -4
- package/lib/view/errorTypeHandler.d.ts +7 -7
- package/lib/view/errorTypeHandler.js +3 -4
- package/lib/view/helpers/getErrorByType.d.ts +1 -1
- package/lib/view/helpers/getErrorByType.js +1 -2
- package/lib/view/helpers/nodeStackFrames.d.ts +1 -1
- package/lib/view/helpers/nodeStackFrames.js +4 -5
- package/lib/view/helpers/noop-template.js +1 -2
- package/lib/view/helpers/parseStack.js +2 -3
- package/lib/view/helpers/stack-frame.d.ts +1 -1
- package/lib/view/helpers/stack-frame.js +2 -3
- package/lib/view/hooks/use-on-click-outside.js +1 -2
- package/lib/view/styles/Base.d.ts +0 -1
- package/lib/view/styles/Base.js +1 -2
- package/lib/view/styles/ComponentStyles.d.ts +0 -1
- package/lib/view/styles/ComponentStyles.js +1 -2
- package/lib/view/styles/CssReset.d.ts +0 -1
- package/lib/view/styles/CssReset.js +1 -2
- package/package.json +5 -5
- package/umd/index.js +16 -20
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.launchEditorMiddleware =
|
|
6
|
+
exports.launchEditorMiddleware = launchEditorMiddleware;
|
|
7
7
|
const launch_editor_1 = __importDefault(require("launch-editor"));
|
|
8
8
|
const url_1 = __importDefault(require("url"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
@@ -32,4 +32,3 @@ function launchEditorMiddleware(launchEditorEndpoint, rootDir) {
|
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
exports.launchEditorMiddleware = launchEditorMiddleware;
|
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.stackFrameMiddleware =
|
|
15
|
+
exports.stackFrameMiddleware = stackFrameMiddleware;
|
|
16
16
|
const url_1 = __importDefault(require("url"));
|
|
17
17
|
const constants_1 = require("@shuvi/shared/constants");
|
|
18
18
|
const getSourceById_1 = require("./helper/getSourceById");
|
|
@@ -36,7 +36,7 @@ function stackFrameMiddleware(originalStackFrameEndpoint, bundler, resolveBuildF
|
|
|
36
36
|
const source = yield (0, getSourceById_1.getSourceById)(fileName.startsWith('file:'), moduleId, compiler, resolveBuildFile, buildDir, compilation);
|
|
37
37
|
cache.set(fileName, source);
|
|
38
38
|
}
|
|
39
|
-
catch (
|
|
39
|
+
catch (_a) {
|
|
40
40
|
cache.set(fileName, null);
|
|
41
41
|
}
|
|
42
42
|
})));
|
|
@@ -47,7 +47,7 @@ function stackFrameMiddleware(originalStackFrameEndpoint, bundler, resolveBuildF
|
|
|
47
47
|
try {
|
|
48
48
|
result = yield (0, getOriginalStackFrame_1.getOriginalStackFrame)(frame, sourceMap, resolveBuildFile, buildDir, errorMessage, compilation);
|
|
49
49
|
}
|
|
50
|
-
catch (
|
|
50
|
+
catch (_a) {
|
|
51
51
|
result = {
|
|
52
52
|
error: true,
|
|
53
53
|
reason: 'No Content',
|
|
@@ -100,4 +100,3 @@ function stackFrameMiddleware(originalStackFrameEndpoint, bundler, resolveBuildF
|
|
|
100
100
|
});
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
|
-
exports.stackFrameMiddleware = stackFrameMiddleware;
|
|
@@ -70,6 +70,6 @@ const Dialog = function Dialog(_a) {
|
|
|
70
70
|
shadowRoot.addEventListener('keydown', handler);
|
|
71
71
|
return () => shadowRoot.removeEventListener('keydown', handler);
|
|
72
72
|
}, [dialog]);
|
|
73
|
-
return ((0, jsx_runtime_1.jsxs)("div",
|
|
73
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ref: onDialog, "data-dialog": true, tabIndex: -1, role: "dialog", "aria-labelledby": props['aria-labelledby'], "aria-describedby": props['aria-describedby'], "aria-modal": "true", children: [(0, jsx_runtime_1.jsx)("div", { "data-dialog-banner": true, className: `banner-${type}` }), children] }));
|
|
74
74
|
};
|
|
75
75
|
exports.Dialog = Dialog;
|
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DialogBody = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const DialogBody = function DialogBody({ children, className }) {
|
|
6
|
-
return ((0, jsx_runtime_1.jsx)("div",
|
|
6
|
+
return ((0, jsx_runtime_1.jsx)("div", { "data-dialog-body": true, className: className, children: children }));
|
|
7
7
|
};
|
|
8
8
|
exports.DialogBody = DialogBody;
|
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DialogContent = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const DialogContent = function DialogContent({ children, className }) {
|
|
6
|
-
return ((0, jsx_runtime_1.jsx)("div",
|
|
6
|
+
return ((0, jsx_runtime_1.jsx)("div", { "data-dialog-content": true, className: className, children: children }));
|
|
7
7
|
};
|
|
8
8
|
exports.DialogContent = DialogContent;
|
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DialogHeader = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const DialogHeader = function DialogHeader({ children, className }) {
|
|
6
|
-
return ((0, jsx_runtime_1.jsx)("div",
|
|
6
|
+
return ((0, jsx_runtime_1.jsx)("div", { "data-dialog-header": true, className: className, children: children }));
|
|
7
7
|
};
|
|
8
8
|
exports.DialogHeader = DialogHeader;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { StackFrame } from 'stacktrace-parser';
|
|
3
3
|
import { OriginalStackFrame } from '../../../helpers/stack-frame';
|
|
4
|
-
export
|
|
4
|
+
export type CallStackFrameProps = {
|
|
5
5
|
stackFrame: StackFrame;
|
|
6
6
|
codeFrame: string;
|
|
7
7
|
};
|
|
@@ -45,6 +45,6 @@ const CallStackFrame = function CallStackFrame({ frame }) {
|
|
|
45
45
|
console.error('There was an issue opening this code in your editor.');
|
|
46
46
|
});
|
|
47
47
|
}, [hasSource, f]);
|
|
48
|
-
return ((0, jsx_runtime_1.jsxs)("div",
|
|
48
|
+
return ((0, jsx_runtime_1.jsxs)("div", { "data-call-stack-frame": true, children: [(0, jsx_runtime_1.jsx)("h6", { "data-frame-expanded": Boolean(frame.expanded), children: f.methodName }), (0, jsx_runtime_1.jsxs)("div", { "data-has-source": hasSource ? 'true' : undefined, tabIndex: hasSource ? 10 : undefined, role: hasSource ? 'link' : undefined, onClick: open, title: hasSource ? 'Click to open in your editor' : undefined, children: [(0, jsx_runtime_1.jsx)("span", { children: (0, stack_frame_1.getFrameSource)(f) }), (0, jsx_runtime_1.jsx)(Icons_1.ExternalLinkIcon, {})] })] }));
|
|
49
49
|
};
|
|
50
50
|
exports.CallStackFrame = CallStackFrame;
|
|
@@ -70,10 +70,10 @@ const CodeFrame = function CodeFrame({ stackFrame, codeFrame }) {
|
|
|
70
70
|
console.error('There was an issue opening this code in your editor.');
|
|
71
71
|
});
|
|
72
72
|
}, [stackFrame]);
|
|
73
|
-
return ((0, jsx_runtime_1.jsxs)("div",
|
|
73
|
+
return ((0, jsx_runtime_1.jsxs)("div", { "data-codeframe": true, children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("p", { role: "link", onClick: open, tabIndex: 1, title: "Click to open in your editor", children: [(0, jsx_runtime_1.jsxs)("span", { children: [(0, stack_frame_1.getFrameSource)(stackFrame), " @ ", stackFrame.methodName] }), (0, jsx_runtime_1.jsx)(Icons_1.ExternalLinkIcon, {})] }) }), (0, jsx_runtime_1.jsx)("pre", { children: decoded.map((entry, index) => ((0, jsx_runtime_1.jsx)("span", { style: Object.assign({ color: entry.fg ? `var(--color-${entry.fg})` : undefined }, (entry.decoration === 'bold'
|
|
74
74
|
? { fontWeight: 800 }
|
|
75
75
|
: entry.decoration === 'italic'
|
|
76
76
|
? { fontStyle: 'italic' }
|
|
77
|
-
: undefined))
|
|
77
|
+
: undefined)), children: entry.content }, `frame-${index}`))) })] }));
|
|
78
78
|
};
|
|
79
79
|
exports.CodeFrame = CodeFrame;
|
|
@@ -57,6 +57,6 @@ const Errors = function Errors({ error }) {
|
|
|
57
57
|
firstFrame,
|
|
58
58
|
visibleCallStackFrames.length
|
|
59
59
|
]);
|
|
60
|
-
return ((0, jsx_runtime_1.jsxs)(React.Fragment, { children: [firstFrame ? ((0, jsx_runtime_1.jsxs)(React.Fragment, { children: [(0, jsx_runtime_1.jsx)("h5", { children: "Source" }), leadingFrames.map((frame, index) => ((0, jsx_runtime_1.jsx)(CallStackFrame_1.CallStackFrame, { frame: frame }, `leading-frame-${index}-${all}`))), (0, jsx_runtime_1.jsx)(CodeFrame_1.CodeFrame, { stackFrame: firstFrame.originalStackFrame, codeFrame: firstFrame.originalCodeFrame })] })) : undefined, visibleCallStackFrames.length ? ((0, jsx_runtime_1.jsxs)(React.Fragment, { children: [(0, jsx_runtime_1.jsx)("h5", { children: "Call Stack" }), visibleCallStackFrames.map((frame, index) => ((0, jsx_runtime_1.jsx)(CallStackFrame_1.CallStackFrame, { frame: frame }, `call-stack-${index}-${all}`)))] })) : undefined, canShowMore ? ((0, jsx_runtime_1.jsx)(React.Fragment, { children: (0, jsx_runtime_1.jsxs)("button",
|
|
60
|
+
return ((0, jsx_runtime_1.jsxs)(React.Fragment, { children: [firstFrame ? ((0, jsx_runtime_1.jsxs)(React.Fragment, { children: [(0, jsx_runtime_1.jsx)("h5", { children: "Source" }), leadingFrames.map((frame, index) => ((0, jsx_runtime_1.jsx)(CallStackFrame_1.CallStackFrame, { frame: frame }, `leading-frame-${index}-${all}`))), (0, jsx_runtime_1.jsx)(CodeFrame_1.CodeFrame, { stackFrame: firstFrame.originalStackFrame, codeFrame: firstFrame.originalCodeFrame })] })) : undefined, visibleCallStackFrames.length ? ((0, jsx_runtime_1.jsxs)(React.Fragment, { children: [(0, jsx_runtime_1.jsx)("h5", { children: "Call Stack" }), visibleCallStackFrames.map((frame, index) => ((0, jsx_runtime_1.jsx)(CallStackFrame_1.CallStackFrame, { frame: frame }, `call-stack-${index}-${all}`)))] })) : undefined, canShowMore ? ((0, jsx_runtime_1.jsx)(React.Fragment, { children: (0, jsx_runtime_1.jsxs)("button", { tabIndex: 10, "data-runtime-error-collapsed-action": true, type: "button", onClick: toggleAll, children: [all ? 'Hide' : 'Show', " collapsed frames"] }) })) : undefined] }));
|
|
61
61
|
};
|
|
62
62
|
exports.Errors = Errors;
|
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ArrowLeftIcon = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const ArrowLeftIcon = () => {
|
|
6
|
-
return ((0, jsx_runtime_1.jsx)("svg",
|
|
6
|
+
return ((0, jsx_runtime_1.jsx)("svg", { viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M6.99996 1.16666L1.16663 6.99999L6.99996 12.8333M12.8333 6.99999H1.99996H12.8333Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
7
7
|
};
|
|
8
8
|
exports.ArrowLeftIcon = ArrowLeftIcon;
|
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ArrowRightIcon = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const ArrowRightIcon = () => {
|
|
6
|
-
return ((0, jsx_runtime_1.jsx)("svg",
|
|
6
|
+
return ((0, jsx_runtime_1.jsx)("svg", { viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M6.99996 1.16666L12.8333 6.99999L6.99996 12.8333M1.16663 6.99999H12H1.16663Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
7
7
|
};
|
|
8
8
|
exports.ArrowRightIcon = ArrowRightIcon;
|
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CloseIcon = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const CloseIcon = () => {
|
|
6
|
-
return ((0, jsx_runtime_1.jsxs)("svg",
|
|
6
|
+
return ((0, jsx_runtime_1.jsxs)("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [(0, jsx_runtime_1.jsx)("path", { d: "M18 6L6 18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), (0, jsx_runtime_1.jsx)("path", { d: "M6 6L18 18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
7
7
|
};
|
|
8
8
|
exports.CloseIcon = CloseIcon;
|
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ExternalLinkIcon = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const ExternalLinkIcon = () => {
|
|
6
|
-
return ((0, jsx_runtime_1.jsxs)("svg",
|
|
6
|
+
return ((0, jsx_runtime_1.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }), (0, jsx_runtime_1.jsx)("polyline", { points: "15 3 21 3 21 9" }), (0, jsx_runtime_1.jsx)("line", { x1: "10", y1: "14", x2: "21", y2: "3" })] }));
|
|
7
7
|
};
|
|
8
8
|
exports.ExternalLinkIcon = ExternalLinkIcon;
|
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.WarningIcon = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const WarningIcon = () => {
|
|
6
|
-
return ((0, jsx_runtime_1.jsxs)("svg",
|
|
6
|
+
return ((0, jsx_runtime_1.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)("circle", { cx: "12", cy: "12", r: "10" }), (0, jsx_runtime_1.jsx)("line", { x1: "12", y1: "8", x2: "12", y2: "12" }), (0, jsx_runtime_1.jsx)("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })] }));
|
|
7
7
|
};
|
|
8
8
|
exports.WarningIcon = WarningIcon;
|
|
@@ -103,6 +103,6 @@ const NavigationBar = function NavigationBar({ children, className, previous, ne
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
}, [nav, next, previous]);
|
|
106
|
-
return ((0, jsx_runtime_1.jsxs)("div",
|
|
106
|
+
return ((0, jsx_runtime_1.jsxs)("div", { "data-nav-bar": true, className: className, children: [(0, jsx_runtime_1.jsxs)("nav", { ref: onNav, children: [(0, jsx_runtime_1.jsx)("button", { ref: buttonLeft, type: "button", disabled: previous == null ? true : undefined, "aria-disabled": previous == null ? true : undefined, onClick: previous !== null && previous !== void 0 ? previous : undefined, children: (0, jsx_runtime_1.jsx)(Icons_1.ArrowLeftIcon, {}) }), (0, jsx_runtime_1.jsx)("button", { ref: buttonRight, type: "button", disabled: next == null ? true : undefined, "aria-disabled": next == null ? true : undefined, onClick: next !== null && next !== void 0 ? next : undefined, children: (0, jsx_runtime_1.jsx)(Icons_1.ArrowRightIcon, {}) }), "\u00A0", children] }), close ? ((0, jsx_runtime_1.jsx)("button", { ref: buttonClose, type: "button", onClick: close, "aria-label": "Close", children: (0, jsx_runtime_1.jsx)("span", { "aria-hidden": "true", children: (0, jsx_runtime_1.jsx)(Icons_1.CloseIcon, {}) }) })) : null] }));
|
|
107
107
|
};
|
|
108
108
|
exports.NavigationBar = NavigationBar;
|
|
@@ -34,6 +34,6 @@ const Overlay = function Overlay({ className, children, fixed }) {
|
|
|
34
34
|
(0, body_locker_1.unlock)();
|
|
35
35
|
};
|
|
36
36
|
}, []);
|
|
37
|
-
return ((0, jsx_runtime_1.jsxs)("div",
|
|
37
|
+
return ((0, jsx_runtime_1.jsxs)("div", { "data-dialog-overlay": true, className: className, children: [(0, jsx_runtime_1.jsx)("div", { "data-dialog-backdrop": true, "data-dialog-backdrop-fixed": fixed ? true : undefined }), children] }));
|
|
38
38
|
};
|
|
39
39
|
exports.Overlay = Overlay;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.lock = lock;
|
|
4
|
+
exports.unlock = unlock;
|
|
4
5
|
let previousBodyPaddingRight;
|
|
5
6
|
let previousBodyOverflowSetting;
|
|
6
7
|
let activeLocks = 0;
|
|
@@ -18,7 +19,6 @@ function lock() {
|
|
|
18
19
|
document.body.style.overflow = 'hidden';
|
|
19
20
|
});
|
|
20
21
|
}
|
|
21
|
-
exports.lock = lock;
|
|
22
22
|
function unlock() {
|
|
23
23
|
setTimeout(() => {
|
|
24
24
|
if (activeLocks === 0 || --activeLocks !== 0) {
|
|
@@ -34,4 +34,3 @@ function unlock() {
|
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
exports.unlock = unlock;
|
|
@@ -38,10 +38,10 @@ const Terminal = function Terminal({ content }) {
|
|
|
38
38
|
remove_empty: true
|
|
39
39
|
});
|
|
40
40
|
}, [content]);
|
|
41
|
-
return ((0, jsx_runtime_1.jsx)("div",
|
|
41
|
+
return ((0, jsx_runtime_1.jsx)("div", { "data-terminal": true, children: (0, jsx_runtime_1.jsx)("pre", { children: decoded.map((entry, index) => ((0, jsx_runtime_1.jsx)("span", { style: Object.assign({ color: entry.fg ? `var(--color-${entry.fg})` : undefined }, (entry.decoration === 'bold'
|
|
42
42
|
? { fontWeight: 800 }
|
|
43
43
|
: entry.decoration === 'italic'
|
|
44
44
|
? { fontStyle: 'italic' }
|
|
45
|
-
: undefined))
|
|
45
|
+
: undefined)), children: entry.content }, `terminal-entry-${index}`))) }) }));
|
|
46
46
|
};
|
|
47
47
|
exports.Terminal = Terminal;
|
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Toast = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const Toast = function Toast({ onClick, children, className }) {
|
|
6
|
-
return ((0, jsx_runtime_1.jsx)("div",
|
|
6
|
+
return ((0, jsx_runtime_1.jsx)("div", { "data-toast": true, onClick: onClick, className: className, children: (0, jsx_runtime_1.jsx)("div", { "data-toast-wrapper": true, children: children }) }));
|
|
7
7
|
};
|
|
8
8
|
exports.Toast = Toast;
|
|
@@ -32,7 +32,7 @@ const Terminal_1 = require("../components/Terminal");
|
|
|
32
32
|
const noop_template_1 = require("../helpers/noop-template");
|
|
33
33
|
const BuildError = function BuildError({ error }) {
|
|
34
34
|
const noop = React.useCallback(() => { }, []);
|
|
35
|
-
return ((0, jsx_runtime_1.jsx)(Overlay_1.Overlay,
|
|
35
|
+
return ((0, jsx_runtime_1.jsx)(Overlay_1.Overlay, { fixed: true, children: (0, jsx_runtime_1.jsx)(Dialog_1.Dialog, { type: "error", onClose: noop, "aria-labelledby": "build_error_label", "aria-describedby": "build_error_desc", children: (0, jsx_runtime_1.jsxs)(Dialog_1.DialogContent, { children: [(0, jsx_runtime_1.jsx)(Dialog_1.DialogHeader, { className: "container-build-error-header", children: (0, jsx_runtime_1.jsx)("h4", { children: "Failed to compile" }) }), (0, jsx_runtime_1.jsxs)(Dialog_1.DialogBody, { className: "container-build-error-body", children: [(0, jsx_runtime_1.jsx)(Terminal_1.Terminal, { content: error }), (0, jsx_runtime_1.jsx)("footer", { children: (0, jsx_runtime_1.jsx)("small", { children: "This error occurred during the build process and can only be dismissed by fixing the error." }) })] })] }) }) }));
|
|
36
36
|
};
|
|
37
37
|
exports.BuildError = BuildError;
|
|
38
38
|
exports.styles = (0, noop_template_1.noop) `
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { UnhandledError, UnhandledRejection } from '../errorTypeHandler';
|
|
3
|
-
export
|
|
3
|
+
export type SupportedErrorEvent = {
|
|
4
4
|
id: number;
|
|
5
5
|
event: UnhandledError | UnhandledRejection;
|
|
6
6
|
};
|
|
7
|
-
export
|
|
7
|
+
export type RuntimeErrorProps = {
|
|
8
8
|
errors: SupportedErrorEvent[];
|
|
9
9
|
close: () => void;
|
|
10
10
|
};
|
|
@@ -124,15 +124,15 @@ const RuntimeError = function RuntimeError({ errors, close }) {
|
|
|
124
124
|
return null;
|
|
125
125
|
}
|
|
126
126
|
if (displayState === 'minimized') {
|
|
127
|
-
return ((0, jsx_runtime_1.jsx)(Toast_1.Toast,
|
|
127
|
+
return ((0, jsx_runtime_1.jsx)(Toast_1.Toast, { className: "shuvi-toast-errors-parent", onClick: fullscreen, children: (0, jsx_runtime_1.jsxs)("div", { className: "shuvi-toast-errors", children: [(0, jsx_runtime_1.jsx)(Icons_1.WarningIcon, {}), (0, jsx_runtime_1.jsxs)("span", { children: [readyErrors.length, " error", readyErrors.length > 1 ? 's' : ''] }), (0, jsx_runtime_1.jsx)("button", { "data-shuvi-toast-errors-hide-button": true, className: "shuvi-toast-errors-hide-button", type: "button", onClick: e => {
|
|
128
128
|
e.stopPropagation();
|
|
129
129
|
hide();
|
|
130
|
-
}, "aria-label": "Hide Errors"
|
|
130
|
+
}, "aria-label": "Hide Errors", children: (0, jsx_runtime_1.jsx)(Icons_1.CloseIcon, {}) })] }) }));
|
|
131
131
|
}
|
|
132
132
|
const isServerError = (0, nodeStackFrames_1.getErrorSource)(activeError.error) === constants_1.SERVER_TYPE_ERROR;
|
|
133
|
-
return ((0, jsx_runtime_1.jsx)(Overlay_1.Overlay, { children: (0, jsx_runtime_1.jsx)(Dialog_1.Dialog,
|
|
133
|
+
return ((0, jsx_runtime_1.jsx)(Overlay_1.Overlay, { children: (0, jsx_runtime_1.jsx)(Dialog_1.Dialog, { type: "error", "aria-labelledby": "shuvi__container_errors_label", "aria-describedby": "shuvi__container_errors_desc", onClose: isServerError ? undefined : minimize, children: (0, jsx_runtime_1.jsxs)(Dialog_1.DialogContent, { children: [(0, jsx_runtime_1.jsxs)(Dialog_1.DialogHeader, { className: "shuvi-container-errors-header", children: [(0, jsx_runtime_1.jsx)(NavigationBar_1.NavigationBar, { previous: activeIdx > 0 ? previous : null, next: activeIdx < readyErrors.length - 1 ? next : null, close: isServerError ? undefined : minimize, children: (0, jsx_runtime_1.jsxs)("small", { children: [(0, jsx_runtime_1.jsx)("span", { children: activeIdx + 1 }), " of", ' ', (0, jsx_runtime_1.jsx)("span", { children: readyErrors.length }), " runtime error", readyErrors.length < 2 ? '' : 's'] }) }), (0, jsx_runtime_1.jsx)("h1", { id: "shuvi__container_errors_label", children: isServerError
|
|
134
134
|
? 'Server Runtime Error'
|
|
135
|
-
: 'Unhandled Runtime Error' })
|
|
135
|
+
: 'Unhandled Runtime Error' }), (0, jsx_runtime_1.jsxs)("p", { id: "shuvi__container_errors_desc", children: [activeError.error.name, ": ", activeError.error.message] }), isServerError ? ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("small", { children: "This error happened while generating the page. Any console logs will be displayed in the terminal window." }) })) : undefined] }), (0, jsx_runtime_1.jsx)(Dialog_1.DialogBody, { className: "shuvi-container-errors-body", children: (0, jsx_runtime_1.jsx)(Errors_1.Errors, { error: activeError }, activeError.id.toString()) })] }) }) }));
|
|
136
136
|
};
|
|
137
137
|
exports.RuntimeError = RuntimeError;
|
|
138
138
|
exports.styles = (0, noop_template_1.noop) `
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { StackFrame } from 'stacktrace-parser';
|
|
2
2
|
import { TYPE_BUILD_OK, TYPE_REFRESH, TYPE_BUILD_ERROR, TYPE_UNHANDLED_ERROR, TYPE_UNHANDLED_REJECTION } from '../constants';
|
|
3
|
-
export
|
|
3
|
+
export type BuildOk = {
|
|
4
4
|
type: typeof TYPE_BUILD_OK;
|
|
5
5
|
};
|
|
6
|
-
export
|
|
6
|
+
export type FastRefresh = {
|
|
7
7
|
type: typeof TYPE_REFRESH;
|
|
8
8
|
};
|
|
9
|
-
export
|
|
9
|
+
export type BuildError = {
|
|
10
10
|
type: typeof TYPE_BUILD_ERROR;
|
|
11
11
|
message: string;
|
|
12
12
|
};
|
|
13
|
-
export
|
|
13
|
+
export type UnhandledError = {
|
|
14
14
|
type: typeof TYPE_UNHANDLED_ERROR;
|
|
15
15
|
reason: Error;
|
|
16
16
|
frames: StackFrame[];
|
|
17
17
|
};
|
|
18
|
-
export
|
|
18
|
+
export type UnhandledRejection = {
|
|
19
19
|
type: typeof TYPE_UNHANDLED_REJECTION;
|
|
20
20
|
reason: Error;
|
|
21
21
|
frames: StackFrame[];
|
|
22
22
|
};
|
|
23
|
-
export
|
|
24
|
-
export
|
|
23
|
+
export type ErrorTypeEvent = BuildOk | FastRefresh | BuildError | UnhandledError | UnhandledRejection;
|
|
24
|
+
export type ErrorTypeEventHandler = (ev: ErrorTypeEvent) => void;
|
|
25
25
|
export declare function emit(ev: ErrorTypeEvent): void;
|
|
26
26
|
export declare function on(fn: ErrorTypeEventHandler): boolean;
|
|
27
27
|
export declare function off(fn: ErrorTypeEventHandler): boolean;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.emit = emit;
|
|
4
|
+
exports.on = on;
|
|
5
|
+
exports.off = off;
|
|
4
6
|
let handlers = new Set();
|
|
5
7
|
let queue = [];
|
|
6
8
|
function drain() {
|
|
@@ -22,7 +24,6 @@ function emit(ev) {
|
|
|
22
24
|
queue.push(Object.freeze(Object.assign({}, ev)));
|
|
23
25
|
drain();
|
|
24
26
|
}
|
|
25
|
-
exports.emit = emit;
|
|
26
27
|
function on(fn) {
|
|
27
28
|
if (handlers.has(fn)) {
|
|
28
29
|
return false;
|
|
@@ -31,7 +32,6 @@ function on(fn) {
|
|
|
31
32
|
drain();
|
|
32
33
|
return true;
|
|
33
34
|
}
|
|
34
|
-
exports.on = on;
|
|
35
35
|
function off(fn) {
|
|
36
36
|
if (handlers.has(fn)) {
|
|
37
37
|
handlers.delete(fn);
|
|
@@ -39,4 +39,3 @@ function off(fn) {
|
|
|
39
39
|
}
|
|
40
40
|
return false;
|
|
41
41
|
}
|
|
42
|
-
exports.off = off;
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.getErrorByType =
|
|
12
|
+
exports.getErrorByType = getErrorByType;
|
|
13
13
|
const constants_1 = require("../../constants");
|
|
14
14
|
const nodeStackFrames_1 = require("./nodeStackFrames");
|
|
15
15
|
const stack_frame_1 = require("./stack-frame");
|
|
@@ -33,4 +33,3 @@ function getErrorByType(ev) {
|
|
|
33
33
|
throw new Error('type system invariant violation');
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
|
-
exports.getErrorByType = getErrorByType;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StackFrame } from 'stacktrace-parser';
|
|
2
|
-
|
|
2
|
+
type ErrorType = 'server';
|
|
3
3
|
export declare function getFilesystemFrame(frame: StackFrame): StackFrame;
|
|
4
4
|
export declare function decorateServerError(error: Error): void;
|
|
5
5
|
export declare function getServerError(error: Error): Error;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getFilesystemFrame = getFilesystemFrame;
|
|
4
|
+
exports.decorateServerError = decorateServerError;
|
|
5
|
+
exports.getServerError = getServerError;
|
|
6
|
+
exports.getErrorSource = getErrorSource;
|
|
4
7
|
const stacktrace_parser_1 = require("stacktrace-parser");
|
|
5
8
|
const constants_1 = require("../../constants");
|
|
6
9
|
const symbolError = Symbol.for('ShuviError');
|
|
@@ -19,7 +22,6 @@ function getFilesystemFrame(frame) {
|
|
|
19
22
|
}
|
|
20
23
|
return f;
|
|
21
24
|
}
|
|
22
|
-
exports.getFilesystemFrame = getFilesystemFrame;
|
|
23
25
|
function decorateServerError(error) {
|
|
24
26
|
Object.defineProperty(error, symbolError, {
|
|
25
27
|
writable: false,
|
|
@@ -28,7 +30,6 @@ function decorateServerError(error) {
|
|
|
28
30
|
value: constants_1.SERVER_TYPE_ERROR
|
|
29
31
|
});
|
|
30
32
|
}
|
|
31
|
-
exports.decorateServerError = decorateServerError;
|
|
32
33
|
function getServerError(error) {
|
|
33
34
|
let n;
|
|
34
35
|
try {
|
|
@@ -63,8 +64,6 @@ function getServerError(error) {
|
|
|
63
64
|
decorateServerError(n);
|
|
64
65
|
return n;
|
|
65
66
|
}
|
|
66
|
-
exports.getServerError = getServerError;
|
|
67
67
|
function getErrorSource(error) {
|
|
68
68
|
return error[symbolError] || null;
|
|
69
69
|
}
|
|
70
|
-
exports.getErrorSource = getErrorSource;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.noop =
|
|
3
|
+
exports.noop = noop;
|
|
4
4
|
function noop(strings, ...keys) {
|
|
5
5
|
const lastIndex = strings.length - 1;
|
|
6
6
|
return (strings.slice(0, lastIndex).reduce((p, s, i) => p + s + keys[i], '') +
|
|
7
7
|
strings[lastIndex]);
|
|
8
8
|
}
|
|
9
|
-
exports.noop = noop;
|