@expo/metro-runtime 0.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/LICENSE +13 -0
- package/README.md +3 -0
- package/assets/alert-triangle.png +0 -0
- package/assets/chevron-left.png +0 -0
- package/assets/chevron-right.png +0 -0
- package/assets/close.png +0 -0
- package/assets/loader.png +0 -0
- package/asyncRequire.js +1 -0
- package/build/HMRClient.d.ts +17 -0
- package/build/HMRClient.d.ts.map +1 -0
- package/build/HMRClient.js +250 -0
- package/build/HMRClient.js.map +1 -0
- package/build/HMRClient.native.d.ts +1 -0
- package/build/HMRClient.native.d.ts.map +1 -0
- package/build/HMRClient.native.js +2 -0
- package/build/HMRClient.native.js.map +1 -0
- package/build/LoadingView.d.ts +8 -0
- package/build/LoadingView.d.ts.map +1 -0
- package/build/LoadingView.js +21 -0
- package/build/LoadingView.js.map +1 -0
- package/build/LoadingView.native.d.ts +1 -0
- package/build/LoadingView.native.d.ts.map +1 -0
- package/build/LoadingView.native.js +2 -0
- package/build/LoadingView.native.js.map +1 -0
- package/build/asyncRequire/buildAsyncRequire.d.ts +24 -0
- package/build/asyncRequire/buildAsyncRequire.d.ts.map +1 -0
- package/build/asyncRequire/buildAsyncRequire.js +50 -0
- package/build/asyncRequire/buildAsyncRequire.js.map +1 -0
- package/build/asyncRequire/buildUrlForBundle.d.ts +8 -0
- package/build/asyncRequire/buildUrlForBundle.d.ts.map +1 -0
- package/build/asyncRequire/buildUrlForBundle.js +25 -0
- package/build/asyncRequire/buildUrlForBundle.js.map +1 -0
- package/build/asyncRequire/buildUrlForBundle.native.d.ts +2 -0
- package/build/asyncRequire/buildUrlForBundle.native.d.ts.map +1 -0
- package/build/asyncRequire/buildUrlForBundle.native.js +25 -0
- package/build/asyncRequire/buildUrlForBundle.native.js.map +1 -0
- package/build/asyncRequire/fetchAsync.d.ts +5 -0
- package/build/asyncRequire/fetchAsync.d.ts.map +1 -0
- package/build/asyncRequire/fetchAsync.js +19 -0
- package/build/asyncRequire/fetchAsync.js.map +1 -0
- package/build/asyncRequire/fetchAsync.native.d.ts +12 -0
- package/build/asyncRequire/fetchAsync.native.d.ts.map +1 -0
- package/build/asyncRequire/fetchAsync.native.js +57 -0
- package/build/asyncRequire/fetchAsync.native.js.map +1 -0
- package/build/asyncRequire/fetchThenEval.d.ts +7 -0
- package/build/asyncRequire/fetchThenEval.d.ts.map +1 -0
- package/build/asyncRequire/fetchThenEval.js +30 -0
- package/build/asyncRequire/fetchThenEval.js.map +1 -0
- package/build/asyncRequire/fetchThenEval.web.d.ts +6 -0
- package/build/asyncRequire/fetchThenEval.web.d.ts.map +1 -0
- package/build/asyncRequire/fetchThenEval.web.js +29 -0
- package/build/asyncRequire/fetchThenEval.web.js.map +1 -0
- package/build/asyncRequire/index.d.ts +2 -0
- package/build/asyncRequire/index.d.ts.map +1 -0
- package/build/asyncRequire/index.js +5 -0
- package/build/asyncRequire/index.js.map +1 -0
- package/build/asyncRequire/loadBundle.android.d.ts +2 -0
- package/build/asyncRequire/loadBundle.android.d.ts.map +1 -0
- package/build/asyncRequire/loadBundle.android.js +22 -0
- package/build/asyncRequire/loadBundle.android.js.map +1 -0
- package/build/asyncRequire/loadBundle.d.ts +2 -0
- package/build/asyncRequire/loadBundle.d.ts.map +1 -0
- package/build/asyncRequire/loadBundle.js +6 -0
- package/build/asyncRequire/loadBundle.js.map +1 -0
- package/build/asyncRequire/loadBundlePolyfill.d.ts +7 -0
- package/build/asyncRequire/loadBundlePolyfill.d.ts.map +1 -0
- package/build/asyncRequire/loadBundlePolyfill.js +40 -0
- package/build/asyncRequire/loadBundlePolyfill.js.map +1 -0
- package/build/effects.d.ts +2 -0
- package/build/effects.d.ts.map +1 -0
- package/build/effects.js +16 -0
- package/build/effects.js.map +1 -0
- package/build/effects.native.d.ts +1 -0
- package/build/effects.native.d.ts.map +1 -0
- package/build/effects.native.js +1 -0
- package/build/effects.native.js.map +1 -0
- package/build/error-overlay/Data/LogBoxData.d.ts +60 -0
- package/build/error-overlay/Data/LogBoxData.d.ts.map +1 -0
- package/build/error-overlay/Data/LogBoxData.js +386 -0
- package/build/error-overlay/Data/LogBoxData.js.map +1 -0
- package/build/error-overlay/Data/LogBoxLog.d.ts +61 -0
- package/build/error-overlay/Data/LogBoxLog.d.ts.map +1 -0
- package/build/error-overlay/Data/LogBoxLog.js +148 -0
- package/build/error-overlay/Data/LogBoxLog.js.map +1 -0
- package/build/error-overlay/Data/LogBoxSymbolication.d.ts +17 -0
- package/build/error-overlay/Data/LogBoxSymbolication.d.ts.map +1 -0
- package/build/error-overlay/Data/LogBoxSymbolication.js +56 -0
- package/build/error-overlay/Data/LogBoxSymbolication.js.map +1 -0
- package/build/error-overlay/Data/LogContext.d.ts +14 -0
- package/build/error-overlay/Data/LogContext.d.ts.map +1 -0
- package/build/error-overlay/Data/LogContext.js +27 -0
- package/build/error-overlay/Data/LogContext.js.map +1 -0
- package/build/error-overlay/Data/parseLogBoxLog.d.ts +45 -0
- package/build/error-overlay/Data/parseLogBoxLog.d.ts.map +1 -0
- package/build/error-overlay/Data/parseLogBoxLog.js +286 -0
- package/build/error-overlay/Data/parseLogBoxLog.js.map +1 -0
- package/build/error-overlay/ErrorOverlay.d.ts +18 -0
- package/build/error-overlay/ErrorOverlay.d.ts.map +1 -0
- package/build/error-overlay/ErrorOverlay.js +146 -0
- package/build/error-overlay/ErrorOverlay.js.map +1 -0
- package/build/error-overlay/LogBox.d.ts +16 -0
- package/build/error-overlay/LogBox.d.ts.map +1 -0
- package/build/error-overlay/LogBox.js +31 -0
- package/build/error-overlay/LogBox.js.map +1 -0
- package/build/error-overlay/LogBox.web.d.ts +23 -0
- package/build/error-overlay/LogBox.web.d.ts.map +1 -0
- package/build/error-overlay/LogBox.web.js +129 -0
- package/build/error-overlay/LogBox.web.js.map +1 -0
- package/build/error-overlay/UI/AnsiHighlight.d.ts +6 -0
- package/build/error-overlay/UI/AnsiHighlight.d.ts.map +1 -0
- package/build/error-overlay/UI/AnsiHighlight.js +86 -0
- package/build/error-overlay/UI/AnsiHighlight.js.map +1 -0
- package/build/error-overlay/UI/LogBoxButton.d.ts +14 -0
- package/build/error-overlay/UI/LogBoxButton.d.ts.map +1 -0
- package/build/error-overlay/UI/LogBoxButton.js +59 -0
- package/build/error-overlay/UI/LogBoxButton.js.map +1 -0
- package/build/error-overlay/UI/LogBoxMessage.d.ts +11 -0
- package/build/error-overlay/UI/LogBoxMessage.d.ts.map +1 -0
- package/build/error-overlay/UI/LogBoxMessage.js +53 -0
- package/build/error-overlay/UI/LogBoxMessage.js.map +1 -0
- package/build/error-overlay/UI/LogBoxStyle.d.ts +22 -0
- package/build/error-overlay/UI/LogBoxStyle.d.ts.map +1 -0
- package/build/error-overlay/UI/LogBoxStyle.js +68 -0
- package/build/error-overlay/UI/LogBoxStyle.js.map +1 -0
- package/build/error-overlay/UI/constants.d.ts +2 -0
- package/build/error-overlay/UI/constants.d.ts.map +1 -0
- package/build/error-overlay/UI/constants.js +10 -0
- package/build/error-overlay/UI/constants.js.map +1 -0
- package/build/error-overlay/formatProjectFilePath.d.ts +2 -0
- package/build/error-overlay/formatProjectFilePath.d.ts.map +1 -0
- package/build/error-overlay/formatProjectFilePath.js +27 -0
- package/build/error-overlay/formatProjectFilePath.js.map +1 -0
- package/build/error-overlay/index.d.ts +3 -0
- package/build/error-overlay/index.d.ts.map +1 -0
- package/build/error-overlay/index.js +30 -0
- package/build/error-overlay/index.js.map +1 -0
- package/build/error-overlay/modules/ExceptionsManager/index.d.ts +38 -0
- package/build/error-overlay/modules/ExceptionsManager/index.d.ts.map +1 -0
- package/build/error-overlay/modules/ExceptionsManager/index.js +80 -0
- package/build/error-overlay/modules/ExceptionsManager/index.js.map +1 -0
- package/build/error-overlay/modules/ExceptionsManager/index.native.d.ts +2 -0
- package/build/error-overlay/modules/ExceptionsManager/index.native.d.ts.map +1 -0
- package/build/error-overlay/modules/ExceptionsManager/index.native.js +3 -0
- package/build/error-overlay/modules/ExceptionsManager/index.native.js.map +1 -0
- package/build/error-overlay/modules/NativeLogBox/index.d.ts +6 -0
- package/build/error-overlay/modules/NativeLogBox/index.d.ts.map +1 -0
- package/build/error-overlay/modules/NativeLogBox/index.js +34 -0
- package/build/error-overlay/modules/NativeLogBox/index.js.map +1 -0
- package/build/error-overlay/modules/NativeLogBox/index.native.d.ts +3 -0
- package/build/error-overlay/modules/NativeLogBox/index.native.d.ts.map +1 -0
- package/build/error-overlay/modules/NativeLogBox/index.native.js +8 -0
- package/build/error-overlay/modules/NativeLogBox/index.native.js.map +1 -0
- package/build/error-overlay/modules/openFileInEditor/index.d.ts +3 -0
- package/build/error-overlay/modules/openFileInEditor/index.d.ts.map +1 -0
- package/build/error-overlay/modules/openFileInEditor/index.js +15 -0
- package/build/error-overlay/modules/openFileInEditor/index.js.map +1 -0
- package/build/error-overlay/modules/openFileInEditor/index.native.d.ts +3 -0
- package/build/error-overlay/modules/openFileInEditor/index.native.d.ts.map +1 -0
- package/build/error-overlay/modules/openFileInEditor/index.native.js +8 -0
- package/build/error-overlay/modules/openFileInEditor/index.native.js.map +1 -0
- package/build/error-overlay/modules/parseErrorStack/index.d.ts +6 -0
- package/build/error-overlay/modules/parseErrorStack/index.d.ts.map +1 -0
- package/build/error-overlay/modules/parseErrorStack/index.js +25 -0
- package/build/error-overlay/modules/parseErrorStack/index.js.map +1 -0
- package/build/error-overlay/modules/parseErrorStack/parseHermesStack.d.ts +3 -0
- package/build/error-overlay/modules/parseErrorStack/parseHermesStack.d.ts.map +1 -0
- package/build/error-overlay/modules/parseErrorStack/parseHermesStack.js +9 -0
- package/build/error-overlay/modules/parseErrorStack/parseHermesStack.js.map +1 -0
- package/build/error-overlay/modules/stringifySafe/index.d.ts +20 -0
- package/build/error-overlay/modules/stringifySafe/index.d.ts.map +1 -0
- package/build/error-overlay/modules/stringifySafe/index.js +117 -0
- package/build/error-overlay/modules/stringifySafe/index.js.map +1 -0
- package/build/error-overlay/modules/symbolicateStackTrace/index.d.ts +24 -0
- package/build/error-overlay/modules/symbolicateStackTrace/index.d.ts.map +1 -0
- package/build/error-overlay/modules/symbolicateStackTrace/index.js +19 -0
- package/build/error-overlay/modules/symbolicateStackTrace/index.js.map +1 -0
- package/build/error-overlay/modules/symbolicateStackTrace/index.native.d.ts +3 -0
- package/build/error-overlay/modules/symbolicateStackTrace/index.native.d.ts.map +1 -0
- package/build/error-overlay/modules/symbolicateStackTrace/index.native.js +8 -0
- package/build/error-overlay/modules/symbolicateStackTrace/index.native.js.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.d.ts +5 -0
- package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.d.ts.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.js +113 -0
- package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.js.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorFooter.d.ts +7 -0
- package/build/error-overlay/overlay/LogBoxInspectorFooter.d.ts.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorFooter.js +111 -0
- package/build/error-overlay/overlay/LogBoxInspectorFooter.js.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorHeader.d.ts +8 -0
- package/build/error-overlay/overlay/LogBoxInspectorHeader.d.ts.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorHeader.js +139 -0
- package/build/error-overlay/overlay/LogBoxInspectorHeader.js.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.d.ts +12 -0
- package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.d.ts.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.js +116 -0
- package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.js.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorSection.d.ts +8 -0
- package/build/error-overlay/overlay/LogBoxInspectorSection.d.ts.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorSection.js +70 -0
- package/build/error-overlay/overlay/LogBoxInspectorSection.js.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.d.ts +8 -0
- package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.d.ts.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.js +127 -0
- package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.js.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorStackFrame.d.ts +11 -0
- package/build/error-overlay/overlay/LogBoxInspectorStackFrame.d.ts.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorStackFrame.js +103 -0
- package/build/error-overlay/overlay/LogBoxInspectorStackFrame.js.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorStackFrames.d.ts +10 -0
- package/build/error-overlay/overlay/LogBoxInspectorStackFrames.d.ts.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorStackFrames.js +177 -0
- package/build/error-overlay/overlay/LogBoxInspectorStackFrames.js.map +1 -0
- package/build/error-overlay/toast/ErrorToast.d.ts +11 -0
- package/build/error-overlay/toast/ErrorToast.d.ts.map +1 -0
- package/build/error-overlay/toast/ErrorToast.js +147 -0
- package/build/error-overlay/toast/ErrorToast.js.map +1 -0
- package/build/error-overlay/toast/ErrorToastContainer.d.ts +4 -0
- package/build/error-overlay/toast/ErrorToastContainer.d.ts.map +1 -0
- package/build/error-overlay/toast/ErrorToastContainer.js +7 -0
- package/build/error-overlay/toast/ErrorToastContainer.js.map +1 -0
- package/build/error-overlay/toast/ErrorToastContainer.web.d.ts +12 -0
- package/build/error-overlay/toast/ErrorToastContainer.web.d.ts.map +1 -0
- package/build/error-overlay/toast/ErrorToastContainer.web.js +83 -0
- package/build/error-overlay/toast/ErrorToastContainer.web.js.map +1 -0
- package/build/error-overlay/toast/ErrorToastMessage.d.ts +5 -0
- package/build/error-overlay/toast/ErrorToastMessage.d.ts.map +1 -0
- package/build/error-overlay/toast/ErrorToastMessage.js +50 -0
- package/build/error-overlay/toast/ErrorToastMessage.js.map +1 -0
- package/build/error-overlay/useRejectionHandler.d.ts +3 -0
- package/build/error-overlay/useRejectionHandler.d.ts.map +1 -0
- package/build/error-overlay/useRejectionHandler.js +60 -0
- package/build/error-overlay/useRejectionHandler.js.map +1 -0
- package/build/getDevServer.d.ts +8 -0
- package/build/getDevServer.d.ts.map +1 -0
- package/build/getDevServer.js +37 -0
- package/build/getDevServer.js.map +1 -0
- package/build/getDevServer.native.d.ts +1 -0
- package/build/getDevServer.native.d.ts.map +1 -0
- package/build/getDevServer.native.js +2 -0
- package/build/getDevServer.native.js.map +1 -0
- package/build/index.d.ts +2 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +4 -0
- package/build/index.js.map +1 -0
- package/build/messageSocket.d.ts +3 -0
- package/build/messageSocket.d.ts.map +1 -0
- package/build/messageSocket.js +24 -0
- package/build/messageSocket.js.map +1 -0
- package/build/setupFastRefresh.d.ts +10 -0
- package/build/setupFastRefresh.d.ts.map +1 -0
- package/build/setupFastRefresh.js +23 -0
- package/build/setupFastRefresh.js.map +1 -0
- package/build/setupHMR.d.ts +2 -0
- package/build/setupHMR.d.ts.map +1 -0
- package/build/setupHMR.js +14 -0
- package/build/setupHMR.js.map +1 -0
- package/error-overlay.d.ts +1 -0
- package/error-overlay.js +1 -0
- package/package.json +41 -0
|
@@ -0,0 +1,146 @@
|
|
|
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.LogBoxInspector = exports.LogBoxInspectorContainer = void 0;
|
|
27
|
+
/**
|
|
28
|
+
* Copyright (c) Evan Bacon.
|
|
29
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/
|
|
34
|
+
const react_1 = __importStar(require("react"));
|
|
35
|
+
const react_native_1 = require("react-native");
|
|
36
|
+
const LogBoxData = __importStar(require("./Data/LogBoxData"));
|
|
37
|
+
const LogContext_1 = require("./Data/LogContext");
|
|
38
|
+
const LogBoxStyle = __importStar(require("./UI/LogBoxStyle"));
|
|
39
|
+
const LogBoxInspectorCodeFrame_1 = require("./overlay/LogBoxInspectorCodeFrame");
|
|
40
|
+
const LogBoxInspectorFooter_1 = require("./overlay/LogBoxInspectorFooter");
|
|
41
|
+
const LogBoxInspectorHeader_1 = require("./overlay/LogBoxInspectorHeader");
|
|
42
|
+
const LogBoxInspectorMessageHeader_1 = require("./overlay/LogBoxInspectorMessageHeader");
|
|
43
|
+
const LogBoxInspectorStackFrames_1 = require("./overlay/LogBoxInspectorStackFrames");
|
|
44
|
+
const HEADER_TITLE_MAP = {
|
|
45
|
+
warn: "Console Warning",
|
|
46
|
+
error: "Console Error",
|
|
47
|
+
fatal: "Uncaught Error",
|
|
48
|
+
syntax: "Syntax Error",
|
|
49
|
+
component: "Render Error",
|
|
50
|
+
};
|
|
51
|
+
function LogBoxInspectorContainer() {
|
|
52
|
+
const { selectedLogIndex, logs } = (0, LogContext_1.useLogs)();
|
|
53
|
+
const log = logs[selectedLogIndex];
|
|
54
|
+
if (log == null) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
return (react_1.default.createElement(LogBoxInspector, { log: log, selectedLogIndex: selectedLogIndex, logs: logs }));
|
|
58
|
+
}
|
|
59
|
+
exports.LogBoxInspectorContainer = LogBoxInspectorContainer;
|
|
60
|
+
function LogBoxInspector({ log, selectedLogIndex, logs, }) {
|
|
61
|
+
const onDismiss = (0, react_1.useCallback)(() => {
|
|
62
|
+
// Here we handle the cases when the log is dismissed and it
|
|
63
|
+
// was either the last log, or when the current index
|
|
64
|
+
// is now outside the bounds of the log array.
|
|
65
|
+
const logsArray = Array.from(logs);
|
|
66
|
+
if (selectedLogIndex != null) {
|
|
67
|
+
if (logsArray.length - 1 <= 0) {
|
|
68
|
+
LogBoxData.setSelectedLog(-1);
|
|
69
|
+
}
|
|
70
|
+
else if (selectedLogIndex >= logsArray.length - 1) {
|
|
71
|
+
LogBoxData.setSelectedLog(selectedLogIndex - 1);
|
|
72
|
+
}
|
|
73
|
+
LogBoxData.dismiss(logsArray[selectedLogIndex]);
|
|
74
|
+
}
|
|
75
|
+
}, [selectedLogIndex]);
|
|
76
|
+
const onMinimize = (0, react_1.useCallback)(() => {
|
|
77
|
+
LogBoxData.setSelectedLog(-1);
|
|
78
|
+
}, []);
|
|
79
|
+
const onChangeSelectedIndex = (0, react_1.useCallback)((index) => {
|
|
80
|
+
LogBoxData.setSelectedLog(index);
|
|
81
|
+
}, []);
|
|
82
|
+
(0, react_1.useEffect)(() => {
|
|
83
|
+
if (log) {
|
|
84
|
+
LogBoxData.symbolicateLogNow("stack", log);
|
|
85
|
+
LogBoxData.symbolicateLogNow("component", log);
|
|
86
|
+
}
|
|
87
|
+
}, [log]);
|
|
88
|
+
(0, react_1.useEffect)(() => {
|
|
89
|
+
// Optimistically symbolicate the last and next logs.
|
|
90
|
+
if (logs.length > 1) {
|
|
91
|
+
const selected = selectedLogIndex;
|
|
92
|
+
const lastIndex = logs.length - 1;
|
|
93
|
+
const prevIndex = selected - 1 < 0 ? lastIndex : selected - 1;
|
|
94
|
+
const nextIndex = selected + 1 > lastIndex ? 0 : selected + 1;
|
|
95
|
+
for (const type of ["component", "stack"]) {
|
|
96
|
+
LogBoxData.symbolicateLogLazy(type, logs[prevIndex]);
|
|
97
|
+
LogBoxData.symbolicateLogLazy(type, logs[nextIndex]);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}, [logs, selectedLogIndex]);
|
|
101
|
+
(0, react_1.useEffect)(() => {
|
|
102
|
+
react_native_1.Keyboard.dismiss();
|
|
103
|
+
}, []);
|
|
104
|
+
const _handleRetry = (0, react_1.useCallback)((type) => {
|
|
105
|
+
LogBoxData.retrySymbolicateLogNow(type, log);
|
|
106
|
+
}, [log]);
|
|
107
|
+
return (react_1.default.createElement(react_native_1.View, { style: [react_native_1.StyleSheet.absoluteFill, { flex: 1 }] },
|
|
108
|
+
react_1.default.createElement(LogBoxInspectorHeader_1.LogBoxInspectorHeader, { onSelectIndex: onChangeSelectedIndex, level: log.level }),
|
|
109
|
+
react_1.default.createElement(ErrorOverlayBody, { onRetry: _handleRetry }),
|
|
110
|
+
react_1.default.createElement(LogBoxInspectorFooter_1.LogBoxInspectorFooter, { onDismiss: onDismiss, onMinimize: onMinimize })));
|
|
111
|
+
}
|
|
112
|
+
exports.LogBoxInspector = LogBoxInspector;
|
|
113
|
+
function ErrorOverlayBody({ onRetry }) {
|
|
114
|
+
var _a, _b;
|
|
115
|
+
const log = (0, LogContext_1.useSelectedLog)();
|
|
116
|
+
const [collapsed, setCollapsed] = (0, react_1.useState)(true);
|
|
117
|
+
(0, react_1.useEffect)(() => {
|
|
118
|
+
setCollapsed(true);
|
|
119
|
+
}, [log]);
|
|
120
|
+
const headerTitle = (_a = HEADER_TITLE_MAP[log.isComponentError ? "component" : log.level]) !== null && _a !== void 0 ? _a : log.type;
|
|
121
|
+
const header = (react_1.default.createElement(LogBoxInspectorMessageHeader_1.LogBoxInspectorMessageHeader, { collapsed: collapsed, onPress: () => setCollapsed(!collapsed), message: log.message, level: log.level, title: headerTitle }));
|
|
122
|
+
const content = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
123
|
+
react_1.default.createElement(LogBoxInspectorCodeFrame_1.LogBoxInspectorCodeFrame, { codeFrame: log.codeFrame }),
|
|
124
|
+
react_1.default.createElement(LogBoxInspectorStackFrames_1.LogBoxInspectorStackFrames, { type: "stack",
|
|
125
|
+
// eslint-disable-next-line react/jsx-no-bind
|
|
126
|
+
onRetry: onRetry.bind(onRetry, "stack") }),
|
|
127
|
+
!!((_b = log === null || log === void 0 ? void 0 : log.componentStack) === null || _b === void 0 ? void 0 : _b.length) && (react_1.default.createElement(LogBoxInspectorStackFrames_1.LogBoxInspectorStackFrames, { type: "component",
|
|
128
|
+
// eslint-disable-next-line react/jsx-no-bind
|
|
129
|
+
onRetry: onRetry.bind(onRetry, "component") }))));
|
|
130
|
+
if (collapsed) {
|
|
131
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
132
|
+
header,
|
|
133
|
+
react_1.default.createElement(react_native_1.ScrollView, { style: styles.scrollBody }, content)));
|
|
134
|
+
}
|
|
135
|
+
return (react_1.default.createElement(react_native_1.ScrollView, { style: styles.scrollBody },
|
|
136
|
+
header,
|
|
137
|
+
content));
|
|
138
|
+
}
|
|
139
|
+
const styles = react_native_1.StyleSheet.create({
|
|
140
|
+
scrollBody: {
|
|
141
|
+
backgroundColor: LogBoxStyle.getBackgroundColor(1),
|
|
142
|
+
flex: 1,
|
|
143
|
+
},
|
|
144
|
+
});
|
|
145
|
+
exports.default = LogBoxData.withSubscription(LogBoxInspectorContainer);
|
|
146
|
+
//# sourceMappingURL=ErrorOverlay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorOverlay.js","sourceRoot":"","sources":["../../src/error-overlay/ErrorOverlay.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;GAMG;AACH,+CAAgE;AAChE,+CAAsE;AAEtE,8DAAgD;AAEhD,kDAA4D;AAC5D,8DAAgD;AAChD,iFAA8E;AAC9E,2EAA8F;AAC9F,2EAA8F;AAC9F,yFAAsF;AACtF,qFAAkF;AAElF,MAAM,gBAAgB,GAAG;IACvB,IAAI,EAAE,iBAAiB;IACvB,KAAK,EAAE,eAAe;IACtB,KAAK,EAAE,gBAAgB;IACvB,MAAM,EAAE,cAAc;IACtB,SAAS,EAAE,cAAc;CAC1B,CAAC;AAEF,SAAgB,wBAAwB;IACtC,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,GAAG,IAAA,oBAAO,GAAE,CAAC;IAC7C,MAAM,GAAG,GAAG,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACnC,IAAI,GAAG,IAAI,IAAI,EAAE;QACf,OAAO,IAAI,CAAC;KACb;IACD,OAAO,CACL,8BAAC,eAAe,IACd,GAAG,EAAE,GAAG,EACR,gBAAgB,EAAE,gBAAgB,EAClC,IAAI,EAAE,IAAI,GACV,CACH,CAAC;AACJ,CAAC;AAbD,4DAaC;AACD,SAAgB,eAAe,CAAC,EAC9B,GAAG,EACH,gBAAgB,EAChB,IAAI,GAKL;IACC,MAAM,SAAS,GAAG,IAAA,mBAAW,EAAC,GAAS,EAAE;QACvC,4DAA4D;QAC5D,qDAAqD;QACrD,8CAA8C;QAC9C,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,gBAAgB,IAAI,IAAI,EAAE;YAC5B,IAAI,SAAS,CAAC,MAAM,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AE,MAAM,CAAC,UAAU;QACjC,MAAM;QACN,OAAO,CACG,CACd,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,UAAU,EAAE;QACV,eAAe,EAAE,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC;QAClD,IAAI,EAAE,CAAC;KACR;CACF,CAAC,CAAC;AAEH,kBAAe,UAAU,CAAC,gBAAgB,CAAC,wBAAwB,CAAC,CAAC","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 */\nimport React, { useCallback, useEffect, useState } from \"react\";\nimport { Keyboard, ScrollView, StyleSheet, View } from \"react-native\";\n\nimport * as LogBoxData from \"./Data/LogBoxData\";\nimport { LogBoxLog, StackType } from \"./Data/LogBoxLog\";\nimport { useLogs, useSelectedLog } from \"./Data/LogContext\";\nimport * as LogBoxStyle from \"./UI/LogBoxStyle\";\nimport { LogBoxInspectorCodeFrame } from \"./overlay/LogBoxInspectorCodeFrame\";\nimport { LogBoxInspectorFooter as ErrorOverlayFooter } from \"./overlay/LogBoxInspectorFooter\";\nimport { LogBoxInspectorHeader as ErrorOverlayHeader } from \"./overlay/LogBoxInspectorHeader\";\nimport { LogBoxInspectorMessageHeader } from \"./overlay/LogBoxInspectorMessageHeader\";\nimport { LogBoxInspectorStackFrames } from \"./overlay/LogBoxInspectorStackFrames\";\n\nconst HEADER_TITLE_MAP = {\n warn: \"Console Warning\",\n error: \"Console Error\",\n fatal: \"Uncaught Error\",\n syntax: \"Syntax Error\",\n component: \"Render Error\",\n};\n\nexport function LogBoxInspectorContainer() {\n const { selectedLogIndex, logs } = useLogs();\n const log = logs[selectedLogIndex];\n if (log == null) {\n return null;\n }\n return (\n <LogBoxInspector\n log={log}\n selectedLogIndex={selectedLogIndex}\n logs={logs}\n />\n );\n}\nexport function LogBoxInspector({\n log,\n selectedLogIndex,\n logs,\n}: {\n log: LogBoxLog;\n selectedLogIndex: number;\n logs: LogBoxLog[];\n}) {\n const onDismiss = useCallback((): 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 logsArray = Array.from(logs);\n if (selectedLogIndex != null) {\n if (logsArray.length - 1 <= 0) {\n LogBoxData.setSelectedLog(-1);\n } else if (selectedLogIndex >= logsArray.length - 1) {\n LogBoxData.setSelectedLog(selectedLogIndex - 1);\n }\n\n LogBoxData.dismiss(logsArray[selectedLogIndex]);\n }\n }, [selectedLogIndex]);\n\n const onMinimize = useCallback((): void => {\n LogBoxData.setSelectedLog(-1);\n }, []);\n\n const onChangeSelectedIndex = useCallback((index: number): void => {\n LogBoxData.setSelectedLog(index);\n }, []);\n\n useEffect(() => {\n if (log) {\n LogBoxData.symbolicateLogNow(\"stack\", log);\n LogBoxData.symbolicateLogNow(\"component\", log);\n }\n }, [log]);\n\n useEffect(() => {\n // Optimistically symbolicate the last and next logs.\n if (logs.length > 1) {\n const selected = selectedLogIndex;\n const lastIndex = logs.length - 1;\n const prevIndex = selected - 1 < 0 ? lastIndex : selected - 1;\n const nextIndex = selected + 1 > lastIndex ? 0 : selected + 1;\n for (const type of [\"component\", \"stack\"] as const) {\n LogBoxData.symbolicateLogLazy(type, logs[prevIndex]);\n LogBoxData.symbolicateLogLazy(type, logs[nextIndex]);\n }\n }\n }, [logs, selectedLogIndex]);\n\n useEffect(() => {\n Keyboard.dismiss();\n }, []);\n\n const _handleRetry = useCallback(\n (type: StackType) => {\n LogBoxData.retrySymbolicateLogNow(type, log);\n },\n [log]\n );\n\n return (\n <View style={[StyleSheet.absoluteFill, { flex: 1 }]}>\n <ErrorOverlayHeader\n onSelectIndex={onChangeSelectedIndex}\n level={log.level}\n />\n <ErrorOverlayBody onRetry={_handleRetry} />\n <ErrorOverlayFooter onDismiss={onDismiss} onMinimize={onMinimize} />\n </View>\n );\n}\n\nfunction ErrorOverlayBody({ onRetry }: { onRetry: (type: StackType) => void }) {\n const log = useSelectedLog();\n const [collapsed, setCollapsed] = useState(true);\n\n useEffect(() => {\n setCollapsed(true);\n }, [log]);\n\n const headerTitle =\n HEADER_TITLE_MAP[log.isComponentError ? \"component\" : log.level] ??\n log.type;\n\n const header = (\n <LogBoxInspectorMessageHeader\n collapsed={collapsed}\n onPress={() => setCollapsed(!collapsed)}\n message={log.message}\n level={log.level}\n title={headerTitle}\n />\n );\n\n const content = (\n <>\n <LogBoxInspectorCodeFrame codeFrame={log.codeFrame} />\n <LogBoxInspectorStackFrames\n type=\"stack\"\n // eslint-disable-next-line react/jsx-no-bind\n onRetry={onRetry.bind(onRetry, \"stack\")}\n />\n {!!log?.componentStack?.length && (\n <LogBoxInspectorStackFrames\n type=\"component\"\n // eslint-disable-next-line react/jsx-no-bind\n onRetry={onRetry.bind(onRetry, \"component\")}\n />\n )}\n </>\n );\n\n if (collapsed) {\n return (\n <>\n {header}\n <ScrollView style={styles.scrollBody}>{content}</ScrollView>\n </>\n );\n }\n return (\n <ScrollView style={styles.scrollBody}>\n {header}\n {content}\n </ScrollView>\n );\n}\n\nconst styles = StyleSheet.create({\n scrollBody: {\n backgroundColor: LogBoxStyle.getBackgroundColor(1),\n flex: 1,\n },\n});\n\nexport default LogBoxData.withSubscription(LogBoxInspectorContainer);\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IgnorePattern, LogData } from "./Data/LogBoxData";
|
|
2
|
+
import { ExtendedExceptionData } from "./Data/parseLogBoxLog";
|
|
3
|
+
export { LogData, ExtendedExceptionData, IgnorePattern };
|
|
4
|
+
interface ILogBox {
|
|
5
|
+
install(): void;
|
|
6
|
+
uninstall(): void;
|
|
7
|
+
isInstalled(): boolean;
|
|
8
|
+
ignoreLogs(patterns: readonly IgnorePattern[]): void;
|
|
9
|
+
ignoreAllLogs(ignore?: boolean): void;
|
|
10
|
+
clearAllLogs(): void;
|
|
11
|
+
addLog(log: LogData): void;
|
|
12
|
+
addException(error: ExtendedExceptionData): void;
|
|
13
|
+
}
|
|
14
|
+
declare const LogBox: ILogBox;
|
|
15
|
+
export default LogBox;
|
|
16
|
+
//# sourceMappingURL=LogBox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogBox.d.ts","sourceRoot":"","sources":["../../src/error-overlay/LogBox.ts"],"names":[],"mappings":"AAAA,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,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;AAED,QAAA,MAAM,MAAM,EAAE,OAgCb,CAAC;AAIF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const LogBox = {
|
|
4
|
+
install() {
|
|
5
|
+
// Do nothing.
|
|
6
|
+
},
|
|
7
|
+
uninstall() {
|
|
8
|
+
// Do nothing.
|
|
9
|
+
},
|
|
10
|
+
isInstalled() {
|
|
11
|
+
return false;
|
|
12
|
+
},
|
|
13
|
+
ignoreLogs(patterns) {
|
|
14
|
+
// Do nothing.
|
|
15
|
+
},
|
|
16
|
+
ignoreAllLogs(value) {
|
|
17
|
+
// Do nothing.
|
|
18
|
+
},
|
|
19
|
+
clearAllLogs() {
|
|
20
|
+
// Do nothing.
|
|
21
|
+
},
|
|
22
|
+
addLog(log) {
|
|
23
|
+
// Do nothing.
|
|
24
|
+
},
|
|
25
|
+
addException(ex) {
|
|
26
|
+
// Do nothing.
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
module.exports = LogBox;
|
|
30
|
+
exports.default = LogBox;
|
|
31
|
+
//# sourceMappingURL=LogBox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC;AAExB,kBAAe,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\nmodule.exports = LogBox;\n\nexport default LogBox;\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Evan Bacon.
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
import { IgnorePattern, LogData } from "./Data/LogBoxData";
|
|
9
|
+
import { ExtendedExceptionData } from "./Data/parseLogBoxLog";
|
|
10
|
+
export { LogData, ExtendedExceptionData, IgnorePattern };
|
|
11
|
+
declare let LogBox: ILogBox;
|
|
12
|
+
interface ILogBox {
|
|
13
|
+
install(): void;
|
|
14
|
+
uninstall(): void;
|
|
15
|
+
isInstalled(): boolean;
|
|
16
|
+
ignoreLogs(patterns: readonly IgnorePattern[]): void;
|
|
17
|
+
ignoreAllLogs(ignore?: boolean): void;
|
|
18
|
+
clearAllLogs(): void;
|
|
19
|
+
addLog(log: LogData): void;
|
|
20
|
+
addException(error: ExtendedExceptionData): void;
|
|
21
|
+
}
|
|
22
|
+
export default LogBox;
|
|
23
|
+
//# sourceMappingURL=LogBox.web.d.ts.map
|
|
@@ -0,0 +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;AAgJD,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Evan Bacon.
|
|
4
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
const react_native_1 = require("react-native");
|
|
11
|
+
let LogBox;
|
|
12
|
+
/**
|
|
13
|
+
* LogBox displays logs in the app.
|
|
14
|
+
*/
|
|
15
|
+
if (__DEV__) {
|
|
16
|
+
const LogBoxData = require("./Data/LogBoxData");
|
|
17
|
+
const { parseLogBoxLog, parseInterpolation, } = require("./Data/parseLogBoxLog");
|
|
18
|
+
let originalConsoleError;
|
|
19
|
+
let consoleErrorImpl;
|
|
20
|
+
let isLogBoxInstalled = false;
|
|
21
|
+
LogBox = {
|
|
22
|
+
install() {
|
|
23
|
+
if (isLogBoxInstalled) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
isLogBoxInstalled = true;
|
|
27
|
+
// Trigger lazy initialization of module.
|
|
28
|
+
// require("../NativeModules/specs/NativeLogBox");
|
|
29
|
+
// IMPORTANT: we only overwrite `console.error` and `console.warn` once.
|
|
30
|
+
// When we uninstall we keep the same reference and only change its
|
|
31
|
+
// internal implementation
|
|
32
|
+
const isFirstInstall = originalConsoleError == null;
|
|
33
|
+
if (isFirstInstall) {
|
|
34
|
+
originalConsoleError = console.error.bind(console);
|
|
35
|
+
console.error = (...args) => {
|
|
36
|
+
consoleErrorImpl(...args);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
consoleErrorImpl = registerError;
|
|
40
|
+
if (react_native_1.Platform.isTesting) {
|
|
41
|
+
LogBoxData.setDisabled(true);
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
uninstall() {
|
|
45
|
+
if (!isLogBoxInstalled) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
isLogBoxInstalled = false;
|
|
49
|
+
// IMPORTANT: we don't re-assign to `console` in case the method has been
|
|
50
|
+
// decorated again after installing LogBox. E.g.:
|
|
51
|
+
// Before uninstalling: original > LogBox > OtherErrorHandler
|
|
52
|
+
// After uninstalling: original > LogBox (noop) > OtherErrorHandler
|
|
53
|
+
consoleErrorImpl = originalConsoleError;
|
|
54
|
+
delete console.disableLogBox;
|
|
55
|
+
},
|
|
56
|
+
isInstalled() {
|
|
57
|
+
return isLogBoxInstalled;
|
|
58
|
+
},
|
|
59
|
+
ignoreLogs(patterns) {
|
|
60
|
+
LogBoxData.addIgnorePatterns(patterns);
|
|
61
|
+
},
|
|
62
|
+
ignoreAllLogs(value) {
|
|
63
|
+
LogBoxData.setDisabled(value == null ? true : value);
|
|
64
|
+
},
|
|
65
|
+
clearAllLogs() {
|
|
66
|
+
LogBoxData.clear();
|
|
67
|
+
},
|
|
68
|
+
addLog(log) {
|
|
69
|
+
if (isLogBoxInstalled) {
|
|
70
|
+
LogBoxData.addLog(log);
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
addException(error) {
|
|
74
|
+
if (isLogBoxInstalled) {
|
|
75
|
+
LogBoxData.addException(error);
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
const isWarningModuleWarning = (...args) => {
|
|
80
|
+
return typeof args[0] === "string" && args[0].startsWith("Warning: ");
|
|
81
|
+
};
|
|
82
|
+
const registerError = (...args) => {
|
|
83
|
+
// Let errors within LogBox itself fall through.
|
|
84
|
+
if (LogBoxData.isLogBoxErrorMessage(args[0])) {
|
|
85
|
+
originalConsoleError(...args);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
try {
|
|
89
|
+
if (!isWarningModuleWarning(...args)) {
|
|
90
|
+
// Only show LogBox for the 'warning' module, otherwise pass through.
|
|
91
|
+
// By passing through, this will get picked up by the React console override,
|
|
92
|
+
// potentially adding the component stack. React then passes it back to the
|
|
93
|
+
// React Native ExceptionsManager, which reports it to LogBox as an error.
|
|
94
|
+
//
|
|
95
|
+
// The 'warning' module needs to be handled here because React internally calls
|
|
96
|
+
// `console.error('Warning: ')` with the component stack already included.
|
|
97
|
+
originalConsoleError(...args);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const { message } = parseLogBoxLog(args);
|
|
101
|
+
if (!LogBoxData.isMessageIgnored(message.content)) {
|
|
102
|
+
// Interpolate the message so they are formatted for adb and other CLIs.
|
|
103
|
+
// This is different than the message.content above because it includes component stacks.
|
|
104
|
+
const interpolated = parseInterpolation(args);
|
|
105
|
+
originalConsoleError(interpolated.message.content);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
catch (err) {
|
|
109
|
+
LogBoxData.reportUnexpectedLogBoxError(err);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
LogBox = {
|
|
115
|
+
install() { },
|
|
116
|
+
uninstall() { },
|
|
117
|
+
isInstalled() {
|
|
118
|
+
return false;
|
|
119
|
+
},
|
|
120
|
+
ignoreLogs(patterns) { },
|
|
121
|
+
ignoreAllLogs(value) { },
|
|
122
|
+
clearAllLogs() { },
|
|
123
|
+
addLog(log) { },
|
|
124
|
+
addException(ex) { },
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
module.exports = LogBox;
|
|
128
|
+
exports.default = LogBox;
|
|
129
|
+
//# sourceMappingURL=LogBox.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogBox.web.js","sourceRoot":"","sources":["../../src/error-overlay/LogBox.web.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAEH,+CAAwC;AAOxC,IAAI,MAAe,CAAC;AAapB;;GAEG;AACH,IAAI,OAAO,EAAE;IACX,MAAM,UAAU,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAChD,MAAM,EACJ,cAAc,EACd,kBAAkB,GACnB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAErC,IAAI,oBAAoB,CAAC;IACzB,IAAI,gBAAgB,CAAC;IAErB,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,CAAC,GAAG,IAAI,CAAC,CAAC;gBAC5B,CAAC,CAAC;aACH;YAED,gBAAgB,GAAG,aAAa,CAAC;YAEjC,IAAI,uB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C,CAAC,CAAC,EAAE;YAC5C,oBAAoB,CAAC,GAAG,IAAI,CAAC,CAAC;YAC9B,OAAO;SACR;QAED,IAAI;YACF,IAAI,CAAC,sBAAsB,CAAC,GAAG,IAAI,CAAC,EAAE;gBACpC,qEAAqE;gBACrE,6EAA6E;gBAC7E,2EAA2E;gBAC3E,0EAA0E;gBAC1E,EAAE;gBACF,+EAA+E;gBAC/E,0EAA0E;gBAC1E,oBAAoB,CAAC,GAAG,IAAI,CAAC,CAAC;gBAC9B,OAAO;aACR;YAED,MAAM,EAAE,OAAO,EAAE,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;YAEzC,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;gBACjD,wEAAwE;gBACxE,yFAAyF;gBACzF,MAAM,YAAY,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;gBAC9C,oBAAoB,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;aACpD;SACF;QAAC,OAAO,GAAG,EAAE;YACZ,UAAU,CAAC,2BAA2B,CAAC,GAAG,CAAC,CAAC;SAC7C;IACH,CAAC,CAAC;CACH;KAAM;IACL,MAAM,GAAG;QACP,OAAO,KAAU,CAAC;QAClB,SAAS,KAAU,CAAC;QACpB,WAAW;YACT,OAAO,KAAK,CAAC;QACf,CAAC;QACD,UAAU,CAAC,QAAkC,IAAS,CAAC;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,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC;AAExB,kBAAe,MAAM,CAAC","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 { 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 {\n parseLogBoxLog,\n parseInterpolation,\n } = require(\"./Data/parseLogBoxLog\");\n\n let originalConsoleError;\n let consoleErrorImpl;\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): 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 { message } = 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 } 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\nmodule.exports = LogBox;\n\nexport default LogBox;\n"]}
|
|
@@ -0,0 +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,EACnB,IAAI,EACJ,KAAK,GACN,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC7B,eAyDA"}
|
|
@@ -0,0 +1,86 @@
|
|
|
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
|
+
/**
|
|
8
|
+
* Copyright (c) Evan Bacon.
|
|
9
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
10
|
+
*
|
|
11
|
+
* This source code is licensed under the MIT license found in the
|
|
12
|
+
* LICENSE file in the root directory of this source tree.
|
|
13
|
+
*/
|
|
14
|
+
const anser_1 = __importDefault(require("anser"));
|
|
15
|
+
const react_1 = __importDefault(require("react"));
|
|
16
|
+
const react_native_1 = require("react-native");
|
|
17
|
+
// Afterglow theme from https://iterm2colorschemes.com/
|
|
18
|
+
const COLORS = {
|
|
19
|
+
"ansi-black": "rgb(27, 27, 27)",
|
|
20
|
+
"ansi-red": "rgb(187, 86, 83)",
|
|
21
|
+
"ansi-green": "rgb(144, 157, 98)",
|
|
22
|
+
"ansi-yellow": "rgb(234, 193, 121)",
|
|
23
|
+
"ansi-blue": "rgb(125, 169, 199)",
|
|
24
|
+
"ansi-magenta": "rgb(176, 101, 151)",
|
|
25
|
+
"ansi-cyan": "rgb(140, 220, 216)",
|
|
26
|
+
// Instead of white, use the default color provided to the component
|
|
27
|
+
// 'ansi-white': 'rgb(216, 216, 216)',
|
|
28
|
+
"ansi-bright-black": "rgb(98, 98, 98)",
|
|
29
|
+
"ansi-bright-red": "rgb(187, 86, 83)",
|
|
30
|
+
"ansi-bright-green": "rgb(144, 157, 98)",
|
|
31
|
+
"ansi-bright-yellow": "rgb(234, 193, 121)",
|
|
32
|
+
"ansi-bright-blue": "rgb(125, 169, 199)",
|
|
33
|
+
"ansi-bright-magenta": "rgb(176, 101, 151)",
|
|
34
|
+
"ansi-bright-cyan": "rgb(140, 220, 216)",
|
|
35
|
+
"ansi-bright-white": "rgb(247, 247, 247)",
|
|
36
|
+
};
|
|
37
|
+
function Ansi({ text, style, }) {
|
|
38
|
+
let commonWhitespaceLength = Infinity;
|
|
39
|
+
const parsedLines = text.split(/\n/).map((line) => anser_1.default.ansiToJson(line, {
|
|
40
|
+
json: true,
|
|
41
|
+
remove_empty: true,
|
|
42
|
+
use_classes: true,
|
|
43
|
+
}));
|
|
44
|
+
parsedLines.map((lines) => {
|
|
45
|
+
var _a, _b, _c;
|
|
46
|
+
// The third item on each line includes the whitespace of the source code.
|
|
47
|
+
// We are looking for the least amount of common whitespace to trim all lines.
|
|
48
|
+
// Example: Array [" ", " 96 |", " text", ...]
|
|
49
|
+
const match = lines[2] && ((_b = (_a = lines[2]) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.match(/^ +/));
|
|
50
|
+
const whitespaceLength = (match && ((_c = match[0]) === null || _c === void 0 ? void 0 : _c.length)) || 0;
|
|
51
|
+
if (whitespaceLength < commonWhitespaceLength) {
|
|
52
|
+
commonWhitespaceLength = whitespaceLength;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
const getText = (content, key) => {
|
|
56
|
+
if (key === 1) {
|
|
57
|
+
// Remove the vertical bar after line numbers
|
|
58
|
+
return content.replace(/\| $/, " ");
|
|
59
|
+
}
|
|
60
|
+
else if (key === 2 && commonWhitespaceLength < Infinity) {
|
|
61
|
+
// Remove common whitespace at the beginning of the line
|
|
62
|
+
return content.substr(commonWhitespaceLength);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
return content;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
return (react_1.default.createElement(react_native_1.View, null, parsedLines.map((items, i) => (react_1.default.createElement(react_native_1.View, { style: styles.line, key: i }, items.map((bundle, key) => {
|
|
69
|
+
const textStyle = bundle.fg && COLORS[bundle.fg]
|
|
70
|
+
? {
|
|
71
|
+
backgroundColor: bundle.bg && COLORS[bundle.bg],
|
|
72
|
+
color: bundle.fg && COLORS[bundle.fg],
|
|
73
|
+
}
|
|
74
|
+
: {
|
|
75
|
+
backgroundColor: bundle.bg && COLORS[bundle.bg],
|
|
76
|
+
};
|
|
77
|
+
return (react_1.default.createElement(react_native_1.Text, { style: [style, textStyle], key: key }, getText(bundle.content, key)));
|
|
78
|
+
}))))));
|
|
79
|
+
}
|
|
80
|
+
exports.Ansi = Ansi;
|
|
81
|
+
const styles = react_native_1.StyleSheet.create({
|
|
82
|
+
line: {
|
|
83
|
+
flexDirection: "row",
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
//# sourceMappingURL=AnsiHighlight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnsiHighlight.js","sourceRoot":"","sources":["../../../src/error-overlay/UI/AnsiHighlight.tsx"],"names":[],"mappings":";;;;;;AAAA;;;;;;GAMG;AACH,kDAA0B;AAC1B,kDAA0B;AAC1B,+CAA4E;AAE5E,uDAAuD;AACvD,MAAM,MAAM,GAAG;IACb,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;IACpE,sCAAsC;IACtC,mBAAmB,EAAE,iBAAiB;IACtC,iBAAiB,EAAE,kBAAkB;IACrC,mBAAmB,EAAE,mBAAmB;IACxC,oBAAoB,EAAE,oBAAoB;IAC1C,kBAAkB,EAAE,oBAAoB;IACxC,qBAAqB,EAAE,oBAAoB;I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;SAChB;IACH,CAAC,CAAC;IAEF,OAAO,CACL,8BAAC,mBAAI,QACF,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAC7B,8BAAC,mBAAI,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,8BAAC,mBAAI,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;AA/DD,oBA+DC;AAED,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE;QACJ,aAAa,EAAE,KAAK;KACrB;CACF,CAAC,CAAC","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 */\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 = {\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({\n text,\n style,\n}: {\n text: string;\n style: StyleProp<TextStyle>;\n}) {\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, key) => {\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"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { GestureResponderEvent, Insets, ViewStyle } from "react-native";
|
|
2
|
+
declare type Props = {
|
|
3
|
+
backgroundColor: {
|
|
4
|
+
default: string;
|
|
5
|
+
pressed: string;
|
|
6
|
+
};
|
|
7
|
+
children?: any;
|
|
8
|
+
hitSlop?: Insets;
|
|
9
|
+
onPress?: ((event: GestureResponderEvent) => void) | null;
|
|
10
|
+
style?: ViewStyle;
|
|
11
|
+
};
|
|
12
|
+
export declare function LogBoxButton(props: Props): JSX.Element;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=LogBoxButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogBoxButton.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/UI/LogBoxButton.tsx"],"names":[],"mappings":"AAQA,OAAO,EACL,qBAAqB,EACrB,MAAM,EAKN,SAAS,EACV,MAAM,cAAc,CAAC;AAItB,aAAK,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,eA2CxC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
/**
|
|
28
|
+
* Copyright (c) Evan Bacon.
|
|
29
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/
|
|
34
|
+
const react_1 = __importStar(require("react"));
|
|
35
|
+
const react_native_1 = require("react-native");
|
|
36
|
+
const LogBoxStyle = __importStar(require("./LogBoxStyle"));
|
|
37
|
+
function LogBoxButton(props) {
|
|
38
|
+
const [pressed, setPressed] = (0, react_1.useState)(false);
|
|
39
|
+
let backgroundColor = props.backgroundColor;
|
|
40
|
+
if (!backgroundColor) {
|
|
41
|
+
backgroundColor = {
|
|
42
|
+
default: LogBoxStyle.getBackgroundColor(0.95),
|
|
43
|
+
pressed: LogBoxStyle.getBackgroundColor(0.6),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const content = (react_1.default.createElement(react_native_1.View, { style: react_native_1.StyleSheet.compose({
|
|
47
|
+
backgroundColor: pressed
|
|
48
|
+
? backgroundColor.pressed
|
|
49
|
+
: backgroundColor.default,
|
|
50
|
+
...react_native_1.Platform.select({
|
|
51
|
+
web: {
|
|
52
|
+
cursor: "pointer",
|
|
53
|
+
},
|
|
54
|
+
}),
|
|
55
|
+
}, props.style) }, props.children));
|
|
56
|
+
return props.onPress == null ? (content) : (react_1.default.createElement(react_native_1.TouchableWithoutFeedback, { hitSlop: props.hitSlop, onPress: props.onPress, onPressIn: () => setPressed(true), onPressOut: () => setPressed(false) }, content));
|
|
57
|
+
}
|
|
58
|
+
exports.LogBoxButton = LogBoxButton;
|
|
59
|
+
//# sourceMappingURL=LogBoxButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogBoxButton.js","sourceRoot":"","sources":["../../../src/error-overlay/UI/LogBoxButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;GAMG;AACH,+CAAwC;AACxC,+CAQsB;AAEtB,2DAA6C;AAa7C,SAAgB,YAAY,CAAC,KAAY;IACvC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ,EAAC,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,8BAAC,mBAAI,IACH,KAAK,EAAE,yBAAU,CAAC,OAAO,CACvB;YACE,eAAe,EAAE,OAAO;gBACtB,CAAC,CAAC,eAAe,CAAC,OAAO;gBACzB,CAAC,CAAC,eAAe,CAAC,OAAO;YAC3B,GAAG,uBAAQ,CAAC,MAAM,CAAC;gBACjB,GAAG,EAAE;oBACH,MAAM,EAAE,SAAS;iBAClB;aACF,CAAC;SACH,EACD,KAAK,CAAC,KAAK,CACZ,IAEA,KAAK,CAAC,QAAQ,CACV,CACR,CAAC;IAEF,OAAO,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,CAC7B,OAAO,CACR,CAAC,CAAC,CAAC,CACF,8BAAC,uCAAwB,IACvB,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,IAElC,OAAO,CACiB,CAC5B,CAAC;AACJ,CAAC;AA3CD,oCA2CC","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 */\nimport React, { useState } from \"react\";\nimport {\n GestureResponderEvent,\n Insets,\n Platform,\n StyleSheet,\n TouchableWithoutFeedback,\n View,\n ViewStyle,\n} 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={StyleSheet.compose(\n {\n backgroundColor: pressed\n ? backgroundColor.pressed\n : backgroundColor.default,\n ...Platform.select({\n web: {\n cursor: \"pointer\",\n },\n }),\n },\n props.style\n )}\n >\n {props.children}\n </View>\n );\n\n return props.onPress == null ? (\n content\n ) : (\n <TouchableWithoutFeedback\n hitSlop={props.hitSlop}\n onPress={props.onPress}\n onPressIn={() => setPressed(true)}\n onPressOut={() => setPressed(false)}\n >\n {content}\n </TouchableWithoutFeedback>\n );\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StyleProp, TextStyle } from "react-native";
|
|
2
|
+
import type { Message } from "../Data/parseLogBoxLog";
|
|
3
|
+
declare type Props = {
|
|
4
|
+
message: Message;
|
|
5
|
+
style: StyleProp<TextStyle>;
|
|
6
|
+
plaintext?: boolean;
|
|
7
|
+
maxLength?: number;
|
|
8
|
+
};
|
|
9
|
+
export declare function LogBoxMessage(props: Props): JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=LogBoxMessage.d.ts.map
|
|
@@ -0,0 +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,aAAK,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,CA4DvD"}
|