@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 +1 @@
1
- {"version":3,"file":"fetchThenEval.web.js","sourceRoot":"","sources":["../../src/async-require/fetchThenEval.web.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,qCAAqC;AACrC,MAAM,UAAU,kBAAkB,CAChC,GAAW,EACX,EACE,UAAU,EACV,KAAK,EACL,WAAW,MACsD,EAAE;IAErE,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;QACnC,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;KAChF;IACD,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAChD,IAAI,UAAU;YAAE,MAAM,CAAC,IAAI,GAAG,UAAU,CAAC;QACzC,IAAI,KAAK;YAAE,MAAM,CAAC,YAAY,CAA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,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YAC3D,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,CAAC;QACF,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,iBAAkB,SAAQ,KAAK;IAC1B,IAAI,GAAG,mBAAmB,CAAC;IACpC,IAAI,CAAU;IACd,OAAO,CAAU;CAClB","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 */\n// Basically `__webpack_require__.l`.\nexport function fetchThenEvalAsync(\n url: string,\n {\n scriptType,\n nonce,\n crossOrigin,\n }: { scriptType?: string; nonce?: string; crossOrigin?: string } = {}\n): Promise<void> {\n if (typeof document === 'undefined') {\n throw new Error('Cannot use fetchThenEvalAsync in a non-browser environment.');\n }\n return new Promise<void>((resolve, reject) => {\n const script = document.createElement('script');\n if (scriptType) script.type = scriptType;\n if (nonce) script.setAttribute('nonce', nonce);\n // script.setAttribute('data-expo-metro', ...);\n script.src = url;\n\n if (crossOrigin && script.src.indexOf(window.location.origin + '/') !== 0) {\n script.crossOrigin = crossOrigin;\n }\n\n script.onload = () => {\n script.parentNode && script.parentNode.removeChild(script);\n resolve();\n };\n // Create a new error object to preserve the original stack trace.\n const error = new AsyncRequireError();\n\n // Server error or network error.\n script.onerror = (ev) => {\n let event: Event;\n if (typeof ev === 'string') {\n event = {\n type: 'error',\n target: {\n // @ts-expect-error\n src: event,\n },\n };\n } else {\n event = ev;\n }\n\n const errorType = event && (event.type === 'load' ? 'missing' : event.type);\n // @ts-expect-error\n const realSrc = event?.target?.src;\n error.message = 'Loading module ' + url + ' failed.\\n(' + errorType + ': ' + realSrc + ')';\n error.type = errorType;\n error.request = realSrc;\n\n script.parentNode && script.parentNode.removeChild(script);\n reject(error);\n };\n document.head.appendChild(script);\n });\n}\n\nclass AsyncRequireError extends Error {\n readonly name = 'AsyncRequireError';\n type?: string;\n request?: string;\n}\n"]}
1
+ {"version":3,"file":"fetchThenEval.web.js","sourceRoot":"","sources":["../../src/async-require/fetchThenEval.web.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,qCAAqC;AACrC,SAAgB,kBAAkB,CAChC,GAAW,EACX,EACE,UAAU,EACV,KAAK,EACL,WAAW,MACsD,EAAE;IAErE,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;QACnC,OAAO,OAAO,CAAC,mBAAmB,CAAC,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;KAC7D;IACD,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAChD,IAAI,UAAU;YAAE,MAAM,CAAC,IAAI,GAAG,UAAU,CAAC;QACzC,IAAI,KAAK;YAAE,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAC/C,+CAA+C;QAC/C,MAAM,CAAC,GAAG,GAAG,GAAG,CAAC;QAEjB,IAAI,WAAW,IAAI,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,EAAE;YACzE,MAAM,CAAC,WAAW,GAAG,WAAW,CAAC;SAClC;QAED,MAAM,CAAC,MAAM,GAAG,GAAG,EAAE;YACnB,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YAC3D,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC;QACF,kEAAkE;QAClE,MAAM,KAAK,GAAG,IAAI,iBAAiB,EAAE,CAAC;QAEtC,iCAAiC;QACjC,MAAM,CAAC,OAAO,GAAG,CAAC,EAAE,EAAE,EAAE;YACtB,IAAI,KAAY,CAAC;YACjB,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;gBAC1B,KAAK,GAAG;oBACN,IAAI,EAAE,OAAO;oBACb,MAAM,EAAE;wBACN,mBAAmB;wBACnB,GAAG,EAAE,KAAK;qBACX;iBACF,CAAC;aACH;iBAAM;gBACL,KAAK,GAAG,EAAE,CAAC;aACZ;YAED,MAAM,SAAS,GAAG,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC5E,mBAAmB;YACnB,MAAM,OAAO,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC;YACnC,KAAK,CAAC,OAAO,GAAG,iBAAiB,GAAG,GAAG,GAAG,aAAa,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,GAAG,GAAG,CAAC;YAC3F,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC;YACvB,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;YAExB,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YAC3D,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,CAAC;QACF,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC;AAxDD,gDAwDC;AAED,MAAM,iBAAkB,SAAQ,KAAK;IAC1B,IAAI,GAAG,mBAAmB,CAAC;IACpC,IAAI,CAAU;IACd,OAAO,CAAU;CAClB","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 */\n// Basically `__webpack_require__.l`.\nexport function fetchThenEvalAsync(\n url: string,\n {\n scriptType,\n nonce,\n crossOrigin,\n }: { scriptType?: string; nonce?: string; crossOrigin?: string } = {}\n): Promise<void> {\n if (typeof document === 'undefined') {\n return require('./fetchThenEvalJs').fetchThenEvalAsync(url);\n }\n return new Promise<void>((resolve, reject) => {\n const script = document.createElement('script');\n if (scriptType) script.type = scriptType;\n if (nonce) script.setAttribute('nonce', nonce);\n // script.setAttribute('data-expo-metro', ...);\n script.src = url;\n\n if (crossOrigin && script.src.indexOf(window.location.origin + '/') !== 0) {\n script.crossOrigin = crossOrigin;\n }\n\n script.onload = () => {\n script.parentNode && script.parentNode.removeChild(script);\n resolve();\n };\n // Create a new error object to preserve the original stack trace.\n const error = new AsyncRequireError();\n\n // Server error or network error.\n script.onerror = (ev) => {\n let event: Event;\n if (typeof ev === 'string') {\n event = {\n type: 'error',\n target: {\n // @ts-expect-error\n src: event,\n },\n };\n } else {\n event = ev;\n }\n\n const errorType = event && (event.type === 'load' ? 'missing' : event.type);\n // @ts-expect-error\n const realSrc = event?.target?.src;\n error.message = 'Loading module ' + url + ' failed.\\n(' + errorType + ': ' + realSrc + ')';\n error.type = errorType;\n error.request = realSrc;\n\n script.parentNode && script.parentNode.removeChild(script);\n reject(error);\n };\n document.head.appendChild(script);\n });\n}\n\nclass AsyncRequireError extends Error {\n readonly name = 'AsyncRequireError';\n type?: string;\n request?: string;\n}\n"]}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Load a bundle for a URL using fetch + eval on native and script tag injection on web.
3
+ *
4
+ * @param bundlePath Given a statement like `import('./Bacon')` `bundlePath` would be `Bacon`.
5
+ */
6
+ export declare function fetchThenEvalAsync(url: string): Promise<void>;
7
+ //# sourceMappingURL=fetchThenEvalJs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchThenEvalJs.d.ts","sourceRoot":"","sources":["../../src/async-require/fetchThenEvalJs.ts"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAqB7D"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchThenEvalAsync = void 0;
4
+ /**
5
+ * Copyright © 2022 650 Industries.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */
10
+ const fetchAsync_1 = require("./fetchAsync");
11
+ /**
12
+ * Load a bundle for a URL using fetch + eval on native and script tag injection on web.
13
+ *
14
+ * @param bundlePath Given a statement like `import('./Bacon')` `bundlePath` would be `Bacon`.
15
+ */
16
+ function fetchThenEvalAsync(url) {
17
+ return (0, fetchAsync_1.fetchAsync)(url).then(({ body, headers }) => {
18
+ if (headers?.has?.('Content-Type') != null &&
19
+ headers.get('Content-Type').includes('application/json')) {
20
+ // Errors are returned as JSON.
21
+ throw new Error(JSON.parse(body).message || `Unknown error fetching '${url}'`);
22
+ }
23
+ // NOTE(EvanBacon): All of this code is ignored in development mode at the root.
24
+ // Some engines do not support `sourceURL` as a comment. We expose a
25
+ // `globalEvalWithSourceUrl` function to handle updates in that case.
26
+ if (global.globalEvalWithSourceUrl) {
27
+ global.globalEvalWithSourceUrl(body, url);
28
+ }
29
+ else {
30
+ // eslint-disable-next-line no-eval
31
+ eval(body);
32
+ }
33
+ });
34
+ }
35
+ exports.fetchThenEvalAsync = fetchThenEvalAsync;
36
+ //# sourceMappingURL=fetchThenEvalJs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchThenEvalJs.js","sourceRoot":"","sources":["../../src/async-require/fetchThenEvalJs.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,6CAA0C;AAM1C;;;;GAIG;AACH,SAAgB,kBAAkB,CAAC,GAAW;IAC5C,OAAO,IAAA,uBAAU,EAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;QAChD,IACE,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,IAAI,IAAI;YACtC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EACzD;YACA,+BAA+B;YAC/B,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,IAAI,2BAA2B,GAAG,GAAG,CAAC,CAAC;SAChF;QAED,gFAAgF;QAEhF,oEAAoE;QACpE,qEAAqE;QACrE,IAAI,MAAM,CAAC,uBAAuB,EAAE;YAClC,MAAM,CAAC,uBAAuB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;SAC3C;aAAM;YACL,mCAAmC;YACnC,IAAI,CAAC,IAAI,CAAC,CAAC;SACZ;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AArBD,gDAqBC","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 { fetchAsync } from './fetchAsync';\n\ndeclare let global: {\n globalEvalWithSourceUrl?: any;\n};\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`.\n */\nexport function fetchThenEvalAsync(url: string): Promise<void> {\n return fetchAsync(url).then(({ body, headers }) => {\n if (\n headers?.has?.('Content-Type') != null &&\n headers.get('Content-Type')!.includes('application/json')\n ) {\n // Errors are returned as JSON.\n throw new Error(JSON.parse(body).message || `Unknown error fetching '${url}'`);\n }\n\n // NOTE(EvanBacon): All of this code is ignored in development mode at the root.\n\n // Some engines do not support `sourceURL` as a comment. We expose a\n // `globalEvalWithSourceUrl` function to handle updates in that case.\n if (global.globalEvalWithSourceUrl) {\n global.globalEvalWithSourceUrl(body, url);\n } else {\n // eslint-disable-next-line no-eval\n eval(body);\n }\n });\n}\n"]}
@@ -1,10 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
1
3
  /**
2
4
  * Copyright © 2022 650 Industries.
3
5
  *
4
6
  * This source code is licensed under the MIT license found in the
5
7
  * LICENSE file in the root directory of this source tree.
6
8
  */
