@expo/metro-runtime 3.0.3 → 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.
@@ -1 +1 @@
1
- {"version":3,"file":"loadBundle.d.ts","sourceRoot":"","sources":["../../src/async-require/loadBundle.ts"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BvE"}
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
- // Send a signal to the `expo` package to show the loading indicator.
28
- LoadingView.showMessage('Downloading...', 'load');
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
- if (process.env.NODE_ENV !== 'production') {
33
- const HMRClient = require('../HMRClient')
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;AACrD,4CAA4C;AAE5C,IAAI,eAAe,GAAG,CAAC,CAAC;AAExB;;;;GAIG;AACI,KAAK,UAAU,eAAe,CAAC,UAAkB;IACtD,MAAM,UAAU,GAAG,IAAA,qCAAiB,EAAC,UAAU,CAAC,CAAC;IAEjD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;QACzC,OAAO,IAAA,kCAAkB,EAAC,UAAU,CAAC,CAAC;KACvC;SAAM;QACL,MAAM,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC;aAC1C,OAAkD,CAAC;QAEtD,qEAAqE;QACrE,WAAW,CAAC,WAAW,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;QAElD,eAAe,EAAE,CAAC;QAElB,OAAO,IAAA,kCAAkB,EAAC,UAAU,CAAC;aAClC,IAAI,CAAC,GAAG,EAAE;YACT,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;gBACzC,MAAM,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC;qBACtC,OAAgD,CAAC;gBACpD,SAAS,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;aACtC;QACH,CAAC,CAAC;aACD,OAAO,CAAC,GAAG,EAAE;YACZ,IAAI,CAAC,EAAE,eAAe,EAAE;gBACtB,WAAW,CAAC,IAAI,EAAE,CAAC;aACpB;QACH,CAAC,CAAC,CAAC;KACN;AACH,CAAC;AA5BD,0CA4BC","sourcesContent":["/**\n * Copyright © 2022 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { buildUrlForBundle } from './buildUrlForBundle';\nimport { fetchThenEvalAsync } from './fetchThenEval';\n// import LoadingView from '../LoadingView';\n\nlet pendingRequests = 0;\n\n/**\n * Load a bundle for a URL using fetch + eval on native and script tag injection on web.\n *\n * @param bundlePath Given a statement like `import('./Bacon')` `bundlePath` would be `Bacon.bundle?params=from-metro`.\n */\nexport async function loadBundleAsync(bundlePath: string): Promise<void> {\n const requestUrl = buildUrlForBundle(bundlePath);\n\n if (process.env.NODE_ENV === 'production') {\n return fetchThenEvalAsync(requestUrl);\n } else {\n const LoadingView = require('../LoadingView')\n .default as typeof import('../LoadingView').default;\n\n // Send a signal to the `expo` package to show the loading indicator.\n LoadingView.showMessage('Downloading...', 'load');\n\n pendingRequests++;\n\n return fetchThenEvalAsync(requestUrl)\n .then(() => {\n if (process.env.NODE_ENV !== 'production') {\n const HMRClient = require('../HMRClient')\n .default as typeof import('../HMRClient').default;\n HMRClient.registerBundle(requestUrl);\n }\n })\n .finally(() => {\n if (!--pendingRequests) {\n LoadingView.hide();\n }\n });\n }\n}\n"]}
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
- boxShadow: `0 -2px 0 2px #000`,
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,+CAAiE;AAEjE,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;QAC5C,OAAO,CACL,8BAAC,mBAAI,IAAC,KAAK,EAAE,MAAM,CAAC,IAAI;YACtB,8BAAC,mBAAI,IAAC,KAAK,EAAE,MAAM,CAAC,MAAM;gBACxB,8BAAC,mBAAI,IAAC,KAAK,EAAE,MAAM,CAAC,eAAe,sCAAwC,CACtE,CACF,CACR,CAAC;KACH;IAED,OAAO,CACL,8BAAC,mBAAI,IAAC,KAAK,EAAE,MAAM,CAAC,IAAI;QACtB,8BAAC,YAAY,IAAC,IAAI,EAAC,SAAS,EAAC,OAAO,EAAE,KAAK,CAAC,SAAS,GAAI;QACzD,8BAAC,YAAY,IAAC,IAAI,EAAC,UAAU,EAAC,OAAO,EAAE,KAAK,CAAC,UAAU,GAAI,C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,eAAe,EAAE,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC;QAClD,SAAS,EAAE,mBAAmB;QAC9B,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 { 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 boxShadow: `0 -2px 0 2px #000`,\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"]}
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;QAC5C,OAAO,CACL,8BAAC,mBAAI,IAAC,KAAK,EAAE,MAAM,CAAC,IAAI;YACtB,8BAAC,mBAAI,IAAC,KAAK,EAAE,MAAM,CAAC,MAAM;gBACxB,8BAAC,mBAAI,IAAC,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AE,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
- boxShadow: `0 2px 0 2px #00000080`,
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,+CAAsD;AAItD,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,KAAK,EAAE,MAAM,CAAC,IAAI;QACtB,8BAAC,mBAAI,IAAC,KAAK,EAAE,MAAM,CAAC,OAAO;YACzB,8BAAC,mBAAI,IAAC,KAAK,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAG,KAAK,CAAC,KAAK,CAAQ,CACvE;QACP,8BAAC,mBAAI,IAAC,KAAK,EAAE,MAAM,CAAC,QAAQ;YAC1B,8BAAC,6BAAa,IACZ,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,QAAQ,EAChE,OAAO,EAAE,KAAK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AAC,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 { 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 boxShadow: `0 2px 0 2px #00000080`,\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"]}
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,SAAg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W,EAAE;QACX,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,EAAE;QACZ,UAAU,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
- textShadow: `0px 0px 3px ${LogBoxStyle.getBackgroundColor(0.8)}`,
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,+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,wBAAS,IAAC,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,WAAW,IACtD,CAAC;QACA,uDAAuD;QACvD,OAAO,EACP,OAAO,GACR,EAAE,EAAE,CAAC,CACJ,8BAAC,mBAAI,IACH,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,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
+ {"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,IAAI,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,WAAW,IACtD,CAAC;QACA,uDAAuD;QACvD,OAAO,EACP,OAAO,GACR,EAAE,EAAE,CAAC,CACJ,8BAAC,mBAAI,IACH,KAAK,EAAE;gBACL,WAAW,CAAC,KAAK;gBACjB;oBACE,kCAAkC;oBAClC,kBAAkB,EAAE,OAAO;oBAC3B,eAAe,EAAE,OAAO;wBACtB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,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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"getDevServer.d.ts","sourceRoot":"","sources":["../src/getDevServer.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,YAAY;;IAcd,0DAA0D;;;CAe7D,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"getDevServer.d.ts","sourceRoot":"","sources":["../src/getDevServer.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,YAAY;;IAcd,0DAA0D;;;CAc7D,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -1,9 +1,5 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const qs_1 = __importDefault(require("qs"));
7
3
  const getDevServer = () => {
8
4
  // Disable for SSR
9
5
  if (typeof window === 'undefined') {
@@ -21,9 +17,9 @@ const getDevServer = () => {
21
17
  if (document?.currentScript && 'src' in document.currentScript) {
22
18
  return document.currentScript.src;
23
19
  }
24
- const url = window.location.toString();
25
- const query = qs_1.default.parse(url);
26
- return (location.origin + location.pathname + '?' + qs_1.default.stringify({ ...query, platform: 'web' }));
20
+ const bundleUrl = new URL(location.href);
21
+ bundleUrl.searchParams.set('platform', 'web');
22
+ return bundleUrl.toString();
27
23
  },
28
24
  url: location.origin + location.pathname,
29
25
  };
@@ -1 +1 @@
1
- {"version":3,"file":"getDevServer.js","sourceRoot":"","sources":["../src/getDevServer.ts"],"names":[],"mappings":";;;;;AAAA,4CAAoB;AAEpB,MAAM,YAAY,GAAG,GAAG,EAAE;IACxB,kBAAkB;IAClB,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,OAAO;YACL,sBAAsB,EAAE,IAAI;YAC5B,aAAa,EAAE,EAAE;YACjB,GAAG,EAAE,EAAE;SACR,CAAC;KACH;IAED,OAAO;QACL,4DAA4D;QAC5D,sBAAsB,EAAE,IAAI;QAE5B,0DAA0D;QAC1D,IAAI,aAAa;YACf,IAAI,QAAQ,EAAE,aAAa,IAAI,KAAK,IAAI,QAAQ,CAAC,aAAa,EAAE;gBAC9D,OAAO,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC;aACnC;YAED,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;YACvC,MAAM,KAAK,GAAG,YAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAE5B,OAAO,CACL,QAAQ,CAAC,MAAM,GAAG,QAAQ,CAAC,QAAQ,GAAG,GAAG,GAAG,YAAE,CAAC,SAAS,CAAC,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CACxF,CAAC;QACJ,CAAC;QACD,GAAG,EAAE,QAAQ,CAAC,MAAM,GAAG,QAAQ,CAAC,QAAQ;KACzC,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,YAAY,CAAC","sourcesContent":["import qs from 'qs';\n\nconst getDevServer = () => {\n // Disable for SSR\n if (typeof window === 'undefined') {\n return {\n bundleLoadedFromServer: true,\n fullBundleUrl: '',\n url: '',\n };\n }\n\n return {\n // The bundle is always loaded from a server in the browser.\n bundleLoadedFromServer: true,\n\n /** URL but ensures that platform query param is added. */\n get fullBundleUrl() {\n if (document?.currentScript && 'src' in document.currentScript) {\n return document.currentScript.src;\n }\n\n const url = window.location.toString();\n const query = qs.parse(url);\n\n return (\n location.origin + location.pathname + '?' + qs.stringify({ ...query, platform: 'web' })\n );\n },\n url: location.origin + location.pathname,\n };\n};\n\nexport default getDevServer;\n"]}
1
+ {"version":3,"file":"getDevServer.js","sourceRoot":"","sources":["../src/getDevServer.ts"],"names":[],"mappings":";;AAAA,MAAM,YAAY,GAAG,GAAG,EAAE;IACxB,kBAAkB;IAClB,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,OAAO;YACL,sBAAsB,EAAE,IAAI;YAC5B,aAAa,EAAE,EAAE;YACjB,GAAG,EAAE,EAAE;SACR,CAAC;KACH;IAED,OAAO;QACL,4DAA4D;QAC5D,sBAAsB,EAAE,IAAI;QAE5B,0DAA0D;QAC1D,IAAI,aAAa;YACf,IAAI,QAAQ,EAAE,aAAa,IAAI,KAAK,IAAI,QAAQ,CAAC,aAAa,EAAE;gBAC9D,OAAO,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC;aACnC;YAED,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAEzC,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;YAE9C,OAAO,SAAS,CAAC,QAAQ,EAAE,CAAC;QAC9B,CAAC;QACD,GAAG,EAAE,QAAQ,CAAC,MAAM,GAAG,QAAQ,CAAC,QAAQ;KACzC,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,YAAY,CAAC","sourcesContent":["const getDevServer = () => {\n // Disable for SSR\n if (typeof window === 'undefined') {\n return {\n bundleLoadedFromServer: true,\n fullBundleUrl: '',\n url: '',\n };\n }\n\n return {\n // The bundle is always loaded from a server in the browser.\n bundleLoadedFromServer: true,\n\n /** URL but ensures that platform query param is added. */\n get fullBundleUrl() {\n if (document?.currentScript && 'src' in document.currentScript) {\n return document.currentScript.src;\n }\n\n const bundleUrl = new URL(location.href);\n\n bundleUrl.searchParams.set('platform', 'web');\n\n return bundleUrl.toString();\n },\n url: location.origin + location.pathname,\n };\n};\n\nexport default getDevServer;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Location.native.d.ts","sourceRoot":"","sources":["../../src/location/Location.native.ts"],"names":[],"mappings":"AAoLA,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,QAE3C;AAED,wBAAgB,OAAO,SAgBtB"}
1
+ {"version":3,"file":"Location.native.d.ts","sourceRoot":"","sources":["../../src/location/Location.native.ts"],"names":[],"mappings":"AAiLA,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,QAE3C;AAED,wBAAgB,OAAO,SAgBtB"}
@@ -1,12 +1,8 @@
1
1
  "use strict";
2
2
  // Copyright © 2023 650 Industries.
3
3
  // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
4
- var __importDefault = (this && this.__importDefault) || function (mod) {
5
- return (mod && mod.__esModule) ? mod : { "default": mod };
6
- };
7
4
  Object.defineProperty(exports, "__esModule", { value: true });
8
5
  exports.install = exports.setLocationHref = void 0;
9
- const url_parse_1 = __importDefault(require("url-parse"));
10
6
  class DOMException extends Error {
11
7
  constructor(message, name) {
12
8
  super(message);
@@ -20,12 +16,10 @@ class DOMException extends Error {
20
16
  // - https://heycam.github.io/webidl/#LegacyUnforgeable
21
17
  class Location {
22
18
  constructor(href = null) {
23
- const url = new url_parse_1.default(
19
+ const url = new URL(
24
20
  // @ts-expect-error
25
21
  href);
26
- // @ts-expect-error
27
22
  url.username = '';
28
- // @ts-expect-error
29
23
  url.password = '';
30
24
  Object.defineProperties(this, {
31
25
  hash: {
@@ -99,7 +93,6 @@ class Location {
99
93
  },
100
94
  search: {
101
95
  get() {
102
- // @ts-expect-error
103
96
  return url.search;
104
97
  },
105
98
  set() {
@@ -1 +1 @@
1
- {"version":3,"file":"Location.native.js","sourceRoot":"","sources":["../../src/location/Location.native.ts"],"names":[],"mappings":";AAAA,mCAAmC;AACnC,0EAA0E;;;;;;AAE1E,0DAA4B;AAE5B,MAAM,YAAa,SAAQ,KAAK;IAC9B,YAAY,OAAe,EAAE,IAAY;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,6EAA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BACvD,CAAC;aACF;SACF,CAAC,CAAC;IACL,CAAC;CACF;AAED,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,SAAS,EAAE;IAC1C,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,EAAE;QACnB,KAAK,EAAE,UAAU;QACjB,YAAY,EAAE,IAAI;KACnB;CACF,CAAC,CAAC;AAEH,IAAI,QAAQ,GAAyB,SAAS,CAAC;AAE/C,SAAgB,eAAe,CAAC,IAAY;IAC1C,QAAQ,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC;AAFD,0CAEC;AAED,SAAgB,OAAO;IACrB,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE;QACxC,KAAK,EAAE,QAAQ;QACf,YAAY,EAAE,IAAI;QAClB,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IAEH,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE;QACxC,GAAG;YACD,OAAO,QAAQ,CAAC;QAClB,CAAC;QACD,GAAG;YACD,MAAM,IAAI,YAAY,CAAC,wBAAwB,EAAE,mBAAmB,CAAC,CAAC;QACxE,CAAC;QACD,UAAU,EAAE,IAAI;KACjB,CAAC,CAAC;AACL,CAAC;AAhBD,0BAgBC","sourcesContent":["// Copyright © 2023 650 Industries.\n// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.\n\nimport URL from 'url-parse';\n\nclass DOMException extends Error {\n constructor(message: string, name: string) {\n super(message);\n this.name = name;\n }\n}\n\n// The differences between the definitions of `Location` and `WorkerLocation`\n// are because of the `LegacyUnforgeable` attribute only specified upon\n// `Location`'s properties. See:\n// - https://html.spec.whatwg.org/multipage/history.html#the-location-interface\n// - https://heycam.github.io/webidl/#LegacyUnforgeable\nclass Location {\n constructor(href: string | null = null) {\n const url = new URL(\n // @ts-expect-error\n href\n );\n // @ts-expect-error\n url.username = '';\n // @ts-expect-error\n url.password = '';\n Object.defineProperties(this, {\n hash: {\n get() {\n return url.hash;\n },\n set() {\n throw new DOMException(`Cannot set \"location.hash\".`, 'NotSupportedError');\n },\n enumerable: true,\n },\n host: {\n get() {\n return url.host;\n },\n set() {\n throw new DOMException(`Cannot set \"location.host\".`, 'NotSupportedError');\n },\n enumerable: true,\n },\n hostname: {\n get() {\n return url.hostname;\n },\n set() {\n throw new DOMException(`Cannot set \"location.hostname\".`, 'NotSupportedError');\n },\n enumerable: true,\n },\n href: {\n get() {\n return url.href;\n },\n set() {\n throw new DOMException(`Cannot set \"location.href\".`, 'NotSupportedError');\n },\n enumerable: true,\n },\n origin: {\n get() {\n return url.origin;\n },\n enumerable: true,\n },\n pathname: {\n get() {\n return url.pathname;\n },\n set() {\n throw new DOMException(`Cannot set \"location.pathname\".`, 'NotSupportedError');\n },\n enumerable: true,\n },\n port: {\n get() {\n return url.port;\n },\n set() {\n throw new DOMException(`Cannot set \"location.port\".`, 'NotSupportedError');\n },\n enumerable: true,\n },\n protocol: {\n get() {\n return url.protocol;\n },\n set() {\n throw new DOMException(`Cannot set \"location.protocol\".`, 'NotSupportedError');\n },\n enumerable: true,\n },\n search: {\n get() {\n // @ts-expect-error\n return url.search;\n },\n set() {\n throw new DOMException(`Cannot set \"location.search\".`, 'NotSupportedError');\n },\n enumerable: true,\n },\n ancestorOrigins: {\n get() {\n return {\n length: 0,\n item: () => null,\n contains: () => false,\n };\n },\n enumerable: true,\n },\n assign: {\n value: function assign() {\n throw new DOMException(`Cannot call \"location.assign()\".`, 'NotSupportedError');\n },\n enumerable: true,\n },\n reload: {\n value: function reload() {\n if (process.env.NODE_ENV !== 'production') {\n // NOTE: This does change how native fast refresh works. The upstream metro-runtime will check\n // if `location.reload` exists before falling back on an implementation that is nearly identical to\n // this. The main difference is that on iOS there is a \"reason\" message sent, but at the time of writing\n // this, that message is unused (ref: `RCTTriggerReloadCommandNotification`).\n const DevSettings = (require('react-native') as typeof import('react-native'))\n .DevSettings;\n return DevSettings.reload();\n } else {\n throw new DOMException(`Cannot call \"location.reload()\".`, 'NotSupportedError');\n }\n },\n enumerable: true,\n },\n replace: {\n value: function replace() {\n throw new DOMException(`Cannot call \"location.replace()\".`, 'NotSupportedError');\n },\n enumerable: true,\n },\n toString: {\n value: function toString() {\n return url.href;\n },\n enumerable: true,\n },\n [Symbol.for('Expo.privateCustomInspect')]: {\n value(inspect: any) {\n const object = {\n hash: this.hash,\n host: this.host,\n hostname: this.hostname,\n href: this.href,\n origin: this.origin,\n pathname: this.pathname,\n port: this.port,\n protocol: this.protocol,\n search: this.search,\n };\n return `${this.constructor.name} ${inspect(object)}`;\n },\n },\n });\n }\n}\n\nObject.defineProperties(Location.prototype, {\n [Symbol.toString()]: {\n value: 'Location',\n configurable: true,\n },\n});\n\nlet location: Location | undefined = undefined;\n\nexport function setLocationHref(href: string) {\n location = new Location(href);\n}\n\nexport function install() {\n Object.defineProperty(global, 'Location', {\n value: Location,\n configurable: true,\n writable: true,\n });\n\n Object.defineProperty(window, 'location', {\n get() {\n return location;\n },\n set() {\n throw new DOMException(`Cannot set \"location\".`, 'NotSupportedError');\n },\n enumerable: true,\n });\n}\n"]}
1
+ {"version":3,"file":"Location.native.js","sourceRoot":"","sources":["../../src/location/Location.native.ts"],"names":[],"mappings":";AAAA,mCAAmC;AACnC,0EAA0E;;;AAE1E,MAAM,YAAa,SAAQ,KAAK;IAC9B,YAAY,OAAe,EAAE,IAAY;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,6EAA6E;AAC7E,uEAAuE;AACvE,gCAAgC;AAChC,+EAA+E;AAC/E,uDAAuD;AACvD,MAAM,QAAQ;IACZ,YAAY,OAAsB,IAAI;QACpC,MAAM,GAAG,GAAG,IAAI,GAAG;QACjB,mBAAmB;QACnB,IAAI,CACL,CAAC;QAEF,GAAG,CAAC,QAAQ,GAAG,EAAE,CAAC;QAElB,GAAG,CAAC,QAAQ,GAAG,EAAE,CAAC;Q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AAG,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC;AAFD,0CAEC;AAED,SAAgB,OAAO;IACrB,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE;QACxC,KAAK,EAAE,QAAQ;QACf,YAAY,EAAE,IAAI;QAClB,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IAEH,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE;QACxC,GAAG;YACD,OAAO,QAAQ,CAAC;QAClB,CAAC;QACD,GAAG;YACD,MAAM,IAAI,YAAY,CAAC,wBAAwB,EAAE,mBAAmB,CAAC,CAAC;QACxE,CAAC;QACD,UAAU,EAAE,IAAI;KACjB,CAAC,CAAC;AACL,CAAC;AAhBD,0BAgBC","sourcesContent":["// Copyright © 2023 650 Industries.\n// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.\n\nclass DOMException extends Error {\n constructor(message: string, name: string) {\n super(message);\n this.name = name;\n }\n}\n\n// The differences between the definitions of `Location` and `WorkerLocation`\n// are because of the `LegacyUnforgeable` attribute only specified upon\n// `Location`'s properties. See:\n// - https://html.spec.whatwg.org/multipage/history.html#the-location-interface\n// - https://heycam.github.io/webidl/#LegacyUnforgeable\nclass Location {\n constructor(href: string | null = null) {\n const url = new URL(\n // @ts-expect-error\n href\n );\n\n url.username = '';\n\n url.password = '';\n Object.defineProperties(this, {\n hash: {\n get() {\n return url.hash;\n },\n set() {\n throw new DOMException(`Cannot set \"location.hash\".`, 'NotSupportedError');\n },\n enumerable: true,\n },\n host: {\n get() {\n return url.host;\n },\n set() {\n throw new DOMException(`Cannot set \"location.host\".`, 'NotSupportedError');\n },\n enumerable: true,\n },\n hostname: {\n get() {\n return url.hostname;\n },\n set() {\n throw new DOMException(`Cannot set \"location.hostname\".`, 'NotSupportedError');\n },\n enumerable: true,\n },\n href: {\n get() {\n return url.href;\n },\n set() {\n throw new DOMException(`Cannot set \"location.href\".`, 'NotSupportedError');\n },\n enumerable: true,\n },\n origin: {\n get() {\n return url.origin;\n },\n enumerable: true,\n },\n pathname: {\n get() {\n return url.pathname;\n },\n set() {\n throw new DOMException(`Cannot set \"location.pathname\".`, 'NotSupportedError');\n },\n enumerable: true,\n },\n port: {\n get() {\n return url.port;\n },\n set() {\n throw new DOMException(`Cannot set \"location.port\".`, 'NotSupportedError');\n },\n enumerable: true,\n },\n protocol: {\n get() {\n return url.protocol;\n },\n set() {\n throw new DOMException(`Cannot set \"location.protocol\".`, 'NotSupportedError');\n },\n enumerable: true,\n },\n search: {\n get() {\n return url.search;\n },\n set() {\n throw new DOMException(`Cannot set \"location.search\".`, 'NotSupportedError');\n },\n enumerable: true,\n },\n ancestorOrigins: {\n get() {\n return {\n length: 0,\n item: () => null,\n contains: () => false,\n };\n },\n enumerable: true,\n },\n assign: {\n value: function assign() {\n throw new DOMException(`Cannot call \"location.assign()\".`, 'NotSupportedError');\n },\n enumerable: true,\n },\n reload: {\n value: function reload() {\n if (process.env.NODE_ENV !== 'production') {\n // NOTE: This does change how native fast refresh works. The upstream metro-runtime will check\n // if `location.reload` exists before falling back on an implementation that is nearly identical to\n // this. The main difference is that on iOS there is a \"reason\" message sent, but at the time of writing\n // this, that message is unused (ref: `RCTTriggerReloadCommandNotification`).\n const DevSettings = (require('react-native') as typeof import('react-native'))\n .DevSettings;\n return DevSettings.reload();\n } else {\n throw new DOMException(`Cannot call \"location.reload()\".`, 'NotSupportedError');\n }\n },\n enumerable: true,\n },\n replace: {\n value: function replace() {\n throw new DOMException(`Cannot call \"location.replace()\".`, 'NotSupportedError');\n },\n enumerable: true,\n },\n toString: {\n value: function toString() {\n return url.href;\n },\n enumerable: true,\n },\n [Symbol.for('Expo.privateCustomInspect')]: {\n value(inspect: any) {\n const object = {\n hash: this.hash,\n host: this.host,\n hostname: this.hostname,\n href: this.href,\n origin: this.origin,\n pathname: this.pathname,\n port: this.port,\n protocol: this.protocol,\n search: this.search,\n };\n return `${this.constructor.name} ${inspect(object)}`;\n },\n },\n });\n }\n}\n\nObject.defineProperties(Location.prototype, {\n [Symbol.toString()]: {\n value: 'Location',\n configurable: true,\n },\n});\n\nlet location: Location | undefined = undefined;\n\nexport function setLocationHref(href: string) {\n location = new Location(href);\n}\n\nexport function install() {\n Object.defineProperty(global, 'Location', {\n value: Location,\n configurable: true,\n writable: true,\n });\n\n Object.defineProperty(window, 'location', {\n get() {\n return location;\n },\n set() {\n throw new DOMException(`Cannot set \"location\".`, 'NotSupportedError');\n },\n enumerable: true,\n });\n}\n"]}
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  // This MUST be first to ensure that `fetch` is defined in the React Native environment.
7
7
  require("react-native/Libraries/Core/InitializeCore");
8
8
  const expo_constants_1 = __importDefault(require("expo-constants"));
9
- const url_parse_1 = __importDefault(require("url-parse"));
10
9
  const Location_1 = require("./Location");
11
10
  const getDevServer_1 = __importDefault(require("../getDevServer"));
12
11
  let hasWarned = false;
@@ -47,14 +46,14 @@ function wrapFetchWithWindowLocation(fetch) {
47
46
  if (process.env.NODE_ENV !== 'production') {
48
47
  warnProductionOriginNotConfigured(props[0]);
49
48
  }
50
- props[0] = new url_parse_1.default(props[0], window.location?.origin).toString();
49
+ props[0] = new URL(props[0], window.location?.origin).toString();
51
50
  }
52
51
  else if (props[0] && typeof props[0] === 'object') {
53
52
  if (props[0].url && typeof props[0].url === 'string' && props[0].url.startsWith('/')) {
54
53
  if (process.env.NODE_ENV !== 'production') {
55
54
  warnProductionOriginNotConfigured(props[0]);
56
55
  }
57
- props[0].url = new url_parse_1.default(props[0].url, window.location?.origin).toString();
56
+ props[0].url = new URL(props[0].url, window.location?.origin).toString();
58
57
  }
59
58
  }
60
59
  return fetch(...props);
@@ -1 +1 @@
1
- {"version":3,"file":"install.native.js","sourceRoot":"","sources":["../../src/location/install.native.ts"],"names":[],"mappings":";;;;;AAAA,wFAAwF;AACxF,sDAAoD;AAEpD,oEAAuC;AACvC,0DAA4B;AAE5B,yCAAsD;AAC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ACrB,IAAA,kBAAO,GAAE,CAAC;SACX;KACF;IACD,iDAAiD;IACjD,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE;QACrC,KAAK,EAAE,2BAA2B,CAAC,KAAK,CAAC;KAC1C,CAAC,CAAC;CACJ","sourcesContent":["// This MUST be first to ensure that `fetch` is defined in the React Native environment.\nimport 'react-native/Libraries/Core/InitializeCore';\n\nimport Constants from 'expo-constants';\nimport URL from 'url-parse';\n\nimport { install, setLocationHref } from './Location';\nimport getDevServer from '../getDevServer';\n\nlet hasWarned = false;\n\nconst manifest = Constants.expoConfig as Record<string, any> | null;\n\n// Add a development warning for fetch requests with relative paths\n// to ensure developers are aware of the need to configure a production\n// base URL in the Expo config (app.json) under `expo.extra.router.origin`.\nfunction warnProductionOriginNotConfigured(requestUrl: string) {\n if (hasWarned) {\n return;\n }\n hasWarned = true;\n if (!manifest?.extra?.router?.origin) {\n console.warn(\n `The relative fetch request \"${requestUrl}\" will not work in production until the Expo Router Config Plugin (app.json) is configured with the \\`origin\\` prop set to the base URL of your web server, e.g. \\`{ plugins: [[\"expo-router\", { origin: \"...\" }]] }\\`. [Learn more](https://expo.github.io/router/docs/lab/runtime-location)`\n );\n }\n}\n\n// TODO: This would be better if native and tied as close to the JS engine as possible, i.e. it should\n// reflect the exact location of the JS file that was executed.\nfunction getBaseUrl() {\n if (process.env.NODE_ENV !== 'production') {\n // e.g. http://localhost:19006\n return getDevServer().url?.replace(/\\/$/, '');\n }\n\n // TODO: Make it official by moving out of `extra`\n const productionBaseUrl = manifest?.extra?.router?.origin;\n\n if (!productionBaseUrl) {\n return null;\n }\n\n // Ensure no trailing slash\n return productionBaseUrl?.replace(/\\/$/, '');\n}\n\nfunction wrapFetchWithWindowLocation(fetch: Function & { __EXPO_BASE_URL_POLYFILLED?: boolean }) {\n if (fetch.__EXPO_BASE_URL_POLYFILLED) {\n return fetch;\n }\n\n const _fetch = (...props: any[]) => {\n if (props[0] && typeof props[0] === 'string' && props[0].startsWith('/')) {\n if (process.env.NODE_ENV !== 'production') {\n warnProductionOriginNotConfigured(props[0]);\n }\n\n props[0] = new URL(props[0], window.location?.origin).toString();\n } else if (props[0] && typeof props[0] === 'object') {\n if (props[0].url && typeof props[0].url === 'string' && props[0].url.startsWith('/')) {\n if (process.env.NODE_ENV !== 'production') {\n warnProductionOriginNotConfigured(props[0]);\n }\n\n props[0].url = new URL(props[0].url, window.location?.origin).toString();\n }\n }\n return fetch(...props);\n };\n\n _fetch.__EXPO_BASE_URL_POLYFILLED = true;\n\n return _fetch;\n}\n\nif (manifest?.extra?.router?.origin !== false) {\n // Polyfill window.location in native runtimes.\n if (typeof window !== 'undefined' && !window.location) {\n const url = getBaseUrl();\n if (url) {\n setLocationHref(url);\n install();\n }\n }\n // Polyfill native fetch to support relative URLs\n Object.defineProperty(global, 'fetch', {\n value: wrapFetchWithWindowLocation(fetch),\n });\n}\n"]}
1
+ {"version":3,"file":"install.native.js","sourceRoot":"","sources":["../../src/location/install.native.ts"],"names":[],"mappings":";;;;;AAAA,wFAAwF;AACxF,sDAAoD;AAEpD,oEAAuC;AAEvC,yCAAsD;AACtD,mEAA2C;AAE3C,IAAI,SAAS,GAAG,KAAK,CAAC;AAEtB,MAAM,QAAQ,GAAG,wBAAS,CAAC,UAAwC,CAAC;AAEpE,mEAAmE;AACnE,uEAAuE;AACvE,2EAA2E;AAC3E,SAAS,iCAAiC,CAAC,UAAkB;IAC3D,IAAI,SAAS,EAAE;QACb,OAAO;KACR;IACD,SAAS,GAAG,IAAI,CAAC;IACjB,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE;QACpC,OAAO,CAAC,IAAI,CACV,+BAA+B,UAAU,+RAA+R,CACzU,CAAC;KACH;AACH,CAAC;AAED,sGAAsG;AACtG,+DAA+D;AAC/D,SAAS,UAAU;IACjB,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;QACzC,8BAA8B;QAC9B,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G,CAAC,QAAQ,KAAK,YAAY,EAAE;oBACzC,iCAAiC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;iBAC7C;gBAED,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC;aAC1E;SACF;QACD,OAAO,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC;IACzB,CAAC,CAAC;IAEF,MAAM,CAAC,0BAA0B,GAAG,IAAI,CAAC;IAEzC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,IAAI,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,KAAK,KAAK,EAAE;IAC7C,+CAA+C;IAC/C,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;QACrD,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;QACzB,IAAI,GAAG,EAAE;YACP,IAAA,0BAAe,EAAC,GAAG,CAAC,CAAC;YACrB,IAAA,kBAAO,GAAE,CAAC;SACX;KACF;IACD,iDAAiD;IACjD,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE;QACrC,KAAK,EAAE,2BAA2B,CAAC,KAAK,CAAC;KAC1C,CAAC,CAAC;CACJ","sourcesContent":["// This MUST be first to ensure that `fetch` is defined in the React Native environment.\nimport 'react-native/Libraries/Core/InitializeCore';\n\nimport Constants from 'expo-constants';\n\nimport { install, setLocationHref } from './Location';\nimport getDevServer from '../getDevServer';\n\nlet hasWarned = false;\n\nconst manifest = Constants.expoConfig as Record<string, any> | null;\n\n// Add a development warning for fetch requests with relative paths\n// to ensure developers are aware of the need to configure a production\n// base URL in the Expo config (app.json) under `expo.extra.router.origin`.\nfunction warnProductionOriginNotConfigured(requestUrl: string) {\n if (hasWarned) {\n return;\n }\n hasWarned = true;\n if (!manifest?.extra?.router?.origin) {\n console.warn(\n `The relative fetch request \"${requestUrl}\" will not work in production until the Expo Router Config Plugin (app.json) is configured with the \\`origin\\` prop set to the base URL of your web server, e.g. \\`{ plugins: [[\"expo-router\", { origin: \"...\" }]] }\\`. [Learn more](https://expo.github.io/router/docs/lab/runtime-location)`\n );\n }\n}\n\n// TODO: This would be better if native and tied as close to the JS engine as possible, i.e. it should\n// reflect the exact location of the JS file that was executed.\nfunction getBaseUrl() {\n if (process.env.NODE_ENV !== 'production') {\n // e.g. http://localhost:19006\n return getDevServer().url?.replace(/\\/$/, '');\n }\n\n // TODO: Make it official by moving out of `extra`\n const productionBaseUrl = manifest?.extra?.router?.origin;\n\n if (!productionBaseUrl) {\n return null;\n }\n\n // Ensure no trailing slash\n return productionBaseUrl?.replace(/\\/$/, '');\n}\n\nfunction wrapFetchWithWindowLocation(fetch: Function & { __EXPO_BASE_URL_POLYFILLED?: boolean }) {\n if (fetch.__EXPO_BASE_URL_POLYFILLED) {\n return fetch;\n }\n\n const _fetch = (...props: any[]) => {\n if (props[0] && typeof props[0] === 'string' && props[0].startsWith('/')) {\n if (process.env.NODE_ENV !== 'production') {\n warnProductionOriginNotConfigured(props[0]);\n }\n\n props[0] = new URL(props[0], window.location?.origin).toString();\n } else if (props[0] && typeof props[0] === 'object') {\n if (props[0].url && typeof props[0].url === 'string' && props[0].url.startsWith('/')) {\n if (process.env.NODE_ENV !== 'production') {\n warnProductionOriginNotConfigured(props[0]);\n }\n\n props[0].url = new URL(props[0].url, window.location?.origin).toString();\n }\n }\n return fetch(...props);\n };\n\n _fetch.__EXPO_BASE_URL_POLYFILLED = true;\n\n return _fetch;\n}\n\nif (manifest?.extra?.router?.origin !== false) {\n // Polyfill window.location in native runtimes.\n if (typeof window !== 'undefined' && !window.location) {\n const url = getBaseUrl();\n if (url) {\n setLocationHref(url);\n install();\n }\n }\n // Polyfill native fetch to support relative URLs\n Object.defineProperty(global, 'fetch', {\n value: wrapFetchWithWindowLocation(fetch),\n });\n}\n"]}
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@expo/metro-runtime",
3
- "version": "3.0.3",
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,24 +36,5 @@
36
36
  "peerDependencies": {
37
37
  "react-native": "*"
38
38
  },
39
- "dependencies": {
40
- "qs": "^6.10.3"
41
- },
42
- "jest": {
43
- "projects": [
44
- {
45
- "preset": "jest-expo/ios",
46
- "clearMocks": true
47
- },
48
- {
49
- "preset": "jest-expo/android",
50
- "clearMocks": true
51
- },
52
- {
53
- "preset": "jest-expo/web",
54
- "clearMocks": true
55
- }
56
- ]
57
- },
58
- "gitHead": "ee7897097f5f946ad7fcb94447eed789b984dd02"
39
+ "gitHead": "2763e9cc6f2317b40da73382fe2595f8deebff46"
59
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
- // Send a signal to the `expo` package to show the loading indicator.
28
- LoadingView.showMessage('Downloading...', 'load');
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
- if (process.env.NODE_ENV !== 'production') {
35
- const HMRClient = require('../HMRClient')
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
- boxShadow: `0 -2px 0 2px #000`,
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
- boxShadow: `0 2px 0 2px #00000080`,
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
- textShadow: `0px 0px 3px ${LogBoxStyle.getBackgroundColor(0.8)}`,
131
+ ...Platform.select({
132
+ web: {
133
+ textShadow: `0px 0px 3px ${LogBoxStyle.getBackgroundColor(0.8)}`,
134
+ },
135
+ }),
132
136
  },
133
137
  });
134
138
 
@@ -1,5 +1,3 @@
1
- import qs from 'qs';
2
-
3
1
  const getDevServer = () => {
4
2
  // Disable for SSR
5
3
  if (typeof window === 'undefined') {
@@ -20,12 +18,11 @@ const getDevServer = () => {
20
18
  return document.currentScript.src;
21
19
  }
22
20
 
23
- const url = window.location.toString();
24
- const query = qs.parse(url);
21
+ const bundleUrl = new URL(location.href);
22
+
23
+ bundleUrl.searchParams.set('platform', 'web');
25
24
 
26
- return (
27
- location.origin + location.pathname + '?' + qs.stringify({ ...query, platform: 'web' })
28
- );
25
+ return bundleUrl.toString();
29
26
  },
30
27
  url: location.origin + location.pathname,
31
28
  };
@@ -1,8 +1,6 @@
1
1
  // Copyright © 2023 650 Industries.
2
2
  // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
3
3
 
4
- import URL from 'url-parse';
5
-
6
4
  class DOMException extends Error {
7
5
  constructor(message: string, name: string) {
8
6
  super(message);
@@ -21,9 +19,9 @@ class Location {
21
19
  // @ts-expect-error
22
20
  href
23
21
  );
24
- // @ts-expect-error
22
+
25
23
  url.username = '';
26
- // @ts-expect-error
24
+
27
25
  url.password = '';
28
26
  Object.defineProperties(this, {
29
27
  hash: {
@@ -97,7 +95,6 @@ class Location {
97
95
  },
98
96
  search: {
99
97
  get() {
100
- // @ts-expect-error
101
98
  return url.search;
102
99
  },
103
100
  set() {
@@ -2,7 +2,6 @@
2
2
  import 'react-native/Libraries/Core/InitializeCore';
3
3
 
4
4
  import Constants from 'expo-constants';
5
- import URL from 'url-parse';
6
5
 
7
6
  import { install, setLocationHref } from './Location';
8
7
  import getDevServer from '../getDevServer';