@shuvi/error-overlay 1.0.55 → 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
package/lib/client.js
CHANGED
|
@@ -3,7 +3,12 @@ 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.
|
|
6
|
+
exports.getServerError = exports.getErrorByType = void 0;
|
|
7
|
+
exports.onBuildError = onBuildError;
|
|
8
|
+
exports.onBuildOk = onBuildOk;
|
|
9
|
+
exports.onRefresh = onRefresh;
|
|
10
|
+
exports.startReportingRuntimeErrors = startReportingRuntimeErrors;
|
|
11
|
+
exports.stopReportingRuntimeErrors = stopReportingRuntimeErrors;
|
|
7
12
|
const iframeScript_1 = __importDefault(require("iframeScript"));
|
|
8
13
|
const constants_1 = require("./constants");
|
|
9
14
|
const parseStack_1 = require("./view/helpers/parseStack");
|
|
@@ -74,7 +79,6 @@ function startReportingRuntimeErrors({ onError }) {
|
|
|
74
79
|
onUnhandledRejection(ev);
|
|
75
80
|
});
|
|
76
81
|
}
|
|
77
|
-
exports.startReportingRuntimeErrors = startReportingRuntimeErrors;
|
|
78
82
|
function stopReportingRuntimeErrors() {
|
|
79
83
|
if (!isRegistered) {
|
|
80
84
|
return;
|
|
@@ -91,7 +95,6 @@ function stopReportingRuntimeErrors() {
|
|
|
91
95
|
window.removeEventListener('error', onUnhandledError);
|
|
92
96
|
window.removeEventListener('unhandledrejection', onUnhandledRejection);
|
|
93
97
|
}
|
|
94
|
-
exports.stopReportingRuntimeErrors = stopReportingRuntimeErrors;
|
|
95
98
|
function dismissRuntimeErrors() {
|
|
96
99
|
hasRuntimeError = false;
|
|
97
100
|
update();
|
|
@@ -101,17 +104,14 @@ function onBuildOk() {
|
|
|
101
104
|
errorTypeList.push({ type: constants_1.TYPE_BUILD_OK });
|
|
102
105
|
update();
|
|
103
106
|
}
|
|
104
|
-
exports.onBuildOk = onBuildOk;
|
|
105
107
|
function onBuildError(message) {
|
|
106
108
|
hasBuildError = true;
|
|
107
109
|
errorTypeList.push({ type: constants_1.TYPE_BUILD_ERROR, message });
|
|
108
110
|
update();
|
|
109
111
|
}
|
|
110
|
-
exports.onBuildError = onBuildError;
|
|
111
112
|
function onRefresh() {
|
|
112
113
|
errorTypeList.push({ type: constants_1.TYPE_REFRESH });
|
|
113
114
|
}
|
|
114
|
-
exports.onRefresh = onRefresh;
|
|
115
115
|
function applyStyles(element, styles) {
|
|
116
116
|
element.setAttribute('style', '');
|
|
117
117
|
for (const key in styles) {
|
package/lib/iframe-bundle.js
CHANGED
|
@@ -827,7 +827,9 @@
|
|
|
827
827
|
if (hasRequiredErrorTypeHandler) return errorTypeHandler$1;
|
|
828
828
|
hasRequiredErrorTypeHandler = 1;
|
|
829
829
|
Object.defineProperty(errorTypeHandler$1, "__esModule", { value: true });
|
|
830
|
-
errorTypeHandler$1.
|
|
830
|
+
errorTypeHandler$1.emit = emit;
|
|
831
|
+
errorTypeHandler$1.on = on;
|
|
832
|
+
errorTypeHandler$1.off = off;
|
|
831
833
|
let handlers = new Set();
|
|
832
834
|
let queue = [];
|
|
833
835
|
function drain() {
|
|
@@ -849,7 +851,6 @@
|
|
|
849
851
|
queue.push(Object.freeze(Object.assign({}, ev)));
|
|
850
852
|
drain();
|
|
851
853
|
}
|
|
852
|
-
errorTypeHandler$1.emit = emit;
|
|
853
854
|
function on(fn) {
|
|
854
855
|
if (handlers.has(fn)) {
|
|
855
856
|
return false;
|
|
@@ -858,7 +859,6 @@
|
|
|
858
859
|
drain();
|
|
859
860
|
return true;
|
|
860
861
|
}
|
|
861
|
-
errorTypeHandler$1.on = on;
|
|
862
862
|
function off(fn) {
|
|
863
863
|
if (handlers.has(fn)) {
|
|
864
864
|
handlers.delete(fn);
|
|
@@ -866,7 +866,6 @@
|
|
|
866
866
|
}
|
|
867
867
|
return false;
|
|
868
868
|
}
|
|
869
|
-
errorTypeHandler$1.off = off;
|
|
870
869
|
|
|
871
870
|
return errorTypeHandler$1;
|
|
872
871
|
}
|
|
@@ -920,7 +919,7 @@
|
|
|
920
919
|
if (hasRequiredUseOnClickOutside) return useOnClickOutside;
|
|
921
920
|
hasRequiredUseOnClickOutside = 1;
|
|
922
921
|
Object.defineProperty(useOnClickOutside, "__esModule", { value: true });
|
|
923
|
-
useOnClickOutside.useOnClickOutside =
|
|
922
|
+
useOnClickOutside.useOnClickOutside = useOnClickOutside$1;
|
|
924
923
|
const tslib_1 = require$$0$1;
|
|
925
924
|
const React = tslib_1.__importStar(requireReact());
|
|
926
925
|
function useOnClickOutside$1(el, handler) {
|
|
@@ -944,7 +943,6 @@
|
|
|
944
943
|
};
|
|
945
944
|
}, [handler, el]);
|
|
946
945
|
}
|
|
947
|
-
useOnClickOutside.useOnClickOutside = useOnClickOutside$1;
|
|
948
946
|
|
|
949
947
|
return useOnClickOutside;
|
|
950
948
|
}
|
|
@@ -992,7 +990,7 @@
|
|
|
992
990
|
shadowRoot.addEventListener('keydown', handler);
|
|
993
991
|
return () => shadowRoot.removeEventListener('keydown', handler);
|
|
994
992
|
}, [dialog]);
|
|
995
|
-
return ((0, jsx_runtime_1.jsxs)("div",
|
|
993
|
+
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] }));
|
|
996
994
|
};
|
|
997
995
|
Dialog.Dialog = Dialog$1;
|
|
998
996
|
|
|
@@ -1010,7 +1008,7 @@
|
|
|
1010
1008
|
DialogBody.DialogBody = void 0;
|
|
1011
1009
|
const jsx_runtime_1 = jsxRuntimeExports;
|
|
1012
1010
|
const DialogBody$1 = function DialogBody({ children, className }) {
|
|
1013
|
-
return ((0, jsx_runtime_1.jsx)("div",
|
|
1011
|
+
return ((0, jsx_runtime_1.jsx)("div", { "data-dialog-body": true, className: className, children: children }));
|
|
1014
1012
|
};
|
|
1015
1013
|
DialogBody.DialogBody = DialogBody$1;
|
|
1016
1014
|
|
|
@@ -1028,7 +1026,7 @@
|
|
|
1028
1026
|
DialogContent.DialogContent = void 0;
|
|
1029
1027
|
const jsx_runtime_1 = jsxRuntimeExports;
|
|
1030
1028
|
const DialogContent$1 = function DialogContent({ children, className }) {
|
|
1031
|
-
return ((0, jsx_runtime_1.jsx)("div",
|
|
1029
|
+
return ((0, jsx_runtime_1.jsx)("div", { "data-dialog-content": true, className: className, children: children }));
|
|
1032
1030
|
};
|
|
1033
1031
|
DialogContent.DialogContent = DialogContent$1;
|
|
1034
1032
|
|
|
@@ -1046,7 +1044,7 @@
|
|
|
1046
1044
|
DialogHeader.DialogHeader = void 0;
|
|
1047
1045
|
const jsx_runtime_1 = jsxRuntimeExports;
|
|
1048
1046
|
const DialogHeader$1 = function DialogHeader({ children, className }) {
|
|
1049
|
-
return ((0, jsx_runtime_1.jsx)("div",
|
|
1047
|
+
return ((0, jsx_runtime_1.jsx)("div", { "data-dialog-header": true, className: className, children: children }));
|
|
1050
1048
|
};
|
|
1051
1049
|
DialogHeader.DialogHeader = DialogHeader$1;
|
|
1052
1050
|
|
|
@@ -1063,13 +1061,12 @@
|
|
|
1063
1061
|
if (hasRequiredNoopTemplate) return noopTemplate;
|
|
1064
1062
|
hasRequiredNoopTemplate = 1;
|
|
1065
1063
|
Object.defineProperty(noopTemplate, "__esModule", { value: true });
|
|
1066
|
-
noopTemplate.noop =
|
|
1064
|
+
noopTemplate.noop = noop;
|
|
1067
1065
|
function noop(strings, ...keys) {
|
|
1068
1066
|
const lastIndex = strings.length - 1;
|
|
1069
1067
|
return (strings.slice(0, lastIndex).reduce((p, s, i) => p + s + keys[i], '') +
|
|
1070
1068
|
strings[lastIndex]);
|
|
1071
1069
|
}
|
|
1072
|
-
noopTemplate.noop = noop;
|
|
1073
1070
|
|
|
1074
1071
|
return noopTemplate;
|
|
1075
1072
|
}
|
|
@@ -1209,7 +1206,8 @@
|
|
|
1209
1206
|
if (hasRequiredBodyLocker) return bodyLocker;
|
|
1210
1207
|
hasRequiredBodyLocker = 1;
|
|
1211
1208
|
Object.defineProperty(bodyLocker, "__esModule", { value: true });
|
|
1212
|
-
bodyLocker.
|
|
1209
|
+
bodyLocker.lock = lock;
|
|
1210
|
+
bodyLocker.unlock = unlock;
|
|
1213
1211
|
let previousBodyPaddingRight;
|
|
1214
1212
|
let previousBodyOverflowSetting;
|
|
1215
1213
|
let activeLocks = 0;
|
|
@@ -1227,7 +1225,6 @@
|
|
|
1227
1225
|
document.body.style.overflow = 'hidden';
|
|
1228
1226
|
});
|
|
1229
1227
|
}
|
|
1230
|
-
bodyLocker.lock = lock;
|
|
1231
1228
|
function unlock() {
|
|
1232
1229
|
setTimeout(() => {
|
|
1233
1230
|
if (activeLocks === 0 || --activeLocks !== 0) {
|
|
@@ -1243,7 +1240,6 @@
|
|
|
1243
1240
|
}
|
|
1244
1241
|
});
|
|
1245
1242
|
}
|
|
1246
|
-
bodyLocker.unlock = unlock;
|
|
1247
1243
|
|
|
1248
1244
|
return bodyLocker;
|
|
1249
1245
|
}
|
|
@@ -1266,7 +1262,7 @@
|
|
|
1266
1262
|
(0, body_locker_1.unlock)();
|
|
1267
1263
|
};
|
|
1268
1264
|
}, []);
|
|
1269
|
-
return ((0, jsx_runtime_1.jsxs)("div",
|
|
1265
|
+
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] }));
|
|
1270
1266
|
};
|
|
1271
1267
|
Overlay.Overlay = Overlay$1;
|
|
1272
1268
|
|
|
@@ -1991,11 +1987,11 @@
|
|
|
1991
1987
|
remove_empty: true
|
|
1992
1988
|
});
|
|
1993
1989
|
}, [content]);
|
|
1994
|
-
return ((0, jsx_runtime_1.jsx)("div",
|
|
1990
|
+
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'
|
|
1995
1991
|
? { fontWeight: 800 }
|
|
1996
1992
|
: entry.decoration === 'italic'
|
|
1997
1993
|
? { fontStyle: 'italic' }
|
|
1998
|
-
: undefined))
|
|
1994
|
+
: undefined)), children: entry.content }, `terminal-entry-${index}`))) }) }));
|
|
1999
1995
|
};
|
|
2000
1996
|
Terminal.Terminal = Terminal$1;
|
|
2001
1997
|
|
|
@@ -2076,7 +2072,7 @@
|
|
|
2076
2072
|
const noop_template_1 = requireNoopTemplate();
|
|
2077
2073
|
const BuildError$1 = function BuildError({ error }) {
|
|
2078
2074
|
const noop = React.useCallback(() => { }, []);
|
|
2079
|
-
return ((0, jsx_runtime_1.jsx)(Overlay_1.Overlay,
|
|
2075
|
+
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." }) })] })] }) }) }));
|
|
2080
2076
|
};
|
|
2081
2077
|
BuildError.BuildError = BuildError$1;
|
|
2082
2078
|
BuildError.styles = (0, noop_template_1.noop) `
|
|
@@ -2120,7 +2116,7 @@
|
|
|
2120
2116
|
CloseIcon.CloseIcon = void 0;
|
|
2121
2117
|
const jsx_runtime_1 = jsxRuntimeExports;
|
|
2122
2118
|
const CloseIcon$1 = () => {
|
|
2123
|
-
return ((0, jsx_runtime_1.jsxs)("svg",
|
|
2119
|
+
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" })] }));
|
|
2124
2120
|
};
|
|
2125
2121
|
CloseIcon.CloseIcon = CloseIcon$1;
|
|
2126
2122
|
|
|
@@ -2138,7 +2134,7 @@
|
|
|
2138
2134
|
WarningIcon.WarningIcon = void 0;
|
|
2139
2135
|
const jsx_runtime_1 = jsxRuntimeExports;
|
|
2140
2136
|
const WarningIcon$1 = () => {
|
|
2141
|
-
return ((0, jsx_runtime_1.jsxs)("svg",
|
|
2137
|
+
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" })] }));
|
|
2142
2138
|
};
|
|
2143
2139
|
WarningIcon.WarningIcon = WarningIcon$1;
|
|
2144
2140
|
|
|
@@ -2156,7 +2152,7 @@
|
|
|
2156
2152
|
ExternalLinkIcon.ExternalLinkIcon = void 0;
|
|
2157
2153
|
const jsx_runtime_1 = jsxRuntimeExports;
|
|
2158
2154
|
const ExternalLinkIcon$1 = () => {
|
|
2159
|
-
return ((0, jsx_runtime_1.jsxs)("svg",
|
|
2155
|
+
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" })] }));
|
|
2160
2156
|
};
|
|
2161
2157
|
ExternalLinkIcon.ExternalLinkIcon = ExternalLinkIcon$1;
|
|
2162
2158
|
|
|
@@ -2174,7 +2170,7 @@
|
|
|
2174
2170
|
ArrowLeftIcon.ArrowLeftIcon = void 0;
|
|
2175
2171
|
const jsx_runtime_1 = jsxRuntimeExports;
|
|
2176
2172
|
const ArrowLeftIcon$1 = () => {
|
|
2177
|
-
return ((0, jsx_runtime_1.jsx)("svg",
|
|
2173
|
+
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" }) }));
|
|
2178
2174
|
};
|
|
2179
2175
|
ArrowLeftIcon.ArrowLeftIcon = ArrowLeftIcon$1;
|
|
2180
2176
|
|
|
@@ -2192,7 +2188,7 @@
|
|
|
2192
2188
|
ArrowRightIcon.ArrowRightIcon = void 0;
|
|
2193
2189
|
const jsx_runtime_1 = jsxRuntimeExports;
|
|
2194
2190
|
const ArrowRightIcon$1 = () => {
|
|
2195
|
-
return ((0, jsx_runtime_1.jsx)("svg",
|
|
2191
|
+
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" }) }));
|
|
2196
2192
|
};
|
|
2197
2193
|
ArrowRightIcon.ArrowRightIcon = ArrowRightIcon$1;
|
|
2198
2194
|
|
|
@@ -2309,7 +2305,7 @@
|
|
|
2309
2305
|
}
|
|
2310
2306
|
}
|
|
2311
2307
|
}, [nav, next, previous]);
|
|
2312
|
-
return ((0, jsx_runtime_1.jsxs)("div",
|
|
2308
|
+
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] }));
|
|
2313
2309
|
};
|
|
2314
2310
|
NavigationBar.NavigationBar = NavigationBar$1;
|
|
2315
2311
|
|
|
@@ -2418,7 +2414,7 @@
|
|
|
2418
2414
|
Toast.Toast = void 0;
|
|
2419
2415
|
const jsx_runtime_1 = jsxRuntimeExports;
|
|
2420
2416
|
const Toast$1 = function Toast({ onClick, children, className }) {
|
|
2421
|
-
return ((0, jsx_runtime_1.jsx)("div",
|
|
2417
|
+
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 }) }));
|
|
2422
2418
|
};
|
|
2423
2419
|
Toast.Toast = Toast$1;
|
|
2424
2420
|
|
|
@@ -2655,7 +2651,10 @@
|
|
|
2655
2651
|
if (hasRequiredNodeStackFrames) return nodeStackFrames;
|
|
2656
2652
|
hasRequiredNodeStackFrames = 1;
|
|
2657
2653
|
Object.defineProperty(nodeStackFrames, "__esModule", { value: true });
|
|
2658
|
-
nodeStackFrames.
|
|
2654
|
+
nodeStackFrames.getFilesystemFrame = getFilesystemFrame;
|
|
2655
|
+
nodeStackFrames.decorateServerError = decorateServerError;
|
|
2656
|
+
nodeStackFrames.getServerError = getServerError;
|
|
2657
|
+
nodeStackFrames.getErrorSource = getErrorSource;
|
|
2659
2658
|
const stacktrace_parser_1 = require$$0;
|
|
2660
2659
|
const constants_1 = requireConstants$1();
|
|
2661
2660
|
const symbolError = Symbol.for('ShuviError');
|
|
@@ -2674,7 +2673,6 @@
|
|
|
2674
2673
|
}
|
|
2675
2674
|
return f;
|
|
2676
2675
|
}
|
|
2677
|
-
nodeStackFrames.getFilesystemFrame = getFilesystemFrame;
|
|
2678
2676
|
function decorateServerError(error) {
|
|
2679
2677
|
Object.defineProperty(error, symbolError, {
|
|
2680
2678
|
writable: false,
|
|
@@ -2683,7 +2681,6 @@
|
|
|
2683
2681
|
value: constants_1.SERVER_TYPE_ERROR
|
|
2684
2682
|
});
|
|
2685
2683
|
}
|
|
2686
|
-
nodeStackFrames.decorateServerError = decorateServerError;
|
|
2687
2684
|
function getServerError(error) {
|
|
2688
2685
|
let n;
|
|
2689
2686
|
try {
|
|
@@ -2718,11 +2715,9 @@
|
|
|
2718
2715
|
decorateServerError(n);
|
|
2719
2716
|
return n;
|
|
2720
2717
|
}
|
|
2721
|
-
nodeStackFrames.getServerError = getServerError;
|
|
2722
2718
|
function getErrorSource(error) {
|
|
2723
2719
|
return error[symbolError] || null;
|
|
2724
2720
|
}
|
|
2725
|
-
nodeStackFrames.getErrorSource = getErrorSource;
|
|
2726
2721
|
|
|
2727
2722
|
return nodeStackFrames;
|
|
2728
2723
|
}
|
|
@@ -2787,7 +2782,8 @@
|
|
|
2787
2782
|
if (hasRequiredStackFrame) return stackFrame;
|
|
2788
2783
|
hasRequiredStackFrame = 1;
|
|
2789
2784
|
Object.defineProperty(stackFrame, "__esModule", { value: true });
|
|
2790
|
-
stackFrame.
|
|
2785
|
+
stackFrame.getOriginalStackFrames = getOriginalStackFrames;
|
|
2786
|
+
stackFrame.getFrameSource = getFrameSource;
|
|
2791
2787
|
const tslib_1 = require$$0$1;
|
|
2792
2788
|
const constants_1 = requireConstants();
|
|
2793
2789
|
function getOriginalStackFrames(frames, type, errorMessage) {
|
|
@@ -2800,7 +2796,6 @@
|
|
|
2800
2796
|
return yield res.json();
|
|
2801
2797
|
});
|
|
2802
2798
|
}
|
|
2803
|
-
stackFrame.getOriginalStackFrames = getOriginalStackFrames;
|
|
2804
2799
|
function getFrameSource(frame) {
|
|
2805
2800
|
var _a;
|
|
2806
2801
|
let str = '';
|
|
@@ -2836,7 +2831,6 @@
|
|
|
2836
2831
|
}
|
|
2837
2832
|
return str.slice(0, -1);
|
|
2838
2833
|
}
|
|
2839
|
-
stackFrame.getFrameSource = getFrameSource;
|
|
2840
2834
|
|
|
2841
2835
|
return stackFrame;
|
|
2842
2836
|
}
|
|
@@ -2847,7 +2841,7 @@
|
|
|
2847
2841
|
if (hasRequiredGetErrorByType) return getErrorByType;
|
|
2848
2842
|
hasRequiredGetErrorByType = 1;
|
|
2849
2843
|
Object.defineProperty(getErrorByType, "__esModule", { value: true });
|
|
2850
|
-
getErrorByType.getErrorByType =
|
|
2844
|
+
getErrorByType.getErrorByType = getErrorByType$1;
|
|
2851
2845
|
const tslib_1 = require$$0$1;
|
|
2852
2846
|
const constants_1 = requireConstants$1();
|
|
2853
2847
|
const nodeStackFrames_1 = requireNodeStackFrames();
|
|
@@ -2869,7 +2863,6 @@
|
|
|
2869
2863
|
throw new Error('type system invariant violation');
|
|
2870
2864
|
});
|
|
2871
2865
|
}
|
|
2872
|
-
getErrorByType.getErrorByType = getErrorByType$1;
|
|
2873
2866
|
|
|
2874
2867
|
return getErrorByType;
|
|
2875
2868
|
}
|
|
@@ -2963,11 +2956,11 @@
|
|
|
2963
2956
|
console.error('There was an issue opening this code in your editor.');
|
|
2964
2957
|
});
|
|
2965
2958
|
}, [stackFrame]);
|
|
2966
|
-
return ((0, jsx_runtime_1.jsxs)("div",
|
|
2959
|
+
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'
|
|
2967
2960
|
? { fontWeight: 800 }
|
|
2968
2961
|
: entry.decoration === 'italic'
|
|
2969
2962
|
? { fontStyle: 'italic' }
|
|
2970
|
-
: undefined))
|
|
2963
|
+
: undefined)), children: entry.content }, `frame-${index}`))) })] }));
|
|
2971
2964
|
};
|
|
2972
2965
|
CodeFrame.CodeFrame = CodeFrame$1;
|
|
2973
2966
|
|
|
@@ -3022,7 +3015,7 @@
|
|
|
3022
3015
|
console.error('There was an issue opening this code in your editor.');
|
|
3023
3016
|
});
|
|
3024
3017
|
}, [hasSource, f]);
|
|
3025
|
-
return ((0, jsx_runtime_1.jsxs)("div",
|
|
3018
|
+
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, {})] })] }));
|
|
3026
3019
|
};
|
|
3027
3020
|
CallStackFrame.CallStackFrame = CallStackFrame$1;
|
|
3028
3021
|
|
|
@@ -3085,7 +3078,7 @@
|
|
|
3085
3078
|
firstFrame,
|
|
3086
3079
|
visibleCallStackFrames.length
|
|
3087
3080
|
]);
|
|
3088
|
-
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",
|
|
3081
|
+
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] }));
|
|
3089
3082
|
};
|
|
3090
3083
|
Errors.Errors = Errors$1;
|
|
3091
3084
|
|
|
@@ -3324,15 +3317,15 @@
|
|
|
3324
3317
|
return null;
|
|
3325
3318
|
}
|
|
3326
3319
|
if (displayState === 'minimized') {
|
|
3327
|
-
return ((0, jsx_runtime_1.jsx)(Toast_1.Toast,
|
|
3320
|
+
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 => {
|
|
3328
3321
|
e.stopPropagation();
|
|
3329
3322
|
hide();
|
|
3330
|
-
}, "aria-label": "Hide Errors"
|
|
3323
|
+
}, "aria-label": "Hide Errors", children: (0, jsx_runtime_1.jsx)(Icons_1.CloseIcon, {}) })] }) }));
|
|
3331
3324
|
}
|
|
3332
3325
|
const isServerError = (0, nodeStackFrames_1.getErrorSource)(activeError.error) === constants_1.SERVER_TYPE_ERROR;
|
|
3333
|
-
return ((0, jsx_runtime_1.jsx)(Overlay_1.Overlay, { children: (0, jsx_runtime_1.jsx)(Dialog_1.Dialog,
|
|
3326
|
+
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
|
|
3334
3327
|
? 'Server Runtime Error'
|
|
3335
|
-
: 'Unhandled Runtime Error' })
|
|
3328
|
+
: '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()) })] }) }) }));
|
|
3336
3329
|
};
|
|
3337
3330
|
RuntimeError.RuntimeError = RuntimeError$1;
|
|
3338
3331
|
RuntimeError.styles = (0, noop_template_1.noop) `
|
|
@@ -3416,7 +3409,7 @@
|
|
|
3416
3409
|
if (hasRequiredBase) return Base;
|
|
3417
3410
|
hasRequiredBase = 1;
|
|
3418
3411
|
Object.defineProperty(Base, "__esModule", { value: true });
|
|
3419
|
-
Base.Base =
|
|
3412
|
+
Base.Base = Base$1;
|
|
3420
3413
|
const jsx_runtime_1 = jsxRuntimeExports;
|
|
3421
3414
|
const noop_template_1 = requireNoopTemplate();
|
|
3422
3415
|
function Base$1() {
|
|
@@ -3497,7 +3490,6 @@
|
|
|
3497
3490
|
}
|
|
3498
3491
|
` }));
|
|
3499
3492
|
}
|
|
3500
|
-
Base.Base = Base$1;
|
|
3501
3493
|
|
|
3502
3494
|
return Base;
|
|
3503
3495
|
}
|
|
@@ -3510,7 +3502,7 @@
|
|
|
3510
3502
|
if (hasRequiredComponentStyles) return ComponentStyles;
|
|
3511
3503
|
hasRequiredComponentStyles = 1;
|
|
3512
3504
|
Object.defineProperty(ComponentStyles, "__esModule", { value: true });
|
|
3513
|
-
ComponentStyles.ComponentStyles =
|
|
3505
|
+
ComponentStyles.ComponentStyles = ComponentStyles$1;
|
|
3514
3506
|
const jsx_runtime_1 = jsxRuntimeExports;
|
|
3515
3507
|
const Dialog_1 = requireDialog();
|
|
3516
3508
|
const NavigationBar_1 = requireNavigationBar();
|
|
@@ -3534,7 +3526,6 @@
|
|
|
3534
3526
|
${RuntimeError_1.styles}
|
|
3535
3527
|
` }));
|
|
3536
3528
|
}
|
|
3537
|
-
ComponentStyles.ComponentStyles = ComponentStyles$1;
|
|
3538
3529
|
|
|
3539
3530
|
return ComponentStyles;
|
|
3540
3531
|
}
|
|
@@ -3547,7 +3538,7 @@
|
|
|
3547
3538
|
if (hasRequiredCssReset) return CssReset;
|
|
3548
3539
|
hasRequiredCssReset = 1;
|
|
3549
3540
|
Object.defineProperty(CssReset, "__esModule", { value: true });
|
|
3550
|
-
CssReset.CssReset =
|
|
3541
|
+
CssReset.CssReset = CssReset$1;
|
|
3551
3542
|
const jsx_runtime_1 = jsxRuntimeExports;
|
|
3552
3543
|
const noop_template_1 = requireNoopTemplate();
|
|
3553
3544
|
function CssReset$1() {
|
|
@@ -3905,7 +3896,6 @@
|
|
|
3905
3896
|
}
|
|
3906
3897
|
` }));
|
|
3907
3898
|
}
|
|
3908
|
-
CssReset.CssReset = CssReset$1;
|
|
3909
3899
|
|
|
3910
3900
|
return CssReset;
|
|
3911
3901
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StackFrame } from 'stacktrace-parser';
|
|
2
2
|
import type webpack from '@shuvi/toolpack/lib/webpack';
|
|
3
|
-
export
|
|
3
|
+
export type OriginalStackFrameResponse = {
|
|
4
4
|
originalStackFrame: StackFrame;
|
|
5
5
|
originalCodeFrame: string | null;
|
|
6
6
|
};
|
|
@@ -9,18 +9,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.createOriginalStackFrame =
|
|
12
|
+
exports.createOriginalStackFrame = createOriginalStackFrame;
|
|
13
13
|
const code_frame_1 = require("@babel/code-frame");
|
|
14
14
|
const getSourcePath_1 = require("./getSourcePath");
|
|
15
15
|
const getModuleById_1 = require("./getModuleById");
|
|
16
16
|
const findOriginalSourcePositionAndContent_1 = require("./findOriginalSourcePositionAndContent");
|
|
17
|
-
function createOriginalStackFrame(
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
function createOriginalStackFrame(_a) {
|
|
18
|
+
return __awaiter(this, arguments, void 0, function* ({ line, column, source, modulePath, frame, errorMessage, compilation }) {
|
|
19
|
+
var _b, _c, _d, _e, _f, _g, _h;
|
|
20
20
|
const match = errorMessage === null || errorMessage === void 0 ? void 0 : errorMessage.match(/'([^']+)' module/);
|
|
21
21
|
const moduleNotFound = match && match[1];
|
|
22
22
|
const result = moduleNotFound && compilation
|
|
23
|
-
? (
|
|
23
|
+
? (_e = (_d = (_c = (_b = (0, getModuleById_1.getModuleById)(modulePath, compilation)) === null || _b === void 0 ? void 0 : _b.buildInfo) === null || _c === void 0 ? void 0 : _c.importLocByPath) === null || _d === void 0 ? void 0 : _d.get(moduleNotFound)) !== null && _e !== void 0 ? _e : null
|
|
24
24
|
: yield (0, findOriginalSourcePositionAndContent_1.findOriginalSourcePositionAndContent)(source, {
|
|
25
25
|
line,
|
|
26
26
|
column
|
|
@@ -40,13 +40,13 @@ function createOriginalStackFrame({ line, column, source, modulePath, frame, err
|
|
|
40
40
|
methodName: frame.methodName,
|
|
41
41
|
arguments: []
|
|
42
42
|
};
|
|
43
|
-
const originalCodeFrame = !((
|
|
43
|
+
const originalCodeFrame = !((_g = (_f = originalFrame.file) === null || _f === void 0 ? void 0 : _f.includes('node_modules')) !== null && _g !== void 0 ? _g : true) &&
|
|
44
44
|
sourceContent &&
|
|
45
45
|
sourcePosition.line
|
|
46
46
|
? (0, code_frame_1.codeFrameColumns)(sourceContent, {
|
|
47
47
|
start: {
|
|
48
48
|
line: sourcePosition.line,
|
|
49
|
-
column: (
|
|
49
|
+
column: (_h = sourcePosition.column) !== null && _h !== void 0 ? _h : 0
|
|
50
50
|
}
|
|
51
51
|
}, { forceColor: true })
|
|
52
52
|
: null;
|
|
@@ -56,4 +56,3 @@ function createOriginalStackFrame({ line, column, source, modulePath, frame, err
|
|
|
56
56
|
};
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
|
-
exports.createOriginalStackFrame = createOriginalStackFrame;
|
|
@@ -9,13 +9,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.findOriginalSourcePositionAndContent =
|
|
12
|
+
exports.findOriginalSourcePositionAndContent = findOriginalSourcePositionAndContent;
|
|
13
13
|
const source_map_1 = require("source-map");
|
|
14
14
|
// @ts-ignore
|
|
15
15
|
const util_1 = require("source-map/lib/util");
|
|
16
16
|
function findOriginalSourcePositionAndContent(webpackSource, position) {
|
|
17
|
-
var _a, _b;
|
|
18
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
var _a, _b;
|
|
19
19
|
let consumer;
|
|
20
20
|
let content;
|
|
21
21
|
// the webpackSource.map() may be broken, check the validity in advance
|
|
@@ -46,4 +46,3 @@ function findOriginalSourcePositionAndContent(webpackSource, position) {
|
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
-
exports.findOriginalSourcePositionAndContent = findOriginalSourcePositionAndContent;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getModuleById =
|
|
3
|
+
exports.getModuleById = getModuleById;
|
|
4
4
|
function getModuleById(id, compilation) {
|
|
5
5
|
return [...compilation.modules].find(searchModule => compilation.chunkGraph.getModuleId(searchModule) === id);
|
|
6
6
|
}
|
|
7
|
-
exports.getModuleById = getModuleById;
|
|
@@ -9,11 +9,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.getOriginalStackFrame =
|
|
12
|
+
exports.getOriginalStackFrame = getOriginalStackFrame;
|
|
13
13
|
const createOriginalStackFrame_1 = require("./createOriginalStackFrame");
|
|
14
14
|
function getOriginalStackFrame(frame, cache, resolveBuildFile, buildDir, errorMessage, compilation) {
|
|
15
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
16
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
17
17
|
if (!(((_a = frame.file) === null || _a === void 0 ? void 0 : _a.startsWith('webpack-internal:')) ||
|
|
18
18
|
((_b = frame.file) === null || _b === void 0 ? void 0 : _b.startsWith('file:')))) {
|
|
19
19
|
return {
|
|
@@ -76,4 +76,3 @@ function getOriginalStackFrame(frame, cache, resolveBuildFile, buildDir, errorMe
|
|
|
76
76
|
};
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
|
-
exports.getOriginalStackFrame = getOriginalStackFrame;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RawSourceMap } from 'source-map';
|
|
2
2
|
import type { webpack } from '@shuvi/toolpack/lib/webpack';
|
|
3
|
-
export
|
|
3
|
+
export type Source = {
|
|
4
4
|
map: () => RawSourceMap;
|
|
5
5
|
} | null;
|
|
6
6
|
export declare function getSourceById(isFile: boolean, id: string, compiler: webpack.Compiler, resolveBuildFile: (...paths: string[]) => string, buildDir: string, compilation?: webpack.Compilation): Promise<Source>;
|
|
@@ -35,7 +35,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
35
35
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
36
|
};
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.getSourceById =
|
|
38
|
+
exports.getSourceById = getSourceById;
|
|
39
39
|
const data_uri_to_buffer_1 = __importDefault(require("data-uri-to-buffer"));
|
|
40
40
|
const path = __importStar(require("path"));
|
|
41
41
|
const getSourceMapUrl_1 = require("./getSourceMapUrl");
|
|
@@ -95,8 +95,8 @@ function getRawSourceMap(fileUrl, compiler) {
|
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
97
|
function getSourceById(isFile, id, compiler, resolveBuildFile, buildDir, compilation) {
|
|
98
|
-
var _a, _b;
|
|
99
98
|
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
+
var _a, _b;
|
|
100
100
|
if (isFile) {
|
|
101
101
|
const pathName = path.isAbsolute(id)
|
|
102
102
|
? id
|
|
@@ -126,4 +126,3 @@ function getSourceById(isFile, id, compiler, resolveBuildFile, buildDir, compila
|
|
|
126
126
|
}
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
|
-
exports.getSourceById = getSourceById;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getSourceMapUrl =
|
|
3
|
+
exports.getSourceMapUrl = getSourceMapUrl;
|
|
4
4
|
function getSourceMapUrl(fileContents) {
|
|
5
5
|
const regex = /\/\/[#@] ?sourceMappingURL=([^\s'"]+)\s*$/gm;
|
|
6
6
|
let match = null;
|
|
@@ -16,4 +16,3 @@ function getSourceMapUrl(fileContents) {
|
|
|
16
16
|
}
|
|
17
17
|
return match[1].toString();
|
|
18
18
|
}
|
|
19
|
-
exports.getSourceMapUrl = getSourceMapUrl;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getSourcePath =
|
|
3
|
+
exports.getSourcePath = getSourcePath;
|
|
4
4
|
function getSourcePath(source) {
|
|
5
5
|
// Webpack prefixes certain source paths with this path
|
|
6
6
|
if (source.startsWith('webpack:///')) {
|
|
@@ -14,4 +14,3 @@ function getSourcePath(source) {
|
|
|
14
14
|
}
|
|
15
15
|
return source;
|
|
16
16
|
}
|
|
17
|
-
exports.getSourcePath = getSourcePath;
|