@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
|
@@ -9,18 +9,18 @@ exports.fetchThenEvalAsync = void 0;
|
|
|
9
9
|
*/
|
|
10
10
|
// Basically `__webpack_require__.l`.
|
|
11
11
|
function fetchThenEvalAsync(url, { scriptType, nonce, crossOrigin, } = {}) {
|
|
12
|
-
if (typeof document ===
|
|
13
|
-
throw new Error(
|
|
12
|
+
if (typeof document === 'undefined') {
|
|
13
|
+
throw new Error('Cannot use fetchThenEvalAsync in a non-browser environment.');
|
|
14
14
|
}
|
|
15
15
|
return new Promise((resolve, reject) => {
|
|
16
|
-
const script = document.createElement(
|
|
16
|
+
const script = document.createElement('script');
|
|
17
17
|
if (scriptType)
|
|
18
18
|
script.type = scriptType;
|
|
19
19
|
if (nonce)
|
|
20
|
-
script.setAttribute(
|
|
20
|
+
script.setAttribute('nonce', nonce);
|
|
21
21
|
// script.setAttribute('data-expo-metro', ...);
|
|
22
22
|
script.src = url;
|
|
23
|
-
if (crossOrigin && script.src.indexOf(window.location.origin +
|
|
23
|
+
if (crossOrigin && script.src.indexOf(window.location.origin + '/') !== 0) {
|
|
24
24
|
script.crossOrigin = crossOrigin;
|
|
25
25
|
}
|
|
26
26
|
script.onload = () => {
|
|
@@ -31,11 +31,10 @@ function fetchThenEvalAsync(url, { scriptType, nonce, crossOrigin, } = {}) {
|
|
|
31
31
|
const error = new AsyncRequireError();
|
|
32
32
|
// Server error or network error.
|
|
33
33
|
script.onerror = (ev) => {
|
|
34
|
-
var _a;
|
|
35
34
|
let event;
|
|
36
|
-
if (typeof ev ===
|
|
35
|
+
if (typeof ev === 'string') {
|
|
37
36
|
event = {
|
|
38
|
-
type:
|
|
37
|
+
type: 'error',
|
|
39
38
|
target: {
|
|
40
39
|
// @ts-expect-error
|
|
41
40
|
src: event,
|
|
@@ -45,17 +44,10 @@ function fetchThenEvalAsync(url, { scriptType, nonce, crossOrigin, } = {}) {
|
|
|
45
44
|
else {
|
|
46
45
|
event = ev;
|
|
47
46
|
}
|
|
48
|
-
const errorType = event && (event.type ===
|
|
47
|
+
const errorType = event && (event.type === 'load' ? 'missing' : event.type);
|
|
49
48
|
// @ts-expect-error
|
|
50
|
-
const realSrc =
|
|
51
|
-
error.message =
|
|
52
|
-
"Loading module " +
|
|
53
|
-
url +
|
|
54
|
-
" failed.\n(" +
|
|
55
|
-
errorType +
|
|
56
|
-
": " +
|
|
57
|
-
realSrc +
|
|
58
|
-
")";
|
|
49
|
+
const realSrc = event?.target?.src;
|
|
50
|
+
error.message = 'Loading module ' + url + ' failed.\n(' + errorType + ': ' + realSrc + ')';
|
|
59
51
|
error.type = errorType;
|
|
60
52
|
error.request = realSrc;
|
|
61
53
|
script.parentNode && script.parentNode.removeChild(script);
|
|
@@ -66,9 +58,8 @@ function fetchThenEvalAsync(url, { scriptType, nonce, crossOrigin, } = {}) {
|
|
|
66
58
|
}
|
|
67
59
|
exports.fetchThenEvalAsync = fetchThenEvalAsync;
|
|
68
60
|
class AsyncRequireError extends Error {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
61
|
+
name = 'AsyncRequireError';
|
|
62
|
+
type;
|
|
63
|
+
request;
|
|
73
64
|
}
|
|
74
65
|
//# sourceMappingURL=fetchThenEval.web.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchThenEval.web.js","sourceRoot":"","sources":["../../src/async-require/fetchThenEval.web.ts"],"names":[],"mappings":";;;AAAA;;;;;G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iC;QACjC,MAAM,CAAC,OAAO,GAAG,CAAC,EAAE,EAAE,EAAE;YACtB,IAAI,KAAY,CAAC;YACjB,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;gBAC1B,KAAK,GAAG;oBACN,IAAI,EAAE,OAAO;oBACb,MAAM,EAAE;wBACN,mBAAmB;wBACnB,GAAG,EAAE,KAAK;qBACX;iBACF,CAAC;aACH;iBAAM;gBACL,KAAK,GAAG,EAAE,CAAC;aACZ;YAED,MAAM,SAAS,GAAG,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC5E,mBAAmB;YACnB,MAAM,OAAO,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC;YACnC,KAAK,CAAC,OAAO,GAAG,iBAAiB,GAAG,GAAG,GAAG,aAAa,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,GAAG,GAAG,CAAC;YAC3F,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC;YACvB,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;YAExB,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YAC3D,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,CAAC;QACF,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC;AAxDD,gDAwDC;AAED,MAAM,iBAAkB,SAAQ,KAAK;IAC1B,IAAI,GAAG,mBAAmB,CAAC;IACpC,IAAI,CAAU;IACd,OAAO,CAAU;CAClB","sourcesContent":["/**\n * Copyright © 2022 650 Industries.\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// Basically `__webpack_require__.l`.\nexport function fetchThenEvalAsync(\n url: string,\n {\n scriptType,\n nonce,\n crossOrigin,\n }: { scriptType?: string; nonce?: string; crossOrigin?: string } = {}\n): Promise<void> {\n if (typeof document === 'undefined') {\n throw new Error('Cannot use fetchThenEvalAsync in a non-browser environment.');\n }\n return new Promise<void>((resolve, reject) => {\n const script = document.createElement('script');\n if (scriptType) script.type = scriptType;\n if (nonce) script.setAttribute('nonce', nonce);\n // script.setAttribute('data-expo-metro', ...);\n script.src = url;\n\n if (crossOrigin && script.src.indexOf(window.location.origin + '/') !== 0) {\n script.crossOrigin = crossOrigin;\n }\n\n script.onload = () => {\n script.parentNode && script.parentNode.removeChild(script);\n resolve();\n };\n // Create a new error object to preserve the original stack trace.\n const error = new AsyncRequireError();\n\n // Server error or network error.\n script.onerror = (ev) => {\n let event: Event;\n if (typeof ev === 'string') {\n event = {\n type: 'error',\n target: {\n // @ts-expect-error\n src: event,\n },\n };\n } else {\n event = ev;\n }\n\n const errorType = event && (event.type === 'load' ? 'missing' : event.type);\n // @ts-expect-error\n const realSrc = event?.target?.src;\n error.message = 'Loading module ' + url + ' failed.\\n(' + errorType + ': ' + realSrc + ')';\n error.type = errorType;\n error.request = realSrc;\n\n script.parentNode && script.parentNode.removeChild(script);\n reject(error);\n };\n document.head.appendChild(script);\n });\n}\n\nclass AsyncRequireError extends Error {\n readonly name = 'AsyncRequireError';\n type?: string;\n request?: string;\n}\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
/**
|
|
5
4
|
* Copyright © 2022 650 Industries.
|
|
@@ -9,6 +8,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
8
|
*/
|
|
10
9
|
const buildAsyncRequire_1 = require("./buildAsyncRequire");
|
|
11
10
|
// @ts-ignore
|
|
12
|
-
global[`${
|
|
13
|
-
(0, buildAsyncRequire_1.buildAsyncRequire)();
|
|
11
|
+
global[`${global.__METRO_GLOBAL_PREFIX__ ?? ''}__loadBundleAsync`] = (0, buildAsyncRequire_1.buildAsyncRequire)();
|
|
14
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/async-require/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/async-require/index.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,2DAAwD;AAExD,aAAa;AACb,MAAM,CAAC,GAAG,MAAM,CAAC,uBAAuB,IAAI,EAAE,mBAAmB,CAAC,GAAG,IAAA,qCAAiB,GAAE,CAAC","sourcesContent":["/**\n * Copyright © 2022 650 Industries.\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 */\nimport { buildAsyncRequire } from './buildAsyncRequire';\n\n// @ts-ignore\nglobal[`${global.__METRO_GLOBAL_PREFIX__ ?? ''}__loadBundleAsync`] = buildAsyncRequire();\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadBundle.d.ts","sourceRoot":"","sources":["../../src/async-require/loadBundle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loadBundle.d.ts","sourceRoot":"","sources":["../../src/async-require/loadBundle.ts"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BvE"}
|
|
@@ -9,6 +9,7 @@ exports.loadBundleAsync = void 0;
|
|
|
9
9
|
*/
|
|
10
10
|
const buildUrlForBundle_1 = require("./buildUrlForBundle");
|
|
11
11
|
const fetchThenEval_1 = require("./fetchThenEval");
|
|
12
|
+
// import LoadingView from '../LoadingView';
|
|
12
13
|
let pendingRequests = 0;
|
|
13
14
|
/**
|
|
14
15
|
* Load a bundle for a URL using fetch + eval on native and script tag injection on web.
|
|
@@ -17,20 +18,19 @@ let pendingRequests = 0;
|
|
|
17
18
|
*/
|
|
18
19
|
async function loadBundleAsync(bundlePath) {
|
|
19
20
|
const requestUrl = (0, buildUrlForBundle_1.buildUrlForBundle)(bundlePath);
|
|
20
|
-
if (process.env.NODE_ENV ===
|
|
21
|
+
if (process.env.NODE_ENV === 'production') {
|
|
21
22
|
return (0, fetchThenEval_1.fetchThenEvalAsync)(requestUrl);
|
|
22
23
|
}
|
|
23
24
|
else {
|
|
24
|
-
const LoadingView = require(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
25
|
+
const LoadingView = require('../LoadingView')
|
|
26
|
+
.default;
|
|
27
|
+
// Send a signal to the `expo` package to show the loading indicator.
|
|
28
|
+
LoadingView.showMessage('Downloading...', 'load');
|
|
29
29
|
pendingRequests++;
|
|
30
30
|
return (0, fetchThenEval_1.fetchThenEvalAsync)(requestUrl)
|
|
31
31
|
.then(() => {
|
|
32
|
-
if (process.env.NODE_ENV !==
|
|
33
|
-
const HMRClient = require(
|
|
32
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
33
|
+
const HMRClient = require('../HMRClient')
|
|
34
34
|
.default;
|
|
35
35
|
HMRClient.registerBundle(requestUrl);
|
|
36
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadBundle.js","sourceRoot":"","sources":["../../src/async-require/loadBundle.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,2DAAwD;AACxD,mDAAqD;
|
|
1
|
+
{"version":3,"file":"loadBundle.js","sourceRoot":"","sources":["../../src/async-require/loadBundle.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,2DAAwD;AACxD,mDAAqD;AACrD,4CAA4C;AAE5C,IAAI,eAAe,GAAG,CAAC,CAAC;AAExB;;;;GAIG;AACI,KAAK,UAAU,eAAe,CAAC,UAAkB;IACtD,MAAM,UAAU,GAAG,IAAA,qCAAiB,EAAC,UAAU,CAAC,CAAC;IAEjD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;QACzC,OAAO,IAAA,kCAAkB,EAAC,UAAU,CAAC,CAAC;KACvC;SAAM;QACL,MAAM,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC;aAC1C,OAAkD,CAAC;QAEtD,qEAAqE;QACrE,WAAW,CAAC,WAAW,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;QAElD,eAAe,EAAE,CAAC;QAElB,OAAO,IAAA,kCAAkB,EAAC,UAAU,CAAC;aAClC,IAAI,CAAC,GAAG,EAAE;YACT,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;gBACzC,MAAM,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC;qBACtC,OAAgD,CAAC;gBACpD,SAAS,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;aACtC;QACH,CAAC,CAAC;aACD,OAAO,CAAC,GAAG,EAAE;YACZ,IAAI,CAAC,EAAE,eAAe,EAAE;gBACtB,WAAW,CAAC,IAAI,EAAE,CAAC;aACpB;QACH,CAAC,CAAC,CAAC;KACN;AACH,CAAC;AA5BD,0CA4BC","sourcesContent":["/**\n * Copyright © 2022 650 Industries.\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 */\nimport { buildUrlForBundle } from './buildUrlForBundle';\nimport { fetchThenEvalAsync } from './fetchThenEval';\n// import LoadingView from '../LoadingView';\n\nlet pendingRequests = 0;\n\n/**\n * Load a bundle for a URL using fetch + eval on native and script tag injection on web.\n *\n * @param bundlePath Given a statement like `import('./Bacon')` `bundlePath` would be `Bacon.bundle?params=from-metro`.\n */\nexport async function loadBundleAsync(bundlePath: string): Promise<void> {\n const requestUrl = buildUrlForBundle(bundlePath);\n\n if (process.env.NODE_ENV === 'production') {\n return fetchThenEvalAsync(requestUrl);\n } else {\n const LoadingView = require('../LoadingView')\n .default as typeof import('../LoadingView').default;\n\n // Send a signal to the `expo` package to show the loading indicator.\n LoadingView.showMessage('Downloading...', 'load');\n\n pendingRequests++;\n\n return fetchThenEvalAsync(requestUrl)\n .then(() => {\n if (process.env.NODE_ENV !== 'production') {\n const HMRClient = require('../HMRClient')\n .default as typeof import('../HMRClient').default;\n HMRClient.registerBundle(requestUrl);\n }\n })\n .finally(() => {\n if (!--pendingRequests) {\n LoadingView.hide();\n }\n });\n }\n}\n"]}
|
package/build/effects.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const expo_modules_core_1 = require("expo-modules-core");
|
|
4
|
-
if (
|
|
5
3
|
// Only during development.
|
|
6
|
-
|
|
4
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5
|
+
if (
|
|
7
6
|
// Disable for SSR
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
typeof window !== 'undefined' &&
|
|
8
|
+
// Disable for non-metro runtimes
|
|
9
|
+
// NOTE(EvanBacon): This can probably be removed in favor of `expo/metro-config` injecting this file.
|
|
10
|
+
global.__METRO_GLOBAL_PREFIX__ != null) {
|
|
11
|
+
require('./setupFastRefresh');
|
|
12
|
+
require('./setupHMR');
|
|
13
|
+
require('./messageSocket');
|
|
14
|
+
}
|
|
15
15
|
}
|
|
16
16
|
//# sourceMappingURL=effects.js.map
|
package/build/effects.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"effects.js","sourceRoot":"","sources":["../src/effects.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"effects.js","sourceRoot":"","sources":["../src/effects.ts"],"names":[],"mappings":";;AAeA,2BAA2B;AAC3B,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;IACzC;IACE,kBAAkB;IAClB,OAAO,MAAM,KAAK,WAAW;QAC7B,iCAAiC;QACjC,qGAAqG;QACrG,MAAM,CAAC,uBAAuB,IAAI,IAAI,EACtC;QACA,OAAO,CAAC,oBAAoB,CAAC,CAAC;QAC9B,OAAO,CAAC,YAAY,CAAC,CAAC;QACtB,OAAO,CAAC,iBAAiB,CAAC,CAAC;KAC5B;CACF","sourcesContent":["import type { NavigationContainerRef } from '@react-navigation/core';\nimport type { LinkingOptions } from '@react-navigation/native';\n\ndeclare let global: {\n __DEV__?: boolean;\n RN$Bridgeless?: boolean;\n __METRO_GLOBAL_PREFIX__?: string;\n __RCTProfileIsProfiling?: boolean;\n WebSocket: any;\n REACT_NAVIGATION_DEVTOOLS: WeakMap<\n NavigationContainerRef<any>,\n { readonly linking: LinkingOptions<any> }\n >;\n};\n\n// Only during development.\nif (process.env.NODE_ENV !== 'production') {\n if (\n // Disable for SSR\n typeof window !== 'undefined' &&\n // Disable for non-metro runtimes\n // NOTE(EvanBacon): This can probably be removed in favor of `expo/metro-config` injecting this file.\n global.__METRO_GLOBAL_PREFIX__ != null\n ) {\n require('./setupFastRefresh');\n require('./setupHMR');\n require('./messageSocket');\n }\n}\n"]}
|
package/build/effects.native.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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 * as React from
|
|
9
|
-
import { LogBoxLog, StackType } from
|
|
10
|
-
import type { LogLevel } from
|
|
11
|
-
import type { Message, Category, ComponentStack, ExtendedExceptionData } from
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
import { LogBoxLog, StackType } from './LogBoxLog';
|
|
10
|
+
import type { LogLevel } from './LogBoxLog';
|
|
11
|
+
import type { Message, Category, ComponentStack, ExtendedExceptionData } from './parseLogBoxLog';
|
|
12
12
|
export type LogBoxLogs = Set<LogBoxLog>;
|
|
13
13
|
export type LogData = {
|
|
14
14
|
level: LogLevel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogBoxData.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogBoxData.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"LogBoxData.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogBoxData.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG5C,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAIjG,MAAM,MAAM,UAAU,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC;AAExC,MAAM,MAAM,OAAO,GAAG;IACpB,KAAK,EAAE,QAAQ,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,cAAc,EAAE,cAAc,CAAC;CAChC,CAAC;AAEF,KAAK,aAAa,GAAG,GAAG,CAAC;AAEzB,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,EAAE;IAC/B,IAAI,EAAE,UAAU,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;CAC1B,KAAK,IAAI,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,CAAC;AAE5C,MAAM,MAAM,YAAY,GAAG;IACzB,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,WAAW,EAAE,MAAM,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AED,wBAAgB,iBAAiB,IAAI,aAAa,EAAE,CAEnD;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,IAAI,CA2BjE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAMhD;AAED,wBAAgB,UAAU,IAAI,OAAO,CAEpC;AAED,wBAAgB,OAAO,CAAC,QAAQ,EAAE,QAAQ,GAAG,YAAY,CAWxD;AAED,wBAAgB,gBAAgB,CAAC,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAiF5F"}
|
|
@@ -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
|
|
@@ -35,18 +35,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.withSubscription = exports.observe = exports.isDisabled = exports.setDisabled = exports.addIgnorePatterns = exports.getIgnorePatterns = exports.dismiss = exports.clearErrors = exports.clearWarnings = exports.setSelectedLog = exports.clear = exports.symbolicateLogLazy = exports.retrySymbolicateLogNow = exports.symbolicateLogNow = exports.addException = exports.addLog = exports.isMessageIgnored = exports.isLogBoxErrorMessage = exports.reportUnexpectedLogBoxError = exports.reportLogBoxError = void 0;
|
|
37
37
|
const React = __importStar(require("react"));
|
|
38
|
-
const NativeLogBox_1 = __importDefault(require("../modules/NativeLogBox"));
|
|
39
|
-
const parseErrorStack_1 = __importDefault(require("../modules/parseErrorStack"));
|
|
40
38
|
const LogBoxLog_1 = require("./LogBoxLog");
|
|
41
39
|
const LogContext_1 = require("./LogContext");
|
|
42
40
|
const parseLogBoxLog_1 = require("./parseLogBoxLog");
|
|
41
|
+
const NativeLogBox_1 = __importDefault(require("../modules/NativeLogBox"));
|
|
42
|
+
const parseErrorStack_1 = __importDefault(require("../modules/parseErrorStack"));
|
|
43
43
|
const observers = new Set();
|
|
44
44
|
const ignorePatterns = new Set();
|
|
45
45
|
let logs = new Set();
|
|
46
46
|
let updateTimeout = null;
|
|
47
47
|
let _isDisabled = false;
|
|
48
48
|
let _selectedIndex = -1;
|
|
49
|
-
const LOGBOX_ERROR_MESSAGE =
|
|
49
|
+
const LOGBOX_ERROR_MESSAGE = 'An error was thrown when attempting to render log messages via LogBox.';
|
|
50
50
|
function getNextState() {
|
|
51
51
|
return {
|
|
52
52
|
logs,
|
|
@@ -55,7 +55,7 @@ function getNextState() {
|
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
function reportLogBoxError(error, componentStack) {
|
|
58
|
-
const ExceptionsManager = require(
|
|
58
|
+
const ExceptionsManager = require('../modules/ExceptionsManager').default;
|
|
59
59
|
if (componentStack != null) {
|
|
60
60
|
error.componentStack = componentStack;
|
|
61
61
|
}
|
|
@@ -68,13 +68,13 @@ function reportUnexpectedLogBoxError(error, componentStack) {
|
|
|
68
68
|
}
|
|
69
69
|
exports.reportUnexpectedLogBoxError = reportUnexpectedLogBoxError;
|
|
70
70
|
function isLogBoxErrorMessage(message) {
|
|
71
|
-
return typeof message ===
|
|
71
|
+
return typeof message === 'string' && message.includes(LOGBOX_ERROR_MESSAGE);
|
|
72
72
|
}
|
|
73
73
|
exports.isLogBoxErrorMessage = isLogBoxErrorMessage;
|
|
74
74
|
function isMessageIgnored(message) {
|
|
75
75
|
for (const pattern of ignorePatterns) {
|
|
76
76
|
if ((pattern instanceof RegExp && pattern.test(message)) ||
|
|
77
|
-
(typeof pattern ===
|
|
77
|
+
(typeof pattern === 'string' && message.includes(pattern))) {
|
|
78
78
|
return true;
|
|
79
79
|
}
|
|
80
80
|
}
|
|
@@ -111,7 +111,7 @@ function appendNewLog(newLog) {
|
|
|
111
111
|
handleUpdate();
|
|
112
112
|
return;
|
|
113
113
|
}
|
|
114
|
-
if (newLog.level ===
|
|
114
|
+
if (newLog.level === 'fatal') {
|
|
115
115
|
// If possible, to avoid jank, we don't want to open the error before
|
|
116
116
|
// it's symbolicated. To do that, we optimistically wait for
|
|
117
117
|
// symbolication for up to a second before adding the log.
|
|
@@ -132,19 +132,19 @@ function appendNewLog(newLog) {
|
|
|
132
132
|
}
|
|
133
133
|
}, OPTIMISTIC_WAIT_TIME);
|
|
134
134
|
// TODO: HANDLE THIS
|
|
135
|
-
newLog.symbolicate(
|
|
136
|
-
newLog.symbolicate(
|
|
137
|
-
if (addPendingLog && status !==
|
|
135
|
+
newLog.symbolicate('component');
|
|
136
|
+
newLog.symbolicate('stack', (status) => {
|
|
137
|
+
if (addPendingLog && status !== 'PENDING') {
|
|
138
138
|
addPendingLog();
|
|
139
139
|
clearTimeout(optimisticTimeout);
|
|
140
140
|
}
|
|
141
|
-
else if (status !==
|
|
141
|
+
else if (status !== 'PENDING') {
|
|
142
142
|
// The log has already been added but we need to trigger a render.
|
|
143
143
|
handleUpdate();
|
|
144
144
|
}
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
|
-
else if (newLog.level ===
|
|
147
|
+
else if (newLog.level === 'syntax') {
|
|
148
148
|
logs.add(newLog);
|
|
149
149
|
setSelectedLog(logs.size - 1);
|
|
150
150
|
}
|
|
@@ -159,7 +159,7 @@ function addLog(log) {
|
|
|
159
159
|
// otherwise spammy logs would pause rendering.
|
|
160
160
|
setImmediate(() => {
|
|
161
161
|
try {
|
|
162
|
-
const stack = (0, parseErrorStack_1.default)(errorForStackTrace
|
|
162
|
+
const stack = (0, parseErrorStack_1.default)(errorForStackTrace?.stack);
|
|
163
163
|
appendNewLog(new LogBoxLog_1.LogBoxLog({
|
|
164
164
|
level: log.level,
|
|
165
165
|
message: log.message,
|
|
@@ -218,7 +218,7 @@ function setSelectedLog(proposedNewIndex) {
|
|
|
218
218
|
let index = logArray.length - 1;
|
|
219
219
|
while (index >= 0) {
|
|
220
220
|
// The latest syntax error is selected and displayed before all other logs.
|
|
221
|
-
if (logArray[index].level ===
|
|
221
|
+
if (logArray[index].level === 'syntax') {
|
|
222
222
|
newIndex = index;
|
|
223
223
|
break;
|
|
224
224
|
}
|
|
@@ -239,7 +239,7 @@ function setSelectedLog(proposedNewIndex) {
|
|
|
239
239
|
}
|
|
240
240
|
exports.setSelectedLog = setSelectedLog;
|
|
241
241
|
function clearWarnings() {
|
|
242
|
-
const newLogs = Array.from(logs).filter((log) => log.level !==
|
|
242
|
+
const newLogs = Array.from(logs).filter((log) => log.level !== 'warn');
|
|
243
243
|
if (newLogs.length !== logs.size) {
|
|
244
244
|
logs = new Set(newLogs);
|
|
245
245
|
setSelectedLog(-1);
|
|
@@ -248,7 +248,7 @@ function clearWarnings() {
|
|
|
248
248
|
}
|
|
249
249
|
exports.clearWarnings = clearWarnings;
|
|
250
250
|
function clearErrors() {
|
|
251
|
-
const newLogs = Array.from(logs).filter((log) => log.level !==
|
|
251
|
+
const newLogs = Array.from(logs).filter((log) => log.level !== 'error' && log.level !== 'fatal');
|
|
252
252
|
if (newLogs.length !== logs.size) {
|
|
253
253
|
logs = new Set(newLogs);
|
|
254
254
|
setSelectedLog(-1);
|
|
@@ -318,37 +318,6 @@ function observe(observer) {
|
|
|
318
318
|
exports.observe = observe;
|
|
319
319
|
function withSubscription(WrappedComponent) {
|
|
320
320
|
class LogBoxStateSubscription extends React.Component {
|
|
321
|
-
constructor() {
|
|
322
|
-
super(...arguments);
|
|
323
|
-
this.state = {
|
|
324
|
-
logs: new Set(),
|
|
325
|
-
isDisabled: false,
|
|
326
|
-
hasError: false,
|
|
327
|
-
selectedLogIndex: -1,
|
|
328
|
-
};
|
|
329
|
-
this._handleDismiss = () => {
|
|
330
|
-
// Here we handle the cases when the log is dismissed and it
|
|
331
|
-
// was either the last log, or when the current index
|
|
332
|
-
// is now outside the bounds of the log array.
|
|
333
|
-
const { selectedLogIndex, logs: stateLogs } = this.state;
|
|
334
|
-
const logsArray = Array.from(stateLogs);
|
|
335
|
-
if (selectedLogIndex != null) {
|
|
336
|
-
if (logsArray.length - 1 <= 0) {
|
|
337
|
-
setSelectedLog(-1);
|
|
338
|
-
}
|
|
339
|
-
else if (selectedLogIndex >= logsArray.length - 1) {
|
|
340
|
-
setSelectedLog(selectedLogIndex - 1);
|
|
341
|
-
}
|
|
342
|
-
dismiss(logsArray[selectedLogIndex]);
|
|
343
|
-
}
|
|
344
|
-
};
|
|
345
|
-
this._handleMinimize = () => {
|
|
346
|
-
setSelectedLog(-1);
|
|
347
|
-
};
|
|
348
|
-
this._handleSetSelectedLog = (index) => {
|
|
349
|
-
setSelectedLog(index);
|
|
350
|
-
};
|
|
351
|
-
}
|
|
352
321
|
static getDerivedStateFromError() {
|
|
353
322
|
return { hasError: true };
|
|
354
323
|
}
|
|
@@ -357,6 +326,13 @@ function withSubscription(WrappedComponent) {
|
|
|
357
326
|
* this parameters */
|
|
358
327
|
reportLogBoxError(err, errorInfo.componentStack);
|
|
359
328
|
}
|
|
329
|
+
_subscription;
|
|
330
|
+
state = {
|
|
331
|
+
logs: new Set(),
|
|
332
|
+
isDisabled: false,
|
|
333
|
+
hasError: false,
|
|
334
|
+
selectedLogIndex: -1,
|
|
335
|
+
};
|
|
360
336
|
render() {
|
|
361
337
|
if (this.state.hasError) {
|
|
362
338
|
// This happens when the component failed to render, in which case we delegate to the native redbox.
|
|
@@ -381,6 +357,28 @@ function withSubscription(WrappedComponent) {
|
|
|
381
357
|
this._subscription.unsubscribe();
|
|
382
358
|
}
|
|
383
359
|
}
|
|
360
|
+
_handleDismiss = () => {
|
|
361
|
+
// Here we handle the cases when the log is dismissed and it
|
|
362
|
+
// was either the last log, or when the current index
|
|
363
|
+
// is now outside the bounds of the log array.
|
|
364
|
+
const { selectedLogIndex, logs: stateLogs } = this.state;
|
|
365
|
+
const logsArray = Array.from(stateLogs);
|
|
366
|
+
if (selectedLogIndex != null) {
|
|
367
|
+
if (logsArray.length - 1 <= 0) {
|
|
368
|
+
setSelectedLog(-1);
|
|
369
|
+
}
|
|
370
|
+
else if (selectedLogIndex >= logsArray.length - 1) {
|
|
371
|
+
setSelectedLog(selectedLogIndex - 1);
|
|
372
|
+
}
|
|
373
|
+
dismiss(logsArray[selectedLogIndex]);
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
_handleMinimize = () => {
|
|
377
|
+
setSelectedLog(-1);
|
|
378
|
+
};
|
|
379
|
+
_handleSetSelectedLog = (index) => {
|
|
380
|
+
setSelectedLog(index);
|
|
381
|
+
};
|
|
384
382
|
}
|
|
385
383
|
// @ts-expect-error
|
|
386
384
|
return LogBoxStateSubscription;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogBoxData.js","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogBoxData.tsx"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,2EAAmD;AACnD,iFAAyD;AACzD,2CAAmD;AAEnD,6CAA0C;AAC1C,qDAAwD;AAoDxD,MAAM,SAAS,GAAsC,IAAI,GAAG,EAAE,CAAC;AAC/D,MAAM,cAAc,GAAuB,IAAI,GAAG,EAAE,CAAC;AACrD,IAAI,IAAI,GAAe,IAAI,GAAG,EAAE,CAAC;AACjC,IAAI,aAAa,GAGmB,IAAI,CAAC;AACzC,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB,IAAI,cAAc,GAAG,CAAC,CAAC,CAAC;AAExB,MAAM,oBAAoB,GACxB,wEAAwE,CAAC;AAE3E,SAAS,YAAY;IACnB,OAAO;QACL,IAAI;QACJ,UAAU,EAAE,WAAW;QACvB,gBAAgB,EAAE,cAAc;KACjC,CAAC;AACJ,CAAC;AAED,SAAgB,iBAAiB,CAC/B,KAAoB,EACpB,cAAuB;IAEvB,MAAM,iBAAiB,GAAG,OAAO,CAAC,8BAA8B,CAA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CAAC;aAClC;QACH,CAAC;KA0BF;IAED,mBAAmB;IACnB,OAAO,uBAAuB,CAAC;AACjC,CAAC;AAvFD,4CAuFC","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 React from \"react\";\n\nimport NativeLogBox from \"../modules/NativeLogBox\";\nimport parseErrorStack from \"../modules/parseErrorStack\";\nimport { LogBoxLog, StackType } from \"./LogBoxLog\";\nimport type { LogLevel } from \"./LogBoxLog\";\nimport { LogContext } from \"./LogContext\";\nimport { parseLogBoxException } from \"./parseLogBoxLog\";\nimport type {\n Message,\n Category,\n ComponentStack,\n ExtendedExceptionData,\n} from \"./parseLogBoxLog\";\n\nexport type LogBoxLogs = Set<LogBoxLog>;\n\nexport type LogData = {\n level: LogLevel;\n message: Message;\n category: Category;\n componentStack: ComponentStack;\n};\n\ntype ExtendedError = any;\n\nexport type Observer = (options: {\n logs: LogBoxLogs;\n isDisabled: boolean;\n selectedLogIndex: number;\n}) => void;\n\nexport type IgnorePattern = string | RegExp;\n\nexport type Subscription = {\n unsubscribe: () => void;\n};\n\nexport type WarningInfo = {\n finalFormat: string;\n forceDialogImmediately: boolean;\n suppressDialog_LEGACY: boolean;\n suppressCompletely: boolean;\n monitorEvent: string | null;\n monitorListVersion: number;\n monitorSampleRate: number;\n};\n\nexport type WarningFilter = (format: string) => WarningInfo;\n\ntype Props = object;\n\ntype State = {\n logs: LogBoxLogs;\n isDisabled: boolean;\n hasError: boolean;\n selectedLogIndex: number;\n};\n\nconst observers: Set<{ observer: Observer } & any> = new Set();\nconst ignorePatterns: Set<IgnorePattern> = new Set();\nlet logs: LogBoxLogs = new Set();\nlet updateTimeout:\n | null\n | ReturnType<typeof setImmediate>\n | ReturnType<typeof setTimeout> = null;\nlet _isDisabled = false;\nlet _selectedIndex = -1;\n\nconst LOGBOX_ERROR_MESSAGE =\n \"An error was thrown when attempting to render log messages via LogBox.\";\n\nfunction getNextState() {\n return {\n logs,\n isDisabled: _isDisabled,\n selectedLogIndex: _selectedIndex,\n };\n}\n\nexport function reportLogBoxError(\n error: ExtendedError,\n componentStack?: string\n): void {\n const ExceptionsManager = require(\"../modules/ExceptionsManager\");\n\n if (componentStack != null) {\n error.componentStack = componentStack;\n }\n ExceptionsManager.handleException(error);\n}\n\nexport function reportUnexpectedLogBoxError(\n error: ExtendedError,\n componentStack?: string\n): void {\n error.message = `${LOGBOX_ERROR_MESSAGE}\\n\\n${error.message}`;\n return reportLogBoxError(error, componentStack);\n}\n\nexport function isLogBoxErrorMessage(message: string): boolean {\n return typeof message === \"string\" && message.includes(LOGBOX_ERROR_MESSAGE);\n}\n\nexport function isMessageIgnored(message: string): boolean {\n for (const pattern of ignorePatterns) {\n if (\n (pattern instanceof RegExp && pattern.test(message)) ||\n (typeof pattern === \"string\" && message.includes(pattern))\n ) {\n return true;\n }\n }\n return false;\n}\n\nfunction setImmediateShim(callback: () => void) {\n if (!global.setImmediate) {\n return setTimeout(callback, 0);\n }\n return global.setImmediate(callback);\n}\n\nfunction handleUpdate(): void {\n if (updateTimeout == null) {\n updateTimeout = setImmediateShim(() => {\n updateTimeout = null;\n const nextState = getNextState();\n observers.forEach(({ observer }) => observer(nextState));\n });\n }\n}\n\nfunction appendNewLog(newLog: LogBoxLog): void {\n // Don't want store these logs because they trigger a\n // state update when we add them to the store.\n if (isMessageIgnored(newLog.message.content)) {\n return;\n }\n\n // If the next log has the same category as the previous one\n // then roll it up into the last log in the list by incrementing\n // the count (similar to how Chrome does it).\n const lastLog = Array.from(logs).pop();\n if (lastLog && lastLog.category === newLog.category) {\n lastLog.incrementCount();\n handleUpdate();\n return;\n }\n\n if (newLog.level === \"fatal\") {\n // If possible, to avoid jank, we don't want to open the error before\n // it's symbolicated. To do that, we optimistically wait for\n // symbolication for up to a second before adding the log.\n const OPTIMISTIC_WAIT_TIME = 1000;\n\n let addPendingLog: null | (() => void) = () => {\n logs.add(newLog);\n if (_selectedIndex < 0) {\n setSelectedLog(logs.size - 1);\n } else {\n handleUpdate();\n }\n addPendingLog = null;\n };\n\n const optimisticTimeout = setTimeout(() => {\n if (addPendingLog) {\n addPendingLog();\n }\n }, OPTIMISTIC_WAIT_TIME);\n\n // TODO: HANDLE THIS\n newLog.symbolicate(\"component\");\n\n newLog.symbolicate(\"stack\", (status) => {\n if (addPendingLog && status !== \"PENDING\") {\n addPendingLog();\n clearTimeout(optimisticTimeout);\n } else if (status !== \"PENDING\") {\n // The log has already been added but we need to trigger a render.\n handleUpdate();\n }\n });\n } else if (newLog.level === \"syntax\") {\n logs.add(newLog);\n setSelectedLog(logs.size - 1);\n } else {\n logs.add(newLog);\n handleUpdate();\n }\n}\n\nexport function addLog(log: LogData): void {\n const errorForStackTrace = new Error();\n\n // Parsing logs are expensive so we schedule this\n // otherwise spammy logs would pause rendering.\n setImmediate(() => {\n try {\n const stack = parseErrorStack(errorForStackTrace?.stack);\n\n appendNewLog(\n new LogBoxLog({\n level: log.level,\n message: log.message,\n isComponentError: false,\n stack,\n category: log.category,\n componentStack: log.componentStack,\n })\n );\n } catch (error) {\n reportUnexpectedLogBoxError(error);\n }\n });\n}\n\nexport function addException(error: ExtendedExceptionData): void {\n // Parsing logs are expensive so we schedule this\n // otherwise spammy logs would pause rendering.\n setImmediate(() => {\n try {\n appendNewLog(new LogBoxLog(parseLogBoxException(error)));\n } catch (loggingError) {\n reportUnexpectedLogBoxError(loggingError);\n }\n });\n}\n\nexport function symbolicateLogNow(type: StackType, log: LogBoxLog) {\n log.symbolicate(type, () => {\n handleUpdate();\n });\n}\n\nexport function retrySymbolicateLogNow(type: StackType, log: LogBoxLog) {\n log.retrySymbolicate(type, () => {\n handleUpdate();\n });\n}\n\nexport function symbolicateLogLazy(type: StackType, log: LogBoxLog) {\n log.symbolicate(type);\n}\n\nexport function clear(): void {\n if (logs.size > 0) {\n logs = new Set();\n setSelectedLog(-1);\n }\n}\n\nexport function setSelectedLog(proposedNewIndex: number): void {\n const oldIndex = _selectedIndex;\n let newIndex = proposedNewIndex;\n\n const logArray = Array.from(logs);\n let index = logArray.length - 1;\n while (index >= 0) {\n // The latest syntax error is selected and displayed before all other logs.\n if (logArray[index].level === \"syntax\") {\n newIndex = index;\n break;\n }\n index -= 1;\n }\n _selectedIndex = newIndex;\n handleUpdate();\n if (NativeLogBox) {\n setTimeout(() => {\n if (oldIndex < 0 && newIndex >= 0) {\n NativeLogBox.show();\n } else if (oldIndex >= 0 && newIndex < 0) {\n NativeLogBox.hide();\n }\n }, 0);\n }\n}\n\nexport function clearWarnings(): void {\n const newLogs = Array.from(logs).filter((log) => log.level !== \"warn\");\n if (newLogs.length !== logs.size) {\n logs = new Set(newLogs);\n setSelectedLog(-1);\n handleUpdate();\n }\n}\n\nexport function clearErrors(): void {\n const newLogs = Array.from(logs).filter(\n (log) => log.level !== \"error\" && log.level !== \"fatal\"\n );\n if (newLogs.length !== logs.size) {\n logs = new Set(newLogs);\n setSelectedLog(-1);\n }\n}\n\nexport function dismiss(log: LogBoxLog): void {\n if (logs.has(log)) {\n logs.delete(log);\n handleUpdate();\n }\n}\n\nexport function getIgnorePatterns(): IgnorePattern[] {\n return Array.from(ignorePatterns);\n}\n\nexport function addIgnorePatterns(patterns: IgnorePattern[]): void {\n const existingSize = ignorePatterns.size;\n // The same pattern may be added multiple times, but adding a new pattern\n // can be expensive so let's find only the ones that are new.\n patterns.forEach((pattern: IgnorePattern) => {\n if (pattern instanceof RegExp) {\n for (const existingPattern of ignorePatterns) {\n if (\n existingPattern instanceof RegExp &&\n existingPattern.toString() === pattern.toString()\n ) {\n return;\n }\n }\n ignorePatterns.add(pattern);\n }\n ignorePatterns.add(pattern);\n });\n if (ignorePatterns.size === existingSize) {\n return;\n }\n // We need to recheck all of the existing logs.\n // This allows adding an ignore pattern anywhere in the codebase.\n // Without this, if you ignore a pattern after the a log is created,\n // then we would keep showing the log.\n logs = new Set(\n Array.from(logs).filter((log) => !isMessageIgnored(log.message.content))\n );\n handleUpdate();\n}\n\nexport function setDisabled(value: boolean): void {\n if (value === _isDisabled) {\n return;\n }\n _isDisabled = value;\n handleUpdate();\n}\n\nexport function isDisabled(): boolean {\n return _isDisabled;\n}\n\nexport function observe(observer: Observer): Subscription {\n const subscription = { observer };\n observers.add(subscription);\n\n observer(getNextState());\n\n return {\n unsubscribe(): void {\n observers.delete(subscription);\n },\n };\n}\n\nexport function withSubscription(\n WrappedComponent: React.FC<object>\n): React.Component<object> {\n class LogBoxStateSubscription extends React.Component<\n React.PropsWithChildren<Props>,\n State\n > {\n static getDerivedStateFromError() {\n return { hasError: true };\n }\n\n componentDidCatch(err: Error, errorInfo: { componentStack: string } & any) {\n /* $FlowFixMe[class-object-subtyping] added when improving typing for\n * this parameters */\n reportLogBoxError(err, errorInfo.componentStack);\n }\n\n _subscription?: Subscription;\n\n state = {\n logs: new Set<LogBoxLog>(),\n isDisabled: false,\n hasError: false,\n selectedLogIndex: -1,\n };\n\n render() {\n if (this.state.hasError) {\n // This happens when the component failed to render, in which case we delegate to the native redbox.\n // We can't show any fallback UI here, because the error may be with <View> or <Text>.\n return null;\n }\n\n return (\n <LogContext.Provider\n value={{\n selectedLogIndex: this.state.selectedLogIndex,\n isDisabled: this.state.isDisabled,\n logs: Array.from(this.state.logs),\n }}\n >\n {this.props.children}\n <WrappedComponent />\n </LogContext.Provider>\n );\n }\n\n componentDidMount(): void {\n this._subscription = observe((data) => {\n this.setState(data);\n });\n }\n\n componentWillUnmount(): void {\n if (this._subscription != null) {\n this._subscription.unsubscribe();\n }\n }\n\n _handleDismiss = (): void => {\n // Here we handle the cases when the log is dismissed and it\n // was either the last log, or when the current index\n // is now outside the bounds of the log array.\n const { selectedLogIndex, logs: stateLogs } = this.state;\n const logsArray = Array.from(stateLogs);\n if (selectedLogIndex != null) {\n if (logsArray.length - 1 <= 0) {\n setSelectedLog(-1);\n } else if (selectedLogIndex >= logsArray.length - 1) {\n setSelectedLog(selectedLogIndex - 1);\n }\n\n dismiss(logsArray[selectedLogIndex]);\n }\n };\n\n _handleMinimize = (): void => {\n setSelectedLog(-1);\n };\n\n _handleSetSelectedLog = (index: number): void => {\n setSelectedLog(index);\n };\n }\n\n // @ts-expect-error\n return LogBoxStateSubscription;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"LogBoxData.js","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogBoxData.tsx"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,2CAAmD;AAEnD,6CAA0C;AAC1C,qDAAwD;AAExD,2EAAmD;AACnD,iFAAyD;AA8CzD,MAAM,SAAS,GAAsC,IAAI,GAAG,EAAE,CAAC;AAC/D,MAAM,cAAc,GAAuB,IAAI,GAAG,EAAE,CAAC;AACrD,IAAI,IAAI,GAAe,IAAI,GAAG,EAAE,CAAC;AACjC,IAAI,aAAa,GAA2E,IAAI,CAAC;AACjG,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB,IAAI,cAAc,GAAG,CAAC,CAAC,CAAC;AAExB,MAAM,oBAAoB,GACxB,wEAAwE,CAAC;AAE3E,SAAS,YAAY;IACnB,OAAO;QACL,IAAI;QACJ,UAAU,EAAE,WAAW;QACvB,gBAAgB,EAAE,cAAc;KACjC,CAAC;AACJ,CAAC;AAED,SAAgB,iBAAiB,CAAC,KAAoB,EAAE,cAAuB;IAC7E,MAAM,iBAAiB,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC,OAAO,CAAC;IAE1E,IAAI,cAAc,IAAI,IAAI,EAAE;QAC1B,KAAK,CAAC,cAAc,GAAG,cAAc,CAAC;KACvC;IACD,iBAAiB,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;AAC3C,CAAC;AAPD,8CAOC;AAED,SAAgB,2BAA2B,CAAC,KAAoB,EAAE,cAAuB;IACvF,KAAK,CAAC,OAAO,GAAG,GAAG,oBAAoB,OAAO,KAAK,CAAC,OA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AC;QACL,CAAC;QAED,oBAAoB;YAClB,IAAI,IAAI,CAAC,aAAa,IAAI,IAAI,EAAE;gBAC9B,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC;aAClC;QACH,CAAC;QAED,cAAc,GAAG,GAAS,EAAE;YAC1B,4DAA4D;YAC5D,qDAAqD;YACrD,8CAA8C;YAC9C,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;YACzD,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACxC,IAAI,gBAAgB,IAAI,IAAI,EAAE;gBAC5B,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,EAAE;oBAC7B,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;iBACpB;qBAAM,IAAI,gBAAgB,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;oBACnD,cAAc,CAAC,gBAAgB,GAAG,CAAC,CAAC,CAAC;iBACtC;gBAED,OAAO,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,CAAC;aACtC;QACH,CAAC,CAAC;QAEF,eAAe,GAAG,GAAS,EAAE;YAC3B,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;QACrB,CAAC,CAAC;QAEF,qBAAqB,GAAG,CAAC,KAAa,EAAQ,EAAE;YAC9C,cAAc,CAAC,KAAK,CAAC,CAAC;QACxB,CAAC,CAAC;KACH;IAED,mBAAmB;IACnB,OAAO,uBAAuB,CAAC;AACjC,CAAC;AAjFD,4CAiFC","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 React from 'react';\n\nimport { LogBoxLog, StackType } from './LogBoxLog';\nimport type { LogLevel } from './LogBoxLog';\nimport { LogContext } from './LogContext';\nimport { parseLogBoxException } from './parseLogBoxLog';\nimport type { Message, Category, ComponentStack, ExtendedExceptionData } from './parseLogBoxLog';\nimport NativeLogBox from '../modules/NativeLogBox';\nimport parseErrorStack from '../modules/parseErrorStack';\n\nexport type LogBoxLogs = Set<LogBoxLog>;\n\nexport type LogData = {\n level: LogLevel;\n message: Message;\n category: Category;\n componentStack: ComponentStack;\n};\n\ntype ExtendedError = any;\n\nexport type Observer = (options: {\n logs: LogBoxLogs;\n isDisabled: boolean;\n selectedLogIndex: number;\n}) => void;\n\nexport type IgnorePattern = string | RegExp;\n\nexport type Subscription = {\n unsubscribe: () => void;\n};\n\nexport type WarningInfo = {\n finalFormat: string;\n forceDialogImmediately: boolean;\n suppressDialog_LEGACY: boolean;\n suppressCompletely: boolean;\n monitorEvent: string | null;\n monitorListVersion: number;\n monitorSampleRate: number;\n};\n\nexport type WarningFilter = (format: string) => WarningInfo;\n\ntype Props = object;\n\ntype State = {\n logs: LogBoxLogs;\n isDisabled: boolean;\n hasError: boolean;\n selectedLogIndex: number;\n};\n\nconst observers: Set<{ observer: Observer } & any> = new Set();\nconst ignorePatterns: Set<IgnorePattern> = new Set();\nlet logs: LogBoxLogs = new Set();\nlet updateTimeout: null | ReturnType<typeof setImmediate> | ReturnType<typeof setTimeout> = null;\nlet _isDisabled = false;\nlet _selectedIndex = -1;\n\nconst LOGBOX_ERROR_MESSAGE =\n 'An error was thrown when attempting to render log messages via LogBox.';\n\nfunction getNextState() {\n return {\n logs,\n isDisabled: _isDisabled,\n selectedLogIndex: _selectedIndex,\n };\n}\n\nexport function reportLogBoxError(error: ExtendedError, componentStack?: string): void {\n const ExceptionsManager = require('../modules/ExceptionsManager').default;\n\n if (componentStack != null) {\n error.componentStack = componentStack;\n }\n ExceptionsManager.handleException(error);\n}\n\nexport function reportUnexpectedLogBoxError(error: ExtendedError, componentStack?: string): void {\n error.message = `${LOGBOX_ERROR_MESSAGE}\\n\\n${error.message}`;\n return reportLogBoxError(error, componentStack);\n}\n\nexport function isLogBoxErrorMessage(message: string): boolean {\n return typeof message === 'string' && message.includes(LOGBOX_ERROR_MESSAGE);\n}\n\nexport function isMessageIgnored(message: string): boolean {\n for (const pattern of ignorePatterns) {\n if (\n (pattern instanceof RegExp && pattern.test(message)) ||\n (typeof pattern === 'string' && message.includes(pattern))\n ) {\n return true;\n }\n }\n return false;\n}\n\nfunction setImmediateShim(callback: () => void) {\n if (!global.setImmediate) {\n return setTimeout(callback, 0);\n }\n return global.setImmediate(callback);\n}\n\nfunction handleUpdate(): void {\n if (updateTimeout == null) {\n updateTimeout = setImmediateShim(() => {\n updateTimeout = null;\n const nextState = getNextState();\n observers.forEach(({ observer }) => observer(nextState));\n });\n }\n}\n\nfunction appendNewLog(newLog: LogBoxLog): void {\n // Don't want store these logs because they trigger a\n // state update when we add them to the store.\n if (isMessageIgnored(newLog.message.content)) {\n return;\n }\n\n // If the next log has the same category as the previous one\n // then roll it up into the last log in the list by incrementing\n // the count (similar to how Chrome does it).\n const lastLog = Array.from(logs).pop();\n if (lastLog && lastLog.category === newLog.category) {\n lastLog.incrementCount();\n handleUpdate();\n return;\n }\n\n if (newLog.level === 'fatal') {\n // If possible, to avoid jank, we don't want to open the error before\n // it's symbolicated. To do that, we optimistically wait for\n // symbolication for up to a second before adding the log.\n const OPTIMISTIC_WAIT_TIME = 1000;\n\n let addPendingLog: null | (() => void) = () => {\n logs.add(newLog);\n if (_selectedIndex < 0) {\n setSelectedLog(logs.size - 1);\n } else {\n handleUpdate();\n }\n addPendingLog = null;\n };\n\n const optimisticTimeout = setTimeout(() => {\n if (addPendingLog) {\n addPendingLog();\n }\n }, OPTIMISTIC_WAIT_TIME);\n\n // TODO: HANDLE THIS\n newLog.symbolicate('component');\n\n newLog.symbolicate('stack', (status) => {\n if (addPendingLog && status !== 'PENDING') {\n addPendingLog();\n clearTimeout(optimisticTimeout);\n } else if (status !== 'PENDING') {\n // The log has already been added but we need to trigger a render.\n handleUpdate();\n }\n });\n } else if (newLog.level === 'syntax') {\n logs.add(newLog);\n setSelectedLog(logs.size - 1);\n } else {\n logs.add(newLog);\n handleUpdate();\n }\n}\n\nexport function addLog(log: LogData): void {\n const errorForStackTrace = new Error();\n\n // Parsing logs are expensive so we schedule this\n // otherwise spammy logs would pause rendering.\n setImmediate(() => {\n try {\n const stack = parseErrorStack(errorForStackTrace?.stack);\n\n appendNewLog(\n new LogBoxLog({\n level: log.level,\n message: log.message,\n isComponentError: false,\n stack,\n category: log.category,\n componentStack: log.componentStack,\n })\n );\n } catch (error) {\n reportUnexpectedLogBoxError(error);\n }\n });\n}\n\nexport function addException(error: ExtendedExceptionData): void {\n // Parsing logs are expensive so we schedule this\n // otherwise spammy logs would pause rendering.\n setImmediate(() => {\n try {\n appendNewLog(new LogBoxLog(parseLogBoxException(error)));\n } catch (loggingError) {\n reportUnexpectedLogBoxError(loggingError);\n }\n });\n}\n\nexport function symbolicateLogNow(type: StackType, log: LogBoxLog) {\n log.symbolicate(type, () => {\n handleUpdate();\n });\n}\n\nexport function retrySymbolicateLogNow(type: StackType, log: LogBoxLog) {\n log.retrySymbolicate(type, () => {\n handleUpdate();\n });\n}\n\nexport function symbolicateLogLazy(type: StackType, log: LogBoxLog) {\n log.symbolicate(type);\n}\n\nexport function clear(): void {\n if (logs.size > 0) {\n logs = new Set();\n setSelectedLog(-1);\n }\n}\n\nexport function setSelectedLog(proposedNewIndex: number): void {\n const oldIndex = _selectedIndex;\n let newIndex = proposedNewIndex;\n\n const logArray = Array.from(logs);\n let index = logArray.length - 1;\n while (index >= 0) {\n // The latest syntax error is selected and displayed before all other logs.\n if (logArray[index].level === 'syntax') {\n newIndex = index;\n break;\n }\n index -= 1;\n }\n _selectedIndex = newIndex;\n handleUpdate();\n if (NativeLogBox) {\n setTimeout(() => {\n if (oldIndex < 0 && newIndex >= 0) {\n NativeLogBox.show();\n } else if (oldIndex >= 0 && newIndex < 0) {\n NativeLogBox.hide();\n }\n }, 0);\n }\n}\n\nexport function clearWarnings(): void {\n const newLogs = Array.from(logs).filter((log) => log.level !== 'warn');\n if (newLogs.length !== logs.size) {\n logs = new Set(newLogs);\n setSelectedLog(-1);\n handleUpdate();\n }\n}\n\nexport function clearErrors(): void {\n const newLogs = Array.from(logs).filter((log) => log.level !== 'error' && log.level !== 'fatal');\n if (newLogs.length !== logs.size) {\n logs = new Set(newLogs);\n setSelectedLog(-1);\n }\n}\n\nexport function dismiss(log: LogBoxLog): void {\n if (logs.has(log)) {\n logs.delete(log);\n handleUpdate();\n }\n}\n\nexport function getIgnorePatterns(): IgnorePattern[] {\n return Array.from(ignorePatterns);\n}\n\nexport function addIgnorePatterns(patterns: IgnorePattern[]): void {\n const existingSize = ignorePatterns.size;\n // The same pattern may be added multiple times, but adding a new pattern\n // can be expensive so let's find only the ones that are new.\n patterns.forEach((pattern: IgnorePattern) => {\n if (pattern instanceof RegExp) {\n for (const existingPattern of ignorePatterns) {\n if (\n existingPattern instanceof RegExp &&\n existingPattern.toString() === pattern.toString()\n ) {\n return;\n }\n }\n ignorePatterns.add(pattern);\n }\n ignorePatterns.add(pattern);\n });\n if (ignorePatterns.size === existingSize) {\n return;\n }\n // We need to recheck all of the existing logs.\n // This allows adding an ignore pattern anywhere in the codebase.\n // Without this, if you ignore a pattern after the a log is created,\n // then we would keep showing the log.\n logs = new Set(Array.from(logs).filter((log) => !isMessageIgnored(log.message.content)));\n handleUpdate();\n}\n\nexport function setDisabled(value: boolean): void {\n if (value === _isDisabled) {\n return;\n }\n _isDisabled = value;\n handleUpdate();\n}\n\nexport function isDisabled(): boolean {\n return _isDisabled;\n}\n\nexport function observe(observer: Observer): Subscription {\n const subscription = { observer };\n observers.add(subscription);\n\n observer(getNextState());\n\n return {\n unsubscribe(): void {\n observers.delete(subscription);\n },\n };\n}\n\nexport function withSubscription(WrappedComponent: React.FC<object>): React.Component<object> {\n class LogBoxStateSubscription extends React.Component<React.PropsWithChildren<Props>, State> {\n static getDerivedStateFromError() {\n return { hasError: true };\n }\n\n componentDidCatch(err: Error, errorInfo: { componentStack: string } & any) {\n /* $FlowFixMe[class-object-subtyping] added when improving typing for\n * this parameters */\n reportLogBoxError(err, errorInfo.componentStack);\n }\n\n _subscription?: Subscription;\n\n state = {\n logs: new Set<LogBoxLog>(),\n isDisabled: false,\n hasError: false,\n selectedLogIndex: -1,\n };\n\n render() {\n if (this.state.hasError) {\n // This happens when the component failed to render, in which case we delegate to the native redbox.\n // We can't show any fallback UI here, because the error may be with <View> or <Text>.\n return null;\n }\n\n return (\n <LogContext.Provider\n value={{\n selectedLogIndex: this.state.selectedLogIndex,\n isDisabled: this.state.isDisabled,\n logs: Array.from(this.state.logs),\n }}>\n {this.props.children}\n <WrappedComponent />\n </LogContext.Provider>\n );\n }\n\n componentDidMount(): void {\n this._subscription = observe((data) => {\n this.setState(data);\n });\n }\n\n componentWillUnmount(): void {\n if (this._subscription != null) {\n this._subscription.unsubscribe();\n }\n }\n\n _handleDismiss = (): void => {\n // Here we handle the cases when the log is dismissed and it\n // was either the last log, or when the current index\n // is now outside the bounds of the log array.\n const { selectedLogIndex, logs: stateLogs } = this.state;\n const logsArray = Array.from(stateLogs);\n if (selectedLogIndex != null) {\n if (logsArray.length - 1 <= 0) {\n setSelectedLog(-1);\n } else if (selectedLogIndex >= logsArray.length - 1) {\n setSelectedLog(selectedLogIndex - 1);\n }\n\n dismiss(logsArray[selectedLogIndex]);\n }\n };\n\n _handleMinimize = (): void => {\n setSelectedLog(-1);\n };\n\n _handleSetSelectedLog = (index: number): void => {\n setSelectedLog(index);\n };\n }\n\n // @ts-expect-error\n return LogBoxStateSubscription;\n}\n"]}
|
|
@@ -1,14 +1,14 @@
|
|
|
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 { Stack } from
|
|
9
|
-
import type { Category, Message, ComponentStack, CodeFrame } from
|
|
10
|
-
type SymbolicationStatus =
|
|
11
|
-
export type LogLevel =
|
|
8
|
+
import type { Stack } from './LogBoxSymbolication';
|
|
9
|
+
import type { Category, Message, ComponentStack, CodeFrame } from './parseLogBoxLog';
|
|
10
|
+
type SymbolicationStatus = 'NONE' | 'PENDING' | 'COMPLETE' | 'FAILED';
|
|
11
|
+
export type LogLevel = 'warn' | 'error' | 'fatal' | 'syntax' | 'static';
|
|
12
12
|
export type LogBoxLogData = {
|
|
13
13
|
level: LogLevel;
|
|
14
14
|
type?: string;
|
|
@@ -19,23 +19,23 @@ export type LogBoxLogData = {
|
|
|
19
19
|
codeFrame?: CodeFrame;
|
|
20
20
|
isComponentError: boolean;
|
|
21
21
|
};
|
|
22
|
-
export type StackType =
|
|
22
|
+
export type StackType = 'stack' | 'component';
|
|
23
23
|
type SymbolicationResult = {
|
|
24
24
|
error: null;
|
|
25
25
|
stack: null;
|
|
26
|
-
status:
|
|
26
|
+
status: 'NONE';
|
|
27
27
|
} | {
|
|
28
28
|
error: null;
|
|
29
29
|
stack: null;
|
|
30
|
-
status:
|
|
30
|
+
status: 'PENDING';
|
|
31
31
|
} | {
|
|
32
32
|
error: null;
|
|
33
33
|
stack: Stack;
|
|
34
|
-
status:
|
|
34
|
+
status: 'COMPLETE';
|
|
35
35
|
} | {
|
|
36
36
|
error: Error;
|
|
37
37
|
stack: null;
|
|
38
|
-
status:
|
|
38
|
+
status: 'FAILED';
|
|
39
39
|
};
|
|
40
40
|
export declare class LogBoxLog {
|
|
41
41
|
message: Message;
|