@expo/metro-runtime 3.0.0 → 3.0.2
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/build/HMRClient.js +43 -15
- package/build/HMRClient.js.map +1 -1
- package/build/HMRClient.native.js +3 -1
- package/build/HMRClient.native.js.map +1 -1
- package/build/LoadingView.d.ts +6 -0
- package/build/LoadingView.d.ts.map +1 -1
- package/build/LoadingView.js +12 -4
- package/build/LoadingView.js.map +1 -1
- package/build/LoadingView.native.js +7 -2
- package/build/LoadingView.native.js.map +1 -1
- package/build/async-require/buildAsyncRequire.js +7 -3
- package/build/async-require/buildAsyncRequire.js.map +1 -1
- package/build/async-require/buildUrlForBundle.js +5 -1
- package/build/async-require/buildUrlForBundle.js.map +1 -1
- package/build/async-require/buildUrlForBundle.native.js +5 -1
- package/build/async-require/buildUrlForBundle.native.js.map +1 -1
- package/build/async-require/fetchAsync.d.ts +6 -0
- package/build/async-require/fetchAsync.d.ts.map +1 -1
- package/build/async-require/fetchAsync.js +6 -3
- package/build/async-require/fetchAsync.js.map +1 -1
- package/build/async-require/fetchAsync.native.js +13 -6
- package/build/async-require/fetchAsync.native.js.map +1 -1
- package/build/async-require/fetchThenEval.d.ts +1 -6
- package/build/async-require/fetchThenEval.d.ts.map +1 -1
- package/build/async-require/fetchThenEval.js +5 -31
- package/build/async-require/fetchThenEval.js.map +1 -1
- package/build/async-require/fetchThenEval.web.js +6 -2
- package/build/async-require/fetchThenEval.web.js.map +1 -1
- package/build/async-require/fetchThenEvalJs.d.ts +7 -0
- package/build/async-require/fetchThenEvalJs.d.ts.map +1 -0
- package/build/async-require/fetchThenEvalJs.js +36 -0
- package/build/async-require/fetchThenEvalJs.js.map +1 -0
- package/build/async-require/index.js +4 -2
- package/build/async-require/index.js.map +1 -1
- package/build/async-require/index.native.d.ts +7 -0
- package/build/async-require/index.native.d.ts.map +1 -0
- package/build/async-require/index.native.js +14 -0
- package/build/async-require/index.native.js.map +1 -0
- package/build/async-require/loadBundle.js +10 -6
- package/build/async-require/loadBundle.js.map +1 -1
- package/build/effects.d.ts +0 -1
- package/build/effects.js +7 -10
- package/build/effects.js.map +1 -1
- package/build/error-overlay/Data/LogBoxData.d.ts.map +1 -1
- package/build/error-overlay/Data/LogBoxData.js +82 -33
- package/build/error-overlay/Data/LogBoxData.js.map +1 -1
- package/build/error-overlay/Data/LogBoxLog.js +29 -2
- package/build/error-overlay/Data/LogBoxLog.js.map +1 -1
- package/build/error-overlay/Data/LogBoxSymbolication.js +12 -4
- package/build/error-overlay/Data/LogBoxSymbolication.js.map +1 -1
- package/build/error-overlay/Data/LogContext.js +17 -9
- package/build/error-overlay/Data/LogContext.js.map +1 -1
- package/build/error-overlay/Data/parseLogBoxLog.d.ts.map +1 -1
- package/build/error-overlay/Data/parseLogBoxLog.js +20 -11
- package/build/error-overlay/Data/parseLogBoxLog.js.map +1 -1
- package/build/error-overlay/ErrorOverlay.d.ts.map +1 -1
- package/build/error-overlay/ErrorOverlay.js +73 -41
- package/build/error-overlay/ErrorOverlay.js.map +1 -1
- package/build/error-overlay/LogBox.js +3 -1
- package/build/error-overlay/LogBox.js.map +1 -1
- package/build/error-overlay/LogBox.web.d.ts.map +1 -1
- package/build/error-overlay/LogBox.web.js +4 -3
- package/build/error-overlay/LogBox.web.js.map +1 -1
- package/build/error-overlay/UI/AnsiHighlight.js +15 -8
- package/build/error-overlay/UI/AnsiHighlight.js.map +1 -1
- package/build/error-overlay/UI/LogBoxButton.js +35 -8
- package/build/error-overlay/UI/LogBoxButton.js.map +1 -1
- package/build/error-overlay/UI/LogBoxMessage.js +13 -6
- package/build/error-overlay/UI/LogBoxMessage.js.map +1 -1
- package/build/error-overlay/UI/LogBoxStyle.js +31 -14
- package/build/error-overlay/UI/LogBoxStyle.js.map +1 -1
- package/build/error-overlay/UI/constants.js +5 -2
- package/build/error-overlay/UI/constants.js.map +1 -1
- package/build/error-overlay/formatProjectFilePath.js +7 -2
- package/build/error-overlay/formatProjectFilePath.js.map +1 -1
- package/build/error-overlay/index.d.ts.map +1 -1
- package/build/error-overlay/index.js +19 -9
- package/build/error-overlay/index.js.map +1 -1
- package/build/error-overlay/modules/ExceptionsManager/index.js +8 -3
- package/build/error-overlay/modules/ExceptionsManager/index.js.map +1 -1
- package/build/error-overlay/modules/ExceptionsManager/index.native.js +7 -2
- package/build/error-overlay/modules/ExceptionsManager/index.native.js.map +1 -1
- package/build/error-overlay/modules/NativeLogBox/index.js +10 -5
- package/build/error-overlay/modules/NativeLogBox/index.js.map +1 -1
- package/build/error-overlay/modules/NativeLogBox/index.native.js +7 -2
- package/build/error-overlay/modules/NativeLogBox/index.native.js.map +1 -1
- package/build/error-overlay/modules/openFileInEditor/index.js +3 -1
- package/build/error-overlay/modules/openFileInEditor/index.js.map +1 -1
- package/build/error-overlay/modules/openFileInEditor/index.native.js +7 -2
- package/build/error-overlay/modules/openFileInEditor/index.native.js.map +1 -1
- package/build/error-overlay/modules/parseErrorStack/index.d.ts.map +1 -1
- package/build/error-overlay/modules/parseErrorStack/index.js +10 -7
- package/build/error-overlay/modules/parseErrorStack/index.js.map +1 -1
- package/build/error-overlay/modules/parseErrorStack/parseHermesStack.js +8 -2
- package/build/error-overlay/modules/parseErrorStack/parseHermesStack.js.map +1 -1
- package/build/error-overlay/modules/stringifySafe/index.js +6 -2
- package/build/error-overlay/modules/stringifySafe/index.js.map +1 -1
- package/build/error-overlay/modules/symbolicateStackTrace/index.js +3 -1
- package/build/error-overlay/modules/symbolicateStackTrace/index.js.map +1 -1
- package/build/error-overlay/modules/symbolicateStackTrace/index.native.js +7 -2
- package/build/error-overlay/modules/symbolicateStackTrace/index.native.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.d.ts.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.js +52 -22
- package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorFooter.js +48 -18
- package/build/error-overlay/overlay/LogBoxInspectorFooter.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorHeader.js +53 -23
- package/build/error-overlay/overlay/LogBoxInspectorHeader.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.js +43 -13
- package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorSection.js +39 -9
- package/build/error-overlay/overlay/LogBoxInspectorSection.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.js +41 -14
- package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorStackFrame.js +44 -14
- package/build/error-overlay/overlay/LogBoxInspectorStackFrame.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorStackFrames.d.ts.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorStackFrames.js +55 -24
- package/build/error-overlay/overlay/LogBoxInspectorStackFrames.js.map +1 -1
- package/build/error-overlay/toast/ErrorToast.d.ts.map +1 -1
- package/build/error-overlay/toast/ErrorToast.js +48 -21
- package/build/error-overlay/toast/ErrorToast.js.map +1 -1
- package/build/error-overlay/toast/ErrorToastContainer.js +9 -3
- package/build/error-overlay/toast/ErrorToastContainer.js.map +1 -1
- package/build/error-overlay/toast/ErrorToastContainer.web.d.ts.map +1 -1
- package/build/error-overlay/toast/ErrorToastContainer.web.js +49 -21
- package/build/error-overlay/toast/ErrorToastContainer.web.js.map +1 -1
- package/build/error-overlay/toast/ErrorToastMessage.js +37 -7
- package/build/error-overlay/toast/ErrorToastMessage.js.map +1 -1
- package/build/error-overlay/useRejectionHandler.js +16 -9
- package/build/error-overlay/useRejectionHandler.js.map +1 -1
- package/build/getDevServer.d.ts.map +1 -1
- package/build/getDevServer.js +10 -9
- package/build/getDevServer.js.map +1 -1
- package/build/getDevServer.native.js +7 -2
- package/build/getDevServer.native.js.map +1 -1
- package/build/index.d.ts +7 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +12 -8
- package/build/index.js.map +1 -1
- package/build/location/Location.js +7 -2
- package/build/location/Location.js.map +1 -1
- package/build/location/Location.native.js +12 -4
- package/build/location/Location.native.js.map +1 -1
- package/build/location/install.native.js +16 -11
- package/build/location/install.native.js.map +1 -1
- package/build/setupHMR.js +28 -26
- package/build/setupHMR.js.map +1 -1
- package/build/symbolicate.js +25 -4
- package/build/symbolicate.js.map +1 -1
- package/package.json +5 -2
- package/src/HMRClient.native.ts +3 -0
- package/src/HMRClient.ts +316 -0
- package/src/LoadingView.native.ts +3 -0
- package/src/LoadingView.ts +24 -0
- package/src/__mocks__/LoadingView.ts +4 -0
- package/src/async-require/buildAsyncRequire.ts +34 -0
- package/src/async-require/buildUrlForBundle.native.ts +28 -0
- package/src/async-require/buildUrlForBundle.ts +18 -0
- package/src/async-require/fetchAsync.native.ts +72 -0
- package/src/async-require/fetchAsync.ts +19 -0
- package/src/async-require/fetchThenEval.ts +1 -0
- package/src/async-require/fetchThenEval.web.ts +70 -0
- package/src/async-require/fetchThenEvalJs.ts +39 -0
- package/src/async-require/index.native.ts +15 -0
- package/src/async-require/index.ts +10 -0
- package/src/async-require/loadBundle.ts +46 -0
- package/src/effects.native.ts +0 -0
- package/src/effects.ts +11 -0
- package/src/error-overlay/Data/LogBoxData.tsx +438 -0
- package/src/error-overlay/Data/LogBoxLog.ts +221 -0
- package/src/error-overlay/Data/LogBoxSymbolication.tsx +64 -0
- package/src/error-overlay/Data/LogContext.tsx +41 -0
- package/src/error-overlay/Data/parseLogBoxLog.tsx +342 -0
- package/src/error-overlay/ErrorOverlay.tsx +191 -0
- package/src/error-overlay/LogBox.ts +51 -0
- package/src/error-overlay/LogBox.web.ts +174 -0
- package/src/error-overlay/UI/AnsiHighlight.tsx +96 -0
- package/src/error-overlay/UI/LogBoxButton.tsx +63 -0
- package/src/error-overlay/UI/LogBoxMessage.tsx +73 -0
- package/src/error-overlay/UI/LogBoxStyle.ts +64 -0
- package/src/error-overlay/UI/constants.ts +7 -0
- package/src/error-overlay/formatProjectFilePath.ts +38 -0
- package/src/error-overlay/index.tsx +34 -0
- package/src/error-overlay/modules/ExceptionsManager/index.native.ts +4 -0
- package/src/error-overlay/modules/ExceptionsManager/index.ts +82 -0
- package/src/error-overlay/modules/NativeLogBox/index.native.ts +3 -0
- package/src/error-overlay/modules/NativeLogBox/index.tsx +27 -0
- package/src/error-overlay/modules/openFileInEditor/index.native.ts +3 -0
- package/src/error-overlay/modules/openFileInEditor/index.ts +16 -0
- package/src/error-overlay/modules/parseErrorStack/index.ts +26 -0
- package/src/error-overlay/modules/parseErrorStack/parseHermesStack.ts +3 -0
- package/src/error-overlay/modules/stringifySafe/index.ts +115 -0
- package/src/error-overlay/modules/symbolicateStackTrace/index.native.ts +3 -0
- package/src/error-overlay/modules/symbolicateStackTrace/index.ts +39 -0
- package/src/error-overlay/overlay/LogBoxInspectorCodeFrame.tsx +102 -0
- package/src/error-overlay/overlay/LogBoxInspectorFooter.tsx +111 -0
- package/src/error-overlay/overlay/LogBoxInspectorHeader.tsx +167 -0
- package/src/error-overlay/overlay/LogBoxInspectorMessageHeader.tsx +116 -0
- package/src/error-overlay/overlay/LogBoxInspectorSection.tsx +52 -0
- package/src/error-overlay/overlay/LogBoxInspectorSourceMapStatus.tsx +125 -0
- package/src/error-overlay/overlay/LogBoxInspectorStackFrame.tsx +89 -0
- package/src/error-overlay/overlay/LogBoxInspectorStackFrames.tsx +201 -0
- package/src/error-overlay/toast/ErrorToast.tsx +167 -0
- package/src/error-overlay/toast/ErrorToastContainer.tsx +9 -0
- package/src/error-overlay/toast/ErrorToastContainer.web.tsx +92 -0
- package/src/error-overlay/toast/ErrorToastMessage.tsx +28 -0
- package/src/error-overlay/useRejectionHandler.ts +61 -0
- package/src/getDevServer.native.ts +3 -0
- package/src/getDevServer.ts +34 -0
- package/src/index.ts +12 -0
- package/src/location/Location.native.ts +201 -0
- package/src/location/Location.ts +3 -0
- package/src/location/install.native.ts +90 -0
- package/src/location/install.ts +0 -0
- package/src/messageSocket.ts +25 -0
- package/src/setupFastRefresh.ts +30 -0
- package/src/setupHMR.ts +28 -0
- package/src/symbolicate.ts +6 -0
|
@@ -1,3 +1,32 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.LogBoxInspectorStackFrame = void 0;
|
|
1
30
|
/**
|
|
2
31
|
* Copyright (c) 650 Industries.
|
|
3
32
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -5,24 +34,25 @@
|
|
|
5
34
|
* This source code is licensed under the MIT license found in the
|
|
6
35
|
* LICENSE file in the root directory of this source tree.
|
|
7
36
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
37
|
+
const react_1 = __importDefault(require("react"));
|
|
38
|
+
const react_native_1 = require("react-native");
|
|
39
|
+
const LogBoxButton_1 = require("../UI/LogBoxButton");
|
|
40
|
+
const LogBoxStyle = __importStar(require("../UI/LogBoxStyle"));
|
|
41
|
+
const constants_1 = require("../UI/constants");
|
|
42
|
+
const formatProjectFilePath_1 = require("../formatProjectFilePath");
|
|
43
|
+
function LogBoxInspectorStackFrame(props) {
|
|
15
44
|
const { frame, onPress } = props;
|
|
16
|
-
const location = getStackFormattedLocation(process.env.EXPO_PROJECT_ROOT, frame);
|
|
17
|
-
return (
|
|
18
|
-
|
|
45
|
+
const location = (0, formatProjectFilePath_1.getStackFormattedLocation)(process.env.EXPO_PROJECT_ROOT, frame);
|
|
46
|
+
return (react_1.default.createElement(react_native_1.View, { style: styles.frameContainer },
|
|
47
|
+
react_1.default.createElement(LogBoxButton_1.LogBoxButton, { backgroundColor: {
|
|
19
48
|
default: 'transparent',
|
|
20
49
|
pressed: onPress ? LogBoxStyle.getBackgroundColor(1) : 'transparent',
|
|
21
50
|
}, onPress: onPress, style: styles.frame },
|
|
22
|
-
|
|
23
|
-
|
|
51
|
+
react_1.default.createElement(react_native_1.Text, { style: [styles.name, frame.collapse === true && styles.dim] }, frame.methodName),
|
|
52
|
+
react_1.default.createElement(react_native_1.Text, { ellipsizeMode: "middle", numberOfLines: 1, style: [styles.location, frame.collapse === true && styles.dim] }, location))));
|
|
24
53
|
}
|
|
25
|
-
|
|
54
|
+
exports.LogBoxInspectorStackFrame = LogBoxInspectorStackFrame;
|
|
55
|
+
const styles = react_native_1.StyleSheet.create({
|
|
26
56
|
frameContainer: {
|
|
27
57
|
flexDirection: 'row',
|
|
28
58
|
paddingHorizontal: 15,
|
|
@@ -42,7 +72,7 @@ const styles = StyleSheet.create({
|
|
|
42
72
|
includeFontPadding: false,
|
|
43
73
|
lineHeight: 18,
|
|
44
74
|
fontWeight: '400',
|
|
45
|
-
fontFamily: CODE_FONT,
|
|
75
|
+
fontFamily: constants_1.CODE_FONT,
|
|
46
76
|
},
|
|
47
77
|
location: {
|
|
48
78
|
color: LogBoxStyle.getTextColor(0.8),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogBoxInspectorStackFrame.js","sourceRoot":"","sources":["../../../src/error-overlay/overlay/LogBoxInspectorStackFrame.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,
|
|
1
|
+
{"version":3,"file":"LogBoxInspectorStackFrame.js","sourceRoot":"","sources":["../../../src/error-overlay/overlay/LogBoxInspectorStackFrame.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;GAMG;AACH,kDAA0B;AAC1B,+CAA6E;AAG7E,qDAAkD;AAClD,+DAAiD;AACjD,+CAA4C;AAC5C,oEAAqE;AASrE,SAAgB,yBAAyB,CAAC,KAAY;IACpD,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IACjC,MAAM,QAAQ,GAAG,IAAA,iDAAyB,EAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC;IACjF,OAAO,CACL,8BAAC,mBAAI,IAAC,KAAK,EAAE,MAAM,CAAC,cAAc;QAChC,8BAAC,2BAAY,IACX,eAAe,EAAE;gBACf,OAAO,EAAE,aAAa;gBACtB,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa;aACrE,EACD,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,8B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CAAC,YAAY,CAAC,GAAG,CAAC;QACpC,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;QACjB,kBAAkB,EAAE,KAAK;QACzB,UAAU,EAAE,EAAE;KACf;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 React from 'react';\nimport { GestureResponderEvent, StyleSheet, Text, View } from 'react-native';\nimport { StackFrame } from 'stacktrace-parser';\n\nimport { LogBoxButton } from '../UI/LogBoxButton';\nimport * as LogBoxStyle from '../UI/LogBoxStyle';\nimport { CODE_FONT } from '../UI/constants';\nimport { getStackFormattedLocation } from '../formatProjectFilePath';\n\ndeclare const process: any;\n\ntype Props = {\n frame: StackFrame & { collapse?: boolean };\n onPress?: (event: GestureResponderEvent) => void;\n};\n\nexport function LogBoxInspectorStackFrame(props: Props) {\n const { frame, onPress } = props;\n const location = getStackFormattedLocation(process.env.EXPO_PROJECT_ROOT, frame);\n return (\n <View style={styles.frameContainer}>\n <LogBoxButton\n backgroundColor={{\n default: 'transparent',\n pressed: onPress ? LogBoxStyle.getBackgroundColor(1) : 'transparent',\n }}\n onPress={onPress}\n style={styles.frame}>\n <Text style={[styles.name, frame.collapse === true && styles.dim]}>{frame.methodName}</Text>\n <Text\n ellipsizeMode=\"middle\"\n numberOfLines={1}\n style={[styles.location, frame.collapse === true && styles.dim]}>\n {location}\n </Text>\n </LogBoxButton>\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n frameContainer: {\n flexDirection: 'row',\n paddingHorizontal: 15,\n },\n frame: {\n flex: 1,\n paddingVertical: 4,\n paddingHorizontal: 10,\n borderRadius: 5,\n },\n lineLocation: {\n flexDirection: 'row',\n },\n name: {\n color: LogBoxStyle.getTextColor(1),\n fontSize: 14,\n includeFontPadding: false,\n lineHeight: 18,\n fontWeight: '400',\n fontFamily: CODE_FONT,\n },\n location: {\n color: LogBoxStyle.getTextColor(0.8),\n fontSize: 12,\n fontWeight: '300',\n includeFontPadding: false,\n lineHeight: 16,\n paddingLeft: 10,\n },\n dim: {\n color: LogBoxStyle.getTextColor(0.4),\n fontWeight: '300',\n },\n line: {\n color: LogBoxStyle.getTextColor(0.8),\n fontSize: 12,\n fontWeight: '300',\n includeFontPadding: false,\n lineHeight: 16,\n },\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogBoxInspectorStackFrames.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/overlay/LogBoxInspectorStackFrames.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LogBoxInspectorStackFrames.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/overlay/LogBoxInspectorStackFrames.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAMzD,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,GAAG,MAAM,CA2BjF;AAED,wBAAgB,0BAA0B,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,KAAK,sBA4ClE"}
|
|
@@ -1,3 +1,32 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.LogBoxInspectorStackFrames = exports.getCollapseMessage = void 0;
|
|
1
30
|
/**
|
|
2
31
|
* Copyright (c) 650 Industries.
|
|
3
32
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -5,16 +34,16 @@
|
|
|
5
34
|
* This source code is licensed under the MIT license found in the
|
|
6
35
|
* LICENSE file in the root directory of this source tree.
|
|
7
36
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
37
|
+
const react_1 = __importStar(require("react"));
|
|
38
|
+
const react_native_1 = require("react-native");
|
|
39
|
+
const LogBoxInspectorSection_1 = require("./LogBoxInspectorSection");
|
|
40
|
+
const LogBoxInspectorSourceMapStatus_1 = require("./LogBoxInspectorSourceMapStatus");
|
|
41
|
+
const LogBoxInspectorStackFrame_1 = require("./LogBoxInspectorStackFrame");
|
|
42
|
+
const LogContext_1 = require("../Data/LogContext");
|
|
43
|
+
const LogBoxButton_1 = require("../UI/LogBoxButton");
|
|
44
|
+
const LogBoxStyle = __importStar(require("../UI/LogBoxStyle"));
|
|
45
|
+
const openFileInEditor_1 = __importDefault(require("../modules/openFileInEditor"));
|
|
46
|
+
function getCollapseMessage(stackFrames, collapsed) {
|
|
18
47
|
if (stackFrames.length === 0) {
|
|
19
48
|
return 'No frames to show';
|
|
20
49
|
}
|
|
@@ -39,9 +68,10 @@ export function getCollapseMessage(stackFrames, collapsed) {
|
|
|
39
68
|
: `Collapse ${collapsedCount} ${framePlural}`;
|
|
40
69
|
}
|
|
41
70
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const
|
|
71
|
+
exports.getCollapseMessage = getCollapseMessage;
|
|
72
|
+
function LogBoxInspectorStackFrames({ onRetry, type }) {
|
|
73
|
+
const log = (0, LogContext_1.useSelectedLog)();
|
|
74
|
+
const [collapsed, setCollapsed] = (0, react_1.useState)(() => {
|
|
45
75
|
// Only collapse frames initially if some frames are not collapsed.
|
|
46
76
|
return log.getAvailableStack(type)?.some(({ collapse }) => !collapse);
|
|
47
77
|
});
|
|
@@ -56,29 +86,30 @@ export function LogBoxInspectorStackFrames({ onRetry, type }) {
|
|
|
56
86
|
if (log.getAvailableStack(type)?.length === 0) {
|
|
57
87
|
return null;
|
|
58
88
|
}
|
|
59
|
-
return (
|
|
60
|
-
log.symbolicated[type].status !== 'COMPLETE' && (
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
89
|
+
return (react_1.default.createElement(LogBoxInspectorSection_1.LogBoxInspectorSection, { heading: type === 'component' ? 'Component Stack' : 'Call Stack', action: react_1.default.createElement(LogBoxInspectorSourceMapStatus_1.LogBoxInspectorSourceMapStatus, { onPress: log.symbolicated[type].status === 'FAILED' ? onRetry : null, status: log.symbolicated[type].status }) },
|
|
90
|
+
log.symbolicated[type].status !== 'COMPLETE' && (react_1.default.createElement(react_native_1.View, { style: stackStyles.hintBox },
|
|
91
|
+
react_1.default.createElement(react_native_1.Text, { style: stackStyles.hintText }, "This call stack is not symbolicated. Some features are unavailable such as viewing the function name or tapping to open files."))),
|
|
92
|
+
react_1.default.createElement(StackFrameList, { list: getStackList(), status: log.symbolicated[type].status }),
|
|
93
|
+
react_1.default.createElement(StackFrameFooter, { onPress: () => setCollapsed(!collapsed), message: getCollapseMessage(log.getAvailableStack(type), !!collapsed) })));
|
|
64
94
|
}
|
|
95
|
+
exports.LogBoxInspectorStackFrames = LogBoxInspectorStackFrames;
|
|
65
96
|
function StackFrameList({ list, status, }) {
|
|
66
97
|
return list.map((frame, index) => {
|
|
67
98
|
const { file, lineNumber } = frame;
|
|
68
|
-
return (
|
|
69
|
-
? () =>
|
|
99
|
+
return (react_1.default.createElement(LogBoxInspectorStackFrame_1.LogBoxInspectorStackFrame, { key: index, frame: frame, onPress: status === 'COMPLETE' && file != null && lineNumber != null
|
|
100
|
+
? () => (0, openFileInEditor_1.default)(file, lineNumber)
|
|
70
101
|
: undefined }));
|
|
71
102
|
});
|
|
72
103
|
}
|
|
73
104
|
function StackFrameFooter({ message, onPress }) {
|
|
74
|
-
return (
|
|
75
|
-
|
|
105
|
+
return (react_1.default.createElement(react_native_1.View, { style: stackStyles.collapseContainer },
|
|
106
|
+
react_1.default.createElement(LogBoxButton_1.LogBoxButton, { backgroundColor: {
|
|
76
107
|
default: 'transparent',
|
|
77
108
|
pressed: LogBoxStyle.getBackgroundColor(1),
|
|
78
109
|
}, onPress: onPress, style: stackStyles.collapseButton },
|
|
79
|
-
|
|
110
|
+
react_1.default.createElement(react_native_1.Text, { style: stackStyles.collapse }, message))));
|
|
80
111
|
}
|
|
81
|
-
const stackStyles = StyleSheet.create({
|
|
112
|
+
const stackStyles = react_native_1.StyleSheet.create({
|
|
82
113
|
section: {
|
|
83
114
|
marginTop: 15,
|
|
84
115
|
},
|
|
@@ -1 +1 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QAAQ,EAAE,EAAE;QACZ,kBAAkB,EAAE,KAAK;QACzB,UAAU,EAAE,EAAE;QACd,UAAU,EAAE,KAAK;QACjB,gBAAgB,EAAE,EAAE;KACrB;IACD,OAAO,EAAE;QACP,eAAe,EAAE,WAAW,CAAC,kBAAkB,EAAE;QACjD,gBAAgB,EAAE,EAAE;QACpB,iBAAiB,EAAE,CAAC;QACpB,eAAe,EAAE,EAAE;QACnB,YAAY,EAAE,CAAC;QACf,YAAY,EAAE,CAAC;KAChB;IACD,iBAAiB,EAAE;QACjB,UAAU,EAAE,EAAE;QACd,aAAa,EAAE,KAAK;KACrB;IACD,cAAc,EAAE;QACd,YAAY,EAAE,CAAC;KAChB;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC;QACpC,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;QACjB,UAAU,EAAE,EAAE;QACd,SAAS,EAAE,CAAC;QACZ,iBAAiB,EAAE,EAAE;QACrB,eAAe,EAAE,CAAC;KACnB;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 React, { useState } from 'react';\nimport { StyleSheet, Text, View } from 'react-native';\n\nimport type { StackType } from '../Data/LogBoxLog';\nimport type { Stack } from '../Data/LogBoxSymbolication';\nimport { useSelectedLog } from '../Data/LogContext';\nimport { LogBoxButton } from '../UI/LogBoxButton';\nimport * as LogBoxStyle from '../UI/LogBoxStyle';\nimport openFileInEditor from '../modules/openFileInEditor';\nimport { LogBoxInspectorSection } from './LogBoxInspectorSection';\nimport { LogBoxInspectorSourceMapStatus } from './LogBoxInspectorSourceMapStatus';\nimport { LogBoxInspectorStackFrame } from './LogBoxInspectorStackFrame';\n\ntype Props = {\n type: StackType;\n onRetry: () => void;\n};\n\nexport function getCollapseMessage(stackFrames: Stack, collapsed: boolean): string {\n if (stackFrames.length === 0) {\n return 'No frames to show';\n }\n\n const collapsedCount = stackFrames.reduce((count, { collapse }) => {\n if (collapse === true) {\n return count + 1;\n }\n\n return count;\n }, 0);\n\n if (collapsedCount === 0) {\n return 'Showing all frames';\n }\n\n const framePlural = `frame${collapsedCount > 1 ? 's' : ''}`;\n if (collapsedCount === stackFrames.length) {\n return collapsed\n ? `See${collapsedCount > 1 ? ' all ' : ' '}${collapsedCount} collapsed ${framePlural}`\n : `Collapse${collapsedCount > 1 ? ' all ' : ' '}${collapsedCount} ${framePlural}`;\n } else {\n return collapsed\n ? `See ${collapsedCount} more ${framePlural}`\n : `Collapse ${collapsedCount} ${framePlural}`;\n }\n}\n\nexport function LogBoxInspectorStackFrames({ onRetry, type }: Props) {\n const log = useSelectedLog();\n\n const [collapsed, setCollapsed] = useState(() => {\n // Only collapse frames initially if some frames are not collapsed.\n return log.getAvailableStack(type)?.some(({ collapse }) => !collapse);\n });\n\n function getStackList() {\n if (collapsed === true) {\n return log.getAvailableStack(type)?.filter(({ collapse }) => !collapse);\n } else {\n return log.getAvailableStack(type);\n }\n }\n\n if (log.getAvailableStack(type)?.length === 0) {\n return null;\n }\n\n return (\n <LogBoxInspectorSection\n heading={type === 'component' ? 'Component Stack' : 'Call Stack'}\n action={\n <LogBoxInspectorSourceMapStatus\n onPress={log.symbolicated[type].status === 'FAILED' ? onRetry : null}\n status={log.symbolicated[type].status}\n />\n }>\n {log.symbolicated[type].status !== 'COMPLETE' && (\n <View style={stackStyles.hintBox}>\n <Text style={stackStyles.hintText}>\n This call stack is not symbolicated. Some features are unavailable such as viewing the\n function name or tapping to open files.\n </Text>\n </View>\n )}\n <StackFrameList list={getStackList()!} status={log.symbolicated[type].status} />\n <StackFrameFooter\n onPress={() => setCollapsed(!collapsed)}\n message={getCollapseMessage(log.getAvailableStack(type)!, !!collapsed)}\n />\n </LogBoxInspectorSection>\n );\n}\n\nfunction StackFrameList({\n list,\n status,\n}: {\n list: Stack;\n status: 'NONE' | 'PENDING' | 'COMPLETE' | 'FAILED';\n}): any {\n return list.map((frame, index) => {\n const { file, lineNumber } = frame;\n return (\n <LogBoxInspectorStackFrame\n key={index}\n frame={frame}\n onPress={\n status === 'COMPLETE' && file != null && lineNumber != null\n ? () => openFileInEditor(file, lineNumber)\n : undefined\n }\n />\n );\n });\n}\n\nfunction StackFrameFooter({ message, onPress }: { message: string; onPress: () => void }) {\n return (\n <View style={stackStyles.collapseContainer}>\n <LogBoxButton\n backgroundColor={{\n default: 'transparent',\n pressed: LogBoxStyle.getBackgroundColor(1),\n }}\n onPress={onPress}\n style={stackStyles.collapseButton}>\n <Text style={stackStyles.collapse}>{message}</Text>\n </LogBoxButton>\n </View>\n );\n}\n\nconst stackStyles = StyleSheet.create({\n section: {\n marginTop: 15,\n },\n heading: {\n alignItems: 'center',\n flexDirection: 'row',\n paddingHorizontal: 12,\n marginBottom: 10,\n },\n headingText: {\n color: LogBoxStyle.getTextColor(1),\n flex: 1,\n fontSize: 20,\n fontWeight: '600',\n includeFontPadding: false,\n lineHeight: 20,\n },\n body: {\n paddingBottom: 10,\n },\n bodyText: {\n color: LogBoxStyle.getTextColor(1),\n fontSize: 14,\n includeFontPadding: false,\n lineHeight: 18,\n fontWeight: '500',\n paddingHorizontal: 27,\n },\n hintText: {\n color: LogBoxStyle.getTextColor(0.7),\n fontSize: 13,\n includeFontPadding: false,\n lineHeight: 18,\n fontWeight: '400',\n marginHorizontal: 10,\n },\n hintBox: {\n backgroundColor: LogBoxStyle.getBackgroundColor(),\n marginHorizontal: 10,\n paddingHorizontal: 5,\n paddingVertical: 10,\n borderRadius: 5,\n marginBottom: 5,\n },\n collapseContainer: {\n marginLeft: 15,\n flexDirection: 'row',\n },\n collapseButton: {\n borderRadius: 5,\n },\n collapse: {\n color: LogBoxStyle.getTextColor(0.7),\n fontSize: 12,\n fontWeight: '300',\n lineHeight: 20,\n marginTop: 0,\n paddingHorizontal: 10,\n paddingVertical: 5,\n },\n});\n"]}
|
|
1
|
+
{"version":3,"file":"LogBoxInspectorStackFrames.js","sourceRoot":"","sources":["../../../src/error-overlay/overlay/LogBoxInspectorStackFrames.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;GAMG;AACH,+CAAwC;AACxC,+CAAsD;AAEtD,qEAAkE;AAClE,qFAAkF;AAClF,2EAAwE;AAGxE,mDAAoD;AACpD,qDAAkD;AAClD,+DAAiD;AACjD,mFAA2D;AAO3D,SAAgB,kBAAkB,CAAC,WAAkB,EAAE,SAAkB;IACvE,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;QAC5B,OAAO,mBAAmB,CAAC;KAC5B;IAED,MAAM,cAAc,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;QAChE,IAAI,QAAQ,KAAK,IAAI,EAAE;YACrB,OAAO,KAAK,GAAG,CAAC,CAAC;SAClB;QAED,OAAO,KAAK,CAAC;IACf,CAAC,EAAE,CAAC,CAAC,CAAC;IAEN,IAAI,cAAc,KAAK,CAAC,EAAE;QACxB,OAAO,oBAAoB,CAAC;KAC7B;IAED,MAAM,WAAW,GAAG,QAAQ,cAAc,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IAC5D,IAAI,cAAc,KAAK,WAAW,CAAC,MAAM,EAAE;QACzC,OAAO,SAAS;YACd,CAAC,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,GAAG,cAAc,cAAc,WAAW,EAAE;YACtF,CAAC,CAAC,WAAW,cAAc,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,GAAG,cAAc,IAAI,WAAW,EAAE,CAAC;KACrF;SAAM;QACL,OAAO,SAAS;YACd,CAAC,CAAC,OAAO,cAAc,SAAS,WAAW,E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nB,YAAY,EAAE,CAAC;QACf,YAAY,EAAE,CAAC;KAChB;IACD,iBAAiB,EAAE;QACjB,UAAU,EAAE,EAAE;QACd,aAAa,EAAE,KAAK;KACrB;IACD,cAAc,EAAE;QACd,YAAY,EAAE,CAAC;KAChB;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC;QACpC,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;QACjB,UAAU,EAAE,EAAE;QACd,SAAS,EAAE,CAAC;QACZ,iBAAiB,EAAE,EAAE;QACrB,eAAe,EAAE,CAAC;KACnB;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 React, { useState } from 'react';\nimport { StyleSheet, Text, View } from 'react-native';\n\nimport { LogBoxInspectorSection } from './LogBoxInspectorSection';\nimport { LogBoxInspectorSourceMapStatus } from './LogBoxInspectorSourceMapStatus';\nimport { LogBoxInspectorStackFrame } from './LogBoxInspectorStackFrame';\nimport type { StackType } from '../Data/LogBoxLog';\nimport type { Stack } from '../Data/LogBoxSymbolication';\nimport { useSelectedLog } from '../Data/LogContext';\nimport { LogBoxButton } from '../UI/LogBoxButton';\nimport * as LogBoxStyle from '../UI/LogBoxStyle';\nimport openFileInEditor from '../modules/openFileInEditor';\n\ntype Props = {\n type: StackType;\n onRetry: () => void;\n};\n\nexport function getCollapseMessage(stackFrames: Stack, collapsed: boolean): string {\n if (stackFrames.length === 0) {\n return 'No frames to show';\n }\n\n const collapsedCount = stackFrames.reduce((count, { collapse }) => {\n if (collapse === true) {\n return count + 1;\n }\n\n return count;\n }, 0);\n\n if (collapsedCount === 0) {\n return 'Showing all frames';\n }\n\n const framePlural = `frame${collapsedCount > 1 ? 's' : ''}`;\n if (collapsedCount === stackFrames.length) {\n return collapsed\n ? `See${collapsedCount > 1 ? ' all ' : ' '}${collapsedCount} collapsed ${framePlural}`\n : `Collapse${collapsedCount > 1 ? ' all ' : ' '}${collapsedCount} ${framePlural}`;\n } else {\n return collapsed\n ? `See ${collapsedCount} more ${framePlural}`\n : `Collapse ${collapsedCount} ${framePlural}`;\n }\n}\n\nexport function LogBoxInspectorStackFrames({ onRetry, type }: Props) {\n const log = useSelectedLog();\n\n const [collapsed, setCollapsed] = useState(() => {\n // Only collapse frames initially if some frames are not collapsed.\n return log.getAvailableStack(type)?.some(({ collapse }) => !collapse);\n });\n\n function getStackList() {\n if (collapsed === true) {\n return log.getAvailableStack(type)?.filter(({ collapse }) => !collapse);\n } else {\n return log.getAvailableStack(type);\n }\n }\n\n if (log.getAvailableStack(type)?.length === 0) {\n return null;\n }\n\n return (\n <LogBoxInspectorSection\n heading={type === 'component' ? 'Component Stack' : 'Call Stack'}\n action={\n <LogBoxInspectorSourceMapStatus\n onPress={log.symbolicated[type].status === 'FAILED' ? onRetry : null}\n status={log.symbolicated[type].status}\n />\n }>\n {log.symbolicated[type].status !== 'COMPLETE' && (\n <View style={stackStyles.hintBox}>\n <Text style={stackStyles.hintText}>\n This call stack is not symbolicated. Some features are unavailable such as viewing the\n function name or tapping to open files.\n </Text>\n </View>\n )}\n <StackFrameList list={getStackList()!} status={log.symbolicated[type].status} />\n <StackFrameFooter\n onPress={() => setCollapsed(!collapsed)}\n message={getCollapseMessage(log.getAvailableStack(type)!, !!collapsed)}\n />\n </LogBoxInspectorSection>\n );\n}\n\nfunction StackFrameList({\n list,\n status,\n}: {\n list: Stack;\n status: 'NONE' | 'PENDING' | 'COMPLETE' | 'FAILED';\n}): any {\n return list.map((frame, index) => {\n const { file, lineNumber } = frame;\n return (\n <LogBoxInspectorStackFrame\n key={index}\n frame={frame}\n onPress={\n status === 'COMPLETE' && file != null && lineNumber != null\n ? () => openFileInEditor(file, lineNumber)\n : undefined\n }\n />\n );\n });\n}\n\nfunction StackFrameFooter({ message, onPress }: { message: string; onPress: () => void }) {\n return (\n <View style={stackStyles.collapseContainer}>\n <LogBoxButton\n backgroundColor={{\n default: 'transparent',\n pressed: LogBoxStyle.getBackgroundColor(1),\n }}\n onPress={onPress}\n style={stackStyles.collapseButton}>\n <Text style={stackStyles.collapse}>{message}</Text>\n </LogBoxButton>\n </View>\n );\n}\n\nconst stackStyles = StyleSheet.create({\n section: {\n marginTop: 15,\n },\n heading: {\n alignItems: 'center',\n flexDirection: 'row',\n paddingHorizontal: 12,\n marginBottom: 10,\n },\n headingText: {\n color: LogBoxStyle.getTextColor(1),\n flex: 1,\n fontSize: 20,\n fontWeight: '600',\n includeFontPadding: false,\n lineHeight: 20,\n },\n body: {\n paddingBottom: 10,\n },\n bodyText: {\n color: LogBoxStyle.getTextColor(1),\n fontSize: 14,\n includeFontPadding: false,\n lineHeight: 18,\n fontWeight: '500',\n paddingHorizontal: 27,\n },\n hintText: {\n color: LogBoxStyle.getTextColor(0.7),\n fontSize: 13,\n includeFontPadding: false,\n lineHeight: 18,\n fontWeight: '400',\n marginHorizontal: 10,\n },\n hintBox: {\n backgroundColor: LogBoxStyle.getBackgroundColor(),\n marginHorizontal: 10,\n paddingHorizontal: 5,\n paddingVertical: 10,\n borderRadius: 5,\n marginBottom: 5,\n },\n collapseContainer: {\n marginLeft: 15,\n flexDirection: 'row',\n },\n collapseButton: {\n borderRadius: 5,\n },\n collapse: {\n color: LogBoxStyle.getTextColor(0.7),\n fontSize: 12,\n fontWeight: '300',\n lineHeight: 20,\n marginTop: 0,\n paddingHorizontal: 10,\n paddingVertical: 5,\n },\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorToast.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/toast/ErrorToast.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ErrorToast.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/toast/ErrorToast.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAG9C,KAAK,KAAK,GAAG;IACX,GAAG,EAAE,SAAS,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IACxB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,cAAc,EAAE,MAAM,IAAI,CAAC;CAC5B,CAAC;AAUF,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,eAkCtC"}
|
|
@@ -1,3 +1,29 @@
|
|
|
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.ErrorToast = void 0;
|
|
1
27
|
/**
|
|
2
28
|
* Copyright (c) 650 Industries.
|
|
3
29
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -5,25 +31,25 @@
|
|
|
5
31
|
* This source code is licensed under the MIT license found in the
|
|
6
32
|
* LICENSE file in the root directory of this source tree.
|
|
7
33
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
34
|
+
const react_1 = __importStar(require("react"));
|
|
35
|
+
const react_native_1 = require("react-native");
|
|
36
|
+
const ErrorToastMessage_1 = require("./ErrorToastMessage");
|
|
37
|
+
const LogBoxData = __importStar(require("../Data/LogBoxData"));
|
|
38
|
+
const LogBoxStyle = __importStar(require("../UI/LogBoxStyle"));
|
|
13
39
|
function useSymbolicatedLog(log) {
|
|
14
40
|
// Eagerly symbolicate so the stack is available when pressing to inspect.
|
|
15
|
-
useEffect(() => {
|
|
41
|
+
(0, react_1.useEffect)(() => {
|
|
16
42
|
LogBoxData.symbolicateLogLazy('stack', log);
|
|
17
43
|
LogBoxData.symbolicateLogLazy('component', log);
|
|
18
44
|
}, [log]);
|
|
19
45
|
}
|
|
20
|
-
|
|
46
|
+
function ErrorToast(props) {
|
|
21
47
|
const { totalLogCount, level, log } = props;
|
|
22
48
|
useSymbolicatedLog(log);
|
|
23
|
-
return (
|
|
24
|
-
|
|
49
|
+
return (react_1.default.createElement(react_native_1.View, { style: toastStyles.container },
|
|
50
|
+
react_1.default.createElement(react_native_1.Pressable, { style: { flex: 1 }, onPress: props.onPressOpen }, ({
|
|
25
51
|
/** @ts-expect-error: react-native types are broken. */
|
|
26
|
-
hovered, pressed, }) => (
|
|
52
|
+
hovered, pressed, }) => (react_1.default.createElement(react_native_1.View, { style: [
|
|
27
53
|
toastStyles.press,
|
|
28
54
|
{
|
|
29
55
|
// @ts-expect-error: web-only type
|
|
@@ -35,16 +61,17 @@ export function ErrorToast(props) {
|
|
|
35
61
|
: LogBoxStyle.getBackgroundColor(),
|
|
36
62
|
},
|
|
37
63
|
] },
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
64
|
+
react_1.default.createElement(Count, { count: totalLogCount, level: level }),
|
|
65
|
+
react_1.default.createElement(ErrorToastMessage_1.ErrorToastMessage, { message: log.message }),
|
|
66
|
+
react_1.default.createElement(Dismiss, { onPress: props.onPressDismiss }))))));
|
|
41
67
|
}
|
|
68
|
+
exports.ErrorToast = ErrorToast;
|
|
42
69
|
function Count({ count, level }) {
|
|
43
|
-
return (
|
|
44
|
-
|
|
70
|
+
return (react_1.default.createElement(react_native_1.View, { style: [countStyles.inside, countStyles[level]] },
|
|
71
|
+
react_1.default.createElement(react_native_1.Text, { style: countStyles.text }, count <= 1 ? '!' : count)));
|
|
45
72
|
}
|
|
46
73
|
function Dismiss({ onPress }) {
|
|
47
|
-
return (
|
|
74
|
+
return (react_1.default.createElement(react_native_1.Pressable, { style: {
|
|
48
75
|
marginLeft: 5,
|
|
49
76
|
}, hitSlop: {
|
|
50
77
|
top: 12,
|
|
@@ -53,10 +80,10 @@ function Dismiss({ onPress }) {
|
|
|
53
80
|
left: 10,
|
|
54
81
|
}, onPress: onPress }, ({
|
|
55
82
|
/** @ts-expect-error: react-native types are broken. */
|
|
56
|
-
hovered, pressed, }) => (
|
|
57
|
-
|
|
83
|
+
hovered, pressed, }) => (react_1.default.createElement(react_native_1.View, { style: [dismissStyles.press, hovered && { opacity: 0.8 }, pressed && { opacity: 0.5 }] },
|
|
84
|
+
react_1.default.createElement(react_native_1.Image, { source: require('@expo/metro-runtime/assets/close.png'), style: dismissStyles.image })))));
|
|
58
85
|
}
|
|
59
|
-
const countStyles = StyleSheet.create({
|
|
86
|
+
const countStyles = react_native_1.StyleSheet.create({
|
|
60
87
|
warn: {
|
|
61
88
|
backgroundColor: LogBoxStyle.getWarningColor(1),
|
|
62
89
|
},
|
|
@@ -84,7 +111,7 @@ const countStyles = StyleSheet.create({
|
|
|
84
111
|
textShadow: `0px 0px 3px ${LogBoxStyle.getBackgroundColor(0.8)}`,
|
|
85
112
|
},
|
|
86
113
|
});
|
|
87
|
-
const dismissStyles = StyleSheet.create({
|
|
114
|
+
const dismissStyles = react_native_1.StyleSheet.create({
|
|
88
115
|
press: {
|
|
89
116
|
backgroundColor: '#323232',
|
|
90
117
|
height: 20,
|
|
@@ -98,7 +125,7 @@ const dismissStyles = StyleSheet.create({
|
|
|
98
125
|
width: 8,
|
|
99
126
|
},
|
|
100
127
|
});
|
|
101
|
-
const toastStyles = StyleSheet.create({
|
|
128
|
+
const toastStyles = react_native_1.StyleSheet.create({
|
|
102
129
|
container: {
|
|
103
130
|
height: 48,
|
|
104
131
|
justifyContent: 'center',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorToast.js","sourceRoot":"","sources":["../../../src/error-overlay/toast/ErrorToast.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH
|
|
1
|
+
{"version":3,"file":"ErrorToast.js","sourceRoot":"","sources":["../../../src/error-overlay/toast/ErrorToast.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;GAMG;AACH,+CAAyC;AACzC,+CAAwE;AAExE,2DAAwD;AACxD,+DAAiD;AAEjD,+DAAiD;AAUjD,SAAS,kBAAkB,CAAC,GAAc;IACxC,0EAA0E;IAC1E,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,UAAU,CAAC,kBAAkB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAC5C,UAAU,CAAC,kBAAkB,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;IAClD,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;AACZ,CAAC;AAED,SAAgB,UAAU,CAAC,KAAY;IACrC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC;IAE5C,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAExB,OAAO,CACL,8BAAC,mBAAI,IAAC,KAAK,EAAE,WAAW,CAAC,SAAS;QAChC,8BAAC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EAAE,SAAS;QAC1B,MAAM,EAAE,EAAE;QACV,KAAK,EAAE,EAAE;QACT,YAAY,EAAE,EAAE;QAChB,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;KACzB;IACD,KAAK,EAAE;QACL,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,CAAC;KACT;CACF,CAAC,CAAC;AAEH,MAAM,WAAW,GAAG,yBAAU,CAAC,MAAM,CAAC;IACpC,SAAS,EAAE;QACT,MAAM,EAAE,EAAE;QACV,cAAc,EAAE,QAAQ;QACxB,YAAY,EAAE,CAAC;KAChB;IACD,KAAK,EAAE;QACL,WAAW,EAAE,CAAC;QACd,YAAY,EAAE,CAAC;QACf,QAAQ,EAAE,QAAQ;QAClB,aAAa,EAAE,KAAK;QACpB,UAAU,EAAE,QAAQ;QACpB,WAAW,EAAE,SAAS;QACtB,eAAe,EAAE,WAAW,CAAC,kBAAkB,EAAE;QACjD,IAAI,EAAE,CAAC;QACP,iBAAiB,EAAE,EAAE;KACtB;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 React, { useEffect } from 'react';\nimport { Image, Pressable, StyleSheet, Text, View } from 'react-native';\n\nimport { ErrorToastMessage } from './ErrorToastMessage';\nimport * as LogBoxData from '../Data/LogBoxData';\nimport { LogBoxLog } from '../Data/LogBoxLog';\nimport * as LogBoxStyle from '../UI/LogBoxStyle';\n\ntype Props = {\n log: LogBoxLog;\n totalLogCount: number;\n level: 'warn' | 'error';\n onPressOpen: () => void;\n onPressDismiss: () => void;\n};\n\nfunction useSymbolicatedLog(log: LogBoxLog) {\n // Eagerly symbolicate so the stack is available when pressing to inspect.\n useEffect(() => {\n LogBoxData.symbolicateLogLazy('stack', log);\n LogBoxData.symbolicateLogLazy('component', log);\n }, [log]);\n}\n\nexport function ErrorToast(props: Props) {\n const { totalLogCount, level, log } = props;\n\n useSymbolicatedLog(log);\n\n return (\n <View style={toastStyles.container}>\n <Pressable style={{ flex: 1 }} onPress={props.onPressOpen}>\n {({\n /** @ts-expect-error: react-native types are broken. */\n hovered,\n pressed,\n }) => (\n <View\n style={[\n toastStyles.press,\n {\n // @ts-expect-error: web-only type\n transitionDuration: '150ms',\n backgroundColor: pressed\n ? '#323232'\n : hovered\n ? '#111111'\n : LogBoxStyle.getBackgroundColor(),\n },\n ]}>\n <Count count={totalLogCount} level={level} />\n <ErrorToastMessage message={log.message} />\n <Dismiss onPress={props.onPressDismiss} />\n </View>\n )}\n </Pressable>\n </View>\n );\n}\n\nfunction Count({ count, level }: { count: number; level: Props['level'] }) {\n return (\n <View style={[countStyles.inside, countStyles[level]]}>\n <Text style={countStyles.text}>{count <= 1 ? '!' : count}</Text>\n </View>\n );\n}\n\nfunction Dismiss({ onPress }: { onPress: () => void }) {\n return (\n <Pressable\n style={{\n marginLeft: 5,\n }}\n hitSlop={{\n top: 12,\n right: 10,\n bottom: 12,\n left: 10,\n }}\n onPress={onPress}>\n {({\n /** @ts-expect-error: react-native types are broken. */\n hovered,\n pressed,\n }) => (\n <View\n style={[dismissStyles.press, hovered && { opacity: 0.8 }, pressed && { opacity: 0.5 }]}>\n <Image\n source={require('@expo/metro-runtime/assets/close.png')}\n style={dismissStyles.image}\n />\n </View>\n )}\n </Pressable>\n );\n}\n\nconst countStyles = StyleSheet.create({\n warn: {\n backgroundColor: LogBoxStyle.getWarningColor(1),\n },\n error: {\n backgroundColor: LogBoxStyle.getErrorColor(1),\n },\n log: {\n backgroundColor: LogBoxStyle.getLogColor(1),\n },\n inside: {\n marginRight: 8,\n minWidth: 22,\n aspectRatio: 1,\n paddingHorizontal: 4,\n borderRadius: 11,\n justifyContent: 'center',\n alignItems: 'center',\n },\n text: {\n color: LogBoxStyle.getTextColor(1),\n fontSize: 14,\n lineHeight: 18,\n textAlign: 'center',\n fontWeight: '600',\n textShadow: `0px 0px 3px ${LogBoxStyle.getBackgroundColor(0.8)}`,\n },\n});\n\nconst dismissStyles = StyleSheet.create({\n press: {\n backgroundColor: '#323232',\n height: 20,\n width: 20,\n borderRadius: 25,\n alignItems: 'center',\n justifyContent: 'center',\n },\n image: {\n height: 8,\n width: 8,\n },\n});\n\nconst toastStyles = StyleSheet.create({\n container: {\n height: 48,\n justifyContent: 'center',\n marginBottom: 4,\n },\n press: {\n borderWidth: 1,\n borderRadius: 8,\n overflow: 'hidden',\n flexDirection: 'row',\n alignItems: 'center',\n borderColor: '#323232',\n backgroundColor: LogBoxStyle.getBackgroundColor(),\n flex: 1,\n paddingHorizontal: 12,\n },\n});\n"]}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return
|
|
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
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
function ErrorToastContainer({ children, }) {
|
|
8
|
+
return react_1.default.createElement(react_1.default.Fragment, null, children);
|
|
4
9
|
}
|
|
10
|
+
exports.default = ErrorToastContainer;
|
|
5
11
|
//# sourceMappingURL=ErrorToastContainer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorToastContainer.js","sourceRoot":"","sources":["../../../src/error-overlay/toast/ErrorToastContainer.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"ErrorToastContainer.js","sourceRoot":"","sources":["../../../src/error-overlay/toast/ErrorToastContainer.tsx"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAE1B,SAAwB,mBAAmB,CAAC,EAC1C,QAAQ,GAGT;IACC,OAAO,8DAAG,QAAQ,CAAI,CAAC;AACzB,CAAC;AAND,sCAMC","sourcesContent":["import React from 'react';\n\nexport default function ErrorToastContainer({\n children,\n}: {\n children: React.ReactNode;\n}): React.ReactElement {\n return <>{children}</>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorToastContainer.web.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/toast/ErrorToastContainer.web.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAA+B,MAAM,OAAO,CAAC;AASpD,wBAAgB,mBAAmB,uBAOlC;;
|
|
1
|
+
{"version":3,"file":"ErrorToastContainer.web.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/toast/ErrorToastContainer.web.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAA+B,MAAM,OAAO,CAAC;AASpD,wBAAgB,mBAAmB,uBAOlC;;AAoED,wBAAgE"}
|
|
@@ -1,3 +1,29 @@
|
|
|
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.ErrorToastContainer = void 0;
|
|
1
27
|
/**
|
|
2
28
|
* Copyright (c) 650 Industries.
|
|
3
29
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -5,28 +31,29 @@
|
|
|
5
31
|
* This source code is licensed under the MIT license found in the
|
|
6
32
|
* LICENSE file in the root directory of this source tree.
|
|
7
33
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
useRejectionHandler();
|
|
16
|
-
const { logs, isDisabled } = useLogs();
|
|
34
|
+
const react_1 = __importStar(require("react"));
|
|
35
|
+
const react_native_1 = require("react-native");
|
|
36
|
+
const ErrorToast_1 = require("./ErrorToast");
|
|
37
|
+
const LogBoxData = __importStar(require("../Data/LogBoxData"));
|
|
38
|
+
const LogContext_1 = require("../Data/LogContext");
|
|
39
|
+
const useRejectionHandler_1 = require("../useRejectionHandler");
|
|
40
|
+
function ErrorToastContainer() {
|
|
41
|
+
(0, useRejectionHandler_1.useRejectionHandler)();
|
|
42
|
+
const { logs, isDisabled } = (0, LogContext_1.useLogs)();
|
|
17
43
|
if (!logs.length || isDisabled) {
|
|
18
44
|
return null;
|
|
19
45
|
}
|
|
20
|
-
return
|
|
46
|
+
return react_1.default.createElement(ErrorToastStack, { logs: logs });
|
|
21
47
|
}
|
|
48
|
+
exports.ErrorToastContainer = ErrorToastContainer;
|
|
22
49
|
function ErrorToastStack({ logs }) {
|
|
23
|
-
const onDismissWarns = useCallback(() => {
|
|
50
|
+
const onDismissWarns = (0, react_1.useCallback)(() => {
|
|
24
51
|
LogBoxData.clearWarnings();
|
|
25
52
|
}, []);
|
|
26
|
-
const onDismissErrors = useCallback(() => {
|
|
53
|
+
const onDismissErrors = (0, react_1.useCallback)(() => {
|
|
27
54
|
LogBoxData.clearErrors();
|
|
28
55
|
}, []);
|
|
29
|
-
const setSelectedLog = useCallback((index) => {
|
|
56
|
+
const setSelectedLog = (0, react_1.useCallback)((index) => {
|
|
30
57
|
LogBoxData.setSelectedLog(index);
|
|
31
58
|
}, []);
|
|
32
59
|
function openLog(log) {
|
|
@@ -37,20 +64,21 @@ function ErrorToastStack({ logs }) {
|
|
|
37
64
|
}
|
|
38
65
|
setSelectedLog(index);
|
|
39
66
|
}
|
|
40
|
-
const warnings = useMemo(() => logs.filter((log) => log.level === 'warn'), [logs]);
|
|
41
|
-
const errors = useMemo(() => logs.filter((log) => log.level === 'error' || log.level === 'fatal'), [logs]);
|
|
42
|
-
return (
|
|
43
|
-
warnings.length > 0 && (
|
|
44
|
-
errors.length > 0 && (
|
|
67
|
+
const warnings = (0, react_1.useMemo)(() => logs.filter((log) => log.level === 'warn'), [logs]);
|
|
68
|
+
const errors = (0, react_1.useMemo)(() => logs.filter((log) => log.level === 'error' || log.level === 'fatal'), [logs]);
|
|
69
|
+
return (react_1.default.createElement(react_native_1.View, { style: styles.list },
|
|
70
|
+
warnings.length > 0 && (react_1.default.createElement(ErrorToast_1.ErrorToast, { log: warnings[warnings.length - 1], level: "warn", totalLogCount: warnings.length, onPressOpen: () => openLog(warnings[warnings.length - 1]), onPressDismiss: onDismissWarns })),
|
|
71
|
+
errors.length > 0 && (react_1.default.createElement(ErrorToast_1.ErrorToast, { log: errors[errors.length - 1], level: "error", totalLogCount: errors.length, onPressOpen: () => openLog(errors[errors.length - 1]), onPressDismiss: onDismissErrors }))));
|
|
45
72
|
}
|
|
46
|
-
const styles = StyleSheet.create({
|
|
73
|
+
const styles = react_native_1.StyleSheet.create({
|
|
47
74
|
list: {
|
|
48
75
|
bottom: 6,
|
|
49
76
|
left: 10,
|
|
50
77
|
right: 10,
|
|
51
|
-
position: 'absolute',
|
|
52
78
|
maxWidth: 320,
|
|
79
|
+
// @ts-expect-error
|
|
80
|
+
position: 'fixed',
|
|
53
81
|
},
|
|
54
82
|
});
|
|
55
|
-
|
|
83
|
+
exports.default = LogBoxData.withSubscription(ErrorToastContainer);
|
|
56
84
|
//# sourceMappingURL=ErrorToastContainer.web.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorToastContainer.web.js","sourceRoot":"","sources":["../../../src/error-overlay/toast/ErrorToastContainer.web.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH
|
|
1
|
+
{"version":3,"file":"ErrorToastContainer.web.js","sourceRoot":"","sources":["../../../src/error-overlay/toast/ErrorToastContainer.web.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;GAMG;AACH,+CAAoD;AACpD,+CAAgD;AAEhD,6CAA0C;AAC1C,+DAAiD;AAEjD,mDAA6C;AAC7C,gEAA6D;AAE7D,SAAgB,mBAAmB;IACjC,IAAA,yCAAmB,GAAE,CAAC;IACtB,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,IAAA,oBAAO,GAAE,CAAC;IACvC,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,UAAU,EAAE;QAC9B,OAAO,IAAI,CAAC;KACb;IACD,OAAO,8BAAC,eAAe,IAAC,IAAI,EAAE,IAAI,GAAI,CAAC;AACzC,CAAC;AAPD,kDAOC;AAED,SAAS,eAAe,CAAC,EAAE,IAAI,EAAyB;IACtD,MAAM,cAAc,GAAG,IAAA,mBAAW,EAAC,GAAG,EAAE;QACtC,UAAU,CAAC,aAAa,EAAE,CAAC;IAC7B,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,eAAe,GAAG,IAAA,mBAAW,EAAC,GAAG,EAAE;QACvC,UAAU,CAAC,WAAW,EAAE,CAAC;IAC3B,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,cAAc,GAAG,IAAA,mBAAW,E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IAAI,CACpB,8BAAC,uBAAU,IACT,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,EAC9B,KAAK,EAAC,OAAO,EACb,aAAa,EAAE,MAAM,CAAC,MAAM,EAC5B,WAAW,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,EACrD,cAAc,EAAE,eAAe,GAC/B,CACH,CACI,CACR,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE;QACJ,MAAM,EAAE,CAAC;QACT,IAAI,EAAE,EAAE;QACR,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE,GAAG;QACb,mBAAmB;QACnB,QAAQ,EAAE,OAAO;KAClB;CACF,CAAC,CAAC;AAEH,kBAAe,UAAU,CAAC,gBAAgB,CAAC,mBAAmB,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 React, { useCallback, useMemo } from 'react';\nimport { StyleSheet, View } from 'react-native';\n\nimport { ErrorToast } from './ErrorToast';\nimport * as LogBoxData from '../Data/LogBoxData';\nimport { LogBoxLog } from '../Data/LogBoxLog';\nimport { useLogs } from '../Data/LogContext';\nimport { useRejectionHandler } from '../useRejectionHandler';\n\nexport function ErrorToastContainer() {\n useRejectionHandler();\n const { logs, isDisabled } = useLogs();\n if (!logs.length || isDisabled) {\n return null;\n }\n return <ErrorToastStack logs={logs} />;\n}\n\nfunction ErrorToastStack({ logs }: { logs: LogBoxLog[] }) {\n const onDismissWarns = useCallback(() => {\n LogBoxData.clearWarnings();\n }, []);\n\n const onDismissErrors = useCallback(() => {\n LogBoxData.clearErrors();\n }, []);\n\n const setSelectedLog = useCallback((index: number): void => {\n LogBoxData.setSelectedLog(index);\n }, []);\n\n function openLog(log: LogBoxLog) {\n let index = logs.length - 1;\n\n // Stop at zero because if we don't find any log, we'll open the first log.\n while (index > 0 && logs[index] !== log) {\n index -= 1;\n }\n setSelectedLog(index);\n }\n\n const warnings = useMemo(() => logs.filter((log) => log.level === 'warn'), [logs]);\n\n const errors = useMemo(\n () => logs.filter((log) => log.level === 'error' || log.level === 'fatal'),\n [logs]\n );\n\n return (\n <View style={styles.list}>\n {warnings.length > 0 && (\n <ErrorToast\n log={warnings[warnings.length - 1]}\n level=\"warn\"\n totalLogCount={warnings.length}\n onPressOpen={() => openLog(warnings[warnings.length - 1])}\n onPressDismiss={onDismissWarns}\n />\n )}\n\n {errors.length > 0 && (\n <ErrorToast\n log={errors[errors.length - 1]}\n level=\"error\"\n totalLogCount={errors.length}\n onPressOpen={() => openLog(errors[errors.length - 1])}\n onPressDismiss={onDismissErrors}\n />\n )}\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n list: {\n bottom: 6,\n left: 10,\n right: 10,\n maxWidth: 320,\n // @ts-expect-error\n position: 'fixed',\n },\n});\n\nexport default LogBoxData.withSubscription(ErrorToastContainer);\n"]}
|