@expo/cli 0.11.1 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (326) hide show
  1. package/build/bin/cli +2 -2
  2. package/build/src/api/getExpoGoIntermediateCertificate.js +1 -1
  3. package/build/src/api/getExpoGoIntermediateCertificate.js.map +1 -1
  4. package/build/src/api/getExpoSchema.js +1 -1
  5. package/build/src/api/getExpoSchema.js.map +1 -1
  6. package/build/src/api/getNativeModuleVersions.js +1 -1
  7. package/build/src/api/getNativeModuleVersions.js.map +1 -1
  8. package/build/src/api/getProjectDevelopmentCertificate.js +1 -1
  9. package/build/src/api/getProjectDevelopmentCertificate.js.map +1 -1
  10. package/build/src/api/getVersions.js +1 -1
  11. package/build/src/api/getVersions.js.map +1 -1
  12. package/build/src/api/rest/cache/wrapFetchWithCache.js.map +1 -1
  13. package/build/src/api/rest/client.js +5 -5
  14. package/build/src/api/rest/client.js.map +1 -1
  15. package/build/src/api/rest/wrapFetchWithOffline.js.map +1 -1
  16. package/build/src/api/rest/wrapFetchWithProgress.js.map +1 -1
  17. package/build/src/api/rest/wrapFetchWithProxy.js.map +1 -1
  18. package/build/src/api/updateDevelopmentSession.js +1 -1
  19. package/build/src/api/updateDevelopmentSession.js.map +1 -1
  20. package/build/src/api/user/actions.js +2 -2
  21. package/build/src/api/user/actions.js.map +1 -1
  22. package/build/src/api/user/otp.js +1 -1
  23. package/build/src/api/user/otp.js.map +1 -1
  24. package/build/src/api/user/user.js +2 -2
  25. package/build/src/api/user/user.js.map +1 -1
  26. package/build/src/config/configAsync.js +17 -1
  27. package/build/src/config/configAsync.js.map +1 -1
  28. package/build/src/customize/customizeAsync.js +1 -1
  29. package/build/src/customize/customizeAsync.js.map +1 -1
  30. package/build/src/customize/generate.js +29 -2
  31. package/build/src/customize/generate.js.map +1 -1
  32. package/build/src/customize/templates.js +8 -0
  33. package/build/src/customize/templates.js.map +1 -1
  34. package/build/src/customize/typescript.js +54 -0
  35. package/build/src/customize/typescript.js.map +1 -0
  36. package/build/src/export/createBundles.js +1 -31
  37. package/build/src/export/createBundles.js.map +1 -1
  38. package/build/src/export/createMetadataJson.js.map +1 -1
  39. package/build/src/export/embed/exportEmbedAsync.js +52 -4
  40. package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
  41. package/build/src/export/embed/index.js +1 -3
  42. package/build/src/export/embed/index.js.map +1 -1
  43. package/build/src/export/embed/resolveOptions.js +6 -10
  44. package/build/src/export/embed/resolveOptions.js.map +1 -1
  45. package/build/src/export/exportApp.js +73 -46
  46. package/build/src/export/exportApp.js.map +1 -1
  47. package/build/src/export/exportAssets.js +4 -4
  48. package/build/src/export/exportAssets.js.map +1 -1
  49. package/build/src/export/exportAsync.js +1 -1
  50. package/build/src/export/exportAsync.js.map +1 -1
  51. package/build/src/export/exportHermes.js +204 -0
  52. package/build/src/export/exportHermes.js.map +1 -0
  53. package/build/src/export/exportStaticAsync.js +48 -14
  54. package/build/src/export/exportStaticAsync.js.map +1 -1
  55. package/build/src/export/favicon.js +7 -7
  56. package/build/src/export/favicon.js.map +1 -1
  57. package/build/src/export/fork-bundleAsync.js +35 -12
  58. package/build/src/export/fork-bundleAsync.js.map +1 -1
  59. package/build/src/export/getPublicExpoManifest.js +1 -1
  60. package/build/src/export/getPublicExpoManifest.js.map +1 -1
  61. package/build/src/export/getResolvedLocales.js.map +1 -1
  62. package/build/src/export/persistMetroAssets.js +118 -0
  63. package/build/src/export/persistMetroAssets.js.map +1 -0
  64. package/build/src/export/printBundleSizes.js.map +1 -1
  65. package/build/src/export/saveAssets.js.map +1 -1
  66. package/build/src/export/web/exportWebAsync.js.map +1 -1
  67. package/build/src/export/writeContents.js +5 -1
  68. package/build/src/export/writeContents.js.map +1 -1
  69. package/build/src/install/checkPackages.js +1 -1
  70. package/build/src/install/checkPackages.js.map +1 -1
  71. package/build/src/install/index.js +1 -0
  72. package/build/src/install/index.js.map +1 -1
  73. package/build/src/install/installAsync.js +2 -1
  74. package/build/src/install/installAsync.js.map +1 -1
  75. package/build/src/install/resolveOptions.js +7 -4
  76. package/build/src/install/resolveOptions.js.map +1 -1
  77. package/build/src/prebuild/configureProjectAsync.js +5 -9
  78. package/build/src/prebuild/configureProjectAsync.js.map +1 -1
  79. package/build/src/prebuild/index.js +2 -0
  80. package/build/src/prebuild/index.js.map +1 -1
  81. package/build/src/prebuild/prebuildAsync.js +7 -6
  82. package/build/src/prebuild/prebuildAsync.js.map +1 -1
  83. package/build/src/prebuild/resolveOptions.js +4 -2
  84. package/build/src/prebuild/resolveOptions.js.map +1 -1
  85. package/build/src/prebuild/updateFromTemplate.js +8 -5
  86. package/build/src/prebuild/updateFromTemplate.js.map +1 -1
  87. package/build/src/register/registerAsync.js +0 -1
  88. package/build/src/register/registerAsync.js.map +1 -1
  89. package/build/src/run/android/resolveInstallApkName.js.map +1 -1
  90. package/build/src/run/android/resolveOptions.js +1 -1
  91. package/build/src/run/android/resolveOptions.js.map +1 -1
  92. package/build/src/run/android/runAndroidAsync.js +7 -2
  93. package/build/src/run/android/runAndroidAsync.js.map +1 -1
  94. package/build/src/run/ios/XcodeBuild.js +2 -2
  95. package/build/src/run/ios/XcodeBuild.js.map +1 -1
  96. package/build/src/run/ios/appleDevice/AppleDevice.js +4 -4
  97. package/build/src/run/ios/appleDevice/AppleDevice.js.map +1 -1
  98. package/build/src/run/ios/appleDevice/ClientManager.js +1 -1
  99. package/build/src/run/ios/appleDevice/ClientManager.js.map +1 -1
  100. package/build/src/run/ios/appleDevice/client/AFCClient.js +1 -1
  101. package/build/src/run/ios/appleDevice/client/AFCClient.js.map +1 -1
  102. package/build/src/run/ios/appleDevice/client/DebugserverClient.js +1 -1
  103. package/build/src/run/ios/appleDevice/client/DebugserverClient.js.map +1 -1
  104. package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js +1 -1
  105. package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js.map +1 -1
  106. package/build/src/run/ios/appleDevice/client/LockdowndClient.js +1 -1
  107. package/build/src/run/ios/appleDevice/client/LockdowndClient.js.map +1 -1
  108. package/build/src/run/ios/appleDevice/client/MobileImageMounterClient.js +1 -1
  109. package/build/src/run/ios/appleDevice/client/MobileImageMounterClient.js.map +1 -1
  110. package/build/src/run/ios/appleDevice/client/ServiceClient.js.map +1 -1
  111. package/build/src/run/ios/appleDevice/client/UsbmuxdClient.js +1 -1
  112. package/build/src/run/ios/appleDevice/client/UsbmuxdClient.js.map +1 -1
  113. package/build/src/run/ios/appleDevice/installOnDeviceAsync.js +1 -1
  114. package/build/src/run/ios/appleDevice/installOnDeviceAsync.js.map +1 -1
  115. package/build/src/run/ios/appleDevice/protocol/AFCProtocol.js +1 -1
  116. package/build/src/run/ios/appleDevice/protocol/AFCProtocol.js.map +1 -1
  117. package/build/src/run/ios/appleDevice/protocol/AbstractProtocol.js.map +1 -1
  118. package/build/src/run/ios/appleDevice/protocol/GDBProtocol.js +1 -1
  119. package/build/src/run/ios/appleDevice/protocol/GDBProtocol.js.map +1 -1
  120. package/build/src/run/ios/appleDevice/protocol/LockdownProtocol.js +1 -1
  121. package/build/src/run/ios/appleDevice/protocol/LockdownProtocol.js.map +1 -1
  122. package/build/src/run/ios/codeSigning/configureCodeSigning.js +1 -1
  123. package/build/src/run/ios/codeSigning/configureCodeSigning.js.map +1 -1
  124. package/build/src/run/ios/codeSigning/resolveCertificateSigningIdentity.js +2 -2
  125. package/build/src/run/ios/codeSigning/resolveCertificateSigningIdentity.js.map +1 -1
  126. package/build/src/run/ios/codeSigning/xcodeCodeSigning.js +3 -0
  127. package/build/src/run/ios/codeSigning/xcodeCodeSigning.js.map +1 -1
  128. package/build/src/run/ios/index.js.map +1 -1
  129. package/build/src/run/ios/launchApp.js +2 -2
  130. package/build/src/run/ios/launchApp.js.map +1 -1
  131. package/build/src/run/ios/options/resolveDevice.js +1 -1
  132. package/build/src/run/ios/options/resolveDevice.js.map +1 -1
  133. package/build/src/run/ios/options/resolveOptions.js +2 -2
  134. package/build/src/run/ios/options/resolveOptions.js.map +1 -1
  135. package/build/src/run/ios/runIosAsync.js +8 -3
  136. package/build/src/run/ios/runIosAsync.js.map +1 -1
  137. package/build/src/start/doctor/apple/XcodePrerequisite.js +43 -2
  138. package/build/src/start/doctor/apple/XcodePrerequisite.js.map +1 -1
  139. package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js +1 -1
  140. package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js.map +1 -1
  141. package/build/src/start/doctor/dependencies/getVersionedPackages.js +5 -3
  142. package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
  143. package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +1 -1
  144. package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -1
  145. package/build/src/start/doctor/ngrok/ExternalModule.js.map +1 -1
  146. package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js +7 -7
  147. package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js.map +1 -1
  148. package/build/src/start/doctor/typescript/updateTSConfig.js +11 -10
  149. package/build/src/start/doctor/typescript/updateTSConfig.js.map +1 -1
  150. package/build/src/start/index.js +0 -2
  151. package/build/src/start/index.js.map +1 -1
  152. package/build/src/start/interface/interactiveActions.js +4 -4
  153. package/build/src/start/interface/interactiveActions.js.map +1 -1
  154. package/build/src/start/interface/startInterface.js +3 -3
  155. package/build/src/start/interface/startInterface.js.map +1 -1
  156. package/build/src/start/platforms/ExpoGoInstaller.js.map +1 -1
  157. package/build/src/start/platforms/PlatformManager.js.map +1 -1
  158. package/build/src/start/platforms/android/ADBServer.js +1 -1
  159. package/build/src/start/platforms/android/ADBServer.js.map +1 -1
  160. package/build/src/start/platforms/android/AndroidDeviceManager.js +5 -5
  161. package/build/src/start/platforms/android/AndroidDeviceManager.js.map +1 -1
  162. package/build/src/start/platforms/android/AndroidPlatformManager.js +1 -1
  163. package/build/src/start/platforms/android/AndroidPlatformManager.js.map +1 -1
  164. package/build/src/start/platforms/android/adb.js +1 -1
  165. package/build/src/start/platforms/android/adb.js.map +1 -1
  166. package/build/src/start/platforms/android/adbReverse.js +2 -2
  167. package/build/src/start/platforms/android/adbReverse.js.map +1 -1
  168. package/build/src/start/platforms/android/emulator.js +1 -1
  169. package/build/src/start/platforms/android/emulator.js.map +1 -1
  170. package/build/src/start/platforms/android/getDevices.js +1 -1
  171. package/build/src/start/platforms/android/getDevices.js.map +1 -1
  172. package/build/src/start/platforms/android/promptAndroidDevice.js +1 -1
  173. package/build/src/start/platforms/android/promptAndroidDevice.js.map +1 -1
  174. package/build/src/start/platforms/ios/AppleDeviceManager.js +5 -5
  175. package/build/src/start/platforms/ios/AppleDeviceManager.js.map +1 -1
  176. package/build/src/start/platforms/ios/ApplePlatformManager.js +1 -1
  177. package/build/src/start/platforms/ios/ApplePlatformManager.js.map +1 -1
  178. package/build/src/start/platforms/ios/ensureSimulatorAppRunning.js.map +1 -1
  179. package/build/src/start/platforms/ios/getBestSimulator.js +1 -1
  180. package/build/src/start/platforms/ios/getBestSimulator.js.map +1 -1
  181. package/build/src/start/platforms/ios/promptAppleDevice.js +1 -1
  182. package/build/src/start/platforms/ios/promptAppleDevice.js.map +1 -1
  183. package/build/src/start/platforms/ios/simctl.js +1 -1
  184. package/build/src/start/platforms/ios/simctl.js.map +1 -1
  185. package/build/src/start/platforms/ios/simctlLogging.js +1 -1
  186. package/build/src/start/platforms/ios/simctlLogging.js.map +1 -1
  187. package/build/src/start/resolveOptions.js +0 -5
  188. package/build/src/start/resolveOptions.js.map +1 -1
  189. package/build/src/start/server/AsyncNgrok.js +4 -3
  190. package/build/src/start/server/AsyncNgrok.js.map +1 -1
  191. package/build/src/start/server/BundlerDevServer.js +4 -11
  192. package/build/src/start/server/BundlerDevServer.js.map +1 -1
  193. package/build/src/start/server/DevServerManager.js +3 -2
  194. package/build/src/start/server/DevServerManager.js.map +1 -1
  195. package/build/src/start/server/UrlCreator.js +2 -1
  196. package/build/src/start/server/UrlCreator.js.map +1 -1
  197. package/build/src/start/server/getStaticRenderFunctions.js +3 -12
  198. package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
  199. package/build/src/start/server/metro/MetroBundlerDevServer.js +57 -36
  200. package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
  201. package/build/src/start/server/metro/MetroTerminalReporter.js +15 -4
  202. package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
  203. package/build/src/start/server/metro/TerminalReporter.js.map +1 -1
  204. package/build/src/start/server/metro/TerminalReporter.types.js.map +1 -1
  205. package/build/src/start/server/metro/inspector-proxy/device.js.map +1 -1
  206. package/build/src/start/server/metro/inspector-proxy/handlers/NetworkResponse.js.map +1 -1
  207. package/build/src/start/server/metro/inspector-proxy/handlers/PageReload.js.map +1 -1
  208. package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerGetPossibleBreakpoints.js.map +1 -1
  209. package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerScriptParsed.js.map +1 -1
  210. package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerSetBreakpointByUrl.js.map +1 -1
  211. package/build/src/start/server/metro/inspector-proxy/handlers/VscodeRuntimeGetProperties.js.map +1 -1
  212. package/build/src/start/server/metro/inspector-proxy/handlers/types.js.map +1 -1
  213. package/build/src/start/server/metro/inspector-proxy/index.js +1 -1
  214. package/build/src/start/server/metro/inspector-proxy/index.js.map +1 -1
  215. package/build/src/start/server/metro/instantiateMetro.js +74 -13
  216. package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
  217. package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
  218. package/build/src/start/server/metro/resolveFromProject.js +13 -4
  219. package/build/src/start/server/metro/resolveFromProject.js.map +1 -1
  220. package/build/src/start/server/metro/runServer-fork.js +1 -1
  221. package/build/src/start/server/metro/runServer-fork.js.map +1 -1
  222. package/build/src/start/server/metro/withMetroMultiPlatform.js +43 -5
  223. package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
  224. package/build/src/start/server/metro/withMetroResolvers.js +1 -1
  225. package/build/src/start/server/metro/withMetroResolvers.js.map +1 -1
  226. package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js +3 -3
  227. package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js.map +1 -1
  228. package/build/src/start/server/middleware/ExpoMiddleware.js.map +1 -1
  229. package/build/src/start/server/middleware/FaviconMiddleware.js +1 -1
  230. package/build/src/start/server/middleware/FaviconMiddleware.js.map +1 -1
  231. package/build/src/start/server/middleware/InterstitialPageMiddleware.js +3 -3
  232. package/build/src/start/server/middleware/InterstitialPageMiddleware.js.map +1 -1
  233. package/build/src/start/server/middleware/ManifestMiddleware.js +8 -5
  234. package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
  235. package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js +1 -1
  236. package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js.map +1 -1
  237. package/build/src/start/server/middleware/ServeStaticMiddleware.js +1 -1
  238. package/build/src/start/server/middleware/ServeStaticMiddleware.js.map +1 -1
  239. package/build/src/start/server/middleware/inspector/JsInspector.js +69 -0
  240. package/build/src/start/server/middleware/inspector/JsInspector.js.map +1 -0
  241. package/build/src/start/server/middleware/inspector/LaunchBrowser.js +57 -0
  242. package/build/src/start/server/middleware/inspector/LaunchBrowser.js.map +1 -0
  243. package/build/src/start/server/middleware/inspector/LaunchBrowser.types.js +13 -0
  244. package/build/src/start/server/middleware/inspector/LaunchBrowser.types.js.map +1 -0
  245. package/build/src/start/server/middleware/inspector/LaunchBrowserImplLinux.js +79 -0
  246. package/build/src/start/server/middleware/inspector/LaunchBrowserImplLinux.js.map +1 -0
  247. package/build/src/start/server/middleware/inspector/LaunchBrowserImplMacOS.js +78 -0
  248. package/build/src/start/server/middleware/inspector/LaunchBrowserImplMacOS.js.map +1 -0
  249. package/build/src/start/server/middleware/inspector/LaunchBrowserImplWindows.js +121 -0
  250. package/build/src/start/server/middleware/inspector/LaunchBrowserImplWindows.js.map +1 -0
  251. package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js +64 -0
  252. package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js.map +1 -0
  253. package/build/src/start/server/middleware/inspector/middlwareMutations.js +19 -0
  254. package/build/src/start/server/middleware/inspector/middlwareMutations.js.map +1 -0
  255. package/build/src/start/server/middleware/mutations.js +19 -0
  256. package/build/src/start/server/middleware/mutations.js.map +1 -0
  257. package/build/src/start/server/middleware/remoteDevtoolsCorsMiddleware.js +31 -0
  258. package/build/src/start/server/middleware/remoteDevtoolsCorsMiddleware.js.map +1 -0
  259. package/build/src/start/server/middleware/remoteDevtoolsSecurityHeadersMiddleware.js +17 -0
  260. package/build/src/start/server/middleware/remoteDevtoolsSecurityHeadersMiddleware.js.map +1 -0
  261. package/build/src/start/server/middleware/resolveAssets.js.map +1 -1
  262. package/build/src/start/server/middleware/resolvePlatform.js.map +1 -1
  263. package/build/src/start/server/middleware/server.types.js.map +1 -1
  264. package/build/src/start/server/middleware/suppressErrorMiddleware.js +16 -0
  265. package/build/src/start/server/middleware/suppressErrorMiddleware.js.map +1 -0
  266. package/build/src/start/server/openPlatforms.js.map +1 -1
  267. package/build/src/start/server/type-generation/__typetests__/fixtures/basic.js.map +1 -1
  268. package/build/src/start/server/type-generation/routes.js +6 -6
  269. package/build/src/start/server/type-generation/routes.js.map +1 -1
  270. package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js +3 -3
  271. package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js.map +1 -1
  272. package/build/src/start/server/webpack/WebpackBundlerDevServer.js +19 -87
  273. package/build/src/start/server/webpack/WebpackBundlerDevServer.js.map +1 -1
  274. package/build/src/start/server/webpack/compile.js +1 -1
  275. package/build/src/start/server/webpack/compile.js.map +1 -1
  276. package/build/src/start/startAsync.js +10 -32
  277. package/build/src/start/startAsync.js.map +1 -1
  278. package/build/src/utils/FileNotifier.js +1 -1
  279. package/build/src/utils/FileNotifier.js.map +1 -1
  280. package/build/src/utils/analytics/metroDebuggerMiddleware.js +1 -1
  281. package/build/src/utils/analytics/metroDebuggerMiddleware.js.map +1 -1
  282. package/build/src/utils/analytics/rudderstackClient.js +2 -2
  283. package/build/src/utils/array.js.map +1 -1
  284. package/build/src/utils/cocoapods.js +2 -2
  285. package/build/src/utils/cocoapods.js.map +1 -1
  286. package/build/src/utils/codesigning.js +2 -2
  287. package/build/src/utils/codesigning.js.map +1 -1
  288. package/build/src/utils/downloadAppAsync.js +1 -1
  289. package/build/src/utils/downloadAppAsync.js.map +1 -1
  290. package/build/src/utils/downloadExpoGoAsync.js +2 -2
  291. package/build/src/utils/downloadExpoGoAsync.js.map +1 -1
  292. package/build/src/utils/editor.js +1 -1
  293. package/build/src/utils/editor.js.map +1 -1
  294. package/build/src/utils/env.js +1 -1
  295. package/build/src/utils/env.js.map +1 -1
  296. package/build/src/utils/errors.js.map +1 -1
  297. package/build/src/utils/getOrPromptApplicationId.js +2 -2
  298. package/build/src/utils/getOrPromptApplicationId.js.map +1 -1
  299. package/build/src/utils/git.js +1 -1
  300. package/build/src/utils/git.js.map +1 -1
  301. package/build/src/utils/modifyConfigAsync.js +1 -1
  302. package/build/src/utils/modifyConfigAsync.js.map +1 -1
  303. package/build/src/utils/modifyConfigPlugins.js +1 -1
  304. package/build/src/utils/modifyConfigPlugins.js.map +1 -1
  305. package/build/src/utils/npm.js +1 -1
  306. package/build/src/utils/npm.js.map +1 -1
  307. package/build/src/utils/obj.js.map +1 -1
  308. package/build/src/utils/plist.js +1 -1
  309. package/build/src/utils/plist.js.map +1 -1
  310. package/build/src/utils/port.js +46 -18
  311. package/build/src/utils/port.js.map +1 -1
  312. package/build/src/utils/profile.js +1 -1
  313. package/build/src/utils/profile.js.map +1 -1
  314. package/build/src/utils/scheme.js +1 -1
  315. package/build/src/utils/scheme.js.map +1 -1
  316. package/build/src/utils/tsconfig/loadTsConfigPaths.js +1 -1
  317. package/build/src/utils/tsconfig/loadTsConfigPaths.js.map +1 -1
  318. package/build/src/utils/validateApplicationId.js +85 -5
  319. package/build/src/utils/validateApplicationId.js.map +1 -1
  320. package/package.json +19 -13
  321. package/build/src/api/signManifest.js +0 -26
  322. package/build/src/api/signManifest.js.map +0 -1
  323. package/build/src/start/server/middleware/ClassicManifestMiddleware.js +0 -155
  324. package/build/src/start/server/middleware/ClassicManifestMiddleware.js.map +0 -1
  325. package/build/src/start/server/middleware/createDevServerMiddleware.js +0 -24
  326. package/build/src/start/server/middleware/createDevServerMiddleware.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/server/metro/TerminalReporter.types.ts"],"sourcesContent":["import type { ReportableEvent } from 'metro';\nimport type { Terminal } from 'metro-core';\nimport type { TerminalReportableEvent } from 'metro/src/lib/TerminalReporter';\n\nexport type GlobalCacheDisabledReason = 'too_many_errors' | 'too_many_misses';\n\nexport type BundleDetails = {\n buildID?: string;\n bundleType: string;\n dev: boolean;\n entryFile: string;\n minify: boolean;\n platform: string | null | undefined;\n runtimeBytecodeVersion: number | null | undefined;\n};\n\nexport type BundleProgress = {\n bundleDetails: BundleDetails;\n transformedFileCount: number;\n totalFileCount: number;\n ratio: number;\n};\n\nexport { TerminalReportableEvent };\n\nexport type BuildPhase = 'in_progress' | 'done' | 'failed';\n\n/**\n * Code across the application takes a reporter as an option and calls the\n * update whenever one of the ReportableEvent happens. Code does not directly\n * write to the standard output, because a build would be:\n *\n * 1. ad-hoc, embedded into another tool, in which case we do not want to\n * pollute that tool's own output. The tool is free to present the\n * warnings/progress we generate any way they want, by specifying a custom\n * reporter.\n * 2. run as a background process from another tool, in which case we want\n * to expose updates in a way that is easily machine-readable, for example\n * a JSON-stream. We don't want to pollute it with textual messages.\n *\n * We centralize terminal reporting into a single place because we want the\n * output to be robust and consistent. The most common reporter is\n * TerminalReporter, that should be the only place in the application should\n * access the `terminal` module (nor the `console`).\n */\nexport type Reporter = { update(event: ReportableEvent): void };\n\nexport interface SnippetError extends Error {\n code?: string;\n filename?: string;\n snippet?: string;\n\n /** Module that failed to load ex 'fs' */\n targetModuleName?: string;\n originModulePath?: string;\n\n errors?: any[];\n}\n\nexport interface TerminalReporterInterface {\n new (terminal: Terminal): TerminalReporterInterface;\n\n /**\n * The bundle builds for which we are actively maintaining the status on the\n * terminal, ie. showing a progress bar. There can be several bundles being\n * built at the same time.\n */\n _activeBundles: Map<string, BundleProgress>;\n\n _scheduleUpdateBundleProgress: {\n (data: { buildID: string; transformedFileCount: number; totalFileCount: number }): void;\n cancel(): void;\n };\n\n /** Set in super type */\n terminal: Terminal;\n\n /**\n * Construct a message that represents the progress of a\n * single bundle build, for example:\n *\n * BUNDLE path/to/bundle.js ▓▓▓▓▓░░░░░░░░░░░ 36.6% (4790/7922)\n */\n _getBundleStatusMessage(\n {\n bundleDetails: { entryFile, bundleType, runtimeBytecodeVersion },\n transformedFileCount,\n totalFileCount,\n ratio,\n }: BundleProgress,\n phase: BuildPhase\n ): string;\n\n /**\n * This function is only concerned with logging and should not do state\n * or terminal status updates.\n */\n _log(event: TerminalReportableEvent): void;\n\n _logCacheDisabled(reason: GlobalCacheDisabledReason): void;\n\n _logBundleBuildDone(buildID: string): void;\n\n _logBundleBuildFailed(buildID: string): void;\n\n _logInitializing(port: number, hasReducedPerformance: boolean): void;\n\n _logInitializingFailed(port: number, error: SnippetError): void;\n\n /**\n * We do not want to log the whole stacktrace for bundling error, because\n * these are operational errors, not programming errors, and the stacktrace\n * is not actionable to end users.\n */\n _logBundlingError(error: SnippetError): void;\n\n /**\n * We use Math.pow(ratio, 2) to as a conservative measure of progress because\n * we know the `totalCount` is going to progressively increase as well. We\n * also prevent the ratio from going backwards.\n */\n _updateBundleProgress({\n buildID,\n transformedFileCount,\n totalFileCount,\n }: {\n buildID: string;\n transformedFileCount: number;\n totalFileCount: number;\n }): void;\n\n /**\n * This function is exclusively concerned with updating the internal state.\n * No logging or status updates should be done at this point.\n */\n _updateState(event: TerminalReportableEvent): void;\n /**\n * Return a status message that is always consistent with the current state\n * of the application. Having this single function ensures we don't have\n * different call sites overriding each other status messages.\n */\n _getStatusMessage(): string;\n\n _logHmrClientError(e: Error): void;\n\n /**\n * Single entry point for reporting events. That allows us to implement the\n * corresponding JSON reporter easily and have a consistent reporting.\n */\n update(event: TerminalReportableEvent): void;\n}\n"],"names":[],"mappings":"AAAA"}
