@expo/metro-runtime 2.2.4 → 3.0.0
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 +40 -68
- package/build/HMRClient.js.map +1 -1
- package/build/HMRClient.native.js +2 -4
- 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 +4 -10
- 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 +2 -2
- package/build/LoadingView.native.js.map +1 -1
- package/build/async-require/buildAsyncRequire.js +3 -7
- package/build/async-require/buildAsyncRequire.js.map +1 -1
- package/build/async-require/buildUrlForBundle.js +2 -6
- package/build/async-require/buildUrlForBundle.js.map +1 -1
- package/build/async-require/buildUrlForBundle.native.js +6 -9
- 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 +4 -8
- 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 +14 -21
- 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 +5 -10
- 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 +14 -27
- package/build/async-require/fetchThenEval.web.js.map +1 -1
- package/build/async-require/index.js +2 -6
- 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 +14 -18
- package/build/async-require/loadBundle.js.map +1 -1
- package/build/effects.js +5 -7
- 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 +76 -127
- 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 +46 -69
- 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 +9 -17
- 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 +12 -20
- 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 +35 -50
- 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 +55 -86
- 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 +1 -4
- 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 +12 -17
- 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 +28 -36
- 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 +11 -40
- 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 +10 -17
- 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 +15 -32
- package/build/error-overlay/UI/LogBoxStyle.js.map +1 -1
- package/build/error-overlay/UI/constants.js +5 -8
- 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 +7 -14
- 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 +9 -17
- 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 +11 -21
- 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 +3 -3
- 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 +10 -15
- 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 +2 -8
- package/build/error-overlay/modules/NativeLogBox/index.native.js.map +1 -1
- package/build/error-overlay/modules/openFileInEditor/index.js +5 -7
- 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 +2 -8
- 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 +4 -7
- 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 +2 -8
- 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 +16 -22
- 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 +6 -8
- 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 +2 -7
- 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 +28 -59
- 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 +34 -61
- 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 +36 -66
- 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 +19 -49
- 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 +13 -43
- 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 +26 -53
- 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 +23 -53
- 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 +42 -76
- 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 +43 -69
- 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 +3 -9
- 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 +22 -49
- 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 +8 -38
- 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 +20 -28
- package/build/error-overlay/useRejectionHandler.js.map +1 -1
- package/build/getDevServer.d.ts.map +1 -1
- package/build/getDevServer.js +10 -16
- 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 +2 -2
- package/build/getDevServer.native.js.map +1 -1
- package/build/index.d.ts +2 -2
- package/build/index.js +4 -6
- package/build/index.js.map +1 -1
- package/build/location/Location.js +2 -7
- package/build/location/Location.js.map +1 -1
- package/build/location/Location.native.d.ts.map +1 -1
- package/build/location/Location.native.js +25 -32
- 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 +23 -34
- 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 +5 -12
- package/build/setupHMR.js.map +1 -1
- package/build/symbolicate.d.ts +3 -3
- package/build/symbolicate.js +4 -25
- 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,68 +1,46 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 650 Industries.
|
|
4
3
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
5
4
|
*
|
|
6
5
|
* This source code is licensed under the MIT license found in the
|
|
7
6
|
* LICENSE file in the root directory of this source tree.
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
-
}
|
|
15
|
-
Object.defineProperty(o, k2, desc);
|
|
16
|
-
}) : (function(o, m, k, k2) {
|
|
17
|
-
if (k2 === undefined) k2 = k;
|
|
18
|
-
o[k2] = m[k];
|
|
19
|
-
}));
|
|
20
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
-
}) : function(o, v) {
|
|
23
|
-
o["default"] = v;
|
|
24
|
-
});
|
|
25
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
26
|
-
if (mod && mod.__esModule) return mod;
|
|
27
|
-
var result = {};
|
|
28
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
29
|
-
__setModuleDefault(result, mod);
|
|
30
|
-
return result;
|
|
31
|
-
};
|
|
32
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
exports.LogBoxLog = void 0;
|
|
34
|
-
const LogBoxSymbolication = __importStar(require("./LogBoxSymbolication"));
|
|
8
|
+
import * as LogBoxSymbolication from './LogBoxSymbolication';
|
|
35
9
|
function componentStackToStack(componentStack) {
|
|
36
|
-
return componentStack.map((stack) => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
arguments: [],
|
|
44
|
-
});
|
|
45
|
-
});
|
|
10
|
+
return componentStack.map((stack) => ({
|
|
11
|
+
file: stack.fileName,
|
|
12
|
+
methodName: stack.content,
|
|
13
|
+
lineNumber: stack.location?.row ?? 0,
|
|
14
|
+
column: stack.location?.column ?? 0,
|
|
15
|
+
arguments: [],
|
|
16
|
+
}));
|
|
46
17
|
}
|
|
47
|
-
class LogBoxLog {
|
|
18
|
+
export class LogBoxLog {
|
|
19
|
+
message;
|
|
20
|
+
type;
|
|
21
|
+
category;
|
|
22
|
+
componentStack;
|
|
23
|
+
stack;
|
|
24
|
+
count;
|
|
25
|
+
level;
|
|
26
|
+
codeFrame;
|
|
27
|
+
isComponentError;
|
|
28
|
+
symbolicated = {
|
|
29
|
+
stack: {
|
|
30
|
+
error: null,
|
|
31
|
+
stack: null,
|
|
32
|
+
status: 'NONE',
|
|
33
|
+
},
|
|
34
|
+
component: {
|
|
35
|
+
error: null,
|
|
36
|
+
stack: null,
|
|
37
|
+
status: 'NONE',
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
callbacks = new Map();
|
|
48
41
|
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
42
|
this.level = data.level;
|
|
65
|
-
this.type =
|
|
43
|
+
this.type = data.type ?? 'error';
|
|
66
44
|
this.message = data.message;
|
|
67
45
|
this.stack = data.stack;
|
|
68
46
|
this.category = data.category;
|
|
@@ -70,13 +48,13 @@ class LogBoxLog {
|
|
|
70
48
|
this.codeFrame = data.codeFrame;
|
|
71
49
|
this.isComponentError = data.isComponentError;
|
|
72
50
|
this.count = 1;
|
|
73
|
-
this.symbolicated =
|
|
51
|
+
this.symbolicated = data.symbolicated ?? this.symbolicated;
|
|
74
52
|
}
|
|
75
53
|
incrementCount() {
|
|
76
54
|
this.count += 1;
|
|
77
55
|
}
|
|
78
56
|
getAvailableStack(type) {
|
|
79
|
-
if (this.symbolicated[type].status ===
|
|
57
|
+
if (this.symbolicated[type].status === 'COMPLETE') {
|
|
80
58
|
return this.symbolicated[type].stack;
|
|
81
59
|
}
|
|
82
60
|
return this.getStack(type);
|
|
@@ -110,7 +88,7 @@ class LogBoxLog {
|
|
|
110
88
|
this.pushCallback(type, callback);
|
|
111
89
|
}
|
|
112
90
|
const status = this.symbolicated[type].status;
|
|
113
|
-
if (status ===
|
|
91
|
+
if (status === 'COMPLETE') {
|
|
114
92
|
return this.flushCallbacks(type);
|
|
115
93
|
}
|
|
116
94
|
if (retry) {
|
|
@@ -118,13 +96,14 @@ class LogBoxLog {
|
|
|
118
96
|
this.handleSymbolicate(type);
|
|
119
97
|
}
|
|
120
98
|
else {
|
|
121
|
-
if (status ===
|
|
99
|
+
if (status === 'NONE') {
|
|
122
100
|
this.handleSymbolicate(type);
|
|
123
101
|
}
|
|
124
102
|
}
|
|
125
103
|
}
|
|
104
|
+
componentStackCache = null;
|
|
126
105
|
getStack(type) {
|
|
127
|
-
if (type ===
|
|
106
|
+
if (type === 'component') {
|
|
128
107
|
if (this.componentStackCache == null) {
|
|
129
108
|
this.componentStackCache = componentStackToStack(this.componentStack);
|
|
130
109
|
}
|
|
@@ -133,14 +112,13 @@ class LogBoxLog {
|
|
|
133
112
|
return this.stack;
|
|
134
113
|
}
|
|
135
114
|
handleSymbolicate(type) {
|
|
136
|
-
|
|
137
|
-
if (type === "component" && !((_a = this.componentStack) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
115
|
+
if (type === 'component' && !this.componentStack?.length) {
|
|
138
116
|
return;
|
|
139
117
|
}
|
|
140
|
-
if (this.symbolicated[type].status !==
|
|
118
|
+
if (this.symbolicated[type].status !== 'PENDING') {
|
|
141
119
|
this.updateStatus(type, null, null, null);
|
|
142
120
|
LogBoxSymbolication.symbolicate(this.getStack(type)).then((data) => {
|
|
143
|
-
this.updateStatus(type, null, data
|
|
121
|
+
this.updateStatus(type, null, data?.stack, data?.codeFrame);
|
|
144
122
|
}, (error) => {
|
|
145
123
|
this.updateStatus(type, error, null, null);
|
|
146
124
|
});
|
|
@@ -152,7 +130,7 @@ class LogBoxLog {
|
|
|
152
130
|
this.symbolicated[type] = {
|
|
153
131
|
error,
|
|
154
132
|
stack: null,
|
|
155
|
-
status:
|
|
133
|
+
status: 'FAILED',
|
|
156
134
|
};
|
|
157
135
|
}
|
|
158
136
|
else if (stack != null) {
|
|
@@ -162,23 +140,22 @@ class LogBoxLog {
|
|
|
162
140
|
this.symbolicated[type] = {
|
|
163
141
|
error: null,
|
|
164
142
|
stack,
|
|
165
|
-
status:
|
|
143
|
+
status: 'COMPLETE',
|
|
166
144
|
};
|
|
167
145
|
}
|
|
168
146
|
else {
|
|
169
147
|
this.symbolicated[type] = {
|
|
170
148
|
error: null,
|
|
171
149
|
stack: null,
|
|
172
|
-
status:
|
|
150
|
+
status: 'PENDING',
|
|
173
151
|
};
|
|
174
152
|
}
|
|
175
153
|
const status = this.symbolicated[type].status;
|
|
176
154
|
if (lastStatus !== status) {
|
|
177
|
-
if ([
|
|
155
|
+
if (['COMPLETE', 'FAILED'].includes(status)) {
|
|
178
156
|
this.flushCallbacks(type);
|
|
179
157
|
}
|
|
180
158
|
}
|
|
181
159
|
}
|
|
182
160
|
}
|
|
183
|
-
exports.LogBoxLog = LogBoxLog;
|
|
184
161
|
//# sourceMappingURL=LogBoxLog.js.map
|
|
@@ -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;gBACL,KAAK,EAAE,IAAI;gBACX,KAAK,EAAE,IAAI;gBACX,MAAM,EAAE,MAAM;aACf;YAC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ACpB,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,OAAO,KAAK,mBAAmB,MAAM,uBAAuB,CAAC;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,MAAM,OAAO,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,EAAE,MAAM;SACf;KACF,CAAC;IAEM,SAAS,GAA+C,IAAI,GAAG,EAAE,CA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ACX,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","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,31 +1,25 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 650 Industries.
|
|
4
3
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
5
4
|
*
|
|
6
5
|
* This source code is licensed under the MIT license found in the
|
|
7
6
|
* LICENSE file in the root directory of this source tree.
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.symbolicate = exports.deleteStack = void 0;
|
|
14
|
-
const symbolicateStackTrace_1 = __importDefault(require("../modules/symbolicateStackTrace"));
|
|
8
|
+
import symbolicateStackTrace from '../modules/symbolicateStackTrace';
|
|
15
9
|
const cache = new Map();
|
|
16
10
|
/**
|
|
17
11
|
* Sanitize because sometimes, `symbolicateStackTrace` gives us invalid values.
|
|
18
12
|
*/
|
|
19
13
|
const sanitize = ({ stack: maybeStack, codeFrame, }) => {
|
|
20
14
|
if (!Array.isArray(maybeStack)) {
|
|
21
|
-
throw new Error(
|
|
15
|
+
throw new Error('Expected stack to be an array.');
|
|
22
16
|
}
|
|
23
17
|
const stack = [];
|
|
24
18
|
for (const maybeFrame of maybeStack) {
|
|
25
19
|
let collapse = false;
|
|
26
|
-
if (
|
|
27
|
-
if (typeof maybeFrame.collapse !==
|
|
28
|
-
throw new Error(
|
|
20
|
+
if ('collapse' in maybeFrame) {
|
|
21
|
+
if (typeof maybeFrame.collapse !== 'boolean') {
|
|
22
|
+
throw new Error('Expected stack frame `collapse` to be a boolean.');
|
|
29
23
|
}
|
|
30
24
|
collapse = maybeFrame.collapse;
|
|
31
25
|
}
|
|
@@ -40,17 +34,15 @@ const sanitize = ({ stack: maybeStack, codeFrame, }) => {
|
|
|
40
34
|
}
|
|
41
35
|
return { stack, codeFrame };
|
|
42
36
|
};
|
|
43
|
-
function deleteStack(stack) {
|
|
37
|
+
export function deleteStack(stack) {
|
|
44
38
|
cache.delete(stack);
|
|
45
39
|
}
|
|
46
|
-
|
|
47
|
-
function symbolicate(stack) {
|
|
40
|
+
export function symbolicate(stack) {
|
|
48
41
|
let promise = cache.get(stack);
|
|
49
42
|
if (promise == null) {
|
|
50
|
-
promise = (
|
|
43
|
+
promise = symbolicateStackTrace(stack).then(sanitize);
|
|
51
44
|
cache.set(stack, promise);
|
|
52
45
|
}
|
|
53
46
|
return promise;
|
|
54
47
|
}
|
|
55
|
-
exports.symbolicate = symbolicate;
|
|
56
48
|
//# sourceMappingURL=LogBoxSymbolication.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogBoxSymbolication.js","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogBoxSymbolication.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LogBoxSymbolication.js","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogBoxSymbolication.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,qBAAqB,MAAM,kCAAkC,CAAC;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,MAAM,UAAU,WAAW,CAAC,KAAY;IACtC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACtB,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAY;IACtC,IAAI,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC/B,IAAI,OAAO,IAAI,IAAI,EAAE;QACnB,OAAO,GAAG,qBAAqB,CAAC,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","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"}
|
|
@@ -1,36 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.useSelectedLog = exports.useLogs = exports.LogContext = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const react_native_1 = require("react-native");
|
|
9
|
-
const LogBoxLog_1 = require("./LogBoxLog");
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Platform } from 'react-native';
|
|
3
|
+
import { LogBoxLog } from './LogBoxLog';
|
|
10
4
|
// Context provider for Array<LogBoxLog>
|
|
11
|
-
|
|
12
|
-
function useLogs() {
|
|
13
|
-
const logs =
|
|
5
|
+
export const LogContext = React.createContext(null);
|
|
6
|
+
export function useLogs() {
|
|
7
|
+
const logs = React.useContext(LogContext);
|
|
14
8
|
if (!logs) {
|
|
15
|
-
if (
|
|
9
|
+
if (Platform.OS === 'web' && typeof window !== 'undefined') {
|
|
16
10
|
// Logbox data that is pre-fetched on the dev server and rendered here.
|
|
17
|
-
const expoCliStaticErrorElement = document.getElementById(
|
|
18
|
-
if (expoCliStaticErrorElement
|
|
11
|
+
const expoCliStaticErrorElement = document.getElementById('_expo-static-error');
|
|
12
|
+
if (expoCliStaticErrorElement?.textContent) {
|
|
19
13
|
const raw = JSON.parse(expoCliStaticErrorElement.textContent);
|
|
20
14
|
return {
|
|
21
15
|
...raw,
|
|
22
|
-
logs: raw.logs.map((raw) => new
|
|
16
|
+
logs: raw.logs.map((raw) => new LogBoxLog(raw)),
|
|
23
17
|
};
|
|
24
18
|
}
|
|
25
19
|
}
|
|
26
|
-
throw new Error(
|
|
20
|
+
throw new Error('useLogs must be used within a LogProvider');
|
|
27
21
|
}
|
|
28
22
|
return logs;
|
|
29
23
|
}
|
|
30
|
-
|
|
31
|
-
function useSelectedLog() {
|
|
24
|
+
export function useSelectedLog() {
|
|
32
25
|
const { selectedLogIndex, logs } = useLogs();
|
|
33
26
|
return logs[selectedLogIndex];
|
|
34
27
|
}
|
|
35
|
-
exports.useSelectedLog = useSelectedLog;
|
|
36
28
|
//# sourceMappingURL=LogContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogContext.js","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogContext.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LogContext.js","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,wCAAwC;AAExC,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAAC,aAAa,CAInC,IAAI,CAAC,CAAC;AAEhB,MAAM,UAAU,OAAO;IAKrB,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IAC1C,IAAI,CAAC,IAAI,EAAE;QACT,IAAI,QAAQ,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,SAAS,CAAC,GAAG,CAAC,CAAC;iBACrD,CAAC;aACH;SACF;QAED,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;KAC9D;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC;IAC7C,OAAO,IAAI,CAAC,gBAAgB,CAAC,CAAC;AAChC,CAAC","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;AAMH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,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,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