@expo/metro-runtime 3.0.0 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/build/HMRClient.js +43 -15
  2. package/build/HMRClient.js.map +1 -1
  3. package/build/HMRClient.native.js +3 -1
  4. package/build/HMRClient.native.js.map +1 -1
  5. package/build/LoadingView.d.ts +6 -0
  6. package/build/LoadingView.d.ts.map +1 -1
  7. package/build/LoadingView.js +12 -4
  8. package/build/LoadingView.js.map +1 -1
  9. package/build/LoadingView.native.js +7 -2
  10. package/build/LoadingView.native.js.map +1 -1
  11. package/build/async-require/buildAsyncRequire.js +7 -3
  12. package/build/async-require/buildAsyncRequire.js.map +1 -1
  13. package/build/async-require/buildUrlForBundle.js +5 -1
  14. package/build/async-require/buildUrlForBundle.js.map +1 -1
  15. package/build/async-require/buildUrlForBundle.native.js +5 -1
  16. package/build/async-require/buildUrlForBundle.native.js.map +1 -1
  17. package/build/async-require/fetchAsync.d.ts +6 -0
  18. package/build/async-require/fetchAsync.d.ts.map +1 -1
  19. package/build/async-require/fetchAsync.js +6 -3
  20. package/build/async-require/fetchAsync.js.map +1 -1
  21. package/build/async-require/fetchAsync.native.js +13 -6
  22. package/build/async-require/fetchAsync.native.js.map +1 -1
  23. package/build/async-require/fetchThenEval.d.ts +1 -6
  24. package/build/async-require/fetchThenEval.d.ts.map +1 -1
  25. package/build/async-require/fetchThenEval.js +5 -31
  26. package/build/async-require/fetchThenEval.js.map +1 -1
  27. package/build/async-require/fetchThenEval.web.js +6 -2
  28. package/build/async-require/fetchThenEval.web.js.map +1 -1
  29. package/build/async-require/fetchThenEvalJs.d.ts +7 -0
  30. package/build/async-require/fetchThenEvalJs.d.ts.map +1 -0
  31. package/build/async-require/fetchThenEvalJs.js +36 -0
  32. package/build/async-require/fetchThenEvalJs.js.map +1 -0
  33. package/build/async-require/index.js +4 -2
  34. package/build/async-require/index.js.map +1 -1
  35. package/build/async-require/index.native.d.ts +7 -0
  36. package/build/async-require/index.native.d.ts.map +1 -0
  37. package/build/async-require/index.native.js +14 -0
  38. package/build/async-require/index.native.js.map +1 -0
  39. package/build/async-require/loadBundle.js +10 -6
  40. package/build/async-require/loadBundle.js.map +1 -1
  41. package/build/effects.d.ts +0 -1
  42. package/build/effects.js +7 -10
  43. package/build/effects.js.map +1 -1
  44. package/build/error-overlay/Data/LogBoxData.d.ts.map +1 -1
  45. package/build/error-overlay/Data/LogBoxData.js +82 -33
  46. package/build/error-overlay/Data/LogBoxData.js.map +1 -1
  47. package/build/error-overlay/Data/LogBoxLog.js +29 -2
  48. package/build/error-overlay/Data/LogBoxLog.js.map +1 -1
  49. package/build/error-overlay/Data/LogBoxSymbolication.js +12 -4
  50. package/build/error-overlay/Data/LogBoxSymbolication.js.map +1 -1
  51. package/build/error-overlay/Data/LogContext.js +17 -9
  52. package/build/error-overlay/Data/LogContext.js.map +1 -1
  53. package/build/error-overlay/Data/parseLogBoxLog.d.ts.map +1 -1
  54. package/build/error-overlay/Data/parseLogBoxLog.js +20 -11
  55. package/build/error-overlay/Data/parseLogBoxLog.js.map +1 -1
  56. package/build/error-overlay/ErrorOverlay.d.ts.map +1 -1
  57. package/build/error-overlay/ErrorOverlay.js +73 -41
  58. package/build/error-overlay/ErrorOverlay.js.map +1 -1
  59. package/build/error-overlay/LogBox.js +3 -1
  60. package/build/error-overlay/LogBox.js.map +1 -1
  61. package/build/error-overlay/LogBox.web.d.ts.map +1 -1
  62. package/build/error-overlay/LogBox.web.js +4 -3
  63. package/build/error-overlay/LogBox.web.js.map +1 -1
  64. package/build/error-overlay/UI/AnsiHighlight.js +15 -8
  65. package/build/error-overlay/UI/AnsiHighlight.js.map +1 -1
  66. package/build/error-overlay/UI/LogBoxButton.js +35 -8
  67. package/build/error-overlay/UI/LogBoxButton.js.map +1 -1
  68. package/build/error-overlay/UI/LogBoxMessage.js +13 -6
  69. package/build/error-overlay/UI/LogBoxMessage.js.map +1 -1
  70. package/build/error-overlay/UI/LogBoxStyle.js +31 -14
  71. package/build/error-overlay/UI/LogBoxStyle.js.map +1 -1
  72. package/build/error-overlay/UI/constants.js +5 -2
  73. package/build/error-overlay/UI/constants.js.map +1 -1
  74. package/build/error-overlay/formatProjectFilePath.js +7 -2
  75. package/build/error-overlay/formatProjectFilePath.js.map +1 -1
  76. package/build/error-overlay/index.d.ts.map +1 -1
  77. package/build/error-overlay/index.js +19 -9
  78. package/build/error-overlay/index.js.map +1 -1
  79. package/build/error-overlay/modules/ExceptionsManager/index.js +8 -3
  80. package/build/error-overlay/modules/ExceptionsManager/index.js.map +1 -1
  81. package/build/error-overlay/modules/ExceptionsManager/index.native.js +7 -2
  82. package/build/error-overlay/modules/ExceptionsManager/index.native.js.map +1 -1
  83. package/build/error-overlay/modules/NativeLogBox/index.js +10 -5
  84. package/build/error-overlay/modules/NativeLogBox/index.js.map +1 -1
  85. package/build/error-overlay/modules/NativeLogBox/index.native.js +7 -2
  86. package/build/error-overlay/modules/NativeLogBox/index.native.js.map +1 -1
  87. package/build/error-overlay/modules/openFileInEditor/index.js +3 -1
  88. package/build/error-overlay/modules/openFileInEditor/index.js.map +1 -1
  89. package/build/error-overlay/modules/openFileInEditor/index.native.js +7 -2
  90. package/build/error-overlay/modules/openFileInEditor/index.native.js.map +1 -1
  91. package/build/error-overlay/modules/parseErrorStack/index.d.ts.map +1 -1
  92. package/build/error-overlay/modules/parseErrorStack/index.js +10 -7
  93. package/build/error-overlay/modules/parseErrorStack/index.js.map +1 -1
  94. package/build/error-overlay/modules/parseErrorStack/parseHermesStack.js +8 -2
  95. package/build/error-overlay/modules/parseErrorStack/parseHermesStack.js.map +1 -1
  96. package/build/error-overlay/modules/stringifySafe/index.js +6 -2
  97. package/build/error-overlay/modules/stringifySafe/index.js.map +1 -1
  98. package/build/error-overlay/modules/symbolicateStackTrace/index.js +3 -1
  99. package/build/error-overlay/modules/symbolicateStackTrace/index.js.map +1 -1
  100. package/build/error-overlay/modules/symbolicateStackTrace/index.native.js +7 -2
  101. package/build/error-overlay/modules/symbolicateStackTrace/index.native.js.map +1 -1
  102. package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.d.ts.map +1 -1
  103. package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.js +52 -22
  104. package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.js.map +1 -1
  105. package/build/error-overlay/overlay/LogBoxInspectorFooter.js +48 -18
  106. package/build/error-overlay/overlay/LogBoxInspectorFooter.js.map +1 -1
  107. package/build/error-overlay/overlay/LogBoxInspectorHeader.js +53 -23
  108. package/build/error-overlay/overlay/LogBoxInspectorHeader.js.map +1 -1
  109. package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.js +43 -13
  110. package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.js.map +1 -1
  111. package/build/error-overlay/overlay/LogBoxInspectorSection.js +39 -9
  112. package/build/error-overlay/overlay/LogBoxInspectorSection.js.map +1 -1
  113. package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.js +41 -14
  114. package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.js.map +1 -1
  115. package/build/error-overlay/overlay/LogBoxInspectorStackFrame.js +44 -14
  116. package/build/error-overlay/overlay/LogBoxInspectorStackFrame.js.map +1 -1
  117. package/build/error-overlay/overlay/LogBoxInspectorStackFrames.d.ts.map +1 -1
  118. package/build/error-overlay/overlay/LogBoxInspectorStackFrames.js +55 -24
  119. package/build/error-overlay/overlay/LogBoxInspectorStackFrames.js.map +1 -1
  120. package/build/error-overlay/toast/ErrorToast.d.ts.map +1 -1
  121. package/build/error-overlay/toast/ErrorToast.js +48 -21
  122. package/build/error-overlay/toast/ErrorToast.js.map +1 -1
  123. package/build/error-overlay/toast/ErrorToastContainer.js +9 -3
  124. package/build/error-overlay/toast/ErrorToastContainer.js.map +1 -1
  125. package/build/error-overlay/toast/ErrorToastContainer.web.d.ts.map +1 -1
  126. package/build/error-overlay/toast/ErrorToastContainer.web.js +49 -21
  127. package/build/error-overlay/toast/ErrorToastContainer.web.js.map +1 -1
  128. package/build/error-overlay/toast/ErrorToastMessage.js +37 -7
  129. package/build/error-overlay/toast/ErrorToastMessage.js.map +1 -1
  130. package/build/error-overlay/useRejectionHandler.js +16 -9
  131. package/build/error-overlay/useRejectionHandler.js.map +1 -1
  132. package/build/getDevServer.d.ts.map +1 -1
  133. package/build/getDevServer.js +10 -9
  134. package/build/getDevServer.js.map +1 -1
  135. package/build/getDevServer.native.js +7 -2
  136. package/build/getDevServer.native.js.map +1 -1
  137. package/build/index.d.ts +7 -0
  138. package/build/index.d.ts.map +1 -1
  139. package/build/index.js +12 -8
  140. package/build/index.js.map +1 -1
  141. package/build/location/Location.js +7 -2
  142. package/build/location/Location.js.map +1 -1
  143. package/build/location/Location.native.js +12 -4
  144. package/build/location/Location.native.js.map +1 -1
  145. package/build/location/install.native.js +16 -11
  146. package/build/location/install.native.js.map +1 -1
  147. package/build/setupHMR.js +28 -26
  148. package/build/setupHMR.js.map +1 -1
  149. package/build/symbolicate.js +25 -4
  150. package/build/symbolicate.js.map +1 -1
  151. package/package.json +5 -2
  152. package/src/HMRClient.native.ts +3 -0
  153. package/src/HMRClient.ts +316 -0
  154. package/src/LoadingView.native.ts +3 -0
  155. package/src/LoadingView.ts +24 -0
  156. package/src/__mocks__/LoadingView.ts +4 -0
  157. package/src/async-require/buildAsyncRequire.ts +34 -0
  158. package/src/async-require/buildUrlForBundle.native.ts +28 -0
  159. package/src/async-require/buildUrlForBundle.ts +18 -0
  160. package/src/async-require/fetchAsync.native.ts +72 -0
  161. package/src/async-require/fetchAsync.ts +19 -0
  162. package/src/async-require/fetchThenEval.ts +1 -0
  163. package/src/async-require/fetchThenEval.web.ts +70 -0
  164. package/src/async-require/fetchThenEvalJs.ts +39 -0
  165. package/src/async-require/index.native.ts +15 -0
  166. package/src/async-require/index.ts +10 -0
  167. package/src/async-require/loadBundle.ts +46 -0
  168. package/src/effects.native.ts +0 -0
  169. package/src/effects.ts +11 -0
  170. package/src/error-overlay/Data/LogBoxData.tsx +438 -0
  171. package/src/error-overlay/Data/LogBoxLog.ts +221 -0
  172. package/src/error-overlay/Data/LogBoxSymbolication.tsx +64 -0
  173. package/src/error-overlay/Data/LogContext.tsx +41 -0
  174. package/src/error-overlay/Data/parseLogBoxLog.tsx +342 -0
  175. package/src/error-overlay/ErrorOverlay.tsx +191 -0
  176. package/src/error-overlay/LogBox.ts +51 -0
  177. package/src/error-overlay/LogBox.web.ts +174 -0
  178. package/src/error-overlay/UI/AnsiHighlight.tsx +96 -0
  179. package/src/error-overlay/UI/LogBoxButton.tsx +63 -0
  180. package/src/error-overlay/UI/LogBoxMessage.tsx +73 -0
  181. package/src/error-overlay/UI/LogBoxStyle.ts +64 -0
  182. package/src/error-overlay/UI/constants.ts +7 -0
  183. package/src/error-overlay/formatProjectFilePath.ts +38 -0
  184. package/src/error-overlay/index.tsx +34 -0
  185. package/src/error-overlay/modules/ExceptionsManager/index.native.ts +4 -0
  186. package/src/error-overlay/modules/ExceptionsManager/index.ts +82 -0
  187. package/src/error-overlay/modules/NativeLogBox/index.native.ts +3 -0
  188. package/src/error-overlay/modules/NativeLogBox/index.tsx +27 -0
  189. package/src/error-overlay/modules/openFileInEditor/index.native.ts +3 -0
  190. package/src/error-overlay/modules/openFileInEditor/index.ts +16 -0
  191. package/src/error-overlay/modules/parseErrorStack/index.ts +26 -0
  192. package/src/error-overlay/modules/parseErrorStack/parseHermesStack.ts +3 -0
  193. package/src/error-overlay/modules/stringifySafe/index.ts +115 -0
  194. package/src/error-overlay/modules/symbolicateStackTrace/index.native.ts +3 -0
  195. package/src/error-overlay/modules/symbolicateStackTrace/index.ts +39 -0
  196. package/src/error-overlay/overlay/LogBoxInspectorCodeFrame.tsx +102 -0
  197. package/src/error-overlay/overlay/LogBoxInspectorFooter.tsx +111 -0
  198. package/src/error-overlay/overlay/LogBoxInspectorHeader.tsx +167 -0
  199. package/src/error-overlay/overlay/LogBoxInspectorMessageHeader.tsx +116 -0
  200. package/src/error-overlay/overlay/LogBoxInspectorSection.tsx +52 -0
  201. package/src/error-overlay/overlay/LogBoxInspectorSourceMapStatus.tsx +125 -0
  202. package/src/error-overlay/overlay/LogBoxInspectorStackFrame.tsx +89 -0
  203. package/src/error-overlay/overlay/LogBoxInspectorStackFrames.tsx +201 -0
  204. package/src/error-overlay/toast/ErrorToast.tsx +167 -0
  205. package/src/error-overlay/toast/ErrorToastContainer.tsx +9 -0
  206. package/src/error-overlay/toast/ErrorToastContainer.web.tsx +92 -0
  207. package/src/error-overlay/toast/ErrorToastMessage.tsx +28 -0
  208. package/src/error-overlay/useRejectionHandler.ts +61 -0
  209. package/src/getDevServer.native.ts +3 -0
  210. package/src/getDevServer.ts +34 -0
  211. package/src/index.ts +12 -0
  212. package/src/location/Location.native.ts +201 -0
  213. package/src/location/Location.ts +3 -0
  214. package/src/location/install.native.ts +90 -0
  215. package/src/location/install.ts +0 -0
  216. package/src/messageSocket.ts +25 -0
  217. package/src/setupFastRefresh.ts +30 -0
  218. package/src/setupHMR.ts +28 -0
  219. package/src/symbolicate.ts +6 -0
