@depup/expo__cli 55.0.23-depup.0 → 57.0.9-depup.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 (594) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +13 -15
  3. package/build/bin/cli +4 -4
  4. package/build/bin/cli.map +1 -1
  5. package/build/src/api/endpoint.js +4 -4
  6. package/build/src/api/endpoint.js.map +1 -1
  7. package/build/src/api/getExpoSchema.js +3 -3
  8. package/build/src/api/getExpoSchema.js.map +1 -1
  9. package/build/src/api/graphql/client.js +26 -14
  10. package/build/src/api/graphql/client.js.map +1 -1
  11. package/build/src/api/graphql/mutations/TunnelMutation.js +31 -0
  12. package/build/src/api/graphql/mutations/TunnelMutation.js.map +1 -0
  13. package/build/src/api/rest/cache/FileSystemResponseCache.js.map +1 -1
  14. package/build/src/api/rest/cache/ResponseCache.js +5 -5
  15. package/build/src/api/rest/cache/ResponseCache.js.map +1 -1
  16. package/build/src/api/rest/client.js +35 -20
  17. package/build/src/api/rest/client.js.map +1 -1
  18. package/build/src/api/rest/wrapFetchWithBaseUrl.js.map +1 -1
  19. package/build/src/api/rest/wrapFetchWithOffline.js.map +1 -1
  20. package/build/src/api/rest/wrapFetchWithProgress.js.map +1 -1
  21. package/build/src/api/rest/wrapFetchWithUserAgent.js.map +1 -1
  22. package/build/src/api/updateDevelopmentSession.js +6 -5
  23. package/build/src/api/updateDevelopmentSession.js.map +1 -1
  24. package/build/src/api/user/UserSettings.js +28 -15
  25. package/build/src/api/user/UserSettings.js.map +1 -1
  26. package/build/src/api/user/actions.js +10 -3
  27. package/build/src/api/user/actions.js.map +1 -1
  28. package/build/src/api/user/expoSsoLauncher.js +76 -24
  29. package/build/src/api/user/expoSsoLauncher.js.map +1 -1
  30. package/build/src/api/user/otp.js +4 -4
  31. package/build/src/api/user/otp.js.map +1 -1
  32. package/build/src/api/user/user.js +19 -7
  33. package/build/src/api/user/user.js.map +1 -1
  34. package/build/src/config/configAsync.js +3 -3
  35. package/build/src/config/configAsync.js.map +1 -1
  36. package/build/src/config/index.js.map +1 -1
  37. package/build/src/customize/customizeAsync.js.map +1 -1
  38. package/build/src/customize/generate.js +7 -4
  39. package/build/src/customize/generate.js.map +1 -1
  40. package/build/src/customize/index.js.map +1 -1
  41. package/build/src/customize/templates.js +4 -6
  42. package/build/src/customize/templates.js.map +1 -1
  43. package/build/src/customize/typescript.js.map +1 -1
  44. package/build/src/events/index.js +19 -15
  45. package/build/src/events/index.js.map +1 -1
  46. package/build/src/events/stream.js +94 -24
  47. package/build/src/events/stream.js.map +1 -1
  48. package/build/src/expoUpdatesExports.js +4 -4
  49. package/build/src/expoUpdatesExports.js.map +1 -1
  50. package/build/src/export/createMetadataJson.js +2 -1
  51. package/build/src/export/createMetadataJson.js.map +1 -1
  52. package/build/src/export/embed/exportEmbedAsync.js +45 -20
  53. package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
  54. package/build/src/export/embed/exportServer.js +1 -1
  55. package/build/src/export/embed/exportServer.js.map +1 -1
  56. package/build/src/export/embed/index.js.map +1 -1
  57. package/build/src/export/embed/resolveOptions.js +7 -6
  58. package/build/src/export/embed/resolveOptions.js.map +1 -1
  59. package/build/src/export/embed/xcodeCompilerLogger.js +7 -7
  60. package/build/src/export/embed/xcodeCompilerLogger.js.map +1 -1
  61. package/build/src/export/exportApp.js +32 -28
  62. package/build/src/export/exportApp.js.map +1 -1
  63. package/build/src/export/exportAssets.js +5 -5
  64. package/build/src/export/exportAssets.js.map +1 -1
  65. package/build/src/export/exportAsync.js.map +1 -1
  66. package/build/src/export/exportDomComponents.js +5 -5
  67. package/build/src/export/exportDomComponents.js.map +1 -1
  68. package/build/src/export/exportHermes.js +23 -13
  69. package/build/src/export/exportHermes.js.map +1 -1
  70. package/build/src/export/exportStaticAsync.js +30 -21
  71. package/build/src/export/exportStaticAsync.js.map +1 -1
  72. package/build/src/export/favicon.js +26 -34
  73. package/build/src/export/favicon.js.map +1 -1
  74. package/build/src/export/getPublicExpoManifest.js.map +1 -1
  75. package/build/src/export/getResolvedLocales.js.map +1 -1
  76. package/build/src/export/html.js +3 -3
  77. package/build/src/export/html.js.map +1 -1
  78. package/build/src/export/index.js +2 -0
  79. package/build/src/export/index.js.map +1 -1
  80. package/build/src/export/metroAssetLocalPath.js +4 -4
  81. package/build/src/export/metroAssetLocalPath.js.map +1 -1
  82. package/build/src/export/persistMetroAssets.js +6 -6
  83. package/build/src/export/persistMetroAssets.js.map +1 -1
  84. package/build/src/export/publicFolder.js +16 -4
  85. package/build/src/export/publicFolder.js.map +1 -1
  86. package/build/src/export/resolveOptions.js +12 -13
  87. package/build/src/export/resolveOptions.js.map +1 -1
  88. package/build/src/export/saveAssets.js +3 -3
  89. package/build/src/export/saveAssets.js.map +1 -1
  90. package/build/src/export/static.js +6 -0
  91. package/build/src/export/static.js.map +1 -0
  92. package/build/src/export/web/exportWebAsync.js.map +1 -1
  93. package/build/src/export/web/index.js.map +1 -1
  94. package/build/src/export/writeContents.js.map +1 -1
  95. package/build/src/install/checkPackages.js +1 -28
  96. package/build/src/install/checkPackages.js.map +1 -1
  97. package/build/src/install/fixPackages.js.map +1 -1
  98. package/build/src/install/index.js.map +1 -1
  99. package/build/src/install/installAsync.js +3 -3
  100. package/build/src/install/installAsync.js.map +1 -1
  101. package/build/src/install/installExpoPackage.js.map +1 -1
  102. package/build/src/install/resolveOptions.js.map +1 -1
  103. package/build/src/install/utils/autoAddConfigPlugins.js +3 -3
  104. package/build/src/install/utils/autoAddConfigPlugins.js.map +1 -1
  105. package/build/src/install/utils/checkPackagesCompatibility.js +32 -16
  106. package/build/src/install/utils/checkPackagesCompatibility.js.map +1 -1
  107. package/build/src/lint/ESlintPrerequisite.js.map +1 -1
  108. package/build/src/log.js +32 -14
  109. package/build/src/log.js.map +1 -1
  110. package/build/src/login/index.js +25 -5
  111. package/build/src/login/index.js.map +1 -1
  112. package/build/src/logout/index.js.map +1 -1
  113. package/build/src/prebuild/clearNativeFolder.js +49 -14
  114. package/build/src/prebuild/clearNativeFolder.js.map +1 -1
  115. package/build/src/prebuild/configureProjectAsync.js.map +1 -1
  116. package/build/src/prebuild/copyTemplateFiles.js +3 -3
  117. package/build/src/prebuild/copyTemplateFiles.js.map +1 -1
  118. package/build/src/prebuild/ensureConfigAsync.js.map +1 -1
  119. package/build/src/prebuild/index.js +3 -2
  120. package/build/src/prebuild/index.js.map +1 -1
  121. package/build/src/prebuild/prebuildAsync.js +31 -6
  122. package/build/src/prebuild/prebuildAsync.js.map +1 -1
  123. package/build/src/prebuild/renameTemplateAppName.js +8 -5
  124. package/build/src/prebuild/renameTemplateAppName.js.map +1 -1
  125. package/build/src/prebuild/resolveOptions.js +7 -7
  126. package/build/src/prebuild/resolveOptions.js.map +1 -1
  127. package/build/src/prebuild/resolveTemplate.js +10 -5
  128. package/build/src/prebuild/resolveTemplate.js.map +1 -1
  129. package/build/src/prebuild/updateFromTemplate.js +3 -3
  130. package/build/src/prebuild/updateFromTemplate.js.map +1 -1
  131. package/build/src/prebuild/updatePackageJson.js +7 -7
  132. package/build/src/prebuild/updatePackageJson.js.map +1 -1
  133. package/build/src/prebuild/validateTemplatePlatforms.js.map +1 -1
  134. package/build/src/register/index.js.map +1 -1
  135. package/build/src/run/android/index.js.map +1 -1
  136. package/build/src/run/android/resolveGradlePropsAsync.js +3 -4
  137. package/build/src/run/android/resolveGradlePropsAsync.js.map +1 -1
  138. package/build/src/run/android/resolveInstallApkName.js +48 -1
  139. package/build/src/run/android/resolveInstallApkName.js.map +1 -1
  140. package/build/src/run/android/resolveLaunchProps.js +4 -1
  141. package/build/src/run/android/resolveLaunchProps.js.map +1 -1
  142. package/build/src/run/android/resolveOptions.js.map +1 -1
  143. package/build/src/run/android/runAndroidAsync.js.map +1 -1
  144. package/build/src/run/ensureNativeProject.js.map +1 -1
  145. package/build/src/run/hints.js +4 -4
  146. package/build/src/run/hints.js.map +1 -1
  147. package/build/src/run/index.js.map +1 -1
  148. package/build/src/run/ios/XcodeBuild.js +163 -23
  149. package/build/src/run/ios/XcodeBuild.js.map +1 -1
  150. package/build/src/run/ios/appleDevice/AppleDevice.js +6 -5
  151. package/build/src/run/ios/appleDevice/AppleDevice.js.map +1 -1
  152. package/build/src/run/ios/appleDevice/ClientManager.js.map +1 -1
  153. package/build/src/run/ios/appleDevice/client/AFCClient.js +10 -16
  154. package/build/src/run/ios/appleDevice/client/AFCClient.js.map +1 -1
  155. package/build/src/run/ios/appleDevice/client/DebugserverClient.js +1 -1
  156. package/build/src/run/ios/appleDevice/client/DebugserverClient.js.map +1 -1
  157. package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js +2 -1
  158. package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js.map +1 -1
  159. package/build/src/run/ios/appleDevice/client/LockdowndClient.js +1 -1
  160. package/build/src/run/ios/appleDevice/client/LockdowndClient.js.map +1 -1
  161. package/build/src/run/ios/appleDevice/client/MobileImageMounterClient.js.map +1 -1
  162. package/build/src/run/ios/appleDevice/client/ServiceClient.js +3 -3
  163. package/build/src/run/ios/appleDevice/client/ServiceClient.js.map +1 -1
  164. package/build/src/run/ios/appleDevice/client/UsbmuxdClient.js.map +1 -1
  165. package/build/src/run/ios/appleDevice/installOnDeviceAsync.js +3 -3
  166. package/build/src/run/ios/appleDevice/installOnDeviceAsync.js.map +1 -1
  167. package/build/src/run/ios/appleDevice/protocol/AFCProtocol.js +16 -13
  168. package/build/src/run/ios/appleDevice/protocol/AFCProtocol.js.map +1 -1
  169. package/build/src/run/ios/appleDevice/protocol/AbstractProtocol.js +6 -6
  170. package/build/src/run/ios/appleDevice/protocol/AbstractProtocol.js.map +1 -1
  171. package/build/src/run/ios/appleDevice/protocol/GDBProtocol.js +5 -5
  172. package/build/src/run/ios/appleDevice/protocol/GDBProtocol.js.map +1 -1
  173. package/build/src/run/ios/appleDevice/protocol/LockdownProtocol.js +7 -7
  174. package/build/src/run/ios/appleDevice/protocol/LockdownProtocol.js.map +1 -1
  175. package/build/src/run/ios/appleDevice/protocol/UsbmuxProtocol.js +5 -5
  176. package/build/src/run/ios/appleDevice/protocol/UsbmuxProtocol.js.map +1 -1
  177. package/build/src/run/ios/codeSigning/Security.js +8 -8
  178. package/build/src/run/ios/codeSigning/Security.js.map +1 -1
  179. package/build/src/run/ios/codeSigning/configureCodeSigning.js +5 -3
  180. package/build/src/run/ios/codeSigning/configureCodeSigning.js.map +1 -1
  181. package/build/src/run/ios/codeSigning/resolveCertificateSigningIdentity.js +7 -5
  182. package/build/src/run/ios/codeSigning/resolveCertificateSigningIdentity.js.map +1 -1
  183. package/build/src/run/ios/codeSigning/settings.js +3 -3
  184. package/build/src/run/ios/codeSigning/settings.js.map +1 -1
  185. package/build/src/run/ios/codeSigning/xcodeCodeSigning.js +4 -4
  186. package/build/src/run/ios/codeSigning/xcodeCodeSigning.js.map +1 -1
  187. package/build/src/run/ios/index.js +8 -1
  188. package/build/src/run/ios/index.js.map +1 -1
  189. package/build/src/run/ios/launchApp.js +3 -3
  190. package/build/src/run/ios/launchApp.js.map +1 -1
  191. package/build/src/run/ios/options/appleDestinations.js.map +1 -1
  192. package/build/src/run/ios/options/promptDevice.js +3 -3
  193. package/build/src/run/ios/options/promptDevice.js.map +1 -1
  194. package/build/src/run/ios/options/resolveDevice.js +8 -3
  195. package/build/src/run/ios/options/resolveDevice.js.map +1 -1
  196. package/build/src/run/ios/options/resolveNativeScheme.js +4 -4
  197. package/build/src/run/ios/options/resolveNativeScheme.js.map +1 -1
  198. package/build/src/run/ios/options/resolveOptions.js +9 -4
  199. package/build/src/run/ios/options/resolveOptions.js.map +1 -1
  200. package/build/src/run/ios/options/resolveXcodeProject.js.map +1 -1
  201. package/build/src/run/ios/runIosAsync.js +39 -0
  202. package/build/src/run/ios/runIosAsync.js.map +1 -1
  203. package/build/src/run/ios/validateExternalBinary.js.map +1 -1
  204. package/build/src/run/startBundler.js +4 -0
  205. package/build/src/run/startBundler.js.map +1 -1
  206. package/build/src/serve/index.js +4 -1
  207. package/build/src/serve/index.js.map +1 -1
  208. package/build/src/serve/serveAsync.js +23 -11
  209. package/build/src/serve/serveAsync.js.map +1 -1
  210. package/build/src/serve/static.js +69 -0
  211. package/build/src/serve/static.js.map +1 -0
  212. package/build/src/start/checkDependenciesOnStart.js +131 -0
  213. package/build/src/start/checkDependenciesOnStart.js.map +1 -0
  214. package/build/src/start/detectDevClient.js +3 -3
  215. package/build/src/start/detectDevClient.js.map +1 -1
  216. package/build/src/start/doctor/Prerequisite.js +4 -4
  217. package/build/src/start/doctor/Prerequisite.js.map +1 -1
  218. package/build/src/start/doctor/apple/SimulatorAppPrerequisite.js +53 -91
  219. package/build/src/start/doctor/apple/SimulatorAppPrerequisite.js.map +1 -1
  220. package/build/src/start/doctor/apple/XcodePrerequisite.js +3 -3
  221. package/build/src/start/doctor/apple/XcodePrerequisite.js.map +1 -1
  222. package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js +3 -3
  223. package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js.map +1 -1
  224. package/build/src/start/doctor/dependencies/getMissingPackages.js +5 -5
  225. package/build/src/start/doctor/dependencies/getMissingPackages.js.map +1 -1
  226. package/build/src/start/doctor/dependencies/getVersionedPackages.js +5 -5
  227. package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
  228. package/build/src/start/doctor/dependencies/reactNativeTv.js +149 -0
  229. package/build/src/start/doctor/dependencies/reactNativeTv.js.map +1 -0
  230. package/build/src/start/doctor/dependencies/resolvePackages.js +4 -4
  231. package/build/src/start/doctor/dependencies/resolvePackages.js.map +1 -1
  232. package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +33 -8
  233. package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -1
  234. package/build/src/start/doctor/ngrok/ExternalModule.js +3 -3
  235. package/build/src/start/doctor/ngrok/ExternalModule.js.map +1 -1
  236. package/build/src/start/doctor/ngrok/NgrokResolver.js +3 -3
  237. package/build/src/start/doctor/ngrok/NgrokResolver.js.map +1 -1
  238. package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js.map +1 -1
  239. package/build/src/start/doctor/typescript/updateTSConfig.js +3 -3
  240. package/build/src/start/doctor/typescript/updateTSConfig.js.map +1 -1
  241. package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js +5 -12
  242. package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js.map +1 -1
  243. package/build/src/start/index.js +2 -0
  244. package/build/src/start/index.js.map +1 -1
  245. package/build/src/start/interface/KeyPressHandler.js.map +1 -1
  246. package/build/src/start/interface/cliExtensionMenuItemHandler.js.map +1 -1
  247. package/build/src/start/interface/commandsTable.js +6 -6
  248. package/build/src/start/interface/commandsTable.js.map +1 -1
  249. package/build/src/start/interface/createDevToolsMenuItems.js.map +1 -1
  250. package/build/src/start/interface/interactiveActions.js +49 -6
  251. package/build/src/start/interface/interactiveActions.js.map +1 -1
  252. package/build/src/start/interface/startInterface.js +13 -4
  253. package/build/src/start/interface/startInterface.js.map +1 -1
  254. package/build/src/start/platforms/AppIdResolver.js +4 -0
  255. package/build/src/start/platforms/AppIdResolver.js.map +1 -1
  256. package/build/src/start/platforms/DeviceManager.js.map +1 -1
  257. package/build/src/start/platforms/ExpoGoInstaller.js +13 -4
  258. package/build/src/start/platforms/ExpoGoInstaller.js.map +1 -1
  259. package/build/src/start/platforms/PlatformManager.js.map +1 -1
  260. package/build/src/start/platforms/android/AndroidAppIdResolver.js.map +1 -1
  261. package/build/src/start/platforms/android/AndroidDeviceManager.js.map +1 -1
  262. package/build/src/start/platforms/android/AndroidPlatformManager.js.map +1 -1
  263. package/build/src/start/platforms/android/activateWindow.js.map +1 -1
  264. package/build/src/start/platforms/android/adb.js +36 -34
  265. package/build/src/start/platforms/android/adb.js.map +1 -1
  266. package/build/src/start/platforms/android/adbReverse.js +4 -4
  267. package/build/src/start/platforms/android/adbReverse.js.map +1 -1
  268. package/build/src/start/platforms/android/emulator.js +5 -5
  269. package/build/src/start/platforms/android/emulator.js.map +1 -1
  270. package/build/src/start/platforms/android/getDevices.js.map +1 -1
  271. package/build/src/start/platforms/android/gradle.js +5 -5
  272. package/build/src/start/platforms/android/gradle.js.map +1 -1
  273. package/build/src/start/platforms/android/promptAndroidDevice.js +3 -3
  274. package/build/src/start/platforms/android/promptAndroidDevice.js.map +1 -1
  275. package/build/src/start/platforms/ios/AppleAppIdResolver.js.map +1 -1
  276. package/build/src/start/platforms/ios/AppleDeviceManager.js +20 -6
  277. package/build/src/start/platforms/ios/AppleDeviceManager.js.map +1 -1
  278. package/build/src/start/platforms/ios/ApplePlatformManager.js +11 -0
  279. package/build/src/start/platforms/ios/ApplePlatformManager.js.map +1 -1
  280. package/build/src/start/platforms/ios/devicectl.js +7 -7
  281. package/build/src/start/platforms/ios/devicectl.js.map +1 -1
  282. package/build/src/start/platforms/ios/ensureSimulatorAppRunning.js +26 -11
  283. package/build/src/start/platforms/ios/ensureSimulatorAppRunning.js.map +1 -1
  284. package/build/src/start/platforms/ios/getBestSimulator.js +5 -5
  285. package/build/src/start/platforms/ios/getBestSimulator.js.map +1 -1
  286. package/build/src/start/platforms/ios/promptAppleDevice.js +5 -4
  287. package/build/src/start/platforms/ios/promptAppleDevice.js.map +1 -1
  288. package/build/src/start/platforms/ios/simctl.js +25 -19
  289. package/build/src/start/platforms/ios/simctl.js.map +1 -1
  290. package/build/src/start/platforms/ios/simctlLogging.js +3 -3
  291. package/build/src/start/platforms/ios/simctlLogging.js.map +1 -1
  292. package/build/src/start/platforms/ios/xcrun.js +3 -3
  293. package/build/src/start/platforms/ios/xcrun.js.map +1 -1
  294. package/build/src/start/project/devices.js +6 -6
  295. package/build/src/start/project/devices.js.map +1 -1
  296. package/build/src/start/project/dotExpo.js +4 -3
  297. package/build/src/start/project/dotExpo.js.map +1 -1
  298. package/build/src/start/resolveOptions.js +7 -7
  299. package/build/src/start/resolveOptions.js.map +1 -1
  300. package/build/src/start/server/AsyncNgrok.js +1 -1
  301. package/build/src/start/server/AsyncNgrok.js.map +1 -1
  302. package/build/src/start/server/AsyncWsTunnel.js +120 -35
  303. package/build/src/start/server/AsyncWsTunnel.js.map +1 -1
  304. package/build/src/start/server/Bonjour.js +8 -3
  305. package/build/src/start/server/Bonjour.js.map +1 -1
  306. package/build/src/start/server/BundlerDevServer.js +23 -9
  307. package/build/src/start/server/BundlerDevServer.js.map +1 -1
  308. package/build/src/start/server/DevServerManager.js.map +1 -1
  309. package/build/src/start/server/DevToolsPlugin.js +63 -3
  310. package/build/src/start/server/DevToolsPlugin.js.map +1 -1
  311. package/build/src/start/server/DevToolsPlugin.schema.js +8 -3
  312. package/build/src/start/server/DevToolsPlugin.schema.js.map +1 -1
  313. package/build/src/start/server/DevToolsPluginCliExtensionExecutor.js +58 -23
  314. package/build/src/start/server/DevToolsPluginCliExtensionExecutor.js.map +1 -1
  315. package/build/src/start/server/DevToolsPluginCliExtensionResults.js +29 -0
  316. package/build/src/start/server/DevToolsPluginCliExtensionResults.js.map +1 -1
  317. package/build/src/start/server/DevToolsPluginManager.js +20 -6
  318. package/build/src/start/server/DevToolsPluginManager.js.map +1 -1
  319. package/build/src/start/server/DevToolsPluginServerHelpers.js +83 -0
  320. package/build/src/start/server/DevToolsPluginServerHelpers.js.map +1 -0
  321. package/build/src/start/server/DevelopmentSession.js +41 -24
  322. package/build/src/start/server/DevelopmentSession.js.map +1 -1
  323. package/build/src/start/server/MCP.js +10 -3
  324. package/build/src/start/server/MCP.js.map +1 -1
  325. package/build/src/start/server/MCPDevToolsPluginCLIExtensions.js +15 -5
  326. package/build/src/start/server/MCPDevToolsPluginCLIExtensions.js.map +1 -1
  327. package/build/src/start/server/UrlCreator.js +14 -1
  328. package/build/src/start/server/UrlCreator.js.map +1 -1
  329. package/build/src/start/server/createMCPDevToolsExtensionSchema.js +18 -4
  330. package/build/src/start/server/createMCPDevToolsExtensionSchema.js.map +1 -1
  331. package/build/src/start/server/getStaticRenderFunctions.js +13 -24
  332. package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
  333. package/build/src/start/server/metro/MetroBundlerDevServer.js +239 -108
  334. package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
  335. package/build/src/start/server/metro/MetroTerminalReporter.js +67 -16
  336. package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
  337. package/build/src/start/server/metro/TerminalReporter.js +22 -4
  338. package/build/src/start/server/metro/TerminalReporter.js.map +1 -1
  339. package/build/src/start/server/metro/createExpoAutolinkingResolver.js +25 -12
  340. package/build/src/start/server/metro/createExpoAutolinkingResolver.js.map +1 -1
  341. package/build/src/start/server/metro/createExpoFallbackResolver.js.map +1 -1
  342. package/build/src/start/server/metro/createFileMap-fork.js +196 -0
  343. package/build/src/start/server/metro/createFileMap-fork.js.map +1 -0
  344. package/build/src/start/server/metro/createServerComponentsMiddleware.js +22 -22
  345. package/build/src/start/server/metro/createServerComponentsMiddleware.js.map +1 -1
  346. package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
  347. package/build/src/start/server/metro/createTypescriptResolver.js +410 -0
  348. package/build/src/start/server/metro/createTypescriptResolver.js.map +1 -0
  349. package/build/src/start/server/metro/debugging/MessageHandler.js.map +1 -1
  350. package/build/src/start/server/metro/debugging/attachAtlas.js +3 -3
  351. package/build/src/start/server/metro/debugging/attachAtlas.js.map +1 -1
  352. package/build/src/start/server/metro/debugging/createDebugMiddleware.js +6 -5
  353. package/build/src/start/server/metro/debugging/createDebugMiddleware.js.map +1 -1
  354. package/build/src/start/server/metro/debugging/createHandlersFactory.js.map +1 -1
  355. package/build/src/start/server/metro/debugging/messageHandlers/NetworkResponse.js +20 -4
  356. package/build/src/start/server/metro/debugging/messageHandlers/NetworkResponse.js.map +1 -1
  357. package/build/src/start/server/metro/debugging/pageIsSupported.js.map +1 -1
  358. package/build/src/start/server/metro/dev-server/compression.js.map +1 -1
  359. package/build/src/start/server/metro/dev-server/createMessageSocket.js +13 -2
  360. package/build/src/start/server/metro/dev-server/createMessageSocket.js.map +1 -1
  361. package/build/src/start/server/metro/dev-server/createMetroMiddleware.js +9 -2
  362. package/build/src/start/server/metro/dev-server/createMetroMiddleware.js.map +1 -1
  363. package/build/src/start/server/metro/dev-server/utils/socketMessages.js +3 -3
  364. package/build/src/start/server/metro/dev-server/utils/socketMessages.js.map +1 -1
  365. package/build/src/start/server/metro/errors/FailedToResolveNativeOnlyModuleError.js.map +1 -1
  366. package/build/src/start/server/metro/externals.js +4 -4
  367. package/build/src/start/server/metro/externals.js.map +1 -1
  368. package/build/src/start/server/metro/fetchRouterManifest.js +3 -3
  369. package/build/src/start/server/metro/fetchRouterManifest.js.map +1 -1
  370. package/build/src/start/server/metro/getCssModulesFromBundler.js +3 -3
  371. package/build/src/start/server/metro/getCssModulesFromBundler.js.map +1 -1
  372. package/build/src/start/server/metro/instantiateMetro.js +141 -57
  373. package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
  374. package/build/src/start/server/metro/log-box/LogBoxLog.js.map +1 -1
  375. package/build/src/start/server/metro/log-box/LogBoxSymbolication.js +4 -4
  376. package/build/src/start/server/metro/log-box/LogBoxSymbolication.js.map +1 -1
  377. package/build/src/start/server/metro/log-box/formatProjectFilePath.js +3 -3
  378. package/build/src/start/server/metro/log-box/formatProjectFilePath.js.map +1 -1
  379. package/build/src/start/server/metro/metroErrorInterface.js +16 -13
  380. package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
  381. package/build/src/start/server/metro/metroErrors.js +3 -3
  382. package/build/src/start/server/metro/metroErrors.js.map +1 -1
  383. package/build/src/start/server/metro/metroWatchTypeScriptFiles.js +48 -16
  384. package/build/src/start/server/metro/metroWatchTypeScriptFiles.js.map +1 -1
  385. package/build/src/start/server/metro/resolveLoader.js +3 -3
  386. package/build/src/start/server/metro/resolveLoader.js.map +1 -1
  387. package/build/src/start/server/metro/router.js +23 -14
  388. package/build/src/start/server/metro/router.js.map +1 -1
  389. package/build/src/start/server/metro/runServer-fork.js +13 -10
  390. package/build/src/start/server/metro/runServer-fork.js.map +1 -1
  391. package/build/src/start/server/metro/serializeHtml.js +29 -13
  392. package/build/src/start/server/metro/serializeHtml.js.map +1 -1
  393. package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js +36 -34
  394. package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js.map +1 -1
  395. package/build/src/start/server/metro/withMetroErrorReportingResolver.js +53 -30
  396. package/build/src/start/server/metro/withMetroErrorReportingResolver.js.map +1 -1
  397. package/build/src/start/server/metro/withMetroMultiPlatform.js +187 -126
  398. package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
  399. package/build/src/start/server/metro/withMetroResolvers.js +4 -4
  400. package/build/src/start/server/metro/withMetroResolvers.js.map +1 -1
  401. package/build/src/start/server/middleware/ContextModuleSourceMapsMiddleware.js.map +1 -1
  402. package/build/src/start/server/middleware/CorsMiddleware.js +3 -3
  403. package/build/src/start/server/middleware/CorsMiddleware.js.map +1 -1
  404. package/build/src/start/server/middleware/CreateFileMiddleware.js.map +1 -1
  405. package/build/src/start/server/middleware/DevToolsPluginMiddleware.js +60 -9
  406. package/build/src/start/server/middleware/DevToolsPluginMiddleware.js.map +1 -1
  407. package/build/src/start/server/middleware/DomComponentsMiddleware.js +16 -12
  408. package/build/src/start/server/middleware/DomComponentsMiddleware.js.map +1 -1
  409. package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js +6 -4
  410. package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js.map +1 -1
  411. package/build/src/start/server/middleware/ExpoMiddleware.js +3 -3
  412. package/build/src/start/server/middleware/ExpoMiddleware.js.map +1 -1
  413. package/build/src/start/server/middleware/FaviconMiddleware.js.map +1 -1
  414. package/build/src/start/server/middleware/HistoryFallbackMiddleware.js.map +1 -1
  415. package/build/src/start/server/middleware/InterstitialPageMiddleware.js +13 -8
  416. package/build/src/start/server/middleware/InterstitialPageMiddleware.js.map +1 -1
  417. package/build/src/start/server/middleware/ManifestMiddleware.js +15 -6
  418. package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
  419. package/build/src/start/server/middleware/OpenMiddleware.js +150 -0
  420. package/build/src/start/server/middleware/OpenMiddleware.js.map +1 -0
  421. package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js +13 -4
  422. package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js.map +1 -1
  423. package/build/src/start/server/middleware/ServeStaticMiddleware.js +2 -9
  424. package/build/src/start/server/middleware/ServeStaticMiddleware.js.map +1 -1
  425. package/build/src/start/server/middleware/domPolyfills.js +60 -0
  426. package/build/src/start/server/middleware/domPolyfills.js.map +1 -0
  427. package/build/src/start/server/middleware/inspector/JsInspector.js +6 -31
  428. package/build/src/start/server/middleware/inspector/JsInspector.js.map +1 -1
  429. package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js +14 -24
  430. package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js.map +1 -1
  431. package/build/src/start/server/middleware/inspector/middlwareMutations.js +3 -3
  432. package/build/src/start/server/middleware/inspector/middlwareMutations.js.map +1 -1
  433. package/build/src/start/server/middleware/metroOptions.js +15 -14
  434. package/build/src/start/server/middleware/metroOptions.js.map +1 -1
  435. package/build/src/start/server/middleware/mutations.js +3 -3
  436. package/build/src/start/server/middleware/mutations.js.map +1 -1
  437. package/build/src/start/server/middleware/openHandlers.js +157 -0
  438. package/build/src/start/server/middleware/openHandlers.js.map +1 -0
  439. package/build/src/start/server/middleware/resolveAssets.js +4 -4
  440. package/build/src/start/server/middleware/resolveAssets.js.map +1 -1
  441. package/build/src/start/server/middleware/resolvePlatform.js +9 -7
  442. package/build/src/start/server/middleware/resolvePlatform.js.map +1 -1
  443. package/build/src/start/server/middleware/resolveRuntimeVersionWithExpoUpdatesAsync.js.map +1 -1
  444. package/build/src/start/server/openPlatforms.js.map +1 -1
  445. package/build/src/start/server/platformBundlers.js +3 -1
  446. package/build/src/start/server/platformBundlers.js.map +1 -1
  447. package/build/src/start/server/serverLogLikeMetro.js +13 -36
  448. package/build/src/start/server/serverLogLikeMetro.js.map +1 -1
  449. package/build/src/start/server/type-generation/expo-env.js +3 -3
  450. package/build/src/start/server/type-generation/expo-env.js.map +1 -1
  451. package/build/src/start/server/type-generation/routes.js +14 -55
  452. package/build/src/start/server/type-generation/routes.js.map +1 -1
  453. package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js.map +1 -1
  454. package/build/src/start/server/type-generation/tsconfig.js +5 -5
  455. package/build/src/start/server/type-generation/tsconfig.js.map +1 -1
  456. package/build/src/start/server/webTemplate.js +12 -10
  457. package/build/src/start/server/webTemplate.js.map +1 -1
  458. package/build/src/start/server/webpack/WebpackBundlerDevServer.js +3 -3
  459. package/build/src/start/server/webpack/WebpackBundlerDevServer.js.map +1 -1
  460. package/build/src/start/server/webpack/formatWebpackMessages.js.map +1 -1
  461. package/build/src/start/server/webpack/resolveFromProject.js +4 -4
  462. package/build/src/start/server/webpack/resolveFromProject.js.map +1 -1
  463. package/build/src/start/server/webpack/tls.js +3 -3
  464. package/build/src/start/server/webpack/tls.js.map +1 -1
  465. package/build/src/start/startAsync.js +21 -11
  466. package/build/src/start/startAsync.js.map +1 -1
  467. package/build/src/types.d.ts +2 -0
  468. package/build/src/utils/FileNotifier.js +1 -1
  469. package/build/src/utils/FileNotifier.js.map +1 -1
  470. package/build/src/utils/args.js +5 -5
  471. package/build/src/utils/args.js.map +1 -1
  472. package/build/src/utils/array.js +8 -8
  473. package/build/src/utils/array.js.map +1 -1
  474. package/build/src/utils/build-cache-providers/helpers.js +4 -4
  475. package/build/src/utils/build-cache-providers/helpers.js.map +1 -1
  476. package/build/src/utils/build-cache-providers/index.js +5 -5
  477. package/build/src/utils/build-cache-providers/index.js.map +1 -1
  478. package/build/src/utils/cocoapods.js +5 -5
  479. package/build/src/utils/cocoapods.js.map +1 -1
  480. package/build/src/utils/codesigning.js +12 -6
  481. package/build/src/utils/codesigning.js.map +1 -1
  482. package/build/src/utils/composeMetroIgnorePatterns.js +69 -0
  483. package/build/src/utils/composeMetroIgnorePatterns.js.map +1 -0
  484. package/build/src/utils/createTempPath.js +3 -3
  485. package/build/src/utils/createTempPath.js.map +1 -1
  486. package/build/src/utils/delay.js +4 -4
  487. package/build/src/utils/delay.js.map +1 -1
  488. package/build/src/utils/dir.js +21 -11
  489. package/build/src/utils/dir.js.map +1 -1
  490. package/build/src/utils/downloadAppAsync.js.map +1 -1
  491. package/build/src/utils/downloadExpoGoAsync.js +4 -4
  492. package/build/src/utils/downloadExpoGoAsync.js.map +1 -1
  493. package/build/src/utils/editor.js +4 -4
  494. package/build/src/utils/editor.js.map +1 -1
  495. package/build/src/utils/env.js +39 -13
  496. package/build/src/utils/env.js.map +1 -1
  497. package/build/src/utils/errors.js +6 -6
  498. package/build/src/utils/errors.js.map +1 -1
  499. package/build/src/utils/exit.js +15 -19
  500. package/build/src/utils/exit.js.map +1 -1
  501. package/build/src/utils/expoUpdatesCli.js +5 -5
  502. package/build/src/utils/expoUpdatesCli.js.map +1 -1
  503. package/build/src/utils/fetch.js +4 -4
  504. package/build/src/utils/fetch.js.map +1 -1
  505. package/build/src/utils/findUp.js +3 -3
  506. package/build/src/utils/findUp.js.map +1 -1
  507. package/build/src/utils/fn.js +3 -3
  508. package/build/src/utils/fn.js.map +1 -1
  509. package/build/src/utils/freeport.js +3 -3
  510. package/build/src/utils/freeport.js.map +1 -1
  511. package/build/src/utils/getOrPromptApplicationId.js +3 -5
  512. package/build/src/utils/getOrPromptApplicationId.js.map +1 -1
  513. package/build/src/utils/getRunningProcess.js +5 -5
  514. package/build/src/utils/getRunningProcess.js.map +1 -1
  515. package/build/src/utils/git.js +3 -3
  516. package/build/src/utils/git.js.map +1 -1
  517. package/build/src/utils/glob.js +3 -3
  518. package/build/src/utils/glob.js.map +1 -1
  519. package/build/src/utils/ip.js +4 -4
  520. package/build/src/utils/ip.js.map +1 -1
  521. package/build/src/utils/link.js +3 -3
  522. package/build/src/utils/link.js.map +1 -1
  523. package/build/src/utils/mergeGitIgnorePaths.js +10 -10
  524. package/build/src/utils/mergeGitIgnorePaths.js.map +1 -1
  525. package/build/src/utils/modifyConfigAsync.js +3 -3
  526. package/build/src/utils/modifyConfigAsync.js.map +1 -1
  527. package/build/src/utils/net.js +23 -4
  528. package/build/src/utils/net.js.map +1 -1
  529. package/build/src/utils/nodeEnv.js +6 -6
  530. package/build/src/utils/nodeEnv.js.map +1 -1
  531. package/build/src/utils/npm.js +10 -9
  532. package/build/src/utils/npm.js.map +1 -1
  533. package/build/src/utils/obj.js +4 -4
  534. package/build/src/utils/obj.js.map +1 -1
  535. package/build/src/utils/open.js +240 -11
  536. package/build/src/utils/open.js.map +1 -1
  537. package/build/src/utils/ora.js +4 -4
  538. package/build/src/utils/ora.js.map +1 -1
  539. package/build/src/utils/plist.js +5 -4
  540. package/build/src/utils/plist.js.map +1 -1
  541. package/build/src/utils/port.js +12 -5
  542. package/build/src/utils/port.js.map +1 -1
  543. package/build/src/utils/progress.js +4 -4
  544. package/build/src/utils/progress.js.map +1 -1
  545. package/build/src/utils/prompts.js +11 -11
  546. package/build/src/utils/prompts.js.map +1 -1
  547. package/build/src/utils/qr.js +5 -4
  548. package/build/src/utils/qr.js.map +1 -1
  549. package/build/src/utils/resolveArgs.js +10 -9
  550. package/build/src/utils/resolveArgs.js.map +1 -1
  551. package/build/src/utils/scheme.js +4 -4
  552. package/build/src/utils/scheme.js.map +1 -1
  553. package/build/src/utils/strings.js.map +1 -1
  554. package/build/src/utils/tar.js +8 -7
  555. package/build/src/utils/tar.js.map +1 -1
  556. package/build/src/utils/telemetry/Telemetry.js +5 -0
  557. package/build/src/utils/telemetry/Telemetry.js.map +1 -1
  558. package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
  559. package/build/src/utils/telemetry/clients/FetchClient.js.map +1 -1
  560. package/build/src/utils/telemetry/clients/flushFetchDetached.js +5 -1
  561. package/build/src/utils/telemetry/clients/flushFetchDetached.js.map +1 -1
  562. package/build/src/utils/telemetry/index.js +4 -4
  563. package/build/src/utils/telemetry/index.js.map +1 -1
  564. package/build/src/utils/telemetry/utils/agent.js +42 -0
  565. package/build/src/utils/telemetry/utils/agent.js.map +1 -0
  566. package/build/src/utils/telemetry/utils/constants.js +3 -3
  567. package/build/src/utils/telemetry/utils/constants.js.map +1 -1
  568. package/build/src/utils/telemetry/utils/context.js +3 -2
  569. package/build/src/utils/telemetry/utils/context.js.map +1 -1
  570. package/build/src/utils/url.js +5 -17
  571. package/build/src/utils/url.js.map +1 -1
  572. package/build/src/utils/validateApplicationId.js +12 -12
  573. package/build/src/utils/validateApplicationId.js.map +1 -1
  574. package/build/src/utils/variadic.js +4 -4
  575. package/build/src/utils/variadic.js.map +1 -1
  576. package/build/src/whoami/index.js.map +1 -1
  577. package/changes.json +18 -26
  578. package/main.js +3 -0
  579. package/package.json +88 -80
  580. package/static/loading-page/index.html +45 -3
  581. package/static/template/+html.tsx +14 -5
  582. package/add-module.js +0 -8
  583. package/build/src/start/server/middleware/inspector/CdpClient.js +0 -81
  584. package/build/src/start/server/middleware/inspector/CdpClient.js.map +0 -1
  585. package/build/src/utils/resolveWatchFolders.js +0 -67
  586. package/build/src/utils/resolveWatchFolders.js.map +0 -1
  587. package/build/src/utils/tsconfig/evaluateTsConfig.js +0 -87
  588. package/build/src/utils/tsconfig/evaluateTsConfig.js.map +0 -1
  589. package/build/src/utils/tsconfig/loadTsConfigPaths.js +0 -84
  590. package/build/src/utils/tsconfig/loadTsConfigPaths.js.map +0 -1
  591. package/build/src/utils/tsconfig/matchTsConfigPathAlias.js +0 -94
  592. package/build/src/utils/tsconfig/matchTsConfigPathAlias.js.map +0 -1
  593. package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js +0 -62
  594. package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/customize/templates.ts"],"sourcesContent":["import chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport prompt, { ExpoChoice } from '../utils/prompts';\n\nconst debug = require('debug')('expo:customize:templates');\n\nexport type DestinationResolutionProps = {\n /** Web 'public' folder path (defaults to `/web`). This technically can be changed but shouldn't be. */\n webStaticPath: string;\n /** The Expo Router app directory. */\n appDirPath: string;\n};\n\nfunction importFromExpoWebpackConfig(projectRoot: string, folder: string, moduleId: string) {\n try {\n const filePath = resolveFrom(projectRoot, `@expo/webpack-config/${folder}/${moduleId}`);\n debug(`Using @expo/webpack-config template for \"${moduleId}\": ${filePath}`);\n return filePath;\n } catch {\n debug(`@expo/webpack-config template for \"${moduleId}\" not found, falling back on @expo/cli`);\n }\n return importFromVendor(projectRoot, moduleId);\n}\n\nfunction importFromVendor(projectRoot: string, moduleId: string) {\n try {\n const filePath = resolveFrom(projectRoot, '@expo/cli/static/template/' + moduleId);\n debug(`Using @expo/cli template for \"${moduleId}\": ${filePath}`);\n return filePath;\n } catch {\n // For dev mode, testing and other cases where @expo/cli is not installed\n const filePath = require.resolve(`@expo/cli/static/template/${moduleId}`);\n debug(\n `Local @expo/cli template for \"${moduleId}\" not found, falling back on template relative to @expo/cli: ${filePath}`\n );\n\n return filePath;\n }\n}\n\nexport const TEMPLATES: {\n /** Unique ID for easily indexing. */\n id: string;\n /** Template file path to copy into the project. */\n file: (projectRoot: string) => string;\n /** Output location for the file in the user project. */\n destination: (props: DestinationResolutionProps) => string;\n /** List of dependencies to install in the project. These are used inside of the template file. */\n dependencies: string[];\n\n /** Custom step for configuring the file. Return true to exit early. */\n configureAsync?: (projectRoot: string) => Promise<boolean>;\n}[] = [\n {\n id: 'babel.config.js',\n file: (projectRoot) => importFromVendor(projectRoot, 'babel.config.js'),\n destination: () => 'babel.config.js',\n dependencies: [\n // Even though this is installed in `expo`, we should add it for now.\n 'babel-preset-expo',\n ],\n },\n {\n id: 'metro.config.js',\n dependencies: ['@expo/metro-config'],\n destination: () => 'metro.config.js',\n file: (projectRoot) => importFromVendor(projectRoot, 'metro.config.js'),\n },\n {\n // `tsconfig.json` is special-cased and doesn't follow the template.\n id: 'tsconfig.json',\n dependencies: [],\n destination: () => 'tsconfig.json',\n file: () => '',\n configureAsync: async (projectRoot) => {\n const { typescript } = require('./typescript') as typeof import('./typescript');\n await typescript(projectRoot);\n return true;\n },\n },\n {\n id: '.eslintrc.js',\n dependencies: [],\n destination: () => '.eslintrc.js (deprecated)',\n file: (projectRoot) => importFromVendor(projectRoot, '.eslintrc.js'),\n configureAsync: async (projectRoot) => {\n const { ESLintProjectPrerequisite } =\n require('../lint/ESlintPrerequisite') as typeof import('../lint/ESlintPrerequisite.js');\n const prerequisite = new ESLintProjectPrerequisite(projectRoot);\n if (!(await prerequisite.assertAsync())) {\n await prerequisite.bootstrapAsync();\n }\n return false;\n },\n },\n {\n id: 'eslint.config.js',\n dependencies: [],\n destination: () => 'eslint.config.js',\n file: (projectRoot) => importFromVendor(projectRoot, 'eslint.config.js'),\n configureAsync: async (projectRoot) => {\n const { ESLintProjectPrerequisite } =\n require('../lint/ESlintPrerequisite') as typeof import('../lint/ESlintPrerequisite.js');\n const prerequisite = new ESLintProjectPrerequisite(projectRoot);\n if (!(await prerequisite.assertAsync())) {\n await prerequisite.bootstrapAsync();\n }\n return false;\n },\n },\n {\n id: 'index.html',\n file: (projectRoot) => importFromExpoWebpackConfig(projectRoot, 'web-default', 'index.html'),\n // web/index.html\n destination: ({ webStaticPath }) => webStaticPath + '/index.html',\n dependencies: [],\n },\n {\n id: 'webpack.config.js',\n file: (projectRoot) =>\n importFromExpoWebpackConfig(projectRoot, 'template', 'webpack.config.js'),\n destination: () => 'webpack.config.js',\n dependencies: ['@expo/webpack-config'],\n },\n {\n id: '+html.tsx',\n file: (projectRoot) => importFromVendor(projectRoot, '+html.tsx'),\n destination: ({ appDirPath }) => path.join(appDirPath, '+html.tsx'),\n dependencies: [],\n },\n {\n id: '+native-intent.ts',\n file: (projectRoot) => importFromVendor(projectRoot, '+native-intent.ts'),\n destination: ({ appDirPath }) => path.join(appDirPath, '+native-intent.ts'),\n dependencies: [],\n },\n];\n\n/** Generate the prompt choices. */\nfunction createChoices(\n projectRoot: string,\n props: DestinationResolutionProps\n): ExpoChoice<number>[] {\n return TEMPLATES.map((template, index) => {\n const destination = template.destination(props);\n const localProjectFile = path.resolve(projectRoot, destination);\n const exists = fs.existsSync(localProjectFile);\n\n return {\n title: destination,\n value: index,\n description: exists ? chalk.red('This will overwrite the existing file') : undefined,\n };\n });\n}\n\n/** Prompt to select templates to add. */\nexport async function selectTemplatesAsync(projectRoot: string, props: DestinationResolutionProps) {\n const options = createChoices(projectRoot, props);\n\n const { answer } = await prompt({\n type: 'multiselect',\n name: 'answer',\n message: 'Which files would you like to generate?',\n hint: '- Space to select. Return to submit',\n warn: 'File already exists.',\n limit: options.length,\n instructions: '',\n choices: options,\n });\n return answer;\n}\n"],"names":["TEMPLATES","selectTemplatesAsync","debug","require","importFromExpoWebpackConfig","projectRoot","folder","moduleId","filePath","resolveFrom","importFromVendor","resolve","id","file","destination","dependencies","configureAsync","typescript","ESLintProjectPrerequisite","prerequisite","assertAsync","bootstrapAsync","webStaticPath","appDirPath","path","join","createChoices","props","map","template","index","localProjectFile","exists","fs","existsSync","title","value","description","chalk","red","undefined","options","answer","prompt","type","name","message","hint","warn","limit","length","instructions","choices"],"mappings":";;;;;;;;;;;IA2CaA,SAAS;eAATA;;IAqHSC,oBAAoB;eAApBA;;;;gEAhKJ;;;;;;;gEACH;;;;;;;gEACE;;;;;;;gEACO;;;;;;gEAEW;;;;;;AAEnC,MAAMC,QAAQC,QAAQ,SAAS;AAS/B,SAASC,4BAA4BC,WAAmB,EAAEC,MAAc,EAAEC,QAAgB;IACxF,IAAI;QACF,MAAMC,WAAWC,IAAAA,sBAAW,EAACJ,aAAa,CAAC,qBAAqB,EAAEC,OAAO,CAAC,EAAEC,UAAU;QACtFL,MAAM,CAAC,yCAAyC,EAAEK,SAAS,GAAG,EAAEC,UAAU;QAC1E,OAAOA;IACT,EAAE,OAAM;QACNN,MAAM,CAAC,mCAAmC,EAAEK,SAAS,sCAAsC,CAAC;IAC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C;IAC/F,MAAMc,UAAUf,cAAcrB,aAAasB;IAE3C,MAAM,EAAEe,MAAM,EAAE,GAAG,MAAMC,IAAAA,gBAAM,EAAC;QAC9BC,MAAM;QACNC,MAAM;QACNC,SAAS;QACTC,MAAM;QACNC,MAAM;QACNC,OAAOR,QAAQS,MAAM;QACrBC,cAAc;QACdC,SAASX;IACX;IACA,OAAOC;AACT"}
1
+ {"version":3,"sources":["../../../src/customize/templates.ts"],"sourcesContent":["import chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport type { ExpoChoice } from '../utils/prompts';\nimport prompt from '../utils/prompts';\n\nconst debug = require('debug')('expo:customize:templates');\n\nexport type DestinationResolutionProps = {\n /** Web 'public' folder path (defaults to `/web`). This technically can be changed but shouldn't be. */\n webStaticPath: string;\n /** The Expo Router app directory. */\n appDirPath: string;\n};\n\nfunction importFromExpoWebpackConfig(projectRoot: string, folder: string, moduleId: string) {\n try {\n const filePath = resolveFrom(projectRoot, `@expo/webpack-config/${folder}/${moduleId}`);\n debug(`Using @expo/webpack-config template for \"${moduleId}\": ${filePath}`);\n return filePath;\n } catch {\n debug(`@expo/webpack-config template for \"${moduleId}\" not found, falling back on @expo/cli`);\n }\n return importFromVendor(projectRoot, moduleId);\n}\n\nfunction importFromVendor(projectRoot: string, moduleId: string) {\n try {\n const filePath = resolveFrom(projectRoot, '@expo/cli/static/template/' + moduleId);\n debug(`Using @expo/cli template for \"${moduleId}\": ${filePath}`);\n return filePath;\n } catch {\n // For dev mode, testing and other cases where @expo/cli is not installed\n const filePath = require.resolve(`@expo/cli/static/template/${moduleId}`);\n debug(\n `Local @expo/cli template for \"${moduleId}\" not found, falling back on template relative to @expo/cli: ${filePath}`\n );\n\n return filePath;\n }\n}\n\nexport const TEMPLATES: {\n /** Unique ID for easily indexing. */\n id: string;\n /** Template file path to copy into the project. */\n file: (projectRoot: string) => string;\n /** Output location for the file in the user project. */\n destination: (props: DestinationResolutionProps) => string;\n /** List of dependencies to install in the project. These are used inside of the template file. */\n dependencies: string[];\n\n /** Custom step for configuring the file. Return true to exit early. */\n configureAsync?: (projectRoot: string) => Promise<boolean>;\n}[] = [\n {\n id: 'babel.config.js',\n file: (projectRoot) => importFromVendor(projectRoot, 'babel.config.js'),\n destination: () => 'babel.config.js',\n dependencies: [\n // Even though this is installed in `expo`, we should add it for now.\n 'babel-preset-expo',\n ],\n },\n {\n id: 'metro.config.js',\n dependencies: [],\n destination: () => 'metro.config.js',\n file: (projectRoot) => importFromVendor(projectRoot, 'metro.config.js'),\n },\n {\n // `tsconfig.json` is special-cased and doesn't follow the template.\n id: 'tsconfig.json',\n dependencies: [],\n destination: () => 'tsconfig.json',\n file: () => '',\n configureAsync: async (projectRoot) => {\n const { typescript } = require('./typescript') as typeof import('./typescript');\n await typescript(projectRoot);\n return true;\n },\n },\n {\n id: '.eslintrc.js',\n dependencies: [],\n destination: () => '.eslintrc.js (deprecated)',\n file: (projectRoot) => importFromVendor(projectRoot, '.eslintrc.js'),\n configureAsync: async (projectRoot) => {\n const { ESLintProjectPrerequisite } =\n require('../lint/ESlintPrerequisite') as typeof import('../lint/ESlintPrerequisite.js');\n const prerequisite = new ESLintProjectPrerequisite(projectRoot);\n if (!(await prerequisite.assertAsync())) {\n await prerequisite.bootstrapAsync();\n }\n return false;\n },\n },\n {\n id: 'eslint.config.js',\n dependencies: [],\n destination: () => 'eslint.config.js',\n file: (projectRoot) => importFromVendor(projectRoot, 'eslint.config.js'),\n configureAsync: async (projectRoot) => {\n const { ESLintProjectPrerequisite } =\n require('../lint/ESlintPrerequisite') as typeof import('../lint/ESlintPrerequisite.js');\n const prerequisite = new ESLintProjectPrerequisite(projectRoot);\n if (!(await prerequisite.assertAsync())) {\n await prerequisite.bootstrapAsync();\n }\n return false;\n },\n },\n {\n id: 'index.html',\n file: (projectRoot) => importFromExpoWebpackConfig(projectRoot, 'web-default', 'index.html'),\n // web/index.html\n destination: ({ webStaticPath }) => webStaticPath + '/index.html',\n dependencies: [],\n },\n {\n id: 'webpack.config.js',\n file: (projectRoot) =>\n importFromExpoWebpackConfig(projectRoot, 'template', 'webpack.config.js'),\n destination: () => 'webpack.config.js',\n dependencies: ['@expo/webpack-config'],\n },\n {\n id: '+html.tsx',\n file: (projectRoot) => importFromVendor(projectRoot, '+html.tsx'),\n destination: ({ appDirPath }) => path.join(appDirPath, '+html.tsx'),\n dependencies: [],\n },\n {\n id: '+native-intent.ts',\n file: (projectRoot) => importFromVendor(projectRoot, '+native-intent.ts'),\n destination: ({ appDirPath }) => path.join(appDirPath, '+native-intent.ts'),\n dependencies: [],\n },\n];\n\n/** Generate the prompt choices. */\nfunction createChoices(\n projectRoot: string,\n props: DestinationResolutionProps\n): ExpoChoice<number>[] {\n return TEMPLATES.map((template, index) => {\n const destination = template.destination(props);\n const localProjectFile = path.resolve(projectRoot, destination);\n const exists = fs.existsSync(localProjectFile);\n\n return {\n title: destination,\n value: index,\n description: exists ? chalk.red('This will overwrite the existing file') : undefined,\n };\n });\n}\n\n/** Prompt to select templates to add. */\nexport async function selectTemplatesAsync(projectRoot: string, props: DestinationResolutionProps) {\n const options = createChoices(projectRoot, props);\n\n const { answer } = await prompt({\n type: 'multiselect',\n name: 'answer',\n message: 'Which files would you like to generate?',\n hint: '- Space to select. Return to submit',\n warn: 'File already exists.',\n limit: options.length,\n instructions: '',\n choices: options,\n });\n return answer;\n}\n"],"names":["TEMPLATES","selectTemplatesAsync","debug","require","importFromExpoWebpackConfig","projectRoot","folder","moduleId","filePath","resolveFrom","importFromVendor","resolve","id","file","destination","dependencies","configureAsync","typescript","ESLintProjectPrerequisite","prerequisite","assertAsync","bootstrapAsync","webStaticPath","appDirPath","path","join","createChoices","props","map","template","index","localProjectFile","exists","fs","existsSync","title","value","description","chalk","red","undefined","options","answer","prompt","type","name","message","hint","warn","limit","length","instructions","choices"],"mappings":";;;;;;;;;;;QA4CaA;eAAAA;;QAqHSC;eAAAA;;;;gEAjKJ;;;;;;;gEACH;;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GACjC,SAASW,cACPrB,WAAmB,EACnBsB,KAAiC;IAEjC,OAAO3B,UAAU4B,GAAG,CAAC,CAACC,UAAUC;QAC9B,MAAMhB,cAAce,SAASf,WAAW,CAACa;QACzC,MAAMI,mBAAmBP,eAAI,CAACb,OAAO,CAACN,aAAaS;QACnD,MAAMkB,SAASC,aAAE,CAACC,UAAU,CAACH;QAE7B,OAAO;YACLI,OAAOrB;YACPsB,OAAON;YACPO,aAAaL,SAASM,gBAAK,CAACC,GAAG,CAAC,2CAA2CC;QAC7E;IACF;AACF;AAGO,eAAevC,qBAAqBI,WAAmB,EAAEsB,KAAiC;IAC/F,MAAMc,UAAUf,cAAcrB,aAAasB;IAE3C,MAAM,EAAEe,MAAM,EAAE,GAAG,MAAMC,IAAAA,gBAAM,EAAC;QAC9BC,MAAM;QACNC,MAAM;QACNC,SAAS;QACTC,MAAM;QACNC,MAAM;QACNC,OAAOR,QAAQS,MAAM;QACrBC,cAAc;QACdC,SAASX;IACX;IACA,OAAOC;AACT"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/customize/typescript.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\n\nimport { Log } from '../log';\n\nexport async function typescript(projectRoot: string) {\n const { TypeScriptProjectPrerequisite } = await import(\n '../start/doctor/typescript/TypeScriptProjectPrerequisite.js'\n );\n const { MetroBundlerDevServer } = await import('../start/server/metro/MetroBundlerDevServer.js');\n const { getPlatformBundlers } = await import('../start/server/platformBundlers.js');\n\n try {\n await new TypeScriptProjectPrerequisite(projectRoot).bootstrapAsync();\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.exception(error);\n return;\n }\n\n const { exp } = getConfig(projectRoot, { skipSDKVersionRequirement: true });\n await new MetroBundlerDevServer(projectRoot, getPlatformBundlers(projectRoot, exp), {\n isDevClient: true,\n }).startTypeScriptServices();\n}\n"],"names":["typescript","projectRoot","TypeScriptProjectPrerequisite","MetroBundlerDevServer","getPlatformBundlers","bootstrapAsync","error","Log","log","exception","exp","getConfig","skipSDKVersionRequirement","isDevClient","startTypeScriptServices"],"mappings":";;;;+BAIsBA;;;eAAAA;;;;yBAJI;;;;;;qBAEN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEb,eAAeA,WAAWC,WAAmB;IAClD,MAAM,EAAEC,6BAA6B,EAAE,GAAG,MAAM,mEAAA,QAC9C;IAEF,MAAM,EAAEC,qBAAqB,EAAE,GAAG,MAAM,mEAAA,QAAO;IAC/C,MAAM,EAAEC,mBAAmB,EAAE,GAAG,MAAM,mEAAA,QAAO;IAE7C,IAAI;QACF,MAAM,IAAIF,8BAA8BD,aAAaI,cAAc;IACrE,EAAE,OAAOC,OAAY;QACnB,iEAAiE;QACjE,wCAAwC;QACxCC,QAAG,CAACC,GAAG;QACPD,QAAG,CAACE,SAAS,CAACH;QACd;IACF;IAEA,MAAM,EAAEI,GAAG,EAAE,GAAGC,IAAAA,mBAAS,EAACV,aAAa;QAAEW,2BAA2B;IAAK;IACzE,MAAM,IAAIT,sBAAsBF,aAAaG,oBAAoBH,aAAaS,MAAM;QAClFG,aAAa;IACf,GAAGC,uBAAuB;AAC5B"}
1
+ {"version":3,"sources":["../../../src/customize/typescript.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\n\nimport { Log } from '../log';\n\nexport async function typescript(projectRoot: string) {\n const { TypeScriptProjectPrerequisite } =\n await import('../start/doctor/typescript/TypeScriptProjectPrerequisite.js');\n const { MetroBundlerDevServer } = await import('../start/server/metro/MetroBundlerDevServer.js');\n const { getPlatformBundlers } = await import('../start/server/platformBundlers.js');\n\n try {\n await new TypeScriptProjectPrerequisite(projectRoot).bootstrapAsync();\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.exception(error);\n return;\n }\n\n const { exp } = getConfig(projectRoot, { skipSDKVersionRequirement: true });\n await new MetroBundlerDevServer(projectRoot, getPlatformBundlers(projectRoot, exp), {\n isDevClient: true,\n }).startTypeScriptServices();\n}\n"],"names":["typescript","projectRoot","TypeScriptProjectPrerequisite","MetroBundlerDevServer","getPlatformBundlers","bootstrapAsync","error","Log","log","exception","exp","getConfig","skipSDKVersionRequirement","isDevClient","startTypeScriptServices"],"mappings":";;;;+BAIsBA;;;eAAAA;;;;yBAJI;;;;;;qBAEN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEb,eAAeA,WAAWC,WAAmB;IAClD,MAAM,EAAEC,6BAA6B,EAAE,GACrC,MAAM,mEAAA,QAAO;IACf,MAAM,EAAEC,qBAAqB,EAAE,GAAG,MAAM,mEAAA,QAAO;IAC/C,MAAM,EAAEC,mBAAmB,EAAE,GAAG,MAAM,mEAAA,QAAO;IAE7C,IAAI;QACF,MAAM,IAAIF,8BAA8BD,aAAaI,cAAc;IACrE,EAAE,OAAOC,OAAY;QACnB,iEAAiE;QACjE,wCAAwC;QACxCC,QAAG,CAACC,GAAG;QACPD,QAAG,CAACE,SAAS,CAACH;QACd;IACF;IAEA,MAAM,EAAEI,GAAG,EAAE,GAAGC,IAAAA,mBAAS,EAACV,aAAa;QAAEW,2BAA2B;IAAK;IACzE,MAAM,IAAIT,sBAAsBF,aAAaG,oBAAoBH,aAAaS,MAAM;QAClFG,aAAa;IACf,GAAGC,uBAAuB;AAC5B"}
@@ -5,23 +5,29 @@ Object.defineProperty(exports, "__esModule", {
5
5
  function _export(target, all) {
6
6
  for(var name in all)Object.defineProperty(target, name, {
7
7
  enumerable: true,
8
- get: all[name]
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- events: function() {
12
+ get events () {
13
13
  return events;
14
14
  },
15
- installEventLogger: function() {
15
+ get getLogFile () {
16
+ return getLogFile;
17
+ },
18
+ get getWellKnownTemporaryLogFile () {
19
+ return getWellKnownTemporaryLogFile;
20
+ },
21
+ get installEventLogger () {
16
22
  return installEventLogger;
17
23
  },
18
- isEventLoggerActive: function() {
24
+ get isEventLoggerActive () {
19
25
  return isEventLoggerActive;
20
26
  },
21
- rootEvent: function() {
27
+ get rootEvent () {
22
28
  return rootEvent;
23
29
  },
24
- shouldReduceLogs: function() {
30
+ get shouldReduceLogs () {
25
31
  return shouldReduceLogs;
26
32
  }
27
33
  });
@@ -70,10 +76,14 @@ function getInitMetadata() {
70
76
  return {
71
77
  format: 'v0-jsonl',
72
78
  // Version is added in the build script.
73
- version: "55.0.23" ?? 'UNVERSIONED'
79
+ version: "57.0.9" ?? 'UNVERSIONED'
74
80
  };
75
81
  }
82
+ function getWellKnownTemporaryLogFile(projectRoot, command) {
83
+ return _nodepath().default.join(projectRoot, '.expo', 'dev', 'logs', `${command}.log`);
84
+ }
76
85
  function installEventLogger(env = process.env.LOG_EVENTS) {
86
+ if (logStream) return;
77
87
  const eventLogDestination = parseLogTarget(env);
78
88
  if (eventLogDestination) {
79
89
  if (eventLogDestination === 1) {
@@ -96,18 +106,12 @@ function installEventLogger(env = process.env.LOG_EVENTS) {
96
106
  }
97
107
  }
98
108
  const isEventLoggerActive = ()=>!!(logStream == null ? void 0 : logStream.writable);
109
+ const getLogFile = ()=>(logStream == null ? void 0 : logStream.file) ?? undefined;
99
110
  const shouldReduceLogs = ()=>!!logStream && _env.env.EXPO_UNSTABLE_HEADLESS;
100
111
  const events = (category, _fn)=>{
101
112
  function log(event, data) {
102
113
  if (logStream) {
103
- const _e = `${category}:${String(event)}`;
104
- const _t = Date.now();
105
- const payload = JSON.stringify({
106
- _e,
107
- _t,
108
- ...data
109
- });
110
- logStream._write(payload + '\n');
114
+ (0, _stream.writeEvent)(logStream, category, event, data);
111
115
  }
112
116
  }
113
117
  log.category = category;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/events/index.ts"],"sourcesContent":["import { Console } from 'node:console';\nimport path from 'node:path';\n\nimport type { EventBuilder, EventLoggerBuilder, EventShape } from './builder';\nimport { LogStream } from './stream';\nimport { env } from '../utils/env';\n\ninterface InitMetadata {\n format: 'v0-jsonl' | (string & {});\n version: string;\n}\n\nlet logPath = process.cwd();\nlet logStream: LogStream | undefined;\n\nfunction parseLogTarget(env: string | undefined) {\n let logDestination: string | number | undefined;\n if (env) {\n const fd = parseInt(env, 10);\n if (fd > 0 && Number.isSafeInteger(fd)) {\n logDestination = fd;\n } else {\n try {\n const parsedPath = path.parse(env);\n logDestination = path.format(parsedPath);\n logPath = parsedPath.dir;\n } catch {\n logDestination = undefined;\n }\n }\n }\n return logDestination;\n}\n\nfunction getInitMetadata(): InitMetadata {\n return {\n format: 'v0-jsonl',\n // Version is added in the build script.\n version: process.env.__EXPO_VERSION ?? 'UNVERSIONED',\n };\n}\n\n/** Activates the event logger based on the input env var\n * @param env - The target to write the logs to; defaults to `$LOG_EVENTS`\n */\nexport function installEventLogger(env = process.env.LOG_EVENTS) {\n const eventLogDestination = parseLogTarget(env);\n if (eventLogDestination) {\n if (eventLogDestination === 1) {\n // Reuse Node's existing stdio streams so redirected or piped terminals don't\n // attempt TTY-only initialization when LOG_EVENTS swaps console output.\n const output = process.stderr;\n Object.defineProperty(process, 'stdout', { get: () => output });\n globalThis.console = new Console(output, output);\n } else if (eventLogDestination === 2) {\n const output = process.stdout;\n Object.defineProperty(process, 'stderr', { get: () => output });\n globalThis.console = new Console(output, output);\n }\n logStream = new LogStream(eventLogDestination);\n rootEvent('init', getInitMetadata());\n }\n}\n\n/** Returns whether the event logger is active */\nexport const isEventLoggerActive = () => !!logStream?.writable;\n\n/** Whether logs shown in the terminal should be reduced.\n * @remarks\n * We indicate that we're in an automated tool (e.g. E2E tests) with `EXPO_UNSTABLE_HEADLESS`.\n * If the event logger is activate and we're running in a headless tool, we should reduce\n * interactive or noisy logs, in favour of the event logger.\n */\nexport const shouldReduceLogs = () => !!logStream && env.EXPO_UNSTABLE_HEADLESS;\n\n/** Used to create an event logger for structured JSONL logs activated with the `LOG_EVENTS` environment variable.\n *\n * @remarks\n * Structured logs are streamed to a JSONL output file or file descriptor, and are meant for automated tooling\n * or normal usage to document what happened during a user session. When creating a module that outputs errors,\n * events, or captures what the user was doing, create a new event logger category for them and add structured\n * log events.\n * For example, `../start/server/metro/MetroTerminalReporter` captures most of Metro's logged events.\n * Structured JSONL logs don't have a large performance impact, unlike `DEBUG` logs, and are easily parseable\n * and filterable, including by wrapper processes.\n *\n * After adding a new event category, don't forget to add it to `./types.ts` to collect all event shape types\n * in one place.\n *\n * @example\n * ```ts\n * export const event = events('test', (t) => [\n * t.event<'my_event', {\n * myValue: string | null;\n * }>(),\n * ]);\n *\n * event('my_event', { myValue: 'test' });\n * ```\n *\n * This will log a `{ _e: 'test:my_event', _t: 0, myValue: 'test' }` entry in the event log.\n */\nexport const events: EventLoggerBuilder = ((\n category: string,\n _fn: (builder: EventBuilder) => readonly EventShape<string>[]\n) => {\n function log(event: string, data: any) {\n if (logStream) {\n const _e = `${category}:${String(event)}`;\n const _t = Date.now();\n const payload = JSON.stringify({ _e, _t, ...data });\n logStream._write(payload + '\\n');\n }\n }\n log.category = category;\n\n log.path = function relativePath(target: string | undefined | null): string | null {\n try {\n return target != null && path.isAbsolute(target)\n ? path.relative(logPath, target).replace(/\\\\/, '/') || '.'\n : (target ?? null);\n } catch {\n return target || null;\n }\n };\n\n return log;\n}) as EventLoggerBuilder;\n\n// These are built-in events: We choose an ambiguous name on purpose,\n// since we don't assume this implementation will necessarily only be in `@expo/cli`\nexport const rootEvent = events('root', (t) => [t.event<'init', InitMetadata>()]);\n\nexport type { EventLogger } from './builder';\n"],"names":["events","installEventLogger","isEventLoggerActive","rootEvent","shouldReduceLogs","logPath","process","cwd","logStream","parseLogTarget","env","logDestination","fd","parseInt","Number","isSafeInteger","parsedPath","path","parse","format","dir","undefined","getInitMetadata","version","__EXPO_VERSION","LOG_EVENTS","eventLogDestination","output","stderr","Object","defineProperty","get","globalThis","console","Console","stdout","LogStream","writable","EXPO_UNSTABLE_HEADLESS","category","_fn","log","event","data","_e","String","_t","Date","now","payload","JSON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;YAAO;YAC7DK,WAAWC,OAAO,GAAG,IAAIC,CAAAA,cAAM,SAAC,CAACP,QAAQA;QAC3C;QACAnB,YAAY,IAAI4B,iBAAS,CAACV;QAC1BvB,UAAU,QAAQmB;IACpB;AACF;AAGO,MAAMpB,sBAAsB,IAAM,CAAC,EAACM,6BAAAA,UAAW6B,QAAQ;AAQvD,MAAMjC,mBAAmB,IAAM,CAAC,CAACI,aAAaE,QAAG,CAAC4B,sBAAsB;AA6BxE,MAAMtC,SAA8B,CACzCuC,UACAC;IAEA,SAASC,IAAIC,KAAa,EAAEC,IAAS;QACnC,IAAInC,WAAW;YACb,MAAMoC,KAAK,GAAGL,SAAS,CAAC,EAAEM,OAAOH,QAAQ;YACzC,MAAMI,KAAKC,KAAKC,GAAG;YACnB,MAAMC,UAAUC,KAAKC,SAAS,CAAC;gBAAEP;gBAAIE;gBAAI,GAAGH,IAAI;YAAC;YACjDnC,UAAU4C,MAAM,CAACH,UAAU;QAC7B;IACF;IACAR,IAAIF,QAAQ,GAAGA;IAEfE,IAAIxB,IAAI,GAAG,SAASoC,aAAaC,MAAiC;QAChE,IAAI;YACF,OAAOA,UAAU,QAAQrC,mBAAI,CAACsC,UAAU,CAACD,UACrCrC,mBAAI,CAACuC,QAAQ,CAACnD,SAASiD,QAAQG,OAAO,CAAC,MAAM,QAAQ,MACpDH,UAAU;QACjB,EAAE,OAAM;YACN,OAAOA,UAAU;QACnB;IACF;IAEA,OAAOb;AACT;AAIO,MAAMtC,YAAYH,OAAO,QAAQ,CAAC0D,IAAM;QAACA,EAAEhB,KAAK;KAAyB"}
1
+ {"version":3,"sources":["../../../src/events/index.ts"],"sourcesContent":["import { Console } from 'node:console';\nimport path from 'node:path';\n\nimport type { EventBuilder, EventLoggerBuilder, EventShape } from './builder';\nimport { LogStream, writeEvent } from './stream';\nimport { env } from '../utils/env';\n\ninterface InitMetadata {\n format: 'v0-jsonl' | (string & {});\n version: string;\n}\n\nlet logPath = process.cwd();\nlet logStream: LogStream | undefined;\n\nfunction parseLogTarget(env: string | undefined) {\n let logDestination: string | number | undefined;\n if (env) {\n const fd = parseInt(env, 10);\n if (fd > 0 && Number.isSafeInteger(fd)) {\n logDestination = fd;\n } else {\n try {\n const parsedPath = path.parse(env);\n logDestination = path.format(parsedPath);\n logPath = parsedPath.dir;\n } catch {\n logDestination = undefined;\n }\n }\n }\n return logDestination;\n}\n\nfunction getInitMetadata(): InitMetadata {\n return {\n format: 'v0-jsonl',\n // Version is added in the build script.\n version: process.env.__EXPO_VERSION ?? 'UNVERSIONED',\n };\n}\n\nexport function getWellKnownTemporaryLogFile(projectRoot: string, command: string): string {\n return path.join(projectRoot, '.expo', 'dev', 'logs', `${command}.log`);\n}\n\n/** Activates the event logger.\n *\n * Accepts either a log target string (file path, fd number, or `$LOG_EVENTS`),\n * or a `projectRoot` + `command` pair to log to `.expo/dev/logs/<command>.log`.\n * Subsequent calls are no-ops — the first activated destination wins.\n */\nexport function installEventLogger(env: string | undefined = process.env.LOG_EVENTS) {\n if (logStream) return;\n const eventLogDestination = parseLogTarget(env);\n if (eventLogDestination) {\n if (eventLogDestination === 1) {\n // Reuse Node's existing stdio streams so redirected or piped terminals don't\n // attempt TTY-only initialization when LOG_EVENTS swaps console output.\n const output = process.stderr;\n Object.defineProperty(process, 'stdout', { get: () => output });\n globalThis.console = new Console(output, output);\n } else if (eventLogDestination === 2) {\n const output = process.stdout;\n Object.defineProperty(process, 'stderr', { get: () => output });\n globalThis.console = new Console(output, output);\n }\n logStream = new LogStream(eventLogDestination);\n rootEvent('init', getInitMetadata());\n }\n}\n\n/** Returns whether the event logger is active */\nexport const isEventLoggerActive = () => !!logStream?.writable;\n\n/** Returns the file path of the active event log, if any */\nexport const getLogFile = () => logStream?.file ?? undefined;\n\n/** Whether logs shown in the terminal should be reduced.\n * @remarks\n * We indicate that we're in an automated tool (e.g. E2E tests) with `EXPO_UNSTABLE_HEADLESS`.\n * If the event logger is activate and we're running in a headless tool, we should reduce\n * interactive or noisy logs, in favour of the event logger.\n */\nexport const shouldReduceLogs = () => !!logStream && env.EXPO_UNSTABLE_HEADLESS;\n\n/** Used to create an event logger for structured JSONL logs activated with the `LOG_EVENTS` environment variable.\n *\n * @remarks\n * Structured logs are streamed to a JSONL output file or file descriptor, and are meant for automated tooling\n * or normal usage to document what happened during a user session. When creating a module that outputs errors,\n * events, or captures what the user was doing, create a new event logger category for them and add structured\n * log events.\n * For example, `../start/server/metro/MetroTerminalReporter` captures most of Metro's logged events.\n * Structured JSONL logs don't have a large performance impact, unlike `DEBUG` logs, and are easily parseable\n * and filterable, including by wrapper processes.\n *\n * After adding a new event category, don't forget to add it to `./types.ts` to collect all event shape types\n * in one place.\n *\n * @example\n * ```ts\n * export const event = events('test', (t) => [\n * t.event<'my_event', {\n * myValue: string | null;\n * }>(),\n * ]);\n *\n * event('my_event', { myValue: 'test' });\n * ```\n *\n * This will log a `{ _e: 'test:my_event', _t: 0, myValue: 'test' }` entry in the event log.\n */\nexport const events: EventLoggerBuilder = ((\n category: string,\n _fn: (builder: EventBuilder) => readonly EventShape<string>[]\n) => {\n function log(event: string, data: any) {\n if (logStream) {\n writeEvent(logStream, category, event, data);\n }\n }\n log.category = category;\n\n log.path = function relativePath(target: string | undefined | null): string | null {\n try {\n return target != null && path.isAbsolute(target)\n ? path.relative(logPath, target).replace(/\\\\/, '/') || '.'\n : (target ?? null);\n } catch {\n return target || null;\n }\n };\n\n return log;\n}) as EventLoggerBuilder;\n\n// These are built-in events: We choose an ambiguous name on purpose,\n// since we don't assume this implementation will necessarily only be in `@expo/cli`\nexport const rootEvent = events('root', (t) => [t.event<'init', InitMetadata>()]);\n\nexport type { EventLogger } from './builder';\n"],"names":["events","getLogFile","getWellKnownTemporaryLogFile","installEventLogger","isEventLoggerActive","rootEvent","shouldReduceLogs","logPath","process","cwd","logStream","parseLogTarget","env","logDestination","fd","parseInt","Number","isSafeInteger","parsedPath","path","parse","format","dir","undefined","getInitMetadata","version","__EXPO_VERSION","projectRoot","command","join","LOG_EVENTS","eventLogDestination","output","stderr","Object","defineProperty","get","globalThis","console","Console","stdout","LogStream","writable","file","EXPO_UNSTABLE_HEADLESS","category","_fn","log","event","data","writeEvent","relativePath","target","isAbsolute","relative","replace","t"],"mappings":";;;;;;;;;;;QAiHaA;eAAAA;;QArCAC;eAAAA;;QAlCGC;eAAAA;;QAUAC;eAAAA;;QAqBHC;eAAAA;;QAkEAC;eAAAA;;QAvDAC;eAAAA;;;;yBApFW;;;;;;;gEACP;;;;;;wBAGqB;qBAClB;;;;;;AAOpB,IAAIC,UAAUC,QAAQC,GAAG;AACzB,IAAIC;AAEJ,SAASC,eAAeC,GAAuB;IAC7C,IAAIC;IACJ,IAAID,KAAK;QACP,MAAME,KAAKC,SAASH,KAAK;QACzB,IAAIE,KAAK,KAAKE,OAAOC,aAAa,CAACH,KAAK;YACtCD,iBAAiBC;QACnB,OAAO;YACL,IAAI;gBACF,MAAMI,aAAaC,mBAAI,CAACC,KAAK,CAACR;gBAC9BC,iBAAiBM,mBAAI,CAACE,MAAM,CAACH;gBAC7BX,UAAUW,WAAWI,GAAG;YAC1B,EAAE,OAAM;gBACNT,iBAAiBU;YACnB;QACF;IACF;IACA,OAAOV;AACT;AAEA,SAASW;IACP,OAAO;QACLH,QAAQ;QACR,wCAAwC;QACxCI,SAASjB,QAAQI,GAAG,CAACc,cAAc,IAAI;IACzC;AACF;AAEO,SAASxB,6BAA6ByB,WAAmB,EAAEC,OAAe;IAC/E,OAAOT,mBAAI,CAACU,IAAI,CAACF,aAAa,SAAS,OAAO,QAAQ,GAAGC,QAAQ,IAAI,CAAC;AACxE;AAQO,SAASzB,mBAAmBS,MAA0BJ,QAAQI,GAAG,CAACkB,UAAU;IACjF,IAAIpB,WAAW;IACf,MAAMqB,sBAAsBpB,eAAeC;IAC3C,IAAImB,qBAAqB;QACvB,IAAIA,wBAAwB,GAAG;YAC7B,6EAA6E;YAC7E,wEAAwE;YACxE,MAAMC,SAASxB,QAAQyB,MAAM;YAC7BC,OA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Property(exports, "LogStream", {
6
- enumerable: true,
7
- get: function() {
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
+ });
10
+ }
11
+ _export(exports, {
12
+ get LogStream () {
8
13
  return LogStream;
14
+ },
15
+ get writeEvent () {
16
+ return writeEvent;
9
17
  }
10
18
  });
11
19
  function _nodebuffer() {
@@ -43,6 +51,12 @@ function _interop_require_default(obj) {
43
51
  }
44
52
  const BUSY_WRITE_TIMEOUT = 100;
45
53
  const HIGH_WATER_MARK = 16387; /*16KB*/
54
+ function writeEvent(dest, category, kind, payload) {
55
+ const timestamp = Date.now();
56
+ const rest = JSON.stringify(payload).slice(1);
57
+ const line = rest.length > 1 ? `{"_e":"${category}:${kind}","_t":${timestamp},${rest}\n` : `{"_e":"${category}:${kind}","_t":${timestamp}}\n`;
58
+ dest._writeln(line);
59
+ }
46
60
  class LogStream extends _nodeevents().EventEmitter {
47
61
  #fd;
48
62
  #file;
@@ -54,9 +68,11 @@ class LogStream extends _nodeevents().EventEmitter {
54
68
  #output;
55
69
  #len;
56
70
  #lines;
71
+ #head;
57
72
  #partialLine;
73
+ #onRelease;
58
74
  constructor(dest){
59
- super(), this.#fd = -1, this.#file = null, this.#writing = false, this.#ending = false, this.#flushPending = false, this.#destroyed = false, this.#opening = false, this.#output = '', this.#len = 0, this.#lines = [], this.#partialLine = 0;
75
+ super(), this.#fd = -1, this.#file = null, this.#writing = false, this.#ending = false, this.#flushPending = false, this.#destroyed = false, this.#opening = false, this.#output = '', this.#len = 0, this.#lines = [], this.#head = 0, this.#partialLine = 0, this.#onRelease = (err, written)=>this.#release(err, written);
60
76
  if (typeof dest === 'number') {
61
77
  _nodefs().default.fsyncSync(dest);
62
78
  this.#fd = dest;
@@ -87,23 +103,43 @@ class LogStream extends _nodeevents().EventEmitter {
87
103
  }
88
104
  } else {
89
105
  this.emit('write', written);
90
- const outputLength = _nodebuffer().Buffer.byteLength(this.#output);
91
- if (outputLength > written) {
92
- const output = _nodebuffer().Buffer.from(this.#output).subarray(written).toString();
93
- this.#len -= this.#output.length - output.length;
94
- this.#output = output;
95
- } else {
106
+ if (written === this.#output.length) {
107
+ // Fast path: complete write (exact for ASCII, the common case for JSONL)
96
108
  this.#len -= this.#output.length;
97
109
  this.#output = '';
98
- }
99
- if (this.#output || this.#lines.length > this.#partialLine) {
100
- this.#writeLine();
101
- } else if (this.#ending) {
102
- this.#writing = false;
103
- this.#close();
110
+ if (this.#lines.length - this.#head > this.#partialLine) {
111
+ this.#writeLine();
112
+ } else if (this.#ending) {
113
+ this.#writing = false;
114
+ this.#close();
115
+ } else {
116
+ this.#writing = false;
117
+ if (this.#flushPending) {
118
+ this.emit('drain');
119
+ }
120
+ }
104
121
  } else {
105
- this.#writing = false;
106
- this.emit('drain');
122
+ // Multi-byte complete write (written > length) or partial write (written < length)
123
+ const outputLength = _nodebuffer().Buffer.byteLength(this.#output);
124
+ if (outputLength > written) {
125
+ const output = _nodebuffer().Buffer.from(this.#output).toString('utf8', written);
126
+ this.#len -= this.#output.length - output.length;
127
+ this.#output = output;
128
+ } else {
129
+ this.#len -= this.#output.length;
130
+ this.#output = '';
131
+ }
132
+ if (this.#output || this.#lines.length - this.#head > this.#partialLine) {
133
+ this.#writeLine();
134
+ } else if (this.#ending) {
135
+ this.#writing = false;
136
+ this.#close();
137
+ } else {
138
+ this.#writing = false;
139
+ if (this.#flushPending) {
140
+ this.emit('drain');
141
+ }
142
+ }
107
143
  }
108
144
  }
109
145
  }
@@ -123,7 +159,7 @@ class LogStream extends _nodeevents().EventEmitter {
123
159
  this.emit('ready');
124
160
  if (this.#destroyed) {
125
161
  // do nothing when we're already closing the file
126
- } else if (!this.writing && this.#lines.length > this.#partialLine || this.#flushPending) {
162
+ } else if (!this.writing && this.#lines.length - this.#head > this.#partialLine || this.#flushPending) {
127
163
  this.#writeLine();
128
164
  }
129
165
  }
@@ -143,6 +179,7 @@ class LogStream extends _nodeevents().EventEmitter {
143
179
  this.#destroyed = true;
144
180
  this.#partialLine = 0;
145
181
  this.#lines.length = 0;
182
+ this.#head = 0;
146
183
  const onClose = (error)=>{
147
184
  if (error) {
148
185
  this.emit('error', error);
@@ -162,8 +199,22 @@ class LogStream extends _nodeevents().EventEmitter {
162
199
  }
163
200
  #writeLine() {
164
201
  this.#writing = true;
165
- this.#output ||= this.#lines.length > this.#partialLine ? this.#lines.shift() || '' : '';
166
- _nodefs().default.write(this.#fd, this.#output, (err, written)=>this.#release(err, written));
202
+ if (!this.#output) {
203
+ const end = this.#lines.length - this.#partialLine;
204
+ if (end > this.#head) {
205
+ this.#output = this.#lines[this.#head++] || '';
206
+ // Batch multiple lines into one write call below HWM, to avoid
207
+ // excessive syscalls after when lines accumulated during a previous write
208
+ while(this.#head < end && this.#output.length < HIGH_WATER_MARK){
209
+ this.#output += this.#lines[this.#head++];
210
+ }
211
+ if (this.#head === this.#lines.length) {
212
+ this.#lines.length = 0;
213
+ this.#head = 0;
214
+ }
215
+ }
216
+ }
217
+ _nodefs().default.write(this.#fd, this.#output, this.#onRelease);
167
218
  }
168
219
  _end() {
169
220
  if (!this.#destroyed && !this.#ending) {
@@ -171,7 +222,7 @@ class LogStream extends _nodeevents().EventEmitter {
171
222
  if (this.#opening) {
172
223
  this.once('ready', ()=>this._end());
173
224
  } else if (!this.#writing && this.#fd >= 0) {
174
- if (this.#lines.length > this.#partialLine) {
225
+ if (this.#lines.length - this.#head > this.#partialLine) {
175
226
  this.#writeLine();
176
227
  } else {
177
228
  this.#close();
@@ -225,7 +276,7 @@ class LogStream extends _nodeevents().EventEmitter {
225
276
  this.once('drain', onDrain);
226
277
  this.once('error', onError);
227
278
  if (!this.#writing) {
228
- if (this.#lines.length > this.#partialLine || this.#output) {
279
+ if (this.#lines.length - this.#head > this.#partialLine || this.#output) {
229
280
  // There are complete lines or remaining output to write
230
281
  this.#writeLine();
231
282
  } else {
@@ -235,10 +286,29 @@ class LogStream extends _nodeevents().EventEmitter {
235
286
  }
236
287
  }
237
288
  }
289
+ _writeln(data) {
290
+ this.#len += data.length;
291
+ if (!this.#writing && this.#lines.length === this.#head && !this.#output) {
292
+ // Fast path: When no write is pending, directly write the line
293
+ this.#writing = true;
294
+ this.#output = data;
295
+ _nodefs().default.write(this.#fd, data, this.#onRelease);
296
+ } else {
297
+ this.#lines.push(data);
298
+ if (!this.#writing) {
299
+ this.#writeLine();
300
+ }
301
+ }
302
+ return this.#len < HIGH_WATER_MARK;
303
+ }
238
304
  _write(data) {
239
305
  if (this.#destroyed) {
240
306
  return false;
241
307
  }
308
+ // Fast path: For complete lines with no pending partial we can skip the work below
309
+ if (this.#partialLine === 0 && data.charCodeAt(data.length - 1) === 10 /*'\n'*/ ) {
310
+ return this._writeln(data);
311
+ }
242
312
  this.#len += data.length;
243
313
  let startIdx = 0;
244
314
  let endIdx = -1;
@@ -261,7 +331,7 @@ class LogStream extends _nodeevents().EventEmitter {
261
331
  }
262
332
  this.#partialLine = 1;
263
333
  }
264
- if (!this.#writing && this.#lines.length > this.#partialLine) {
334
+ if (!this.#writing && this.#lines.length - this.#head > this.#partialLine) {
265
335
  this.#writeLine();
266
336
  }
267
337
  return this.#len < HIGH_WATER_MARK;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/events/stream.ts"],"sourcesContent":["import { Buffer } from 'node:buffer';\nimport { EventEmitter } from 'node:events';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nconst BUSY_WRITE_TIMEOUT = 100;\nconst HIGH_WATER_MARK = 16_387; /*16KB*/\n\nexport class LogStream extends EventEmitter implements NodeJS.WritableStream {\n #fd = -1;\n #file: string | null = null;\n\n #writing = false;\n #ending = false;\n #flushPending = false;\n #destroyed = false;\n #opening = false;\n\n #output = '';\n #len = 0;\n #lines: string[] = [];\n #partialLine = 0;\n\n constructor(dest: string | number) {\n super();\n if (typeof dest === 'number') {\n fs.fsyncSync(dest);\n this.#fd = dest;\n process.nextTick(() => this.emit('ready'));\n } else if (typeof dest === 'string') {\n this.#openFile(dest);\n }\n }\n\n get file(): string | null {\n return this.#file;\n }\n\n get fd(): number {\n return this.#fd;\n }\n\n get writing(): boolean {\n return this.#writing;\n }\n\n get writable(): boolean {\n return !this.#destroyed && !this.#ending;\n }\n\n #release(error: NodeJS.ErrnoException | null, written: number) {\n if (error) {\n if (error.code === 'EAGAIN' || error.code === 'EBUSY') {\n setTimeout(() => this.#writeLine(), BUSY_WRITE_TIMEOUT);\n } else {\n this.#writing = false;\n this.emit('error', error);\n }\n } else {\n this.emit('write', written);\n\n const outputLength = Buffer.byteLength(this.#output);\n if (outputLength > written) {\n const output = Buffer.from(this.#output).subarray(written).toString();\n this.#len -= this.#output.length - output.length;\n this.#output = output;\n } else {\n this.#len -= this.#output.length;\n this.#output = '';\n }\n\n if (this.#output || this.#lines.length > this.#partialLine) {\n this.#writeLine();\n } else if (this.#ending) {\n this.#writing = false;\n this.#close();\n } else {\n this.#writing = false;\n this.emit('drain');\n }\n }\n }\n\n #openFile(file: string) {\n this.#opening = true;\n this.#writing = true;\n\n const onOpened = (error: Error | null, fd?: number | null) => {\n if (error) {\n this.#writing = false;\n this.#opening = false;\n this.emit('error', error);\n } else {\n this.#fd = fd!;\n this.#file = file;\n this.#opening = false;\n this.#writing = false;\n this.emit('ready');\n if (this.#destroyed) {\n // do nothing when we're already closing the file\n } else if (\n (!this.writing && this.#lines.length > this.#partialLine) ||\n this.#flushPending\n ) {\n this.#writeLine();\n }\n }\n };\n\n fs.mkdir(path.dirname(file), { recursive: true }, (err) => {\n if (err) return onOpened(err);\n fs.open(file, 'a', 0o666, onOpened);\n });\n }\n\n #close() {\n if (this.#fd === -1) {\n this.once('ready', () => this.#close());\n return;\n }\n\n this.#destroyed = true;\n this.#partialLine = 0;\n this.#lines.length = 0;\n\n const onClose = (error?: NodeJS.ErrnoException | null) => {\n if (error) {\n this.emit('error', error);\n this.emit('close', error);\n } else {\n if (this.#ending && !this.#writing) this.emit('finish');\n this.emit('close');\n }\n };\n\n fsFsync(this.#fd, (error) => {\n if (!error && !isStdFd(this.#fd)) {\n fs.close(this.#fd, onClose);\n } else {\n onClose(); // Error intentionally ignored, assume closed\n }\n });\n }\n\n #writeLine() {\n this.#writing = true;\n this.#output ||= this.#lines.length > this.#partialLine ? this.#lines.shift() || '' : '';\n fs.write(this.#fd, this.#output, (err, written) => this.#release(err, written));\n }\n\n _end() {\n if (!this.#destroyed && !this.#ending) {\n this.#ending = true;\n if (this.#opening) {\n this.once('ready', () => this._end());\n } else if (!this.#writing && this.#fd >= 0) {\n if (this.#lines.length > this.#partialLine) {\n this.#writeLine();\n } else {\n this.#close();\n }\n }\n }\n return this;\n }\n\n end(cb?: () => void): this;\n end(data: string | Uint8Array, cb?: () => void): this;\n end(str: string, encoding?: BufferEncoding, cb?: () => void): this;\n\n end(\n arg1?: Uint8Array | string | (() => void),\n arg2?: BufferEncoding | (() => void),\n arg3?: () => void\n ) {\n const maybeCb = arg3 || arg2 || arg1;\n const input = typeof arg1 !== 'function' ? arg1 : undefined;\n const encoding = typeof arg2 === 'string' ? arg2 : 'utf8';\n const cb = typeof maybeCb === 'function' ? maybeCb : undefined;\n if (typeof input === 'string') {\n this.write(input, encoding);\n } else if (input != null) {\n this.write(input);\n }\n if (cb) this.once('close', cb);\n return this._end();\n }\n\n destroy() {\n if (!this.#destroyed) this.#close();\n }\n\n flush(cb?: (error?: Error | null) => void) {\n if (this.#destroyed) {\n cb?.();\n } else {\n const onDrain = () => {\n if (!this.#destroyed) {\n fsFsync(this.#fd, (error) => {\n this.#flushPending = false;\n if (error?.code === 'EBADF') {\n cb?.(); // If fd is closed, ignore the error\n } else {\n cb?.(error);\n }\n });\n } else {\n this.#flushPending = false;\n cb?.();\n }\n this.off('error', onError);\n };\n\n const onError = (err: Error) => {\n this.#flushPending = false;\n this.off('drain', onDrain);\n cb?.(err);\n };\n\n this.#flushPending = true;\n this.once('drain', onDrain);\n this.once('error', onError);\n\n if (!this.#writing) {\n if (this.#lines.length > this.#partialLine || this.#output) {\n // There are complete lines or remaining output to write\n this.#writeLine();\n } else {\n // Nothing complete to write, emit drain immediately\n process.nextTick(() => this.emit('drain'));\n }\n }\n }\n }\n\n _write(data: string): boolean {\n if (this.#destroyed) {\n return false;\n }\n\n this.#len += data.length;\n\n let startIdx = 0;\n let endIdx = -1;\n while ((endIdx = data.indexOf('\\n', startIdx)) > -1) {\n const line = data.slice(startIdx, endIdx + 1);\n if (this.#partialLine > 0) {\n this.#lines[this.#lines.length - 1] += line;\n } else {\n this.#lines.push(line);\n }\n this.#partialLine = 0;\n startIdx = ++endIdx;\n }\n\n if (startIdx < data.length) {\n const line = data.slice(startIdx);\n if (this.#partialLine > 0) {\n this.#lines[this.#lines.length - 1] += line;\n } else {\n this.#lines.push(data.slice(startIdx));\n }\n this.#partialLine = 1;\n }\n\n if (!this.#writing && this.#lines.length > this.#partialLine) {\n this.#writeLine();\n }\n\n return this.#len < HIGH_WATER_MARK;\n }\n\n write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;\n write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;\n\n write(\n input: Uint8Array | string,\n arg2?: BufferEncoding | ((err?: Error | null) => void),\n arg3?: (err?: Error | null) => void\n ): boolean {\n const maybeCb = arg3 || arg2;\n const encoding = typeof arg2 === 'string' ? arg2 : 'utf8';\n const data = typeof input === 'string' ? input : Buffer.from(input).toString(encoding);\n const cb = typeof maybeCb === 'function' ? maybeCb : undefined;\n try {\n return this._write(data);\n } finally {\n cb?.();\n }\n }\n\n [Symbol.dispose]() {\n this.destroy();\n }\n}\n\nconst isStdFd = (fd: number) => {\n switch (fd) {\n case 1:\n case 2:\n case process.stdout.fd:\n case process.stderr.fd:\n return true;\n default:\n return false;\n }\n};\n\nconst fsFsync = (fd: number, cb: (error?: NodeJS.ErrnoException | null) => void) => {\n try {\n fs.fsync(fd, cb);\n } catch (error: any) {\n cb(error);\n }\n};\n"],"names":["LogStream","BUSY_WRITE_TIMEOUT","HIGH_WATER_MARK","EventEmitter","constructor","dest","fs","fsyncSync","process","nextTick","emit","file","fd","writing","writable","error","written","code","setTimeout","outputLength","Buffer","byteLength","output","from","subarray","toString","length","onOpened","mkdir","path","dirname","recursive","err","open","once","onClose","fsFsync","isStdFd","close","shift","write","_end","end","arg1","arg2","arg3","maybeCb","input","undefined","encoding","cb","destroy","flush","onDrain","off","onError","_write","data","startIdx","endIdx","indexOf","line","slice","push","Symbol","dispose","stdout","stderr","fsync"],"mappings":";;;;+BAQaA;;;eAAAA;;;;yBARU;;;;;;;yBACM;;;;;;;gEACd;;;;;;;gEACE;;;;;;;;;;;AAEjB,MAAMC,qBAAqB;AAC3B,MAAMC,kBAAkB,OAAQ,MAAM;AAE/B,MAAMF,kBAAkBG,0BAAY;IACzC,CAAA,EAAG,CAAM;IACT,CAAA,IAAK,CAAuB;IAE5B,CAAA,OAAQ,CAAS;IACjB,CAAA,MAAO,CAAS;IAChB,CAAA,YAAa,CAAS;IACtB,CAAA,SAAU,CAAS;IACnB,CAAA,OAAQ,CAAS;IAEjB,CAAA,MAAO,CAAM;IACb,CAAA,GAAI,CAAK;IACT,CAAA,KAAM,CAAgB;IACtB,CAAA,WAAY,CAAK;IAEjBC,YAAYC,IAAqB,CAAE;QACjC,KAAK,SAfP,CAAA,EAAG,GAAG,CAAC,QACP,CAAA,IAAK,GAAkB,WAEvB,CAAA,OAAQ,GAAG,YACX,CAAA,MAAO,GAAG,YACV,CAAA,YAAa,GAAG,YAChB,CAAA,SAAU,GAAG,YACb,CAAA,OAAQ,GAAG,YAEX,CAAA,MAAO,GAAG,SACV,CAAA,GAAI,GAAG,QACP,CAAA,KAAM,GAAa,EAAE,OACrB,CAAA,WAAY,GAAG;QAIb,IAAI,OAAOA,SAAS,UAAU;YAC5BC,iBAAE,CAACC,SAAS,CAACF;YACb,IAAI,CAAC,CAAA,EAAG,GAAGA;YACXG,QAAQC,QAAQ,CAAC,IAAM,IAAI,CAACC,IAAI,CAAC;QACnC,OA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;QACL,KAAK;QACL,KAAKJ,QAAQ0D,MAAM,CAACtD,EAAE;QACtB,KAAKJ,QAAQ2D,MAAM,CAACvD,EAAE;YACpB,OAAO;QACT;YACE,OAAO;IACX;AACF;AAEA,MAAMwB,UAAU,CAACxB,IAAYsC;IAC3B,IAAI;QACF5C,iBAAE,CAAC8D,KAAK,CAACxD,IAAIsC;IACf,EAAE,OAAOnC,OAAY;QACnBmC,GAAGnC;IACL;AACF"}
1
+ {"version":3,"sources":["../../../src/events/stream.ts"],"sourcesContent":["import { Buffer } from 'node:buffer';\nimport { EventEmitter } from 'node:events';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nconst BUSY_WRITE_TIMEOUT = 100;\nconst HIGH_WATER_MARK = 16_387; /*16KB*/\n\nexport function writeEvent(dest: LogStream, category: string, kind: string, payload: any) {\n const timestamp = Date.now();\n const rest = JSON.stringify(payload).slice(1);\n const line =\n rest.length > 1\n ? `{\"_e\":\"${category}:${kind}\",\"_t\":${timestamp},${rest}\\n`\n : `{\"_e\":\"${category}:${kind}\",\"_t\":${timestamp}}\\n`;\n dest._writeln(line);\n}\n\nexport class LogStream extends EventEmitter implements NodeJS.WritableStream {\n #fd = -1;\n #file: string | null = null;\n\n #writing = false;\n #ending = false;\n #flushPending = false;\n #destroyed = false;\n #opening = false;\n\n #output = '';\n #len = 0;\n #lines: string[] = [];\n #head = 0;\n #partialLine = 0;\n #onRelease = (err: NodeJS.ErrnoException | null, written: number) => this.#release(err, written);\n\n constructor(dest: string | number) {\n super();\n if (typeof dest === 'number') {\n fs.fsyncSync(dest);\n this.#fd = dest;\n process.nextTick(() => this.emit('ready'));\n } else if (typeof dest === 'string') {\n this.#openFile(dest);\n }\n }\n\n get file(): string | null {\n return this.#file;\n }\n\n get fd(): number {\n return this.#fd;\n }\n\n get writing(): boolean {\n return this.#writing;\n }\n\n get writable(): boolean {\n return !this.#destroyed && !this.#ending;\n }\n\n #release(error: NodeJS.ErrnoException | null, written: number) {\n if (error) {\n if (error.code === 'EAGAIN' || error.code === 'EBUSY') {\n setTimeout(() => this.#writeLine(), BUSY_WRITE_TIMEOUT);\n } else {\n this.#writing = false;\n this.emit('error', error);\n }\n } else {\n this.emit('write', written);\n\n if (written === this.#output.length) {\n // Fast path: complete write (exact for ASCII, the common case for JSONL)\n this.#len -= this.#output.length;\n this.#output = '';\n\n if (this.#lines.length - this.#head > this.#partialLine) {\n this.#writeLine();\n } else if (this.#ending) {\n this.#writing = false;\n this.#close();\n } else {\n this.#writing = false;\n if (this.#flushPending) {\n this.emit('drain');\n }\n }\n } else {\n // Multi-byte complete write (written > length) or partial write (written < length)\n const outputLength = Buffer.byteLength(this.#output);\n if (outputLength > written) {\n const output = Buffer.from(this.#output).toString('utf8', written);\n this.#len -= this.#output.length - output.length;\n this.#output = output;\n } else {\n this.#len -= this.#output.length;\n this.#output = '';\n }\n\n if (this.#output || this.#lines.length - this.#head > this.#partialLine) {\n this.#writeLine();\n } else if (this.#ending) {\n this.#writing = false;\n this.#close();\n } else {\n this.#writing = false;\n if (this.#flushPending) {\n this.emit('drain');\n }\n }\n }\n }\n }\n\n #openFile(file: string) {\n this.#opening = true;\n this.#writing = true;\n\n const onOpened = (error: Error | null, fd?: number | null) => {\n if (error) {\n this.#writing = false;\n this.#opening = false;\n this.emit('error', error);\n } else {\n this.#fd = fd!;\n this.#file = file;\n this.#opening = false;\n this.#writing = false;\n this.emit('ready');\n if (this.#destroyed) {\n // do nothing when we're already closing the file\n } else if (\n (!this.writing && this.#lines.length - this.#head > this.#partialLine) ||\n this.#flushPending\n ) {\n this.#writeLine();\n }\n }\n };\n\n fs.mkdir(path.dirname(file), { recursive: true }, (err) => {\n if (err) return onOpened(err);\n fs.open(file, 'a', 0o666, onOpened);\n });\n }\n\n #close() {\n if (this.#fd === -1) {\n this.once('ready', () => this.#close());\n return;\n }\n\n this.#destroyed = true;\n this.#partialLine = 0;\n this.#lines.length = 0;\n this.#head = 0;\n\n const onClose = (error?: NodeJS.ErrnoException | null) => {\n if (error) {\n this.emit('error', error);\n this.emit('close', error);\n } else {\n if (this.#ending && !this.#writing) this.emit('finish');\n this.emit('close');\n }\n };\n\n fsFsync(this.#fd, (error) => {\n if (!error && !isStdFd(this.#fd)) {\n fs.close(this.#fd, onClose);\n } else {\n onClose(); // Error intentionally ignored, assume closed\n }\n });\n }\n\n #writeLine() {\n this.#writing = true;\n if (!this.#output) {\n const end = this.#lines.length - this.#partialLine;\n if (end > this.#head) {\n this.#output = this.#lines[this.#head++] || '';\n // Batch multiple lines into one write call below HWM, to avoid\n // excessive syscalls after when lines accumulated during a previous write\n while (this.#head < end && this.#output.length < HIGH_WATER_MARK) {\n this.#output += this.#lines[this.#head++];\n }\n if (this.#head === this.#lines.length) {\n this.#lines.length = 0;\n this.#head = 0;\n }\n }\n }\n fs.write(this.#fd, this.#output, this.#onRelease);\n }\n\n _end() {\n if (!this.#destroyed && !this.#ending) {\n this.#ending = true;\n if (this.#opening) {\n this.once('ready', () => this._end());\n } else if (!this.#writing && this.#fd >= 0) {\n if (this.#lines.length - this.#head > this.#partialLine) {\n this.#writeLine();\n } else {\n this.#close();\n }\n }\n }\n return this;\n }\n\n end(cb?: () => void): this;\n end(data: string | Uint8Array, cb?: () => void): this;\n end(str: string, encoding?: BufferEncoding, cb?: () => void): this;\n\n end(\n arg1?: Uint8Array | string | (() => void),\n arg2?: BufferEncoding | (() => void),\n arg3?: () => void\n ) {\n const maybeCb = arg3 || arg2 || arg1;\n const input = typeof arg1 !== 'function' ? arg1 : undefined;\n const encoding = typeof arg2 === 'string' ? arg2 : 'utf8';\n const cb = typeof maybeCb === 'function' ? maybeCb : undefined;\n if (typeof input === 'string') {\n this.write(input, encoding);\n } else if (input != null) {\n this.write(input);\n }\n if (cb) this.once('close', cb);\n return this._end();\n }\n\n destroy() {\n if (!this.#destroyed) this.#close();\n }\n\n flush(cb?: (error?: Error | null) => void) {\n if (this.#destroyed) {\n cb?.();\n } else {\n const onDrain = () => {\n if (!this.#destroyed) {\n fsFsync(this.#fd, (error) => {\n this.#flushPending = false;\n if (error?.code === 'EBADF') {\n cb?.(); // If fd is closed, ignore the error\n } else {\n cb?.(error);\n }\n });\n } else {\n this.#flushPending = false;\n cb?.();\n }\n this.off('error', onError);\n };\n\n const onError = (err: Error) => {\n this.#flushPending = false;\n this.off('drain', onDrain);\n cb?.(err);\n };\n\n this.#flushPending = true;\n this.once('drain', onDrain);\n this.once('error', onError);\n\n if (!this.#writing) {\n if (this.#lines.length - this.#head > this.#partialLine || this.#output) {\n // There are complete lines or remaining output to write\n this.#writeLine();\n } else {\n // Nothing complete to write, emit drain immediately\n process.nextTick(() => this.emit('drain'));\n }\n }\n }\n }\n\n _writeln(data: string): boolean {\n this.#len += data.length;\n if (!this.#writing && this.#lines.length === this.#head && !this.#output) {\n // Fast path: When no write is pending, directly write the line\n this.#writing = true;\n this.#output = data;\n fs.write(this.#fd, data, this.#onRelease);\n } else {\n this.#lines.push(data);\n if (!this.#writing) {\n this.#writeLine();\n }\n }\n return this.#len < HIGH_WATER_MARK;\n }\n\n _write(data: string): boolean {\n if (this.#destroyed) {\n return false;\n }\n\n // Fast path: For complete lines with no pending partial we can skip the work below\n if (this.#partialLine === 0 && data.charCodeAt(data.length - 1) === 10 /*'\\n'*/) {\n return this._writeln(data);\n }\n\n this.#len += data.length;\n\n let startIdx = 0;\n let endIdx = -1;\n while ((endIdx = data.indexOf('\\n', startIdx)) > -1) {\n const line = data.slice(startIdx, endIdx + 1);\n if (this.#partialLine > 0) {\n this.#lines[this.#lines.length - 1] += line;\n } else {\n this.#lines.push(line);\n }\n this.#partialLine = 0;\n startIdx = ++endIdx;\n }\n\n if (startIdx < data.length) {\n const line = data.slice(startIdx);\n if (this.#partialLine > 0) {\n this.#lines[this.#lines.length - 1] += line;\n } else {\n this.#lines.push(data.slice(startIdx));\n }\n this.#partialLine = 1;\n }\n\n if (!this.#writing && this.#lines.length - this.#head > this.#partialLine) {\n this.#writeLine();\n }\n\n return this.#len < HIGH_WATER_MARK;\n }\n\n write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;\n write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;\n\n write(\n input: Uint8Array | string,\n arg2?: BufferEncoding | ((err?: Error | null) => void),\n arg3?: (err?: Error | null) => void\n ): boolean {\n const maybeCb = arg3 || arg2;\n const encoding = typeof arg2 === 'string' ? arg2 : 'utf8';\n const data = typeof input === 'string' ? input : Buffer.from(input).toString(encoding);\n const cb = typeof maybeCb === 'function' ? maybeCb : undefined;\n try {\n return this._write(data);\n } finally {\n cb?.();\n }\n }\n\n [Symbol.dispose]() {\n this.destroy();\n }\n}\n\nconst isStdFd = (fd: number) => {\n switch (fd) {\n case 1:\n case 2:\n case process.stdout.fd:\n case process.stderr.fd:\n return true;\n default:\n return false;\n }\n};\n\nconst fsFsync = (fd: number, cb: (error?: NodeJS.ErrnoException | null) => void) => {\n try {\n fs.fsync(fd, cb);\n } catch (error: any) {\n cb(error);\n }\n};\n"],"names":["LogStream","writeEvent","BUSY_WRITE_TIMEOUT","HIGH_WATER_MARK","dest","category","kind","payload","timestamp","Date","now","rest","JSON","stringify","slice","line","length","_writeln","EventEmitter","err","written","fs","fsyncSync","process","nextTick","emit","file","fd","writing","writable","error","code","setTimeout","outputLength","Buffer","byteLength","output","from","toString","onOpened","mkdir","path","dirname","recursive","open","once","onClose","fsFsync","isStdFd","close","end","write","_end","arg1","arg2","arg3","maybeCb","input","undefined","encoding","cb","destroy","flush","onDrain","off","onError","data","push","_write","charCodeAt","startIdx","endIdx","indexOf","Symbol","dispose","stdout","stderr","fsync"],"mappings":";;;;;;;;;;;QAkBaA;eAAAA;;QAVGC;eAAAA;;;;yBARO;;;;;;;yBACM;;;;;;;gEACd;;;;;;;gEACE;;;;;;;;;;;AAEjB,MAAMC,qBAAqB;AAC3B,MAAMC,kBAAkB,OAAQ,MAAM;AAE/B,SAASF,WAAWG,IAAe,EAAEC,QAAgB,EAAEC,IAAY,EAAEC,OAAY;IACtF,M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AClD,IAAIiC;IACf,EAAE,OAAO9B,OAAY;QACnB8B,GAAG9B;IACL;AACF"}
@@ -7,17 +7,17 @@ Object.defineProperty(exports, "__esModule", {
7
7
  function _export(target, all) {
8
8
  for(var name in all)Object.defineProperty(target, name, {
9
9
  enumerable: true,
10
- get: all[name]
10
+ get: Object.getOwnPropertyDescriptor(all, name).get
11
11
  });
12
12
  }
13
13
  _export(exports, {
14
- createMetroServerAndBundleRequestAsync: function() {
14
+ get createMetroServerAndBundleRequestAsync () {
15
15
  return createMetroServerAndBundleRequestAsync;
16
16
  },
17
- drawableFileTypes: function() {
17
+ get drawableFileTypes () {
18
18
  return _metroAssetLocalPath.drawableFileTypes;
19
19
  },
20
- exportEmbedAssetsAsync: function() {
20
+ get exportEmbedAssetsAsync () {
21
21
  return _exportEmbedAsync.exportEmbedAssetsAsync;
22
22
  }
23
23
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/expoUpdatesExports.ts"],"sourcesContent":["// NOTE(@kitten): These are currently only used by expo-updates (expo-updates/utols/src/createManifestForBuildAsync)\n// They're re-exported via `expo/internal/cli-unstable-expo-updates-exports` to establish a valid dependency chain\n\nimport { getMetroServerRoot } from '@expo/config/paths';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport { createMetroServerAndBundleRequestAsync as internal_createMetroServerAndBundleRequestAsync } from './export/embed/exportEmbedAsync';\n\n// NOTE for Expo Maintainers: Do not add to this file. We want to remove this\nexport { drawableFileTypes } from './export/metroAssetLocalPath';\nexport { exportEmbedAssetsAsync } from './export/embed/exportEmbedAsync';\n\n/** Older versions of expo-updates may pass a path relative to the server root. But relative paths are expected to be relative to `projectRoot`, so we turn them into absolute paths */\nfunction fixupServerRelativePath(projectRoot: string, entryFile: string) {\n const serverRoot = getMetroServerRoot(projectRoot);\n if (!path.isAbsolute(entryFile)) {\n let candidate: string;\n if (fs.existsSync((candidate = path.resolve(serverRoot, entryFile)))) {\n entryFile = candidate;\n } else if (\n !entryFile.endsWith('.js') &&\n fs.existsSync((candidate = path.resolve(serverRoot, entryFile + '.js')))\n ) {\n entryFile = candidate;\n }\n }\n return entryFile;\n}\n\nexport const createMetroServerAndBundleRequestAsync: typeof internal_createMetroServerAndBundleRequestAsync =\n async (projectRoot, options) => {\n return await internal_createMetroServerAndBundleRequestAsync(projectRoot, {\n ...options,\n entryFile: fixupServerRelativePath(projectRoot, options.entryFile),\n });\n };\n"],"names":["createMetroServerAndBundleRequestAsync","drawableFileTypes","exportEmbedAssetsAsync","fixupServerRelativePath","projectRoot","entryFile","serverRoot","getMetroServerRoot","path","isAbsolute","candidate","fs","existsSync","resolve","endsWith","options","internal_createMetroServerAndBundleRequestAsync"],"mappings":"AAAA,oHAAoH;AACpH,kHAAkH;;;;;;;;;;;;IA6BrGA,sCAAsC;eAAtCA;;IApBJC,iBAAiB;eAAjBA,sCAAiB;;IACjBC,sBAAsB;eAAtBA,wCAAsB;;;;yBARI;;;;;;;gEACpB;;;;;;;gEACE;;;;;;kCAEyF;qCAGxE;;;;;;AAGlC,qLAAqL,GACrL,SAASC,wBAAwBC,WAAmB,EAAEC,SAAiB;IACrE,MAAMC,aAAaC,IAAAA,2BAAkB,EAACH;IACtC,IAAI,CAACI,mBAAI,CAACC,UAAU,CAACJ,YAAY;QAC/B,IAAIK;QACJ,IAAIC,iBAAE,CAACC,UAAU,CAAEF,YAAYF,mBAAI,CAACK,OAAO,CAACP,YAAYD,aAAc;YACpEA,YAAYK;QACd,OAAO,IACL,CAACL,UAAUS,QAAQ,CAAC,UACpBH,iBAAE,CAACC,UAAU,CAAEF,YAAYF,mBAAI,CAACK,OAAO,CAACP,YAAYD,YAAY,SAChE;YACAA,YAAYK;QACd;IACF;IACA,OAAOL;AACT;AAEO,MAAML,yCACX,OAAOI,aAAaW;IAClB,OAAO,MAAMC,IAAAA,wDAA+C,EAACZ,aAAa;QACxE,GAAGW,OAAO;QACVV,WAAWF,wBAAwBC,aAAaW,QAAQV,SAAS;IACnE;AACF"}
1
+ {"version":3,"sources":["../../src/expoUpdatesExports.ts"],"sourcesContent":["// NOTE(@kitten): These are currently only used by expo-updates (expo-updates/utols/src/createManifestForBuildAsync)\n// They're re-exported via `expo/internal/cli-unstable-expo-updates-exports` to establish a valid dependency chain\n\nimport { getMetroServerRoot } from '@expo/config/paths';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport { createMetroServerAndBundleRequestAsync as internal_createMetroServerAndBundleRequestAsync } from './export/embed/exportEmbedAsync';\n\n// NOTE for Expo Maintainers: Do not add to this file. We want to remove this\nexport { drawableFileTypes } from './export/metroAssetLocalPath';\nexport { exportEmbedAssetsAsync } from './export/embed/exportEmbedAsync';\n\n/** Older versions of expo-updates may pass a path relative to the server root. But relative paths are expected to be relative to `projectRoot`, so we turn them into absolute paths */\nfunction fixupServerRelativePath(projectRoot: string, entryFile: string) {\n const serverRoot = getMetroServerRoot(projectRoot);\n if (!path.isAbsolute(entryFile)) {\n let candidate: string;\n if (fs.existsSync((candidate = path.resolve(serverRoot, entryFile)))) {\n entryFile = candidate;\n } else if (\n !entryFile.endsWith('.js') &&\n fs.existsSync((candidate = path.resolve(serverRoot, entryFile + '.js')))\n ) {\n entryFile = candidate;\n }\n }\n return entryFile;\n}\n\nexport const createMetroServerAndBundleRequestAsync: typeof internal_createMetroServerAndBundleRequestAsync =\n async (projectRoot, options) => {\n return await internal_createMetroServerAndBundleRequestAsync(projectRoot, {\n ...options,\n entryFile: fixupServerRelativePath(projectRoot, options.entryFile),\n });\n };\n"],"names":["createMetroServerAndBundleRequestAsync","drawableFileTypes","exportEmbedAssetsAsync","fixupServerRelativePath","projectRoot","entryFile","serverRoot","getMetroServerRoot","path","isAbsolute","candidate","fs","existsSync","resolve","endsWith","options","internal_createMetroServerAndBundleRequestAsync"],"mappings":"AAAA,oHAAoH;AACpH,kHAAkH;;;;;;;;;;;;QA6BrGA;eAAAA;;QApBJC;eAAAA,sCAAiB;;QACjBC;eAAAA,wCAAsB;;;;yBARI;;;;;;;gEACpB;;;;;;;gEACE;;;;;;kCAEyF;qCAGxE;;;;;;AAGlC,qLAAqL,GACrL,SAASC,wBAAwBC,WAAmB,EAAEC,SAAiB;IACrE,MAAMC,aAAaC,IAAAA,2BAAkB,EAACH;IACtC,IAAI,CAACI,mBAAI,CAACC,UAAU,CAACJ,YAAY;QAC/B,IAAIK;QACJ,IAAIC,iBAAE,CAACC,UAAU,CAAEF,YAAYF,mBAAI,CAACK,OAAO,CAACP,YAAYD,aAAc;YACpEA,YAAYK;QACd,OAAO,IACL,CAACL,UAAUS,QAAQ,CAAC,UACpBH,iBAAE,CAACC,UAAU,CAAEF,YAAYF,mBAAI,CAACK,OAAO,CAACP,YAAYD,YAAY,SAChE;YACAA,YAAYK;QACd;IACF;IACA,OAAOL;AACT;AAEO,MAAML,yCACX,OAAOI,aAAaW;IAClB,OAAO,MAAMC,IAAAA,wDAA+C,EAACZ,aAAa;QACxE,GAAGW,OAAO;QACVV,WAAWF,wBAAwBC,aAAaW,QAAQV,SAAS;IACnE;AACF"}
@@ -26,6 +26,7 @@ function createMetadataJson({ bundles, fileNames, embeddedHashSet, domComponentA
26
26
  version: 0,
27
27
  bundler: 'metro',
28
28
  fileMetadata: Object.entries(bundles).reduce((metadata, [platform, bundle])=>{
29
+ var _fileNames_platform;
29
30
  if (platform === 'web') return metadata;
30
31
  // Collect all of the assets and convert them to the serial format, deduplicating by path.
31
32
  const seen = new Set();
@@ -49,7 +50,7 @@ function createMetadataJson({ bundles, fileNames, embeddedHashSet, domComponentA
49
50
  [platform]: {
50
51
  // Get the filename for each platform's bundle.
51
52
  // TODO: Add multi-bundle support to EAS Update!!
52
- bundle: fileNames[platform][0],
53
+ bundle: (_fileNames_platform = fileNames[platform]) == null ? void 0 : _fileNames_platform[0],
53
54
  assets
54
55
  }
55
56
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/export/createMetadataJson.ts"],"sourcesContent":["import path from 'path';\n\nimport type { BundleOutput } from './saveAssets';\n\nexport type BundlePlatform = 'android' | 'ios';\n\ntype PlatformMetadataAsset = { path: string; ext: string };\n\nexport type PlatformMetadata = { bundle: string; assets: PlatformMetadataAsset[] };\n\ntype FileMetadata = {\n [key in BundlePlatform]: PlatformMetadata;\n};\n\nexport function createMetadataJson({\n bundles,\n fileNames,\n embeddedHashSet,\n domComponentAssetsMetadata,\n}: {\n bundles: Partial<Record<BundlePlatform, Pick<BundleOutput, 'assets'>>>;\n fileNames: Record<string, string[]>;\n embeddedHashSet?: Set<string>;\n domComponentAssetsMetadata?: Record<string, PlatformMetadataAsset[]>;\n}): {\n version: 0;\n bundler: 'metro';\n fileMetadata: FileMetadata;\n} {\n // Build metadata.json\n return {\n version: 0,\n bundler: 'metro',\n fileMetadata: Object.entries(bundles).reduce<Record<string, Partial<PlatformMetadata>>>(\n (metadata, [platform, bundle]) => {\n if (platform === 'web') return metadata;\n\n // Collect all of the assets and convert them to the serial format, deduplicating by path.\n const seen = new Set<string>();\n const assets = bundle.assets\n .filter((asset) => !embeddedHashSet || !embeddedHashSet.has(asset.hash))\n .map((asset) =>\n // Each asset has multiple hashes which we convert and then flatten.\n asset.fileHashes?.map((hash) => ({\n path: path.join('assets', hash),\n ext: asset.type,\n }))\n )\n .filter(Boolean)\n .flat()\n .filter((a) => {\n if (seen.has(a.path)) return false;\n seen.add(a.path);\n return true;\n });\n\n if (domComponentAssetsMetadata?.[platform] != null) {\n assets.push(...domComponentAssetsMetadata?.[platform]);\n }\n\n return {\n ...metadata,\n [platform]: {\n // Get the filename for each platform's bundle.\n // TODO: Add multi-bundle support to EAS Update!!\n bundle: fileNames[platform][0],\n assets,\n },\n };\n },\n {}\n ) as FileMetadata,\n };\n}\n"],"names":["createMetadataJson","bundles","fileNames","embeddedHashSet","domComponentAssetsMetadata","version","bundler","fileMetadata","Object","entries","reduce","metadata","platform","bundle","seen","Set","assets","filter","asset","has","hash","map","fileHashes","path","join","ext","type","Boolean","flat","a","add","push"],"mappings":";;;;+BAcgBA;;;eAAAA;;;;gEAdC;;;;;;;;;;;AAcV,SAASA,mBAAmB,EACjCC,OAAO,EACPC,SAAS,EACTC,eAAe,EACfC,0BAA0B,EAM3B;IAKC,sBAAsB;IACtB,OAAO;QACLC,SAAS;QACTC,SAAS;QACTC,cAAcC,OAAOC,OAAO,CAACR,SAASS,MAAM,CAC1C,CAACC,UAAU,CAACC,UAAUC,OAAO;YAC3B,IAAID,aAAa,OAAO,OAAOD;YAE/B,0FAA0F;YAC1F,MAAMG,OAAO,IAAIC;YACjB,MAAMC,SAASH,OAAOG,MAAM,CACzBC,MAAM,CAAC,CAACC,QAAU,CAACf,mBAAmB,CAACA,gBAAgBgB,GAAG,CAACD,MAAME,IAAI,GACrEC,GAAG,CAAC,CAACH;oBACJ,oEAAoE;gBACpEA;wBAAAA,oBAAAA,MAAMI,UAAU,qBAAhBJ,kBAAkBG,GAAG,CAAC,CAACD,OAAU,CAAA;wBAC/BG,MAAMA,eAAI,CAACC,IAAI,CAAC,UAAUJ;wBAC1BK,KAAKP,MAAMQ,IAAI;oBACjB,CAAA;eAEDT,MAAM,CAACU,SACPC,IAAI,GACJX,MAAM,CAAC,CAACY;gBACP,IAAIf,KAAKK,GAAG,CAACU,EAAEN,IAAI,GAAG,OAAO;gBAC7BT,KAAKgB,GAAG,CAACD,EAAEN,IAAI;gBACf,OAAO;YACT;YAEF,IAAInB,CAAAA,8CAAAA,0BAA4B,CAACQ,SAAS,KAAI,MAAM;gBAClDI,OAAOe,IAAI,IAAI3B,8CAAAA,0BAA4B,CAACQ,SAAS;YACvD;YAEA,OAAO;gBACL,GAAGD,QAAQ;gBACX,CAACC,SAAS,EAAE;oBACV,+CAA+C;oBAC/C,iDAAiD;oBACjDC,QAAQX,SAAS,CAACU,SAAS,CAAC,EAAE;oBAC9BI;gBACF;YACF;QACF,GACA,CAAC;IAEL;AACF"}
1
+ {"version":3,"sources":["../../../src/export/createMetadataJson.ts"],"sourcesContent":["import type { NativePlatform } from '@expo/config';\nimport path from 'path';\n\nimport type { BundleOutput } from './saveAssets';\n\n/** Native platforms that produce a bundle in `metadata.json` (web is handled separately). */\nexport type BundlePlatform = NativePlatform;\n\ntype PlatformMetadataAsset = { path: string; ext: string };\n\nexport type PlatformMetadata = { bundle: string; assets: PlatformMetadataAsset[] };\n\ntype FileMetadata = {\n [key in BundlePlatform]: PlatformMetadata;\n};\n\nexport function createMetadataJson({\n bundles,\n fileNames,\n embeddedHashSet,\n domComponentAssetsMetadata,\n}: {\n bundles: Partial<Record<BundlePlatform, Pick<BundleOutput, 'assets'>>>;\n fileNames: Record<string, string[]>;\n embeddedHashSet?: Set<string>;\n domComponentAssetsMetadata?: Record<string, PlatformMetadataAsset[]>;\n}): {\n version: 0;\n bundler: 'metro';\n fileMetadata: FileMetadata;\n} {\n // Build metadata.json\n return {\n version: 0,\n bundler: 'metro',\n fileMetadata: Object.entries(bundles).reduce<Record<string, Partial<PlatformMetadata>>>(\n (metadata, [platform, bundle]) => {\n if (platform === 'web') return metadata;\n\n // Collect all of the assets and convert them to the serial format, deduplicating by path.\n const seen = new Set<string>();\n const assets = bundle.assets\n .filter((asset) => !embeddedHashSet || !embeddedHashSet.has(asset.hash))\n .map((asset) =>\n // Each asset has multiple hashes which we convert and then flatten.\n asset.fileHashes?.map((hash) => ({\n path: path.join('assets', hash),\n ext: asset.type,\n }))\n )\n .filter(Boolean)\n .flat()\n .filter((a) => {\n if (seen.has(a.path)) return false;\n seen.add(a.path);\n return true;\n });\n\n if (domComponentAssetsMetadata?.[platform] != null) {\n assets.push(...domComponentAssetsMetadata?.[platform]);\n }\n\n return {\n ...metadata,\n [platform]: {\n // Get the filename for each platform's bundle.\n // TODO: Add multi-bundle support to EAS Update!!\n bundle: fileNames[platform]?.[0],\n assets,\n },\n };\n },\n {}\n ) as FileMetadata,\n };\n}\n"],"names":["createMetadataJson","bundles","fileNames","embeddedHashSet","domComponentAssetsMetadata","version","bundler","fileMetadata","Object","entries","reduce","metadata","platform","bundle","seen","Set","assets","filter","asset","has","hash","map","fileHashes","path","join","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