@expo/metro-runtime 3.0.4 → 3.1.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/build/async-require/loadBundle.d.ts.map +1 -1
- package/build/async-require/loadBundle.js +8 -9
- package/build/async-require/loadBundle.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorFooter.js +5 -1
- package/build/error-overlay/overlay/LogBoxInspectorFooter.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.js +5 -1
- package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.js.map +1 -1
- package/build/error-overlay/toast/ErrorToast.js +5 -1
- package/build/error-overlay/toast/ErrorToast.js.map +1 -1
- package/package.json +4 -4
- package/src/async-require/loadBundle.ts +8 -11
- package/src/error-overlay/overlay/LogBoxInspectorFooter.tsx +6 -2
- package/src/error-overlay/overlay/LogBoxInspectorMessageHeader.tsx +6 -2
- package/src/error-overlay/toast/ErrorToast.tsx +6 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadBundle.d.ts","sourceRoot":"","sources":["../../src/async-require/loadBundle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loadBundle.d.ts","sourceRoot":"","sources":["../../src/async-require/loadBundle.ts"],"names":[],"mappings":"AAWA;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA0BvE"}
|
|
@@ -9,7 +9,6 @@ exports.loadBundleAsync = void 0;
|
|
|
9
9
|
*/
|
|
10
10
|
const buildUrlForBundle_1 = require("./buildUrlForBundle");
|
|
11
11
|
const fetchThenEval_1 = require("./fetchThenEval");
|
|
12
|
-
// import LoadingView from '../LoadingView';
|
|
13
12
|
let pendingRequests = 0;
|
|
14
13
|
/**
|
|
15
14
|
* Load a bundle for a URL using fetch + eval on native and script tag injection on web.
|
|
@@ -22,21 +21,21 @@ async function loadBundleAsync(bundlePath) {
|
|
|
22
21
|
return (0, fetchThenEval_1.fetchThenEvalAsync)(requestUrl);
|
|
23
22
|
}
|
|
24
23
|
else {
|
|
24
|
+
const Platform = require('react-native').Platform;
|
|
25
25
|
const LoadingView = require('../LoadingView')
|
|
26
26
|
.default;
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
if (Platform.OS !== 'web') {
|
|
28
|
+
// Send a signal to the `expo` package to show the loading indicator.
|
|
29
|
+
LoadingView.showMessage('Downloading...', 'load');
|
|
30
|
+
}
|
|
29
31
|
pendingRequests++;
|
|
30
32
|
return (0, fetchThenEval_1.fetchThenEvalAsync)(requestUrl)
|
|
31
33
|
.then(() => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
.default;
|
|
35
|
-
HMRClient.registerBundle(requestUrl);
|
|
36
|
-
}
|
|
34
|
+
const HMRClient = require('../HMRClient').default;
|
|
35
|
+
HMRClient.registerBundle(requestUrl);
|
|
37
36
|
})
|
|
38
37
|
.finally(() => {
|
|
39
|
-
if (!--pendingRequests) {
|
|
38
|
+
if (!--pendingRequests && Platform.OS !== 'web') {
|
|
40
39
|
LoadingView.hide();
|
|
41
40
|
}
|
|
42
41
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadBundle.js","sourceRoot":"","sources":["../../src/async-require/loadBundle.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,2DAAwD;AACxD,mDAAqD;
|
|
1
|
+
{"version":3,"file":"loadBundle.js","sourceRoot":"","sources":["../../src/async-require/loadBundle.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,2DAAwD;AACxD,mDAAqD;AAErD,IAAI,eAAe,GAAG,CAAC,CAAC;AAExB;;;;GAIG;AACI,KAAK,UAAU,eAAe,CAAC,UAAkB;IACtD,MAAM,UAAU,GAAG,IAAA,qCAAiB,EAAC,UAAU,CAAC,CAAC;IAEjD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;QACzC,OAAO,IAAA,kCAAkB,EAAC,UAAU,CAAC,CAAC;KACvC;SAAM;QACL,MAAM,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC,QAAQ,CAAC;QAClD,MAAM,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC;aAC1C,OAAkD,CAAC;QACtD,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE;YACzB,qEAAqE;YACrE,WAAW,CAAC,WAAW,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;SACnD;QACD,eAAe,EAAE,CAAC;QAElB,OAAO,IAAA,kCAAkB,EAAC,UAAU,CAAC;aAClC,IAAI,CAAC,GAAG,EAAE;YACT,MAAM,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC,OAAgD,CAAC;YAC3F,SAAS,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;QACvC,CAAC,CAAC;aACD,OAAO,CAAC,GAAG,EAAE;YACZ,IAAI,CAAC,EAAE,eAAe,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE;gBAC/C,WAAW,CAAC,IAAI,EAAE,CAAC;aACpB;QACH,CAAC,CAAC,CAAC;KACN;AACH,CAAC;AA1BD,0CA0BC","sourcesContent":["/**\n * Copyright © 2022 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { buildUrlForBundle } from './buildUrlForBundle';\nimport { fetchThenEvalAsync } from './fetchThenEval';\n\nlet pendingRequests = 0;\n\n/**\n * Load a bundle for a URL using fetch + eval on native and script tag injection on web.\n *\n * @param bundlePath Given a statement like `import('./Bacon')` `bundlePath` would be `Bacon.bundle?params=from-metro`.\n */\nexport async function loadBundleAsync(bundlePath: string): Promise<void> {\n const requestUrl = buildUrlForBundle(bundlePath);\n\n if (process.env.NODE_ENV === 'production') {\n return fetchThenEvalAsync(requestUrl);\n } else {\n const Platform = require('react-native').Platform;\n const LoadingView = require('../LoadingView')\n .default as typeof import('../LoadingView').default;\n if (Platform.OS !== 'web') {\n // Send a signal to the `expo` package to show the loading indicator.\n LoadingView.showMessage('Downloading...', 'load');\n }\n pendingRequests++;\n\n return fetchThenEvalAsync(requestUrl)\n .then(() => {\n const HMRClient = require('../HMRClient').default as typeof import('../HMRClient').default;\n HMRClient.registerBundle(requestUrl);\n })\n .finally(() => {\n if (!--pendingRequests && Platform.OS !== 'web') {\n LoadingView.hide();\n }\n });\n }\n}\n"]}
|
|
@@ -91,7 +91,11 @@ const buttonStyles = react_native_1.StyleSheet.create({
|
|
|
91
91
|
const styles = react_native_1.StyleSheet.create({
|
|
92
92
|
root: {
|
|
93
93
|
backgroundColor: LogBoxStyle.getBackgroundColor(1),
|
|
94
|
-
|
|
94
|
+
...react_native_1.Platform.select({
|
|
95
|
+
web: {
|
|
96
|
+
boxShadow: `0 -2px 0 2px #000`,
|
|
97
|
+
},
|
|
98
|
+
}),
|
|
95
99
|
flexDirection: 'row',
|
|
96
100
|
},
|
|
97
101
|
button: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogBoxInspectorFooter.js","sourceRoot":"","sources":["../../../src/error-overlay/overlay/LogBoxInspectorFooter.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;GAMG;AACH,kDAA0B;AAC1B,+
|
|
1
|
+
{"version":3,"file":"LogBoxInspectorFooter.js","sourceRoot":"","sources":["../../../src/error-overlay/overlay/LogBoxInspectorFooter.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;GAMG;AACH,kDAA0B;AAC1B,+CAA2E;AAE3E,mDAAoD;AACpD,+DAAiD;AAOjD,SAAgB,qBAAqB,CAAC,KAAY;IAChD,MAAM,GAAG,GAAG,IAAA,2BAAc,GAAE,CAAC;IAE7B,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;Q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AAE;QACR,IAAI,EAAE,CAAC;QACP,cAAc,EAAE,CAAC;QACjB,WAAW,EAAE,SAAS;QACtB,0EAA0E;KAC3E;IACD,OAAO,EAAE;QACP,UAAU,EAAE,QAAQ;QACpB,MAAM,EAAE,EAAE;QACV,cAAc,EAAE,QAAQ;KACzB;IACD,KAAK,EAAE;QACL,UAAU,EAAE,MAAM;QAClB,KAAK,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC;QAClC,QAAQ,EAAE,EAAE;QACZ,kBAAkB,EAAE,KAAK;QACzB,UAAU,EAAE,EAAE;KACf;CACF,CAAC,CAAC;AAEH,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE;QACJ,eAAe,EAAE,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC;QAClD,GAAG,uBAAQ,CAAC,MAAM,CAAC;YACjB,GAAG,EAAE;gBACH,SAAS,EAAE,mBAAmB;aAC/B;SACF,CAAC;QACF,aAAa,EAAE,KAAK;KACrB;IACD,MAAM,EAAE;QACN,IAAI,EAAE,CAAC;KACR;IACD,eAAe,EAAE;QACf,SAAS,EAAE,QAAQ;QACnB,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,EAAE;QACd,UAAU,EAAE,EAAE;QACd,aAAa,EAAE,EAAE;QACjB,SAAS,EAAE,QAAQ;QACnB,KAAK,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC;KACrC;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 { Platform, Pressable, StyleSheet, Text, View } from 'react-native';\n\nimport { useSelectedLog } from '../Data/LogContext';\nimport * as LogBoxStyle from '../UI/LogBoxStyle';\n\ntype Props = {\n onDismiss: () => void;\n onMinimize: () => void;\n};\n\nexport function LogBoxInspectorFooter(props: Props) {\n const log = useSelectedLog();\n\n if (['static', 'syntax'].includes(log.level)) {\n return (\n <View style={styles.root}>\n <View style={styles.button}>\n <Text style={styles.syntaxErrorText}>This error cannot be dismissed.</Text>\n </View>\n </View>\n );\n }\n\n return (\n <View style={styles.root}>\n <FooterButton text=\"Dismiss\" onPress={props.onDismiss} />\n <FooterButton text=\"Minimize\" onPress={props.onMinimize} />\n </View>\n );\n}\n\nfunction FooterButton({ text, onPress }: { onPress: () => void; text: string }) {\n return (\n <Pressable onPress={onPress} style={{ flex: 1 }}>\n {({\n /** @ts-expect-error: react-native types are broken. */\n hovered,\n pressed,\n }) => (\n <View\n style={[\n buttonStyles.safeArea,\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 <View style={buttonStyles.content}>\n <Text style={buttonStyles.label}>{text}</Text>\n </View>\n </View>\n )}\n </Pressable>\n );\n}\n\nconst buttonStyles = StyleSheet.create({\n safeArea: {\n flex: 1,\n borderTopWidth: 1,\n borderColor: '#323232',\n // paddingBottom: DeviceInfo.getConstants().isIPhoneX_deprecated ? 30 : 0,\n },\n content: {\n alignItems: 'center',\n height: 48,\n justifyContent: 'center',\n },\n label: {\n userSelect: 'none',\n color: LogBoxStyle.getTextColor(1),\n fontSize: 14,\n includeFontPadding: false,\n lineHeight: 20,\n },\n});\n\nconst styles = StyleSheet.create({\n root: {\n backgroundColor: LogBoxStyle.getBackgroundColor(1),\n ...Platform.select({\n web: {\n boxShadow: `0 -2px 0 2px #000`,\n },\n }),\n flexDirection: 'row',\n },\n button: {\n flex: 1,\n },\n syntaxErrorText: {\n textAlign: 'center',\n width: '100%',\n height: 48,\n fontSize: 14,\n lineHeight: 20,\n paddingTop: 20,\n paddingBottom: 50,\n fontStyle: 'italic',\n color: LogBoxStyle.getTextColor(0.6),\n },\n});\n"]}
|
|
@@ -57,7 +57,11 @@ exports.LogBoxInspectorMessageHeader = LogBoxInspectorMessageHeader;
|
|
|
57
57
|
const styles = react_native_1.StyleSheet.create({
|
|
58
58
|
body: {
|
|
59
59
|
backgroundColor: LogBoxStyle.getBackgroundColor(1),
|
|
60
|
-
|
|
60
|
+
...react_native_1.Platform.select({
|
|
61
|
+
web: {
|
|
62
|
+
boxShadow: `0 2px 0 2px #00000080`,
|
|
63
|
+
},
|
|
64
|
+
}),
|
|
61
65
|
},
|
|
62
66
|
bodyText: {
|
|
63
67
|
color: LogBoxStyle.getTextColor(1),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogBoxInspectorMessageHeader.js","sourceRoot":"","sources":["../../../src/error-overlay/overlay/LogBoxInspectorMessageHeader.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;GAMG;AACH,kDAA0B;AAC1B,+
|
|
1
|
+
{"version":3,"file":"LogBoxInspectorMessageHeader.js","sourceRoot":"","sources":["../../../src/error-overlay/overlay/LogBoxInspectorMessageHeader.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;GAMG;AACH,kDAA0B;AAC1B,+CAAgE;AAIhE,uDAAoD;AACpD,+DAAiD;AAUjD,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAErC,SAAS,cAAc,CAAC,EACtB,OAAO,EACP,SAAS,EACT,OAAO,GAC0C;IACjD,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,wBAAwB,IAAI,CAAC,SAAS,EAAE;QACnE,OAAO,IAAI,CAAC;KACb;IACD,OAAO,CACL,8BAAC,mBAAI,IAAC,KAAK,EAAE,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,mBAEvC,CACR,CAAC;AACJ,CAAC;AAED,SAAgB,4BAA4B,CAAC,KAAY;IACvD,OAAO,CACL,8BAAC,mBAAI,IAAC,KAA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AU,EAAE,KAAK;QACjB,kBAAkB,EAAE,KAAK;QACzB,UAAU,EAAE,EAAE;KACf;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,WAAW,CAAC,eAAe,CAAC,CAAC,CAAC;KACtC;IACD,KAAK,EAAE;QACL,KAAK,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC;KACpC;IACD,KAAK,EAAE;QACL,KAAK,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC;KACpC;IACD,MAAM,EAAE;QACN,KAAK,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC;KACpC;IACD,MAAM,EAAE;QACN,KAAK,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC;KACpC;IACD,WAAW,EAAE;QACX,KAAK,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC;KACrC;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC;QACpC,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;QACjB,UAAU,EAAE,EAAE;KACf;IACD,MAAM,EAAE;QACN,eAAe,EAAE,CAAC;QAClB,iBAAiB,EAAE,EAAE;QACrB,YAAY,EAAE,CAAC;KAChB;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 { Platform, StyleSheet, Text, View } from 'react-native';\n\nimport type { LogLevel } from '../Data/LogBoxLog';\nimport type { Message } from '../Data/parseLogBoxLog';\nimport { LogBoxMessage } from '../UI/LogBoxMessage';\nimport * as LogBoxStyle from '../UI/LogBoxStyle';\n\ntype Props = {\n collapsed: boolean;\n message: Message;\n level: LogLevel;\n title: string;\n onPress: () => void;\n};\n\nconst SHOW_MORE_MESSAGE_LENGTH = 300;\n\nfunction ShowMoreButton({\n message,\n collapsed,\n onPress,\n}: Pick<Props, 'collapsed' | 'message' | 'onPress'>) {\n if (message.content.length < SHOW_MORE_MESSAGE_LENGTH || !collapsed) {\n return null;\n }\n return (\n <Text style={styles.collapse} onPress={onPress}>\n ... See More\n </Text>\n );\n}\n\nexport function LogBoxInspectorMessageHeader(props: Props) {\n return (\n <View style={styles.body}>\n <View style={styles.heading}>\n <Text style={[styles.headingText, styles[props.level]]}>{props.title}</Text>\n </View>\n <Text style={styles.bodyText}>\n <LogBoxMessage\n maxLength={props.collapsed ? SHOW_MORE_MESSAGE_LENGTH : Infinity}\n message={props.message}\n style={styles.messageText}\n />\n <ShowMoreButton {...props} />\n </Text>\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n body: {\n backgroundColor: LogBoxStyle.getBackgroundColor(1),\n ...Platform.select({\n web: {\n boxShadow: `0 2px 0 2px #00000080`,\n },\n }),\n },\n bodyText: {\n color: LogBoxStyle.getTextColor(1),\n fontSize: 14,\n includeFontPadding: false,\n lineHeight: 20,\n fontWeight: '500',\n paddingHorizontal: 12,\n paddingBottom: 10,\n },\n heading: {\n alignItems: 'center',\n flexDirection: 'row',\n paddingHorizontal: 12,\n marginTop: 10,\n marginBottom: 5,\n },\n headingText: {\n flex: 1,\n fontSize: 20,\n fontWeight: '600',\n includeFontPadding: false,\n lineHeight: 28,\n },\n warn: {\n color: LogBoxStyle.getWarningColor(1),\n },\n error: {\n color: LogBoxStyle.getErrorColor(1),\n },\n fatal: {\n color: LogBoxStyle.getFatalColor(1),\n },\n syntax: {\n color: LogBoxStyle.getFatalColor(1),\n },\n static: {\n color: LogBoxStyle.getFatalColor(1),\n },\n messageText: {\n color: LogBoxStyle.getTextColor(0.6),\n },\n collapse: {\n color: LogBoxStyle.getTextColor(0.7),\n fontSize: 14,\n fontWeight: '300',\n lineHeight: 12,\n },\n button: {\n paddingVertical: 5,\n paddingHorizontal: 10,\n borderRadius: 3,\n },\n});\n"]}
|
|
@@ -108,7 +108,11 @@ const countStyles = react_native_1.StyleSheet.create({
|
|
|
108
108
|
lineHeight: 18,
|
|
109
109
|
textAlign: 'center',
|
|
110
110
|
fontWeight: '600',
|
|
111
|
-
|
|
111
|
+
...react_native_1.Platform.select({
|
|
112
|
+
web: {
|
|
113
|
+
textShadow: `0px 0px 3px ${LogBoxStyle.getBackgroundColor(0.8)}`,
|
|
114
|
+
},
|
|
115
|
+
}),
|
|
112
116
|
},
|
|
113
117
|
});
|
|
114
118
|
const dismissStyles = react_native_1.StyleSheet.create({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorToast.js","sourceRoot":"","sources":["../../../src/error-overlay/toast/ErrorToast.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;GAMG;AACH,+CAAyC;AACzC,+
|
|
1
|
+
{"version":3,"file":"ErrorToast.js","sourceRoot":"","sources":["../../../src/error-overlay/toast/ErrorToast.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;GAMG;AACH,+CAAyC;AACzC,+CAAkF;AAElF,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,wBAAS,IAAC,KAAK,EAAE,EAAE,IAA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,CAAC;IACtC,KAAK,EAAE;QACL,eAAe,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, Platform, 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 ...Platform.select({\n web: {\n textShadow: `0px 0px 3px ${LogBoxStyle.getBackgroundColor(0.8)}`,\n },\n }),\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"]}
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/metro-runtime",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Tools for making advanced Metro bundler features work",
|
|
5
|
+
"sideEffects": true,
|
|
5
6
|
"types": "build",
|
|
6
7
|
"main": "build",
|
|
7
|
-
"browser": "src",
|
|
8
|
-
"react-native": "src",
|
|
9
8
|
"homepage": "https://github.com/expo/expo/tree/main/packages/@expo/metro-runtime",
|
|
10
9
|
"keywords": [],
|
|
11
10
|
"author": "650 Industries, Inc.",
|
|
12
11
|
"license": "MIT",
|
|
13
12
|
"files": [
|
|
14
13
|
"build",
|
|
14
|
+
"src",
|
|
15
15
|
"symbolicate",
|
|
16
16
|
"async-require.js",
|
|
17
17
|
"async-require.d.ts",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"react-native": "*"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "2763e9cc6f2317b40da73382fe2595f8deebff46"
|
|
40
40
|
}
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { buildUrlForBundle } from './buildUrlForBundle';
|
|
8
8
|
import { fetchThenEvalAsync } from './fetchThenEval';
|
|
9
|
-
// import LoadingView from '../LoadingView';
|
|
10
9
|
|
|
11
10
|
let pendingRequests = 0;
|
|
12
11
|
|
|
@@ -21,24 +20,22 @@ export async function loadBundleAsync(bundlePath: string): Promise<void> {
|
|
|
21
20
|
if (process.env.NODE_ENV === 'production') {
|
|
22
21
|
return fetchThenEvalAsync(requestUrl);
|
|
23
22
|
} else {
|
|
23
|
+
const Platform = require('react-native').Platform;
|
|
24
24
|
const LoadingView = require('../LoadingView')
|
|
25
25
|
.default as typeof import('../LoadingView').default;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
if (Platform.OS !== 'web') {
|
|
27
|
+
// Send a signal to the `expo` package to show the loading indicator.
|
|
28
|
+
LoadingView.showMessage('Downloading...', 'load');
|
|
29
|
+
}
|
|
30
30
|
pendingRequests++;
|
|
31
31
|
|
|
32
32
|
return fetchThenEvalAsync(requestUrl)
|
|
33
33
|
.then(() => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
.default as typeof import('../HMRClient').default;
|
|
37
|
-
HMRClient.registerBundle(requestUrl);
|
|
38
|
-
}
|
|
34
|
+
const HMRClient = require('../HMRClient').default as typeof import('../HMRClient').default;
|
|
35
|
+
HMRClient.registerBundle(requestUrl);
|
|
39
36
|
})
|
|
40
37
|
.finally(() => {
|
|
41
|
-
if (!--pendingRequests) {
|
|
38
|
+
if (!--pendingRequests && Platform.OS !== 'web') {
|
|
42
39
|
LoadingView.hide();
|
|
43
40
|
}
|
|
44
41
|
});
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
import React from 'react';
|
|
9
|
-
import { Pressable, StyleSheet, Text, View } from 'react-native';
|
|
9
|
+
import { Platform, Pressable, StyleSheet, Text, View } from 'react-native';
|
|
10
10
|
|
|
11
11
|
import { useSelectedLog } from '../Data/LogContext';
|
|
12
12
|
import * as LogBoxStyle from '../UI/LogBoxStyle';
|
|
@@ -91,7 +91,11 @@ const buttonStyles = StyleSheet.create({
|
|
|
91
91
|
const styles = StyleSheet.create({
|
|
92
92
|
root: {
|
|
93
93
|
backgroundColor: LogBoxStyle.getBackgroundColor(1),
|
|
94
|
-
|
|
94
|
+
...Platform.select({
|
|
95
|
+
web: {
|
|
96
|
+
boxShadow: `0 -2px 0 2px #000`,
|
|
97
|
+
},
|
|
98
|
+
}),
|
|
95
99
|
flexDirection: 'row',
|
|
96
100
|
},
|
|
97
101
|
button: {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
import React from 'react';
|
|
9
|
-
import { StyleSheet, Text, View } from 'react-native';
|
|
9
|
+
import { Platform, StyleSheet, Text, View } from 'react-native';
|
|
10
10
|
|
|
11
11
|
import type { LogLevel } from '../Data/LogBoxLog';
|
|
12
12
|
import type { Message } from '../Data/parseLogBoxLog';
|
|
@@ -59,7 +59,11 @@ export function LogBoxInspectorMessageHeader(props: Props) {
|
|
|
59
59
|
const styles = StyleSheet.create({
|
|
60
60
|
body: {
|
|
61
61
|
backgroundColor: LogBoxStyle.getBackgroundColor(1),
|
|
62
|
-
|
|
62
|
+
...Platform.select({
|
|
63
|
+
web: {
|
|
64
|
+
boxShadow: `0 2px 0 2px #00000080`,
|
|
65
|
+
},
|
|
66
|
+
}),
|
|
63
67
|
},
|
|
64
68
|
bodyText: {
|
|
65
69
|
color: LogBoxStyle.getTextColor(1),
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
import React, { useEffect } from 'react';
|
|
9
|
-
import { Image, Pressable, StyleSheet, Text, View } from 'react-native';
|
|
9
|
+
import { Image, Platform, Pressable, StyleSheet, Text, View } from 'react-native';
|
|
10
10
|
|
|
11
11
|
import { ErrorToastMessage } from './ErrorToastMessage';
|
|
12
12
|
import * as LogBoxData from '../Data/LogBoxData';
|
|
@@ -128,7 +128,11 @@ const countStyles = StyleSheet.create({
|
|
|
128
128
|
lineHeight: 18,
|
|
129
129
|
textAlign: 'center',
|
|
130
130
|
fontWeight: '600',
|
|
131
|
-
|
|
131
|
+
...Platform.select({
|
|
132
|
+
web: {
|
|
133
|
+
textShadow: `0px 0px 3px ${LogBoxStyle.getBackgroundColor(0.8)}`,
|
|
134
|
+
},
|
|
135
|
+
}),
|
|
132
136
|
},
|
|
133
137
|
});
|
|
134
138
|
|