7
- import { buildAsyncRequire } from './buildAsyncRequire';
9
+ const buildAsyncRequire_1 = require("./buildAsyncRequire");
8
10
  // @ts-ignore
9
- global[`${global.__METRO_GLOBAL_PREFIX__ ?? ''}__loadBundleAsync`] = buildAsyncRequire();
11
+ global[`${global.__METRO_GLOBAL_PREFIX__ ?? ''}__loadBundleAsync`] = (0, buildAsyncRequire_1.buildAsyncRequire)();
10
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/async-require/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,aAAa;AACb,MAAM,CAAC,GAAG,MAAM,CAAC,uBAAuB,IAAI,EAAE,mBAAmB,CAAC,GAAG,iBAAiB,EAAE,CAAC","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 { buildAsyncRequire } from './buildAsyncRequire';\n\n// @ts-ignore\nglobal[`${global.__METRO_GLOBAL_PREFIX__ ?? ''}__loadBundleAsync`] = buildAsyncRequire();\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/async-require/index.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,2DAAwD;AAExD,aAAa;AACb,MAAM,CAAC,GAAG,MAAM,CAAC,uBAAuB,IAAI,EAAE,mBAAmB,CAAC,GAAG,IAAA,qCAAiB,GAAE,CAAC","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 { buildAsyncRequire } from './buildAsyncRequire';\n\n// @ts-ignore\nglobal[`${global.__METRO_GLOBAL_PREFIX__ ?? ''}__loadBundleAsync`] = buildAsyncRequire();\n"]}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Copyright © 2022 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
+ */
7
+ //# sourceMappingURL=index.native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../src/async-require/index.native.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Copyright © 2022 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
+ */
7
+ // Ensure this is removed in production.
8
+ // TODO: Enable in production.
9
+ if (process.env.NODE_ENV !== 'production') {
10
+ const { buildAsyncRequire } = require('./buildAsyncRequire');
11
+ // @ts-ignore
12
+ global[`${global.__METRO_GLOBAL_PREFIX__ ?? ''}__loadBundleAsync`] = buildAsyncRequire();
13
+ }
14
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.native.js","sourceRoot":"","sources":["../../src/async-require/index.native.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,wCAAwC;AACxC,8BAA8B;AAC9B,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;IACzC,MAAM,EAAE,iBAAiB,EAAE,GACzB,OAAO,CAAC,qBAAqB,CAAyC,CAAC;IACzE,aAAa;IACb,MAAM,CAAC,GAAG,MAAM,CAAC,uBAAuB,IAAI,EAAE,mBAAmB,CAAC,GAAG,iBAAiB,EAAE,CAAC;CAC1F","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 */\n\n// Ensure this is removed in production.\n// TODO: Enable in production.\nif (process.env.NODE_ENV !== 'production') {\n const { buildAsyncRequire } =\n require('./buildAsyncRequire') as typeof import('./buildAsyncRequire');\n // @ts-ignore\n global[`${global.__METRO_GLOBAL_PREFIX__ ?? ''}__loadBundleAsync`] = buildAsyncRequire();\n}\n"]}
@@ -1,11 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadBundleAsync = void 0;
1
4
  /**
2
5
  * Copyright © 2022 650 Industries.
3
6
  *
4
7
  * This source code is licensed under the MIT license found in the
5
8
  * LICENSE file in the root directory of this source tree.
6
9
  */
7
- import { buildUrlForBundle } from './buildUrlForBundle';
8
- import { fetchThenEvalAsync } from './fetchThenEval';
10
+ const buildUrlForBundle_1 = require("./buildUrlForBundle");
11
+ const fetchThenEval_1 = require("./fetchThenEval");
9
12
  // import LoadingView from '../LoadingView';
10
13
  let pendingRequests = 0;