1
+ {"version":3,"sources":["../../../../../src/start/server/metro/TerminalReporter.types.ts"],"sourcesContent":["import type { ReportableEvent } from 'metro';\nimport type { TerminalReportableEvent } from 'metro/src/lib/TerminalReporter';\nimport type { Terminal } from 'metro-core';\n\nexport type GlobalCacheDisabledReason = 'too_many_errors' | 'too_many_misses';\n\nexport type BundleDetails = {\n buildID?: string;\n bundleType: string;\n dev: boolean;\n entryFile: string;\n minify: boolean;\n platform: string | null | undefined;\n customTransformOptions?: { environment?: 'node' };\n runtimeBytecodeVersion: number | null | undefined;\n};\n\nexport type BundleProgress = {\n bundleDetails: BundleDetails;\n transformedFileCount: number;\n totalFileCount: number;\n ratio: number;\n};\n\nexport { TerminalReportableEvent };\n\nexport type BuildPhase = 'in_progress' | 'done' | 'failed';\n\n/**\n * Code across the application takes a reporter as an option and calls the\n * update whenever one of the ReportableEvent happens. Code does not directly\n * write to the standard output, because a build would be:\n *\n * 1. ad-hoc, embedded into another tool, in which case we do not want to\n * pollute that tool's own output. The tool is free to present the\n * warnings/progress we generate any way they want, by specifying a custom\n * reporter.\n * 2. run as a background process from another tool, in which case we want\n * to expose updates in a way that is easily machine-readable, for example\n * a JSON-stream. We don't want to pollute it with textual messages.\n *\n * We centralize terminal reporting into a single place because we want the\n * output to be robust and consistent. The most common reporter is\n * TerminalReporter, that should be the only place in the application should\n * access the `terminal` module (nor the `console`).\n */\nexport type Reporter = { update(event: ReportableEvent): void };\n\nexport interface SnippetError extends Error {\n code?: string;\n filename?: string;\n snippet?: string;\n\n /** Module that failed to load ex 'fs' */\n targetModuleName?: string;\n originModulePath?: string;\n\n errors?: any[];\n}\n\nexport interface TerminalReporterInterface {\n new (terminal: Terminal): TerminalReporterInterface;\n\n /**\n * The bundle builds for which we are actively maintaining the status on the\n * terminal, ie. showing a progress bar. There can be several bundles being\n * built at the same time.\n */\n _activeBundles: Map<string, BundleProgress>;\n\n _scheduleUpdateBundleProgress: {\n (data: { buildID: string; transformedFileCount: number; totalFileCount: number }): void;\n cancel(): void;\n };\n\n /** Set in super type */\n terminal: Terminal;\n\n /**\n * Construct a message that represents the progress of a\n * single bundle build, for example:\n *\n * BUNDLE path/to/bundle.js ▓▓▓▓▓░░░░░░░░░░░ 36.6% (4790/7922)\n */\n _getBundleStatusMessage(\n {\n bundleDetails: { entryFile, bundleType, runtimeBytecodeVersion },\n transformedFileCount,\n totalFileCount,\n ratio,\n }: BundleProgress,\n phase: BuildPhase\n ): string;\n\n /**\n * This function is only concerned with logging and should not do state\n * or terminal status updates.\n */\n _log(event: TerminalReportableEvent): void;\n\n _logCacheDisabled(reason: GlobalCacheDisabledReason): void;\n\n _logBundleBuildDone(buildID: string): void;\n\n _logBundleBuildFailed(buildID: string): void;\n\n _logInitializing(port: number, hasReducedPerformance: boolean): void;\n\n _logInitializingFailed(port: number, error: SnippetError): void;\n\n /**\n * We do not want to log the whole stacktrace for bundling error, because\n * these are operational errors, not programming errors, and the stacktrace\n * is not actionable to end users.\n */\n _logBundlingError(error: SnippetError): void;\n\n /**\n * We use Math.pow(ratio, 2) to as a conservative measure of progress because\n * we know the `totalCount` is going to progressively increase as well. We\n * also prevent the ratio from going backwards.\n */\n _updateBundleProgress({\n buildID,\n transformedFileCount,\n totalFileCount,\n }: {\n buildID: string;\n transformedFileCount: number;\n totalFileCount: number;\n }): void;\n\n /**\n * This function is exclusively concerned with updating the internal state.\n * No logging or status updates should be done at this point.\n */\n _updateState(event: TerminalReportableEvent): void;\n /**\n * Return a status message that is always consistent with the current state\n * of the application. Having this single function ensures we don't have\n * different call sites overriding each other status messages.\n */\n _getStatusMessage(): string;\n\n _logHmrClientError(e: Error): void;\n\n /**\n * Single entry point for reporting events. That allows us to implement the\n * corresponding JSON reporter easily and have a consistent reporting.\n */\n update(event: TerminalReportableEvent): void;\n}\n"],"names":[],"mappings":"AAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/start/server/metro/inspector-proxy/device.ts"],"sourcesContent":["import type { DebuggerInfo, Device as MetroDevice } from 'metro-inspector-proxy';\nimport fetch from 'node-fetch';\nimport type WS from 'ws';\n\nimport { MetroBundlerDevServer } from '../MetroBundlerDevServer';\nimport { NetworkResponseHandler } from './handlers/NetworkResponse';\nimport { PageReloadHandler } from './handlers/PageReload';\nimport { VscodeDebuggerGetPossibleBreakpointsHandler } from './handlers/VscodeDebuggerGetPossibleBreakpoints';\nimport { VscodeDebuggerScriptParsedHandler } from './handlers/VscodeDebuggerScriptParsed';\nimport { VscodeDebuggerSetBreakpointByUrlHandler } from './handlers/VscodeDebuggerSetBreakpointByUrl';\nimport { VscodeRuntimeGetPropertiesHandler } from './handlers/VscodeRuntimeGetProperties';\nimport { DeviceRequest, InspectorHandler, DebuggerRequest } from './handlers/types';\n\n/** Export the supported debugger types this inspector proxy can handle */\nexport type DebuggerType = 'vscode' | 'generic';\n\n/** The debugger information being tracked by this device class */\nexport type ExpoDebuggerInfo = DebuggerInfo & { debuggerType?: DebuggerType };\n\nexport function createInspectorDeviceClass(\n metroBundler: MetroBundlerDevServer,\n MetroDeviceClass: typeof MetroDevice\n) {\n return class ExpoInspectorDevice extends MetroDeviceClass implements InspectorHandler {\n /** Stores information about currently connected debugger (if any). */\n _debuggerConnection: ExpoDebuggerInfo | null = null;\n\n /** All handlers that should be used to intercept or reply to CDP events */\n public handlers: InspectorHandler[] = [\n // Generic handlers\n new NetworkResponseHandler(),\n new PageReloadHandler(metroBundler),\n // Vscode-specific handlers\n new VscodeDebuggerGetPossibleBreakpointsHandler(),\n new VscodeDebuggerScriptParsedHandler(this),\n new VscodeDebuggerSetBreakpointByUrlHandler(),\n new VscodeRuntimeGetPropertiesHandler(),\n ];\n\n onDeviceMessage(message: any, info: DebuggerInfo): boolean {\n return this.handlers.some((handler) => handler.onDeviceMessage?.(message, info) ?? false);\n }\n\n onDebuggerMessage(message: any, info: DebuggerInfo): boolean {\n return this.handlers.some((handler) => handler.onDebuggerMessage?.(message, info) ?? false);\n }\n\n /**\n * Handle a new device connection with the same device identifier.\n * When the app and device name matches, we can reuse the debugger connection.\n * Else, we have to shut the debugger connection down.\n */\n handleDuplicateDeviceConnection(newDevice: InstanceType<typeof MetroDeviceClass>) {\n if (this._app !== newDevice._app || this._name !== newDevice._name) {\n this._deviceSocket.close();\n this._debuggerConnection?.socket.close();\n return;\n }\n\n const oldDebugger = this._debuggerConnection;\n this._debuggerConnection = null;\n\n if (oldDebugger) {\n oldDebugger.socket.removeAllListeners();\n this._deviceSocket.close();\n newDevice.handleDebuggerConnection(oldDebugger.socket, oldDebugger.pageId);\n }\n }\n\n /**\n * Handle a new debugger connection to this device.\n * This adds the `debuggerType` property to the `DebuggerInfo` object.\n * With that information, we can enable or disable debugger-specific handlers.\n */\n handleDebuggerConnectionWithType(socket: WS, pageId: string, debuggerType: DebuggerType): void {\n this.handleDebuggerConnection(socket, pageId);\n\n if (this._debuggerConnection) {\n this._debuggerConnection.debuggerType = debuggerType;\n }\n }\n\n /** Hook into the message life cycle to answer more complex CDP messages */\n async _processMessageFromDevice(message: DeviceRequest<any>, info: DebuggerInfo) {\n if (!this.onDeviceMessage(message, info)) {\n await super._processMessageFromDevice(message, info);\n }\n }\n\n /** Hook into the message life cycle to answer more complex CDP messages */\n _interceptMessageFromDebugger(\n request: DebuggerRequest,\n info: DebuggerInfo,\n socket: WS\n ): boolean {\n // Note, `socket` is the exact same as `info.socket`\n if (this.onDebuggerMessage(request, info)) {\n return true;\n }\n\n return super._interceptMessageFromDebugger(request, info, socket);\n }\n\n /**\n * Overwrite the default text fetcher, to load sourcemaps from sources other than `localhost`.\n * @todo Cedric: remove the custom `DebuggerScriptSource` handler when switching over to `metro@>=0.75.1`\n * @see https://github.com/facebook/metro/blob/77f445f1bcd2264ad06174dbf8d542bc75834d29/packages/metro-inspector-proxy/src/Device.js#L573-L588\n * @since metro-inspector-proxy@0.75.1\n */\n async _fetchText(url: URL): Promise<string> {\n const LENGTH_LIMIT_BYTES = 350_000_000; // 350mb\n\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(`Received status ${response.status} while fetching: ${url}`);\n }\n\n const contentLength = response.headers.get('Content-Length');\n if (contentLength && Number(contentLength) > LENGTH_LIMIT_BYTES) {\n throw new Error('Expected file size is too large (more than 350mb)');\n }\n\n const text = await response.text();\n if (Buffer.byteLength(text, 'utf8') > LENGTH_LIMIT_BYTES) {\n throw new Error('File size is too large (more than 350mb)');\n }\n\n return text;\n }\n };\n}\n"],"names":["createInspectorDeviceClass","metroBundler","MetroDeviceClass","ExpoInspectorDevice","_debuggerConnection","handlers","NetworkResponseHandler","PageReloadHandler","VscodeDebuggerGetPossibleBreakpointsHandler","VscodeDebuggerScriptParsedHandler","VscodeDebuggerSetBreakpointByUrlHandler","VscodeRuntimeGetPropertiesHandler","onDeviceMessage","message","info","handler","some","onDebuggerMessage","handleDuplicateDeviceConnection","newDevice","_app","_name","_deviceSocket","close","socket","oldDebugger","removeAllListeners","handleDebuggerConnection","pageId","handleDebuggerConnectionWithType","debuggerType","_processMessageFromDevice","_interceptMessageFromDebugger","request","_fetchText","url","LENGTH_LIMIT_BYTES","response","fetch","ok","Error","status","contentLength","headers","get","Number","text","Buffer","byteLength"],"mappings":"AAAA;;;;QAmBgBA,0BAA0B,GAA1BA,0BAA0B;AAlBxB,IAAA,UAAY,kCAAZ,YAAY,EAAA;AAIS,IAAA,gBAA4B,WAA5B,4BAA4B,CAAA;AACjC,IAAA,WAAuB,WAAvB,uBAAuB,CAAA;AACG,IAAA,qCAAiD,WAAjD,iDAAiD,CAAA;AAC3D,IAAA,2BAAuC,WAAvC,uCAAuC,CAAA;AACjC,IAAA,iCAA6C,WAA7C,6CAA6C,CAAA;AACnD,IAAA,2BAAuC,WAAvC,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BAAiB,CAACgB,OAAO,EAAEnB,IAAI,CAAC,EAAE;gBACzC,OAAO,IAAI,CAAC;aACb;YAED,OAAO,KAAK,CAACkB,6BAA6B,CAACC,OAAO,EAAEnB,IAAI,EAAEU,MAAM,CAAC,CAAC;SACnE;QAED;;;;;OAKG,CACH,MAAMU,UAAU,CAACC,GAAQ,EAAmB;YAC1C,MAAMC,kBAAkB,GAAG,SAAW,AAAC,EAAC,QAAQ;YAEhD,MAAMC,QAAQ,GAAG,MAAMC,CAAAA,GAAAA,UAAK,AAAK,CAAA,QAAL,CAACH,GAAG,CAAC,AAAC;YAClC,IAAI,CAACE,QAAQ,CAACE,EAAE,EAAE;gBAChB,MAAM,IAAIC,KAAK,CAAC,CAAC,gBAAgB,EAAEH,QAAQ,CAACI,MAAM,CAAC,iBAAiB,EAAEN,GAAG,CAAC,CAAC,CAAC,CAAC;aAC9E;YAED,MAAMO,aAAa,GAAGL,QAAQ,CAACM,OAAO,CAACC,GAAG,CAAC,gBAAgB,CAAC,AAAC;YAC7D,IAAIF,aAAa,IAAIG,MAAM,CAACH,aAAa,CAAC,GAAGN,kBAAkB,EAAE;gBAC/D,MAAM,IAAII,KAAK,CAAC,mDAAmD,CAAC,CAAC;aACtE;YAED,MAAMM,IAAI,GAAG,MAAMT,QAAQ,CAACS,IAAI,EAAE,AAAC;YACnC,IAAIC,MAAM,CAACC,UAAU,CAACF,IAAI,EAAE,MAAM,CAAC,GAAGV,kBAAkB,EAAE;gBACxD,MAAM,IAAII,KAAK,CAAC,0CAA0C,CAAC,CAAC;aAC7D;YAED,OAAOM,IAAI,CAAC;SACb;KACF,CAAC;CACH"}
1
+ {"version":3,"sources":["../../../../../../src/start/server/metro/inspector-proxy/device.ts"],"sourcesContent":["import type { DebuggerInfo, Device as MetroDevice } from 'metro-inspector-proxy';\nimport fetch from 'node-fetch';\nimport type WS from 'ws';\n\nimport { NetworkResponseHandler } from './handlers/NetworkResponse';\nimport { PageReloadHandler } from './handlers/PageReload';\nimport { VscodeDebuggerGetPossibleBreakpointsHandler } from './handlers/VscodeDebuggerGetPossibleBreakpoints';\nimport { VscodeDebuggerScriptParsedHandler } from './handlers/VscodeDebuggerScriptParsed';\nimport { VscodeDebuggerSetBreakpointByUrlHandler } from './handlers/VscodeDebuggerSetBreakpointByUrl';\nimport { VscodeRuntimeGetPropertiesHandler } from './handlers/VscodeRuntimeGetProperties';\nimport { DeviceRequest, InspectorHandler, DebuggerRequest } from './handlers/types';\nimport { MetroBundlerDevServer } from '../MetroBundlerDevServer';\n\n/** Export the supported debugger types this inspector proxy can handle */\nexport type DebuggerType = 'vscode' | 'generic';\n\n/** The debugger information being tracked by this device class */\nexport type ExpoDebuggerInfo = DebuggerInfo & { debuggerType?: DebuggerType };\n\nexport function createInspectorDeviceClass(\n metroBundler: MetroBundlerDevServer,\n MetroDeviceClass: typeof MetroDevice\n) {\n return class ExpoInspectorDevice extends MetroDeviceClass implements InspectorHandler {\n /** Stores information about currently connected debugger (if any). */\n _debuggerConnection: ExpoDebuggerInfo | null = null;\n\n /** All handlers that should be used to intercept or reply to CDP events */\n public handlers: InspectorHandler[] = [\n // Generic handlers\n new NetworkResponseHandler(),\n new PageReloadHandler(metroBundler),\n // Vscode-specific handlers\n new VscodeDebuggerGetPossibleBreakpointsHandler(),\n new VscodeDebuggerScriptParsedHandler(this),\n new VscodeDebuggerSetBreakpointByUrlHandler(),\n new VscodeRuntimeGetPropertiesHandler(),\n ];\n\n onDeviceMessage(message: any, info: DebuggerInfo): boolean {\n return this.handlers.some((handler) => handler.onDeviceMessage?.(message, info) ?? false);\n }\n\n onDebuggerMessage(message: any, info: DebuggerInfo): boolean {\n return this.handlers.some((handler) => handler.onDebuggerMessage?.(message, info) ?? false);\n }\n\n /**\n * Handle a new device connection with the same device identifier.\n * When the app and device name matches, we can reuse the debugger connection.\n * Else, we have to shut the debugger connection down.\n */\n handleDuplicateDeviceConnection(newDevice: InstanceType<typeof MetroDeviceClass>) {\n if (this._app !== newDevice._app || this._name !== newDevice._name) {\n this._deviceSocket.close();\n this._debuggerConnection?.socket.close();\n return;\n }\n\n const oldDebugger = this._debuggerConnection;\n this._debuggerConnection = null;\n\n if (oldDebugger) {\n oldDebugger.socket.removeAllListeners();\n this._deviceSocket.close();\n newDevice.handleDebuggerConnection(oldDebugger.socket, oldDebugger.pageId);\n }\n }\n\n /**\n * Handle a new debugger connection to this device.\n * This adds the `debuggerType` property to the `DebuggerInfo` object.\n * With that information, we can enable or disable debugger-specific handlers.\n */\n handleDebuggerConnectionWithType(socket: WS, pageId: string, debuggerType: DebuggerType): void {\n this.handleDebuggerConnection(socket, pageId);\n\n if (this._debuggerConnection) {\n this._debuggerConnection.debuggerType = debuggerType;\n }\n }\n\n /** Hook into the message life cycle to answer more complex CDP messages */\n async _processMessageFromDevice(message: DeviceRequest<any>, info: DebuggerInfo) {\n if (!this.onDeviceMessage(message, info)) {\n await super._processMessageFromDevice(message, info);\n }\n }\n\n /** Hook into the message life cycle to answer more complex CDP messages */\n _interceptMessageFromDebugger(\n request: DebuggerRequest,\n info: DebuggerInfo,\n socket: WS\n ): boolean {\n // Note, `socket` is the exact same as `info.socket`\n if (this.onDebuggerMessage(request, info)) {\n return true;\n }\n\n return super._interceptMessageFromDebugger(request, info, socket);\n }\n\n /**\n * Overwrite the default text fetcher, to load sourcemaps from sources other than `localhost`.\n * @todo Cedric: remove the custom `DebuggerScriptSource` handler when switching over to `metro@>=0.75.1`\n * @see https://github.com/facebook/metro/blob/77f445f1bcd2264ad06174dbf8d542bc75834d29/packages/metro-inspector-proxy/src/Device.js#L573-L588\n * @since metro-inspector-proxy@0.75.1\n */\n async _fetchText(url: URL): Promise<string> {\n const LENGTH_LIMIT_BYTES = 350_000_000; // 350mb\n\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(`Received status ${response.status} while fetching: ${url}`);\n }\n\n const contentLength = response.headers.get('Content-Length');\n if (contentLength && Number(contentLength) > LENGTH_LIMIT_BYTES) {\n throw new Error('Expected file size is too large (more than 350mb)');\n }\n\n const text = await response.text();\n if (Buffer.byteLength(text, 'utf8') > LENGTH_LIMIT_BYTES) {\n throw new Error('File size is too large (more than 350mb)');\n }\n\n return text;\n }\n };\n}\n"],"names":["createInspectorDeviceClass","metroBundler","MetroDeviceClass","ExpoInspectorDevice","_debuggerConnection","handlers","NetworkResponseHandler","PageReloadHandler","VscodeDebuggerGetPossibleBreakpointsHandler","VscodeDebuggerScriptParsedHandler","VscodeDebuggerSetBreakpointByUrlHandler","VscodeRuntimeGetPropertiesHandler","onDeviceMessage","message","info","handler","some","onDebuggerMessage","handleDuplicateDeviceConnection","newDevice","_app","_name","_deviceSocket","close","socket","oldDebugger","removeAllListeners","handleDebuggerConnection","pageId","handleDebuggerConnectionWithType","debuggerType","_processMessageFromDevice","_interceptMessageFromDebugger","request","_fetchText","url","LENGTH_LIMIT_BYTES","response","fetch","ok","Error","status","contentLength","headers","get","Number","text","Buffer","byteLength"],"mappings":"AAAA;;;;QAmBgBA,0BAA0B,GAA1BA,0BAA0B;AAlBxB,IAAA,UAAY,kCAAZ,YAAY,EAAA;AAGS,IAAA,gBAA4B,WAA5B,4BAA4B,CAAA;AACjC,IAAA,WAAuB,WAAvB,uBAAuB,CAAA;AACG,IAAA,qCAAiD,WAAjD,iDAAiD,CAAA;AAC3D,IAAA,2BAAuC,WAAvC,uCAAuC,CAAA;AACjC,IAAA,iCAA6C,WAA7C,6CAA6C,CAAA;AACnD,IAAA,2BAAuC,WAAvC,uCAAuC,CAAA;;;;;;AAUlF,SAASA,0BAA0B,CACxCC,YAAmC,EACnCC,gBAAoC,EACpC;IACA,OAAO,MAAMC,mBAAmB,SAASD,gBAAgB;QACvD,sEAAsE,CACtEE,mBAAmB,GAA4B,IAAI,CAAC;QAEpD,2EAA2E,CAC3E,AAAOC,QAAQ,GAAuB;YACpC,mBAAmB;YACnB,IAAIC,gBAAsB,uBAAA,EAAE;YAC5B,IAAIC,WAAiB,kBAAA,CAACN,YAAY,CAAC;YACnC,2BAA2B;YA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UAAK,AAAK,CAAA,QAAL,CAACH,GAAG,CAAC,AAAC;YAClC,IAAI,CAACE,QAAQ,CAACE,EAAE,EAAE;gBAChB,MAAM,IAAIC,KAAK,CAAC,CAAC,gBAAgB,EAAEH,QAAQ,CAACI,MAAM,CAAC,iBAAiB,EAAEN,GAAG,CAAC,CAAC,CAAC,CAAC;aAC9E;YAED,MAAMO,aAAa,GAAGL,QAAQ,CAACM,OAAO,CAACC,GAAG,CAAC,gBAAgB,CAAC,AAAC;YAC7D,IAAIF,aAAa,IAAIG,MAAM,CAACH,aAAa,CAAC,GAAGN,kBAAkB,EAAE;gBAC/D,MAAM,IAAII,KAAK,CAAC,mDAAmD,CAAC,CAAC;aACtE;YAED,MAAMM,IAAI,GAAG,MAAMT,QAAQ,CAACS,IAAI,EAAE,AAAC;YACnC,IAAIC,MAAM,CAACC,UAAU,CAACF,IAAI,EAAE,MAAM,CAAC,GAAGV,kBAAkB,EAAE;gBACxD,MAAM,IAAII,KAAK,CAAC,0CAA0C,CAAC,CAAC;aAC7D;YAED,OAAOM,IAAI,CAAC;SACb;KACF,CAAC;CACH"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../src/start/server/metro/inspector-proxy/handlers/NetworkResponse.ts"],"sourcesContent":["import type { Protocol } from 'devtools-protocol';\n\nimport { ExpoDebuggerInfo } from '../device';\nimport {\n CdpMessage,\n InspectorHandler,\n DeviceRequest,\n DebuggerRequest,\n DebuggerResponse,\n DeviceResponse,\n} from './types';\n\nexport class NetworkResponseHandler implements InspectorHandler {\n /** All known responses, mapped by request id */\n storage = new Map<string, DebuggerResponse<NetworkGetResponseBody>['result']>();\n\n onDeviceMessage(message: DeviceRequest<NetworkReceivedResponseBody>) {\n if (message.method === 'Expo(Network.receivedResponseBody)') {\n const { requestId, ...requestInfo } = message.params;\n this.storage.set(requestId, requestInfo);\n return true;\n }\n\n return false;\n }\n\n onDebuggerMessage(\n message: DebuggerRequest<NetworkGetResponseBody>,\n { socket }: ExpoDebuggerInfo\n ) {\n if (\n message.method === 'Network.getResponseBody' &&\n this.storage.has(message.params.requestId)\n ) {\n const response: DeviceResponse<NetworkGetResponseBody> = {\n id: message.id,\n result: this.storage.get(message.params.requestId)!,\n };\n\n socket.send(JSON.stringify(response));\n return true;\n }\n\n return false;\n }\n}\n\n/** Custom message to transfer the response body data to the proxy */\nexport type NetworkReceivedResponseBody = CdpMessage<\n 'Expo(Network.receivedResponseBody)',\n Protocol.Network.GetResponseBodyRequest & Protocol.Network.GetResponseBodyResponse,\n never\n>;\n\n/** @see https://chromedevtools.github.io/devtools-protocol/1-2/Network/#method-getResponseBody */\nexport type NetworkGetResponseBody = CdpMessage<\n 'Network.getResponseBody',\n Protocol.Network.GetResponseBodyRequest,\n Protocol.Network.GetResponseBodyResponse\n>;\n"],"names":["NetworkResponseHandler","storage","Map","onDeviceMessage","message","method","requestId","requestInfo","params","set","onDebuggerMessage","socket","has","response","id","result","get","send","JSON","stringify"],"mappings":"AAAA;;;;AAYO,MAAMA,sBAAsB;IACjC,gDAAgD,CAChDC,OAAO,GAAG,IAAIC,GAAG,EAA8D,CAAC;IAEhFC,eAAe,CAACC,OAAmD,EAAE;QACnE,IAAIA,OAAO,CAACC,MAAM,KAAK,oCAAoC,EAAE;YAC3D,MAAM,EAAEC,SAAS,CAAA,EAAE,GAAGC,WAAW,EAAE,GAAGH,OAAO,CAACI,MAAM,AAAC;YACrD,IAAI,CAACP,OAAO,CAACQ,GAAG,CAACH,SAAS,EAAEC,WAAW,CAAC,CAAC;YACzC,OAAO,IAAI,CAAC;SACb;QAED,OAAO,KAAK,CAAC;KACd;IAEDG,iBAAiB,CACfN,OAAgD,EAChD,EAAEO,MAAM,CAAA,EAAoB,EAC5B;QACA,IACEP,OAAO,CAACC,MAAM,KAAK,yBAAyB,IAC5C,IAAI,CAACJ,OAAO,CAACW,GAAG,CAACR,OAAO,CAACI,MAAM,CAACF,SAAS,CAAC,EAC1C;YACA,MAAMO,QAAQ,GAA2C;gBACvDC,EAAE,EAAEV,OAAO,CAACU,EAAE;gBACdC,MAAM,EAAE,IAAI,CAACd,OAAO,CAACe,GAAG,CAACZ,OAAO,CAACI,MAAM,CAACF,SAAS,CAAC;aACnD,AAAC;YAEFK,MAAM,CAACM,IAAI,CAACC,IAAI,CAACC,SAAS,CAACN,QAAQ,CAAC,CAAC,CAAC;YACtC,OAAO,IAAI,CAAC;SACb;QAED,OAAO,KAAK,CAAC;KACd;CACF;QAjCYb,sBAAsB,GAAtBA,sBAAsB"}
1
+ {"version":3,"sources":["../../../../../../../src/start/server/metro/inspector-proxy/handlers/NetworkResponse.ts"],"sourcesContent":["import type { Protocol } from 'devtools-protocol';\n\nimport {\n CdpMessage,\n InspectorHandler,\n DeviceRequest,\n DebuggerRequest,\n DebuggerResponse,\n DeviceResponse,\n} from './types';\nimport { ExpoDebuggerInfo } from '../device';\n\nexport class NetworkResponseHandler implements InspectorHandler {\n /** All known responses, mapped by request id */\n storage = new Map<string, DebuggerResponse<NetworkGetResponseBody>['result']>();\n\n onDeviceMessage(message: DeviceRequest<NetworkReceivedResponseBody>) {\n if (message.method === 'Expo(Network.receivedResponseBody)') {\n const { requestId, ...requestInfo } = message.params;\n this.storage.set(requestId, requestInfo);\n return true;\n }\n\n return false;\n }\n\n onDebuggerMessage(\n message: DebuggerRequest<NetworkGetResponseBody>,\n { socket }: ExpoDebuggerInfo\n ) {\n if (\n message.method === 'Network.getResponseBody' &&\n this.storage.has(message.params.requestId)\n ) {\n const response: DeviceResponse<NetworkGetResponseBody> = {\n id: message.id,\n result: this.storage.get(message.params.requestId)!,\n };\n\n socket.send(JSON.stringify(response));\n return true;\n }\n\n return false;\n }\n}\n\n/** Custom message to transfer the response body data to the proxy */\nexport type NetworkReceivedResponseBody = CdpMessage<\n 'Expo(Network.receivedResponseBody)',\n Protocol.Network.GetResponseBodyRequest & Protocol.Network.GetResponseBodyResponse,\n never\n>;\n\n/** @see https://chromedevtools.github.io/devtools-protocol/1-2/Network/#method-getResponseBody */\nexport type NetworkGetResponseBody = CdpMessage<\n 'Network.getResponseBody',\n Protocol.Network.GetResponseBodyRequest,\n Protocol.Network.GetResponseBodyResponse\n>;\n"],"names":["NetworkResponseHandler","storage","Map","onDeviceMessage","message","method","requestId","requestInfo","params","set","onDebuggerMessage","socket","has","response","id","result","get","send","JSON","stringify"],"mappings":"AAAA;;;;AAYO,MAAMA,sBAAsB;IACjC,gDAAgD,CAChDC,OAAO,GAAG,IAAIC,GAAG,EAA8D,CAAC;IAEhFC,eAAe,CAACC,OAAmD,EAAE;QACnE,IAAIA,OAAO,CAACC,MAAM,KAAK,oCAAoC,EAAE;YAC3D,MAAM,EAAEC,SAAS,CAAA,EAAE,GAAGC,WAAW,EAAE,GAAGH,OAAO,CAACI,MAAM,AAAC;YACrD,IAAI,CAACP,OAAO,CAACQ,GAAG,CAACH,SAAS,EAAEC,WAAW,CAAC,CAAC;YACzC,OAAO,IAAI,CAAC;SACb;QAED,OAAO,KAAK,CAAC;KACd;IAEDG,iBAAiB,CACfN,OAAgD,EAChD,EAAEO,MAAM,CAAA,EAAoB,EAC5B;QACA,IACEP,OAAO,CAACC,MAAM,KAAK,yBAAyB,IAC5C,IAAI,CAACJ,OAAO,CAACW,GAAG,CAACR,OAAO,CAACI,MAAM,CAACF,SAAS,CAAC,EAC1C;YACA,MAAMO,QAAQ,GAA2C;gBACvDC,EAAE,EAAEV,OAAO,CAACU,EAAE;gBACdC,MAAM,EAAE,IAAI,CAACd,OAAO,CAACe,GAAG,CAACZ,OAAO,CAACI,MAAM,CAACF,SAAS,CAAC;aACnD,AAAC;YAEFK,MAAM,CAACM,IAAI,CAACC,IAAI,CAACC,SAAS,CAACN,QAAQ,CAAC,CAAC,CAAC;YACtC,OAAO,IAAI,CAAC;SACb;QAED,OAAO,KAAK,CAAC;KACd;CACF;QAjCYb,sBAAsB,GAAtBA,sBAAsB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../src/start/server/metro/inspector-proxy/handlers/PageReload.ts"],"sourcesContent":["import type { Protocol } from 'devtools-protocol';\n\nimport { MetroBundlerDevServer } from '../../MetroBundlerDevServer';\nimport { ExpoDebuggerInfo } from '../device';\nimport { CdpMessage, DebuggerRequest, InspectorHandler } from './types';\n\nexport class PageReloadHandler implements InspectorHandler {\n constructor(private readonly metroBundler: MetroBundlerDevServer) {}\n\n onDebuggerMessage(message: DebuggerRequest<PageReload>, { socket }: ExpoDebuggerInfo) {\n if (message.method === 'Page.reload') {\n this.metroBundler.broadcastMessage('reload');\n socket.send(JSON.stringify({ id: message.id }));\n return true;\n }\n\n return false;\n }\n}\n\n/** @see https://chromedevtools.github.io/devtools-protocol/1-2/Page/#method-reload */\nexport type PageReload = CdpMessage<'Page.reload', Protocol.Page.ReloadRequest, never>;\n"],"names":["PageReloadHandler","constructor","metroBundler","onDebuggerMessage","message","socket","method","broadcastMessage","send","JSON","stringify","id"],"mappings":"AAAA;;;;AAMO,MAAMA,iBAAiB;IAC5BC,YAA6BC,YAAmC,CAAE;aAArCA,YAAmC,GAAnCA,YAAmC;KAAI;IAEpEC,iBAAiB,CAACC,OAAoC,EAAE,EAAEC,MAAM,CAAA,EAAoB,EAAE;QACpF,IAAID,OAAO,CAACE,MAAM,KAAK,aAAa,EAAE;YACpC,IAAI,CAACJ,YAAY,CAACK,gBAAgB,CAAC,QAAQ,CAAC,CAAC;YAC7CF,MAAM,CAACG,IAAI,CAACC,IAAI,CAACC,SAAS,CAAC;gBAAEC,EAAE,EAAEP,OAAO,CAACO,EAAE;aAAE,CAAC,CAAC,CAAC;YAChD,OAAO,IAAI,CAAC;SACb;QAED,OAAO,KAAK,CAAC;KACd;CACF;QAZYX,iBAAiB,GAAjBA,iBAAiB"}
1
+ {"version":3,"sources":["../../../../../../../src/start/server/metro/inspector-proxy/handlers/PageReload.ts"],"sourcesContent":["import type { Protocol } from 'devtools-protocol';\n\nimport { CdpMessage, DebuggerRequest, InspectorHandler } from './types';\nimport { MetroBundlerDevServer } from '../../MetroBundlerDevServer';\nimport { ExpoDebuggerInfo } from '../device';\n\nexport class PageReloadHandler implements InspectorHandler {\n constructor(private readonly metroBundler: MetroBundlerDevServer) {}\n\n onDebuggerMessage(message: DebuggerRequest<PageReload>, { socket }: ExpoDebuggerInfo) {\n if (message.method === 'Page.reload') {\n this.metroBundler.broadcastMessage('reload');\n socket.send(JSON.stringify({ id: message.id }));\n return true;\n }\n\n return false;\n }\n}\n\n/** @see https://chromedevtools.github.io/devtools-protocol/1-2/Page/#method-reload */\nexport type PageReload = CdpMessage<'Page.reload', Protocol.Page.ReloadRequest, never>;\n"],"names":["PageReloadHandler","constructor","metroBundler","onDebuggerMessage","message","socket","method","broadcastMessage","send","JSON","stringify","id"],"mappings":"AAAA;;;;AAMO,MAAMA,iBAAiB;IAC5BC,YAA6BC,YAAmC,CAAE;aAArCA,YAAmC,GAAnCA,YAAmC;KAAI;IAEpEC,iBAAiB,CAACC,OAAoC,EAAE,EAAEC,MAAM,CAAA,EAAoB,EAAE;QACpF,IAAID,OAAO,CAACE,MAAM,KAAK,aAAa,EAAE;YACpC,IAAI,CAACJ,YAAY,CAACK,gBAAgB,CAAC,QAAQ,CAAC,CAAC;YAC7CF,MAAM,CAACG,IAAI,CAACC,IAAI,CAACC,SAAS,CAAC;gBAAEC,EAAE,EAAEP,OAAO,CAACO,EAAE;aAAE,CAAC,CAAC,CAAC;YAChD,OAAO,IAAI,CAAC;SACb;QAED,OAAO,KAAK,CAAC;KACd;CACF;QAZYX,iBAAiB,GAAjBA,iBAAiB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerGetPossibleBreakpoints.ts"],"sourcesContent":["import Protocol from 'devtools-protocol';\n\nimport { ExpoDebuggerInfo } from '../device';\nimport { CdpMessage, DebuggerRequest, DeviceResponse, InspectorHandler } from './types';\n\n/**\n * Hermes doesn't seem to handle this request, but `locations` have to be returned.\n * Respond with an empty location to make it \"spec compliant\" with Chrome DevTools.\n */\nexport class VscodeDebuggerGetPossibleBreakpointsHandler implements InspectorHandler {\n onDebuggerMessage(\n message: DebuggerRequest<DebuggerGetPossibleBreakpoints>,\n { socket, debuggerType }: ExpoDebuggerInfo\n ): boolean {\n if (debuggerType === 'vscode' && message.method === 'Debugger.getPossibleBreakpoints') {\n const response: DeviceResponse<DebuggerGetPossibleBreakpoints> = {\n id: message.id,\n result: { locations: [] },\n };\n socket.send(JSON.stringify(response));\n return true;\n }\n\n return false;\n }\n}\n\n/** @see https://chromedevtools.github.io/devtools-protocol/v8/Debugger/#method-getPossibleBreakpoints */\nexport type DebuggerGetPossibleBreakpoints = CdpMessage<\n 'Debugger.getPossibleBreakpoints',\n Protocol.Debugger.GetPossibleBreakpointsRequest,\n Protocol.Debugger.GetPossibleBreakpointsResponse\n>;\n"],"names":["VscodeDebuggerGetPossibleBreakpointsHandler","onDebuggerMessage","message","socket","debuggerType","method","response","id","result","locations","send","JSON","stringify"],"mappings":"AAAA;;;;AASO,MAAMA,2CAA2C;IACtDC,iBAAiB,CACfC,OAAwD,EACxD,EAAEC,MAAM,CAAA,EAAEC,YAAY,CAAA,EAAoB,EACjC;QACT,IAAIA,YAAY,KAAK,QAAQ,IAAIF,OAAO,CAACG,MAAM,KAAK,iCAAiC,EAAE;YACrF,MAAMC,QAAQ,GAAmD;gBAC/DC,EAAE,EAAEL,OAAO,CAACK,EAAE;gBACdC,MAAM,EAAE;oBAAEC,SAAS,EAAE,EAAE;iBAAE;aAC1B,AAAC;YACFN,MAAM,CAACO,IAAI,CAACC,IAAI,CAACC,SAAS,CAACN,QAAQ,CAAC,CAAC,CAAC;YACtC,OAAO,IAAI,CAAC;SACb;QAED,OAAO,KAAK,CAAC;KACd;CACF;QAhBYN,2CAA2C,GAA3CA,2CAA2C"}
1
+ {"version":3,"sources":["../../../../../../../src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerGetPossibleBreakpoints.ts"],"sourcesContent":["import Protocol from 'devtools-protocol';\n\nimport { CdpMessage, DebuggerRequest, DeviceResponse, InspectorHandler } from './types';\nimport { ExpoDebuggerInfo } from '../device';\n\n/**\n * Hermes doesn't seem to handle this request, but `locations` have to be returned.\n * Respond with an empty location to make it \"spec compliant\" with Chrome DevTools.\n */\nexport class VscodeDebuggerGetPossibleBreakpointsHandler implements InspectorHandler {\n onDebuggerMessage(\n message: DebuggerRequest<DebuggerGetPossibleBreakpoints>,\n { socket, debuggerType }: ExpoDebuggerInfo\n ): boolean {\n if (debuggerType === 'vscode' && message.method === 'Debugger.getPossibleBreakpoints') {\n const response: DeviceResponse<DebuggerGetPossibleBreakpoints> = {\n id: message.id,\n result: { locations: [] },\n };\n socket.send(JSON.stringify(response));\n return true;\n }\n\n return false;\n }\n}\n\n/** @see https://chromedevtools.github.io/devtools-protocol/v8/Debugger/#method-getPossibleBreakpoints */\nexport type DebuggerGetPossibleBreakpoints = CdpMessage<\n 'Debugger.getPossibleBreakpoints',\n Protocol.Debugger.GetPossibleBreakpointsRequest,\n Protocol.Debugger.GetPossibleBreakpointsResponse\n>;\n"],"names":["VscodeDebuggerGetPossibleBreakpointsHandler","onDebuggerMessage","message","socket","debuggerType","method","response","id","result","locations","send","JSON","stringify"],"mappings":"AAAA;;;;AASO,MAAMA,2CAA2C;IACtDC,iBAAiB,CACfC,OAAwD,EACxD,EAAEC,MAAM,CAAA,EAAEC,YAAY,CAAA,EAAoB,EACjC;QACT,IAAIA,YAAY,KAAK,QAAQ,IAAIF,OAAO,CAACG,MAAM,KAAK,iCAAiC,EAAE;YACrF,MAAMC,QAAQ,GAAmD;gBAC/DC,EAAE,EAAEL,OAAO,CAACK,EAAE;gBACdC,MAAM,EAAE;oBAAEC,SAAS,EAAE,EAAE;iBAAE;aAC1B,AAAC;YACFN,MAAM,CAACO,IAAI,CAACC,IAAI,CAACC,SAAS,CAACN,QAAQ,CAAC,CAAC,CAAC;YACtC,OAAO,IAAI,CAAC;SACb;QAED,OAAO,KAAK,CAAC;KACd;CACF;QAhBYN,2CAA2C,GAA3CA,2CAA2C"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerScriptParsed.ts"],"sourcesContent":["import Protocol from 'devtools-protocol';\nimport { Device as MetroDevice } from 'metro-inspector-proxy';\n\nimport { ExpoDebuggerInfo } from '../device';\nimport { CdpMessage, DeviceRequest, InspectorHandler } from './types';\n\n/** Android's stock emulator and other emulators such as genymotion use a standard localhost alias. */\nconst EMULATOR_LOCALHOST_ADDRESSES: Readonly<string[]> = ['10.0.2.2', '10.0.3.2'];\n/** Prefix for script URLs that are alphanumeric IDs. */\nconst FILE_PREFIX = 'file://';\n\n/**\n * Some debug clients does not support fetching source maps by URL.\n * By default, the `metro-inspector-proxy` inlines the source map as base64 string.\n * Unfortunately, that causes a multi-second delay in VS Code (±5s).\n * This handler disables inlining the source maps for VS Code only.\n */\nexport class VscodeDebuggerScriptParsedHandler implements InspectorHandler {\n constructor(private readonly device: MetroDevice) {}\n\n onDeviceMessage(message: DeviceRequest<DebuggerScriptParsed>, debuggerInfo: ExpoDebuggerInfo) {\n if (debuggerInfo.debuggerType !== 'vscode' || message.method !== 'Debugger.scriptParsed') {\n return false;\n }\n\n // See: https://github.com/facebook/metro/blob/f43caa371a813b257cb0b42028079645a1e85e0e/packages/metro-inspector-proxy/src/Device.js#L401-L410\n if (message.params.sourceMapURL) {\n for (let i = 0; i < EMULATOR_LOCALHOST_ADDRESSES.length; ++i) {\n const address = EMULATOR_LOCALHOST_ADDRESSES[i];\n if (message.params.sourceMapURL.indexOf(address) >= 0) {\n message.params.sourceMapURL = message.params.sourceMapURL.replace(address, 'localhost');\n debuggerInfo.originalSourceURLAddress = address;\n }\n }\n }\n\n // See: https://github.com/facebook/metro/blob/f43caa371a813b257cb0b42028079645a1e85e0e/packages/metro-inspector-proxy/src/Device.js#L431-L453\n if (message.params.url) {\n for (let i = 0; i < EMULATOR_LOCALHOST_ADDRESSES.length; ++i) {\n const address = EMULATOR_LOCALHOST_ADDRESSES[i];\n if (message.params.url.indexOf(address) >= 0) {\n message.params.url = message.params.url.replace(address, 'localhost');\n debuggerInfo.originalSourceURLAddress = address;\n }\n }\n\n // Chrome doesn't download source maps if URL param is not a valid\n // URL. Some frameworks pass alphanumeric script ID instead of URL which causes\n // Chrome to not download source maps. In this case we want to prepend script ID\n // with 'file://' prefix.\n if (message.params.url.match(/^[0-9a-z]+$/)) {\n message.params.url = FILE_PREFIX + message.params.url;\n debuggerInfo.prependedFilePrefix = true;\n }\n\n if (message.params.scriptId != null) {\n this.device._scriptIdToSourcePathMapping.set(message.params.scriptId, message.params.url);\n }\n }\n\n // Block `metro-inspector-proxy`'s default source map inlining\n return true;\n }\n}\n\n/** @see https://chromedevtools.github.io/devtools-protocol/v8/Debugger/#event-scriptParsed */\nexport type DebuggerScriptParsed = CdpMessage<\n 'Debugger.scriptParsed',\n Protocol.Debugger.ScriptParsedEvent,\n never\n>;\n"],"names":["EMULATOR_LOCALHOST_ADDRESSES","FILE_PREFIX","VscodeDebuggerScriptParsedHandler","constructor","device","onDeviceMessage","message","debuggerInfo","debuggerType","method","params","sourceMapURL","i","length","address","indexOf","replace","originalSourceURLAddress","url","match","prependedFilePrefix","scriptId","_scriptIdToSourcePathMapping","set"],"mappings":"AAAA;;;;AAMA,sGAAsG,CACtG,MAAMA,4BAA4B,GAAuB;IAAC,UAAU;IAAE,UAAU;CAAC,AAAC;AAClF,wDAAwD,CACxD,MAAMC,WAAW,GAAG,SAAS,AAAC;AAQvB,MAAMC,iCAAiC;IAC5CC,YAA6BC,MAAmB,CAAE;aAArBA,MAAmB,GAAnBA,MAAmB;KAAI;IAEpDC,eAAe,CAACC,OAA4C,EAAEC,YAA8B,EAAE;QAC5F,IAAIA,YAAY,CAACC,YAAY,KAAK,QAAQ,IAAIF,OAAO,CAACG,MAAM,KAAK,uBAAuB,EAAE;YACxF,OAAO,KAAK,CAAC;SACd;QAED,8IAA8I;QAC9I,IAAIH,OAAO,CAACI,MAAM,CAACC,YAAY,EA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AC;aACzC;YAED,IAAId,OAAO,CAACI,MAAM,CAACW,QAAQ,IAAI,IAAI,EAAE;gBACnC,IAAI,CAACjB,MAAM,CAACkB,4BAA4B,CAACC,GAAG,CAACjB,OAAO,CAACI,MAAM,CAACW,QAAQ,EAAEf,OAAO,CAACI,MAAM,CAACQ,GAAG,CAAC,CAAC;aAC3F;SACF;QAED,8DAA8D;QAC9D,OAAO,IAAI,CAAC;KACb;CACF;QA9CYhB,iCAAiC,GAAjCA,iCAAiC"}
1
+ {"version":3,"sources":["../../../../../../../src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerScriptParsed.ts"],"sourcesContent":["import Protocol from 'devtools-protocol';\nimport { Device as MetroDevice } from 'metro-inspector-proxy';\n\nimport { CdpMessage, DeviceRequest, InspectorHandler } from './types';\nimport { ExpoDebuggerInfo } from '../device';\n\n/** Android's stock emulator and other emulators such as genymotion use a standard localhost alias. */\nconst EMULATOR_LOCALHOST_ADDRESSES: Readonly<string[]> = ['10.0.2.2', '10.0.3.2'];\n/** Prefix for script URLs that are alphanumeric IDs. */\nconst FILE_PREFIX = 'file://';\n\n/**\n * Some debug clients does not support fetching source maps by URL.\n * By default, the `metro-inspector-proxy` inlines the source map as base64 string.\n * Unfortunately, that causes a multi-second delay in VS Code (±5s).\n * This handler disables inlining the source maps for VS Code only.\n */\nexport class VscodeDebuggerScriptParsedHandler implements InspectorHandler {\n constructor(private readonly device: MetroDevice) {}\n\n onDeviceMessage(message: DeviceRequest<DebuggerScriptParsed>, debuggerInfo: ExpoDebuggerInfo) {\n if (debuggerInfo.debuggerType !== 'vscode' || message.method !== 'Debugger.scriptParsed') {\n return false;\n }\n\n // See: https://github.com/facebook/metro/blob/f43caa371a813b257cb0b42028079645a1e85e0e/packages/metro-inspector-proxy/src/Device.js#L401-L410\n if (message.params.sourceMapURL) {\n for (let i = 0; i < EMULATOR_LOCALHOST_ADDRESSES.length; ++i) {\n const address = EMULATOR_LOCALHOST_ADDRESSES[i];\n if (message.params.sourceMapURL.indexOf(address) >= 0) {\n message.params.sourceMapURL = message.params.sourceMapURL.replace(address, 'localhost');\n debuggerInfo.originalSourceURLAddress = address;\n }\n }\n }\n\n // See: https://github.com/facebook/metro/blob/f43caa371a813b257cb0b42028079645a1e85e0e/packages/metro-inspector-proxy/src/Device.js#L431-L453\n if (message.params.url) {\n for (let i = 0; i < EMULATOR_LOCALHOST_ADDRESSES.length; ++i) {\n const address = EMULATOR_LOCALHOST_ADDRESSES[i];\n if (message.params.url.indexOf(address) >= 0) {\n message.params.url = message.params.url.replace(address, 'localhost');\n debuggerInfo.originalSourceURLAddress = address;\n }\n }\n\n // Chrome doesn't download source maps if URL param is not a valid\n // URL. Some frameworks pass alphanumeric script ID instead of URL which causes\n // Chrome to not download source maps. In this case we want to prepend script ID\n // with 'file://' prefix.\n if (message.params.url.match(/^[0-9a-z]+$/)) {\n message.params.url = FILE_PREFIX + message.params.url;\n debuggerInfo.prependedFilePrefix = true;\n }\n\n if (message.params.scriptId != null) {\n this.device._scriptIdToSourcePathMapping.set(message.params.scriptId, message.params.url);\n }\n }\n\n // Block `metro-inspector-proxy`'s default source map inlining\n return true;\n }\n}\n\n/** @see https://chromedevtools.github.io/devtools-protocol/v8/Debugger/#event-scriptParsed */\nexport type DebuggerScriptParsed = CdpMessage<\n 'Debugger.scriptParsed',\n Protocol.Debugger.ScriptParsedEvent,\n never\n>;\n"],"names":["EMULATOR_LOCALHOST_ADDRESSES","FILE_PREFIX","VscodeDebuggerScriptParsedHandler","constructor","device","onDeviceMessage","message","debuggerInfo","debuggerType","method","params","sourceMapURL","i","length","address","indexOf","replace","originalSourceURLAddress","url","match","prependedFilePrefix","scriptId","_scriptIdToSourcePathMapping","set"],"mappings":"AAAA;;;;AAMA,sGAAsG,CACtG,MAAMA,4BAA4B,GAAuB;IAAC,UAAU;IAAE,UAAU;CAAC,AAAC;AAClF,wDAAwD,CACxD,MAAMC,WAAW,GAAG,SAAS,AAAC;AAQvB,MAAMC,iCAAiC;IAC5C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CAAC;iBACjD;aACF;YAED,kEAAkE;YAClE,+EAA+E;YAC/E,gFAAgF;YAChF,yBAAyB;YACzB,IAAIR,OAAO,CAACI,MAAM,CAACQ,GAAG,CAACC,KAAK,eAAe,EAAE;gBAC3Cb,OAAO,CAACI,MAAM,CAACQ,GAAG,GAAGjB,WAAW,GAAGK,OAAO,CAACI,MAAM,CAACQ,GAAG,CAAC;gBACtDX,YAAY,CAACa,mBAAmB,GAAG,IAAI,CAAC;aACzC;YAED,IAAId,OAAO,CAACI,MAAM,CAACW,QAAQ,IAAI,IAAI,EAAE;gBACnC,IAAI,CAACjB,MAAM,CAACkB,4BAA4B,CAACC,GAAG,CAACjB,OAAO,CAACI,MAAM,CAACW,QAAQ,EAAEf,OAAO,CAACI,MAAM,CAACQ,GAAG,CAAC,CAAC;aAC3F;SACF;QAED,8DAA8D;QAC9D,OAAO,IAAI,CAAC;KACb;CACF;QA9CYhB,iCAAiC,GAAjCA,iCAAiC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerSetBreakpointByUrl.ts"],"sourcesContent":["import Protocol from 'devtools-protocol';\n\nimport { ExpoDebuggerInfo } from '../device';\nimport { CdpMessage, DebuggerRequest, InspectorHandler } from './types';\n\n/**\n * Hermes and vscode have trouble setting breakpoints by `urlRegex` through `Debugger.setBreakpointByUrl`.\n * Vscode adds `file://` to a URL containing `http://`, which confuses Hermes and sets it to the wrong location.\n * Hermes needs to create the breakpoint to get the proper ID, but it must be unbounded.\n * Once the sourcemap is loaded, vscode will rebind the unbounded breakpoint to the correct location (using `Debugger.setBreakpoint`).\n */\nexport class VscodeDebuggerSetBreakpointByUrlHandler implements InspectorHandler {\n onDebuggerMessage(\n message: DebuggerRequest<DebuggerSetBreakpointByUrl>,\n { debuggerType }: ExpoDebuggerInfo\n ): boolean {\n if (\n debuggerType === 'vscode' &&\n message.method === 'Debugger.setBreakpointByUrl' &&\n message.params.urlRegex\n ) {\n // Explicitly force the breakpoint to be unbounded\n message.params.url = 'file://__invalid_url__';\n delete message.params.urlRegex;\n }\n\n return false;\n }\n}\n\n/** @see https://chromedevtools.github.io/devtools-protocol/v8/Debugger/#method-setBreakpointByUrl */\nexport type DebuggerSetBreakpointByUrl = CdpMessage<\n 'Debugger.setBreakpointByUrl',\n Protocol.Debugger.SetBreakpointByUrlRequest,\n Protocol.Debugger.SetBreakpointByUrlResponse\n>;\n"],"names":["VscodeDebuggerSetBreakpointByUrlHandler","onDebuggerMessage","message","debuggerType","method","params","urlRegex","url"],"mappings":"AAAA;;;;AAWO,MAAMA,uCAAuC;IAClDC,iBAAiB,CACfC,OAAoD,EACpD,EAAEC,YAAY,CAAA,EAAoB,EACzB;QACT,IACEA,YAAY,KAAK,QAAQ,IACzBD,OAAO,CAACE,MAAM,KAAK,6BAA6B,IAChDF,OAAO,CAACG,MAAM,CAACC,QAAQ,EACvB;YACA,kDAAkD;YAClDJ,OAAO,CAACG,MAAM,CAACE,GAAG,GAAG,wBAAwB,CAAC;YAC9C,OAAOL,OAAO,CAACG,MAAM,CAACC,QAAQ,CAAC;SAChC;QAED,OAAO,KAAK,CAAC;KACd;CACF;QAjBYN,uCAAuC,GAAvCA,uCAAuC"}
1
+ {"version":3,"sources":["../../../../../../../src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerSetBreakpointByUrl.ts"],"sourcesContent":["import Protocol from 'devtools-protocol';\n\nimport { CdpMessage, DebuggerRequest, InspectorHandler } from './types';\nimport { ExpoDebuggerInfo } from '../device';\n\n/**\n * Hermes and vscode have trouble setting breakpoints by `urlRegex` through `Debugger.setBreakpointByUrl`.\n * Vscode adds `file://` to a URL containing `http://`, which confuses Hermes and sets it to the wrong location.\n * Hermes needs to create the breakpoint to get the proper ID, but it must be unbounded.\n * Once the sourcemap is loaded, vscode will rebind the unbounded breakpoint to the correct location (using `Debugger.setBreakpoint`).\n */\nexport class VscodeDebuggerSetBreakpointByUrlHandler implements InspectorHandler {\n onDebuggerMessage(\n message: DebuggerRequest<DebuggerSetBreakpointByUrl>,\n { debuggerType }: ExpoDebuggerInfo\n ): boolean {\n if (\n debuggerType === 'vscode' &&\n message.method === 'Debugger.setBreakpointByUrl' &&\n message.params.urlRegex\n ) {\n // Explicitly force the breakpoint to be unbounded\n message.params.url = 'file://__invalid_url__';\n delete message.params.urlRegex;\n }\n\n return false;\n }\n}\n\n/** @see https://chromedevtools.github.io/devtools-protocol/v8/Debugger/#method-setBreakpointByUrl */\nexport type DebuggerSetBreakpointByUrl = CdpMessage<\n 'Debugger.setBreakpointByUrl',\n Protocol.Debugger.SetBreakpointByUrlRequest,\n Protocol.Debugger.SetBreakpointByUrlResponse\n>;\n"],"names":["VscodeDebuggerSetBreakpointByUrlHandler","onDebuggerMessage","message","debuggerType","method","params","urlRegex","url"],"mappings":"AAAA;;;;AAWO,MAAMA,uCAAuC;IAClDC,iBAAiB,CACfC,OAAoD,EACpD,EAAEC,YAAY,CAAA,EAAoB,EACzB;QACT,IACEA,YAAY,KAAK,QAAQ,IACzBD,OAAO,CAACE,MAAM,KAAK,6BAA6B,IAChDF,OAAO,CAACG,MAAM,CAACC,QAAQ,EACvB;YACA,kDAAkD;YAClDJ,OAAO,CAACG,MAAM,CAACE,GAAG,GAAG,wBAAwB,CAAC;YAC9C,OAAOL,OAAO,CAACG,MAAM,CAACC,QAAQ,CAAC;SAChC;QAED,OAAO,KAAK,CAAC;KACd;CACF;QAjBYN,uCAAuC,GAAvCA,uCAAuC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../src/start/server/metro/inspector-proxy/handlers/VscodeRuntimeGetProperties.ts"],"sourcesContent":["import Protocol from 'devtools-protocol';\n\nimport { ExpoDebuggerInfo } from '../device';\nimport { CdpMessage, DebuggerRequest, DeviceResponse, InspectorHandler } from './types';\n\n/**\n * Vscode doesn't seem to work nicely with missing `description` fields on `RemoteObject` instances.\n * It also tries to invoke `Runtime.callFunctionOn` on `Symbol` types, which crashes Hermes.\n * This handler tries to compensate for these two separate issues.\n *\n * @see https://github.com/facebook/hermes/issues/114\n * @see https://github.com/microsoft/vscode-js-debug/issues/1583\n */\nexport class VscodeRuntimeGetPropertiesHandler implements InspectorHandler {\n /** Keep track of `Runtime.getProperties` responses to intercept, by request id */\n interceptGetProperties = new Set<number>();\n\n onDebuggerMessage(\n message: DebuggerRequest<RuntimeGetProperties>,\n { debuggerType }: ExpoDebuggerInfo\n ): boolean {\n if (debuggerType === 'vscode' && message.method === 'Runtime.getProperties') {\n this.interceptGetProperties.add(message.id);\n }\n\n // Do not block propagation of this message\n return false;\n }\n\n onDeviceMessage(\n message: DeviceResponse<RuntimeGetProperties>,\n { debuggerType }: ExpoDebuggerInfo\n ) {\n if (\n debuggerType === 'vscode' &&\n 'id' in message &&\n this.interceptGetProperties.has(message.id)\n ) {\n this.interceptGetProperties.delete(message.id);\n\n for (const item of message.result.result ?? []) {\n // Force-fully format the properties description to be an empty string\n if (item.value) {\n item.value.description = item.value.description ?? '';\n }\n\n // Avoid passing the `objectId` for symbol types.\n // When collapsing in vscode, it will fetch information about the symbol using the `objectId`.\n // The `Runtime.getProperties` request of the symbol hard-crashes Hermes.\n if (item.value?.type === 'symbol' && item.value.objectId) {\n delete item.value.objectId;\n }\n }\n }\n\n // Do not block propagation of this message\n return false;\n }\n}\n\n/** @see https://chromedevtools.github.io/devtools-protocol/v8/Runtime/#method-getProperties */\nexport type RuntimeGetProperties = CdpMessage<\n 'Runtime.getProperties',\n Protocol.Runtime.GetPropertiesRequest,\n Protocol.Runtime.GetPropertiesResponse\n>;\n"],"names":["VscodeRuntimeGetPropertiesHandler","interceptGetProperties","Set","onDebuggerMessage","message","debuggerType","method","add","id","onDeviceMessage","has","delete","item","result","value","description","type","objectId"],"mappings":"AAAA;;;;AAaO,MAAMA,iCAAiC;IAC5C,kFAAkF,CAClFC,sBAAsB,GAAG,IAAIC,GAAG,EAAU,CAAC;IAE3CC,iBAAiB,CACfC,OAA8C,EAC9C,EAAEC,YAAY,CA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
1
+ {"version":3,"sources":["../../../../../../../src/start/server/metro/inspector-proxy/handlers/VscodeRuntimeGetProperties.ts"],"sourcesContent":["import Protocol from 'devtools-protocol';\n\nimport { CdpMessage, DebuggerRequest, DeviceResponse, InspectorHandler } from './types';\nimport { ExpoDebuggerInfo } from '../device';\n\n/**\n * Vscode doesn't seem to work nicely with missing `description` fields on `RemoteObject` instances.\n * It also tries to invoke `Runtime.callFunctionOn` on `Symbol` types, which crashes Hermes.\n * This handler tries to compensate for these two separate issues.\n *\n * @see https://github.com/facebook/hermes/issues/114\n * @see https://github.com/microsoft/vscode-js-debug/issues/1583\n */\nexport class VscodeRuntimeGetPropertiesHandler implements InspectorHandler {\n /** Keep track of `Runtime.getProperties` responses to intercept, by request id */\n interceptGetProperties = new Set<number>();\n\n onDebuggerMessage(\n message: DebuggerRequest<RuntimeGetProperties>,\n { debuggerType }: ExpoDebuggerInfo\n ): boolean {\n if (debuggerType === 'vscode' && message.method === 'Runtime.getProperties') {\n this.interceptGetProperties.add(message.id);\n }\n\n // Do not block propagation of this message\n return false;\n }\n\n onDeviceMessage(\n message: DeviceResponse<RuntimeGetProperties>,\n { debuggerType }: ExpoDebuggerInfo\n ) {\n if (\n debuggerType === 'vscode' &&\n 'id' in message &&\n this.interceptGetProperties.has(message.id)\n ) {\n this.interceptGetProperties.delete(message.id);\n\n for (const item of message.result.result ?? []) {\n // Force-fully format the properties description to be an empty string\n if (item.value) {\n item.value.description = item.value.description ?? '';\n }\n\n // Avoid passing the `objectId` for symbol types.\n // When collapsing in vscode, it will fetch information about the symbol using the `objectId`.\n // The `Runtime.getProperties` request of the symbol hard-crashes Hermes.\n if (item.value?.type === 'symbol' && item.value.objectId) {\n delete item.value.objectId;\n }\n }\n }\n\n // Do not block propagation of this message\n return false;\n }\n}\n\n/** @see https://chromedevtools.github.io/devtools-protocol/v8/Runtime/#method-getProperties */\nexport type RuntimeGetProperties = CdpMessage<\n 'Runtime.getProperties',\n Protocol.Runtime.GetPropertiesRequest,\n Protocol.Runtime.GetPropertiesResponse\n>;\n"],"names":["VscodeRuntimeGetPropertiesHandler","interceptGetProperties","Set","onDebuggerMessage","message","debuggerType","method","add","id","onDeviceMessage","has","delete","item","result","value","description","type","objectId"],"mappings":"AAAA;;;;AAaO,MAAMA,iCAAiC;IAC5C,kFAAkF,CAClFC,sBAAsB,GAAG,IAAIC,GAAG,EAAU,CAAC;IAE3CC,iBAAiB,CACfC,OAA8C,EAC9C,EAAEC,YAAY,CAAA,EAAoB,EACzB;QACT,IAAIA,YAAY,KAAK,QAAQ,IAAID,OAAO,CAACE,MAAM,KAAK,uBAAuB,EAAE;YAC3E,IAAI,CAACL,sBAAsB,CAACM,GAAG,CAACH,OAAO,CAACI,EAAE,CAAC,CAAC;SAC7C;QAED,2CAA2C;QAC3C,OAAO,KAAK,CAAC;KACd;IAEDC,eAAe,CACbL,OAA6C,EAC7C,EAAEC,YAAY,CAAA,EAAoB,EAClC;QACA,IACEA,YAAY,KAAK,QAAQ,IACzB,IAAI,IAAID,OAAO,IACf,IAAI,CAACH,sBAAsB,CAACS,GAAG,CAACN,OAAO,CAACI,EAAE,CAAC,EAC3C;YACA,IAAI,CAACP,sBAAsB,CAACU,MAAM,CAACP,OAAO,CAACI,EAAE,CAAC,CAAC;gBAE5BJ,OAAqB;YAAxC,KAAK,MAAMQ,IAAI,IAAIR,CAAAA,OAAqB,GAArBA,OAAO,CAACS,MAAM,CAACA,MAAM,YAArBT,OAAqB,GAAI,EAAE,CAAE;oBAS1CQ,GAAU;gBARd,sEAAsE;gBACtE,IAAIA,IAAI,CAACE,KAAK,EAAE;wBACWF,YAAsB;oBAA/CA,IAAI,CAACE,KAAK,CAACC,WAAW,GAAGH,CAAAA,YAAsB,GAAtBA,IAAI,CAACE,KAAK,CAACC,WAAW,YAAtBH,YAAsB,GAAI,EAAE,CAAC;iBACvD;gBAED,iDAAiD;gBACjD,8FAA8F;gBAC9F,yEAAyE;gBACzE,IAAIA,CAAAA,CAAAA,GAAU,GAAVA,IAAI,CAACE,KAAK,SAAM,GAAhBF,KAAAA,CAAgB,GAAhBA,GAAU,CAAEI,IAAI,CAAA,KAAK,QAAQ,IAAIJ,IAAI,CAACE,KAAK,CAACG,QAAQ,EAAE;oBACxD,OAAOL,IAAI,CAACE,KAAK,CAACG,QAAQ,CAAC;iBAC5B;aACF;SACF;QAED,2CAA2C;QAC3C,OAAO,KAAK,CAAC;KACd;CACF;QA7CYjB,iCAAiC,GAAjCA,iCAAiC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../src/start/server/metro/inspector-proxy/handlers/types.ts"],"sourcesContent":["import { ExpoDebuggerInfo } from '../device';\n\nexport interface InspectorHandler {\n /**\n * Intercept a message coming from the device, modify or respond to it through `this._sendMessageToDevice`.\n * Return `true` if the message was handled, this will stop the message propagation.\n */\n onDeviceMessage?(message: DeviceRequest | DeviceResponse, info: ExpoDebuggerInfo): boolean;\n\n /**\n * Intercept a message coming from the debugger, modify or respond to it through `socket.send`.\n * Return `true` if the message was handled, this will stop the message propagation.\n */\n onDebuggerMessage?(message: DebuggerRequest, info: ExpoDebuggerInfo): boolean;\n}\n\n/**\n * The outline of a basic Chrome DevTools Protocol request, either from device or debugger.\n * Both the request and response parameters could be optional, use `never` to enforce these fields.\n */\nexport type CdpMessage<\n Method extends string = string,\n Request extends object = object,\n Response extends object = object\n> = {\n id: number;\n method: Method;\n params: Request;\n result: Response;\n};\n\nexport type DeviceRequest<M extends CdpMessage = CdpMessage> = Pick<M, 'method' | 'params'>;\nexport type DeviceResponse<M extends CdpMessage = CdpMessage> = Pick<M, 'id' | 'result'>;\n\nexport type DebuggerRequest<M extends CdpMessage = CdpMessage> = Pick<\n M,\n 'id' | 'method' | 'params'\n>;\nexport type DebuggerResponse<M extends CdpMessage = CdpMessage> = Pick<M, 'result'>;\n"],"names":[],"mappings":"AAAA"}
1
+ {"version":3,"sources":["../../../../../../../src/start/server/metro/inspector-proxy/handlers/types.ts"],"sourcesContent":["import { ExpoDebuggerInfo } from '../device';\n\nexport interface InspectorHandler {\n /**\n * Intercept a message coming from the device, modify or respond to it through `this._sendMessageToDevice`.\n * Return `true` if the message was handled, this will stop the message propagation.\n */\n onDeviceMessage?(message: DeviceRequest | DeviceResponse, info: ExpoDebuggerInfo): boolean;\n\n /**\n * Intercept a message coming from the debugger, modify or respond to it through `socket.send`.\n * Return `true` if the message was handled, this will stop the message propagation.\n */\n onDebuggerMessage?(message: DebuggerRequest, info: ExpoDebuggerInfo): boolean;\n}\n\n/**\n * The outline of a basic Chrome DevTools Protocol request, either from device or debugger.\n * Both the request and response parameters could be optional, use `never` to enforce these fields.\n */\nexport type CdpMessage<\n Method extends string = string,\n Request extends object = object,\n Response extends object = object,\n> = {\n id: number;\n method: Method;\n params: Request;\n result: Response;\n};\n\nexport type DeviceRequest<M extends CdpMessage = CdpMessage> = Pick<M, 'method' | 'params'>;\nexport type DeviceResponse<M extends CdpMessage = CdpMessage> = Pick<M, 'id' | 'result'>;\n\nexport type DebuggerRequest<M extends CdpMessage = CdpMessage> = Pick<\n M,\n 'id' | 'method' | 'params'\n>;\nexport type DebuggerResponse<M extends CdpMessage = CdpMessage> = Pick<M, 'result'>;\n"],"names":[],"mappings":"AAAA"}
@@ -9,9 +9,9 @@ Object.defineProperty(exports, "ExpoInspectorProxy", {
9
9
  }
10
10
  });