@@ -1,11 +1,41 @@
1
- import React from 'react';
2
- import { StyleSheet, Text } from 'react-native';
3
- import { LogBoxMessage } from '../UI/LogBoxMessage';
4
- import * as LogBoxStyle from '../UI/LogBoxStyle';
5
- export function ErrorToastMessage({ message }) {
6
- return (React.createElement(Text, { numberOfLines: 1, style: styles.text }, message && React.createElement(LogBoxMessage, { plaintext: true, message: message, style: styles.substitutionText })));
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.ErrorToastMessage = void 0;
30
+ const react_1 = __importDefault(require("react"));
31
+ const react_native_1 = require("react-native");
32
+ const LogBoxMessage_1 = require("../UI/LogBoxMessage");
33
+ const LogBoxStyle = __importStar(require("../UI/LogBoxStyle"));
34
+ function ErrorToastMessage({ message }) {
35
+ return (react_1.default.createElement(react_native_1.Text, { numberOfLines: 1, style: styles.text }, message && react_1.default.createElement(LogBoxMessage_1.LogBoxMessage, { plaintext: true, message: message, style: styles.substitutionText })));
7
36
  }
8
- const styles = StyleSheet.create({
37
+ exports.ErrorToastMessage = ErrorToastMessage;
38
+ const styles = react_native_1.StyleSheet.create({
9
39
  text: {
10
40
  userSelect: 'none',
11
41
  paddingLeft: 8,
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorToastMessage.js","sourceRoot":"","sources":["../../../src/error-overlay/toast/ErrorToastMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAGhD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,WAAW,MAAM,mBAAmB,CAAC;AAEjD,MAAM,UAAU,iBAAiB,CAAC,EAAE,OAAO,EAA6B;IACtE,OAAO,CACL,oBAAC,IAAI,IAAC,aAAa,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,IACvC,OAAO,IAAI,oBAAC,aAAa,IAAC,SAAS,QAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,gBAAgB,GAAI,CACpF,CACR,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE;QACJ,UAAU,EAAE,MAAM;QAClB,WAAW,EAAE,CAAC;QACd,KAAK,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC;QAClC,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,EAAE;KACf;IACD,gBAAgB,EAAE;QAChB,KAAK,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC;KACrC;CACF,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { StyleSheet, Text } from 'react-native';\n\nimport type { Message as MessageType } from '../Data/parseLogBoxLog';\nimport { LogBoxMessage } from '../UI/LogBoxMessage';\nimport * as LogBoxStyle from '../UI/LogBoxStyle';\n\nexport function ErrorToastMessage({ message }: { message?: MessageType }) {\n return (\n <Text numberOfLines={1} style={styles.text}>\n {message && <LogBoxMessage plaintext message={message} style={styles.substitutionText} />}\n </Text>\n );\n}\n\nconst styles = StyleSheet.create({\n text: {\n userSelect: 'none',\n paddingLeft: 8,\n color: LogBoxStyle.getTextColor(1),\n flex: 1,\n fontSize: 14,\n lineHeight: 22,\n },\n substitutionText: {\n color: LogBoxStyle.getTextColor(0.6),\n },\n});\n"]}
1
+ {"version":3,"file":"ErrorToastMessage.js","sourceRoot":"","sources":["../../../src/error-overlay/toast/ErrorToastMessage.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,+CAAgD;AAGhD,uDAAoD;AACpD,+DAAiD;AAEjD,SAAgB,iBAAiB,CAAC,EAAE,OAAO,EAA6B;IACtE,OAAO,CACL,8BAAC,mBAAI,IAAC,aAAa,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,IACvC,OAAO,IAAI,8BAAC,6BAAa,IAAC,SAAS,QAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,gBAAgB,GAAI,CACpF,CACR,CAAC;AACJ,CAAC;AAND,8CAMC;AAED,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE;QACJ,UAAU,EAAE,MAAM;QAClB,WAAW,EAAE,CAAC;QACd,KAAK,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC;QAClC,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,EAAE;KACf;IACD,gBAAgB,EAAE;QAChB,KAAK,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC;KACrC;CACF,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { StyleSheet, Text } from 'react-native';\n\nimport type { Message as MessageType } from '../Data/parseLogBoxLog';\nimport { LogBoxMessage } from '../UI/LogBoxMessage';\nimport * as LogBoxStyle from '../UI/LogBoxStyle';\n\nexport function ErrorToastMessage({ message }: { message?: MessageType }) {\n return (\n <Text numberOfLines={1} style={styles.text}>\n {message && <LogBoxMessage plaintext message={message} style={styles.substitutionText} />}\n </Text>\n );\n}\n\nconst styles = StyleSheet.create({\n text: {\n userSelect: 'none',\n paddingLeft: 8,\n color: LogBoxStyle.getTextColor(1),\n flex: 1,\n fontSize: 14,\n lineHeight: 22,\n },\n substitutionText: {\n color: LogBoxStyle.getTextColor(0.6),\n },\n});\n"]}
@@ -1,8 +1,14 @@
1
- import React from 'react';
2
- import ExceptionsManager from './modules/ExceptionsManager';
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.useRejectionHandler = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const ExceptionsManager_1 = __importDefault(require("./modules/ExceptionsManager"));
3
9
  function useStackTraceLimit(limit) {
4
- const current = React.useRef(0);
5
- React.useEffect(() => {
10
+ const current = react_1.default.useRef(0);
11
+ react_1.default.useEffect(() => {
6
12
  try {
7
13
  // @ts-expect-error: StackTraceLimit is not defined in the Error type
8
14
  const currentLimit = Error.stackTraceLimit;
@@ -20,17 +26,17 @@ function useStackTraceLimit(limit) {
20
26
  };
21
27
  }, [limit]);
22
28
  }
23
- export function useRejectionHandler() {
24
- const hasError = React.useRef(false);
29
+ function useRejectionHandler() {
30
+ const hasError = react_1.default.useRef(false);
25
31
  useStackTraceLimit(35);
26
- React.useEffect(() => {
32
+ react_1.default.useEffect(() => {
27
33
  function onUnhandledError(ev) {
28
34
  hasError.current = true;
29
35
  const error = ev?.error;
30
36
  if (!error || !(error instanceof Error) || typeof error.stack !== 'string') {
31
37
  return;
32
38
  }
33
- ExceptionsManager.handleException(error);
39
+ ExceptionsManager_1.default.handleException(error);
34
40
  }
35
41
  function onUnhandledRejection(ev) {
36
42
  hasError.current = true;
@@ -38,7 +44,7 @@ export function useRejectionHandler() {
38
44
  if (!reason || !(reason instanceof Error) || typeof reason.stack !== 'string') {
39
45
  return;
40
46
  }
41
- ExceptionsManager.handleException(reason);
47
+ ExceptionsManager_1.default.handleException(reason);
42
48
  }
43
49
  window.addEventListener('unhandledrejection', onUnhandledRejection);
44
50
  window.addEventListener('error', onUnhandledError);
@@ -49,4 +55,5 @@ export function useRejectionHandler() {
49
55
  }, []);
50
56
  return hasError;
51
57
  }
58
+ exports.useRejectionHandler = useRejectionHandler;
52
59
  //# sourceMappingURL=useRejectionHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useRejectionHandler.js","sourceRoot":"","sources":["../../src/error-overlay/useRejectionHandler.ts"],"names":[],"mappings":"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AAM,CAAC;YAC1B,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,MAAM,YAAY,KAAK,CAAC,IAAI,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,EAAE;gBAC7E,OAAO;aACR;YAED,iBAAiB,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;QAC5C,CAAC;QAED,MAAM,CAAC,gBAAgB,CAAC,oBAAoB,EAAE,oBAAoB,CAAC,CAAC;QACpE,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;QACnD,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;YACtD,MAAM,CAAC,mBAAmB,CAAC,oBAAoB,EAAE,oBAAoB,CAAC,CAAC;QACzE,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import React from 'react';\n\nimport ExceptionsManager from './modules/ExceptionsManager';\n\nfunction useStackTraceLimit(limit: number) {\n const current = React.useRef(0);\n React.useEffect(() => {\n try {\n // @ts-expect-error: StackTraceLimit is not defined in the Error type\n const currentLimit = Error.stackTraceLimit;\n // @ts-expect-error: StackTraceLimit is not defined in the Error type\n Error.stackTraceLimit = limit;\n current.current = currentLimit;\n } catch {}\n return () => {\n try {\n // @ts-expect-error: StackTraceLimit is not defined in the Error type\n Error.stackTraceLimit = current.current;\n } catch {}\n };\n }, [limit]);\n}\n\nexport function useRejectionHandler() {\n const hasError = React.useRef(false);\n\n useStackTraceLimit(35);\n\n React.useEffect(() => {\n function onUnhandledError(ev: ErrorEvent) {\n hasError.current = true;\n\n const error = ev?.error;\n if (!error || !(error instanceof Error) || typeof error.stack !== 'string') {\n return;\n }\n\n ExceptionsManager.handleException(error);\n }\n\n function onUnhandledRejection(ev: PromiseRejectionEvent) {\n hasError.current = true;\n\n const reason = ev?.reason;\n if (!reason || !(reason instanceof Error) || typeof reason.stack !== 'string') {\n return;\n }\n\n ExceptionsManager.handleException(reason);\n }\n\n window.addEventListener('unhandledrejection', onUnhandledRejection);\n window.addEventListener('error', onUnhandledError);\n return () => {\n window.removeEventListener('error', onUnhandledError);\n window.removeEventListener('unhandledrejection', onUnhandledRejection);\n };\n }, []);\n\n return hasError;\n}\n"]}
1
+ {"version":3,"file":"useRejectionHandler.js","sourceRoot":"","sources":["../../src/error-overlay/useRejectionHandler.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,oFAA4D;AAE5D,SAAS,kBAAkB,CAAC,KAAa;IACvC,MAAM,OAAO,GAAG,eAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAChC,eAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI;YACF,qEAAqE;YACrE,MAAM,YAAY,GAAG,KAAK,CAAC,eAAe,CAAC;YAC3C,qEAAqE;YACrE,KAAK,CAAC,eAAe,GAAG,KAAK,CAAC;YAC9B,OAAO,CAAC,OAAO,GAAG,YAAY,CAAC;SAChC;QAAC,MAAM,GAAE;QACV,OAAO,GAAG,EAAE;YACV,IAAI;gBACF,qEAAqE;gBACrE,KAAK,CAAC,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC;aACzC;YAAC,MAAM,GAAE;QACZ,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AACd,CAAC;AAED,SAAgB,mBAAmB;IACjC,MAAM,QAAQ,GAAG,eAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAErC,kBAAkB,CAAC,EAAE,CAAC,CAAC;IAEvB,eAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,SAAS,gBAAgB,CAAC,EAAc;YACtC,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC;YAExB,MAAM,KAAK,GAAG,EAAE,EAAE,KAAK,CAAC;YACxB,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,EAAE;gBAC1E,OAAO;aACR;YAED,2BAAiB,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QAC3C,CAAC;QAED,SAAS,oBAAoB,CAAC,EAAyB;YACrD,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC;YAExB,MAAM,MAAM,GAAG,EAAE,EAAE,MAAM,CAAC;YAC1B,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,MAAM,YAAY,KAAK,CAAC,IAAI,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,EAAE;gBAC7E,OAAO;aACR;YAED,2BAAiB,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;QAC5C,CAAC;QAED,MAAM,CAAC,gBAAgB,CAAC,oBAAoB,EAAE,oBAAoB,CAAC,CAAC;QACpE,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;QACnD,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;YACtD,MAAM,CAAC,mBAAmB,CAAC,oBAAoB,EAAE,oBAAoB,CAAC,CAAC;QACzE,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,QAAQ,CAAC;AAClB,CAAC;AArCD,kDAqCC","sourcesContent":["import React from 'react';\n\nimport ExceptionsManager from './modules/ExceptionsManager';\n\nfunction useStackTraceLimit(limit: number) {\n const current = React.useRef(0);\n React.useEffect(() => {\n try {\n // @ts-expect-error: StackTraceLimit is not defined in the Error type\n const currentLimit = Error.stackTraceLimit;\n // @ts-expect-error: StackTraceLimit is not defined in the Error type\n Error.stackTraceLimit = limit;\n current.current = currentLimit;\n } catch {}\n return () => {\n try {\n // @ts-expect-error: StackTraceLimit is not defined in the Error type\n Error.stackTraceLimit = current.current;\n } catch {}\n };\n }, [limit]);\n}\n\nexport function useRejectionHandler() {\n const hasError = React.useRef(false);\n\n useStackTraceLimit(35);\n\n React.useEffect(() => {\n function onUnhandledError(ev: ErrorEvent) {\n hasError.current = true;\n\n const error = ev?.error;\n if (!error || !(error instanceof Error) || typeof error.stack !== 'string') {\n return;\n }\n\n ExceptionsManager.handleException(error);\n }\n\n function onUnhandledRejection(ev: PromiseRejectionEvent) {\n hasError.current = true;\n\n const reason = ev?.reason;\n if (!reason || !(reason instanceof Error) || typeof reason.stack !== 'string') {\n return;\n }\n\n ExceptionsManager.handleException(reason);\n }\n\n window.addEventListener('unhandledrejection', onUnhandledRejection);\n window.addEventListener('error', onUnhandledError);\n return () => {\n window.removeEventListener('error', onUnhandledError);\n window.removeEventListener('unhandledrejection', onUnhandledRejection);\n };\n }, []);\n\n return hasError;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"getDevServer.d.ts","sourceRoot":"","sources":["../src/getDevServer.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,YAAY;;IAcd,0DAA0D;;;CAkB7D,CAAC;AAEF,eAAe,YAAY,CAAC"}
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,8 +1,12 @@
1
- import { Platform } from 'expo-modules-core';
2
- import qs from 'qs';
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const qs_1 = __importDefault(require("qs"));
3
7
  const getDevServer = () => {
4
8
  // Disable for SSR
5
- if (!Platform.isDOMAvailable) {
9
+ if (typeof window === 'undefined') {
6
10
  return {
7
11
  bundleLoadedFromServer: true,
8
12
  fullBundleUrl: '',
@@ -18,14 +22,11 @@ const getDevServer = () => {
18
22
  return document.currentScript.src;
19
23
  }
20
24
  const url = window.location.toString();
21
- const query = qs.parse(url);
22
- return (location.origin +
23
- location.pathname +
24
- '?' +
25
- qs.stringify({ ...query, platform: Platform.OS }));
25
+ const query = qs_1.default.parse(url);
26
+ return (location.origin + location.pathname + '?' + qs_1.default.stringify({ ...query, platform: 'web' }));
26
27
  },
27
28
  url: location.origin + location.pathname,
28
29
  };
29
30
  };
30
- export default getDevServer;
31
+ exports.default = getDevServer;
31
32
  //# sourceMappingURL=getDevServer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getDevServer.js","sourceRoot":"","sources":["../src/getDevServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,MAAM,YAAY,GAAG,GAAG,EAAE;IACxB,kBAAkB;IAClB,IAAI,CAAC,QAAQ,CAAC,cAAc,EAAE;QAC5B,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,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAE5B,OAAO,CACL,QAAQ,CAAC,MAAM;gBACf,QAAQ,CAAC,QAAQ;gBACjB,GAAG;gBACH,EAAE,CAAC,SAAS,CAAC,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC,CAClD,CAAC;QACJ,CAAC;QACD,GAAG,EAAE,QAAQ,CAAC,MAAM,GAAG,QAAQ,CAAC,QAAQ;KACzC,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { Platform } from 'expo-modules-core';\nimport qs from 'qs';\n\nconst getDevServer = () => {\n // Disable for SSR\n if (!Platform.isDOMAvailable) {\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 +\n location.pathname +\n '?' +\n qs.stringify({ ...query, platform: Platform.OS })\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,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,3 +1,8 @@
1
- import getDevServer from 'react-native/Libraries/Core/Devtools/getDevServer';
2
- export default getDevServer;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const getDevServer_1 = __importDefault(require("react-native/Libraries/Core/Devtools/getDevServer"));
7
+ exports.default = getDevServer_1.default;
3
8
  //# sourceMappingURL=getDevServer.native.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getDevServer.native.js","sourceRoot":"","sources":["../src/getDevServer.native.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,mDAAmD,CAAC;AAE7E,eAAe,YAAY,CAAC","sourcesContent":["import getDevServer from 'react-native/Libraries/Core/Devtools/getDevServer';\n\nexport default getDevServer;\n"]}
1
+ {"version":3,"file":"getDevServer.native.js","sourceRoot":"","sources":["../src/getDevServer.native.ts"],"names":[],"mappings":";;;;;AAAA,qGAA6E;AAE7E,kBAAe,sBAAY,CAAC","sourcesContent":["import getDevServer from 'react-native/Libraries/Core/Devtools/getDevServer';\n\nexport default getDevServer;\n"]}
package/build/index.d.ts CHANGED
@@ -1,3 +1,10 @@
1
+ /**
2
+ * Copyright © 2023 650 Industries.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
1
7
  import './location/install';
2
8
  import './effects';
9
+ import './async-require';
3
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAC;AAE5B,OAAO,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,oBAAoB,CAAC;AAE5B,OAAO,WAAW,CAAC;AAEnB,OAAO,iBAAiB,CAAC"}
package/build/index.js CHANGED
@@ -1,10 +1,14 @@
1
- import './location/install';
1
+ "use strict";
2
+ /**
3
+ * Copyright © 2023 650 Industries.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ require("./location/install");
2
10
  // IMPORT POSITION MATTERS FOR FAST REFRESH ON WEB
3
- import './effects';
4
- // Ensure this is removed in production.
5
- // TODO: Enable in production.
6
- if (process.env.NODE_ENV !== 'production') {
7
- // vvv EVERYTHING ELSE vvv
8
- require('./async-require');
9
- }
11
+ require("./effects");
12
+ // vvv EVERYTHING ELSE vvv
13
+ require("./async-require");
10
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAC;AAC5B,kDAAkD;AAClD,OAAO,WAAW,CAAC;AAEnB,wCAAwC;AACxC,8BAA8B;AAC9B,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;IACzC,0BAA0B;IAC1B,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC5B","sourcesContent":["import './location/install';\n// IMPORT POSITION MATTERS FOR FAST REFRESH ON WEB\nimport './effects';\n\n// Ensure this is removed in production.\n// TODO: Enable in production.\nif (process.env.NODE_ENV !== 'production') {\n // vvv EVERYTHING ELSE vvv\n require('./async-require');\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,8BAA4B;AAC5B,kDAAkD;AAClD,qBAAmB;AACnB,0BAA0B;AAC1B,2BAAyB","sourcesContent":["/**\n * Copyright © 2023 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 */\n\nimport './location/install';\n// IMPORT POSITION MATTERS FOR FAST REFRESH ON WEB\nimport './effects';\n// vvv EVERYTHING ELSE vvv\nimport './async-require';\n"]}
@@ -1,3 +1,8 @@
1
- export function install() { }
2
- export function setLocationHref(href) { }
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setLocationHref = exports.install = void 0;
4
+ function install() { }
5
+ exports.install = install;
6
+ function setLocationHref(href) { }
7
+ exports.setLocationHref = setLocationHref;
3
8
  //# sourceMappingURL=Location.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Location.js","sourceRoot":"","sources":["../../src/location/Location.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,OAAO,KAAI,CAAC;AAE5B,MAAM,UAAU,eAAe,CAAC,IAAY,IAAG,CAAC","sourcesContent":["export function install() {}\n\nexport function setLocationHref(href: string) {}\n"]}
1
+ {"version":3,"file":"Location.js","sourceRoot":"","sources":["../../src/location/Location.ts"],"names":[],"mappings":";;;AAAA,SAAgB,OAAO,KAAI,CAAC;AAA5B,0BAA4B;AAE5B,SAAgB,eAAe,CAAC,IAAY,IAAG,CAAC;AAAhD,0CAAgD","sourcesContent":["export function install() {}\n\nexport function setLocationHref(href: string) {}\n"]}
@@ -1,6 +1,12 @@
1
+ "use strict";
1
2
  // Copyright © 2023 650 Industries.
2
3
  // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
3
- import URL from 'url-parse';
4
+ var __importDefault = (this && this.__importDefault) || function (mod) {
5
+ return (mod && mod.__esModule) ? mod : { "default": mod };
6
+ };
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.install = exports.setLocationHref = void 0;
9
+ const url_parse_1 = __importDefault(require("url-parse"));
4
10
  class DOMException extends Error {
5
11
  constructor(message, name) {
6
12
  super(message);
@@ -14,7 +20,7 @@ class DOMException extends Error {
14
20
  // - https://heycam.github.io/webidl/#LegacyUnforgeable
15
21
  class Location {
16
22
  constructor(href = null) {
17
- const url = new URL(
23
+ const url = new url_parse_1.default(
18
24
  // @ts-expect-error
19
25
  href);
20
26
  // @ts-expect-error
@@ -172,10 +178,11 @@ Object.defineProperties(Location.prototype, {
172
178
  },
173
179
  });
174
180
  let location = undefined;
175
- export function setLocationHref(href) {
181
+ function setLocationHref(href) {
176
182
  location = new Location(href);
177
183
  }
178
- export function install() {
184
+ exports.setLocationHref = setLocationHref;
185
+ function install() {
179
186
  Object.defineProperty(global, 'Location', {
180
187
  value: Location,
181
188
  configurable: true,
@@ -191,4 +198,5 @@ export function install() {
191
198
  enumerable: true,
192
199
  });
193
200
  }
201
+ exports.install = install;
194
202
  //# sourceMappingURL=Location.native.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Location.native.js","sourceRoot":"","sources":["../../src/location/Location.native.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,0EAA0E;AAE1E,OAAO,GAAG,MAAM,WAAW,CAAC;AAE5B,MAAM,YAAa,SAAQ,KAAK;IAC9B,YAAY,OAAe,EAAE,IAAY;QACvC,KAAK,CAA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,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;gBACvD,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,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,QAAQ,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,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","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,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,6EAA6E;AAC7E,uEAAuE;AACvE,gCAAgC;AAChC,+EAA+E;AAC/E,uDAAuD;AACvD,MAAM,QAAQ;IACZ,YAAY,OAAsB,IAAI;QACpC,MAAM,GAAG,GAAG,IAAI,mBAAG;QACjB,mBAAmB;QACnB,IAAI,CACL,CAAC;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jB,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,11 +1,16 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
1
6
  // This MUST be first to ensure that `fetch` is defined in the React Native environment.
2
- import 'react-native/Libraries/Core/InitializeCore';
3
- import Constants from 'expo-constants';
4
- import URL from 'url-parse';
5
- import getDevServer from '../getDevServer';
6
- import { install, setLocationHref } from './Location';
7
+ require("react-native/Libraries/Core/InitializeCore");
8
+ const expo_constants_1 = __importDefault(require("expo-constants"));
9
+ const url_parse_1 = __importDefault(require("url-parse"));
10
+ const Location_1 = require("./Location");
11
+ const getDevServer_1 = __importDefault(require("../getDevServer"));
7
12
  let hasWarned = false;
8
- const manifest = Constants.expoConfig;
13
+ const manifest = expo_constants_1.default.expoConfig;
9
14
  // Add a development warning for fetch requests with relative paths
10
15
  // to ensure developers are aware of the need to configure a production
11
16
  // base URL in the Expo config (app.json) under `expo.extra.router.origin`.
@@ -23,7 +28,7 @@ function warnProductionOriginNotConfigured(requestUrl) {
23
28
  function getBaseUrl() {
24
29
  if (process.env.NODE_ENV !== 'production') {
25
30
  // e.g. http://localhost:19006
26
- return getDevServer().url?.replace(/\/$/, '');
31
+ return (0, getDevServer_1.default)().url?.replace(/\/$/, '');
27
32
  }
28
33
  // TODO: Make it official by moving out of `extra`
29
34
  const productionBaseUrl = manifest?.extra?.router?.origin;
@@ -42,14 +47,14 @@ function wrapFetchWithWindowLocation(fetch) {
42
47
  if (process.env.NODE_ENV !== 'production') {
43
48
  warnProductionOriginNotConfigured(props[0]);
44
49
  }
45
- props[0] = new URL(props[0], window.location?.origin).toString();
50
+ props[0] = new url_parse_1.default(props[0], window.location?.origin).toString();
46
51
  }
47
52
  else if (props[0] && typeof props[0] === 'object') {
48
53
  if (props[0].url && typeof props[0].url === 'string' && props[0].url.startsWith('/')) {
49
54
  if (process.env.NODE_ENV !== 'production') {
50
55
  warnProductionOriginNotConfigured(props[0]);
51
56
  }
52
- props[0].url = new URL(props[0].url, window.location?.origin).toString();
57
+ props[0].url = new url_parse_1.default(props[0].url, window.location?.origin).toString();
53
58
  }
54
59
  }
55
60
  return fetch(...props);
@@ -62,8 +67,8 @@ if (manifest?.extra?.router?.origin !== false) {
62
67
  if (typeof window !== 'undefined' && !window.location) {
63
68
  const url = getBaseUrl();
64
69
  if (url) {
65
- setLocationHref(url);
66
- install();
70
+ (0, Location_1.setLocationHref)(url);
71
+ (0, Location_1.install)();
67
72
  }
68
73
  }
69
74
  // Polyfill native fetch to support relative URLs
@@ -1 +1 @@
1
- {"version":3,"file":"install.native.js","sourceRoot":"","sources":["../../src/location/install.native.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,OAAO,4CAA4C,CAAC;AAEpD,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,GAAG,MAAM,WAAW,CAAC;AAE5B,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEtD,IAAI,SAAS,GAAG,KAAK,CAAC;AAEtB,MAAM,QAA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AE,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 getDevServer from '../getDevServer';\nimport { install, setLocationHref } from './Location';\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;AACvC,0DAA4B;AAE5B,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,OAAO,IAAA,sBAAY,GAAE,CAAC,GAAG,EAAE,OAAO,CAAC,KAAK,EAAE,EAAE,CAA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AC,CAAC,CAAC;iBAC7C;gBAED,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,mBAAG,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';\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"]}
package/build/setupHMR.js CHANGED
@@ -1,29 +1,31 @@
1
- import { Platform } from 'react-native';
2
- import HMRClient from './HMRClient';
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const HMRClient_1 = __importDefault(require("./HMRClient"));
3
7
  // Sets up developer tools for React Native web.
4
- if (!Platform.isTesting) {
5
- // We assume full control over the console and send JavaScript logs to Metro.
6
- // [
7
- // 'trace',
8
- // 'info',
9
- // 'warn',
10
- // 'error',
11
- // 'log',
12
- // 'group',
13
- // 'groupCollapsed',
14
- // 'groupEnd',
15
- // 'debug',
16
- // ].forEach(level => {
17
- // const originalFunction = console[level];
18
- // console[level] = function (...args: readonly any[]) {
19
- // HMRClient.log(
20
- // // @ts-expect-error
21
- // level, args);
22
- // originalFunction.apply(console, args);
23
- // };
24
- // });
25
- HMRClient.log('log', [`[${Platform.OS}] Logs will appear in the browser console`]);
26
- }
8
+ // We assume full control over the console and send JavaScript logs to Metro.
9
+ // [
10
+ // 'trace',
11
+ // 'info',
12
+ // 'warn',
13
+ // 'error',
14
+ // 'log',
15
+ // 'group',
16
+ // 'groupCollapsed',
17
+ // 'groupEnd',
18
+ // 'debug',
19
+ // ].forEach(level => {
20
+ // const originalFunction = console[level];
21
+ // console[level] = function (...args: readonly any[]) {
22
+ // HMRClient.log(
23
+ // // @ts-expect-error
24
+ // level, args);
25
+ // originalFunction.apply(console, args);
26
+ // };
27
+ // });
28
+ HMRClient_1.default.log('log', [`[web] Logs will appear in the browser console`]);
27
29
  // This is called native on native platforms
28
- HMRClient.setup({ isEnabled: true });
30
+ HMRClient_1.default.setup({ isEnabled: true });
29
31
  //# sourceMappingURL=setupHMR.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"setupHMR.js","sourceRoot":"","sources":["../src/setupHMR.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,gDAAgD;AAChD,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE;IACvB,6EAA6E;IAC7E,IAAI;IACJ,aAAa;IACb,YAAY;IACZ,YAAY;IACZ,aAAa;IACb,WAAW;IACX,aAAa;IACb,sBAAsB;IACtB,gBAAgB;IAChB,aAAa;IACb,uBAAuB;IACvB,6CAA6C;IAC7C,0DAA0D;IAC1D,qBAAqB;IACrB,4BAA4B;IAC5B,sBAAsB;IACtB,6CAA6C;IAC7C,OAAO;IACP,MAAM;IAEN,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,IAAI,QAAQ,CAAC,EAAE,2CAA2C,CAAC,CAAC,CAAC;CACpF;AAED,4CAA4C;AAC5C,SAAS,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC","sourcesContent":["import { Platform } from 'react-native';\n\nimport HMRClient from './HMRClient';\n\n// Sets up developer tools for React Native web.\nif (!Platform.isTesting) {\n // We assume full control over the console and send JavaScript logs to Metro.\n // [\n // 'trace',\n // 'info',\n // 'warn',\n // 'error',\n // 'log',\n // 'group',\n // 'groupCollapsed',\n // 'groupEnd',\n // 'debug',\n // ].forEach(level => {\n // const originalFunction = console[level];\n // console[level] = function (...args: readonly any[]) {\n // HMRClient.log(\n // // @ts-expect-error\n // level, args);\n // originalFunction.apply(console, args);\n // };\n // });\n\n HMRClient.log('log', [`[${Platform.OS}] Logs will appear in the browser console`]);\n}\n\n// This is called native on native platforms\nHMRClient.setup({ isEnabled: true });\n"]}
1
+ {"version":3,"file":"setupHMR.js","sourceRoot":"","sources":["../src/setupHMR.ts"],"names":[],"mappings":";;;;;AAAA,4DAAoC;AAEpC,gDAAgD;AAChD,6EAA6E;AAC7E,IAAI;AACJ,aAAa;AACb,YAAY;AACZ,YAAY;AACZ,aAAa;AACb,WAAW;AACX,aAAa;AACb,sBAAsB;AACtB,gBAAgB;AAChB,aAAa;AACb,uBAAuB;AACvB,6CAA6C;AAC7C,0DAA0D;AAC1D,qBAAqB;AACrB,4BAA4B;AAC5B,sBAAsB;AACtB,6CAA6C;AAC7C,OAAO;AACP,MAAM;AAEN,mBAAS,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,+CAA+C,CAAC,CAAC,CAAC;AAExE,4CAA4C;AAC5C,mBAAS,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC","sourcesContent":["import HMRClient from './HMRClient';\n\n// Sets up developer tools for React Native web.\n// We assume full control over the console and send JavaScript logs to Metro.\n// [\n// 'trace',\n// 'info',\n// 'warn',\n// 'error',\n// 'log',\n// 'group',\n// 'groupCollapsed',\n// 'groupEnd',\n// 'debug',\n// ].forEach(level => {\n// const originalFunction = console[level];\n// console[level] = function (...args: readonly any[]) {\n// HMRClient.log(\n// // @ts-expect-error\n// level, args);\n// originalFunction.apply(console, args);\n// };\n// });\n\nHMRClient.log('log', [`[web] Logs will appear in the browser console`]);\n\n// This is called native on native platforms\nHMRClient.setup({ isEnabled: true });\n"]}
@@ -1,5 +1,26 @@
1
- import { LogBoxLog } from './error-overlay/Data/LogBoxLog';
2
- import parseErrorStack from './error-overlay/modules/parseErrorStack';
3
- export { LogBoxLog, parseErrorStack };
4
- export * from './error-overlay/formatProjectFilePath';
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.parseErrorStack = exports.LogBoxLog = void 0;
21
+ const LogBoxLog_1 = require("./error-overlay/Data/LogBoxLog");
22
+ Object.defineProperty(exports, "LogBoxLog", { enumerable: true, get: function () { return LogBoxLog_1.LogBoxLog; } });
23
+ const parseErrorStack_1 = __importDefault(require("./error-overlay/modules/parseErrorStack"));
24
+ exports.parseErrorStack = parseErrorStack_1.default;
25
+ __exportStar(require("./error-overlay/formatProjectFilePath"), exports);
5
26
  //# sourceMappingURL=symbolicate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"symbolicate.js","sourceRoot":"","sources":["../src/symbolicate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,eAAe,MAAM,yCAAyC,CAAC;AAEtE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;AAEtC,cAAc,uCAAuC,CAAC","sourcesContent":["import { LogBoxLog } from './error-overlay/Data/LogBoxLog';\nimport parseErrorStack from './error-overlay/modules/parseErrorStack';\n\nexport { LogBoxLog, parseErrorStack };\n\nexport * from './error-overlay/formatProjectFilePath';\n"]}
1
+ {"version":3,"file":"symbolicate.js","sourceRoot":"","sources":["../src/symbolicate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,8DAA2D;AAGlD,0FAHA,qBAAS,OAGA;AAFlB,8FAAsE;AAElD,0BAFb,yBAAe,CAEa;AAEnC,wEAAsD","sourcesContent":["import { LogBoxLog } from './error-overlay/Data/LogBoxLog';\nimport parseErrorStack from './error-overlay/modules/parseErrorStack';\n\nexport { LogBoxLog, parseErrorStack };\n\nexport * from './error-overlay/formatProjectFilePath';\n"]}
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "@expo/metro-runtime",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "description": "Tools for making advanced Metro bundler features work",
5
+ "types": "build",
5
6
  "main": "build",
7
+ "browser": "src",
8
+ "react-native": "src",
6
9
  "homepage": "https://github.com/expo/expo/tree/main/packages/@expo/metro-runtime",
7
10
  "keywords": [],
8
11
  "author": "650 Industries, Inc.",
@@ -52,5 +55,5 @@
52
55
  }
53
56
  ]
54
57
  },
55
- "gitHead": "2240630a92eb79a4e4bf73e1439916c394876478"
58
+ "gitHead": "ee2c866ba3c7fbc35ff2a3e896041cf15d3bd7c5"
56
59
  }
@@ -0,0 +1,3 @@
1
+ const HMRClient = require('react-native/Libraries/Utilities/HMRClient');
2
+
3
+ export default HMRClient;