@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
@@ -4,15 +4,18 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  exports.getDeepLinkHandler = getDeepLinkHandler;
6
6
  var _config = require("@expo/config");
7
- var _devServer = require("@expo/dev-server");
8
7
  var runtimeEnv = _interopRequireWildcard(require("@expo/env"));
9
- var _assert = _interopRequireDefault(require("assert"));
10
8
  var _chalk = _interopRequireDefault(require("chalk"));
11
9
  var _nodeFetch = _interopRequireDefault(require("node-fetch"));
12
10
  var _path = _interopRequireDefault(require("path"));
11
+ var _instantiateMetro = require("./instantiateMetro");
12
+ var _metroErrorInterface = require("./metroErrorInterface");
13
+ var _metroWatchTypeScriptFiles = require("./metroWatchTypeScriptFiles");
14
+ var _waitForMetroToObserveTypeScriptFile = require("./waitForMetroToObserveTypeScriptFile");
13
15
  var _log = require("../../../log");
14
16
  var _getDevClientProperties = _interopRequireDefault(require("../../../utils/analytics/getDevClientProperties"));
15
17
  var _rudderstackClient = require("../../../utils/analytics/rudderstackClient");
18
+ var _errors = require("../../../utils/errors");
16
19
  var _port = require("../../../utils/port");
17
20
  var _bundlerDevServer = require("../BundlerDevServer");
18
21
  var _getStaticRenderFunctions = require("../getStaticRenderFunctions");
@@ -25,11 +28,8 @@ var _manifestMiddleware = require("../middleware/ManifestMiddleware");
25
28
  var _reactDevToolsPageMiddleware = require("../middleware/ReactDevToolsPageMiddleware");
26
29
  var _runtimeRedirectMiddleware = require("../middleware/RuntimeRedirectMiddleware");
27
30
  var _serveStaticMiddleware = require("../middleware/ServeStaticMiddleware");
31
+ var _mutations = require("../middleware/mutations");
28
32
  var _startTypescriptTypeGeneration = require("../type-generation/startTypescriptTypeGeneration");
29
- var _instantiateMetro = require("./instantiateMetro");
30
- var _metroErrorInterface = require("./metroErrorInterface");
31
- var _metroWatchTypeScriptFiles = require("./metroWatchTypeScriptFiles");
32
- var _waitForMetroToObserveTypeScriptFile = require("./waitForMetroToObserveTypeScriptFile");
33
33
  function _interopRequireDefault(obj) {
34
34
  return obj && obj.__esModule ? obj : {
35
35
  default: obj
@@ -56,6 +56,13 @@ function _interopRequireWildcard(obj) {
56
56
  return newObj;
57
57
  }
58
58
  }
59
+ class ForwardHtmlError extends _errors.CommandError {
60
+ constructor(message, html, statusCode){
61
+ super(message);
62
+ this.html = html;
63
+ this.statusCode = statusCode;
64
+ }
65
+ }
59
66
  const debug = require("debug")("expo:start:server:metro");
60
67
  /** Default port to use for apps running in Expo Go. */ const EXPO_GO_METRO_PORT = 8081;
61
68
  /** Default port to use for apps that run in standard React Native projects or Expo Dev Clients. */ const DEV_CLIENT_METRO_PORT = 8081;
@@ -71,18 +78,7 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
71
78
  (options.devClient ? Number(process.env.RCT_METRO_PORT) || DEV_CLIENT_METRO_PORT : await (0, _port).getFreePortAsync(EXPO_GO_METRO_PORT));
72
79
  return port;
73
80
  }