11
14
  /**
@@ -13,10 +16,10 @@ let pendingRequests = 0;
13
16
  *
14
17
  * @param bundlePath Given a statement like `import('./Bacon')` `bundlePath` would be `Bacon.bundle?params=from-metro`.
15
18
  */
16
- export async function loadBundleAsync(bundlePath) {
17
- const requestUrl = buildUrlForBundle(bundlePath);
19
+ async function loadBundleAsync(bundlePath) {
20
+ const requestUrl = (0, buildUrlForBundle_1.buildUrlForBundle)(bundlePath);
18
21
  if (process.env.NODE_ENV === 'production') {
19
- return fetchThenEvalAsync(requestUrl);
22
+ return (0, fetchThenEval_1.fetchThenEvalAsync)(requestUrl);
20
23
  }
21
24
  else {
22
25
  const LoadingView = require('../LoadingView')
@@ -24,7 +27,7 @@ export async function loadBundleAsync(bundlePath) {
24
27
  // Send a signal to the `expo` package to show the loading indicator.
25
28
  LoadingView.showMessage('Downloading...', 'load');
26
29
  pendingRequests++;
27
- return fetchThenEvalAsync(requestUrl)
30
+ return (0, fetchThenEval_1.fetchThenEvalAsync)(requestUrl)
28
31
  .then(() => {
29
32
  if (process.env.NODE_ENV !== 'production') {
30
33
  const HMRClient = require('../HMRClient')
@@ -39,4 +42,5 @@ export async function loadBundleAsync(bundlePath) {
39
42
  });
40
43
  }
41
44
  }
45
+ exports.loadBundleAsync = loadBundleAsync;
42
46
  //# sourceMappingURL=loadBundle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"loadBundle.js","sourceRoot":"","sources":["../../src/async-require/loadBundle.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,4CAA4C;AAE5C,IAAI,eAAe,GAAG,CAAC,CAAC;AAExB;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,UAAkB;IACtD,MAAM,UAAU,GAAG,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAEjD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;QACzC,OAAO,kBAAkB,CAAC,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,kBAAkB,CAAC,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","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;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,2 +1 @@
1
- export {};
2
1
  //# sourceMappingURL=effects.d.ts.map
package/build/effects.js CHANGED
@@ -1,14 +1,11 @@
1
- import { Platform } from 'expo-modules-core';
2
- if (
3
1
  // Only during development.
4
- global.__DEV__ &&
2
+ if (process.env.NODE_ENV !== 'production') {
3
+ if (
5
4
  // Disable for SSR
6
- Platform.isDOMAvailable &&
7
- // Disable for non-metro runtimes
8
- // NOTE(EvanBacon): This can probably be removed in favor of `expo/metro-config` injecting this file.
9
- global.__METRO_GLOBAL_PREFIX__ != null) {
10
- require('./setupFastRefresh');
11
- require('./setupHMR');
12
- require('./messageSocket');
5
+ typeof window !== 'undefined') {
6
+ require('./setupFastRefresh');
7
+ require('./setupHMR');
8
+ require('./messageSocket');
9
+ }
13
10
  }
14
11
  //# sourceMappingURL=effects.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"effects.js","sourceRoot":"","sources":["../src/effects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAU7C;AACE,2BAA2B;AAC3B,MAAM,CAAC,OAAO;IACd,kBAAkB;IAClB,QAAQ,CAAC,cAAc;IACvB,iCAAiC;IACjC,qGAAqG;IACrG,MAAM,CAAC,uBAAuB,IAAI,IAAI,EACtC;IACA,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC9B,OAAO,CAAC,YAAY,CAAC,CAAC;IACtB,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC5B","sourcesContent":["import { Platform } from 'expo-modules-core';\n\ndeclare let global: {\n __DEV__?: boolean;\n RN$Bridgeless?: boolean;\n __METRO_GLOBAL_PREFIX__?: string;\n __RCTProfileIsProfiling?: boolean;\n WebSocket: any;\n};\n\nif (\n // Only during development.\n global.__DEV__ &&\n // Disable for SSR\n Platform.isDOMAvailable &&\n // Disable for non-metro runtimes\n // NOTE(EvanBacon): This can probably be removed in favor of `expo/metro-config` injecting this file.\n global.__METRO_GLOBAL_PREFIX__ != null\n) {\n require('./setupFastRefresh');\n require('./setupHMR');\n require('./messageSocket');\n}\n"]}
1
+ {"version":3,"file":"effects.js","sourceRoot":"","sources":["../src/effects.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;IACzC;IACE,kBAAkB;IAClB,OAAO,MAAM,KAAK,WAAW,EAC7B;QACA,OAAO,CAAC,oBAAoB,CAAC,CAAC;QAC9B,OAAO,CAAC,YAAY,CAAC,CAAC;QACtB,OAAO,CAAC,iBAAiB,CAAC,CAAC;KAC5B;CACF","sourcesContent":["// Only during development.\nif (process.env.NODE_ENV !== 'production') {\n if (\n // Disable for SSR\n typeof window !== 'undefined'\n ) {\n require('./setupFastRefresh');\n require('./setupHMR');\n require('./messageSocket');\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"LogBoxData.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogBoxData.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG5C,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEjG,MAAM,MAAM,UAAU,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC;AAExC,MAAM,MAAM,OAAO,GAAG;IACpB,KAAK,EAAE,QAAQ,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,cAAc,EAAE,cAAc,CAAC;CAChC,CAAC;AAEF,KAAK,aAAa,GAAG,GAAG,CAAC;AAEzB,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,EAAE;IAC/B,IAAI,EAAE,UAAU,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,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E;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,QAIrE;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,QAEjE;AAED,wBAAgB,KAAK,IAAI,IAAI,CAK5B;AAED,wBAAgB,cAAc,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAyB7D;AAED,wBAAgB,aAAa,IAAI,IAAI,CAOpC;AAED,wBAAgB,WAAW,IAAI,IAAI,CAMlC;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI,CAK5C;AAED,wBAAgB,iBAAiB,IAAI,aAAa,EAAE,CAEnD;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,IAAI,CA2BjE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAMhD;AAED,wBAAgB,UAAU,IAAI,OAAO,CAEpC;AAED,wBAAgB,OAAO,CAAC,QAAQ,EAAE,QAAQ,GAAG,YAAY,CAWxD;AAED,wBAAgB,gBAAgB,CAAC,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAiF5F"}
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  /**
2
3
  * Copyright (c) 650 Industries.
3
4
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -5,12 +6,40 @@
5
6
  * This source code is licensed under the MIT license found in the
6
7
  * LICENSE file in the root directory of this source tree.
7
8
  */
8
- import * as React from 'react';
9
- import NativeLogBox from '../modules/NativeLogBox';
10
- import parseErrorStack from '../modules/parseErrorStack';
11
- import { LogBoxLog } from './LogBoxLog';
12
- import { LogContext } from './LogContext';
13
- import { parseLogBoxException } from './parseLogBoxLog';
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
22
+ }) : function(o, v) {
23
+ o["default"] = v;
24
+ });
25
+ var __importStar = (this && this.__importStar) || function (mod) {
26
+ if (mod && mod.__esModule) return mod;
27
+ var result = {};
28
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
29
+ __setModuleDefault(result, mod);
30
+ return result;
31
+ };
32
+ var __importDefault = (this && this.__importDefault) || function (mod) {
33
+ return (mod && mod.__esModule) ? mod : { "default": mod };
34
+ };
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.withSubscription = exports.observe = exports.isDisabled = exports.setDisabled = exports.addIgnorePatterns = exports.getIgnorePatterns = exports.dismiss = exports.clearErrors = exports.clearWarnings = exports.setSelectedLog = exports.clear = exports.symbolicateLogLazy = exports.retrySymbolicateLogNow = exports.symbolicateLogNow = exports.addException = exports.addLog = exports.isMessageIgnored = exports.isLogBoxErrorMessage = exports.reportUnexpectedLogBoxError = exports.reportLogBoxError = void 0;
37
+ const React = __importStar(require("react"));
38
+ const LogBoxLog_1 = require("./LogBoxLog");
39
+ const LogContext_1 = require("./LogContext");
40
+ const parseLogBoxLog_1 = require("./parseLogBoxLog");
41
+ const NativeLogBox_1 = __importDefault(require("../modules/NativeLogBox"));
42
+ const parseErrorStack_1 = __importDefault(require("../modules/parseErrorStack"));
14
43
  const observers = new Set();
15
44
  const ignorePatterns = new Set();
16
45
  let logs = new Set();
@@ -25,21 +54,24 @@ function getNextState() {
25
54
  selectedLogIndex: _selectedIndex,
26
55
  };
27
56
  }
28
- export function reportLogBoxError(error, componentStack) {
57
+ function reportLogBoxError(error, componentStack) {
29
58
  const ExceptionsManager = require('../modules/ExceptionsManager').default;
30
59
  if (componentStack != null) {
31
60
  error.componentStack = componentStack;
32
61
  }
33
62
  ExceptionsManager.handleException(error);
34
63
  }
35
- export function reportUnexpectedLogBoxError(error, componentStack) {
64
+ exports.reportLogBoxError = reportLogBoxError;
65
+ function reportUnexpectedLogBoxError(error, componentStack) {
36
66
  error.message = `${LOGBOX_ERROR_MESSAGE}\n\n${error.message}`;
37
67
  return reportLogBoxError(error, componentStack);
38
68
  }
39
- export function isLogBoxErrorMessage(message) {
69
+ exports.reportUnexpectedLogBoxError = reportUnexpectedLogBoxError;
70
+ function isLogBoxErrorMessage(message) {
40
71
  return typeof message === 'string' && message.includes(LOGBOX_ERROR_MESSAGE);
41
72
  }
42
- export function isMessageIgnored(message) {
73
+ exports.isLogBoxErrorMessage = isLogBoxErrorMessage;
74
+ function isMessageIgnored(message) {
43
75
  for (const pattern of ignorePatterns) {
44
76
  if ((pattern instanceof RegExp && pattern.test(message)) ||
45
77
  (typeof pattern === 'string' && message.includes(pattern))) {
@@ -48,6 +80,7 @@ export function isMessageIgnored(message) {
48
80
  }
49
81
  return false;
50
82
  }
83
+ exports.isMessageIgnored = isMessageIgnored;
51
84
  function setImmediateShim(callback) {
52
85
  if (!global.setImmediate) {
53
86
  return setTimeout(callback, 0);
@@ -120,14 +153,14 @@ function appendNewLog(newLog) {
120
153
  handleUpdate();
121
154
  }
122
155
  }
123
- export function addLog(log) {
156
+ function addLog(log) {
124
157
  const errorForStackTrace = new Error();
125
158
  // Parsing logs are expensive so we schedule this
126
159
  // otherwise spammy logs would pause rendering.
127
160
  setImmediate(() => {
128
161
  try {
129
- const stack = parseErrorStack(errorForStackTrace?.stack);
130
- appendNewLog(new LogBoxLog({
162
+ const stack = (0, parseErrorStack_1.default)(errorForStackTrace?.stack);
163
+ appendNewLog(new LogBoxLog_1.LogBoxLog({
131
164
  level: log.level,
132
165
  message: log.message,
133
166
  isComponentError: false,
@@ -141,38 +174,44 @@ export function addLog(log) {
141
174
  }
142
175
  });
143
176
  }
144
- export function addException(error) {
177
+ exports.addLog = addLog;
178
+ function addException(error) {
145
179
  // Parsing logs are expensive so we schedule this
146
180
  // otherwise spammy logs would pause rendering.
147
181
  setImmediate(() => {
148
182
  try {
149
- appendNewLog(new LogBoxLog(parseLogBoxException(error)));
183
+ appendNewLog(new LogBoxLog_1.LogBoxLog((0, parseLogBoxLog_1.parseLogBoxException)(error)));
150
184
  }
151
185
  catch (loggingError) {
152
186
  reportUnexpectedLogBoxError(loggingError);
153
187
  }
154
188
  });
155
189
  }
156
- export function symbolicateLogNow(type, log) {
190
+ exports.addException = addException;
191
+ function symbolicateLogNow(type, log) {
157
192
  log.symbolicate(type, () => {
158
193
  handleUpdate();
159
194
  });
160
195
  }
161
- export function retrySymbolicateLogNow(type, log) {
196
+ exports.symbolicateLogNow = symbolicateLogNow;
197
+ function retrySymbolicateLogNow(type, log) {
162
198
  log.retrySymbolicate(type, () => {
163
199
  handleUpdate();
164
200
  });
165
201
  }
166
- export function symbolicateLogLazy(type, log) {
202
+ exports.retrySymbolicateLogNow = retrySymbolicateLogNow;
203
+ function symbolicateLogLazy(type, log) {
167
204
  log.symbolicate(type);
168
205
  }
169
- export function clear() {
206
+ exports.symbolicateLogLazy = symbolicateLogLazy;
207
+ function clear() {
170
208
  if (logs.size > 0) {
171
209
  logs = new Set();
172
210
  setSelectedLog(-1);
173
211
  }
174
212
  }
175
- export function setSelectedLog(proposedNewIndex) {
213
+ exports.clear = clear;
214
+ function setSelectedLog(proposedNewIndex) {
176
215
  const oldIndex = _selectedIndex;
177
216
  let newIndex = proposedNewIndex;
178
217
  const logArray = Array.from(logs);
@@ -187,18 +226,19 @@ export function setSelectedLog(proposedNewIndex) {
187
226
  }
188
227
  _selectedIndex = newIndex;
189
228
  handleUpdate();
190
- if (NativeLogBox) {
229
+ if (NativeLogBox_1.default) {
191
230
  setTimeout(() => {
192
231
  if (oldIndex < 0 && newIndex >= 0) {
193
- NativeLogBox.show();
232
+ NativeLogBox_1.default.show();
194
233
  }
195
234
  else if (oldIndex >= 0 && newIndex < 0) {
196
- NativeLogBox.hide();
235
+ NativeLogBox_1.default.hide();
197
236
  }
198
237
  }, 0);
199
238
  }
200
239
  }
201
- export function clearWarnings() {
240
+ exports.setSelectedLog = setSelectedLog;
241
+ function clearWarnings() {
202
242
  const newLogs = Array.from(logs).filter((log) => log.level !== 'warn');
203
243
  if (newLogs.length !== logs.size) {
204
244
  logs = new Set(newLogs);
@@ -206,23 +246,27 @@ export function clearWarnings() {
206
246
  handleUpdate();
207
247
  }
208
248
  }
209
- export function clearErrors() {
249
+ exports.clearWarnings = clearWarnings;
250
+ function clearErrors() {
210
251
  const newLogs = Array.from(logs).filter((log) => log.level !== 'error' && log.level !== 'fatal');
211
252
  if (newLogs.length !== logs.size) {
212
253
  logs = new Set(newLogs);
213
254
  setSelectedLog(-1);
214
255
  }
215
256
  }
216
- export function dismiss(log) {
257
+ exports.clearErrors = clearErrors;
258
+ function dismiss(log) {
217
259
  if (logs.has(log)) {
218
260
  logs.delete(log);
219
261
  handleUpdate();
220
262
  }
221
263
  }
222
- export function getIgnorePatterns() {
264
+ exports.dismiss = dismiss;
265
+ function getIgnorePatterns() {
223
266
  return Array.from(ignorePatterns);
224
267
  }
225
- export function addIgnorePatterns(patterns) {
268
+ exports.getIgnorePatterns = getIgnorePatterns;
269
+ function addIgnorePatterns(patterns) {
226
270
  const existingSize = ignorePatterns.size;
227
271
  // The same pattern may be added multiple times, but adding a new pattern
228
272
  // can be expensive so let's find only the ones that are new.
@@ -248,17 +292,20 @@ export function addIgnorePatterns(patterns) {
248
292
  logs = new Set(Array.from(logs).filter((log) => !isMessageIgnored(log.message.content)));
249
293
  handleUpdate();
250
294
  }
251
- export function setDisabled(value) {
295
+ exports.addIgnorePatterns = addIgnorePatterns;
296
+ function setDisabled(value) {
252
297
  if (value === _isDisabled) {
253
298
  return;
254
299
  }
255
300
  _isDisabled = value;
256
301
  handleUpdate();
257
302
  }
258
- export function isDisabled() {
303
+ exports.setDisabled = setDisabled;
304
+ function isDisabled() {
259
305
  return _isDisabled;
260
306
  }
261
- export function observe(observer) {
307
+ exports.isDisabled = isDisabled;
308
+ function observe(observer) {
262
309
  const subscription = { observer };
263
310
  observers.add(subscription);
264
311
  observer(getNextState());
@@ -268,7 +315,8 @@ export function observe(observer) {
268
315
  },
269
316
  };
270
317
  }
271
- export function withSubscription(WrappedComponent) {
318
+ exports.observe = observe;
319
+ function withSubscription(WrappedComponent) {
272
320
  class LogBoxStateSubscription extends React.Component {
273
321
  static getDerivedStateFromError() {
274
322
  return { hasError: true };
@@ -291,7 +339,7 @@ export function withSubscription(WrappedComponent) {
291
339
  // We can't show any fallback UI here, because the error may be with <View> or <Text>.
292
340
  return null;
293
341
  }
294
- return (React.createElement(LogContext.Provider, { value: {
342
+ return (React.createElement(LogContext_1.LogContext.Provider, { value: {
295
343
  selectedLogIndex: this.state.selectedLogIndex,
296
344
  isDisabled: this.state.isDisabled,
297
345
  logs: Array.from(this.state.logs),
@@ -335,4 +383,5 @@ export function withSubscription(WrappedComponent) {
335
383
  // @ts-expect-error
336
384
  return LogBoxStateSubscription;
337
385
  }
386
+ exports.withSubscription = withSubscription;
338
387
  //# sourceMappingURL=LogBoxData.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LogBoxData.js","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogBoxData.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,YAAY,MAAM,yBAAyB,CAAC;AACnD,OAAO,eAAe,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAa,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,MAA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qBAAM,IAAI,gBAAgB,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;oBACnD,cAAc,CAAC,gBAAgB,GAAG,CAAC,CAAC,CAAC;iBACtC;gBAED,OAAO,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,CAAC;aACtC;QACH,CAAC,CAAC;QAEF,eAAe,GAAG,GAAS,EAAE;YAC3B,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;QACrB,CAAC,CAAC;QAEF,qBAAqB,GAAG,CAAC,KAAa,EAAQ,EAAE;YAC9C,cAAc,CAAC,KAAK,CAAC,CAAC;QACxB,CAAC,CAAC;KACH;IAED,mBAAmB;IACnB,OAAO,uBAAuB,CAAC;AACjC,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 */\n\nimport * as React from 'react';\n\nimport NativeLogBox from '../modules/NativeLogBox';\nimport parseErrorStack from '../modules/parseErrorStack';\nimport { LogBoxLog, StackType } from './LogBoxLog';\nimport type { LogLevel } from './LogBoxLog';\nimport { LogContext } from './LogContext';\nimport { parseLogBoxException } from './parseLogBoxLog';\nimport type { Message, Category, ComponentStack, ExtendedExceptionData } from './parseLogBoxLog';\n\nexport type LogBoxLogs = Set<LogBoxLog>;\n\nexport type LogData = {\n level: LogLevel;\n message: Message;\n category: Category;\n componentStack: ComponentStack;\n};\n\ntype ExtendedError = any;\n\nexport type Observer = (options: {\n logs: LogBoxLogs;\n isDisabled: boolean;\n selectedLogIndex: number;\n}) => void;\n\nexport type IgnorePattern = string | RegExp;\n\nexport type Subscription = {\n unsubscribe: () => void;\n};\n\nexport type WarningInfo = {\n finalFormat: string;\n forceDialogImmediately: boolean;\n suppressDialog_LEGACY: boolean;\n suppressCompletely: boolean;\n monitorEvent: string | null;\n monitorListVersion: number;\n monitorSampleRate: number;\n};\n\nexport type WarningFilter = (format: string) => WarningInfo;\n\ntype Props = object;\n\ntype State = {\n logs: LogBoxLogs;\n isDisabled: boolean;\n hasError: boolean;\n selectedLogIndex: number;\n};\n\nconst observers: Set<{ observer: Observer } & any> = new Set();\nconst ignorePatterns: Set<IgnorePattern> = new Set();\nlet logs: LogBoxLogs = new Set();\nlet updateTimeout: null | ReturnType<typeof setImmediate> | ReturnType<typeof setTimeout> = null;\nlet _isDisabled = false;\nlet _selectedIndex = -1;\n\nconst LOGBOX_ERROR_MESSAGE =\n 'An error was thrown when attempting to render log messages via LogBox.';\n\nfunction getNextState() {\n return {\n logs,\n isDisabled: _isDisabled,\n selectedLogIndex: _selectedIndex,\n };\n}\n\nexport function reportLogBoxError(error: ExtendedError, componentStack?: string): void {\n const ExceptionsManager = require('../modules/ExceptionsManager').default;\n\n if (componentStack != null) {\n error.componentStack = componentStack;\n }\n ExceptionsManager.handleException(error);\n}\n\nexport function reportUnexpectedLogBoxError(error: ExtendedError, componentStack?: string): void {\n error.message = `${LOGBOX_ERROR_MESSAGE}\\n\\n${error.message}`;\n return reportLogBoxError(error, componentStack);\n}\n\nexport function isLogBoxErrorMessage(message: string): boolean {\n return typeof message === 'string' && message.includes(LOGBOX_ERROR_MESSAGE);\n}\n\nexport function isMessageIgnored(message: string): boolean {\n for (const pattern of ignorePatterns) {\n if (\n (pattern instanceof RegExp && pattern.test(message)) ||\n (typeof pattern === 'string' && message.includes(pattern))\n ) {\n return true;\n }\n }\n return false;\n}\n\nfunction setImmediateShim(callback: () => void) {\n if (!global.setImmediate) {\n return setTimeout(callback, 0);\n }\n return global.setImmediate(callback);\n}\n\nfunction handleUpdate(): void {\n if (updateTimeout == null) {\n updateTimeout = setImmediateShim(() => {\n updateTimeout = null;\n const nextState = getNextState();\n observers.forEach(({ observer }) => observer(nextState));\n });\n }\n}\n\nfunction appendNewLog(newLog: LogBoxLog): void {\n // Don't want store these logs because they trigger a\n // state update when we add them to the store.\n if (isMessageIgnored(newLog.message.content)) {\n return;\n }\n\n // If the next log has the same category as the previous one\n // then roll it up into the last log in the list by incrementing\n // the count (similar to how Chrome does it).\n const lastLog = Array.from(logs).pop();\n if (lastLog && lastLog.category === newLog.category) {\n lastLog.incrementCount();\n handleUpdate();\n return;\n }\n\n if (newLog.level === 'fatal') {\n // If possible, to avoid jank, we don't want to open the error before\n // it's symbolicated. To do that, we optimistically wait for\n // symbolication for up to a second before adding the log.\n const OPTIMISTIC_WAIT_TIME = 1000;\n\n let addPendingLog: null | (() => void) = () => {\n logs.add(newLog);\n if (_selectedIndex < 0) {\n setSelectedLog(logs.size - 1);\n } else {\n handleUpdate();\n }\n addPendingLog = null;\n };\n\n const optimisticTimeout = setTimeout(() => {\n if (addPendingLog) {\n addPendingLog();\n }\n }, OPTIMISTIC_WAIT_TIME);\n\n // TODO: HANDLE THIS\n newLog.symbolicate('component');\n\n newLog.symbolicate('stack', (status) => {\n if (addPendingLog && status !== 'PENDING') {\n addPendingLog();\n clearTimeout(optimisticTimeout);\n } else if (status !== 'PENDING') {\n // The log has already been added but we need to trigger a render.\n handleUpdate();\n }\n });\n } else if (newLog.level === 'syntax') {\n logs.add(newLog);\n setSelectedLog(logs.size - 1);\n } else {\n logs.add(newLog);\n handleUpdate();\n }\n}\n\nexport function addLog(log: LogData): void {\n const errorForStackTrace = new Error();\n\n // Parsing logs are expensive so we schedule this\n // otherwise spammy logs would pause rendering.\n setImmediate(() => {\n try {\n const stack = parseErrorStack(errorForStackTrace?.stack);\n\n appendNewLog(\n new LogBoxLog({\n level: log.level,\n message: log.message,\n isComponentError: false,\n stack,\n category: log.category,\n componentStack: log.componentStack,\n })\n );\n } catch (error) {\n reportUnexpectedLogBoxError(error);\n }\n });\n}\n\nexport function addException(error: ExtendedExceptionData): void {\n // Parsing logs are expensive so we schedule this\n // otherwise spammy logs would pause rendering.\n setImmediate(() => {\n try {\n appendNewLog(new LogBoxLog(parseLogBoxException(error)));\n } catch (loggingError) {\n reportUnexpectedLogBoxError(loggingError);\n }\n });\n}\n\nexport function symbolicateLogNow(type: StackType, log: LogBoxLog) {\n log.symbolicate(type, () => {\n handleUpdate();\n });\n}\n\nexport function retrySymbolicateLogNow(type: StackType, log: LogBoxLog) {\n log.retrySymbolicate(type, () => {\n handleUpdate();\n });\n}\n\nexport function symbolicateLogLazy(type: StackType, log: LogBoxLog) {\n log.symbolicate(type);\n}\n\nexport function clear(): void {\n if (logs.size > 0) {\n logs = new Set();\n setSelectedLog(-1);\n }\n}\n\nexport function setSelectedLog(proposedNewIndex: number): void {\n const oldIndex = _selectedIndex;\n let newIndex = proposedNewIndex;\n\n const logArray = Array.from(logs);\n let index = logArray.length - 1;\n while (index >= 0) {\n // The latest syntax error is selected and displayed before all other logs.\n if (logArray[index].level === 'syntax') {\n newIndex = index;\n break;\n }\n index -= 1;\n }\n _selectedIndex = newIndex;\n handleUpdate();\n if (NativeLogBox) {\n setTimeout(() => {\n if (oldIndex < 0 && newIndex >= 0) {\n NativeLogBox.show();\n } else if (oldIndex >= 0 && newIndex < 0) {\n NativeLogBox.hide();\n }\n }, 0);\n }\n}\n\nexport function clearWarnings(): void {\n const newLogs = Array.from(logs).filter((log) => log.level !== 'warn');\n if (newLogs.length !== logs.size) {\n logs = new Set(newLogs);\n setSelectedLog(-1);\n handleUpdate();\n }\n}\n\nexport function clearErrors(): void {\n const newLogs = Array.from(logs).filter((log) => log.level !== 'error' && log.level !== 'fatal');\n if (newLogs.length !== logs.size) {\n logs = new Set(newLogs);\n setSelectedLog(-1);\n }\n}\n\nexport function dismiss(log: LogBoxLog): void {\n if (logs.has(log)) {\n logs.delete(log);\n handleUpdate();\n }\n}\n\nexport function getIgnorePatterns(): IgnorePattern[] {\n return Array.from(ignorePatterns);\n}\n\nexport function addIgnorePatterns(patterns: IgnorePattern[]): void {\n const existingSize = ignorePatterns.size;\n // The same pattern may be added multiple times, but adding a new pattern\n // can be expensive so let's find only the ones that are new.\n patterns.forEach((pattern: IgnorePattern) => {\n if (pattern instanceof RegExp) {\n for (const existingPattern of ignorePatterns) {\n if (\n existingPattern instanceof RegExp &&\n existingPattern.toString() === pattern.toString()\n ) {\n return;\n }\n }\n ignorePatterns.add(pattern);\n }\n ignorePatterns.add(pattern);\n });\n if (ignorePatterns.size === existingSize) {\n return;\n }\n // We need to recheck all of the existing logs.\n // This allows adding an ignore pattern anywhere in the codebase.\n // Without this, if you ignore a pattern after the a log is created,\n // then we would keep showing the log.\n logs = new Set(Array.from(logs).filter((log) => !isMessageIgnored(log.message.content)));\n handleUpdate();\n}\n\nexport function setDisabled(value: boolean): void {\n if (value === _isDisabled) {\n return;\n }\n _isDisabled = value;\n handleUpdate();\n}\n\nexport function isDisabled(): boolean {\n return _isDisabled;\n}\n\nexport function observe(observer: Observer): Subscription {\n const subscription = { observer };\n observers.add(subscription);\n\n observer(getNextState());\n\n return {\n unsubscribe(): void {\n observers.delete(subscription);\n },\n };\n}\n\nexport function withSubscription(WrappedComponent: React.FC<object>): React.Component<object> {\n class LogBoxStateSubscription extends React.Component<React.PropsWithChildren<Props>, State> {\n static getDerivedStateFromError() {\n return { hasError: true };\n }\n\n componentDidCatch(err: Error, errorInfo: { componentStack: string } & any) {\n /* $FlowFixMe[class-object-subtyping] added when improving typing for\n * this parameters */\n reportLogBoxError(err, errorInfo.componentStack);\n }\n\n _subscription?: Subscription;\n\n state = {\n logs: new Set<LogBoxLog>(),\n isDisabled: false,\n hasError: false,\n selectedLogIndex: -1,\n };\n\n render() {\n if (this.state.hasError) {\n // This happens when the component failed to render, in which case we delegate to the native redbox.\n // We can't show any fallback UI here, because the error may be with <View> or <Text>.\n return null;\n }\n\n return (\n <LogContext.Provider\n value={{\n selectedLogIndex: this.state.selectedLogIndex,\n isDisabled: this.state.isDisabled,\n logs: Array.from(this.state.logs),\n }}>\n {this.props.children}\n <WrappedComponent />\n </LogContext.Provider>\n );\n }\n\n componentDidMount(): void {\n this._subscription = observe((data) => {\n this.setState(data);\n });\n }\n\n componentWillUnmount(): void {\n if (this._subscription != null) {\n this._subscription.unsubscribe();\n }\n }\n\n _handleDismiss = (): void => {\n // Here we handle the cases when the log is dismissed and it\n // was either the last log, or when the current index\n // is now outside the bounds of the log array.\n const { selectedLogIndex, logs: stateLogs } = this.state;\n const logsArray = Array.from(stateLogs);\n if (selectedLogIndex != null) {\n if (logsArray.length - 1 <= 0) {\n setSelectedLog(-1);\n } else if (selectedLogIndex >= logsArray.length - 1) {\n setSelectedLog(selectedLogIndex - 1);\n }\n\n dismiss(logsArray[selectedLogIndex]);\n }\n };\n\n _handleMinimize = (): void => {\n setSelectedLog(-1);\n };\n\n _handleSetSelectedLog = (index: number): void => {\n setSelectedLog(index);\n };\n }\n\n // @ts-expect-error\n return LogBoxStateSubscription;\n}\n"]}
1
+ {"version":3,"file":"LogBoxData.js","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogBoxData.tsx"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,2CAAmD;AAEnD,6CAA0C;AAC1C,qDAAwD;AAExD,2EAAmD;AACnD,iFAAyD;AA8CzD,MAAM,SAAS,GAAsC,IAAI,GAAG,EAAE,CAAC;AAC/D,MAAM,cAAc,GAAuB,IAAI,GAAG,EAAE,CAAC;AACrD,IAAI,IAAI,GAAe,IAAI,GAAG,EAAE,CAAC;AACjC,IAAI,aAAa,GAA2E,IAAI,CAAC;AACjG,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB,IAAI,cAAc,GAAG,CAAC,CAAC,CAAC;AAExB,MAAM,oBAAoB,GACxB,wEAAwE,CAAC;AAE3E,SAAS,YAAY;IACnB,OAAO;QACL,IAAI;QACJ,UAAU,EAAE,WAAW;QACvB,gBAAgB,EAAE,cAAc;KACjC,CAAC;AACJ,CAAC;AAED,SAAgB,iBAAiB,CAAC,KAAoB,EAAE,cAAuB;IAC7E,MAAM,iBAAiB,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC,OAAO,CAAC;IAE1E,IAAI,cAAc,IAAI,IAAI,EAAE;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esContent":["/**\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 */\n\nimport * as React from 'react';\n\nimport { LogBoxLog, StackType } from './LogBoxLog';\nimport type { LogLevel } from './LogBoxLog';\nimport { LogContext } from './LogContext';\nimport { parseLogBoxException } from './parseLogBoxLog';\nimport type { Message, Category, ComponentStack, ExtendedExceptionData } from './parseLogBoxLog';\nimport NativeLogBox from '../modules/NativeLogBox';\nimport parseErrorStack from '../modules/parseErrorStack';\n\nexport type LogBoxLogs = Set<LogBoxLog>;\n\nexport type LogData = {\n level: LogLevel;\n message: Message;\n category: Category;\n componentStack: ComponentStack;\n};\n\ntype ExtendedError = any;\n\nexport type Observer = (options: {\n logs: LogBoxLogs;\n isDisabled: boolean;\n selectedLogIndex: number;\n}) => void;\n\nexport type IgnorePattern = string | RegExp;\n\nexport type Subscription = {\n unsubscribe: () => void;\n};\n\nexport type WarningInfo = {\n finalFormat: string;\n forceDialogImmediately: boolean;\n suppressDialog_LEGACY: boolean;\n suppressCompletely: boolean;\n monitorEvent: string | null;\n monitorListVersion: number;\n monitorSampleRate: number;\n};\n\nexport type WarningFilter = (format: string) => WarningInfo;\n\ntype Props = object;\n\ntype State = {\n logs: LogBoxLogs;\n isDisabled: boolean;\n hasError: boolean;\n selectedLogIndex: number;\n};\n\nconst observers: Set<{ observer: Observer } & any> = new Set();\nconst ignorePatterns: Set<IgnorePattern> = new Set();\nlet logs: LogBoxLogs = new Set();\nlet updateTimeout: null | ReturnType<typeof setImmediate> | ReturnType<typeof setTimeout> = null;\nlet _isDisabled = false;\nlet _selectedIndex = -1;\n\nconst LOGBOX_ERROR_MESSAGE =\n 'An error was thrown when attempting to render log messages via LogBox.';\n\nfunction getNextState() {\n return {\n logs,\n isDisabled: _isDisabled,\n selectedLogIndex: _selectedIndex,\n };\n}\n\nexport function reportLogBoxError(error: ExtendedError, componentStack?: string): void {\n const ExceptionsManager = require('../modules/ExceptionsManager').default;\n\n if (componentStack != null) {\n error.componentStack = componentStack;\n }\n ExceptionsManager.handleException(error);\n}\n\nexport function reportUnexpectedLogBoxError(error: ExtendedError, componentStack?: string): void {\n error.message = `${LOGBOX_ERROR_MESSAGE}\\n\\n${error.message}`;\n return reportLogBoxError(error, componentStack);\n}\n\nexport function isLogBoxErrorMessage(message: string): boolean {\n return typeof message === 'string' && message.includes(LOGBOX_ERROR_MESSAGE);\n}\n\nexport function isMessageIgnored(message: string): boolean {\n for (const pattern of ignorePatterns) {\n if (\n (pattern instanceof RegExp && pattern.test(message)) ||\n (typeof pattern === 'string' && message.includes(pattern))\n ) {\n return true;\n }\n }\n return false;\n}\n\nfunction setImmediateShim(callback: () => void) {\n if (!global.setImmediate) {\n return setTimeout(callback, 0);\n }\n return global.setImmediate(callback);\n}\n\nfunction handleUpdate(): void {\n if (updateTimeout == null) {\n updateTimeout = setImmediateShim(() => {\n updateTimeout = null;\n const nextState = getNextState();\n observers.forEach(({ observer }) => observer(nextState));\n });\n }\n}\n\nfunction appendNewLog(newLog: LogBoxLog): void {\n // Don't want store these logs because they trigger a\n // state update when we add them to the store.\n if (isMessageIgnored(newLog.message.content)) {\n return;\n }\n\n // If the next log has the same category as the previous one\n // then roll it up into the last log in the list by incrementing\n // the count (similar to how Chrome does it).\n const lastLog = Array.from(logs).pop();\n if (lastLog && lastLog.category === newLog.category) {\n lastLog.incrementCount();\n handleUpdate();\n return;\n }\n\n if (newLog.level === 'fatal') {\n // If possible, to avoid jank, we don't want to open the error before\n // it's symbolicated. To do that, we optimistically wait for\n // symbolication for up to a second before adding the log.\n const OPTIMISTIC_WAIT_TIME = 1000;\n\n let addPendingLog: null | (() => void) = () => {\n logs.add(newLog);\n if (_selectedIndex < 0) {\n setSelectedLog(logs.size - 1);\n } else {\n handleUpdate();\n }\n addPendingLog = null;\n };\n\n const optimisticTimeout = setTimeout(() => {\n if (addPendingLog) {\n addPendingLog();\n }\n }, OPTIMISTIC_WAIT_TIME);\n\n // TODO: HANDLE THIS\n newLog.symbolicate('component');\n\n newLog.symbolicate('stack', (status) => {\n if (addPendingLog && status !== 'PENDING') {\n addPendingLog();\n clearTimeout(optimisticTimeout);\n } else if (status !== 'PENDING') {\n // The log has already been added but we need to trigger a render.\n handleUpdate();\n }\n });\n } else if (newLog.level === 'syntax') {\n logs.add(newLog);\n setSelectedLog(logs.size - 1);\n } else {\n logs.add(newLog);\n handleUpdate();\n }\n}\n\nexport function addLog(log: LogData): void {\n const errorForStackTrace = new Error();\n\n // Parsing logs are expensive so we schedule this\n // otherwise spammy logs would pause rendering.\n setImmediate(() => {\n try {\n const stack = parseErrorStack(errorForStackTrace?.stack);\n\n appendNewLog(\n new LogBoxLog({\n level: log.level,\n message: log.message,\n isComponentError: false,\n stack,\n category: log.category,\n componentStack: log.componentStack,\n })\n );\n } catch (error) {\n reportUnexpectedLogBoxError(error);\n }\n });\n}\n\nexport function addException(error: ExtendedExceptionData): void {\n // Parsing logs are expensive so we schedule this\n // otherwise spammy logs would pause rendering.\n setImmediate(() => {\n try {\n appendNewLog(new LogBoxLog(parseLogBoxException(error)));\n } catch (loggingError) {\n reportUnexpectedLogBoxError(loggingError);\n }\n });\n}\n\nexport function symbolicateLogNow(type: StackType, log: LogBoxLog) {\n log.symbolicate(type, () => {\n handleUpdate();\n });\n}\n\nexport function retrySymbolicateLogNow(type: StackType, log: LogBoxLog) {\n log.retrySymbolicate(type, () => {\n handleUpdate();\n });\n}\n\nexport function symbolicateLogLazy(type: StackType, log: LogBoxLog) {\n log.symbolicate(type);\n}\n\nexport function clear(): void {\n if (logs.size > 0) {\n logs = new Set();\n setSelectedLog(-1);\n }\n}\n\nexport function setSelectedLog(proposedNewIndex: number): void {\n const oldIndex = _selectedIndex;\n let newIndex = proposedNewIndex;\n\n const logArray = Array.from(logs);\n let index = logArray.length - 1;\n while (index >= 0) {\n // The latest syntax error is selected and displayed before all other logs.\n if (logArray[index].level === 'syntax') {\n newIndex = index;\n break;\n }\n index -= 1;\n }\n _selectedIndex = newIndex;\n handleUpdate();\n if (NativeLogBox) {\n setTimeout(() => {\n if (oldIndex < 0 && newIndex >= 0) {\n NativeLogBox.show();\n } else if (oldIndex >= 0 && newIndex < 0) {\n NativeLogBox.hide();\n }\n }, 0);\n }\n}\n\nexport function clearWarnings(): void {\n const newLogs = Array.from(logs).filter((log) => log.level !== 'warn');\n if (newLogs.length !== logs.size) {\n logs = new Set(newLogs);\n setSelectedLog(-1);\n handleUpdate();\n }\n}\n\nexport function clearErrors(): void {\n const newLogs = Array.from(logs).filter((log) => log.level !== 'error' && log.level !== 'fatal');\n if (newLogs.length !== logs.size) {\n logs = new Set(newLogs);\n setSelectedLog(-1);\n }\n}\n\nexport function dismiss(log: LogBoxLog): void {\n if (logs.has(log)) {\n logs.delete(log);\n handleUpdate();\n }\n}\n\nexport function getIgnorePatterns(): IgnorePattern[] {\n return Array.from(ignorePatterns);\n}\n\nexport function addIgnorePatterns(patterns: IgnorePattern[]): void {\n const existingSize = ignorePatterns.size;\n // The same pattern may be added multiple times, but adding a new pattern\n // can be expensive so let's find only the ones that are new.\n patterns.forEach((pattern: IgnorePattern) => {\n if (pattern instanceof RegExp) {\n for (const existingPattern of ignorePatterns) {\n if (\n existingPattern instanceof RegExp &&\n existingPattern.toString() === pattern.toString()\n ) {\n return;\n }\n }\n ignorePatterns.add(pattern);\n }\n ignorePatterns.add(pattern);\n });\n if (ignorePatterns.size === existingSize) {\n return;\n }\n // We need to recheck all of the existing logs.\n // This allows adding an ignore pattern anywhere in the codebase.\n // Without this, if you ignore a pattern after the a log is created,\n // then we would keep showing the log.\n logs = new Set(Array.from(logs).filter((log) => !isMessageIgnored(log.message.content)));\n handleUpdate();\n}\n\nexport function setDisabled(value: boolean): void {\n if (value === _isDisabled) {\n return;\n }\n _isDisabled = value;\n handleUpdate();\n}\n\nexport function isDisabled(): boolean {\n return _isDisabled;\n}\n\nexport function observe(observer: Observer): Subscription {\n const subscription = { observer };\n observers.add(subscription);\n\n observer(getNextState());\n\n return {\n unsubscribe(): void {\n observers.delete(subscription);\n },\n };\n}\n\nexport function withSubscription(WrappedComponent: React.FC<object>): React.Component<object> {\n class LogBoxStateSubscription extends React.Component<React.PropsWithChildren<Props>, State> {\n static getDerivedStateFromError() {\n return { hasError: true };\n }\n\n componentDidCatch(err: Error, errorInfo: { componentStack: string } & any) {\n /* $FlowFixMe[class-object-subtyping] added when improving typing for\n * this parameters */\n reportLogBoxError(err, errorInfo.componentStack);\n }\n\n _subscription?: Subscription;\n\n state = {\n logs: new Set<LogBoxLog>(),\n isDisabled: false,\n hasError: false,\n selectedLogIndex: -1,\n };\n\n render() {\n if (this.state.hasError) {\n // This happens when the component failed to render, in which case we delegate to the native redbox.\n // We can't show any fallback UI here, because the error may be with <View> or <Text>.\n return null;\n }\n\n return (\n <LogContext.Provider\n value={{\n selectedLogIndex: this.state.selectedLogIndex,\n isDisabled: this.state.isDisabled,\n logs: Array.from(this.state.logs),\n }}>\n {this.props.children}\n <WrappedComponent />\n </LogContext.Provider>\n );\n }\n\n componentDidMount(): void {\n this._subscription = observe((data) => {\n this.setState(data);\n });\n }\n\n componentWillUnmount(): void {\n if (this._subscription != null) {\n this._subscription.unsubscribe();\n }\n }\n\n _handleDismiss = (): void => {\n // Here we handle the cases when the log is dismissed and it\n // was either the last log, or when the current index\n // is now outside the bounds of the log array.\n const { selectedLogIndex, logs: stateLogs } = this.state;\n const logsArray = Array.from(stateLogs);\n if (selectedLogIndex != null) {\n if (logsArray.length - 1 <= 0) {\n setSelectedLog(-1);\n } else if (selectedLogIndex >= logsArray.length - 1) {\n setSelectedLog(selectedLogIndex - 1);\n }\n\n dismiss(logsArray[selectedLogIndex]);\n }\n };\n\n _handleMinimize = (): void => {\n setSelectedLog(-1);\n };\n\n _handleSetSelectedLog = (index: number): void => {\n setSelectedLog(index);\n };\n }\n\n // @ts-expect-error\n return LogBoxStateSubscription;\n}\n"]}