@expo/metro-runtime 2.2.7 → 3.0.1
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/README.md +17 -1
- package/async-require.d.ts +1 -1
- package/async-require.js +1 -1
- package/build/HMRClient.d.ts +1 -1
- package/build/HMRClient.d.ts.map +1 -1
- package/build/HMRClient.js +27 -27
- package/build/HMRClient.js.map +1 -1
- package/build/HMRClient.native.js +1 -1
- package/build/HMRClient.native.js.map +1 -1
- package/build/LoadingView.d.ts +1 -1
- package/build/LoadingView.d.ts.map +1 -1
- package/build/LoadingView.js +2 -6
- package/build/LoadingView.js.map +1 -1
- package/build/LoadingView.native.d.ts +2 -0
- package/build/LoadingView.native.d.ts.map +1 -1
- package/build/LoadingView.native.js +6 -1
- package/build/LoadingView.native.js.map +1 -1
- package/build/async-require/buildAsyncRequire.js.map +1 -1
- package/build/async-require/buildUrlForBundle.js +1 -1
- package/build/async-require/buildUrlForBundle.js.map +1 -1
- package/build/async-require/buildUrlForBundle.native.js +5 -4
- package/build/async-require/buildUrlForBundle.native.js.map +1 -1
- package/build/async-require/fetchAsync.d.ts.map +1 -1
- package/build/async-require/fetchAsync.js +2 -2
- package/build/async-require/fetchAsync.js.map +1 -1
- package/build/async-require/fetchAsync.native.d.ts +1 -1
- package/build/async-require/fetchAsync.native.d.ts.map +1 -1
- package/build/async-require/fetchAsync.native.js +10 -10
- package/build/async-require/fetchAsync.native.js.map +1 -1
- package/build/async-require/fetchThenEval.d.ts.map +1 -1
- package/build/async-require/fetchThenEval.js +2 -3
- package/build/async-require/fetchThenEval.js.map +1 -1
- package/build/async-require/fetchThenEval.web.d.ts.map +1 -1
- package/build/async-require/fetchThenEval.web.js +13 -22
- package/build/async-require/fetchThenEval.web.js.map +1 -1
- package/build/async-require/index.js +1 -3
- package/build/async-require/index.js.map +1 -1
- package/build/async-require/loadBundle.d.ts.map +1 -1
- package/build/async-require/loadBundle.js +8 -8
- package/build/async-require/loadBundle.js.map +1 -1
- package/build/effects.js +10 -10
- package/build/effects.js.map +1 -1
- package/build/effects.native.js +0 -1
- package/build/error-overlay/Data/LogBoxData.d.ts +5 -5
- package/build/error-overlay/Data/LogBoxData.d.ts.map +1 -1
- package/build/error-overlay/Data/LogBoxData.js +46 -48
- package/build/error-overlay/Data/LogBoxData.js.map +1 -1
- package/build/error-overlay/Data/LogBoxLog.d.ts +10 -10
- package/build/error-overlay/Data/LogBoxLog.d.ts.map +1 -1
- package/build/error-overlay/Data/LogBoxLog.js +44 -40
- package/build/error-overlay/Data/LogBoxLog.js.map +1 -1
- package/build/error-overlay/Data/LogBoxSymbolication.d.ts +2 -2
- package/build/error-overlay/Data/LogBoxSymbolication.js +5 -5
- package/build/error-overlay/Data/LogBoxSymbolication.js.map +1 -1
- package/build/error-overlay/Data/LogContext.d.ts +2 -2
- package/build/error-overlay/Data/LogContext.d.ts.map +1 -1
- package/build/error-overlay/Data/LogContext.js +4 -4
- package/build/error-overlay/Data/LogContext.js.map +1 -1
- package/build/error-overlay/Data/parseLogBoxLog.d.ts +2 -2
- package/build/error-overlay/Data/parseLogBoxLog.d.ts.map +1 -1
- package/build/error-overlay/Data/parseLogBoxLog.js +26 -31
- package/build/error-overlay/Data/parseLogBoxLog.js.map +1 -1
- package/build/error-overlay/ErrorOverlay.d.ts +10 -3
- package/build/error-overlay/ErrorOverlay.d.ts.map +1 -1
- package/build/error-overlay/ErrorOverlay.js +22 -21
- package/build/error-overlay/ErrorOverlay.js.map +1 -1
- package/build/error-overlay/LogBox.d.ts +2 -2
- package/build/error-overlay/LogBox.d.ts.map +1 -1
- package/build/error-overlay/LogBox.js +0 -1
- package/build/error-overlay/LogBox.js.map +1 -1
- package/build/error-overlay/LogBox.web.d.ts +3 -3
- package/build/error-overlay/LogBox.web.d.ts.map +1 -1
- package/build/error-overlay/LogBox.web.js +9 -12
- package/build/error-overlay/LogBox.web.js.map +1 -1
- package/build/error-overlay/UI/AnsiHighlight.d.ts +2 -2
- package/build/error-overlay/UI/AnsiHighlight.d.ts.map +1 -1
- package/build/error-overlay/UI/AnsiHighlight.js +21 -22
- package/build/error-overlay/UI/AnsiHighlight.js.map +1 -1
- package/build/error-overlay/UI/LogBoxButton.d.ts +1 -1
- package/build/error-overlay/UI/LogBoxButton.d.ts.map +1 -1
- package/build/error-overlay/UI/LogBoxButton.js +3 -5
- package/build/error-overlay/UI/LogBoxButton.js.map +1 -1
- package/build/error-overlay/UI/LogBoxMessage.d.ts +2 -2
- package/build/error-overlay/UI/LogBoxMessage.d.ts.map +1 -1
- package/build/error-overlay/UI/LogBoxMessage.js +4 -4
- package/build/error-overlay/UI/LogBoxMessage.js.map +1 -1
- package/build/error-overlay/UI/LogBoxStyle.d.ts +1 -1
- package/build/error-overlay/UI/LogBoxStyle.js +1 -1
- package/build/error-overlay/UI/LogBoxStyle.js.map +1 -1
- package/build/error-overlay/UI/constants.js +3 -3
- package/build/error-overlay/UI/constants.js.map +1 -1
- package/build/error-overlay/formatProjectFilePath.d.ts +1 -1
- package/build/error-overlay/formatProjectFilePath.d.ts.map +1 -1
- package/build/error-overlay/formatProjectFilePath.js +5 -7
- package/build/error-overlay/formatProjectFilePath.js.map +1 -1
- package/build/error-overlay/index.d.ts +1 -1
- package/build/error-overlay/index.d.ts.map +1 -1
- package/build/error-overlay/index.js +6 -5
- package/build/error-overlay/index.js.map +1 -1
- package/build/error-overlay/modules/ExceptionsManager/index.d.ts +1 -1
- package/build/error-overlay/modules/ExceptionsManager/index.d.ts.map +1 -1
- package/build/error-overlay/modules/ExceptionsManager/index.js +9 -14
- package/build/error-overlay/modules/ExceptionsManager/index.js.map +1 -1
- package/build/error-overlay/modules/ExceptionsManager/index.native.d.ts +2 -1
- package/build/error-overlay/modules/ExceptionsManager/index.native.d.ts.map +1 -1
- package/build/error-overlay/modules/ExceptionsManager/index.native.js +7 -2
- package/build/error-overlay/modules/ExceptionsManager/index.native.js.map +1 -1
- package/build/error-overlay/modules/NativeLogBox/index.d.ts.map +1 -1
- package/build/error-overlay/modules/NativeLogBox/index.js +5 -5
- package/build/error-overlay/modules/NativeLogBox/index.js.map +1 -1
- package/build/error-overlay/modules/NativeLogBox/index.native.d.ts +1 -1
- package/build/error-overlay/modules/NativeLogBox/index.native.d.ts.map +1 -1
- package/build/error-overlay/modules/NativeLogBox/index.native.js +0 -1
- package/build/error-overlay/modules/NativeLogBox/index.native.js.map +1 -1
- package/build/error-overlay/modules/openFileInEditor/index.js +4 -4
- package/build/error-overlay/modules/openFileInEditor/index.js.map +1 -1
- package/build/error-overlay/modules/openFileInEditor/index.native.d.ts +1 -1
- package/build/error-overlay/modules/openFileInEditor/index.native.d.ts.map +1 -1
- package/build/error-overlay/modules/openFileInEditor/index.native.js +0 -1
- package/build/error-overlay/modules/openFileInEditor/index.native.js.map +1 -1
- package/build/error-overlay/modules/parseErrorStack/index.d.ts +1 -1
- package/build/error-overlay/modules/parseErrorStack/index.d.ts.map +1 -1
- package/build/error-overlay/modules/parseErrorStack/index.js +5 -5
- package/build/error-overlay/modules/parseErrorStack/index.js.map +1 -1
- package/build/error-overlay/modules/parseErrorStack/parseHermesStack.d.ts +1 -1
- package/build/error-overlay/modules/parseErrorStack/parseHermesStack.js.map +1 -1
- package/build/error-overlay/modules/stringifySafe/index.d.ts +1 -1
- package/build/error-overlay/modules/stringifySafe/index.d.ts.map +1 -1
- package/build/error-overlay/modules/stringifySafe/index.js +14 -16
- package/build/error-overlay/modules/stringifySafe/index.js.map +1 -1
- package/build/error-overlay/modules/symbolicateStackTrace/index.d.ts +2 -2
- package/build/error-overlay/modules/symbolicateStackTrace/index.d.ts.map +1 -1
- package/build/error-overlay/modules/symbolicateStackTrace/index.js +5 -5
- package/build/error-overlay/modules/symbolicateStackTrace/index.js.map +1 -1
- package/build/error-overlay/modules/symbolicateStackTrace/index.native.d.ts +1 -1
- package/build/error-overlay/modules/symbolicateStackTrace/index.native.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.d.ts +2 -2
- package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.d.ts.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.js +10 -11
- package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorFooter.d.ts.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorFooter.js +27 -24
- package/build/error-overlay/overlay/LogBoxInspectorFooter.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorHeader.d.ts +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorHeader.d.ts.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorHeader.js +18 -18
- package/build/error-overlay/overlay/LogBoxInspectorHeader.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.d.ts +2 -2
- package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.d.ts.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.js +6 -6
- package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorSection.d.ts +2 -2
- package/build/error-overlay/overlay/LogBoxInspectorSection.js +4 -4
- package/build/error-overlay/overlay/LogBoxInspectorSection.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.d.ts +2 -2
- package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.d.ts.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.js +13 -13
- package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorStackFrame.d.ts +2 -2
- package/build/error-overlay/overlay/LogBoxInspectorStackFrame.d.ts.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorStackFrame.js +9 -9
- package/build/error-overlay/overlay/LogBoxInspectorStackFrame.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorStackFrames.d.ts +2 -2
- package/build/error-overlay/overlay/LogBoxInspectorStackFrames.d.ts.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorStackFrames.js +24 -27
- package/build/error-overlay/overlay/LogBoxInspectorStackFrames.js.map +1 -1
- package/build/error-overlay/toast/ErrorToast.d.ts +2 -2
- package/build/error-overlay/toast/ErrorToast.d.ts.map +1 -1
- package/build/error-overlay/toast/ErrorToast.js +35 -34
- package/build/error-overlay/toast/ErrorToast.js.map +1 -1
- package/build/error-overlay/toast/ErrorToastContainer.d.ts +1 -1
- package/build/error-overlay/toast/ErrorToastContainer.js.map +1 -1
- package/build/error-overlay/toast/ErrorToastContainer.web.d.ts +2 -2
- package/build/error-overlay/toast/ErrorToastContainer.web.d.ts.map +1 -1
- package/build/error-overlay/toast/ErrorToastContainer.web.js +6 -5
- package/build/error-overlay/toast/ErrorToastContainer.web.js.map +1 -1
- package/build/error-overlay/toast/ErrorToastMessage.d.ts +1 -1
- package/build/error-overlay/toast/ErrorToastMessage.d.ts.map +1 -1
- package/build/error-overlay/toast/ErrorToastMessage.js +4 -4
- package/build/error-overlay/toast/ErrorToastMessage.js.map +1 -1
- package/build/error-overlay/useRejectionHandler.d.ts +1 -1
- package/build/error-overlay/useRejectionHandler.d.ts.map +1 -1
- package/build/error-overlay/useRejectionHandler.js +11 -12
- package/build/error-overlay/useRejectionHandler.js.map +1 -1
- package/build/getDevServer.d.ts.map +1 -1
- package/build/getDevServer.js +4 -5
- package/build/getDevServer.js.map +1 -1
- package/build/getDevServer.native.d.ts +2 -0
- package/build/getDevServer.native.d.ts.map +1 -1
- package/build/getDevServer.native.js +6 -1
- package/build/getDevServer.native.js.map +1 -1
- package/build/index.d.ts +1 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +4 -4
- package/build/index.js.map +1 -1
- package/build/location/Location.native.d.ts.map +1 -1
- package/build/location/Location.native.js +21 -20
- package/build/location/Location.native.js.map +1 -1
- package/build/location/install.js +0 -1
- package/build/location/install.native.d.ts +1 -1
- package/build/location/install.native.js +16 -22
- package/build/location/install.native.js.map +1 -1
- package/build/messageSocket.d.ts.map +1 -1
- package/build/messageSocket.js +5 -6
- package/build/messageSocket.js.map +1 -1
- package/build/setupFastRefresh.d.ts.map +1 -1
- package/build/setupFastRefresh.js +2 -4
- package/build/setupFastRefresh.js.map +1 -1
- package/build/setupHMR.js +1 -3
- package/build/setupHMR.js.map +1 -1
- package/build/symbolicate.d.ts +3 -3
- package/build/symbolicate.js.map +1 -1
- package/error-overlay.d.ts +1 -1
- package/error-overlay.js +1 -1
- package/package.json +25 -14
- package/LICENSE +0 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogBoxLog.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogBoxLog.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"LogBoxLog.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogBoxLog.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAErF,KAAK,mBAAmB,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEtE,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAExE,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,QAAQ,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,cAAc,CAAC;IAC/B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,IAAI,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,GAAG,IAAI;IAIzF,WAAW,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,GAAG,IAAI;IAIpF,OAAO,CAAC,YAAY;IAwBpB,OAAO,CAAC,mBAAmB,CAAsB;IAEjD,OAAO,CAAC,QAAQ;IAUhB,OAAO,CAAC,iBAAiB;IAkBzB,OAAO,CAAC,YAAY;CAsCrB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 650 Industries.
|
|
4
4
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
5
5
|
*
|
|
6
6
|
* This source code is licensed under the MIT license found in the
|
|
@@ -33,36 +33,40 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
33
33
|
exports.LogBoxLog = void 0;
|
|
34
34
|
const LogBoxSymbolication = __importStar(require("./LogBoxSymbolication"));
|
|
35
35
|
function componentStackToStack(componentStack) {
|
|
36
|
-
return componentStack.map((stack) => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
arguments: [],
|
|
44
|
-
});
|
|
45
|
-
});
|
|
36
|
+
return componentStack.map((stack) => ({
|
|
37
|
+
file: stack.fileName,
|
|
38
|
+
methodName: stack.content,
|
|
39
|
+
lineNumber: stack.location?.row ?? 0,
|
|
40
|
+
column: stack.location?.column ?? 0,
|
|
41
|
+
arguments: [],
|
|
42
|
+
}));
|
|
46
43
|
}
|
|
47
44
|
class LogBoxLog {
|
|
45
|
+
message;
|
|
46
|
+
type;
|
|
47
|
+
category;
|
|
48
|
+
componentStack;
|
|
49
|
+
stack;
|
|
50
|
+
count;
|
|
51
|
+
level;
|
|
52
|
+
codeFrame;
|
|
53
|
+
isComponentError;
|
|
54
|
+
symbolicated = {
|
|
55
|
+
stack: {
|
|
56
|
+
error: null,
|
|
57
|
+
stack: null,
|
|
58
|
+
status: 'NONE',
|
|
59
|
+
},
|
|
60
|
+
component: {
|
|
61
|
+
error: null,
|
|
62
|
+
stack: null,
|
|
63
|
+
status: 'NONE',
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
callbacks = new Map();
|
|
48
67
|
constructor(data) {
|
|
49
|
-
var _a, _b;
|
|
50
|
-
this.symbolicated = {
|
|
51
|
-
stack: {
|
|
52
|
-
error: null,
|
|
53
|
-
stack: null,
|
|
54
|
-
status: "NONE",
|
|
55
|
-
},
|
|
56
|
-
component: {
|
|
57
|
-
error: null,
|
|
58
|
-
stack: null,
|
|
59
|
-
status: "NONE",
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
this.callbacks = new Map();
|
|
63
|
-
this.componentStackCache = null;
|
|
64
68
|
this.level = data.level;
|
|
65
|
-
this.type =
|
|
69
|
+
this.type = data.type ?? 'error';
|
|
66
70
|
this.message = data.message;
|
|
67
71
|
this.stack = data.stack;
|
|
68
72
|
this.category = data.category;
|
|
@@ -70,13 +74,13 @@ class LogBoxLog {
|
|
|
70
74
|
this.codeFrame = data.codeFrame;
|
|
71
75
|
this.isComponentError = data.isComponentError;
|
|
72
76
|
this.count = 1;
|
|
73
|
-
this.symbolicated =
|
|
77
|
+
this.symbolicated = data.symbolicated ?? this.symbolicated;
|
|
74
78
|
}
|
|
75
79
|
incrementCount() {
|
|
76
80
|
this.count += 1;
|
|
77
81
|
}
|
|
78
82
|
getAvailableStack(type) {
|
|
79
|
-
if (this.symbolicated[type].status ===
|
|
83
|
+
if (this.symbolicated[type].status === 'COMPLETE') {
|
|
80
84
|
return this.symbolicated[type].stack;
|
|
81
85
|
}
|
|
82
86
|
return this.getStack(type);
|
|
@@ -110,7 +114,7 @@ class LogBoxLog {
|
|
|
110
114
|
this.pushCallback(type, callback);
|
|
111
115
|
}
|
|
112
116
|
const status = this.symbolicated[type].status;
|
|
113
|
-
if (status ===
|
|
117
|
+
if (status === 'COMPLETE') {
|
|
114
118
|
return this.flushCallbacks(type);
|
|
115
119
|
}
|
|
116
120
|
if (retry) {
|
|
@@ -118,13 +122,14 @@ class LogBoxLog {
|
|
|
118
122
|
this.handleSymbolicate(type);
|
|
119
123
|
}
|
|
120
124
|
else {
|
|
121
|
-
if (status ===
|
|
125
|
+
if (status === 'NONE') {
|
|
122
126
|
this.handleSymbolicate(type);
|
|
123
127
|
}
|
|
124
128
|
}
|
|
125
129
|
}
|
|
130
|
+
componentStackCache = null;
|
|
126
131
|
getStack(type) {
|
|
127
|
-
if (type ===
|
|
132
|
+
if (type === 'component') {
|
|
128
133
|
if (this.componentStackCache == null) {
|
|
129
134
|
this.componentStackCache = componentStackToStack(this.componentStack);
|
|
130
135
|
}
|
|
@@ -133,14 +138,13 @@ class LogBoxLog {
|
|
|
133
138
|
return this.stack;
|
|
134
139
|
}
|
|
135
140
|
handleSymbolicate(type) {
|
|
136
|
-
|
|
137
|
-
if (type === "component" && !((_a = this.componentStack) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
141
|
+
if (type === 'component' && !this.componentStack?.length) {
|
|
138
142
|
return;
|
|
139
143
|
}
|
|
140
|
-
if (this.symbolicated[type].status !==
|
|
144
|
+
if (this.symbolicated[type].status !== 'PENDING') {
|
|
141
145
|
this.updateStatus(type, null, null, null);
|
|
142
146
|
LogBoxSymbolication.symbolicate(this.getStack(type)).then((data) => {
|
|
143
|
-
this.updateStatus(type, null, data
|
|
147
|
+
this.updateStatus(type, null, data?.stack, data?.codeFrame);
|
|
144
148
|
}, (error) => {
|
|
145
149
|
this.updateStatus(type, error, null, null);
|
|
146
150
|
});
|
|
@@ -152,7 +156,7 @@ class LogBoxLog {
|
|
|
152
156
|
this.symbolicated[type] = {
|
|
153
157
|
error,
|
|
154
158
|
stack: null,
|
|
155
|
-
status:
|
|
159
|
+
status: 'FAILED',
|
|
156
160
|
};
|
|
157
161
|
}
|
|
158
162
|
else if (stack != null) {
|
|
@@ -162,19 +166,19 @@ class LogBoxLog {
|
|
|
162
166
|
this.symbolicated[type] = {
|
|
163
167
|
error: null,
|
|
164
168
|
stack,
|
|
165
|
-
status:
|
|
169
|
+
status: 'COMPLETE',
|
|
166
170
|
};
|
|
167
171
|
}
|
|
168
172
|
else {
|
|
169
173
|
this.symbolicated[type] = {
|
|
170
174
|
error: null,
|
|
171
175
|
stack: null,
|
|
172
|
-
status:
|
|
176
|
+
status: 'PENDING',
|
|
173
177
|
};
|
|
174
178
|
}
|
|
175
179
|
const status = this.symbolicated[type].status;
|
|
176
180
|
if (lastStatus !== status) {
|
|
177
|
-
if ([
|
|
181
|
+
if (['COMPLETE', 'FAILED'].includes(status)) {
|
|
178
182
|
this.flushCallbacks(type);
|
|
179
183
|
}
|
|
180
184
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogBoxLog.js","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogBoxLog.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2EAA6D;AA0B7D,SAAS,qBAAqB,CAAC,cAA8B;IAC3D,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;;QAAC,OAAA,CAAC;YACpC,IAAI,EAAE,KAAK,CAAC,QAAQ;YACpB,UAAU,EAAE,KAAK,CAAC,OAAO;YACzB,UAAU,EAAE,MAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,GAAG,mCAAI,CAAC;YACpC,MAAM,EAAE,MAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,MAAM,mCAAI,CAAC;YACnC,SAAS,EAAE,EAAE;SACd,CAAC,CAAA;KAAA,CAAC,CAAC;AACN,CAAC;AAUD,MAAa,SAAS;IAyBpB,YACE,IAEC;;QAlBH,iBAAY,GAA2C;YACrD,KAAK,EAAE;gB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CACF,CAAC;SACH;IACH,CAAC;IAEO,YAAY,CAClB,IAAe,EACf,KAAoB,EACpB,KAAoB,EACpB,SAA4B;QAE5B,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;QAClD,IAAI,KAAK,IAAI,IAAI,EAAE;YACjB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG;gBACxB,KAAK;gBACL,KAAK,EAAE,IAAI;gBACX,MAAM,EAAE,QAAQ;aACjB,CAAC;SACH;aAAM,IAAI,KAAK,IAAI,IAAI,EAAE;YACxB,IAAI,SAAS,EAAE;gBACb,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;aAC5B;YAED,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG;gBACxB,KAAK,EAAE,IAAI;gBACX,KAAK;gBACL,MAAM,EAAE,UAAU;aACnB,CAAC;SACH;aAAM;YACL,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG;gBACxB,KAAK,EAAE,IAAI;gBACX,KAAK,EAAE,IAAI;gBACX,MAAM,EAAE,SAAS;aAClB,CAAC;SACH;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;QAC9C,IAAI,UAAU,KAAK,MAAM,EAAE;YACzB,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;gBAC3C,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;aAC3B;SACF;IACH,CAAC;CACF;AAnLD,8BAmLC","sourcesContent":["/**\n * Copyright (c) Evan Bacon.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport * as LogBoxSymbolication from \"./LogBoxSymbolication\";\nimport type { Stack } from \"./LogBoxSymbolication\";\nimport type {\n Category,\n Message,\n ComponentStack,\n CodeFrame,\n} from \"./parseLogBoxLog\";\n\ntype SymbolicationStatus = \"NONE\" | \"PENDING\" | \"COMPLETE\" | \"FAILED\";\n\nexport type LogLevel = \"warn\" | \"error\" | \"fatal\" | \"syntax\" | \"static\";\n\nexport type LogBoxLogData = {\n level: LogLevel;\n type?: string;\n message: Message;\n stack: Stack;\n category: string;\n componentStack: ComponentStack;\n codeFrame?: CodeFrame;\n isComponentError: boolean;\n};\n\nexport type StackType = \"stack\" | \"component\";\n\nfunction componentStackToStack(componentStack: ComponentStack): Stack {\n return componentStack.map((stack) => ({\n file: stack.fileName,\n methodName: stack.content,\n lineNumber: stack.location?.row ?? 0,\n column: stack.location?.column ?? 0,\n arguments: [],\n }));\n}\n\ntype SymbolicationCallback = (status: SymbolicationStatus) => void;\n\ntype SymbolicationResult =\n | { error: null; stack: null; status: \"NONE\" }\n | { error: null; stack: null; status: \"PENDING\" }\n | { error: null; stack: Stack; status: \"COMPLETE\" }\n | { error: Error; stack: null; status: \"FAILED\" };\n\nexport class LogBoxLog {\n message: Message;\n type: string;\n category: Category;\n componentStack: ComponentStack;\n stack: Stack;\n count: number;\n level: LogLevel;\n codeFrame?: CodeFrame;\n isComponentError: boolean;\n symbolicated: Record<StackType, SymbolicationResult> = {\n stack: {\n error: null,\n stack: null,\n status: \"NONE\",\n },\n component: {\n error: null,\n stack: null,\n status: \"NONE\",\n },\n };\n\n private callbacks: Map<StackType, Set<SymbolicationCallback>> = new Map();\n\n constructor(\n data: LogBoxLogData & {\n symbolicated?: Record<StackType, SymbolicationResult>;\n }\n ) {\n this.level = data.level;\n this.type = data.type ?? \"error\";\n this.message = data.message;\n this.stack = data.stack;\n this.category = data.category;\n this.componentStack = data.componentStack;\n this.codeFrame = data.codeFrame;\n this.isComponentError = data.isComponentError;\n this.count = 1;\n this.symbolicated = data.symbolicated ?? this.symbolicated;\n }\n\n incrementCount(): void {\n this.count += 1;\n }\n\n getAvailableStack(type: StackType): Stack | null {\n if (this.symbolicated[type].status === \"COMPLETE\") {\n return this.symbolicated[type].stack;\n }\n return this.getStack(type);\n }\n\n private flushCallbacks(type: StackType): void {\n const callbacks = this.callbacks.get(type);\n const status = this.symbolicated[type].status;\n if (callbacks) {\n for (const callback of callbacks) {\n callback(status);\n }\n callbacks.clear();\n }\n }\n\n private pushCallback(type: StackType, callback: SymbolicationCallback): void {\n let callbacks = this.callbacks.get(type);\n if (!callbacks) {\n callbacks = new Set();\n this.callbacks.set(type, callbacks);\n }\n callbacks.add(callback);\n }\n\n retrySymbolicate(\n type: StackType,\n callback?: (status: SymbolicationStatus) => void\n ): void {\n this._symbolicate(type, true, callback);\n }\n\n symbolicate(\n type: StackType,\n callback?: (status: SymbolicationStatus) => void\n ): void {\n this._symbolicate(type, false, callback);\n }\n\n private _symbolicate(\n type: StackType,\n retry: boolean,\n callback?: (status: SymbolicationStatus) => void\n ): void {\n if (callback) {\n this.pushCallback(type, callback);\n }\n const status = this.symbolicated[type].status;\n\n if (status === \"COMPLETE\") {\n return this.flushCallbacks(type);\n }\n\n if (retry) {\n LogBoxSymbolication.deleteStack(this.getStack(type));\n this.handleSymbolicate(type);\n } else {\n if (status === \"NONE\") {\n this.handleSymbolicate(type);\n }\n }\n }\n\n private componentStackCache: Stack | null = null;\n\n private getStack(type: StackType): Stack {\n if (type === \"component\") {\n if (this.componentStackCache == null) {\n this.componentStackCache = componentStackToStack(this.componentStack);\n }\n return this.componentStackCache;\n }\n return this.stack;\n }\n\n private handleSymbolicate(type: StackType): void {\n if (type === \"component\" && !this.componentStack?.length) {\n return;\n }\n\n if (this.symbolicated[type].status !== \"PENDING\") {\n this.updateStatus(type, null, null, null);\n LogBoxSymbolication.symbolicate(this.getStack(type)).then(\n (data) => {\n this.updateStatus(type, null, data?.stack, data?.codeFrame);\n },\n (error) => {\n this.updateStatus(type, error, null, null);\n }\n );\n }\n }\n\n private updateStatus(\n type: StackType,\n error?: Error | null,\n stack?: Stack | null,\n codeFrame?: CodeFrame | null\n ): void {\n const lastStatus = this.symbolicated[type].status;\n if (error != null) {\n this.symbolicated[type] = {\n error,\n stack: null,\n status: \"FAILED\",\n };\n } else if (stack != null) {\n if (codeFrame) {\n this.codeFrame = codeFrame;\n }\n\n this.symbolicated[type] = {\n error: null,\n stack,\n status: \"COMPLETE\",\n };\n } else {\n this.symbolicated[type] = {\n error: null,\n stack: null,\n status: \"PENDING\",\n };\n }\n\n const status = this.symbolicated[type].status;\n if (lastStatus !== status) {\n if ([\"COMPLETE\", \"FAILED\"].includes(status)) {\n this.flushCallbacks(type);\n }\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"LogBoxLog.js","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogBoxLog.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2EAA6D;AAqB7D,SAAS,qBAAqB,CAAC,cAA8B;IAC3D,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACpC,IAAI,EAAE,KAAK,CAAC,QAAQ;QACpB,UAAU,EAAE,KAAK,CAAC,OAAO;QACzB,UAAU,EAAE,KAAK,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC;QACpC,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;QACnC,SAAS,EAAE,EAAE;KACd,CAAC,CAAC,CAAC;AACN,CAAC;AAUD,MAAa,SAAS;IACpB,OAAO,CAAU;IACjB,IAAI,CAAS;IACb,QAAQ,CAAW;IACnB,cAAc,CAAiB;IAC/B,KAAK,CAAQ;IACb,KAAK,CAAS;IACd,KAAK,CAAW;IAChB,SAAS,CAAa;IACtB,gBAAgB,CAAU;IAC1B,YAAY,GAA2C;QACrD,KAAK,EAAE;YACL,KAAK,EAAE,IAAI;YACX,KAAK,EAAE,IAAI;YACX,MAAM,EAAE,MAAM;SACf;QACD,SAAS,EAAE;YACT,KAAK,EAAE,IAAI;YACX,KAAK,EAAE,IAAI;YACX,MAAM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AAY,CAAC,IAAI,CAAC,GAAG;gBACxB,KAAK;gBACL,KAAK,EAAE,IAAI;gBACX,MAAM,EAAE,QAAQ;aACjB,CAAC;SACH;aAAM,IAAI,KAAK,IAAI,IAAI,EAAE;YACxB,IAAI,SAAS,EAAE;gBACb,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;aAC5B;YAED,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG;gBACxB,KAAK,EAAE,IAAI;gBACX,KAAK;gBACL,MAAM,EAAE,UAAU;aACnB,CAAC;SACH;aAAM;YACL,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG;gBACxB,KAAK,EAAE,IAAI;gBACX,KAAK,EAAE,IAAI;gBACX,MAAM,EAAE,SAAS;aAClB,CAAC;SACH;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;QAC9C,IAAI,UAAU,KAAK,MAAM,EAAE;YACzB,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;gBAC3C,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;aAC3B;SACF;IACH,CAAC;CACF;AA7KD,8BA6KC","sourcesContent":["/**\n * Copyright (c) 650 Industries.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport * as LogBoxSymbolication from './LogBoxSymbolication';\nimport type { Stack } from './LogBoxSymbolication';\nimport type { Category, Message, ComponentStack, CodeFrame } from './parseLogBoxLog';\n\ntype SymbolicationStatus = 'NONE' | 'PENDING' | 'COMPLETE' | 'FAILED';\n\nexport type LogLevel = 'warn' | 'error' | 'fatal' | 'syntax' | 'static';\n\nexport type LogBoxLogData = {\n level: LogLevel;\n type?: string;\n message: Message;\n stack: Stack;\n category: string;\n componentStack: ComponentStack;\n codeFrame?: CodeFrame;\n isComponentError: boolean;\n};\n\nexport type StackType = 'stack' | 'component';\n\nfunction componentStackToStack(componentStack: ComponentStack): Stack {\n return componentStack.map((stack) => ({\n file: stack.fileName,\n methodName: stack.content,\n lineNumber: stack.location?.row ?? 0,\n column: stack.location?.column ?? 0,\n arguments: [],\n }));\n}\n\ntype SymbolicationCallback = (status: SymbolicationStatus) => void;\n\ntype SymbolicationResult =\n | { error: null; stack: null; status: 'NONE' }\n | { error: null; stack: null; status: 'PENDING' }\n | { error: null; stack: Stack; status: 'COMPLETE' }\n | { error: Error; stack: null; status: 'FAILED' };\n\nexport class LogBoxLog {\n message: Message;\n type: string;\n category: Category;\n componentStack: ComponentStack;\n stack: Stack;\n count: number;\n level: LogLevel;\n codeFrame?: CodeFrame;\n isComponentError: boolean;\n symbolicated: Record<StackType, SymbolicationResult> = {\n stack: {\n error: null,\n stack: null,\n status: 'NONE',\n },\n component: {\n error: null,\n stack: null,\n status: 'NONE',\n },\n };\n\n private callbacks: Map<StackType, Set<SymbolicationCallback>> = new Map();\n\n constructor(\n data: LogBoxLogData & {\n symbolicated?: Record<StackType, SymbolicationResult>;\n }\n ) {\n this.level = data.level;\n this.type = data.type ?? 'error';\n this.message = data.message;\n this.stack = data.stack;\n this.category = data.category;\n this.componentStack = data.componentStack;\n this.codeFrame = data.codeFrame;\n this.isComponentError = data.isComponentError;\n this.count = 1;\n this.symbolicated = data.symbolicated ?? this.symbolicated;\n }\n\n incrementCount(): void {\n this.count += 1;\n }\n\n getAvailableStack(type: StackType): Stack | null {\n if (this.symbolicated[type].status === 'COMPLETE') {\n return this.symbolicated[type].stack;\n }\n return this.getStack(type);\n }\n\n private flushCallbacks(type: StackType): void {\n const callbacks = this.callbacks.get(type);\n const status = this.symbolicated[type].status;\n if (callbacks) {\n for (const callback of callbacks) {\n callback(status);\n }\n callbacks.clear();\n }\n }\n\n private pushCallback(type: StackType, callback: SymbolicationCallback): void {\n let callbacks = this.callbacks.get(type);\n if (!callbacks) {\n callbacks = new Set();\n this.callbacks.set(type, callbacks);\n }\n callbacks.add(callback);\n }\n\n retrySymbolicate(type: StackType, callback?: (status: SymbolicationStatus) => void): void {\n this._symbolicate(type, true, callback);\n }\n\n symbolicate(type: StackType, callback?: (status: SymbolicationStatus) => void): void {\n this._symbolicate(type, false, callback);\n }\n\n private _symbolicate(\n type: StackType,\n retry: boolean,\n callback?: (status: SymbolicationStatus) => void\n ): void {\n if (callback) {\n this.pushCallback(type, callback);\n }\n const status = this.symbolicated[type].status;\n\n if (status === 'COMPLETE') {\n return this.flushCallbacks(type);\n }\n\n if (retry) {\n LogBoxSymbolication.deleteStack(this.getStack(type));\n this.handleSymbolicate(type);\n } else {\n if (status === 'NONE') {\n this.handleSymbolicate(type);\n }\n }\n }\n\n private componentStackCache: Stack | null = null;\n\n private getStack(type: StackType): Stack {\n if (type === 'component') {\n if (this.componentStackCache == null) {\n this.componentStackCache = componentStackToStack(this.componentStack);\n }\n return this.componentStackCache;\n }\n return this.stack;\n }\n\n private handleSymbolicate(type: StackType): void {\n if (type === 'component' && !this.componentStack?.length) {\n return;\n }\n\n if (this.symbolicated[type].status !== 'PENDING') {\n this.updateStatus(type, null, null, null);\n LogBoxSymbolication.symbolicate(this.getStack(type)).then(\n (data) => {\n this.updateStatus(type, null, data?.stack, data?.codeFrame);\n },\n (error) => {\n this.updateStatus(type, error, null, null);\n }\n );\n }\n }\n\n private updateStatus(\n type: StackType,\n error?: Error | null,\n stack?: Stack | null,\n codeFrame?: CodeFrame | null\n ): void {\n const lastStatus = this.symbolicated[type].status;\n if (error != null) {\n this.symbolicated[type] = {\n error,\n stack: null,\n status: 'FAILED',\n };\n } else if (stack != null) {\n if (codeFrame) {\n this.codeFrame = codeFrame;\n }\n\n this.symbolicated[type] = {\n error: null,\n stack,\n status: 'COMPLETE',\n };\n } else {\n this.symbolicated[type] = {\n error: null,\n stack: null,\n status: 'PENDING',\n };\n }\n\n const status = this.symbolicated[type].status;\n if (lastStatus !== status) {\n if (['COMPLETE', 'FAILED'].includes(status)) {\n this.flushCallbacks(type);\n }\n }\n }\n}\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 650 Industries.
|
|
3
3
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
|
-
import { StackFrame as UpstreamStackFrame } from
|
|
8
|
+
import { StackFrame as UpstreamStackFrame } from 'stacktrace-parser';
|
|
9
9
|
type SymbolicatedStackTrace = any;
|
|
10
10
|
type StackFrame = UpstreamStackFrame & {
|
|
11
11
|
collapse?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 650 Industries.
|
|
4
4
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
5
5
|
*
|
|
6
6
|
* This source code is licensed under the MIT license found in the
|
|
@@ -18,14 +18,14 @@ const cache = new Map();
|
|
|
18
18
|
*/
|
|
19
19
|
const sanitize = ({ stack: maybeStack, codeFrame, }) => {
|
|
20
20
|
if (!Array.isArray(maybeStack)) {
|
|
21
|
-
throw new Error(
|
|
21
|
+
throw new Error('Expected stack to be an array.');
|
|
22
22
|
}
|
|
23
23
|
const stack = [];
|
|
24
24
|
for (const maybeFrame of maybeStack) {
|
|
25
25
|
let collapse = false;
|
|
26
|
-
if (
|
|
27
|
-
if (typeof maybeFrame.collapse !==
|
|
28
|
-
throw new Error(
|
|
26
|
+
if ('collapse' in maybeFrame) {
|
|
27
|
+
if (typeof maybeFrame.collapse !== 'boolean') {
|
|
28
|
+
throw new Error('Expected stack frame `collapse` to be a boolean.');
|
|
29
29
|
}
|
|
30
30
|
collapse = maybeFrame.collapse;
|
|
31
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version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I,IAAI,EAAE;QACnB,OAAO,GAAG,IAAA,+BAAqB,EAAC,KAAK,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACtD,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;KAC3B;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AARD,kCAQC","sourcesContent":["/**\n * Copyright (c)
|
|
1
|
+
{"version":3,"file":"LogBoxSymbolication.js","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogBoxSymbolication.tsx"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;AAIH,6FAAqE;AAQrE,MAAM,KAAK,GAAgD,IAAI,GAAG,EAAE,CAAC;AAErE;;GAEG;AACH,MAAM,QAAQ,GAAG,CAAC,EAChB,KAAK,EAAE,UAAU,EACjB,SAAS,GACc,EAA0B,EAAE;IACnD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;QAC9B,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;KACnD;IACD,MAAM,KAAK,GAAiB,EAAE,CAAC;IAC/B,KAAK,MAAM,UAAU,IAAI,UAAU,EAAE;QACnC,IAAI,QAAQ,GAAG,KAAK,CAAC;QACrB,IAAI,UAAU,IAAI,UAAU,EAAE;YAC5B,IAAI,OAAO,UAAU,CAAC,QAAQ,KAAK,SAAS,EAAE;gBAC5C,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;aACrE;YACD,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;SAChC;QACD,KAAK,CAAC,IAAI,CAAC;YACT,SAAS,EAAE,EAAE;YACb,MAAM,EAAE,UAAU,CAAC,MAAM;YACzB,IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,UAAU,EAAE,UAAU,CAAC,UAAU;YACjC,UAAU,EAAE,UAAU,CAAC,UAAU;YACjC,QAAQ;SACT,CAAC,CAAC;KACJ;IACD,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AAC9B,CAAC,CAAC;AAEF,SAAgB,WAAW,CAAC,KAAY;IACtC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACtB,CAAC;AAFD,kCAEC;AAED,SAAgB,WAAW,CAAC,KAAY;IACtC,IAAI,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC/B,IAAI,OAAO,IAAI,IAAI,EAAE;QACnB,OAAO,GAAG,IAAA,+BAAqB,EAAC,KAAK,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACtD,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;KAC3B;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AARD,kCAQC","sourcesContent":["/**\n * Copyright (c) 650 Industries.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { StackFrame as UpstreamStackFrame } from 'stacktrace-parser';\n\nimport symbolicateStackTrace from '../modules/symbolicateStackTrace';\n\ntype SymbolicatedStackTrace = any;\n\ntype StackFrame = UpstreamStackFrame & { collapse?: boolean };\n\nexport type Stack = StackFrame[];\n\nconst cache: Map<Stack, Promise<SymbolicatedStackTrace>> = new Map();\n\n/**\n * Sanitize because sometimes, `symbolicateStackTrace` gives us invalid values.\n */\nconst sanitize = ({\n stack: maybeStack,\n codeFrame,\n}: SymbolicatedStackTrace): SymbolicatedStackTrace => {\n if (!Array.isArray(maybeStack)) {\n throw new Error('Expected stack to be an array.');\n }\n const stack: StackFrame[] = [];\n for (const maybeFrame of maybeStack) {\n let collapse = false;\n if ('collapse' in maybeFrame) {\n if (typeof maybeFrame.collapse !== 'boolean') {\n throw new Error('Expected stack frame `collapse` to be a boolean.');\n }\n collapse = maybeFrame.collapse;\n }\n stack.push({\n arguments: [],\n column: maybeFrame.column,\n file: maybeFrame.file,\n lineNumber: maybeFrame.lineNumber,\n methodName: maybeFrame.methodName,\n collapse,\n });\n }\n return { stack, codeFrame };\n};\n\nexport function deleteStack(stack: Stack): void {\n cache.delete(stack);\n}\n\nexport function symbolicate(stack: Stack): Promise<SymbolicatedStackTrace> {\n let promise = cache.get(stack);\n if (promise == null) {\n promise = symbolicateStackTrace(stack).then(sanitize);\n cache.set(stack, promise);\n }\n\n return promise;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogContext.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC,eAAO,MAAM,UAAU;sBACH,MAAM;gBACZ,OAAO;UACb,SAAS,EAAE;SACJ,CAAC;AAEhB,wBAAgB,OAAO,IAAI;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,OAAO,CAAC;IACpB,IAAI,EAAE,SAAS,EAAE,CAAC;CACnB,
|
|
1
|
+
{"version":3,"file":"LogContext.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC,eAAO,MAAM,UAAU;sBACH,MAAM;gBACZ,OAAO;UACb,SAAS,EAAE;SACJ,CAAC;AAEhB,wBAAgB,OAAO,IAAI;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,OAAO,CAAC;IACpB,IAAI,EAAE,SAAS,EAAE,CAAC;CACnB,CAkBA;AAED,wBAAgB,cAAc,cAG7B"}
|
|
@@ -12,10 +12,10 @@ exports.LogContext = react_1.default.createContext(null);
|
|
|
12
12
|
function useLogs() {
|
|
13
13
|
const logs = react_1.default.useContext(exports.LogContext);
|
|
14
14
|
if (!logs) {
|
|
15
|
-
if (react_native_1.Platform.OS ===
|
|
15
|
+
if (react_native_1.Platform.OS === 'web' && typeof window !== 'undefined') {
|
|
16
16
|
// Logbox data that is pre-fetched on the dev server and rendered here.
|
|
17
|
-
const expoCliStaticErrorElement = document.getElementById(
|
|
18
|
-
if (expoCliStaticErrorElement
|
|
17
|
+
const expoCliStaticErrorElement = document.getElementById('_expo-static-error');
|
|
18
|
+
if (expoCliStaticErrorElement?.textContent) {
|
|
19
19
|
const raw = JSON.parse(expoCliStaticErrorElement.textContent);
|
|
20
20
|
return {
|
|
21
21
|
...raw,
|
|
@@ -23,7 +23,7 @@ function useLogs() {
|
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
throw new Error(
|
|
26
|
+
throw new Error('useLogs must be used within a LogProvider');
|
|
27
27
|
}
|
|
28
28
|
return logs;
|
|
29
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogContext.js","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogContext.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,+CAAwC;AAExC,2CAAwC;AAExC,wCAAwC;AAE3B,QAAA,UAAU,GAAG,eAAK,CAAC,aAAa,CAInC,IAAI,CAAC,CAAC;AAEhB,SAAgB,OAAO;IAKrB,MAAM,IAAI,GAAG,eAAK,CAAC,UAAU,CAAC,kBAAU,CAAC,CAAC;IAC1C,IAAI,CAAC,IAAI,EAAE;QACT,IAAI,uBAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;YAC1D,uEAAuE;YACvE,MAAM,yBAAyB,
|
|
1
|
+
{"version":3,"file":"LogContext.js","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogContext.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,+CAAwC;AAExC,2CAAwC;AAExC,wCAAwC;AAE3B,QAAA,UAAU,GAAG,eAAK,CAAC,aAAa,CAInC,IAAI,CAAC,CAAC;AAEhB,SAAgB,OAAO;IAKrB,MAAM,IAAI,GAAG,eAAK,CAAC,UAAU,CAAC,kBAAU,CAAC,CAAC;IAC1C,IAAI,CAAC,IAAI,EAAE;QACT,IAAI,uBAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;YAC1D,uEAAuE;YACvE,MAAM,yBAAyB,GAAG,QAAQ,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC;YAChF,IAAI,yBAAyB,EAAE,WAAW,EAAE;gBAC1C,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,yBAAyB,CAAC,WAAW,CAAC,CAAC;gBAC9D,OAAO;oBACL,GAAG,GAAG;oBACN,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,qBAAS,CAAC,GAAG,CAAC,CAAC;iBACrD,CAAC;aACH;SACF;QAED,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;KAC9D;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAtBD,0BAsBC;AAED,SAAgB,cAAc;IAC5B,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC;IAC7C,OAAO,IAAI,CAAC,gBAAgB,CAAC,CAAC;AAChC,CAAC;AAHD,wCAGC","sourcesContent":["import React from 'react';\nimport { Platform } from 'react-native';\n\nimport { LogBoxLog } from './LogBoxLog';\n\n// Context provider for Array<LogBoxLog>\n\nexport const LogContext = React.createContext<{\n selectedLogIndex: number;\n isDisabled: boolean;\n logs: LogBoxLog[];\n} | null>(null);\n\nexport function useLogs(): {\n selectedLogIndex: number;\n isDisabled: boolean;\n logs: LogBoxLog[];\n} {\n const logs = React.useContext(LogContext);\n if (!logs) {\n if (Platform.OS === 'web' && typeof window !== 'undefined') {\n // Logbox data that is pre-fetched on the dev server and rendered here.\n const expoCliStaticErrorElement = document.getElementById('_expo-static-error');\n if (expoCliStaticErrorElement?.textContent) {\n const raw = JSON.parse(expoCliStaticErrorElement.textContent);\n return {\n ...raw,\n logs: raw.logs.map((raw: any) => new LogBoxLog(raw)),\n };\n }\n }\n\n throw new Error('useLogs must be used within a LogProvider');\n }\n return logs;\n}\n\nexport function useSelectedLog() {\n const { selectedLogIndex, logs } = useLogs();\n return logs[selectedLogIndex];\n}\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 650 Industries.
|
|
3
3
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
|
-
import type { LogBoxLogData } from
|
|
8
|
+
import type { LogBoxLogData } from './LogBoxLog';
|
|
9
9
|
type ExceptionData = any;
|
|
10
10
|
export type ExtendedExceptionData = ExceptionData & {
|
|
11
11
|
isComponentError: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseLogBoxLog.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/Data/parseLogBoxLog.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"parseLogBoxLog.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/Data/parseLogBoxLog.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,KAAK,aAAa,GAAG,GAAG,CAAC;AASzB,MAAM,MAAM,qBAAqB,GAAG,aAAa,GAAG;IAClD,gBAAgB,EAAE,OAAO,CAAC;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAC9B,MAAM,MAAM,SAAS,GAAG;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE;QACT,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,GAAG,IAAI,CAAC;IACT,QAAQ,EAAE,MAAM,CAAC;IAKjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE;QACb,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;KAChB,EAAE,CAAC;CACL,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,SAAS,EAAE,CAAC;AAIzC,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,SAAS,GAAG,EAAE,GAAG;IACxD,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;CAClB,CAsEA;AAUD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,CAoCnE;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,qBAAqB,GAAG,aAAa,CA0HhF;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,GAAG,EAAE,GAAG;IACpD,cAAc,EAAE,cAAc,CAAC;IAC/B,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;CAClB,CAwCA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 650 Industries.
|
|
4
4
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
5
5
|
*
|
|
6
6
|
* This source code is licensed under the MIT license found in the
|
|
@@ -11,26 +11,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.parseLogBoxLog = exports.parseLogBoxException = exports.parseComponentStack = exports.parseInterpolation = void 0;
|
|
14
|
-
// @ts-expect-error
|
|
15
14
|
const UTFSequence_1 = __importDefault(require("react-native/Libraries/UTFSequence"));
|
|
16
15
|
const parseErrorStack_1 = __importDefault(require("../modules/parseErrorStack"));
|
|
17
16
|
const stringifySafe_1 = __importDefault(require("../modules/stringifySafe"));
|
|
18
17
|
const BABEL_TRANSFORM_ERROR_FORMAT = /^(?:TransformError )?(?:SyntaxError: |ReferenceError: )(.*): (.*) \((\d+):(\d+)\)\n\n([\s\S]+)/;
|
|
19
18
|
const BABEL_CODE_FRAME_ERROR_FORMAT = /^(?:TransformError )?(?:.*):? (?:.*?)(\/.*): ([\s\S]+?)\n([ >]{2}[\d\s]+ \|[\s\S]+|\u{001b}[\s\S]+)/u;
|
|
20
19
|
const METRO_ERROR_FORMAT = /^(?:InternalError Metro has encountered an error:) (.*): (.*) \((\d+):(\d+)\)\n\n([\s\S]+)/u;
|
|
21
|
-
const SUBSTITUTION = UTFSequence_1.default.BOM +
|
|
20
|
+
const SUBSTITUTION = UTFSequence_1.default.BOM + '%s';
|
|
22
21
|
function parseInterpolation(args) {
|
|
23
22
|
const categoryParts = [];
|
|
24
23
|
const contentParts = [];
|
|
25
24
|
const substitutionOffsets = [];
|
|
26
25
|
const remaining = [...args];
|
|
27
|
-
if (typeof remaining[0] ===
|
|
26
|
+
if (typeof remaining[0] === 'string') {
|
|
28
27
|
const formatString = String(remaining.shift());
|
|
29
|
-
const formatStringParts = formatString.split(
|
|
28
|
+
const formatStringParts = formatString.split('%s');
|
|
30
29
|
const substitutionCount = formatStringParts.length - 1;
|
|
31
30
|
const substitutions = remaining.splice(0, substitutionCount);
|
|
32
|
-
let categoryString =
|
|
33
|
-
let contentString =
|
|
31
|
+
let categoryString = '';
|
|
32
|
+
let contentString = '';
|
|
34
33
|
let substitutionIndex = 0;
|
|
35
34
|
for (const formatStringPart of formatStringParts) {
|
|
36
35
|
categoryString += formatStringPart;
|
|
@@ -40,7 +39,7 @@ function parseInterpolation(args) {
|
|
|
40
39
|
// Don't stringify a string type.
|
|
41
40
|
// It adds quotation mark wrappers around the string,
|
|
42
41
|
// which causes the LogBox to look odd.
|
|
43
|
-
const substitution = typeof substitutions[substitutionIndex] ===
|
|
42
|
+
const substitution = typeof substitutions[substitutionIndex] === 'string'
|
|
44
43
|
? substitutions[substitutionIndex]
|
|
45
44
|
: (0, stringifySafe_1.default)(substitutions[substitutionIndex]);
|
|
46
45
|
substitutionOffsets.push({
|
|
@@ -55,8 +54,8 @@ function parseInterpolation(args) {
|
|
|
55
54
|
length: 2,
|
|
56
55
|
offset: contentString.length,
|
|
57
56
|
});
|
|
58
|
-
categoryString +=
|
|
59
|
-
contentString +=
|
|
57
|
+
categoryString += '%s';
|
|
58
|
+
contentString += '%s';
|
|
60
59
|
}
|
|
61
60
|
substitutionIndex++;
|
|
62
61
|
}
|
|
@@ -68,14 +67,14 @@ function parseInterpolation(args) {
|
|
|
68
67
|
// Don't stringify a string type.
|
|
69
68
|
// It adds quotation mark wrappers around the string,
|
|
70
69
|
// which causes the LogBox to look odd.
|
|
71
|
-
return typeof arg ===
|
|
70
|
+
return typeof arg === 'string' ? arg : (0, stringifySafe_1.default)(arg);
|
|
72
71
|
});
|
|
73
72
|
categoryParts.push(...remainingArgs);
|
|
74
73
|
contentParts.push(...remainingArgs);
|
|
75
74
|
return {
|
|
76
|
-
category: categoryParts.join(
|
|
75
|
+
category: categoryParts.join(' '),
|
|
77
76
|
message: {
|
|
78
|
-
content: contentParts.join(
|
|
77
|
+
content: contentParts.join(' '),
|
|
79
78
|
substitutions: substitutionOffsets,
|
|
80
79
|
},
|
|
81
80
|
};
|
|
@@ -85,9 +84,7 @@ function isComponentStack(consoleArgument) {
|
|
|
85
84
|
const isOldComponentStackFormat = / {4}in/.test(consoleArgument);
|
|
86
85
|
const isNewComponentStackFormat = / {4}at/.test(consoleArgument);
|
|
87
86
|
const isNewJSCComponentStackFormat = /@.*\n/.test(consoleArgument);
|
|
88
|
-
return
|
|
89
|
-
isNewComponentStackFormat ||
|
|
90
|
-
isNewJSCComponentStackFormat);
|
|
87
|
+
return isOldComponentStackFormat || isNewComponentStackFormat || isNewJSCComponentStackFormat;
|
|
91
88
|
}
|
|
92
89
|
function parseComponentStack(message) {
|
|
93
90
|
// In newer versions of React, the component stack is formatted as a call stack frame.
|
|
@@ -98,7 +95,7 @@ function parseComponentStack(message) {
|
|
|
98
95
|
return stack.map((frame) => ({
|
|
99
96
|
content: frame.methodName,
|
|
100
97
|
collapse: frame.collapse || false,
|
|
101
|
-
fileName: frame.file == null ?
|
|
98
|
+
fileName: frame.file == null ? 'unknown' : frame.file,
|
|
102
99
|
location: {
|
|
103
100
|
column: frame.column == null ? -1 : frame.column,
|
|
104
101
|
row: frame.lineNumber == null ? -1 : frame.lineNumber,
|
|
@@ -126,13 +123,13 @@ function parseComponentStack(message) {
|
|
|
126
123
|
}
|
|
127
124
|
exports.parseComponentStack = parseComponentStack;
|
|
128
125
|
function parseLogBoxException(error) {
|
|
129
|
-
const message = error.originalMessage != null ? error.originalMessage :
|
|
126
|
+
const message = error.originalMessage != null ? error.originalMessage : 'Unknown';
|
|
130
127
|
const metroInternalError = message.match(METRO_ERROR_FORMAT);
|
|
131
128
|
if (metroInternalError) {
|
|
132
129
|
const [content, fileName, row, column, codeFrame] = metroInternalError.slice(1);
|
|
133
130
|
return {
|
|
134
|
-
level:
|
|
135
|
-
type:
|
|
131
|
+
level: 'fatal',
|
|
132
|
+
type: 'Metro Error',
|
|
136
133
|
stack: [],
|
|
137
134
|
isComponentError: false,
|
|
138
135
|
componentStack: [],
|
|
@@ -156,7 +153,7 @@ function parseLogBoxException(error) {
|
|
|
156
153
|
// Transform errors are thrown from inside the Babel transformer.
|
|
157
154
|
const [fileName, content, row, column, codeFrame] = babelTransformError.slice(1);
|
|
158
155
|
return {
|
|
159
|
-
level:
|
|
156
|
+
level: 'syntax',
|
|
160
157
|
stack: [],
|
|
161
158
|
isComponentError: false,
|
|
162
159
|
componentStack: [],
|
|
@@ -180,7 +177,7 @@ function parseLogBoxException(error) {
|
|
|
180
177
|
// Codeframe errors are thrown from any use of buildCodeFrameError.
|
|
181
178
|
const [fileName, content, codeFrame] = babelCodeFrameError.slice(1);
|
|
182
179
|
return {
|
|
183
|
-
level:
|
|
180
|
+
level: 'syntax',
|
|
184
181
|
stack: [],
|
|
185
182
|
isComponentError: false,
|
|
186
183
|
componentStack: [],
|
|
@@ -198,7 +195,7 @@ function parseLogBoxException(error) {
|
|
|
198
195
|
}
|
|
199
196
|
if (message.match(/^TransformError /)) {
|
|
200
197
|
return {
|
|
201
|
-
level:
|
|
198
|
+
level: 'syntax',
|
|
202
199
|
stack: error.stack,
|
|
203
200
|
isComponentError: error.isComponentError,
|
|
204
201
|
componentStack: [],
|
|
@@ -212,7 +209,7 @@ function parseLogBoxException(error) {
|
|
|
212
209
|
const componentStack = error.componentStack;
|
|
213
210
|
if (error.isFatal || error.isComponentError) {
|
|
214
211
|
return {
|
|
215
|
-
level:
|
|
212
|
+
level: 'fatal',
|
|
216
213
|
stack: error.stack,
|
|
217
214
|
isComponentError: error.isComponentError,
|
|
218
215
|
componentStack: componentStack != null ? parseComponentStack(componentStack) : [],
|
|
@@ -222,7 +219,7 @@ function parseLogBoxException(error) {
|
|
|
222
219
|
if (componentStack != null) {
|
|
223
220
|
// It is possible that console errors have a componentStack.
|
|
224
221
|
return {
|
|
225
|
-
level:
|
|
222
|
+
level: 'error',
|
|
226
223
|
stack: error.stack,
|
|
227
224
|
isComponentError: error.isComponentError,
|
|
228
225
|
componentStack: parseComponentStack(componentStack),
|
|
@@ -232,7 +229,7 @@ function parseLogBoxException(error) {
|
|
|
232
229
|
// Most `console.error` calls won't have a componentStack. We parse them like
|
|
233
230
|
// regular logs which have the component stack burried in the message.
|
|
234
231
|
return {
|
|
235
|
-
level:
|
|
232
|
+
level: 'error',
|
|
236
233
|
stack: error.stack,
|
|
237
234
|
isComponentError: error.isComponentError,
|
|
238
235
|
...parseLogBoxLog([message]),
|
|
@@ -244,11 +241,9 @@ function parseLogBoxLog(args) {
|
|
|
244
241
|
let argsWithoutComponentStack = [];
|
|
245
242
|
let componentStack = [];
|
|
246
243
|
// Extract component stack from warnings like "Some warning%s".
|
|
247
|
-
if (typeof message ===
|
|
248
|
-
message.slice(-2) === "%s" &&
|
|
249
|
-
args.length > 0) {
|
|
244
|
+
if (typeof message === 'string' && message.slice(-2) === '%s' && args.length > 0) {
|
|
250
245
|
const lastArg = args[args.length - 1];
|
|
251
|
-
if (typeof lastArg ===
|
|
246
|
+
if (typeof lastArg === 'string' && isComponentStack(lastArg)) {
|
|
252
247
|
argsWithoutComponentStack = args.slice(0, -1);
|
|
253
248
|
argsWithoutComponentStack[0] = message.slice(0, -2);
|
|
254
249
|
componentStack = parseComponentStack(lastArg);
|
|
@@ -257,7 +252,7 @@ function parseLogBoxLog(args) {
|
|
|
257
252
|
if (componentStack.length === 0) {
|
|
258
253
|
// Try finding the component stack elsewhere.
|
|
259
254
|
for (const arg of args) {
|
|
260
|
-
if (typeof arg ===
|
|
255
|
+
if (typeof arg === 'string' && isComponentStack(arg)) {
|
|
261
256
|
// Strip out any messages before the component stack.
|
|
262
257
|
let messageEndIndex = arg.search(/\n {4}(in|at) /);
|
|
263
258
|
if (messageEndIndex < 0) {
|