74
- /** Get routes from Expo Router. */ async getRoutesAsync() {
75
- const url = this.getDevServerUrl();
76
- (0, _assert).default(url, "Dev server must be started");
77
- const { getManifest } = await (0, _getStaticRenderFunctions).getStaticRenderFunctions(this.projectRoot, url, {
78
- // Ensure the API Routes are included
79
- environment: "node"
80
- });
81
- return getManifest({
82
- fetchData: true
83
- });
84
- }
85
- async composeResourcesWithHtml({ mode , resources , template , devBundleUrl }) {
81
+ async composeResourcesWithHtml({ mode , resources , template , devBundleUrl , basePath }) {
86
82
  if (!resources) {
87
83
  return "";
88
84
  }
@@ -90,22 +86,30 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
90
86
  return htmlFromSerialAssets(resources, {
91
87
  dev: isDev,
92
88
  template,
89
+ basePath,
93
90
  bundleUrl: isDev ? devBundleUrl : undefined
94
91
  });
95
92
  }
96
93
  async getStaticRenderFunctionAsync({ mode , minify =mode !== "development" }) {
97
94
  const url = this.getDevServerUrl();
98
- const { getStaticContent } = await (0, _getStaticRenderFunctions).getStaticRenderFunctions(this.projectRoot, url, {
95
+ const { getStaticContent , getManifest } = await (0, _getStaticRenderFunctions).getStaticRenderFunctions(this.projectRoot, url, {
99
96
  minify,
100
97
  dev: mode !== "production",
101
98
  // Ensure the API Routes are included
102
99
  environment: "node"
103
100
  });
104
- return async (path)=>{
105
- return await getStaticContent(new URL(path, url));
101
+ return {
102
+ // Get routes from Expo Router.
103
+ manifest: await getManifest({
104
+ fetchData: true
105
+ }),
106
+ // Get route generating function
107
+ async renderAsync (path) {
108
+ return await getStaticContent(new URL(path, url));
109
+ }
106
110
  };
107
111
  }
108
- async getStaticResourcesAsync({ mode , minify =mode !== "development" }) {
112
+ async getStaticResourcesAsync({ mode , minify =mode !== "development" , includeMaps }) {
109
113
  var ref;
110
114
  const devBundleUrlPathname = (0, _manifestMiddleware).createBundleUrlPath({
111
115
  platform: "web",
@@ -113,6 +117,7 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
113
117
  minify,
114
118
  environment: "client",
115
119
  serializerOutput: "static",
120
+ serializerIncludeMaps: includeMaps,
116
121
  mainModuleName: (0, _manifestMiddleware).resolveMainModuleName(this.projectRoot, (0, _config).getConfig(this.projectRoot), "web"),
117
122
  lazy: (0, _manifestMiddleware).shouldEnableAsyncImports(this.projectRoot)
118
123
  });
@@ -120,12 +125,17 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
120
125
  // Fetch the generated HTML from our custom Metro serializer
121
126
  const results = await (0, _nodeFetch).default(bundleUrl.toString());
122
127
  const txt = await results.text();
128
+ // console.log('STAT:', results.status, results.statusText);
123
129
  let data;
124
130
  try {
125
131
  data = JSON.parse(txt);
126
132
  } catch (error) {
127
- _log.Log.error("Failed to generate resources with Metro, the Metro config may not be using the correct serializer. Ensure the metro.config.js is extending the expo/metro-config and is not overriding the serializer.");
128
133
  debug(txt);
134
+ // Metro can throw this error when the initial module id cannot be resolved.
135
+ if (!results.ok && txt.startsWith("<!DOCTYPE html>")) {
136
+ throw new ForwardHtmlError(`Metro failed to bundle the project. Check the console for more information.`, txt, results.status);
137
+ }
138
+ _log.Log.error("Failed to generate resources with Metro, the Metro config may not be using the correct serializer. Ensure the metro.config.js is extending the expo/metro-config and is not overriding the serializer.");
129
139
  throw error;
130
140
  }
131
141
  // NOTE: This could potentially need more validation in the future.
@@ -160,7 +170,7 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
160
170
  projectRoot: this.projectRoot
161
171
  });
162
172
  }
163
- async getStaticPageAsync(pathname, { mode , minify =mode !== "development" }) {
173
+ async getStaticPageAsync(pathname, { mode , minify =mode !== "development" , basePath }) {
164
174
  const devBundleUrlPathname = (0, _manifestMiddleware).createBundleUrlPath({
165
175
  platform: "web",
166
176
  mode,
@@ -189,7 +199,8 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
189
199
  mode,
190
200
  resources,
191
201
  template: staticHtml,
192
- devBundleUrl: devBundleUrlPathname
202
+ devBundleUrl: devBundleUrlPathname,
203
+ basePath
193
204
  });
194
205
  return {
195
206
  content,
@@ -232,17 +243,19 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
232
243
  };
233
244
  // Required for symbolication:
234
245
  process.env.EXPO_DEV_SERVER_ORIGIN = `http://localhost:${options.port}`;
235
- const { metro , server , middleware , messageSocket } = await (0, _instantiateMetro).instantiateMetroAsync(this, parsedOptions);
246
+ const { metro , server , middleware , messageSocket } = await (0, _instantiateMetro).instantiateMetroAsync(this, parsedOptions, {
247
+ isExporting: !!options.isExporting
248
+ });
236
249
  const manifestMiddleware = await this.getManifestMiddlewareAsync(options);
237
250
  // Important that we noop source maps for context modules as soon as possible.
238
- (0, _devServer).prependMiddleware(middleware, new _contextModuleSourceMapsMiddleware.ContextModuleSourceMapsMiddleware().getHandler());
251
+ (0, _mutations).prependMiddleware(middleware, new _contextModuleSourceMapsMiddleware.ContextModuleSourceMapsMiddleware().getHandler());
239
252
  // We need the manifest handler to be the first middleware to run so our
240
253
  // routes take precedence over static files. For example, the manifest is
241
254
  // served from '/' and if the user has an index.html file in their project
242
255
  // then the manifest handler will never run, the static middleware will run
243
256
  // and serve index.html instead of the manifest.
244
257
  // https://github.com/expo/expo/issues/13114
245
- (0, _devServer).prependMiddleware(middleware, manifestMiddleware.getHandler());
258
+ (0, _mutations).prependMiddleware(middleware, manifestMiddleware.getHandler());
246
259
  var _scheme;
247
260
  middleware.use(new _interstitialPageMiddleware.InterstitialPageMiddleware(this.projectRoot, {
248
261
  // TODO: Prevent this from becoming stale.
@@ -291,13 +304,20 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
291
304
  try {
292
305
  var _mode;
293
306
  const { content } = await this.getStaticPageAsync(req.url, {
294
- mode: (_mode = options.mode) != null ? _mode : "development"
307
+ mode: (_mode = options.mode) != null ? _mode : "development",
308
+ // Asset prefix is not supported in development.
309
+ basePath: ""
295
310
  });
296
311
  res.setHeader("Content-Type", "text/html");
297
312
  res.end(content);
298
- return;
299
313
  } catch (error) {
300
314
  res.setHeader("Content-Type", "text/html");
315
+ // Forward the Metro server response as-is. It won't be pretty, but at least it will be accurate.
316
+ if (error instanceof ForwardHtmlError) {
317
+ res.statusCode = error.statusCode;
318
+ res.end(error.html);
319
+ return;
320
+ }
301
321
  try {
302
322
  res.end(await this.renderStaticErrorAsync(error));
303
323
  } catch (staticError) {
@@ -382,8 +402,9 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
382
402
  });
383
403
  }
384
404
  async startTypeScriptServices() {
385
- (0, _startTypescriptTypeGeneration).startTypescriptTypeGenerationAsync({
386
- server: this.instance.server,
405
+ var ref;
406
+ return (0, _startTypescriptTypeGeneration).startTypescriptTypeGenerationAsync({
407
+ server: (ref = this.instance) == null ? void 0 : ref.server,
387
408
  metro: this.metro,
388
409
  projectRoot: this.projectRoot
389
410
  });
@@ -407,7 +428,7 @@ function getDeepLinkHandler(projectRoot) {
407
428
  });
408
429
  };
409
430
  }
410
- function htmlFromSerialAssets(assets, { dev , template , bundleUrl }) {
431
+ function htmlFromSerialAssets(assets, { dev , template , basePath , bundleUrl }) {
411
432
  // Combine the CSS modules into tags that have hot refresh data attributes.
412
433
  const styleString = assets.filter((asset)=>asset.type === "css"
413
434
  ).map(({ metadata , filename , source })=>{
@@ -415,15 +436,15 @@ function htmlFromSerialAssets(assets, { dev , template , bundleUrl }) {
415
436
  return `<style data-expo-css-hmr="${metadata.hmrId}">` + source + "\n</style>";
416
437
  } else {
417
438
  return [
418
- `<link rel="preload" href="/${filename}" as="style">`,
419
- `<link rel="stylesheet" href="/${filename}">`,
439
+ `<link rel="preload" href="${basePath}/${filename}" as="style">`,
440
+ `<link rel="stylesheet" href="${basePath}/${filename}">`,
420
441
  ].join("");
421
442
  }
422
443
  }).join("");
423
444
  const jsAssets = assets.filter((asset)=>asset.type === "js"
424
445
  );
425
446
  const scripts = bundleUrl ? `<script src="${bundleUrl}" defer></script>` : jsAssets.map(({ filename })=>{
426
- return `<script src="/${filename}" defer></script>`;
447
+ return `<script src="${basePath}/${filename}" defer></script>`;
427
448
  }).join("");
428
449
  return template.replace("</head>", `${styleString}</head>`).replace("</body>", `${scripts}\n</body>`);
429
450
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/server/metro/MetroBundlerDevServer.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 { getConfig } from '@expo/config';\nimport { prependMiddleware } from '@expo/dev-server';\nimport * as runtimeEnv from '@expo/env';\nimport { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport assert from 'assert';\nimport chalk from 'chalk';\nimport fetch from 'node-fetch';\nimport path from 'path';\n\nimport { Log } from '../../../log';\nimport getDevClientProperties from '../../../utils/analytics/getDevClientProperties';\nimport { logEventAsync } from '../../../utils/analytics/rudderstackClient';\nimport { getFreePortAsync } from '../../../utils/port';\nimport { BundlerDevServer, BundlerStartOptions, DevServerInstance } from '../BundlerDevServer';\nimport { getStaticRenderFunctions } from '../getStaticRenderFunctions';\nimport { ContextModuleSourceMapsMiddleware } from '../middleware/ContextModuleSourceMapsMiddleware';\nimport { CreateFileMiddleware } from '../middleware/CreateFileMiddleware';\nimport { FaviconMiddleware } from '../middleware/FaviconMiddleware';\nimport { HistoryFallbackMiddleware } from '../middleware/HistoryFallbackMiddleware';\nimport { InterstitialPageMiddleware } from '../middleware/InterstitialPageMiddleware';\nimport {\n createBundleUrlPath,\n resolveMainModuleName,\n shouldEnableAsyncImports,\n} from '../middleware/ManifestMiddleware';\nimport { ReactDevToolsPageMiddleware } from '../middleware/ReactDevToolsPageMiddleware';\nimport {\n DeepLinkHandler,\n RuntimeRedirectMiddleware,\n} from '../middleware/RuntimeRedirectMiddleware';\nimport { ServeStaticMiddleware } from '../middleware/ServeStaticMiddleware';\nimport { ServerNext, ServerRequest, ServerResponse } from '../middleware/server.types';\nimport { startTypescriptTypeGenerationAsync } from '../type-generation/startTypescriptTypeGeneration';\nimport { instantiateMetroAsync } from './instantiateMetro';\nimport { getErrorOverlayHtmlAsync } from './metroErrorInterface';\nimport { metroWatchTypeScriptFiles } from './metroWatchTypeScriptFiles';\nimport { observeFileChanges } from './waitForMetroToObserveTypeScriptFile';\n\nconst debug = require('debug')('expo:start:server:metro') as typeof console.log;\n\n/** Default port to use for apps running in Expo Go. */\nconst EXPO_GO_METRO_PORT = 8081;\n\n/** Default port to use for apps that run in standard React Native projects or Expo Dev Clients. */\nconst DEV_CLIENT_METRO_PORT = 8081;\n\nexport class MetroBundlerDevServer extends BundlerDevServer {\n private metro: import('metro').Server | null = null;\n\n get name(): string {\n return 'metro';\n }\n\n async resolvePortAsync(options: Partial<BundlerStartOptions> = {}): Promise<number> {\n const port =\n // If the manually defined port is busy then an error should be thrown...\n options.port ??\n // Otherwise use the default port based on the runtime target.\n (options.devClient\n ? // Don't check if the port is busy if we're using the dev client since most clients are hardcoded to 8081.\n Number(process.env.RCT_METRO_PORT) || DEV_CLIENT_METRO_PORT\n : // Otherwise (running in Expo Go) use a free port that falls back on the classic 8081 port.\n await getFreePortAsync(EXPO_GO_METRO_PORT));\n\n return port;\n }\n\n /** Get routes from Expo Router. */\n async getRoutesAsync() {\n const url = this.getDevServerUrl();\n assert(url, 'Dev server must be started');\n const { getManifest } = await getStaticRenderFunctions(this.projectRoot, url, {\n // Ensure the API Routes are included\n environment: 'node',\n });\n\n return getManifest({ fetchData: true });\n }\n\n async composeResourcesWithHtml({\n mode,\n resources,\n template,\n devBundleUrl,\n }: {\n mode: 'development' | 'production';\n resources: SerialAsset[];\n template: string;\n devBundleUrl?: string;\n }): Promise<string> {\n if (!resources) {\n return '';\n }\n const isDev = mode === 'development';\n return htmlFromSerialAssets(resources, {\n dev: isDev,\n template,\n bundleUrl: isDev ? devBundleUrl : undefined,\n });\n }\n\n async getStaticRenderFunctionAsync({\n mode,\n minify = mode !== 'development',\n }: {\n mode: 'development' | 'production';\n minify?: boolean;\n }) {\n const url = this.getDevServerUrl()!;\n\n const { getStaticContent } = await getStaticRenderFunctions(this.projectRoot, url, {\n minify,\n dev: mode !== 'production',\n // Ensure the API Routes are included\n environment: 'node',\n });\n return async (path: string) => {\n return await getStaticContent(new URL(path, url));\n };\n }\n\n async getStaticResourcesAsync({\n mode,\n minify = mode !== 'development',\n }: {\n mode: string;\n minify?: boolean;\n }): Promise<SerialAsset[]> {\n const devBundleUrlPathname = createBundleUrlPath({\n platform: 'web',\n mode,\n minify,\n environment: 'client',\n serializerOutput: 'static',\n mainModuleName: resolveMainModuleName(this.projectRoot, getConfig(this.projectRoot), 'web'),\n lazy: shouldEnableAsyncImports(this.projectRoot),\n });\n\n const bundleUrl = new URL(devBundleUrlPathname, this.getDevServerUrl()!);\n\n // Fetch the generated HTML from our custom Metro serializer\n const results = await fetch(bundleUrl.toString());\n\n const txt = await results.text();\n\n let data: any;\n try {\n data = JSON.parse(txt);\n } catch (error: any) {\n Log.error(\n 'Failed to generate resources with Metro, the Metro config may not be using the correct serializer. Ensure the metro.config.js is extending the expo/metro-config and is not overriding the serializer.'\n );\n debug(txt);\n throw error;\n }\n\n // NOTE: This could potentially need more validation in the future.\n if (Array.isArray(data)) {\n return data;\n }\n\n if (data != null && (data.errors || data.type?.match(/.*Error$/))) {\n // {\n // type: 'InternalError',\n // errors: [],\n // message: 'Metro has encountered an error: While trying to resolve module `stylis` from file `/Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js`, the package `/Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/dist/stylis.mjs`. Indeed, none of these files exist:\\n' +\n // '\\n' +\n // ' * /Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/dist/stylis.mjs(.web.ts|.ts|.web.tsx|.tsx|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css)\\n' +\n // ' * /Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/dist/stylis.mjs/index(.web.ts|.ts|.web.tsx|.tsx|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css): /Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/metro/src/node-haste/DependencyGraph.js (289:17)\\n' +\n // '\\n' +\n // '\\x1B[0m \\x1B[90m 287 |\\x1B[39m }\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 288 |\\x1B[39m \\x1B[36mif\\x1B[39m (error \\x1B[36minstanceof\\x1B[39m \\x1B[33mInvalidPackageError\\x1B[39m) {\\x1B[0m\\n' +\n // '\\x1B[0m\\x1B[31m\\x1B[1m>\\x1B[22m\\x1B[39m\\x1B[90m 289 |\\x1B[39m \\x1B[36mthrow\\x1B[39m \\x1B[36mnew\\x1B[39m \\x1B[33mPackageResolutionError\\x1B[39m({\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m |\\x1B[39m \\x1B[31m\\x1B[1m^\\x1B[22m\\x1B[39m\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 290 |\\x1B[39m packageError\\x1B[33m:\\x1B[39m error\\x1B[33m,\\x1B[39m\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 291 |\\x1B[39m originModulePath\\x1B[33m:\\x1B[39m \\x1B[36mfrom\\x1B[39m\\x1B[33m,\\x1B[39m\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 292 |\\x1B[39m targetModuleName\\x1B[33m:\\x1B[39m to\\x1B[33m,\\x1B[39m\\x1B[0m'\n // }\n // The Metro logger already showed this error.\n throw new Error(data.message);\n }\n\n throw new Error(\n 'Invalid resources returned from the Metro serializer. Expected array, found: ' + data\n );\n }\n\n private async renderStaticErrorAsync(error: Error) {\n return getErrorOverlayHtmlAsync({\n error,\n projectRoot: this.projectRoot,\n });\n }\n\n async getStaticPageAsync(\n pathname: string,\n {\n mode,\n minify = mode !== 'development',\n }: {\n mode: 'development' | 'production';\n minify?: boolean;\n }\n ) {\n const devBundleUrlPathname = createBundleUrlPath({\n platform: 'web',\n mode,\n environment: 'client',\n mainModuleName: resolveMainModuleName(this.projectRoot, getConfig(this.projectRoot), 'web'),\n lazy: shouldEnableAsyncImports(this.projectRoot),\n });\n\n const bundleStaticHtml = async (): Promise<string> => {\n const { getStaticContent } = await getStaticRenderFunctions(\n this.projectRoot,\n this.getDevServerUrl()!,\n {\n minify: false,\n dev: mode !== 'production',\n // Ensure the API Routes are included\n environment: 'node',\n }\n );\n\n const location = new URL(pathname, this.getDevServerUrl()!);\n return await getStaticContent(location);\n };\n\n const [resources, staticHtml] = await Promise.all([\n this.getStaticResourcesAsync({ mode, minify }),\n bundleStaticHtml(),\n ]);\n const content = await this.composeResourcesWithHtml({\n mode,\n resources,\n template: staticHtml,\n devBundleUrl: devBundleUrlPathname,\n });\n return {\n content,\n resources,\n };\n }\n\n async watchEnvironmentVariables() {\n if (!this.instance) {\n throw new Error(\n 'Cannot observe environment variable changes without a running Metro instance.'\n );\n }\n if (!this.metro) {\n // This can happen when the run command is used and the server is already running in another\n // process.\n debug('Skipping Environment Variable observation because Metro is not running (headless).');\n return;\n }\n\n const envFiles = runtimeEnv\n .getFiles(process.env.NODE_ENV)\n .map((fileName) => path.join(this.projectRoot, fileName));\n\n observeFileChanges(\n {\n metro: this.metro,\n server: this.instance.server,\n },\n envFiles,\n () => {\n debug('Reloading environment variables...');\n // Force reload the environment variables.\n runtimeEnv.load(this.projectRoot, { force: true });\n }\n );\n }\n\n protected async startImplementationAsync(\n options: BundlerStartOptions\n ): Promise<DevServerInstance> {\n options.port = await this.resolvePortAsync(options);\n this.urlCreator = this.getUrlCreator(options);\n\n const parsedOptions = {\n port: options.port,\n maxWorkers: options.maxWorkers,\n resetCache: options.resetDevServer,\n\n // Use the unversioned metro config.\n // TODO: Deprecate this property when expo-cli goes away.\n unversioned: false,\n };\n\n // Required for symbolication:\n process.env.EXPO_DEV_SERVER_ORIGIN = `http://localhost:${options.port}`;\n\n const { metro, server, middleware, messageSocket } = await instantiateMetroAsync(\n this,\n parsedOptions\n );\n\n const manifestMiddleware = await this.getManifestMiddlewareAsync(options);\n\n // Important that we noop source maps for context modules as soon as possible.\n prependMiddleware(middleware, new ContextModuleSourceMapsMiddleware().getHandler());\n\n // We need the manifest handler to be the first middleware to run so our\n // routes take precedence over static files. For example, the manifest is\n // served from '/' and if the user has an index.html file in their project\n // then the manifest handler will never run, the static middleware will run\n // and serve index.html instead of the manifest.\n // https://github.com/expo/expo/issues/13114\n prependMiddleware(middleware, manifestMiddleware.getHandler());\n\n middleware.use(\n new InterstitialPageMiddleware(this.projectRoot, {\n // TODO: Prevent this from becoming stale.\n scheme: options.location.scheme ?? null,\n }).getHandler()\n );\n middleware.use(new ReactDevToolsPageMiddleware(this.projectRoot).getHandler());\n\n const deepLinkMiddleware = new RuntimeRedirectMiddleware(this.projectRoot, {\n onDeepLink: getDeepLinkHandler(this.projectRoot),\n getLocation: ({ runtime }) => {\n if (runtime === 'custom') {\n return this.urlCreator?.constructDevClientUrl();\n } else {\n return this.urlCreator?.constructUrl({\n scheme: 'exp',\n });\n }\n },\n });\n middleware.use(deepLinkMiddleware.getHandler());\n\n middleware.use(new CreateFileMiddleware(this.projectRoot).getHandler());\n\n // Append support for redirecting unhandled requests to the index.html page on web.\n if (this.isTargetingWeb()) {\n const { exp } = getConfig(this.projectRoot, { skipSDKVersionRequirement: true });\n const useWebSSG = exp.web?.output === 'static';\n\n // This MUST be after the manifest middleware so it doesn't have a chance to serve the template `public/index.html`.\n middleware.use(new ServeStaticMiddleware(this.projectRoot).getHandler());\n\n // This should come after the static middleware so it doesn't serve the favicon from `public/favicon.ico`.\n middleware.use(new FaviconMiddleware(this.projectRoot).getHandler());\n\n if (useWebSSG) {\n middleware.use(async (req: ServerRequest, res: ServerResponse, next: ServerNext) => {\n if (!req?.url) {\n return next();\n }\n\n // TODO: Formal manifest for allowed paths\n if (req.url.endsWith('.ico')) {\n return next();\n }\n if (req.url.includes('serializer.output=static')) {\n return next();\n }\n\n try {\n const { content } = await this.getStaticPageAsync(req.url, {\n mode: options.mode ?? 'development',\n });\n\n res.setHeader('Content-Type', 'text/html');\n res.end(content);\n return;\n } catch (error: any) {\n res.setHeader('Content-Type', 'text/html');\n try {\n res.end(await this.renderStaticErrorAsync(error));\n } catch (staticError: any) {\n // Fallback error for when Expo Router is misconfigured in the project.\n res.end(\n '<span><h3>Internal Error:</h3><b>Project is not setup correctly for static rendering (check terminal for more info):</b><br/>' +\n error.message +\n '<br/><br/>' +\n staticError.message +\n '</span>'\n );\n }\n }\n });\n }\n\n // This MUST run last since it's the fallback.\n if (!useWebSSG) {\n middleware.use(\n new HistoryFallbackMiddleware(manifestMiddleware.getHandler().internal).getHandler()\n );\n }\n }\n // Extend the close method to ensure that we clean up the local info.\n const originalClose = server.close.bind(server);\n\n server.close = (callback?: (err?: Error) => void) => {\n return originalClose((err?: Error) => {\n this.instance = null;\n this.metro = null;\n callback?.(err);\n });\n };\n\n this.metro = metro;\n return {\n server,\n location: {\n // The port is the main thing we want to send back.\n port: options.port,\n // localhost isn't always correct.\n host: 'localhost',\n // http is the only supported protocol on native.\n url: `http://localhost:${options.port}`,\n protocol: 'http',\n },\n middleware,\n messageSocket,\n };\n }\n\n public async waitForTypeScriptAsync(): Promise<boolean> {\n if (!this.instance) {\n throw new Error('Cannot wait for TypeScript without a running server.');\n }\n\n return new Promise<boolean>((resolve) => {\n if (!this.metro) {\n // This can happen when the run command is used and the server is already running in another\n // process. In this case we can't wait for the TypeScript check to complete because we don't\n // have access to the Metro server.\n debug('Skipping TypeScript check because Metro is not running (headless).');\n return resolve(false);\n }\n\n const off = metroWatchTypeScriptFiles({\n projectRoot: this.projectRoot,\n server: this.instance!.server,\n metro: this.metro,\n tsconfig: true,\n throttle: true,\n eventTypes: ['change', 'add'],\n callback: async () => {\n // Run once, this prevents the TypeScript project prerequisite from running on every file change.\n off();\n const { TypeScriptProjectPrerequisite } = await import(\n '../../doctor/typescript/TypeScriptProjectPrerequisite'\n );\n\n try {\n const req = new TypeScriptProjectPrerequisite(this.projectRoot);\n await req.bootstrapAsync();\n resolve(true);\n } catch (error: any) {\n // Ensure the process doesn't fail if the TypeScript check fails.\n // This could happen during the install.\n Log.log();\n Log.error(\n chalk.red`Failed to automatically setup TypeScript for your project. Try restarting the dev server to fix.`\n );\n Log.exception(error);\n resolve(false);\n }\n },\n });\n });\n }\n\n public async startTypeScriptServices() {\n startTypescriptTypeGenerationAsync({\n server: this.instance!.server,\n metro: this.metro,\n projectRoot: this.projectRoot,\n });\n }\n\n protected getConfigModuleIds(): string[] {\n return ['./metro.config.js', './metro.config.json', './rn-cli.config.js'];\n }\n}\n\nexport function getDeepLinkHandler(projectRoot: string): DeepLinkHandler {\n return async ({ runtime }) => {\n if (runtime === 'expo') return;\n const { exp } = getConfig(projectRoot);\n await logEventAsync('dev client start command', {\n status: 'started',\n ...getDevClientProperties(projectRoot, exp),\n });\n };\n}\n\nfunction htmlFromSerialAssets(\n assets: SerialAsset[],\n { dev, template, bundleUrl }: { dev: boolean; template: string; bundleUrl?: string }\n) {\n // Combine the CSS modules into tags that have hot refresh data attributes.\n const styleString = assets\n .filter((asset) => asset.type === 'css')\n .map(({ metadata, filename, source }) => {\n if (dev) {\n return `<style data-expo-css-hmr=\"${metadata.hmrId}\">` + source + '\\n</style>';\n } else {\n return [\n `<link rel=\"preload\" href=\"/${filename}\" as=\"style\">`,\n `<link rel=\"stylesheet\" href=\"/${filename}\">`,\n ].join('');\n }\n })\n .join('');\n\n const jsAssets = assets.filter((asset) => asset.type === 'js');\n\n const scripts = bundleUrl\n ? `<script src=\"${bundleUrl}\" defer></script>`\n : jsAssets\n .map(({ filename }) => {\n return `<script src=\"/${filename}\" defer></script>`;\n })\n .join('');\n\n return template\n .replace('</head>', `${styleString}</head>`)\n .replace('</body>', `${scripts}\\n</body>`);\n}\n"],"names":["getDeepLinkHandler","runtimeEnv","debug","require","EXPO_GO_METRO_PORT","DEV_CLIENT_METRO_PORT","MetroBundlerDevServer","BundlerDevServer","metro","name","resolvePortAsync","options","port","devClient","Number","process","env","RCT_METRO_PORT","getFreePortAsync","getRoutesAsync","url","getDevServerUrl","assert","getManifest","getStaticRenderFunctions","projectRoot","environment","fetchData","composeResourcesWithHtml","mode","resources","template","devBundleUrl","isDev","htmlFromSerialAssets","dev","bundleUrl","undefined","getStaticRenderFunctionAsync","minify","getStaticContent","path","URL","getStaticResourcesAsync","data","devBundleUrlPathname","createBundleUrlPath","platform","serializerOutput","mainModuleName","resolveMainModuleName","getConfig","lazy","shouldEnableAsyncImports","results","fetch","toString","txt","text","JSON","parse","error","Log","Array","isArray","errors","type","match","Error","message","renderStaticErrorAsync","getErrorOverlayHtmlAsync","getStaticPageAsync","pathname","bundleStaticHtml","location","staticHtml","Promise","all","content","watchEnvironmentVariables","instance","envFiles","getFiles","NODE_ENV","map","fileName","join","observeFileChanges","server","load","force","startImplementationAsync","urlCreator","getUrlCreator","parsedOptions","maxWorkers","resetCache","resetDevServer","unversioned","EXPO_DEV_SERVER_ORIGIN","middleware","messageSocket","instantiateMetroAsync","manifestMiddleware","getManifestMiddlewareAsync","prependMiddleware","ContextModuleSourceMapsMiddleware","getHandler","use","InterstitialPageMiddleware","scheme","ReactDevToolsPageMiddleware","deepLinkMiddleware","RuntimeRedirectMiddleware","onDeepLink","getLocation","runtime","constructDevClientUrl","constructUrl","CreateFileMiddleware","isTargetingWeb","exp","skipSDKVersionRequirement","useWebSSG","web","output","ServeStaticMiddleware","FaviconMiddleware","req","res","next","endsWith","includes","setHeader","end","staticError","HistoryFallbackMiddleware","internal","originalClose","close","bind","callback","err","host","protocol","waitForTypeScriptAsync","resolve","off","metroWatchTypeScriptFiles","tsconfig","throttle","eventTypes","TypeScriptProjectPrerequisite","bootstrapAsync","log","chalk","red","exception","startTypeScriptServices","startTypescriptTypeGenerationAsync","getConfigModuleIds","logEventAsync","status","getDevClientProperties","assets","styleString","filter","asset","metadata","filename","source","hmrId","jsAssets","scripts","replace"],"mappings":"AAMA;;;;QAkegBA,kBAAkB,GAAlBA,kBAAkB;AAleR,IAAA,OAAc,WAAd,cAAc,CAAA;AACN,IAAA,UAAkB,WAAlB,kBAAkB,CAAA;AACxCC,IAAAA,UAAU,mCAAM,WAAW,EAAjB;AAEH,IAAA,OAAQ,kCAAR,QAAQ,EAA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,CAAC,AAAC;IAEhB,OAAOxD,QAAQ,CACZgJ,OAAO,CAAC,SAAS,EAAE,CAAC,EAAET,WAAW,CAAC,OAAO,CAAC,CAAC,CAC3CS,OAAO,CAAC,SAAS,EAAE,CAAC,EAAED,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;CAC9C"}
1
+ {"version":3,"sources":["../../../../../src/start/server/metro/MetroBundlerDevServer.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 { getConfig } from '@expo/config';\nimport * as runtimeEnv from '@expo/env';\nimport { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport chalk from 'chalk';\nimport fetch from 'node-fetch';\nimport path from 'path';\n\nimport { instantiateMetroAsync } from './instantiateMetro';\nimport { getErrorOverlayHtmlAsync } from './metroErrorInterface';\nimport { metroWatchTypeScriptFiles } from './metroWatchTypeScriptFiles';\nimport { observeFileChanges } from './waitForMetroToObserveTypeScriptFile';\nimport { Log } from '../../../log';\nimport getDevClientProperties from '../../../utils/analytics/getDevClientProperties';\nimport { logEventAsync } from '../../../utils/analytics/rudderstackClient';\nimport { CommandError } from '../../../utils/errors';\nimport { getFreePortAsync } from '../../../utils/port';\nimport { BundlerDevServer, BundlerStartOptions, DevServerInstance } from '../BundlerDevServer';\nimport { getStaticRenderFunctions } from '../getStaticRenderFunctions';\nimport { ContextModuleSourceMapsMiddleware } from '../middleware/ContextModuleSourceMapsMiddleware';\nimport { CreateFileMiddleware } from '../middleware/CreateFileMiddleware';\nimport { FaviconMiddleware } from '../middleware/FaviconMiddleware';\nimport { HistoryFallbackMiddleware } from '../middleware/HistoryFallbackMiddleware';\nimport { InterstitialPageMiddleware } from '../middleware/InterstitialPageMiddleware';\nimport {\n createBundleUrlPath,\n resolveMainModuleName,\n shouldEnableAsyncImports,\n} from '../middleware/ManifestMiddleware';\nimport { ReactDevToolsPageMiddleware } from '../middleware/ReactDevToolsPageMiddleware';\nimport {\n DeepLinkHandler,\n RuntimeRedirectMiddleware,\n} from '../middleware/RuntimeRedirectMiddleware';\nimport { ServeStaticMiddleware } from '../middleware/ServeStaticMiddleware';\nimport { prependMiddleware } from '../middleware/mutations';\nimport { ServerNext, ServerRequest, ServerResponse } from '../middleware/server.types';\nimport { startTypescriptTypeGenerationAsync } from '../type-generation/startTypescriptTypeGeneration';\n\nclass ForwardHtmlError extends CommandError {\n constructor(\n message: string,\n public html: string,\n public statusCode: number\n ) {\n super(message);\n }\n}\n\nconst debug = require('debug')('expo:start:server:metro') as typeof console.log;\n\n/** Default port to use for apps running in Expo Go. */\nconst EXPO_GO_METRO_PORT = 8081;\n\n/** Default port to use for apps that run in standard React Native projects or Expo Dev Clients. */\nconst DEV_CLIENT_METRO_PORT = 8081;\n\nexport class MetroBundlerDevServer extends BundlerDevServer {\n private metro: import('metro').Server | null = null;\n\n get name(): string {\n return 'metro';\n }\n\n async resolvePortAsync(options: Partial<BundlerStartOptions> = {}): Promise<number> {\n const port =\n // If the manually defined port is busy then an error should be thrown...\n options.port ??\n // Otherwise use the default port based on the runtime target.\n (options.devClient\n ? // Don't check if the port is busy if we're using the dev client since most clients are hardcoded to 8081.\n Number(process.env.RCT_METRO_PORT) || DEV_CLIENT_METRO_PORT\n : // Otherwise (running in Expo Go) use a free port that falls back on the classic 8081 port.\n await getFreePortAsync(EXPO_GO_METRO_PORT));\n\n return port;\n }\n\n async composeResourcesWithHtml({\n mode,\n resources,\n template,\n devBundleUrl,\n basePath,\n }: {\n mode: 'development' | 'production';\n resources: SerialAsset[];\n template: string;\n /** asset prefix used for deploying to non-standard origins like GitHub pages. */\n basePath: string;\n devBundleUrl?: string;\n }): Promise<string> {\n if (!resources) {\n return '';\n }\n const isDev = mode === 'development';\n return htmlFromSerialAssets(resources, {\n dev: isDev,\n template,\n basePath,\n bundleUrl: isDev ? devBundleUrl : undefined,\n });\n }\n\n async getStaticRenderFunctionAsync({\n mode,\n minify = mode !== 'development',\n }: {\n mode: 'development' | 'production';\n minify?: boolean;\n }) {\n const url = this.getDevServerUrl()!;\n\n const { getStaticContent, getManifest } = await getStaticRenderFunctions(\n this.projectRoot,\n url,\n {\n minify,\n dev: mode !== 'production',\n // Ensure the API Routes are included\n environment: 'node',\n }\n );\n return {\n // Get routes from Expo Router.\n manifest: await getManifest({ fetchData: true }),\n // Get route generating function\n async renderAsync(path: string) {\n return await getStaticContent(new URL(path, url));\n },\n };\n }\n\n async getStaticResourcesAsync({\n mode,\n minify = mode !== 'development',\n includeMaps,\n }: {\n mode: string;\n minify?: boolean;\n includeMaps?: boolean;\n }): Promise<SerialAsset[]> {\n const devBundleUrlPathname = createBundleUrlPath({\n platform: 'web',\n mode,\n minify,\n environment: 'client',\n serializerOutput: 'static',\n serializerIncludeMaps: includeMaps,\n mainModuleName: resolveMainModuleName(this.projectRoot, getConfig(this.projectRoot), 'web'),\n lazy: shouldEnableAsyncImports(this.projectRoot),\n });\n\n const bundleUrl = new URL(devBundleUrlPathname, this.getDevServerUrl()!);\n\n // Fetch the generated HTML from our custom Metro serializer\n const results = await fetch(bundleUrl.toString());\n\n const txt = await results.text();\n\n // console.log('STAT:', results.status, results.statusText);\n let data: any;\n try {\n data = JSON.parse(txt);\n } catch (error: any) {\n debug(txt);\n\n // Metro can throw this error when the initial module id cannot be resolved.\n if (!results.ok && txt.startsWith('<!DOCTYPE html>')) {\n throw new ForwardHtmlError(\n `Metro failed to bundle the project. Check the console for more information.`,\n txt,\n results.status\n );\n }\n\n Log.error(\n 'Failed to generate resources with Metro, the Metro config may not be using the correct serializer. Ensure the metro.config.js is extending the expo/metro-config and is not overriding the serializer.'\n );\n throw error;\n }\n\n // NOTE: This could potentially need more validation in the future.\n if (Array.isArray(data)) {\n return data;\n }\n\n if (data != null && (data.errors || data.type?.match(/.*Error$/))) {\n // {\n // type: 'InternalError',\n // errors: [],\n // message: 'Metro has encountered an error: While trying to resolve module `stylis` from file `/Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js`, the package `/Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/dist/stylis.mjs`. Indeed, none of these files exist:\\n' +\n // '\\n' +\n // ' * /Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/dist/stylis.mjs(.web.ts|.ts|.web.tsx|.tsx|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css)\\n' +\n // ' * /Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/dist/stylis.mjs/index(.web.ts|.ts|.web.tsx|.tsx|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css): /Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/metro/src/node-haste/DependencyGraph.js (289:17)\\n' +\n // '\\n' +\n // '\\x1B[0m \\x1B[90m 287 |\\x1B[39m }\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 288 |\\x1B[39m \\x1B[36mif\\x1B[39m (error \\x1B[36minstanceof\\x1B[39m \\x1B[33mInvalidPackageError\\x1B[39m) {\\x1B[0m\\n' +\n // '\\x1B[0m\\x1B[31m\\x1B[1m>\\x1B[22m\\x1B[39m\\x1B[90m 289 |\\x1B[39m \\x1B[36mthrow\\x1B[39m \\x1B[36mnew\\x1B[39m \\x1B[33mPackageResolutionError\\x1B[39m({\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m |\\x1B[39m \\x1B[31m\\x1B[1m^\\x1B[22m\\x1B[39m\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 290 |\\x1B[39m packageError\\x1B[33m:\\x1B[39m error\\x1B[33m,\\x1B[39m\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 291 |\\x1B[39m originModulePath\\x1B[33m:\\x1B[39m \\x1B[36mfrom\\x1B[39m\\x1B[33m,\\x1B[39m\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 292 |\\x1B[39m targetModuleName\\x1B[33m:\\x1B[39m to\\x1B[33m,\\x1B[39m\\x1B[0m'\n // }\n // The Metro logger already showed this error.\n throw new Error(data.message);\n }\n\n throw new Error(\n 'Invalid resources returned from the Metro serializer. Expected array, found: ' + data\n );\n }\n\n private async renderStaticErrorAsync(error: Error) {\n return getErrorOverlayHtmlAsync({\n error,\n projectRoot: this.projectRoot,\n });\n }\n\n async getStaticPageAsync(\n pathname: string,\n {\n mode,\n minify = mode !== 'development',\n basePath,\n }: {\n mode: 'development' | 'production';\n minify?: boolean;\n basePath: string;\n }\n ) {\n const devBundleUrlPathname = createBundleUrlPath({\n platform: 'web',\n mode,\n environment: 'client',\n mainModuleName: resolveMainModuleName(this.projectRoot, getConfig(this.projectRoot), 'web'),\n lazy: shouldEnableAsyncImports(this.projectRoot),\n });\n\n const bundleStaticHtml = async (): Promise<string> => {\n const { getStaticContent } = await getStaticRenderFunctions(\n this.projectRoot,\n this.getDevServerUrl()!,\n {\n minify: false,\n dev: mode !== 'production',\n // Ensure the API Routes are included\n environment: 'node',\n }\n );\n\n const location = new URL(pathname, this.getDevServerUrl()!);\n return await getStaticContent(location);\n };\n\n const [resources, staticHtml] = await Promise.all([\n this.getStaticResourcesAsync({ mode, minify }),\n bundleStaticHtml(),\n ]);\n const content = await this.composeResourcesWithHtml({\n mode,\n resources,\n template: staticHtml,\n devBundleUrl: devBundleUrlPathname,\n basePath,\n });\n return {\n content,\n resources,\n };\n }\n\n async watchEnvironmentVariables() {\n if (!this.instance) {\n throw new Error(\n 'Cannot observe environment variable changes without a running Metro instance.'\n );\n }\n if (!this.metro) {\n // This can happen when the run command is used and the server is already running in another\n // process.\n debug('Skipping Environment Variable observation because Metro is not running (headless).');\n return;\n }\n\n const envFiles = runtimeEnv\n .getFiles(process.env.NODE_ENV)\n .map((fileName) => path.join(this.projectRoot, fileName));\n\n observeFileChanges(\n {\n metro: this.metro,\n server: this.instance.server,\n },\n envFiles,\n () => {\n debug('Reloading environment variables...');\n // Force reload the environment variables.\n runtimeEnv.load(this.projectRoot, { force: true });\n }\n );\n }\n\n protected async startImplementationAsync(\n options: BundlerStartOptions\n ): Promise<DevServerInstance> {\n options.port = await this.resolvePortAsync(options);\n this.urlCreator = this.getUrlCreator(options);\n\n const parsedOptions = {\n port: options.port,\n maxWorkers: options.maxWorkers,\n resetCache: options.resetDevServer,\n\n // Use the unversioned metro config.\n // TODO: Deprecate this property when expo-cli goes away.\n unversioned: false,\n };\n\n // Required for symbolication:\n process.env.EXPO_DEV_SERVER_ORIGIN = `http://localhost:${options.port}`;\n\n const { metro, server, middleware, messageSocket } = await instantiateMetroAsync(\n this,\n parsedOptions,\n {\n isExporting: !!options.isExporting,\n }\n );\n\n const manifestMiddleware = await this.getManifestMiddlewareAsync(options);\n\n // Important that we noop source maps for context modules as soon as possible.\n prependMiddleware(middleware, new ContextModuleSourceMapsMiddleware().getHandler());\n\n // We need the manifest handler to be the first middleware to run so our\n // routes take precedence over static files. For example, the manifest is\n // served from '/' and if the user has an index.html file in their project\n // then the manifest handler will never run, the static middleware will run\n // and serve index.html instead of the manifest.\n // https://github.com/expo/expo/issues/13114\n prependMiddleware(middleware, manifestMiddleware.getHandler());\n\n middleware.use(\n new InterstitialPageMiddleware(this.projectRoot, {\n // TODO: Prevent this from becoming stale.\n scheme: options.location.scheme ?? null,\n }).getHandler()\n );\n middleware.use(new ReactDevToolsPageMiddleware(this.projectRoot).getHandler());\n\n const deepLinkMiddleware = new RuntimeRedirectMiddleware(this.projectRoot, {\n onDeepLink: getDeepLinkHandler(this.projectRoot),\n getLocation: ({ runtime }) => {\n if (runtime === 'custom') {\n return this.urlCreator?.constructDevClientUrl();\n } else {\n return this.urlCreator?.constructUrl({\n scheme: 'exp',\n });\n }\n },\n });\n middleware.use(deepLinkMiddleware.getHandler());\n\n middleware.use(new CreateFileMiddleware(this.projectRoot).getHandler());\n\n // Append support for redirecting unhandled requests to the index.html page on web.\n if (this.isTargetingWeb()) {\n const { exp } = getConfig(this.projectRoot, { skipSDKVersionRequirement: true });\n const useWebSSG = exp.web?.output === 'static';\n\n // This MUST be after the manifest middleware so it doesn't have a chance to serve the template `public/index.html`.\n middleware.use(new ServeStaticMiddleware(this.projectRoot).getHandler());\n\n // This should come after the static middleware so it doesn't serve the favicon from `public/favicon.ico`.\n middleware.use(new FaviconMiddleware(this.projectRoot).getHandler());\n\n if (useWebSSG) {\n middleware.use(async (req: ServerRequest, res: ServerResponse, next: ServerNext) => {\n if (!req?.url) {\n return next();\n }\n\n // TODO: Formal manifest for allowed paths\n if (req.url.endsWith('.ico')) {\n return next();\n }\n if (req.url.includes('serializer.output=static')) {\n return next();\n }\n\n try {\n const { content } = await this.getStaticPageAsync(req.url, {\n mode: options.mode ?? 'development',\n // Asset prefix is not supported in development.\n basePath: '',\n });\n\n res.setHeader('Content-Type', 'text/html');\n res.end(content);\n } catch (error: any) {\n res.setHeader('Content-Type', 'text/html');\n // Forward the Metro server response as-is. It won't be pretty, but at least it will be accurate.\n if (error instanceof ForwardHtmlError) {\n res.statusCode = error.statusCode;\n res.end(error.html);\n return;\n }\n try {\n res.end(await this.renderStaticErrorAsync(error));\n } catch (staticError: any) {\n // Fallback error for when Expo Router is misconfigured in the project.\n res.end(\n '<span><h3>Internal Error:</h3><b>Project is not setup correctly for static rendering (check terminal for more info):</b><br/>' +\n error.message +\n '<br/><br/>' +\n staticError.message +\n '</span>'\n );\n }\n }\n });\n }\n\n // This MUST run last since it's the fallback.\n if (!useWebSSG) {\n middleware.use(\n new HistoryFallbackMiddleware(manifestMiddleware.getHandler().internal).getHandler()\n );\n }\n }\n // Extend the close method to ensure that we clean up the local info.\n const originalClose = server.close.bind(server);\n\n server.close = (callback?: (err?: Error) => void) => {\n return originalClose((err?: Error) => {\n this.instance = null;\n this.metro = null;\n callback?.(err);\n });\n };\n\n this.metro = metro;\n return {\n server,\n location: {\n // The port is the main thing we want to send back.\n port: options.port,\n // localhost isn't always correct.\n host: 'localhost',\n // http is the only supported protocol on native.\n url: `http://localhost:${options.port}`,\n protocol: 'http',\n },\n middleware,\n messageSocket,\n };\n }\n\n public async waitForTypeScriptAsync(): Promise<boolean> {\n if (!this.instance) {\n throw new Error('Cannot wait for TypeScript without a running server.');\n }\n\n return new Promise<boolean>((resolve) => {\n if (!this.metro) {\n // This can happen when the run command is used and the server is already running in another\n // process. In this case we can't wait for the TypeScript check to complete because we don't\n // have access to the Metro server.\n debug('Skipping TypeScript check because Metro is not running (headless).');\n return resolve(false);\n }\n\n const off = metroWatchTypeScriptFiles({\n projectRoot: this.projectRoot,\n server: this.instance!.server,\n metro: this.metro,\n tsconfig: true,\n throttle: true,\n eventTypes: ['change', 'add'],\n callback: async () => {\n // Run once, this prevents the TypeScript project prerequisite from running on every file change.\n off();\n const { TypeScriptProjectPrerequisite } = await import(\n '../../doctor/typescript/TypeScriptProjectPrerequisite'\n );\n\n try {\n const req = new TypeScriptProjectPrerequisite(this.projectRoot);\n await req.bootstrapAsync();\n resolve(true);\n } catch (error: any) {\n // Ensure the process doesn't fail if the TypeScript check fails.\n // This could happen during the install.\n Log.log();\n Log.error(\n chalk.red`Failed to automatically setup TypeScript for your project. Try restarting the dev server to fix.`\n );\n Log.exception(error);\n resolve(false);\n }\n },\n });\n });\n }\n\n public async startTypeScriptServices() {\n return startTypescriptTypeGenerationAsync({\n server: this.instance?.server,\n metro: this.metro,\n projectRoot: this.projectRoot,\n });\n }\n\n protected getConfigModuleIds(): string[] {\n return ['./metro.config.js', './metro.config.json', './rn-cli.config.js'];\n }\n}\n\nexport function getDeepLinkHandler(projectRoot: string): DeepLinkHandler {\n return async ({ runtime }) => {\n if (runtime === 'expo') return;\n const { exp } = getConfig(projectRoot);\n await logEventAsync('dev client start command', {\n status: 'started',\n ...getDevClientProperties(projectRoot, exp),\n });\n };\n}\n\nfunction htmlFromSerialAssets(\n assets: SerialAsset[],\n {\n dev,\n template,\n basePath,\n bundleUrl,\n }: {\n dev: boolean;\n template: string;\n basePath: string;\n /** This is dev-only. */\n bundleUrl?: string;\n }\n) {\n // Combine the CSS modules into tags that have hot refresh data attributes.\n const styleString = assets\n .filter((asset) => asset.type === 'css')\n .map(({ metadata, filename, source }) => {\n if (dev) {\n return `<style data-expo-css-hmr=\"${metadata.hmrId}\">` + source + '\\n</style>';\n } else {\n return [\n `<link rel=\"preload\" href=\"${basePath}/${filename}\" as=\"style\">`,\n `<link rel=\"stylesheet\" href=\"${basePath}/${filename}\">`,\n ].join('');\n }\n })\n .join('');\n\n const jsAssets = assets.filter((asset) => asset.type === 'js');\n\n const scripts = bundleUrl\n ? `<script src=\"${bundleUrl}\" defer></script>`\n : jsAssets\n .map(({ filename }) => {\n return `<script src=\"${basePath}/${filename}\" defer></script>`;\n })\n .join('');\n\n return template\n .replace('</head>', `${styleString}</head>`)\n .replace('</body>', `${scripts}\\n</body>`);\n}\n"],"names":["getDeepLinkHandler","runtimeEnv","ForwardHtmlError","CommandError","constructor","message","html","statusCode","debug","require","EXPO_GO_METRO_PORT","DEV_CLIENT_METRO_PORT","MetroBundlerDevServer","BundlerDevServer","metro","name","resolvePortAsync","options","port","devClient","Number","process","env","RCT_METRO_PORT","getFreePortAsync","composeResourcesWithHtml","mode","resources","template","devBundleUrl","basePath","isDev","htmlFromSerialAssets","dev","bundleUrl","undefined","getStaticRenderFunctionAsync","minify","url","getDevServerUrl","getStaticContent","getManifest","getStaticRenderFunctions","projectRoot","environment","manifest","fetchData","renderAsync","path","URL","getStaticResourcesAsync","includeMaps","data","devBundleUrlPathname","createBundleUrlPath","platform","serializerOutput","serializerIncludeMaps","mainModuleName","resolveMainModuleName","getConfig","lazy","shouldEnableAsyncImports","results","fetch","toString","txt","text","JSON","parse","error","ok","startsWith","status","Log","Array","isArray","errors","type","match","Error","renderStaticErrorAsync","getErrorOverlayHtmlAsync","getStaticPageAsync","pathname","bundleStaticHtml","location","staticHtml","Promise","all","content","watchEnvironmentVariables","instance","envFiles","getFiles","NODE_ENV","map","fileName","join","observeFileChanges","server","load","force","startImplementationAsync","urlCreator","getUrlCreator","parsedOptions","maxWorkers","resetCache","resetDevServer","unversioned","EXPO_DEV_SERVER_ORIGIN","middleware","messageSocket","instantiateMetroAsync","isExporting","manifestMiddleware","getManifestMiddlewareAsync","prependMiddleware","ContextModuleSourceMapsMiddleware","getHandler","use","InterstitialPageMiddleware","scheme","ReactDevToolsPageMiddleware","deepLinkMiddleware","RuntimeRedirectMiddleware","onDeepLink","getLocation","runtime","constructDevClientUrl","constructUrl","CreateFileMiddleware","isTargetingWeb","exp","skipSDKVersionRequirement","useWebSSG","web","output","ServeStaticMiddleware","FaviconMiddleware","req","res","next","endsWith","includes","setHeader","end","staticError","HistoryFallbackMiddleware","internal","originalClose","close","bind","callback","err","host","protocol","waitForTypeScriptAsync","resolve","off","metroWatchTypeScriptFiles","tsconfig","throttle","eventTypes","TypeScriptProjectPrerequisite","bootstrapAsync","log","chalk","red","exception","startTypeScriptServices","startTypescriptTypeGenerationAsync","getConfigModuleIds","logEventAsync","getDevClientProperties","assets","styleString","filter","asset","metadata","filename","source","hmrId","jsAssets","scripts","replace"],"mappings":"AAMA;;;;QAwgBgBA,kBAAkB,GAAlBA,kBAAkB;AAxgBR,IAAA,OAAc,WAAd,cAAc,CAAA;AAC5BC,IAAAA,UAAU,mCAAM,WAAW,EAAjB;AAEJ,IAAA,MAAO,kCAAP,OAAO,EAAA;AACP,IAAA,UAAY,kCAAZ,YAAY,EAAA;AACb,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEe,IAAA,iBAAoB,WAApB,oBAAoB,CAAA;AACjB,IAAA,oBAAuB,WAAvB,uBAAuB,CAAA;AACtB,IAAA,0BAA6B,WAA7B,6BAA6B,CAAA;AACpC,IAAA,oCAAuC,WAAvC,uCAAuC,CAAA;AACtD,IAAA,IAAc,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,CAACnF,IAAI,CAAC,EAAE,CAAC,CAAC;SACZ;KACF,CAAC,CACDA,IAAI,CAAC,EAAE,CAAC,AAAC;IAEZ,MAAMsF,QAAQ,GAAGR,MAAM,CAACE,MAAM,CAAC,CAACC,KAAK,GAAKA,KAAK,CAACrG,IAAI,KAAK,IAAI;IAAA,CAAC,AAAC;IAE/D,MAAM2G,OAAO,GAAGvJ,SAAS,GACrB,CAAC,aAAa,EAAEA,SAAS,CAAC,iBAAiB,CAAC,GAC5CsJ,QAAQ,CACLxF,GAAG,CAAC,CAAC,EAAEqF,QAAQ,CAAA,EAAE,GAAK;QACrB,OAAO,CAAC,aAAa,EAAEvJ,QAAQ,CAAC,CAAC,EAAEuJ,QAAQ,CAAC,iBAAiB,CAAC,CAAC;KAChE,CAAC,CACDnF,IAAI,CAAC,EAAE,CAAC,AAAC;IAEhB,OAAOtE,QAAQ,CACZ8J,OAAO,CAAC,SAAS,EAAE,CAAC,EAAET,WAAW,CAAC,OAAO,CAAC,CAAC,CAC3CS,OAAO,CAAC,SAAS,EAAE,CAAC,EAAED,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;CAC9C"}
@@ -7,9 +7,9 @@ exports.isNodeStdLibraryModule = isNodeStdLibraryModule;
7
7
  exports.stripMetroInfo = stripMetroInfo;
8
8
  var _chalk = _interopRequireDefault(require("chalk"));
9
9
  var _path = _interopRequireDefault(require("path"));
10
- var _link = require("../../../utils/link");
11
10
  var _terminalReporter = require("./TerminalReporter");
12
11
  var _externals = require("./externals");
12
+ var _link = require("../../../utils/link");
13
13
  function _interopRequireDefault(obj) {
14
14
  return obj && obj.__esModule ? obj : {
15
15
  default: obj
@@ -32,7 +32,8 @@ class MetroTerminalReporter extends _terminalReporter.TerminalReporter {
32
32
  *
33
33
  * @returns `iOS path/to/bundle.js ▓▓▓▓▓░░░░░░░░░░░ 36.6% (4790/7922)`
34
34
  */ _getBundleStatusMessage(progress, phase) {
35
- const platform = getPlatformTagForBuildDetails(progress.bundleDetails);
35
+ const env = getEnvironmentForBuildDetails(progress.bundleDetails);
36
+ const platform = env || getPlatformTagForBuildDetails(progress.bundleDetails);
36
37
  const inProgress = phase === "in_progress";
37
38
  if (!inProgress) {
38
39
  const status = phase === "done" ? `Bundling complete ` : `Bundling failed `;
@@ -42,7 +43,7 @@ class MetroTerminalReporter extends _terminalReporter.TerminalReporter {
42
43
  // iOS Bundling complete 150ms
43
44
  return color(platform + status) + time;
44
45
  }
45
- const localPath = _path.default.relative(".", progress.bundleDetails.entryFile);
46
+ const localPath = progress.bundleDetails.entryFile.startsWith(_path.default.sep) ? _path.default.relative(this.projectRoot, progress.bundleDetails.entryFile) : progress.bundleDetails.entryFile;
46
47
  const filledBar = Math.floor(progress.ratio * MAX_PROGRESS_BAR_CHAR_WIDTH);
47
48
  const _progress = inProgress ? _chalk.default.green.bgGreen(DARK_BLOCK_CHAR.repeat(filledBar)) + _chalk.default.bgWhite.white(LIGHT_BLOCK_CHAR.repeat(MAX_PROGRESS_BAR_CHAR_WIDTH - filledBar)) + _chalk.default.bold(` ${(100 * progress.ratio).toFixed(1).padStart(4)}% `) + _chalk.default.dim(`(${progress.transformedFileCount.toString().padStart(progress.totalFileCount.toString().length)}/${progress.totalFileCount})`) : "";
48
49
  return platform + _chalk.default.reset.dim(`${_path.default.dirname(localPath)}/`) + _chalk.default.bold(_path.default.basename(localPath)) + " " + _progress;
@@ -103,7 +104,7 @@ function formatUsingNodeStandardLibraryError(projectRoot, error) {
103
104
  ].join("\n");
104
105
  } else {
105
106
  return [
106
- `You attempted attempted to import the Node standard library module "${_chalk.default.bold(targetModuleName)}" from "${_chalk.default.bold(relativePath)}".`,
107
+ `You attempted to import the Node standard library module "${_chalk.default.bold(targetModuleName)}" from "${_chalk.default.bold(relativePath)}".`,
107
108
  `It failed because the native React runtime does not include the Node standard library.`,
108
109
  (0, _link).learnMore(DOCS_PAGE_URL),
109
110
  ].join("\n");
@@ -150,5 +151,15 @@ function stripMetroInfo(errorMessage) {
150
151
  }
151
152
  return "";
152
153
  }
154
+ /** @returns platform specific tag for a `BundleDetails` object */ function getEnvironmentForBuildDetails(bundleDetails) {
155
+ var ref;
156
+ var ref1;
157
+ // Expo CLI will pass `customTransformOptions.environment = 'node'` when bundling for the server.
158
+ const env = (ref1 = bundleDetails == null ? void 0 : (ref = bundleDetails.customTransformOptions) == null ? void 0 : ref.environment) != null ? ref1 : null;
159
+ if (env === "node") {
160
+ return `${_chalk.default.bold("Server")} `;
161
+ }
162
+ return "";
163
+ }
153
164
 
154
165
  //# sourceMappingURL=MetroTerminalReporter.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/server/metro/MetroTerminalReporter.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { Terminal } from 'metro-core';\nimport path from 'path';\n\nimport { learnMore } from '../../../utils/link';\nimport { logWarning, TerminalReporter } from './TerminalReporter';\nimport { BuildPhase, BundleDetails, BundleProgress, SnippetError } from './TerminalReporter.types';\nimport { NODE_STDLIB_MODULES } from './externals';\n\nconst MAX_PROGRESS_BAR_CHAR_WIDTH = 16;\nconst DARK_BLOCK_CHAR = '\\u2593';\nconst LIGHT_BLOCK_CHAR = '\\u2591';\n/**\n * Extends the default Metro logger and adds some additional features.\n * Also removes the giant Metro logo from the output.\n */\nexport class MetroTerminalReporter extends TerminalReporter {\n constructor(public projectRoot: string, terminal: Terminal) {\n super(terminal);\n }\n\n // Used for testing\n _getElapsedTime(startTime: number): number {\n return Date.now() - startTime;\n }\n /**\n * Extends the bundle progress to include the current platform that we're bundling.\n *\n * @returns `iOS path/to/bundle.js ▓▓▓▓▓░░░░░░░░░░░ 36.6% (4790/7922)`\n */\n _getBundleStatusMessage(progress: BundleProgress, phase: BuildPhase): string {\n const platform = getPlatformTagForBuildDetails(progress.bundleDetails);\n const inProgress = phase === 'in_progress';\n\n if (!inProgress) {\n const status = phase === 'done' ? `Bundling complete ` : `Bundling failed `;\n const color = phase === 'done' ? chalk.green : chalk.red;\n\n const startTime = this._bundleTimers.get(progress.bundleDetails.buildID!);\n const time = startTime != null ? chalk.dim(this._getElapsedTime(startTime) + 'ms') : '';\n // iOS Bundling complete 150ms\n return color(platform + status) + time;\n }\n\n const localPath = path.relative('.', progress.bundleDetails.entryFile);\n const filledBar = Math.floor(progress.ratio * MAX_PROGRESS_BAR_CHAR_WIDTH);\n\n const _progress = inProgress\n ? chalk.green.bgGreen(DARK_BLOCK_CHAR.repeat(filledBar)) +\n chalk.bgWhite.white(LIGHT_BLOCK_CHAR.repeat(MAX_PROGRESS_BAR_CHAR_WIDTH - filledBar)) +\n chalk.bold(` ${(100 * progress.ratio).toFixed(1).padStart(4)}% `) +\n chalk.dim(\n `(${progress.transformedFileCount\n .toString()\n .padStart(progress.totalFileCount.toString().length)}/${progress.totalFileCount})`\n )\n : '';\n\n return (\n platform +\n chalk.reset.dim(`${path.dirname(localPath)}/`) +\n chalk.bold(path.basename(localPath)) +\n ' ' +\n _progress\n );\n }\n\n _logInitializing(port: number, hasReducedPerformance: boolean): void {\n // Don't print a giant logo...\n this.terminal.log('Starting Metro Bundler');\n }\n\n shouldFilterClientLog(event: {\n type: 'client_log';\n level: 'trace' | 'info' | 'warn' | 'log' | 'group' | 'groupCollapsed' | 'groupEnd' | 'debug';\n data: unknown[];\n }): boolean {\n return isAppRegistryStartupMessage(event.data);\n }\n\n /** Print the cache clear message. */\n transformCacheReset(): void {\n logWarning(\n this.terminal,\n chalk`Bundler cache is empty, rebuilding {dim (this may take a minute)}`\n );\n }\n\n /** One of the first logs that will be printed */\n dependencyGraphLoading(hasReducedPerformance: boolean): void {\n // this.terminal.log('Dependency graph is loading...');\n if (hasReducedPerformance) {\n // Extends https://github.com/facebook/metro/blob/347b1d7ed87995d7951aaa9fd597c04b06013dac/packages/metro/src/lib/TerminalReporter.js#L283-L290\n this.terminal.log(\n chalk.red(\n [\n 'Metro is operating with reduced performance.',\n 'Please fix the problem above and restart Metro.',\n ].join('\\n')\n )\n );\n }\n }\n\n _logBundlingError(error: SnippetError): void {\n const moduleResolutionError = formatUsingNodeStandardLibraryError(this.projectRoot, error);\n const cause = error.cause as undefined | { _expoImportStack?: string };\n if (moduleResolutionError) {\n let message = maybeAppendCodeFrame(moduleResolutionError, error.message);\n if (cause?._expoImportStack) {\n message += `\\n\\n${cause?._expoImportStack}`;\n }\n return this.terminal.log(message);\n }\n if (cause?._expoImportStack) {\n error.message += `\\n\\n${cause._expoImportStack}`;\n }\n return super._logBundlingError(error);\n }\n}\n\n/**\n * Formats an error where the user is attempting to import a module from the Node.js standard library.\n * Exposed for testing.\n *\n * @param error\n * @returns error message or null if not a module resolution error\n */\nexport function formatUsingNodeStandardLibraryError(\n projectRoot: string,\n error: SnippetError\n): string | null {\n if (!error.message) {\n return null;\n }\n const { targetModuleName, originModulePath } = error;\n if (!targetModuleName || !originModulePath) {\n return null;\n }\n const relativePath = path.relative(projectRoot, originModulePath);\n\n const DOCS_PAGE_URL =\n 'https://docs.expo.dev/workflow/using-libraries/#using-third-party-libraries';\n\n if (isNodeStdLibraryModule(targetModuleName)) {\n if (originModulePath.includes('node_modules')) {\n return [\n `The package at \"${chalk.bold(\n relativePath\n )}\" attempted to import the Node standard library module \"${chalk.bold(\n targetModuleName\n )}\".`,\n `It failed because the native React runtime does not include the Node standard library.`,\n learnMore(DOCS_PAGE_URL),\n ].join('\\n');\n } else {\n return [\n `You attempted attempted to import the Node standard library module \"${chalk.bold(\n targetModuleName\n )}\" from \"${chalk.bold(relativePath)}\".`,\n `It failed because the native React runtime does not include the Node standard library.`,\n learnMore(DOCS_PAGE_URL),\n ].join('\\n');\n }\n }\n return `Unable to resolve \"${targetModuleName}\" from \"${relativePath}\"`;\n}\n\nexport function isNodeStdLibraryModule(moduleName: string): boolean {\n return /^node:/.test(moduleName) || NODE_STDLIB_MODULES.includes(moduleName);\n}\n\n/** If the code frame can be found then append it to the existing message. */\nfunction maybeAppendCodeFrame(message: string, rawMessage: string): string {\n const codeFrame = stripMetroInfo(rawMessage);\n if (codeFrame) {\n message += '\\n' + codeFrame;\n }\n return message;\n}\n\n/**\n * Remove the Metro cache clearing steps if they exist.\n * In future versions we won't need this.\n * Returns the remaining code frame logs.\n */\nexport function stripMetroInfo(errorMessage: string): string | null {\n // Newer versions of Metro don't include the list.\n if (!errorMessage.includes('4. Remove the cache')) {\n return null;\n }\n const lines = errorMessage.split('\\n');\n const index = lines.findIndex((line) => line.includes('4. Remove the cache'));\n if (index === -1) {\n return null;\n }\n return lines.slice(index + 1).join('\\n');\n}\n\n/** @returns if the message matches the initial startup log */\nfunction isAppRegistryStartupMessage(body: any[]): boolean {\n return (\n body.length === 1 &&\n (/^Running application \"main\" with appParams:/.test(body[0]) ||\n /^Running \"main\" with \\{/.test(body[0]))\n );\n}\n\n/** @returns platform specific tag for a `BundleDetails` object */\nfunction getPlatformTagForBuildDetails(bundleDetails?: BundleDetails | null): string {\n const platform = bundleDetails?.platform ?? null;\n if (platform) {\n const formatted = { ios: 'iOS', android: 'Android', web: 'Web' }[platform] || platform;\n return `${chalk.bold(formatted)} `;\n }\n\n return '';\n}\n"],"names":["formatUsingNodeStandardLibraryError","isNodeStdLibraryModule","stripMetroInfo","MAX_PROGRESS_BAR_CHAR_WIDTH","DARK_BLOCK_CHAR","LIGHT_BLOCK_CHAR","MetroTerminalReporter","TerminalReporter","constructor","projectRoot","terminal","_getElapsedTime","startTime","Date","now","_getBundleStatusMessage","progress","phase","platform","getPlatformTagForBuildDetails","bundleDetails","inProgress","status","color","chalk","green","red","_bundleTimers","get","buildID","time","dim","localPath","path","relative","entryFile","filledBar","Math","floor","ratio","_progress","bgGreen","repeat","bgWhite","white","bold","toFixed","padStart","transformedFileCount","toString","totalFileCount","length","reset","dirname","basename","_logInitializing","port","hasReducedPerformance","log","shouldFilterClientLog","event","isAppRegistryStartupMessage","data","transformCacheReset","logWarning","dependencyGraphLoading","join","_logBundlingError","error","moduleResolutionError","cause","message","maybeAppendCodeFrame","_expoImportStack","targetModuleName","originModulePath","relativePath","DOCS_PAGE_URL","includes","learnMore","moduleName","test","NODE_STDLIB_MODULES","rawMessage","codeFrame","errorMessage","lines","split","index","findIndex","line","slice","body","formatted","ios","android","web"],"mappings":"AAAA;;;;QAgIgBA,mCAAmC,GAAnCA,mCAAmC;QAwCnCC,sBAAsB,GAAtBA,sBAAsB;QAkBtBC,cAAc,GAAdA,cAAc;AA1LZ,IAAA,MAAO,kCAAP,OAAO,EAAA;AAER,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEG,IAAA,KAAqB,WAArB,qBAAqB,CAAA;AACF,IAAA,iBAAoB,WAApB,oBAAoB,CAAA;AAE7B,IAAA,UAAa,WAAb,aAAa,CAAA;;;;;;AAEjD,MAAMC,2BAA2B,GAAG,EAAE,AAAC;AACvC,MAAMC,eAAe,GAAG,QAAQ,AAAC;AACjC,MAAMC,gBAAgB,GAAG,QAAQ,AAAC;AAK3B,MAAMC,qBAAqB,SAASC,iBAAgB,iBAAA;IACzDC,YAAmBC,WAAmB,EAAEC,QAAkB,CAAE;QAC1D,KAAK,CAACA,QAAQ,CAAC,CAAC;aADCD,WAAmB,GAAnBA,WAAmB;KAErC;IAED,mBAAmB;IACnBE,eAAe,CAACC,SAAiB,EAAU;QACzC,OAAOC,IAAI,CAACC,GAAG,EAAE,GAAGF,SAAS,CAAC;KAC/B;IACD;;;;KAIG,CACHG,uBAAuB,CAACC,QAAwB,EAAEC,KAAiB,EAAU;QAC3E,MAAMC,QAAQ,GAAGC,6BAA6B,CAACH,QAAQ,CAACI,aAAa,CAAC,AAAC;QACvE,MAAMC,UAAU,GAAGJ,KAAK,KAAK,aAAa,AAAC;QAE3C,IAAI,CAACI,UAAU,EAAE;YACf,MAAMC,MAAM,GAAGL,KAAK,KAAK,MAAM,GAAG,CAAC,kBAAkB,CAAC,GAAG,CAAC,gBAAgB,CAAC,AAAC;YAC5E,MAAMM,KAAK,GAAGN,KAAK,KAAK,MAAM,GAAGO,MAAK,QAAA,CAACC,KAAK,GAAGD,MAAK,QAAA,CAACE,GAAG,AAAC;Y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AAGD,YAAY,CAACE,KAAK,CAAC,IAAI,CAAC,AAAC;IACvC,MAAMC,KAAK,GAAGF,KAAK,CAACG,SAAS,CAAC,CAACC,IAAI,GAAKA,IAAI,CAACZ,QAAQ,CAAC,qBAAqB,CAAC;IAAA,CAAC,AAAC;IAC9E,IAAIU,KAAK,KAAK,CAAC,CAAC,EAAE;QAChB,OAAO,IAAI,CAAC;KACb;IACD,OAAOF,KAAK,CAACK,KAAK,CAACH,KAAK,GAAG,CAAC,CAAC,CAACtB,IAAI,CAAC,IAAI,CAAC,CAAC;CAC1C;AAED,8DAA8D,CAC9D,SAASL,2BAA2B,CAAC+B,IAAW,EAAW;IACzD,OACEA,IAAI,CAACzC,MAAM,KAAK,CAAC,IACjB,CAAC,8CAA8C8B,IAAI,CAACW,IAAI,CAAC,CAAC,CAAC,CAAC,IAC1D,0BAA0BX,IAAI,CAACW,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAC1C;CACH;AAED,kEAAkE,CAClE,SAASzE,6BAA6B,CAACC,aAAoC,EAAU;QAClEA,GAAuB;IAAxC,MAAMF,QAAQ,GAAGE,CAAAA,GAAuB,GAAvBA,aAAa,QAAU,GAAvBA,KAAAA,CAAuB,GAAvBA,aAAa,CAAEF,QAAQ,YAAvBE,GAAuB,GAAI,IAAI,AAAC;IACjD,IAAIF,QAAQ,EAAE;QACZ,MAAM2E,SAAS,GAAG;YAAEC,GAAG,EAAE,KAAK;YAAEC,OAAO,EAAE,SAAS;YAAEC,GAAG,EAAE,KAAK;SAAE,CAAC9E,QAAQ,CAAC,IAAIA,QAAQ,AAAC;QACvF,OAAO,CAAC,EAAEM,MAAK,QAAA,CAACqB,IAAI,CAACgD,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;KACpC;IAED,OAAO,EAAE,CAAC;CACX"}
1
+ {"version":3,"sources":["../../../../../src/start/server/metro/MetroTerminalReporter.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { Terminal } from 'metro-core';\nimport path from 'path';\n\nimport { logWarning, TerminalReporter } from './TerminalReporter';\nimport { BuildPhase, BundleDetails, BundleProgress, SnippetError } from './TerminalReporter.types';\nimport { NODE_STDLIB_MODULES } from './externals';\nimport { learnMore } from '../../../utils/link';\n\nconst MAX_PROGRESS_BAR_CHAR_WIDTH = 16;\nconst DARK_BLOCK_CHAR = '\\u2593';\nconst LIGHT_BLOCK_CHAR = '\\u2591';\n/**\n * Extends the default Metro logger and adds some additional features.\n * Also removes the giant Metro logo from the output.\n */\nexport class MetroTerminalReporter extends TerminalReporter {\n constructor(\n public projectRoot: string,\n terminal: Terminal\n ) {\n super(terminal);\n }\n\n // Used for testing\n _getElapsedTime(startTime: number): number {\n return Date.now() - startTime;\n }\n /**\n * Extends the bundle progress to include the current platform that we're bundling.\n *\n * @returns `iOS path/to/bundle.js ▓▓▓▓▓░░░░░░░░░░░ 36.6% (4790/7922)`\n */\n _getBundleStatusMessage(progress: BundleProgress, phase: BuildPhase): string {\n const env = getEnvironmentForBuildDetails(progress.bundleDetails);\n const platform = env || getPlatformTagForBuildDetails(progress.bundleDetails);\n const inProgress = phase === 'in_progress';\n\n if (!inProgress) {\n const status = phase === 'done' ? `Bundling complete ` : `Bundling failed `;\n const color = phase === 'done' ? chalk.green : chalk.red;\n\n const startTime = this._bundleTimers.get(progress.bundleDetails.buildID!);\n const time = startTime != null ? chalk.dim(this._getElapsedTime(startTime) + 'ms') : '';\n // iOS Bundling complete 150ms\n return color(platform + status) + time;\n }\n\n const localPath = progress.bundleDetails.entryFile.startsWith(path.sep)\n ? path.relative(this.projectRoot, progress.bundleDetails.entryFile)\n : progress.bundleDetails.entryFile;\n\n const filledBar = Math.floor(progress.ratio * MAX_PROGRESS_BAR_CHAR_WIDTH);\n\n const _progress = inProgress\n ? chalk.green.bgGreen(DARK_BLOCK_CHAR.repeat(filledBar)) +\n chalk.bgWhite.white(LIGHT_BLOCK_CHAR.repeat(MAX_PROGRESS_BAR_CHAR_WIDTH - filledBar)) +\n chalk.bold(` ${(100 * progress.ratio).toFixed(1).padStart(4)}% `) +\n chalk.dim(\n `(${progress.transformedFileCount\n .toString()\n .padStart(progress.totalFileCount.toString().length)}/${progress.totalFileCount})`\n )\n : '';\n\n return (\n platform +\n chalk.reset.dim(`${path.dirname(localPath)}/`) +\n chalk.bold(path.basename(localPath)) +\n ' ' +\n _progress\n );\n }\n\n _logInitializing(port: number, hasReducedPerformance: boolean): void {\n // Don't print a giant logo...\n this.terminal.log('Starting Metro Bundler');\n }\n\n shouldFilterClientLog(event: {\n type: 'client_log';\n level: 'trace' | 'info' | 'warn' | 'log' | 'group' | 'groupCollapsed' | 'groupEnd' | 'debug';\n data: unknown[];\n }): boolean {\n return isAppRegistryStartupMessage(event.data);\n }\n\n /** Print the cache clear message. */\n transformCacheReset(): void {\n logWarning(\n this.terminal,\n chalk`Bundler cache is empty, rebuilding {dim (this may take a minute)}`\n );\n }\n\n /** One of the first logs that will be printed */\n dependencyGraphLoading(hasReducedPerformance: boolean): void {\n // this.terminal.log('Dependency graph is loading...');\n if (hasReducedPerformance) {\n // Extends https://github.com/facebook/metro/blob/347b1d7ed87995d7951aaa9fd597c04b06013dac/packages/metro/src/lib/TerminalReporter.js#L283-L290\n this.terminal.log(\n chalk.red(\n [\n 'Metro is operating with reduced performance.',\n 'Please fix the problem above and restart Metro.',\n ].join('\\n')\n )\n );\n }\n }\n\n _logBundlingError(error: SnippetError): void {\n const moduleResolutionError = formatUsingNodeStandardLibraryError(this.projectRoot, error);\n const cause = error.cause as undefined | { _expoImportStack?: string };\n if (moduleResolutionError) {\n let message = maybeAppendCodeFrame(moduleResolutionError, error.message);\n if (cause?._expoImportStack) {\n message += `\\n\\n${cause?._expoImportStack}`;\n }\n return this.terminal.log(message);\n }\n if (cause?._expoImportStack) {\n error.message += `\\n\\n${cause._expoImportStack}`;\n }\n return super._logBundlingError(error);\n }\n}\n\n/**\n * Formats an error where the user is attempting to import a module from the Node.js standard library.\n * Exposed for testing.\n *\n * @param error\n * @returns error message or null if not a module resolution error\n */\nexport function formatUsingNodeStandardLibraryError(\n projectRoot: string,\n error: SnippetError\n): string | null {\n if (!error.message) {\n return null;\n }\n const { targetModuleName, originModulePath } = error;\n if (!targetModuleName || !originModulePath) {\n return null;\n }\n const relativePath = path.relative(projectRoot, originModulePath);\n\n const DOCS_PAGE_URL =\n 'https://docs.expo.dev/workflow/using-libraries/#using-third-party-libraries';\n\n if (isNodeStdLibraryModule(targetModuleName)) {\n if (originModulePath.includes('node_modules')) {\n return [\n `The package at \"${chalk.bold(\n relativePath\n )}\" attempted to import the Node standard library module \"${chalk.bold(\n targetModuleName\n )}\".`,\n `It failed because the native React runtime does not include the Node standard library.`,\n learnMore(DOCS_PAGE_URL),\n ].join('\\n');\n } else {\n return [\n `You attempted to import the Node standard library module \"${chalk.bold(\n targetModuleName\n )}\" from \"${chalk.bold(relativePath)}\".`,\n `It failed because the native React runtime does not include the Node standard library.`,\n learnMore(DOCS_PAGE_URL),\n ].join('\\n');\n }\n }\n return `Unable to resolve \"${targetModuleName}\" from \"${relativePath}\"`;\n}\n\nexport function isNodeStdLibraryModule(moduleName: string): boolean {\n return /^node:/.test(moduleName) || NODE_STDLIB_MODULES.includes(moduleName);\n}\n\n/** If the code frame can be found then append it to the existing message. */\nfunction maybeAppendCodeFrame(message: string, rawMessage: string): string {\n const codeFrame = stripMetroInfo(rawMessage);\n if (codeFrame) {\n message += '\\n' + codeFrame;\n }\n return message;\n}\n\n/**\n * Remove the Metro cache clearing steps if they exist.\n * In future versions we won't need this.\n * Returns the remaining code frame logs.\n */\nexport function stripMetroInfo(errorMessage: string): string | null {\n // Newer versions of Metro don't include the list.\n if (!errorMessage.includes('4. Remove the cache')) {\n return null;\n }\n const lines = errorMessage.split('\\n');\n const index = lines.findIndex((line) => line.includes('4. Remove the cache'));\n if (index === -1) {\n return null;\n }\n return lines.slice(index + 1).join('\\n');\n}\n\n/** @returns if the message matches the initial startup log */\nfunction isAppRegistryStartupMessage(body: any[]): boolean {\n return (\n body.length === 1 &&\n (/^Running application \"main\" with appParams:/.test(body[0]) ||\n /^Running \"main\" with \\{/.test(body[0]))\n );\n}\n\n/** @returns platform specific tag for a `BundleDetails` object */\nfunction getPlatformTagForBuildDetails(bundleDetails?: BundleDetails | null): string {\n const platform = bundleDetails?.platform ?? null;\n if (platform) {\n const formatted = { ios: 'iOS', android: 'Android', web: 'Web' }[platform] || platform;\n return `${chalk.bold(formatted)} `;\n }\n\n return '';\n}\n/** @returns platform specific tag for a `BundleDetails` object */\nfunction getEnvironmentForBuildDetails(bundleDetails?: BundleDetails | null): string {\n // Expo CLI will pass `customTransformOptions.environment = 'node'` when bundling for the server.\n const env = bundleDetails?.customTransformOptions?.environment ?? null;\n if (env === 'node') {\n return `${chalk.bold('Server')} `;\n }\n\n return '';\n}\n"],"names":["formatUsingNodeStandardLibraryError","isNodeStdLibraryModule","stripMetroInfo","MAX_PROGRESS_BAR_CHAR_WIDTH","DARK_BLOCK_CHAR","LIGHT_BLOCK_CHAR","MetroTerminalReporter","TerminalReporter","constructor","projectRoot","terminal","_getElapsedTime","startTime","Date","now","_getBundleStatusMessage","progress","phase","env","getEnvironmentForBuildDetails","bundleDetails","platform","getPlatformTagForBuildDetails","inProgress","status","color","chalk","green","red","_bundleTimers","get","buildID","time","dim","localPath","entryFile","startsWith","path","sep","relative","filledBar","Math","floor","ratio","_progress","bgGreen","repeat","bgWhite","white","bold","toFixed","padStart","transformedFileCount","toString","totalFileCount","length","reset","dirname","basename","_logInitializing","port","hasReducedPerformance","log","shouldFilterClientLog","event","isAppRegistryStartupMessage","data","transformCacheReset","logWarning","dependencyGraphLoading","join","_logBundlingError","error","moduleResolutionError","cause","message","maybeAppendCodeFrame","_expoImportStack","targetModuleName","originModulePath","relativePath","DOCS_PAGE_URL","includes","learnMore","moduleName","test","NODE_STDLIB_MODULES","rawMessage","codeFrame","errorMessage","lines","split","index","findIndex","line","slice","body","formatted","ios","android","web","customTransformOptions","environment"],"mappings":"AAAA;;;;QAuIgBA,mCAAmC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ACD,kEAAkE,CAClE,SAAS9E,6BAA6B,CAACC,aAAoC,EAAU;QAEvEA,GAAqC;QAArCA,IAAkD;IAD9D,iGAAiG;IACjG,MAAMF,GAAG,GAAGE,CAAAA,IAAkD,GAAlDA,aAAa,QAAwB,GAArCA,KAAAA,CAAqC,GAArCA,CAAAA,GAAqC,GAArCA,aAAa,CAAEiF,sBAAsB,SAAA,GAArCjF,KAAAA,CAAqC,GAArCA,GAAqC,CAAEkF,WAAW,AAAb,YAArClF,IAAkD,GAAI,IAAI,AAAC;IACvE,IAAIF,GAAG,KAAK,MAAM,EAAE;QAClB,OAAO,CAAC,EAAEQ,MAAK,QAAA,CAACuB,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;KACnC;IAED,OAAO,EAAE,CAAC;CACX"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/server/metro/TerminalReporter.ts"],"sourcesContent":["// This file represents an abstraction on the metro TerminalReporter.\n// We use this abstraction to safely extend the TerminalReporter for our own custom logging.\nimport chalk from 'chalk';\nimport { Terminal } from 'metro-core';\nimport UpstreamTerminalReporter from 'metro/src/lib/TerminalReporter';\nimport util from 'util';\n\nimport { stripAnsi } from '../../../utils/ansi';\nimport {\n BundleDetails,\n TerminalReportableEvent,\n TerminalReporterInterface,\n} from './TerminalReporter.types';\n\n/**\n * A standard way to log a warning to the terminal. This should not be called\n * from some arbitrary Metro logic, only from the reporters. Instead of\n * calling this, add a new type of ReportableEvent instead, and implement a\n * proper handler in the reporter(s).\n */\nexport function logWarning(terminal: Terminal, format: string, ...args: any[]): void {\n const str = util.format(format, ...args);\n terminal.log('%s: %s', chalk.yellow('warning'), str);\n}\n\n/**\n * Similar to `logWarning`, but for messages that require the user to act.\n */\nexport function logError(terminal: Terminal, format: string, ...args: any[]): void {\n terminal.log(\n '%s: %s',\n chalk.red('error'),\n // Syntax errors may have colors applied for displaying code frames\n // in various places outside of where Metro is currently running.\n // If the current terminal does not support color, we'll strip the colors\n // here.\n util.format(chalk.supportsColor ? format : stripAnsi(format), ...args)\n );\n}\n\nconst XTerminalReporter = UpstreamTerminalReporter as unknown as TerminalReporterInterface;\n\n/** Extended TerminalReporter class but with proper types and extra functionality to avoid using the `_log` method directly in subclasses. */\nexport class TerminalReporter extends XTerminalReporter implements TerminalReporterInterface {\n /**\n * A cache of { [buildID]: BundleDetails } which can be used to\n * add more contextual logs. BundleDetails is currently only sent with `bundle_build_started`\n * so we need to cache the details in order to print the platform info with other event types.\n */\n _bundleDetails: Map<string, BundleDetails> = new Map();\n\n /** Keep track of how long a bundle takes to complete */\n _bundleTimers: Map<string, number> = new Map();\n\n _log(event: TerminalReportableEvent): void {\n switch (event.type) {\n case 'transform_cache_reset':\n return this.transformCacheReset();\n case 'dep_graph_loading':\n return this.dependencyGraphLoading(event.hasReducedPerformance);\n case 'client_log':\n if (this.shouldFilterClientLog(event)) {\n return;\n }\n break;\n }\n return super._log(event);\n }\n\n /** Gives subclasses an easy interface for filtering out logs. Return `true` to skip. */\n shouldFilterClientLog(event: {\n type: 'client_log';\n level: 'trace' | 'info' | 'warn' | 'log' | 'group' | 'groupCollapsed' | 'groupEnd' | 'debug';\n data: unknown[];\n }): boolean {\n return false;\n }\n\n /** Cache has been reset. */\n transformCacheReset(): void {}\n\n /** One of the first logs that will be printed. */\n dependencyGraphLoading(hasReducedPerformance: boolean): void {}\n\n /**\n * Custom log event representing the end of the bundling.\n *\n * @param event event object.\n * @param duration duration of the build in milliseconds.\n */\n bundleBuildEnded(event: TerminalReportableEvent, duration: number): 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(\n event: TerminalReportableEvent & { bundleDetails?: BundleDetails; buildID?: string }\n ) {\n // Append the buildID to the bundleDetails.\n if (event.bundleDetails) {\n event.bundleDetails.buildID = event.buildID;\n }\n\n super._updateState(event);\n switch (event.type) {\n case 'bundle_build_done':\n case 'bundle_build_failed': {\n const startTime = this._bundleTimers.get(event.buildID);\n // Observed a bug in Metro where the `bundle_build_done` is invoked twice during a static bundle\n // i.e. `expo export`.\n if (startTime == null) {\n break;\n }\n\n this.bundleBuildEnded(event, startTime ? Date.now() - startTime : 0);\n this._bundleTimers.delete(event.buildID);\n break;\n }\n case 'bundle_build_started':\n this._bundleDetails.set(event.buildID, event.bundleDetails);\n this._bundleTimers.set(event.buildID, Date.now());\n break;\n }\n }\n}\n"],"names":["logWarning","logError","terminal","format","args","str","util","log","chalk","yellow","red","supportsColor","stripAnsi","XTerminalReporter","UpstreamTerminalReporter","TerminalReporter","_bundleDetails","Map","_bundleTimers","_log","event","type","transformCacheReset","dependencyGraphLoading","hasReducedPerformance","shouldFilterClientLog","bundleBuildEnded","duration","_updateState","bundleDetails","buildID","startTime","get","Date","now","delete","set"],"mappings":"AAEA;;;;QAkBgBA,UAAU,GAAVA,UAAU;QAQVC,QAAQ,GAARA,QAAQ;AA1BN,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEY,IAAA,iBAAgC,kCAAhC,gCAAgC,EAAA;AACpD,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEG,IAAA,KAAqB,WAArB,qBAAqB,CAAA;;;;;;AAaxC,SAASD,UAAU,CAACE,QAAkB,EAAEC,MAAc,EAAE,GAAGC,IAAI,AAAO,EAAQ;IACnF,MAAMC,GAAG,GAAGC,KAAI,QAAA,CAACH,MAAM,CAACA,MAAM,KAAKC,IAAI,CAAC,AAAC;IACzCF,QAAQ,CAACK,GAAG,CAAC,QAAQ,EAAEC,MAAK,QAAA,CAACC,MAAM,CAAC,SAAS,CAAC,EAAEJ,GAAG,CAAC,CAAC;CACtD;AAKM,SAASJ,QAAQ,CAACC,QAAkB,EAAEC,MAAc,EAAE,GAAGC,IAAI,AAAO,EAAQ;IACjFF,QAAQ,CAACK,GAAG,CACV,QAAQ,EACRC,MAAK,QAAA,CAACE,GAAG,CAAC,OAAO,CAAC,EAClB,mEAAmE;IACnE,iEAAiE;IACjE,yEAAyE;IACzE,QAAQ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AY,CAACR,KAAK,CAAC,CAAC;QAC1B,OAAQA,KAAK,CAACC,IAAI;YAChB,KAAK,mBAAmB,CAAC;YACzB,KAAK,qBAAqB;gBAAE;oBAC1B,MAAMU,SAAS,GAAG,IAAI,CAACb,aAAa,CAACc,GAAG,CAACZ,KAAK,CAACU,OAAO,CAAC,AAAC;oBACxD,gGAAgG;oBAChG,sBAAsB;oBACtB,IAAIC,SAAS,IAAI,IAAI,EAAE;wBACrB,MAAM;qBACP;oBAED,IAAI,CAACL,gBAAgB,CAACN,KAAK,EAAEW,SAAS,GAAGE,IAAI,CAACC,GAAG,EAAE,GAAGH,SAAS,GAAG,CAAC,CAAC,CAAC;oBACrE,IAAI,CAACb,aAAa,CAACiB,MAAM,CAACf,KAAK,CAACU,OAAO,CAAC,CAAC;oBACzC,MAAM;iBACP;YACD,KAAK,sBAAsB;gBACzB,IAAI,CAACd,cAAc,CAACoB,GAAG,CAAChB,KAAK,CAACU,OAAO,EAAEV,KAAK,CAACS,aAAa,CAAC,CAAC;gBAC5D,IAAI,CAACX,aAAa,CAACkB,GAAG,CAAChB,KAAK,CAACU,OAAO,EAAEG,IAAI,CAACC,GAAG,EAAE,CAAC,CAAC;gBAClD,MAAM;SACT;KACF;CACF;QAlFYnB,gBAAgB,GAAhBA,gBAAgB"}
1
+ {"version":3,"sources":["../../../../../src/start/server/metro/TerminalReporter.ts"],"sourcesContent":["// This file represents an abstraction on the metro TerminalReporter.\n// We use this abstraction to safely extend the TerminalReporter for our own custom logging.\nimport chalk from 'chalk';\nimport UpstreamTerminalReporter from 'metro/src/lib/TerminalReporter';\nimport { Terminal } from 'metro-core';\nimport util from 'util';\n\nimport {\n BundleDetails,\n TerminalReportableEvent,\n TerminalReporterInterface,\n} from './TerminalReporter.types';\nimport { stripAnsi } from '../../../utils/ansi';\n\n/**\n * A standard way to log a warning to the terminal. This should not be called\n * from some arbitrary Metro logic, only from the reporters. Instead of\n * calling this, add a new type of ReportableEvent instead, and implement a\n * proper handler in the reporter(s).\n */\nexport function logWarning(terminal: Terminal, format: string, ...args: any[]): void {\n const str = util.format(format, ...args);\n terminal.log('%s: %s', chalk.yellow('warning'), str);\n}\n\n/**\n * Similar to `logWarning`, but for messages that require the user to act.\n */\nexport function logError(terminal: Terminal, format: string, ...args: any[]): void {\n terminal.log(\n '%s: %s',\n chalk.red('error'),\n // Syntax errors may have colors applied for displaying code frames\n // in various places outside of where Metro is currently running.\n // If the current terminal does not support color, we'll strip the colors\n // here.\n util.format(chalk.supportsColor ? format : stripAnsi(format), ...args)\n );\n}\n\nconst XTerminalReporter = UpstreamTerminalReporter as unknown as TerminalReporterInterface;\n\n/** Extended TerminalReporter class but with proper types and extra functionality to avoid using the `_log` method directly in subclasses. */\nexport class TerminalReporter extends XTerminalReporter implements TerminalReporterInterface {\n /**\n * A cache of { [buildID]: BundleDetails } which can be used to\n * add more contextual logs. BundleDetails is currently only sent with `bundle_build_started`\n * so we need to cache the details in order to print the platform info with other event types.\n */\n _bundleDetails: Map<string, BundleDetails> = new Map();\n\n /** Keep track of how long a bundle takes to complete */\n _bundleTimers: Map<string, number> = new Map();\n\n _log(event: TerminalReportableEvent): void {\n switch (event.type) {\n case 'transform_cache_reset':\n return this.transformCacheReset();\n case 'dep_graph_loading':\n return this.dependencyGraphLoading(event.hasReducedPerformance);\n case 'client_log':\n if (this.shouldFilterClientLog(event)) {\n return;\n }\n break;\n }\n return super._log(event);\n }\n\n /** Gives subclasses an easy interface for filtering out logs. Return `true` to skip. */\n shouldFilterClientLog(event: {\n type: 'client_log';\n level: 'trace' | 'info' | 'warn' | 'log' | 'group' | 'groupCollapsed' | 'groupEnd' | 'debug';\n data: unknown[];\n }): boolean {\n return false;\n }\n\n /** Cache has been reset. */\n transformCacheReset(): void {}\n\n /** One of the first logs that will be printed. */\n dependencyGraphLoading(hasReducedPerformance: boolean): void {}\n\n /**\n * Custom log event representing the end of the bundling.\n *\n * @param event event object.\n * @param duration duration of the build in milliseconds.\n */\n bundleBuildEnded(event: TerminalReportableEvent, duration: number): 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(\n event: TerminalReportableEvent & { bundleDetails?: BundleDetails; buildID?: string }\n ) {\n // Append the buildID to the bundleDetails.\n if (event.bundleDetails) {\n event.bundleDetails.buildID = event.buildID;\n }\n\n super._updateState(event);\n switch (event.type) {\n case 'bundle_build_done':\n case 'bundle_build_failed': {\n const startTime = this._bundleTimers.get(event.buildID);\n // Observed a bug in Metro where the `bundle_build_done` is invoked twice during a static bundle\n // i.e. `expo export`.\n if (startTime == null) {\n break;\n }\n\n this.bundleBuildEnded(event, startTime ? Date.now() - startTime : 0);\n this._bundleTimers.delete(event.buildID);\n break;\n }\n case 'bundle_build_started':\n this._bundleDetails.set(event.buildID, event.bundleDetails);\n this._bundleTimers.set(event.buildID, Date.now());\n break;\n }\n }\n}\n"],"names":["logWarning","logError","terminal","format","args","str","util","log","chalk","yellow","red","supportsColor","stripAnsi","XTerminalReporter","UpstreamTerminalReporter","TerminalReporter","_bundleDetails","Map","_bundleTimers","_log","event","type","transformCacheReset","dependencyGraphLoading","hasReducedPerformance","shouldFilterClientLog","bundleBuildEnded","duration","_updateState","bundleDetails","buildID","startTime","get","Date","now","delete","set"],"mappings":"AAEA;;;;QAkBgBA,UAAU,GAAVA,UAAU;QAQVC,QAAQ,GAARA,QAAQ;AA1BN,IAAA,MAAO,kCAAP,OAAO,EAAA;AACY,IAAA,iBAAgC,kCAAhC,gCAAgC,EAAA;AAEpD,IAAA,KAAM,kCAAN,MAAM,EAAA;AAOG,IAAA,KAAqB,WAArB,qBAAqB,CAAA;;;;;;AAQxC,SAASD,UAAU,CAACE,QAAkB,EAAEC,MAAc,EAAE,GAAGC,IAAI,AAAO,EAAQ;IACnF,MAAMC,GAAG,GAAGC,KAAI,QAAA,CAACH,MAAM,CAACA,MAAM,KAAKC,IAAI,CAAC,AAAC;IACzCF,QAAQ,CAACK,GAAG,CAAC,QAAQ,EAAEC,MA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