11
11
  exports.createInspectorProxy = createInspectorProxy;
12
- var _resolveFromProject = require("../resolveFromProject");
13
12
  var _device = require("./device");
14
13
  var _proxy = require("./proxy");
14
+ var _resolveFromProject = require("../resolveFromProject");
15
15
  const debug = require("debug")("expo:metro:inspector-proxy");
16
16
  function createInspectorProxy(metroBundler, projectRoot) {
17
17
  debug("Expo inspector proxy enabled");
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/start/server/metro/inspector-proxy/index.ts"],"sourcesContent":["import { MetroBundlerDevServer } from '../MetroBundlerDevServer';\nimport {\n importMetroInspectorDeviceFromProject,\n importMetroInspectorProxyFromProject,\n} from '../resolveFromProject';\nimport { createInspectorDeviceClass } from './device';\nimport { ExpoInspectorProxy } from './proxy';\n\nexport { ExpoInspectorProxy } from './proxy';\n\nconst debug = require('debug')('expo:metro:inspector-proxy') as typeof console.log;\n\nexport function createInspectorProxy(metroBundler: MetroBundlerDevServer, projectRoot: string) {\n debug('Expo inspector proxy enabled');\n\n // Import the installed `metro-inspector-proxy` from the project\n // We use these base classes to extend functionality\n const { InspectorProxy: MetroInspectorProxy } = importMetroInspectorProxyFromProject(projectRoot);\n // The device is slightly more complicated, we need to extend that class\n const ExpoInspectorDevice = createInspectorDeviceClass(\n metroBundler,\n importMetroInspectorDeviceFromProject(projectRoot)\n );\n\n const inspectorProxy = new ExpoInspectorProxy(\n new MetroInspectorProxy(projectRoot),\n ExpoInspectorDevice\n );\n\n return inspectorProxy;\n}\n"],"names":["ExpoInspectorProxy","createInspectorProxy","debug","require","metroBundler","projectRoot","InspectorProxy","MetroInspectorProxy","importMetroInspectorProxyFromProject","ExpoInspectorDevice","createInspectorDeviceClass","importMetroInspectorDeviceFromProject","inspectorProxy"],"mappings":"AAAA;;;;+BAQSA,oBAAkB;;;eAFQ,MAAS,CAEnCA,kBAAkB;;;QAIXC,oBAAoB,GAApBA,oBAAoB;AAR7B,IAAA,mBAAuB,WAAvB,uBAAuB,CAAA;AACa,IAAA,OAAU,WAAV,UAAU,CAAA;AAClB,IAAA,MAAS,WAAT,SAAS,CAAA;AAI5C,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,4BAA4B,CAAC,AAAsB,AAAC;AAE5E,SAASF,oBAAoB,CAACG,YAAmC,EAAEC,WAAmB,EAAE;IAC7FH,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAEtC,gEAAgE;IAChE,oDAAoD;IACpD,MAAM,EAAEI,cAAc,EAAEC,mBAAmB,CAAA,EAAE,GAAGC,CAAAA,GAAAA,mBAAoC,AAAa,CAAA,qCAAb,CAACH,WAAW,CAAC,AAAC;IAClG,wEAAwE;IACxE,MAAMI,mBAAmB,GAAGC,CAAAA,GAAAA,OAA0B,AAGrD,CAAA,2BAHqD,CACpDN,YAAY,EACZO,CAAAA,GAAAA,mBAAqC,AAAa,CAAA,sCAAb,CAACN,WAAW,CAAC,CACnD,AAAC;IAEF,MAAMO,cAAc,GAAG,IAAIZ,MAAkB,mBAAA,CAC3C,IAAIO,mBAAmB,CAACF,WAAW,CAAC,EACpCI,mBAAmB,CACpB,AAAC;IAEF,OAAOG,cAAc,CAAC;CACvB"}
1
+ {"version":3,"sources":["../../../../../../src/start/server/metro/inspector-proxy/index.ts"],"sourcesContent":["import { createInspectorDeviceClass } from './device';\nimport { ExpoInspectorProxy } from './proxy';\nimport { MetroBundlerDevServer } from '../MetroBundlerDevServer';\nimport {\n importMetroInspectorDeviceFromProject,\n importMetroInspectorProxyFromProject,\n} from '../resolveFromProject';\n\nexport { ExpoInspectorProxy } from './proxy';\n\nconst debug = require('debug')('expo:metro:inspector-proxy') as typeof console.log;\n\nexport function createInspectorProxy(metroBundler: MetroBundlerDevServer, projectRoot: string) {\n debug('Expo inspector proxy enabled');\n\n // Import the installed `metro-inspector-proxy` from the project\n // We use these base classes to extend functionality\n const { InspectorProxy: MetroInspectorProxy } = importMetroInspectorProxyFromProject(projectRoot);\n // The device is slightly more complicated, we need to extend that class\n const ExpoInspectorDevice = createInspectorDeviceClass(\n metroBundler,\n importMetroInspectorDeviceFromProject(projectRoot)\n );\n\n const inspectorProxy = new ExpoInspectorProxy(\n new MetroInspectorProxy(projectRoot),\n ExpoInspectorDevice\n );\n\n return inspectorProxy;\n}\n"],"names":["ExpoInspectorProxy","createInspectorProxy","debug","require","metroBundler","projectRoot","InspectorProxy","MetroInspectorProxy","importMetroInspectorProxyFromProject","ExpoInspectorDevice","createInspectorDeviceClass","importMetroInspectorDeviceFromProject","inspectorProxy"],"mappings":"AAAA;;;;+BAQSA,oBAAkB;;;eAPQ,MAAS,CAOnCA,kBAAkB;;;QAIXC,oBAAoB,GAApBA,oBAAoB;AAZO,IAAA,OAAU,WAAV,UAAU,CAAA;AAClB,IAAA,MAAS,WAAT,SAAS,CAAA;AAKrC,IAAA,mBAAuB,WAAvB,uBAAuB,CAAA;AAI9B,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,4BAA4B,CAAC,AAAsB,AAAC;AAE5E,SAASF,oBAAoB,CAACG,YAAmC,EAAEC,WAAmB,EAAE;IAC7FH,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAEtC,gEAAgE;IAChE,oDAAoD;IACpD,MAAM,EAAEI,cAAc,EAAEC,mBAAmB,CAAA,EAAE,GAAGC,CAAAA,GAAAA,mBAAoC,AAAa,CAAA,qCAAb,CAACH,WAAW,CAAC,AAAC;IAClG,wEAAwE;IACxE,MAAMI,mBAAmB,GAAGC,CAAAA,GAAAA,OAA0B,AAGrD,CAAA,2BAHqD,CACpDN,YAAY,EACZO,CAAAA,GAAAA,mBAAqC,AAAa,CAAA,sCAAb,CAACN,WAAW,CAAC,CACnD,AAAC;IAEF,MAAMO,cAAc,GAAG,IAAIZ,MAAkB,mBAAA,CAC3C,IAAIO,mBAAmB,CAACF,WAAW,CAAC,EACpCI,mBAAmB,CACpB,AAAC;IAEF,OAAOG,cAAc,CAAC;CACvB"}
@@ -8,28 +8,47 @@ exports.isWatchEnabled = isWatchEnabled;
8
8
  var _config = require("@expo/config");
9
9
  var _chalk = _interopRequireDefault(require("chalk"));
10
10
  var _metroCore = require("metro-core");
11
+ var _semver = _interopRequireDefault(require("semver"));
12
+ var _url = require("url");
13
+ var _metroTerminalReporter = require("./MetroTerminalReporter");
14
+ var _resolveFromProject = require("./resolveFromProject");
15
+ var _router = require("./router");
16
+ var _runServerFork = require("./runServer-fork");
17
+ var _withMetroMultiPlatform = require("./withMetroMultiPlatform");
11
18
  var _log = require("../../../log");
12
19
  var _getMetroProperties = require("../../../utils/analytics/getMetroProperties");
13
20
  var _metroDebuggerMiddleware = require("../../../utils/analytics/metroDebuggerMiddleware");
14
21
  var _rudderstackClient = require("../../../utils/analytics/rudderstackClient");
15
22
  var _env = require("../../../utils/env");
16
23
  var _manifestMiddleware = require("../middleware/ManifestMiddleware");
17
- var _createDevServerMiddleware = require("../middleware/createDevServerMiddleware");
24
+ var _createJsInspectorMiddleware = _interopRequireDefault(require("../middleware/inspector/createJsInspectorMiddleware"));
25
+ var _mutations = require("../middleware/mutations");
26
+ var _remoteDevtoolsCorsMiddleware = require("../middleware/remoteDevtoolsCorsMiddleware");
27
+ var _remoteDevtoolsSecurityHeadersMiddleware = require("../middleware/remoteDevtoolsSecurityHeadersMiddleware");
28
+ var _suppressErrorMiddleware = require("../middleware/suppressErrorMiddleware");
18
29
  var _platformBundlers = require("../platformBundlers");
19
- var _metroTerminalReporter = require("./MetroTerminalReporter");
20
- var _resolveFromProject = require("./resolveFromProject");
21
- var _router = require("./router");
22
- var _runServerFork = require("./runServer-fork");
23
- var _withMetroMultiPlatform = require("./withMetroMultiPlatform");
24
30
  function _interopRequireDefault(obj) {
25
31
  return obj && obj.__esModule ? obj : {
26
32
  default: obj
27
33
  };
28
34
  }
35
+ function gteSdkVersion(exp, sdkVersion) {
36
+ if (!exp.sdkVersion) {
37
+ return false;
38
+ }
39
+ if (exp.sdkVersion === "UNVERSIONED") {
40
+ return true;
41
+ }
42
+ try {
43
+ return _semver.default.gte(exp.sdkVersion, sdkVersion);
44
+ } catch {
45
+ throw new Error(`${exp.sdkVersion} is not a valid version. Must be in the form of x.y.z`);
46
+ }
47
+ }
29
48
  async function loadMetroConfigAsync(projectRoot, options, { exp =(0, _config).getConfig(projectRoot, {
30
49
  skipSDKVersionRequirement: true,
31
50
  skipPlugins: true
32
- }).exp } = {}) {
51
+ }).exp , isExporting }) {
33
52
  var ref, ref1, ref2, ref3;
34
53
  let reportEvent;
35
54
  const serverRoot = (0, _manifestMiddleware).getMetroServerRoot(projectRoot);
@@ -48,14 +67,35 @@ async function loadMetroConfigAsync(projectRoot, options, { exp =(0, _config).ge
48
67
  reporter,
49
68
  ...options
50
69
  });
70
+ if (// Requires SDK 50 for expo-assets hashAssetPlugin change.
71
+ !exp.sdkVersion || gteSdkVersion(exp, "50.0.0")) {
72
+ if (isExporting) {
73
+ var ref4;
74
+ var ref5;
75
+ // This token will be used in the asset plugin to ensure the path is correct for writing locally.
76
+ // @ts-expect-error: typed as readonly.
77
+ config.transformer.publicPath = `/assets?export_path=${((ref5 = (ref4 = exp.experiments) == null ? void 0 : ref4.basePath) != null ? ref5 : "") + "/assets"}`;
78
+ } else {
79
+ // @ts-expect-error: typed as readonly
80
+ config.transformer.publicPath = "/assets/?unstable_path=.";
81
+ }
82
+ } else {
83
+ var ref6;
84
+ if (isExporting && ((ref6 = exp.experiments) == null ? void 0 : ref6.basePath)) {
85
+ var ref7;
86
+ // This token will be used in the asset plugin to ensure the path is correct for writing locally.
87
+ // @ts-expect-error: typed as readonly.
88
+ config.transformer.publicPath = (ref7 = exp.experiments) == null ? void 0 : ref7.basePath;
89
+ }
90
+ }
51
91
  const platformBundlers = (0, _platformBundlers).getPlatformBundlers(exp);
52
- var ref4, ref5;
92
+ var ref8, ref9;
53
93
  config = await (0, _withMetroMultiPlatform).withMetroMultiPlatformAsync(projectRoot, {
54
- routerDirectory: (ref4 = (ref = exp.extra) == null ? void 0 : (ref1 = ref.router) == null ? void 0 : ref1.unstable_src) != null ? ref4 : (0, _router).getRouterDirectory(projectRoot),
94
+ routerDirectory: (ref8 = (ref = exp.extra) == null ? void 0 : (ref1 = ref.router) == null ? void 0 : ref1.unstable_src) != null ? ref8 : (0, _router).getRouterDirectory(projectRoot),
55
95
  config,
56
96
  platformBundlers,
57
97
  isTsconfigPathsEnabled: !!((ref2 = exp.experiments) == null ? void 0 : ref2.tsconfigPaths),
58
- webOutput: (ref5 = (ref3 = exp.web) == null ? void 0 : ref3.output) != null ? ref5 : "single"
98
+ webOutput: (ref9 = (ref3 = exp.web) == null ? void 0 : ref3.output) != null ? ref9 : "single"
59
99
  });
60
100
  (0, _rudderstackClient).logEventAsync("metro config", (0, _getMetroProperties).getMetroProperties(projectRoot, exp, config));
61
101
  return {
@@ -65,7 +105,7 @@ async function loadMetroConfigAsync(projectRoot, options, { exp =(0, _config).ge
65
105
  reporter: terminalReporter
66
106
  };
67
107
  }
68
- async function instantiateMetroAsync(metroBundler, options) {
108
+ async function instantiateMetroAsync(metroBundler, options, { isExporting }) {
69
109
  const projectRoot = metroBundler.projectRoot;
70
110
  // TODO: When we bring expo/metro-config into the expo/expo repo, then we can upstream this.
71
111
  const { exp } = (0, _config).getConfig(projectRoot, {
@@ -73,12 +113,21 @@ async function instantiateMetroAsync(metroBundler, options) {
73
113
  skipPlugins: true
74
114
  });
75
115
  const { config: metroConfig , setEventReporter } = await loadMetroConfigAsync(projectRoot, options, {
76
- exp
116
+ exp,
117
+ isExporting
77
118
  });
78
- const { middleware , websocketEndpoints , eventsSocketEndpoint , messageSocketEndpoint } = (0, _createDevServerMiddleware).createDevServerMiddleware(projectRoot, {
119
+ const { createDevServerMiddleware , securityHeadersMiddleware } = (0, _resolveFromProject).importCliServerApiFromProject(projectRoot);
120
+ const { middleware , messageSocketEndpoint , eventsSocketEndpoint , websocketEndpoints } = createDevServerMiddleware({
79
121
  port: metroConfig.server.port,
80
122
  watchFolders: metroConfig.watchFolders
81
123
  });
124
+ // securityHeadersMiddleware does not support cross-origin requests for remote devtools to get the sourcemap.
125
+ // We replace with the enhanced version.
126
+ (0, _mutations).replaceMiddlewareWith(middleware, securityHeadersMiddleware, _remoteDevtoolsSecurityHeadersMiddleware.remoteDevtoolsSecurityHeadersMiddleware);
127
+ middleware.use(_remoteDevtoolsCorsMiddleware.remoteDevtoolsCorsMiddleware);
128
+ (0, _mutations).prependMiddleware(middleware, _suppressErrorMiddleware.suppressRemoteDebuggingErrorMiddleware);
129
+ middleware.use("/inspector", (0, _createJsInspectorMiddleware).default());
130
+ // TODO: We can probably drop this now.
82
131
  const customEnhanceMiddleware = metroConfig.server.enhanceMiddleware;
83
132
  // @ts-expect-error: can't mutate readonly config
84
133
  metroConfig.server.enhanceMiddleware = (metroMiddleware, server)=>{
@@ -94,6 +143,18 @@ async function instantiateMetroAsync(metroBundler, options) {
94
143
  websocketEndpoints,
95
144
  watch: isWatchEnabled()
96
145
  });
146
+ (0, _mutations).prependMiddleware(middleware, (req, res, next)=>{
147
+ // If the URL is a Metro asset request, then we need to skip all other middleware to prevent
148
+ // the community CLI's serve-static from hosting `/assets/index.html` in place of all assets if it exists.
149
+ // /assets/?unstable_path=.
150
+ if (req.url) {
151
+ const url = new _url.URL(req.url, "http://localhost:8000");
152
+ if (url.pathname.match(/^\/assets\/?/) && url.searchParams.get("unstable_path") != null) {
153
+ return metro.processRequest(req, res, next);
154
+ }
155
+ }
156
+ return next();
157
+ });
97
158
  setEventReporter(eventsSocketEndpoint.reportEvent);
98
159
  return {
99
160
  metro,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/server/metro/instantiateMetro.ts"],"sourcesContent":["import { ExpoConfig, getConfig } from '@expo/config';\nimport { MetroDevServerOptions } from '@expo/dev-server';\nimport type { LoadOptions } from '@expo/metro-config';\nimport chalk from 'chalk';\nimport http from 'http';\nimport type Metro from 'metro';\nimport { Terminal } from 'metro-core';\n\nimport { Log } from '../../../log';\nimport { getMetroProperties } from '../../../utils/analytics/getMetroProperties';\nimport { createDebuggerTelemetryMiddleware } from '../../../utils/analytics/metroDebuggerMiddleware';\nimport { logEventAsync } from '../../../utils/analytics/rudderstackClient';\nimport { env } from '../../../utils/env';\nimport { getMetroServerRoot } from '../middleware/ManifestMiddleware';\nimport { createDevServerMiddleware } from '../middleware/createDevServerMiddleware';\nimport { getPlatformBundlers } from '../platformBundlers';\nimport { MetroBundlerDevServer } from './MetroBundlerDevServer';\nimport { MetroTerminalReporter } from './MetroTerminalReporter';\nimport { importExpoMetroConfig } from './resolveFromProject';\nimport { getRouterDirectory } from './router';\nimport { runServer } from './runServer-fork';\nimport { withMetroMultiPlatformAsync } from './withMetroMultiPlatform';\n\n// From expo/dev-server but with ability to use custom logger.\ntype MessageSocket = {\n broadcast: (method: string, params?: Record<string, any> | undefined) => void;\n};\n\nexport async function loadMetroConfigAsync(\n projectRoot: string,\n options: LoadOptions,\n {\n exp = getConfig(projectRoot, { skipSDKVersionRequirement: true, skipPlugins: true }).exp,\n }: { exp?: ExpoConfig } = {}\n) {\n let reportEvent: ((event: any) => void) | undefined;\n const serverRoot = getMetroServerRoot(projectRoot);\n\n const terminal = new Terminal(process.stdout);\n const terminalReporter = new MetroTerminalReporter(serverRoot, terminal);\n\n const reporter = {\n update(event: any) {\n terminalReporter.update(event);\n if (reportEvent) {\n reportEvent(event);\n }\n },\n };\n\n const ExpoMetroConfig = importExpoMetroConfig(projectRoot);\n let config = await ExpoMetroConfig.loadAsync(projectRoot, { reporter, ...options });\n\n const platformBundlers = getPlatformBundlers(exp);\n\n config = await withMetroMultiPlatformAsync(projectRoot, {\n routerDirectory: exp.extra?.router?.unstable_src ?? getRouterDirectory(projectRoot),\n config,\n platformBundlers,\n isTsconfigPathsEnabled: !!exp.experiments?.tsconfigPaths,\n webOutput: exp.web?.output ?? 'single',\n });\n\n logEventAsync('metro config', getMetroProperties(projectRoot, exp, config));\n\n return {\n config,\n setEventReporter: (logger: (event: any) => void) => (reportEvent = logger),\n reporter: terminalReporter,\n };\n}\n\n/** The most generic possible setup for Metro bundler. */\nexport async function instantiateMetroAsync(\n metroBundler: MetroBundlerDevServer,\n options: Omit<MetroDevServerOptions, 'logger'>\n): Promise<{\n metro: Metro.Server;\n server: http.Server;\n middleware: any;\n messageSocket: MessageSocket;\n}> {\n const projectRoot = metroBundler.projectRoot;\n\n // TODO: When we bring expo/metro-config into the expo/expo repo, then we can upstream this.\n const { exp } = getConfig(projectRoot, {\n skipSDKVersionRequirement: true,\n skipPlugins: true,\n });\n\n const { config: metroConfig, setEventReporter } = await loadMetroConfigAsync(\n projectRoot,\n options,\n { exp }\n );\n\n const { middleware, websocketEndpoints, eventsSocketEndpoint, messageSocketEndpoint } =\n createDevServerMiddleware(projectRoot, {\n port: metroConfig.server.port,\n watchFolders: metroConfig.watchFolders,\n });\n\n const customEnhanceMiddleware = metroConfig.server.enhanceMiddleware;\n // @ts-expect-error: can't mutate readonly config\n metroConfig.server.enhanceMiddleware = (metroMiddleware: any, server: Metro.Server) => {\n if (customEnhanceMiddleware) {\n metroMiddleware = customEnhanceMiddleware(metroMiddleware, server);\n }\n return middleware.use(metroMiddleware);\n };\n\n middleware.use(createDebuggerTelemetryMiddleware(projectRoot, exp));\n\n const { server, metro } = await runServer(metroBundler, metroConfig, {\n hmrEnabled: true,\n // @ts-expect-error: Inconsistent `websocketEndpoints` type between metro and @react-native-community/cli-server-api\n websocketEndpoints,\n watch: isWatchEnabled(),\n });\n\n setEventReporter(eventsSocketEndpoint.reportEvent);\n\n return {\n metro,\n server,\n middleware,\n messageSocket: messageSocketEndpoint,\n };\n}\n\n/**\n * Simplify and communicate if Metro is running without watching file updates,.\n * Exposed for testing.\n */\nexport function isWatchEnabled() {\n if (env.CI) {\n Log.log(\n chalk`Metro is running in CI mode, reloads are disabled. Remove {bold CI=true} to enable watch mode.`\n );\n }\n\n return !env.CI;\n}\n"],"names":["loadMetroConfigAsync","instantiateMetroAsync","isWatchEnabled","projectRoot","options","exp","getConfig","skipSDKVersionRequirement","skipPlugins","reportEvent","serverRoot","getMetroServerRoot","terminal","Terminal","process","stdout","terminalReporter","MetroTerminalReporter","reporter","update","event","ExpoMetroConfig","importExpoMetroConfig","config","loadAsync","platformBundlers","getPlatformBundlers","withMetroMultiPlatformAsync","routerDirectory","extra","router","unstable_src","getRouterDirectory","isTsconfigPathsEnabled","experiments","tsconfigPaths","webOutput","web","output","logEventAsync","getMetroProperties","setEventReporter","logger","metroBundler","metroConfig","middleware","websocketEndpoints","eventsSocketEndpoint","messageSocketEndpoint","createDevServerMiddleware","port","server","watchFolders","customEnhanceMiddleware","enhanceMiddleware","metroMiddleware","use","createDebuggerTelemetryMiddleware","metro","runServer","hmrEnabled","watch","messageSocket","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,YAAY;KACvC,CAAC,AAAC;IAEL,MAAMC,uBAAuB,GAAGT,WAAW,CAACO,MAAM,CAACG,iBAAiB,AAAC;IACrE,iDAAiD;IACjDV,WAAW,CAACO,MAAM,CAACG,iBAAiB,GAAG,CAACC,eAAoB,EAAEJ,MAAoB,GAAK;QACrF,IAAIE,uBAAuB,EAAE;YAC3BE,eAAe,GAAGF,uBAAuB,CAACE,eAAe,EAAEJ,MAAM,CAAC,CAAC;SACpE;QACD,OAAON,UAAU,CAACW,GAAG,CAACD,eAAe,CAAC,CAAC;KACxC,CAAC;IAEFV,UAAU,CAACW,GAAG,CAACC,CAAAA,GAAAA,wBAAiC,AAAkB,CAAA,kCAAlB,CAACtD,WAAW,EAAEE,GAAG,CAAC,CAAC,CAAC;IAEpE,MAAM,EAAE8C,MAAM,EAANA,OAAM,CAAA,EAAEO,KAAK,CAAA,EAAE,GAAG,MAAMC,CAAAA,GAAAA,cAAS,AAKvC,CAAA,UALuC,CAAChB,YAAY,EAAEC,WAAW,EAAE;QACnEgB,UAAU,EAAE,IAAI;QAChB,oHAAoH;QACpHd,kBAAkB;QAClBe,KAAK,EAAE3D,cAAc,EAAE;KACxB,CAAC,AAAC;IAEHuC,gBAAgB,CAACM,oBAAoB,CAACtC,WAAW,CAAC,CAAC;IAEnD,OAAO;QACLiD,KAAK;QACLP,MAAM,EAANA,OAAM;QACNN,UAAU;QACViB,aAAa,EAAEd,qBAAqB;KACrC,CAAC;CACH;AAMM,SAAS9C,cAAc,GAAG;IAC/B,IAAI6D,IAAG,IAAA,CAACC,EAAE,EAAE;QACVC,IAAG,IAAA,CAACC,GAAG,CACLC,MAAK,QAAA,CAAC,8FAA8F,CAAC,CACtG,CAAC;KACH;IAED,OAAO,CAACJ,IAAG,IAAA,CAACC,EAAE,CAAC;CAChB"}
1
+ {"version":3,"sources":["../../../../../src/start/server/metro/instantiateMetro.ts"],"sourcesContent":["import { ExpoConfig, getConfig } from '@expo/config';\nimport type { LoadOptions } from '@expo/metro-config';\nimport chalk from 'chalk';\nimport { Server as ConnectServer } from 'connect';\nimport http from 'http';\nimport type Metro from 'metro';\nimport { Terminal } from 'metro-core';\nimport semver from 'semver';\nimport { URL } from 'url';\n\nimport { MetroBundlerDevServer } from './MetroBundlerDevServer';\nimport { MetroTerminalReporter } from './MetroTerminalReporter';\nimport { importCliServerApiFromProject, importExpoMetroConfig } from './resolveFromProject';\nimport { getRouterDirectory } from './router';\nimport { runServer } from './runServer-fork';\nimport { withMetroMultiPlatformAsync } from './withMetroMultiPlatform';\nimport { MetroDevServerOptions } from '../../../export/fork-bundleAsync';\nimport { Log } from '../../../log';\nimport { getMetroProperties } from '../../../utils/analytics/getMetroProperties';\nimport { createDebuggerTelemetryMiddleware } from '../../../utils/analytics/metroDebuggerMiddleware';\nimport { logEventAsync } from '../../../utils/analytics/rudderstackClient';\nimport { env } from '../../../utils/env';\nimport { getMetroServerRoot } from '../middleware/ManifestMiddleware';\nimport createJsInspectorMiddleware from '../middleware/inspector/createJsInspectorMiddleware';\nimport { prependMiddleware, replaceMiddlewareWith } from '../middleware/mutations';\nimport { remoteDevtoolsCorsMiddleware } from '../middleware/remoteDevtoolsCorsMiddleware';\nimport { remoteDevtoolsSecurityHeadersMiddleware } from '../middleware/remoteDevtoolsSecurityHeadersMiddleware';\nimport { ServerNext, ServerRequest, ServerResponse } from '../middleware/server.types';\nimport { suppressRemoteDebuggingErrorMiddleware } from '../middleware/suppressErrorMiddleware';\nimport { getPlatformBundlers } from '../platformBundlers';\n\n// From expo/dev-server but with ability to use custom logger.\ntype MessageSocket = {\n broadcast: (method: string, params?: Record<string, any> | undefined) => void;\n};\n\nfunction gteSdkVersion(exp: Pick<ExpoConfig, 'sdkVersion'>, sdkVersion: string): boolean {\n if (!exp.sdkVersion) {\n return false;\n }\n\n if (exp.sdkVersion === 'UNVERSIONED') {\n return true;\n }\n\n try {\n return semver.gte(exp.sdkVersion, sdkVersion);\n } catch {\n throw new Error(`${exp.sdkVersion} is not a valid version. Must be in the form of x.y.z`);\n }\n}\n\nexport async function loadMetroConfigAsync(\n projectRoot: string,\n options: LoadOptions,\n {\n exp = getConfig(projectRoot, { skipSDKVersionRequirement: true, skipPlugins: true }).exp,\n isExporting,\n }: { exp?: ExpoConfig; isExporting: boolean }\n) {\n let reportEvent: ((event: any) => void) | undefined;\n const serverRoot = getMetroServerRoot(projectRoot);\n\n const terminal = new Terminal(process.stdout);\n const terminalReporter = new MetroTerminalReporter(serverRoot, terminal);\n\n const reporter = {\n update(event: any) {\n terminalReporter.update(event);\n if (reportEvent) {\n reportEvent(event);\n }\n },\n };\n\n const ExpoMetroConfig = importExpoMetroConfig(projectRoot);\n let config = await ExpoMetroConfig.loadAsync(projectRoot, { reporter, ...options });\n\n if (\n // Requires SDK 50 for expo-assets hashAssetPlugin change.\n !exp.sdkVersion ||\n gteSdkVersion(exp, '50.0.0')\n ) {\n if (isExporting) {\n // This token will be used in the asset plugin to ensure the path is correct for writing locally.\n // @ts-expect-error: typed as readonly.\n config.transformer.publicPath = `/assets?export_path=${\n (exp.experiments?.basePath ?? '') + '/assets'\n }`;\n } else {\n // @ts-expect-error: typed as readonly\n config.transformer.publicPath = '/assets/?unstable_path=.';\n }\n } else {\n if (isExporting && exp.experiments?.basePath) {\n // This token will be used in the asset plugin to ensure the path is correct for writing locally.\n // @ts-expect-error: typed as readonly.\n config.transformer.publicPath = exp.experiments?.basePath;\n }\n }\n\n const platformBundlers = getPlatformBundlers(exp);\n\n config = await withMetroMultiPlatformAsync(projectRoot, {\n routerDirectory: exp.extra?.router?.unstable_src ?? getRouterDirectory(projectRoot),\n config,\n platformBundlers,\n isTsconfigPathsEnabled: !!exp.experiments?.tsconfigPaths,\n webOutput: exp.web?.output ?? 'single',\n });\n\n logEventAsync('metro config', getMetroProperties(projectRoot, exp, config));\n\n return {\n config,\n setEventReporter: (logger: (event: any) => void) => (reportEvent = logger),\n reporter: terminalReporter,\n };\n}\n\n/** The most generic possible setup for Metro bundler. */\nexport async function instantiateMetroAsync(\n metroBundler: MetroBundlerDevServer,\n options: Omit<MetroDevServerOptions, 'logger'>,\n { isExporting }: { isExporting: boolean }\n): Promise<{\n metro: Metro.Server;\n server: http.Server;\n middleware: any;\n messageSocket: MessageSocket;\n}> {\n const projectRoot = metroBundler.projectRoot;\n\n // TODO: When we bring expo/metro-config into the expo/expo repo, then we can upstream this.\n const { exp } = getConfig(projectRoot, {\n skipSDKVersionRequirement: true,\n skipPlugins: true,\n });\n\n const { config: metroConfig, setEventReporter } = await loadMetroConfigAsync(\n projectRoot,\n options,\n { exp, isExporting }\n );\n\n const { createDevServerMiddleware, securityHeadersMiddleware } =\n importCliServerApiFromProject(projectRoot);\n\n const { middleware, messageSocketEndpoint, eventsSocketEndpoint, websocketEndpoints } =\n createDevServerMiddleware({\n port: metroConfig.server.port,\n watchFolders: metroConfig.watchFolders,\n });\n\n // securityHeadersMiddleware does not support cross-origin requests for remote devtools to get the sourcemap.\n // We replace with the enhanced version.\n replaceMiddlewareWith(\n middleware as ConnectServer,\n securityHeadersMiddleware,\n remoteDevtoolsSecurityHeadersMiddleware\n );\n\n middleware.use(remoteDevtoolsCorsMiddleware);\n\n prependMiddleware(middleware, suppressRemoteDebuggingErrorMiddleware);\n\n middleware.use('/inspector', createJsInspectorMiddleware());\n\n // TODO: We can probably drop this now.\n const customEnhanceMiddleware = metroConfig.server.enhanceMiddleware;\n // @ts-expect-error: can't mutate readonly config\n metroConfig.server.enhanceMiddleware = (metroMiddleware: any, server: Metro.Server) => {\n if (customEnhanceMiddleware) {\n metroMiddleware = customEnhanceMiddleware(metroMiddleware, server);\n }\n return middleware.use(metroMiddleware);\n };\n\n middleware.use(createDebuggerTelemetryMiddleware(projectRoot, exp));\n\n const { server, metro } = await runServer(metroBundler, metroConfig, {\n hmrEnabled: true,\n // @ts-expect-error: Inconsistent `websocketEndpoints` type between metro and @react-native-community/cli-server-api\n websocketEndpoints,\n watch: isWatchEnabled(),\n });\n\n prependMiddleware(middleware, (req: ServerRequest, res: ServerResponse, next: ServerNext) => {\n // If the URL is a Metro asset request, then we need to skip all other middleware to prevent\n // the community CLI's serve-static from hosting `/assets/index.html` in place of all assets if it exists.\n // /assets/?unstable_path=.\n if (req.url) {\n const url = new URL(req.url!, 'http://localhost:8000');\n if (url.pathname.match(/^\\/assets\\/?/) && url.searchParams.get('unstable_path') != null) {\n return metro.processRequest(req, res, next);\n }\n }\n return next();\n });\n\n setEventReporter(eventsSocketEndpoint.reportEvent);\n\n return {\n metro,\n server,\n middleware,\n messageSocket: messageSocketEndpoint,\n };\n}\n\n/**\n * Simplify and communicate if Metro is running without watching file updates,.\n * Exposed for testing.\n */\nexport function isWatchEnabled() {\n if (env.CI) {\n Log.log(\n chalk`Metro is running in CI mode, reloads are disabled. Remove {bold CI=true} to enable watch mode.`\n );\n }\n\n return !env.CI;\n}\n"],"names":["loadMetroConfigAsync","instantiateMetroAsync","isWatchEnabled","gteSdkVersion","exp","sdkVersion","semver","gte","Error","projectRoot","options","getConfig","skipSDKVersionRequirement","skipPlugins","isExporting","reportEvent","serverRoot","getMetroServerRoot","terminal","Terminal","process","stdout","terminalReporter","MetroTerminalReporter","reporter","update","event","ExpoMetroConfig","importExpoMetroConfig","config","loadAsync","transformer","publicPath","experiments","basePath","platformBundlers","getPlatformBundlers","withMetroMultiPlatformAsync","routerDirectory","extra","router","unstable_src","getRouterDirectory","isTsconfigPathsEnabled","tsconfigPaths","webOutput","web","output","logEventAsync","getMetroProperties","setEventReporter","logger","metroBundler","metroConfig","createDevServerMiddleware","securityHeadersMiddleware","importCliServerApiFromProject","middleware","messageSocketEndpoint","eventsSocketEndpoint","websocketEndpoints","port","server","watchFolders","replaceMiddlewareWith","remoteDevtoolsSecurityHeadersMiddleware","use","remoteDevtoolsCorsMiddleware","prependMiddleware","suppressRemoteDebuggingErrorMiddleware","createJsInspectorMiddleware","customEnhanceMiddleware","enhanceMiddleware","metroMiddleware","createDebuggerTelemetryMiddleware","metro","runServer","hmrEnabled","watch","req","res","next","url","URL","p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F,IAAG,IAAA,CAACC,EAAE,EAAE;QACVC,IAAG,IAAA,CAACC,GAAG,CACLC,MAAK,QAAA,CAAC,8FAA8F,CAAC,CACtG,CAAC;KACH;IAED,OAAO,CAACJ,IAAG,IAAA,CAACC,EAAE,CAAC;CAChB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/server/metro/metroErrorInterface.ts"],"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 chalk from 'chalk';\nimport resolveFrom from 'resolve-from';\nimport { StackFrame } from 'stacktrace-parser';\nimport terminalLink from 'terminal-link';\n\nimport { Log } from '../../../log';\nimport { createMetroEndpointAsync } from '../getStaticRenderFunctions';\n// import type { CodeFrame, MetroStackFrame } from '@expo/metro-runtime/symbolicate';\n\ntype CodeFrame = {\n content: string;\n location?: {\n row: number;\n column: number;\n [key: string]: any;\n };\n fileName: string;\n};\n\ntype MetroStackFrame = StackFrame & { collapse?: boolean };\n\nexport async function logMetroErrorWithStack(\n projectRoot: string,\n {\n stack,\n codeFrame,\n error,\n }: {\n stack: MetroStackFrame[];\n codeFrame: CodeFrame;\n error: Error;\n }\n) {\n const { getStackFormattedLocation } = require(resolveFrom(\n projectRoot,\n '@expo/metro-runtime/symbolicate'\n ));\n\n Log.log();\n Log.log(chalk.red('Metro error: ') + error.message);\n Log.log();\n\n if (codeFrame) {\n Log.log(codeFrame.content);\n }\n\n if (stack?.length) {\n Log.log();\n Log.log(chalk.bold`Call Stack`);\n\n const stackProps = stack.map((frame) => {\n return {\n title: frame.methodName,\n subtitle: getStackFormattedLocation(projectRoot, frame),\n collapse: frame.collapse,\n };\n });\n\n stackProps.forEach((frame) => {\n const position = terminalLink.isSupported\n ? terminalLink(frame.subtitle, frame.subtitle)\n : frame.subtitle;\n let lineItem = chalk.gray(` ${frame.title} (${position})`);\n if (frame.collapse) {\n lineItem = chalk.dim(lineItem);\n }\n Log.log(lineItem);\n });\n } else {\n Log.log(chalk.gray(` ${error.stack}`));\n }\n}\n\nexport async function logMetroError(projectRoot: string, { error }: { error: Error }) {\n const { LogBoxLog, parseErrorStack } = require(resolveFrom(\n projectRoot,\n '@expo/metro-runtime/symbolicate'\n ));\n\n const stack = parseErrorStack(error.stack);\n\n const log = new LogBoxLog({\n level: 'static',\n message: {\n content: error.message,\n substitutions: [],\n },\n isComponentError: false,\n stack,\n category: 'static',\n componentStack: [],\n });\n\n await new Promise((res) => log.symbolicate('stack', res));\n\n logMetroErrorWithStack(projectRoot, {\n stack: log.symbolicated?.stack?.stack ?? [],\n codeFrame: log.codeFrame,\n error,\n });\n}\n\n/** @returns the html required to render the static metro error as an SPA. */\nexport function logFromError({ error, projectRoot }: { error: Error; projectRoot: string }): {\n symbolicated: any;\n symbolicate: (type: string, callback: () => void) => void;\n codeFrame: CodeFrame;\n} {\n const { LogBoxLog, parseErrorStack } = require(resolveFrom(\n projectRoot,\n '@expo/metro-runtime/symbolicate'\n ));\n\n const stack = parseErrorStack(error.stack);\n\n return new LogBoxLog({\n level: 'static',\n message: {\n content: error.message,\n substitutions: [],\n },\n isComponentError: false,\n stack,\n category: 'static',\n componentStack: [],\n });\n}\n\n/** @returns the html required to render the static metro error as an SPA. */\nexport async function logMetroErrorAsync({\n error,\n projectRoot,\n}: {\n error: Error;\n projectRoot: string;\n}) {\n const log = logFromError({ projectRoot, error });\n\n await new Promise<void>((res) => log.symbolicate('stack', res));\n\n logMetroErrorWithStack(projectRoot, {\n stack: log.symbolicated?.stack?.stack ?? [],\n codeFrame: log.codeFrame,\n error,\n });\n}\n\n/** @returns the html required to render the static metro error as an SPA. */\nexport async function getErrorOverlayHtmlAsync({\n error,\n projectRoot,\n}: {\n error: Error;\n projectRoot: string;\n}) {\n const log = logFromError({ projectRoot, error });\n\n await new Promise<void>((res) => log.symbolicate('stack', res));\n\n logMetroErrorWithStack(projectRoot, {\n stack: log.symbolicated?.stack?.stack ?? [],\n codeFrame: log.codeFrame,\n error,\n });\n\n const logBoxContext = {\n selectedLogIndex: 0,\n isDisabled: false,\n logs: [log],\n };\n const html = `<html><head><style>#root,body,html{height:100%}body{overflow:hidden}#root{display:flex}</style></head><body><div id=\"root\"></div><script id=\"_expo-static-error\" type=\"application/json\">${JSON.stringify(\n logBoxContext\n )}</script></body></html>`;\n\n const errorOverlayEntry = await createMetroEndpointAsync(\n projectRoot,\n // Keep the URL relative\n '',\n resolveFrom(projectRoot, 'expo-router/_error'),\n {\n dev: true,\n platform: 'web',\n minify: false,\n environment: 'node',\n }\n );\n\n const htmlWithJs = html.replace('</body>', `<script src=${errorOverlayEntry}></script></body>`);\n return htmlWithJs;\n}\n"],"names":["logMetroErrorWithStack","logMetroError","logFromError","logMetroErrorAsync","getErrorOverlayHtmlAsync","projectRoot","stack","codeFrame","error","getStackFormattedLocation","require","resolveFrom","Log","log","chalk","red","message","content","length","bold","stackProps","map","frame","title","methodName","subtitle","collapse","forEach","position","terminalLink","isSupported","lineItem","gray","dim","LogBoxLog","parseErrorStack","level","substitutions","isComponentError","category","componentStack","Promise","res","symbolicate","symbolicated","logBoxContext","selectedLogIndex","isDisabled","logs","html","JSON","stringify","errorOverlayEntry","createMetroEndpointAsync","dev","platform","minify","environment","htmlWithJs","replace"],"mappings":"AAMA;;;;QAqBsBA,sBAAsB,GAAtBA,sBAAsB;QAoDtBC,aAAa,GAAbA,aAAa;QA8BnBC,YAAY,GAAZA,YAAY;QA0BNC,kBAAkB,GAAlBA,kBAAkB;QAmBlBC,wBAAwB,GAAxBA,wBAAwB;AApJ5B,IAAA,MAAO,kCAAP,OAAO,EAAA;AACD,IAAA,YAAc,kCAAd,cAAc,EAAA;AAEb,IAAA,aAAe,kCAAf,eAAe,EAAA;AAEpB,IAAA,IAAc,WAAd,cAAc,CAAA;AACO,IAAA,yBAA6B,WAA7B,6BAA6B,CAAA;;;;;;AAe/D,eAAeJ,sBAAsB,CAC1CK,WAAmB,EACnB,EACEC,KAAK,CAAA,EACLC,SAAS,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,MAAMC,CAAAA,GAAAA,yBAAwB,AAWvD,CAAA,yBAXuD,CACtDhD,WAAW,EACX,wBAAwB;IACxB,EAAE,EACFM,CAAAA,GAAAA,YAAW,AAAmC,CAAA,QAAnC,CAACN,WAAW,EAAE,oBAAoB,CAAC,EAC9C;QACEiD,GAAG,EAAE,IAAI;QACTC,QAAQ,EAAE,KAAK;QACfC,MAAM,EAAE,KAAK;QACbC,WAAW,EAAE,MAAM;KACpB,CACF,AAAC;IAEF,MAAMC,UAAU,GAAGT,IAAI,CAACU,OAAO,CAAC,SAAS,EAAE,CAAC,YAAY,EAAEP,iBAAiB,CAAC,iBAAiB,CAAC,CAAC,AAAC;IAChG,OAAOM,UAAU,CAAC;CACnB"}
1
+ {"version":3,"sources":["../../../../../src/start/server/metro/metroErrorInterface.ts"],"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 chalk from 'chalk';\nimport resolveFrom from 'resolve-from';\nimport { StackFrame } from 'stacktrace-parser';\nimport terminalLink from 'terminal-link';\n\nimport { Log } from '../../../log';\nimport { createMetroEndpointAsync } from '../getStaticRenderFunctions';\n// import type { CodeFrame, MetroStackFrame } from '@expo/metro-runtime/symbolicate';\n\ntype CodeFrame = {\n content: string;\n location?: {\n row: number;\n column: number;\n [key: string]: any;\n };\n fileName: string;\n};\n\ntype MetroStackFrame = StackFrame & { collapse?: boolean };\n\nexport async function logMetroErrorWithStack(\n projectRoot: string,\n {\n stack,\n codeFrame,\n error,\n }: {\n stack: MetroStackFrame[];\n codeFrame: CodeFrame;\n error: Error;\n }\n) {\n const { getStackFormattedLocation } = require(\n resolveFrom(projectRoot, '@expo/metro-runtime/symbolicate')\n );\n\n Log.log();\n Log.log(chalk.red('Metro error: ') + error.message);\n Log.log();\n\n if (codeFrame) {\n Log.log(codeFrame.content);\n }\n\n if (stack?.length) {\n Log.log();\n Log.log(chalk.bold`Call Stack`);\n\n const stackProps = stack.map((frame) => {\n return {\n title: frame.methodName,\n subtitle: getStackFormattedLocation(projectRoot, frame),\n collapse: frame.collapse,\n };\n });\n\n stackProps.forEach((frame) => {\n const position = terminalLink.isSupported\n ? terminalLink(frame.subtitle, frame.subtitle)\n : frame.subtitle;\n let lineItem = chalk.gray(` ${frame.title} (${position})`);\n if (frame.collapse) {\n lineItem = chalk.dim(lineItem);\n }\n Log.log(lineItem);\n });\n } else {\n Log.log(chalk.gray(` ${error.stack}`));\n }\n}\n\nexport async function logMetroError(projectRoot: string, { error }: { error: Error }) {\n const { LogBoxLog, parseErrorStack } = require(\n resolveFrom(projectRoot, '@expo/metro-runtime/symbolicate')\n );\n\n const stack = parseErrorStack(error.stack);\n\n const log = new LogBoxLog({\n level: 'static',\n message: {\n content: error.message,\n substitutions: [],\n },\n isComponentError: false,\n stack,\n category: 'static',\n componentStack: [],\n });\n\n await new Promise((res) => log.symbolicate('stack', res));\n\n logMetroErrorWithStack(projectRoot, {\n stack: log.symbolicated?.stack?.stack ?? [],\n codeFrame: log.codeFrame,\n error,\n });\n}\n\n/** @returns the html required to render the static metro error as an SPA. */\nexport function logFromError({ error, projectRoot }: { error: Error; projectRoot: string }): {\n symbolicated: any;\n symbolicate: (type: string, callback: () => void) => void;\n codeFrame: CodeFrame;\n} {\n const { LogBoxLog, parseErrorStack } = require(\n resolveFrom(projectRoot, '@expo/metro-runtime/symbolicate')\n );\n\n const stack = parseErrorStack(error.stack);\n\n return new LogBoxLog({\n level: 'static',\n message: {\n content: error.message,\n substitutions: [],\n },\n isComponentError: false,\n stack,\n category: 'static',\n componentStack: [],\n });\n}\n\n/** @returns the html required to render the static metro error as an SPA. */\nexport async function logMetroErrorAsync({\n error,\n projectRoot,\n}: {\n error: Error;\n projectRoot: string;\n}) {\n const log = logFromError({ projectRoot, error });\n\n await new Promise<void>((res) => log.symbolicate('stack', res));\n\n logMetroErrorWithStack(projectRoot, {\n stack: log.symbolicated?.stack?.stack ?? [],\n codeFrame: log.codeFrame,\n error,\n });\n}\n\n/** @returns the html required to render the static metro error as an SPA. */\nexport async function getErrorOverlayHtmlAsync({\n error,\n projectRoot,\n}: {\n error: Error;\n projectRoot: string;\n}) {\n const log = logFromError({ projectRoot, error });\n\n await new Promise<void>((res) => log.symbolicate('stack', res));\n\n logMetroErrorWithStack(projectRoot, {\n stack: log.symbolicated?.stack?.stack ?? [],\n codeFrame: log.codeFrame,\n error,\n });\n\n const logBoxContext = {\n selectedLogIndex: 0,\n isDisabled: false,\n logs: [log],\n };\n const html = `<html><head><style>#root,body,html{height:100%}body{overflow:hidden}#root{display:flex}</style></head><body><div id=\"root\"></div><script id=\"_expo-static-error\" type=\"application/json\">${JSON.stringify(\n logBoxContext\n )}</script></body></html>`;\n\n const errorOverlayEntry = await createMetroEndpointAsync(\n projectRoot,\n // Keep the URL relative\n '',\n resolveFrom(projectRoot, 'expo-router/_error'),\n {\n dev: true,\n platform: 'web',\n minify: false,\n environment: 'node',\n }\n );\n\n const htmlWithJs = html.replace('</body>', `<script src=${errorOverlayEntry}></script></body>`);\n return htmlWithJs;\n}\n"],"names":["logMetroErrorWithStack","logMetroError","logFromError","logMetroErrorAsync","getErrorOverlayHtmlAsync","projectRoot","stack","codeFrame","error","getStackFormattedLocation","require","resolveFrom","Log","log","chalk","red","message","content","length","bold","stackProps","map","frame","title","methodName","subtitle","collapse","forEach","position","terminalLink","isSupported","lineItem","gray","dim","LogBoxLog","parseErrorStack","level","substitutions","isComponentError","category","componentStack","Promise","res","symbolicate","symbolicated","logBoxContext","selectedLogIndex","isDisabled","logs","html","JSON","stringify","errorOverlayEntry","createMetroEndpointAsync","dev","platform","minify","environment","htmlWithJs","replace"],"mappings":"AAMA;;;;QAqBsBA,sBAAsB,GAAtBA,sBAAsB;QAmDtBC,aAAa,GAAbA,aAAa;QA6BnBC,YAAY,GAAZA,YAAY;QAyBNC,kBAAkB,GAAlBA,kBAAkB;QAmBlBC,wBAAwB,GAAxBA,wBAAwB;AAjJ5B,IAAA,MAAO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H,MAAMqC,aAAa,GAAG;QACpBC,gBAAgB,EAAE,CAAC;QACnBC,UAAU,EAAE,KAAK;QACjBC,IAAI,EAAE;YAACnC,GAAG;SAAC;KACZ,AAAC;IACF,MAAMoC,IAAI,GAAG,CAAC,yLAAyL,EAAEC,IAAI,CAACC,SAAS,CACrNN,aAAa,CACd,CAAC,uBAAuB,CAAC,AAAC;IAE3B,MAAMO,iBAAiB,GAAG,MAAMC,CAAAA,GAAAA,yBAAwB,AAWvD,CAAA,yBAXuD,CACtDhD,WAAW,EACX,wBAAwB;IACxB,EAAE,EACFM,CAAAA,GAAAA,YAAW,AAAmC,CAAA,QAAnC,CAACN,WAAW,EAAE,oBAAoB,CAAC,EAC9C;QACEiD,GAAG,EAAE,IAAI;QACTC,QAAQ,EAAE,KAAK;QACfC,MAAM,EAAE,KAAK;QACbC,WAAW,EAAE,MAAM;KACpB,CACF,AAAC;IAEF,MAAMC,UAAU,GAAGT,IAAI,CAACU,OAAO,CAAC,SAAS,EAAE,CAAC,YAAY,EAAEP,iBAAiB,CAAC,iBAAiB,CAAC,CAAC,AAAC;IAChG,OAAOM,UAAU,CAAC;CACnB"}
@@ -2,7 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
+ exports.importCliServerApiFromProject = importCliServerApiFromProject;
6
+ exports.importMetroSourceMapComposeSourceMapsFromProject = importMetroSourceMapComposeSourceMapsFromProject;
7
+ exports.resolveFromProject = resolveFromProject;
5
8
  exports.importMetroFromProject = importMetroFromProject;
9
+ exports.importMetroServerFromProject = importMetroServerFromProject;
6
10
  exports.importMetroCreateWebsocketServerFromProject = importMetroCreateWebsocketServerFromProject;
7
11
  exports.importMetroHmrServerFromProject = importMetroHmrServerFromProject;
8
12
  exports.importExpoMetroConfig = importExpoMetroConfig;
@@ -11,7 +15,6 @@ exports.importMetroResolverFromProject = importMetroResolverFromProject;
11
15
  exports.importMetroInspectorProxyFromProject = importMetroInspectorProxyFromProject;
12
16
  exports.importMetroInspectorDeviceFromProject = importMetroInspectorDeviceFromProject;
13
17
  exports.importCliSaveAssetsFromProject = importCliSaveAssetsFromProject;
14
- exports.importCliBuildBundleWithConfigFromProject = importCliBuildBundleWithConfigFromProject;
15
18
  exports.resolveMetroVersionFromProject = resolveMetroVersionFromProject;
16
19
  var _resolveFrom = _interopRequireDefault(require("resolve-from"));
17
20
  function _interopRequireDefault(obj) {
@@ -28,6 +31,12 @@ class MetroImportError extends Error {
28
31
  super(`Missing package "${moduleId}" in the project at: ${projectRoot}\n` + 'This usually means "react-native" is not installed. ' + 'Please verify that dependencies in package.json include "react-native" ' + "and run `yarn` or `npm install`.");
29
32
  }
30
33
  }
34
+ function importCliServerApiFromProject(projectRoot) {
35
+ return importFromProject(projectRoot, "@react-native-community/cli-server-api");
36
+ }
37
+ function importMetroSourceMapComposeSourceMapsFromProject(projectRoot) {
38
+ return importFromProject(projectRoot, "metro-source-map/src/composeSourceMaps");
39
+ }
31
40
  function resolveFromProject(projectRoot, moduleId) {
32
41
  const resolvedPath = _resolveFrom.default.silent(projectRoot, moduleId);
33
42
  if (!resolvedPath) {
@@ -41,6 +50,9 @@ function importFromProject(projectRoot, moduleId) {
41
50
  function importMetroFromProject(projectRoot) {
42
51
  return importFromProject(projectRoot, "metro");
43
52
  }
53
+ function importMetroServerFromProject(projectRoot) {
54
+ return importFromProject(projectRoot, "metro/src/Server");
55
+ }
44
56
  function importMetroCreateWebsocketServerFromProject(projectRoot) {
45
57
  return importFromProject(projectRoot, "metro/src/lib/createWebsocketServer");
46
58
  }
@@ -71,9 +83,6 @@ function importMetroInspectorDeviceFromProject(projectRoot) {
71
83
  function importCliSaveAssetsFromProject(projectRoot) {
72
84
  return importFromProject(projectRoot, "@react-native-community/cli-plugin-metro/build/commands/bundle/saveAssets").default;
73
85
  }
74
- function importCliBuildBundleWithConfigFromProject(projectRoot) {
75
- return importFromProject(projectRoot, "@react-native-community/cli-plugin-metro/build/commands/bundle/buildBundle").buildBundleWithConfig;
76
- }
77
86
  function resolveMetroVersionFromProject(projectRoot) {
78
87
  return importFromProject(projectRoot, "metro/package.json").version;
79
88
  }