@expo/metro-runtime 2.2.3 → 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 +18 -44
- 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 -58
- 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 +35 -64
- 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 +37 -71
- 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 +20 -54
- 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 -55
- 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 +44 -72
- 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 -37
- 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,5 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
const LogBox = {
|
|
4
2
|
install() {
|
|
5
3
|
// Do nothing.
|
|
@@ -26,6 +24,5 @@ const LogBox = {
|
|
|
26
24
|
// Do nothing.
|
|
27
25
|
},
|
|
28
26
|
};
|
|
29
|
-
|
|
30
|
-
exports.default = LogBox;
|
|
27
|
+
export default LogBox;
|
|
31
28
|
//# sourceMappingURL=LogBox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogBox.js","sourceRoot":"","sources":["../../src/error-overlay/LogBox.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LogBox.js","sourceRoot":"","sources":["../../src/error-overlay/LogBox.ts"],"names":[],"mappings":"AAgBA,MAAM,MAAM,GAAY;IACtB,OAAO;QACL,cAAc;IAChB,CAAC;IAED,SAAS;QACP,cAAc;IAChB,CAAC;IAED,WAAW;QACT,OAAO,KAAK,CAAC;IACf,CAAC;IAED,UAAU,CAAC,QAAkC;QAC3C,cAAc;IAChB,CAAC;IAED,aAAa,CAAC,KAAe;QAC3B,cAAc;IAChB,CAAC;IAED,YAAY;QACV,cAAc;IAChB,CAAC;IAED,MAAM,CAAC,GAAY;QACjB,cAAc;IAChB,CAAC;IAED,YAAY,CAAC,EAAyB;QACpC,cAAc;IAChB,CAAC;CACF,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import { IgnorePattern, LogData } from './Data/LogBoxData';\nimport { ExtendedExceptionData } from './Data/parseLogBoxLog';\n\nexport { LogData, ExtendedExceptionData, IgnorePattern };\n\ninterface ILogBox {\n install(): void;\n uninstall(): void;\n isInstalled(): boolean;\n ignoreLogs(patterns: readonly IgnorePattern[]): void;\n ignoreAllLogs(ignore?: boolean): void;\n clearAllLogs(): void;\n addLog(log: LogData): void;\n addException(error: ExtendedExceptionData): void;\n}\n\nconst LogBox: ILogBox = {\n install(): void {\n // Do nothing.\n },\n\n uninstall(): void {\n // Do nothing.\n },\n\n isInstalled(): boolean {\n return false;\n },\n\n ignoreLogs(patterns: readonly IgnorePattern[]): void {\n // Do nothing.\n },\n\n ignoreAllLogs(value?: boolean): void {\n // Do nothing.\n },\n\n clearAllLogs(): void {\n // Do nothing.\n },\n\n addLog(log: LogData): void {\n // Do nothing.\n },\n\n addException(ex: ExtendedExceptionData): void {\n // Do nothing.\n },\n};\n\nexport default LogBox;\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
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 { IgnorePattern, LogData } from
|
|
9
|
-
import { ExtendedExceptionData } from
|
|
8
|
+
import { IgnorePattern, LogData } from './Data/LogBoxData';
|
|
9
|
+
import { ExtendedExceptionData } from './Data/parseLogBoxLog';
|
|
10
10
|
export { LogData, ExtendedExceptionData, IgnorePattern };
|
|
11
11
|
declare let LogBox: ILogBox;
|
|
12
12
|
interface ILogBox {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogBox.web.d.ts","sourceRoot":"","sources":["../../src/error-overlay/LogBox.web.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,OAAO,EAAE,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,CAAC;AAEzD,QAAA,IAAI,MAAM,EAAE,OAAO,CAAC;AAEpB,UAAU,OAAO;IACf,OAAO,IAAI,IAAI,CAAC;IAChB,SAAS,IAAI,IAAI,CAAC;IAClB,WAAW,IAAI,OAAO,CAAC;IACvB,UAAU,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,GAAG,IAAI,CAAC;IACrD,aAAa,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACtC,YAAY,IAAI,IAAI,CAAC;IACrB,MAAM,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,YAAY,CAAC,KAAK,EAAE,qBAAqB,GAAG,IAAI,CAAC;CAClD;
|
|
1
|
+
{"version":3,"file":"LogBox.web.d.ts","sourceRoot":"","sources":["../../src/error-overlay/LogBox.web.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,OAAO,EAAE,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,CAAC;AAEzD,QAAA,IAAI,MAAM,EAAE,OAAO,CAAC;AAEpB,UAAU,OAAO;IACf,OAAO,IAAI,IAAI,CAAC;IAChB,SAAS,IAAI,IAAI,CAAC;IAClB,WAAW,IAAI,OAAO,CAAC;IACvB,UAAU,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,GAAG,IAAI,CAAC;IACrD,aAAa,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACtC,YAAY,IAAI,IAAI,CAAC;IACrB,MAAM,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,YAAY,CAAC,KAAK,EAAE,qBAAqB,GAAG,IAAI,CAAC;CAClD;AAqJD,eAAe,MAAM,CAAC"}
|
|
@@ -1,20 +1,18 @@
|
|
|
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
|
-
const react_native_1 = require("react-native");
|
|
8
|
+
import { Platform } from 'react-native';
|
|
11
9
|
let LogBox;
|
|
12
10
|
/**
|
|
13
11
|
* LogBox displays logs in the app.
|
|
14
12
|
*/
|
|
15
13
|
if (__DEV__) {
|
|
16
|
-
const LogBoxData = require(
|
|
17
|
-
const { parseLogBoxLog, parseInterpolation } = require(
|
|
14
|
+
const LogBoxData = require('./Data/LogBoxData');
|
|
15
|
+
const { parseLogBoxLog, parseInterpolation } = require('./Data/parseLogBoxLog');
|
|
18
16
|
let originalConsoleError;
|
|
19
17
|
let consoleErrorImpl;
|
|
20
18
|
let isLogBoxInstalled = false;
|
|
@@ -33,11 +31,11 @@ if (__DEV__) {
|
|
|
33
31
|
if (isFirstInstall) {
|
|
34
32
|
originalConsoleError = console.error.bind(console);
|
|
35
33
|
console.error = (...args) => {
|
|
36
|
-
consoleErrorImpl
|
|
34
|
+
consoleErrorImpl?.(...args);
|
|
37
35
|
};
|
|
38
36
|
}
|
|
39
37
|
consoleErrorImpl = registerError;
|
|
40
|
-
if (
|
|
38
|
+
if (Platform.isTesting) {
|
|
41
39
|
LogBoxData.setDisabled(true);
|
|
42
40
|
}
|
|
43
41
|
},
|
|
@@ -77,12 +75,12 @@ if (__DEV__) {
|
|
|
77
75
|
},
|
|
78
76
|
};
|
|
79
77
|
const isWarningModuleWarning = (...args) => {
|
|
80
|
-
return typeof args[0] ===
|
|
78
|
+
return typeof args[0] === 'string' && args[0].startsWith('Warning: ');
|
|
81
79
|
};
|
|
82
80
|
const registerError = (...args) => {
|
|
83
81
|
// Let errors within LogBox itself fall through.
|
|
84
82
|
if (LogBoxData.isLogBoxErrorMessage(args[0])) {
|
|
85
|
-
originalConsoleError
|
|
83
|
+
originalConsoleError?.(...args);
|
|
86
84
|
return;
|
|
87
85
|
}
|
|
88
86
|
try {
|
|
@@ -94,7 +92,7 @@ if (__DEV__) {
|
|
|
94
92
|
//
|
|
95
93
|
// The 'warning' module needs to be handled here because React internally calls
|
|
96
94
|
// `console.error('Warning: ')` with the component stack already included.
|
|
97
|
-
originalConsoleError
|
|
95
|
+
originalConsoleError?.(...args);
|
|
98
96
|
return;
|
|
99
97
|
}
|
|
100
98
|
const { category, message, componentStack } = parseLogBoxLog(args);
|
|
@@ -102,13 +100,11 @@ if (__DEV__) {
|
|
|
102
100
|
// Interpolate the message so they are formatted for adb and other CLIs.
|
|
103
101
|
// This is different than the message.content above because it includes component stacks.
|
|
104
102
|
const interpolated = parseInterpolation(args);
|
|
105
|
-
originalConsoleError
|
|
103
|
+
originalConsoleError?.(interpolated.message.content);
|
|
106
104
|
LogBoxData.addLog({
|
|
107
105
|
// Always show the static rendering issues as full screen since they
|
|
108
106
|
// are too confusing otherwise.
|
|
109
|
-
level: /did not match\. Server:/.test(message.content)
|
|
110
|
-
? "fatal"
|
|
111
|
-
: "error",
|
|
107
|
+
level: /did not match\. Server:/.test(message.content) ? 'fatal' : 'error',
|
|
112
108
|
category,
|
|
113
109
|
message,
|
|
114
110
|
componentStack,
|
|
@@ -134,6 +130,5 @@ else {
|
|
|
134
130
|
addException(ex) { },
|
|
135
131
|
};
|
|
136
132
|
}
|
|
137
|
-
|
|
138
|
-
exports.default = LogBox;
|
|
133
|
+
export default LogBox;
|
|
139
134
|
//# sourceMappingURL=LogBox.web.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogBox.web.js","sourceRoot":"","sources":["../../src/error-overlay/LogBox.web.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LogBox.web.js","sourceRoot":"","sources":["../../src/error-overlay/LogBox.web.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAOxC,IAAI,MAAe,CAAC;AAapB;;GAEG;AACH,IAAI,OAAO,EAAE;IACX,MAAM,UAAU,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAChD,MAAM,EAAE,cAAc,EAAE,kBAAkB,EAAE,GAC1C,OAAO,CAAC,uBAAuB,CAA2C,CAAC;IAE7E,IAAI,oBAAsD,CAAC;IAC3D,IAAI,gBAAkD,CAAC;IAEvD,IAAI,iBAAiB,GAAY,KAAK,CAAC;IAEvC,MAAM,GAAG;QACP,OAAO;YACL,IAAI,iBAAiB,EAAE;gBACrB,OAAO;aACR;YAED,iBAAiB,GAAG,IAAI,CAAC;YAEzB,yCAAyC;YACzC,kDAAkD;YAElD,wEAAwE;YACxE,mEAAmE;YACnE,0BAA0B;YAC1B,MAAM,cAAc,GAAG,oBAAoB,IAAI,IAAI,CAAC;YACpD,IAAI,cAAc,EAAE;gBAClB,oBAAoB,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBAEnD,OAAO,CAAC,KAAK,GAAG,CAAC,GAAG,IAAI,EAAE,EAAE;oBAC1B,gBAAgB,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;gBA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AAC;QACvD,aAAa,CAAC,KAAe,IAAS,CAAC;QACvC,YAAY,KAAU,CAAC;QACvB,MAAM,CAAC,GAAY,IAAS,CAAC;QAC7B,YAAY,CAAC,EAAyB,IAAS,CAAC;KACjD,CAAC;CACH;AAED,eAAe,MAAM,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 { Platform } from 'react-native';\n\nimport { IgnorePattern, LogData } from './Data/LogBoxData';\nimport { ExtendedExceptionData } from './Data/parseLogBoxLog';\n\nexport { LogData, ExtendedExceptionData, IgnorePattern };\n\nlet LogBox: ILogBox;\n\ninterface ILogBox {\n install(): void;\n uninstall(): void;\n isInstalled(): boolean;\n ignoreLogs(patterns: readonly IgnorePattern[]): void;\n ignoreAllLogs(ignore?: boolean): void;\n clearAllLogs(): void;\n addLog(log: LogData): void;\n addException(error: ExtendedExceptionData): void;\n}\n\n/**\n * LogBox displays logs in the app.\n */\nif (__DEV__) {\n const LogBoxData = require('./Data/LogBoxData');\n const { parseLogBoxLog, parseInterpolation } =\n require('./Data/parseLogBoxLog') as typeof import('./Data/parseLogBoxLog');\n\n let originalConsoleError: typeof console.error | undefined;\n let consoleErrorImpl: typeof console.error | undefined;\n\n let isLogBoxInstalled: boolean = false;\n\n LogBox = {\n install(): void {\n if (isLogBoxInstalled) {\n return;\n }\n\n isLogBoxInstalled = true;\n\n // Trigger lazy initialization of module.\n // require(\"../NativeModules/specs/NativeLogBox\");\n\n // IMPORTANT: we only overwrite `console.error` and `console.warn` once.\n // When we uninstall we keep the same reference and only change its\n // internal implementation\n const isFirstInstall = originalConsoleError == null;\n if (isFirstInstall) {\n originalConsoleError = console.error.bind(console);\n\n console.error = (...args) => {\n consoleErrorImpl?.(...args);\n };\n }\n\n consoleErrorImpl = registerError;\n\n if (Platform.isTesting) {\n LogBoxData.setDisabled(true);\n }\n },\n\n uninstall(): void {\n if (!isLogBoxInstalled) {\n return;\n }\n\n isLogBoxInstalled = false;\n\n // IMPORTANT: we don't re-assign to `console` in case the method has been\n // decorated again after installing LogBox. E.g.:\n // Before uninstalling: original > LogBox > OtherErrorHandler\n // After uninstalling: original > LogBox (noop) > OtherErrorHandler\n consoleErrorImpl = originalConsoleError;\n delete (console as any).disableLogBox;\n },\n\n isInstalled(): boolean {\n return isLogBoxInstalled;\n },\n\n ignoreLogs(patterns: readonly IgnorePattern[]): void {\n LogBoxData.addIgnorePatterns(patterns);\n },\n\n ignoreAllLogs(value?: boolean): void {\n LogBoxData.setDisabled(value == null ? true : value);\n },\n\n clearAllLogs(): void {\n LogBoxData.clear();\n },\n\n addLog(log: LogData): void {\n if (isLogBoxInstalled) {\n LogBoxData.addLog(log);\n }\n },\n\n addException(error: ExtendedExceptionData): void {\n if (isLogBoxInstalled) {\n LogBoxData.addException(error);\n }\n },\n };\n\n const isWarningModuleWarning = (...args: any) => {\n return typeof args[0] === 'string' && args[0].startsWith('Warning: ');\n };\n\n const registerError = (...args: Parameters<typeof console.error>): void => {\n // Let errors within LogBox itself fall through.\n if (LogBoxData.isLogBoxErrorMessage(args[0])) {\n originalConsoleError?.(...args);\n return;\n }\n\n try {\n if (!isWarningModuleWarning(...args)) {\n // Only show LogBox for the 'warning' module, otherwise pass through.\n // By passing through, this will get picked up by the React console override,\n // potentially adding the component stack. React then passes it back to the\n // React Native ExceptionsManager, which reports it to LogBox as an error.\n //\n // The 'warning' module needs to be handled here because React internally calls\n // `console.error('Warning: ')` with the component stack already included.\n originalConsoleError?.(...args);\n return;\n }\n\n const { category, message, componentStack } = parseLogBoxLog(args);\n\n if (!LogBoxData.isMessageIgnored(message.content)) {\n // Interpolate the message so they are formatted for adb and other CLIs.\n // This is different than the message.content above because it includes component stacks.\n const interpolated = parseInterpolation(args);\n originalConsoleError?.(interpolated.message.content);\n\n LogBoxData.addLog({\n // Always show the static rendering issues as full screen since they\n // are too confusing otherwise.\n level: /did not match\\. Server:/.test(message.content) ? 'fatal' : 'error',\n category,\n message,\n componentStack,\n });\n }\n } catch (err) {\n LogBoxData.reportUnexpectedLogBoxError(err);\n }\n };\n} else {\n LogBox = {\n install(): void {},\n uninstall(): void {},\n isInstalled(): boolean {\n return false;\n },\n ignoreLogs(patterns: readonly IgnorePattern[]): void {},\n ignoreAllLogs(value?: boolean): void {},\n clearAllLogs(): void {},\n addLog(log: LogData): void {},\n addException(ex: ExtendedExceptionData): void {},\n };\n}\n\nexport default LogBox;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { StyleProp, TextStyle } from
|
|
2
|
-
export declare function Ansi({ text, style
|
|
1
|
+
import { StyleProp, TextStyle } from 'react-native';
|
|
2
|
+
export declare function Ansi({ text, style }: {
|
|
3
3
|
text: string;
|
|
4
4
|
style: StyleProp<TextStyle>;
|
|
5
5
|
}): JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnsiHighlight.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/UI/AnsiHighlight.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,SAAS,EAAoB,SAAS,EAAQ,MAAM,cAAc,CAAC;AAuB5E,wBAAgB,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"AnsiHighlight.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/UI/AnsiHighlight.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,SAAS,EAAoB,SAAS,EAAQ,MAAM,cAAc,CAAC;AAuB5E,wBAAgB,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CAAE,eAyDlF"}
|
|
@@ -1,53 +1,46 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Ansi = void 0;
|
|
7
1
|
/**
|
|
8
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 650 Industries.
|
|
9
3
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
10
4
|
*
|
|
11
5
|
* This source code is licensed under the MIT license found in the
|
|
12
6
|
* LICENSE file in the root directory of this source tree.
|
|
13
7
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
import Anser from 'anser';
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { StyleSheet, Text, View } from 'react-native';
|
|
17
11
|
// Afterglow theme from https://iterm2colorschemes.com/
|
|
18
12
|
const COLORS = {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
'ansi-black': 'rgb(27, 27, 27)',
|
|
14
|
+
'ansi-red': 'rgb(187, 86, 83)',
|
|
15
|
+
'ansi-green': 'rgb(144, 157, 98)',
|
|
16
|
+
'ansi-yellow': 'rgb(234, 193, 121)',
|
|
17
|
+
'ansi-blue': 'rgb(125, 169, 199)',
|
|
18
|
+
'ansi-magenta': 'rgb(176, 101, 151)',
|
|
19
|
+
'ansi-cyan': 'rgb(140, 220, 216)',
|
|
26
20
|
// Instead of white, use the default color provided to the component
|
|
27
21
|
// 'ansi-white': 'rgb(216, 216, 216)',
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
22
|
+
'ansi-bright-black': 'rgb(98, 98, 98)',
|
|
23
|
+
'ansi-bright-red': 'rgb(187, 86, 83)',
|
|
24
|
+
'ansi-bright-green': 'rgb(144, 157, 98)',
|
|
25
|
+
'ansi-bright-yellow': 'rgb(234, 193, 121)',
|
|
26
|
+
'ansi-bright-blue': 'rgb(125, 169, 199)',
|
|
27
|
+
'ansi-bright-magenta': 'rgb(176, 101, 151)',
|
|
28
|
+
'ansi-bright-cyan': 'rgb(140, 220, 216)',
|
|
29
|
+
'ansi-bright-white': 'rgb(247, 247, 247)',
|
|
36
30
|
};
|
|
37
|
-
function Ansi({ text, style
|
|
31
|
+
export function Ansi({ text, style }) {
|
|
38
32
|
let commonWhitespaceLength = Infinity;
|
|
39
|
-
const parsedLines = text.split(/\n/).map((line) =>
|
|
33
|
+
const parsedLines = text.split(/\n/).map((line) => Anser.ansiToJson(line, {
|
|
40
34
|
json: true,
|
|
41
35
|
remove_empty: true,
|
|
42
36
|
use_classes: true,
|
|
43
37
|
}));
|
|
44
38
|
parsedLines.map((lines) => {
|
|
45
|
-
var _a, _b, _c;
|
|
46
39
|
// The third item on each line includes the whitespace of the source code.
|
|
47
40
|
// We are looking for the least amount of common whitespace to trim all lines.
|
|
48
41
|
// Example: Array [" ", " 96 |", " text", ...]
|
|
49
|
-
const match = lines[2] &&
|
|
50
|
-
const whitespaceLength = (match &&
|
|
42
|
+
const match = lines[2] && lines[2]?.content?.match(/^ +/);
|
|
43
|
+
const whitespaceLength = (match && match[0]?.length) || 0;
|
|
51
44
|
if (whitespaceLength < commonWhitespaceLength) {
|
|
52
45
|
commonWhitespaceLength = whitespaceLength;
|
|
53
46
|
}
|
|
@@ -55,7 +48,7 @@ function Ansi({ text, style, }) {
|
|
|
55
48
|
const getText = (content, key) => {
|
|
56
49
|
if (key === 1) {
|
|
57
50
|
// Remove the vertical bar after line numbers
|
|
58
|
-
return content.replace(/\| $/,
|
|
51
|
+
return content.replace(/\| $/, ' ');
|
|
59
52
|
}
|
|
60
53
|
else if (key === 2 && commonWhitespaceLength < Infinity) {
|
|
61
54
|
// Remove common whitespace at the beginning of the line
|
|
@@ -65,7 +58,7 @@ function Ansi({ text, style, }) {
|
|
|
65
58
|
return content;
|
|
66
59
|
}
|
|
67
60
|
};
|
|
68
|
-
return (
|
|
61
|
+
return (React.createElement(View, null, parsedLines.map((items, i) => (React.createElement(View, { style: styles.line, key: i }, items.map((bundle, key) => {
|
|
69
62
|
const textStyle = bundle.fg && COLORS[bundle.fg]
|
|
70
63
|
? {
|
|
71
64
|
backgroundColor: bundle.bg && COLORS[bundle.bg],
|
|
@@ -74,13 +67,12 @@ function Ansi({ text, style, }) {
|
|
|
74
67
|
: {
|
|
75
68
|
backgroundColor: bundle.bg && COLORS[bundle.bg],
|
|
76
69
|
};
|
|
77
|
-
return (
|
|
70
|
+
return (React.createElement(Text, { style: [style, textStyle], key: key }, getText(bundle.content, key)));
|
|
78
71
|
}))))));
|
|
79
72
|
}
|
|
80
|
-
|
|
81
|
-
const styles = react_native_1.StyleSheet.create({
|
|
73
|
+
const styles = StyleSheet.create({
|
|
82
74
|
line: {
|
|
83
|
-
flexDirection:
|
|
75
|
+
flexDirection: 'row',
|
|
84
76
|
},
|
|
85
77
|
});
|
|
86
78
|
//# sourceMappingURL=AnsiHighlight.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnsiHighlight.js","sourceRoot":"","sources":["../../../src/error-overlay/UI/AnsiHighlight.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AnsiHighlight.js","sourceRoot":"","sources":["../../../src/error-overlay/UI/AnsiHighlight.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAa,UAAU,EAAE,IAAI,EAAa,IAAI,EAAE,MAAM,cAAc,CAAC;AAE5E,uDAAuD;AACvD,MAAM,MAAM,GAA2B;IACrC,YAAY,EAAE,iBAAiB;IAC/B,UAAU,EAAE,kBAAkB;IAC9B,YAAY,EAAE,mBAAmB;IACjC,aAAa,EAAE,oBAAoB;IACnC,WAAW,EAAE,oBAAoB;IACjC,cAAc,EAAE,oBAAoB;IACpC,WAAW,EAAE,oBAAoB;IACjC,oEAAoE;IACp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,GAAG,KAAK,CAAC,IAAI,sBAAsB,GAAG,QAAQ,EAAE;YACzD,wDAAwD;YACxD,OAAO,OAAO,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC;SAC/C;aAAM;YACL,OAAO,OAAO,CAAC;SAChB;IACH,CAAC,CAAC;IAEF,OAAO,CACL,oBAAC,IAAI,QACF,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAC7B,oBAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,IAC7B,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE;QACzB,MAAM,SAAS,GACb,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;YAC5B,CAAC,CAAC;gBACE,eAAe,EAAE,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC/C,KAAK,EAAE,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;aACtC;YACH,CAAC,CAAC;gBACE,eAAe,EAAE,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;aAChD,CAAC;QACR,OAAO,CACL,oBAAC,IAAI,IAAC,KAAK,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,GAAG,EAAE,GAAG,IACtC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,CACxB,CACR,CAAC;IACJ,CAAC,CAAC,CACG,CACR,CAAC,CACG,CACR,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE;QACJ,aAAa,EAAE,KAAK;KACrB;CACF,CAAC,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 */\nimport Anser from 'anser';\nimport React from 'react';\nimport { StyleProp, StyleSheet, Text, TextStyle, View } from 'react-native';\n\n// Afterglow theme from https://iterm2colorschemes.com/\nconst COLORS: Record<string, string> = {\n 'ansi-black': 'rgb(27, 27, 27)',\n 'ansi-red': 'rgb(187, 86, 83)',\n 'ansi-green': 'rgb(144, 157, 98)',\n 'ansi-yellow': 'rgb(234, 193, 121)',\n 'ansi-blue': 'rgb(125, 169, 199)',\n 'ansi-magenta': 'rgb(176, 101, 151)',\n 'ansi-cyan': 'rgb(140, 220, 216)',\n // Instead of white, use the default color provided to the component\n // 'ansi-white': 'rgb(216, 216, 216)',\n 'ansi-bright-black': 'rgb(98, 98, 98)',\n 'ansi-bright-red': 'rgb(187, 86, 83)',\n 'ansi-bright-green': 'rgb(144, 157, 98)',\n 'ansi-bright-yellow': 'rgb(234, 193, 121)',\n 'ansi-bright-blue': 'rgb(125, 169, 199)',\n 'ansi-bright-magenta': 'rgb(176, 101, 151)',\n 'ansi-bright-cyan': 'rgb(140, 220, 216)',\n 'ansi-bright-white': 'rgb(247, 247, 247)',\n};\n\nexport function Ansi({ text, style }: { text: string; style: StyleProp<TextStyle> }) {\n let commonWhitespaceLength = Infinity;\n const parsedLines = text.split(/\\n/).map((line) =>\n Anser.ansiToJson(line, {\n json: true,\n remove_empty: true,\n use_classes: true,\n })\n );\n\n parsedLines.map((lines) => {\n // The third item on each line includes the whitespace of the source code.\n // We are looking for the least amount of common whitespace to trim all lines.\n // Example: Array [\" \", \" 96 |\", \" text\", ...]\n const match = lines[2] && lines[2]?.content?.match(/^ +/);\n const whitespaceLength = (match && match[0]?.length) || 0;\n if (whitespaceLength < commonWhitespaceLength) {\n commonWhitespaceLength = whitespaceLength;\n }\n });\n\n const getText = (content: string, key: number) => {\n if (key === 1) {\n // Remove the vertical bar after line numbers\n return content.replace(/\\| $/, ' ');\n } else if (key === 2 && commonWhitespaceLength < Infinity) {\n // Remove common whitespace at the beginning of the line\n return content.substr(commonWhitespaceLength);\n } else {\n return content;\n }\n };\n\n return (\n <View>\n {parsedLines.map((items, i) => (\n <View style={styles.line} key={i}>\n {items.map((bundle, key) => {\n const textStyle =\n bundle.fg && COLORS[bundle.fg]\n ? {\n backgroundColor: bundle.bg && COLORS[bundle.bg],\n color: bundle.fg && COLORS[bundle.fg],\n }\n : {\n backgroundColor: bundle.bg && COLORS[bundle.bg],\n };\n return (\n <Text style={[style, textStyle]} key={key}>\n {getText(bundle.content, key)}\n </Text>\n );\n })}\n </View>\n ))}\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n line: {\n flexDirection: 'row',\n },\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogBoxButton.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/UI/LogBoxButton.tsx"],"names":[],"mappings":"AAQA,OAAO,
|
|
1
|
+
{"version":3,"file":"LogBoxButton.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/UI/LogBoxButton.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,qBAAqB,EAAE,MAAM,EAA6B,SAAS,EAAE,MAAM,cAAc,CAAC;AAInG,KAAK,KAAK,GAAG;IACX,eAAe,EAAE;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;IAC1D,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB,CAAC;AAEF,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,eAuCxC"}
|
|
@@ -1,41 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.LogBoxButton = void 0;
|
|
27
1
|
/**
|
|
28
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 650 Industries.
|
|
29
3
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
30
4
|
*
|
|
31
5
|
* This source code is licensed under the MIT license found in the
|
|
32
6
|
* LICENSE file in the root directory of this source tree.
|
|
33
7
|
*/
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
function LogBoxButton(props) {
|
|
38
|
-
const [pressed, setPressed] =
|
|
8
|
+
import React, { useState } from 'react';
|
|
9
|
+
import { Platform, Pressable, View } from 'react-native';
|
|
10
|
+
import * as LogBoxStyle from './LogBoxStyle';
|
|
11
|
+
export function LogBoxButton(props) {
|
|
12
|
+
const [pressed, setPressed] = useState(false);
|
|
39
13
|
let backgroundColor = props.backgroundColor;
|
|
40
14
|
if (!backgroundColor) {
|
|
41
15
|
backgroundColor = {
|
|
@@ -43,17 +17,17 @@ function LogBoxButton(props) {
|
|
|
43
17
|
pressed: LogBoxStyle.getBackgroundColor(0.6),
|
|
44
18
|
};
|
|
45
19
|
}
|
|
46
|
-
const content = (
|
|
47
|
-
|
|
48
|
-
? backgroundColor.pressed
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
},
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
20
|
+
const content = (React.createElement(View, { style: [
|
|
21
|
+
{
|
|
22
|
+
backgroundColor: pressed ? backgroundColor.pressed : backgroundColor.default,
|
|
23
|
+
...Platform.select({
|
|
24
|
+
web: {
|
|
25
|
+
cursor: 'pointer',
|
|
26
|
+
},
|
|
27
|
+
}),
|
|
28
|
+
},
|
|
29
|
+
props.style,
|
|
30
|
+
] }, props.children));
|
|
31
|
+
return props.onPress == null ? (content) : (React.createElement(Pressable, { hitSlop: props.hitSlop, onPress: props.onPress, onPressIn: () => setPressed(true), onPressOut: () => setPressed(false) }, content));
|
|
57
32
|
}
|
|
58
|
-
exports.LogBoxButton = LogBoxButton;
|
|
59
33
|
//# sourceMappingURL=LogBoxButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogBoxButton.js","sourceRoot":"","sources":["../../../src/error-overlay/UI/LogBoxButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LogBoxButton.js","sourceRoot":"","sources":["../../../src/error-overlay/UI/LogBoxButton.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAiC,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAa,MAAM,cAAc,CAAC;AAEnG,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC;AAa7C,MAAM,UAAU,YAAY,CAAC,KAAY;IACvC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE9C,IAAI,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;IAC5C,IAAI,CAAC,eAAe,EAAE;QACpB,eAAe,GAAG;YAChB,OAAO,EAAE,WAAW,CAAC,kBAAkB,CAAC,IAAI,CAAC;YAC7C,OAAO,EAAE,WAAW,CAAC,kBAAkB,CAAC,GAAG,CAAC;SAC7C,CAAC;KACH;IAED,MAAM,OAAO,GAAG,CACd,oBAAC,IAAI,IACH,KAAK,EAAE;YACL;gBACE,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,OAAO;gBAC5E,GAAG,QAAQ,CAAC,MAAM,CAAC;oBACjB,GAAG,EAAE;wBACH,MAAM,EAAE,SAAS;qBAClB;iBACF,CAAC;aACH;YACD,KAAK,CAAC,KAAK;SACZ,IACA,KAAK,CAAC,QAAQ,CACV,CACR,CAAC;IAEF,OAAO,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,CAC7B,OAAO,CACR,CAAC,CAAC,CAAC,CACF,oBAAC,SAAS,IACR,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,SAAS,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EACjC,UAAU,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,IAClC,OAAO,CACE,CACb,CAAC;AACJ,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 */\nimport React, { useState } from 'react';\nimport { GestureResponderEvent, Insets, Platform, Pressable, View, ViewStyle } from 'react-native';\n\nimport * as LogBoxStyle from './LogBoxStyle';\n\ntype Props = {\n backgroundColor: {\n default: string;\n pressed: string;\n };\n children?: any;\n hitSlop?: Insets;\n onPress?: ((event: GestureResponderEvent) => void) | null;\n style?: ViewStyle;\n};\n\nexport function LogBoxButton(props: Props) {\n const [pressed, setPressed] = useState(false);\n\n let backgroundColor = props.backgroundColor;\n if (!backgroundColor) {\n backgroundColor = {\n default: LogBoxStyle.getBackgroundColor(0.95),\n pressed: LogBoxStyle.getBackgroundColor(0.6),\n };\n }\n\n const content = (\n <View\n style={[\n {\n backgroundColor: pressed ? backgroundColor.pressed : backgroundColor.default,\n ...Platform.select({\n web: {\n cursor: 'pointer',\n },\n }),\n },\n props.style,\n ]}>\n {props.children}\n </View>\n );\n\n return props.onPress == null ? (\n content\n ) : (\n <Pressable\n hitSlop={props.hitSlop}\n onPress={props.onPress}\n onPressIn={() => setPressed(true)}\n onPressOut={() => setPressed(false)}>\n {content}\n </Pressable>\n );\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { StyleProp, TextStyle } from
|
|
2
|
-
import type { Message } from
|
|
1
|
+
import { StyleProp, TextStyle } from 'react-native';
|
|
2
|
+
import type { Message } from '../Data/parseLogBoxLog';
|
|
3
3
|
type Props = {
|
|
4
4
|
message: Message;
|
|
5
5
|
style: StyleProp<TextStyle>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogBoxMessage.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/UI/LogBoxMessage.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAQ,SAAS,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEtD,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAKF,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"LogBoxMessage.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/UI/LogBoxMessage.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAQ,SAAS,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEtD,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAKF,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,CAkDvD"}
|
|
@@ -1,23 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.LogBoxMessage = void 0;
|
|
7
1
|
/**
|
|
8
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 650 Industries.
|
|
9
3
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
10
4
|
*
|
|
11
5
|
* This source code is licensed under the MIT license found in the
|
|
12
6
|
* LICENSE file in the root directory of this source tree.
|
|
13
7
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const cleanContent = (content) => content.replace(/^(TransformError |Warning: (Warning: )?|Error: )/g,
|
|
17
|
-
function LogBoxMessage(props) {
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { Text } from 'react-native';
|
|
10
|
+
const cleanContent = (content) => content.replace(/^(TransformError |Warning: (Warning: )?|Error: )/g, '');
|
|
11
|
+
export function LogBoxMessage(props) {
|
|
18
12
|
const { content, substitutions } = props.message;
|
|
19
13
|
if (props.plaintext === true) {
|
|
20
|
-
return
|
|
14
|
+
return React.createElement(Text, null, cleanContent(content));
|
|
21
15
|
}
|
|
22
16
|
const maxLength = props.maxLength != null ? props.maxLength : Infinity;
|
|
23
17
|
const substitutionStyle = props.style;
|
|
@@ -29,7 +23,7 @@ function LogBoxMessage(props) {
|
|
|
29
23
|
cleanMessage = cleanMessage.slice(0, props.maxLength - length);
|
|
30
24
|
}
|
|
31
25
|
if (length < maxLength) {
|
|
32
|
-
elements.push(
|
|
26
|
+
elements.push(React.createElement(Text, { key: key, style: style }, cleanMessage));
|
|
33
27
|
}
|
|
34
28
|
length += cleanMessage.length;
|
|
35
29
|
};
|
|
@@ -40,14 +34,13 @@ function LogBoxMessage(props) {
|
|
|
40
34
|
createUnderLength(key, prevPart);
|
|
41
35
|
}
|
|
42
36
|
const substititionPart = content.substr(substitution.offset, substitution.length);
|
|
43
|
-
createUnderLength(key +
|
|
37
|
+
createUnderLength(key + '.5', substititionPart, substitutionStyle);
|
|
44
38
|
return substitution.offset + substitution.length;
|
|
45
39
|
}, 0);
|
|
46
40
|
if (lastOffset < content.length) {
|
|
47
41
|
const lastPart = content.substr(lastOffset);
|
|
48
|
-
createUnderLength(
|
|
42
|
+
createUnderLength('-1', lastPart);
|
|
49
43
|
}
|
|
50
|
-
return
|
|
44
|
+
return React.createElement(React.Fragment, null, elements);
|
|
51
45
|
}
|
|
52
|
-
exports.LogBoxMessage = LogBoxMessage;
|
|
53
46
|
//# sourceMappingURL=LogBoxMessage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogBoxMessage.js","sourceRoot":"","sources":["../../../src/error-overlay/UI/LogBoxMessage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LogBoxMessage.js","sourceR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,CAAC;IAChC,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,YAAY,EAAE,KAAK,EAAE,EAAE;QAC1E,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAE1B,IAAI,YAAY,CAAC,MAAM,GAAG,UAAU,EAAE;YACpC,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC,MAAM,GAAG,UAAU,CAAC,CAAC;YAE9E,iBAAiB,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;SAClC;QAED,MAAM,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;QAElF,iBAAiB,CAAC,GAAG,GAAG,IAAI,EAAE,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;QACnE,OAAO,YAAY,CAAC,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;IACnD,CAAC,EAAE,CAAC,CAAC,CAAC;IAEN,IAAI,UAAU,GAAG,OAAO,CAAC,MAAM,EAAE;QAC/B,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC5C,iBAAiB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;KACnC;IAED,OAAO,0CAAG,QAAQ,CAAI,CAAC;AACzB,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 */\nimport React from 'react';\nimport { StyleProp, Text, TextStyle } from 'react-native';\n\nimport type { Message } from '../Data/parseLogBoxLog';\n\ntype Props = {\n message: Message;\n style: StyleProp<TextStyle>;\n plaintext?: boolean;\n maxLength?: number;\n};\n\nconst cleanContent = (content: string) =>\n content.replace(/^(TransformError |Warning: (Warning: )?|Error: )/g, '');\n\nexport function LogBoxMessage(props: Props): JSX.Element {\n const { content, substitutions }: Message = props.message;\n\n if (props.plaintext === true) {\n return <Text>{cleanContent(content)}</Text>;\n }\n\n const maxLength = props.maxLength != null ? props.maxLength : Infinity;\n const substitutionStyle: StyleProp<TextStyle> = props.style;\n const elements: JSX.Element[] = [];\n let length = 0;\n const createUnderLength = (key: string | '-1', message: string, style?: StyleProp<TextStyle>) => {\n let cleanMessage = cleanContent(message);\n\n if (props.maxLength != null) {\n cleanMessage = cleanMessage.slice(0, props.maxLength - length);\n }\n\n if (length < maxLength) {\n elements.push(\n <Text key={key} style={style}>\n {cleanMessage}\n </Text>\n );\n }\n\n length += cleanMessage.length;\n };\n\n const lastOffset = substitutions.reduce((prevOffset, substitution, index) => {\n const key = String(index);\n\n if (substitution.offset > prevOffset) {\n const prevPart = content.substr(prevOffset, substitution.offset - prevOffset);\n\n createUnderLength(key, prevPart);\n }\n\n const substititionPart = content.substr(substitution.offset, substitution.length);\n\n createUnderLength(key + '.5', substititionPart, substitutionStyle);\n return substitution.offset + substitution.length;\n }, 0);\n\n if (lastOffset < content.length) {\n const lastPart = content.substr(lastOffset);\n createUnderLength('-1', lastPart);\n }\n\n return <>{elements}</>;\n}\n"]}
|