@expo/cli 0.17.10 → 0.18.1

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 (693) hide show
  1. package/build/bin/cli +98 -118
  2. package/build/bin/cli.map +1 -1
  3. package/build/src/api/endpoint.js +11 -3
  4. package/build/src/api/endpoint.js.map +1 -1
  5. package/build/src/api/getExpoGoIntermediateCertificate.js +7 -4
  6. package/build/src/api/getExpoGoIntermediateCertificate.js.map +1 -1
  7. package/build/src/api/getExpoSchema.js +32 -12
  8. package/build/src/api/getExpoSchema.js.map +1 -1
  9. package/build/src/api/getNativeModuleVersions.js +7 -4
  10. package/build/src/api/getNativeModuleVersions.js.map +1 -1
  11. package/build/src/api/getProjectDevelopmentCertificate.js +7 -4
  12. package/build/src/api/getProjectDevelopmentCertificate.js.map +1 -1
  13. package/build/src/api/getVersions.js +7 -4
  14. package/build/src/api/getVersions.js.map +1 -1
  15. package/build/src/api/graphql/client.js +78 -40
  16. package/build/src/api/graphql/client.js.map +1 -1
  17. package/build/src/api/graphql/queries/AppQuery.js +22 -8
  18. package/build/src/api/graphql/queries/AppQuery.js.map +1 -1
  19. package/build/src/api/graphql/queries/UserQuery.js +13 -5
  20. package/build/src/api/graphql/queries/UserQuery.js.map +1 -1
  21. package/build/src/api/graphql/types/App.js +12 -4
  22. package/build/src/api/graphql/types/App.js.map +1 -1
  23. package/build/src/api/rest/cache/FileSystemCache.js +25 -11
  24. package/build/src/api/rest/cache/FileSystemCache.js.map +1 -1
  25. package/build/src/api/rest/cache/response.js +13 -4
  26. package/build/src/api/rest/cache/response.js.map +1 -1
  27. package/build/src/api/rest/cache/wrapFetchWithCache.js +51 -18
  28. package/build/src/api/rest/cache/wrapFetchWithCache.js.map +1 -1
  29. package/build/src/api/rest/client.js +55 -30
  30. package/build/src/api/rest/client.js.map +1 -1
  31. package/build/src/api/rest/wrapFetchWithBaseUrl.js +13 -5
  32. package/build/src/api/rest/wrapFetchWithBaseUrl.js.map +1 -1
  33. package/build/src/api/rest/wrapFetchWithOffline.js +5 -2
  34. package/build/src/api/rest/wrapFetchWithOffline.js.map +1 -1
  35. package/build/src/api/rest/wrapFetchWithProgress.js +40 -19
  36. package/build/src/api/rest/wrapFetchWithProgress.js.map +1 -1
  37. package/build/src/api/rest/wrapFetchWithProxy.js +13 -4
  38. package/build/src/api/rest/wrapFetchWithProxy.js.map +1 -1
  39. package/build/src/api/settings.js +16 -5
  40. package/build/src/api/settings.js.map +1 -1
  41. package/build/src/api/updateDevelopmentSession.js +33 -13
  42. package/build/src/api/updateDevelopmentSession.js.map +1 -1
  43. package/build/src/api/user/UserSettings.js +31 -11
  44. package/build/src/api/user/UserSettings.js.map +1 -1
  45. package/build/src/api/user/actions.js +78 -41
  46. package/build/src/api/user/actions.js.map +1 -1
  47. package/build/src/api/user/expoSsoLauncher.js +72 -27
  48. package/build/src/api/user/expoSsoLauncher.js.map +1 -1
  49. package/build/src/api/user/otp.js +82 -50
  50. package/build/src/api/user/otp.js.map +1 -1
  51. package/build/src/api/user/user.js +80 -48
  52. package/build/src/api/user/user.js.map +1 -1
  53. package/build/src/config/configAsync.js +82 -45
  54. package/build/src/config/configAsync.js.map +1 -1
  55. package/build/src/config/index.js +52 -30
  56. package/build/src/config/index.js.map +1 -1
  57. package/build/src/customize/customizeAsync.js +21 -12
  58. package/build/src/customize/customizeAsync.js.map +1 -1
  59. package/build/src/customize/generate.js +74 -47
  60. package/build/src/customize/generate.js.map +1 -1
  61. package/build/src/customize/index.js +16 -8
  62. package/build/src/customize/index.js.map +1 -1
  63. package/build/src/customize/resolveOptions.js +7 -4
  64. package/build/src/customize/resolveOptions.js.map +1 -1
  65. package/build/src/customize/templates.js +58 -37
  66. package/build/src/customize/templates.js.map +1 -1
  67. package/build/src/customize/typescript.js +50 -29
  68. package/build/src/customize/typescript.js.map +1 -1
  69. package/build/src/export/createMetadataJson.js +14 -7
  70. package/build/src/export/createMetadataJson.js.map +1 -1
  71. package/build/src/export/embed/exportEmbedAsync.js +103 -50
  72. package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
  73. package/build/src/export/embed/index.js +61 -37
  74. package/build/src/export/embed/index.js.map +1 -1
  75. package/build/src/export/embed/resolveOptions.js +14 -5
  76. package/build/src/export/embed/resolveOptions.js.map +1 -1
  77. package/build/src/export/embed/xcodeCompilerLogger.js +33 -9
  78. package/build/src/export/embed/xcodeCompilerLogger.js.map +1 -1
  79. package/build/src/export/exportApp.js +110 -73
  80. package/build/src/export/exportApp.js.map +1 -1
  81. package/build/src/export/exportAssets.js +84 -47
  82. package/build/src/export/exportAssets.js.map +1 -1
  83. package/build/src/export/exportAsync.js +56 -27
  84. package/build/src/export/exportAsync.js.map +1 -1
  85. package/build/src/export/exportHermes.js +46 -26
  86. package/build/src/export/exportHermes.js.map +1 -1
  87. package/build/src/export/exportStaticAsync.js +109 -66
  88. package/build/src/export/exportStaticAsync.js.map +1 -1
  89. package/build/src/export/favicon.js +47 -15
  90. package/build/src/export/favicon.js.map +1 -1
  91. package/build/src/export/fork-bundleAsync.js +92 -44
  92. package/build/src/export/fork-bundleAsync.js.map +1 -1
  93. package/build/src/export/getPublicExpoManifest.js +16 -7
  94. package/build/src/export/getPublicExpoManifest.js.map +1 -1
  95. package/build/src/export/getResolvedLocales.js +20 -5
  96. package/build/src/export/getResolvedLocales.js.map +1 -1
  97. package/build/src/export/html.js +12 -4
  98. package/build/src/export/html.js.map +1 -1
  99. package/build/src/export/index.js +55 -33
  100. package/build/src/export/index.js.map +1 -1
  101. package/build/src/export/metroAssetLocalPath.js +30 -8
  102. package/build/src/export/metroAssetLocalPath.js.map +1 -1
  103. package/build/src/export/persistMetroAssets.js +59 -33
  104. package/build/src/export/persistMetroAssets.js.map +1 -1
  105. package/build/src/export/publicFolder.js +31 -11
  106. package/build/src/export/publicFolder.js.map +1 -1
  107. package/build/src/export/resolveOptions.js +26 -16
  108. package/build/src/export/resolveOptions.js.map +1 -1
  109. package/build/src/export/saveAssets.js +77 -49
  110. package/build/src/export/saveAssets.js.map +1 -1
  111. package/build/src/export/web/exportWebAsync.js +28 -13
  112. package/build/src/export/web/exportWebAsync.js.map +1 -1
  113. package/build/src/export/web/index.js +53 -31
  114. package/build/src/export/web/index.js.map +1 -1
  115. package/build/src/export/web/resolveOptions.js +4 -1
  116. package/build/src/export/web/resolveOptions.js.map +1 -1
  117. package/build/src/export/writeContents.js +12 -7
  118. package/build/src/export/writeContents.js.map +1 -1
  119. package/build/src/graphql/generated.js +141 -128
  120. package/build/src/graphql/generated.js.map +1 -1
  121. package/build/src/install/applyPlugins.js +50 -26
  122. package/build/src/install/applyPlugins.js.map +1 -1
  123. package/build/src/install/checkPackages.js +68 -36
  124. package/build/src/install/checkPackages.js.map +1 -1
  125. package/build/src/install/fixPackages.js +58 -35
  126. package/build/src/install/fixPackages.js.map +1 -1
  127. package/build/src/install/index.js +21 -13
  128. package/build/src/install/index.js.map +1 -1
  129. package/build/src/install/installAsync.js +107 -64
  130. package/build/src/install/installAsync.js.map +1 -1
  131. package/build/src/install/installExpoPackage.js +60 -27
  132. package/build/src/install/installExpoPackage.js.map +1 -1
  133. package/build/src/install/resolveOptions.js +8 -5
  134. package/build/src/install/resolveOptions.js.map +1 -1
  135. package/build/src/install/utils/autoAddConfigPlugins.js +29 -9
  136. package/build/src/install/utils/autoAddConfigPlugins.js.map +1 -1
  137. package/build/src/lint/ESlintPrerequisite.js +174 -0
  138. package/build/src/lint/ESlintPrerequisite.js.map +1 -0
  139. package/build/src/lint/index.js +66 -0
  140. package/build/src/lint/index.js.map +1 -0
  141. package/build/src/lint/lintAsync.js +33 -0
  142. package/build/src/lint/lintAsync.js.map +1 -0
  143. package/build/src/log.js +27 -15
  144. package/build/src/log.js.map +1 -1
  145. package/build/src/login/index.js +43 -25
  146. package/build/src/login/index.js.map +1 -1
  147. package/build/src/logout/index.js +43 -25
  148. package/build/src/logout/index.js.map +1 -1
  149. package/build/src/prebuild/clearNativeFolder.js +97 -50
  150. package/build/src/prebuild/clearNativeFolder.js.map +1 -1
  151. package/build/src/prebuild/configureProjectAsync.js +64 -31
  152. package/build/src/prebuild/configureProjectAsync.js.map +1 -1
  153. package/build/src/prebuild/copyTemplateFiles.js +41 -17
  154. package/build/src/prebuild/copyTemplateFiles.js.map +1 -1
  155. package/build/src/prebuild/ensureConfigAsync.js +74 -30
  156. package/build/src/prebuild/ensureConfigAsync.js.map +1 -1
  157. package/build/src/prebuild/index.js +58 -38
  158. package/build/src/prebuild/index.js.map +1 -1
  159. package/build/src/prebuild/prebuildAsync.js +75 -52
  160. package/build/src/prebuild/prebuildAsync.js.map +1 -1
  161. package/build/src/prebuild/renameTemplateAppName.js +124 -0
  162. package/build/src/prebuild/renameTemplateAppName.js.map +1 -0
  163. package/build/src/prebuild/resolveOptions.js +85 -36
  164. package/build/src/prebuild/resolveOptions.js.map +1 -1
  165. package/build/src/prebuild/resolveTemplate.js +102 -46
  166. package/build/src/prebuild/resolveTemplate.js.map +1 -1
  167. package/build/src/prebuild/updateFromTemplate.js +80 -41
  168. package/build/src/prebuild/updateFromTemplate.js.map +1 -1
  169. package/build/src/prebuild/updatePackageJson.js +111 -54
  170. package/build/src/prebuild/updatePackageJson.js.map +1 -1
  171. package/build/src/prebuild/validateTemplatePlatforms.js +56 -23
  172. package/build/src/prebuild/validateTemplatePlatforms.js.map +1 -1
  173. package/build/src/register/index.js +43 -25
  174. package/build/src/register/index.js.map +1 -1
  175. package/build/src/register/registerAsync.js +14 -11
  176. package/build/src/register/registerAsync.js.map +1 -1
  177. package/build/src/run/android/index.js +64 -32
  178. package/build/src/run/android/index.js.map +1 -1
  179. package/build/src/run/android/resolveDevice.js +9 -6
  180. package/build/src/run/android/resolveDevice.js.map +1 -1
  181. package/build/src/run/android/resolveGradlePropsAsync.js +56 -0
  182. package/build/src/run/android/resolveGradlePropsAsync.js.map +1 -0
  183. package/build/src/run/android/resolveInstallApkName.js +28 -14
  184. package/build/src/run/android/resolveInstallApkName.js.map +1 -1
  185. package/build/src/run/android/resolveLaunchProps.js +16 -7
  186. package/build/src/run/android/resolveLaunchProps.js.map +1 -1
  187. package/build/src/run/android/resolveOptions.js +14 -9
  188. package/build/src/run/android/resolveOptions.js.map +1 -1
  189. package/build/src/run/android/runAndroidAsync.js +39 -27
  190. package/build/src/run/android/runAndroidAsync.js.map +1 -1
  191. package/build/src/run/ensureNativeProject.js +24 -9
  192. package/build/src/run/ensureNativeProject.js.map +1 -1
  193. package/build/src/run/hints.js +23 -9
  194. package/build/src/run/hints.js.map +1 -1
  195. package/build/src/run/index.js +55 -35
  196. package/build/src/run/index.js.map +1 -1
  197. package/build/src/run/ios/XcodeBuild.js +126 -66
  198. package/build/src/run/ios/XcodeBuild.js.map +1 -1
  199. package/build/src/run/ios/appleDevice/AppleDevice.js +52 -27
  200. package/build/src/run/ios/appleDevice/AppleDevice.js.map +1 -1
  201. package/build/src/run/ios/appleDevice/ClientManager.js +70 -31
  202. package/build/src/run/ios/appleDevice/ClientManager.js.map +1 -1
  203. package/build/src/run/ios/appleDevice/client/AFCClient.js +94 -44
  204. package/build/src/run/ios/appleDevice/client/AFCClient.js.map +1 -1
  205. package/build/src/run/ios/appleDevice/client/DebugserverClient.js +63 -24
  206. package/build/src/run/ios/appleDevice/client/DebugserverClient.js.map +1 -1
  207. package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js +21 -6
  208. package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js.map +1 -1
  209. package/build/src/run/ios/appleDevice/client/LockdowndClient.js +64 -25
  210. package/build/src/run/ios/appleDevice/client/LockdowndClient.js.map +1 -1
  211. package/build/src/run/ios/appleDevice/client/MobileImageMounterClient.js +66 -28
  212. package/build/src/run/ios/appleDevice/client/MobileImageMounterClient.js.map +1 -1
  213. package/build/src/run/ios/appleDevice/client/ServiceClient.js +18 -4
  214. package/build/src/run/ios/appleDevice/client/ServiceClient.js.map +1 -1
  215. package/build/src/run/ios/appleDevice/client/UsbmuxdClient.js +42 -15
  216. package/build/src/run/ios/appleDevice/client/UsbmuxdClient.js.map +1 -1
  217. package/build/src/run/ios/appleDevice/installOnDeviceAsync.js +78 -34
  218. package/build/src/run/ios/appleDevice/installOnDeviceAsync.js.map +1 -1
  219. package/build/src/run/ios/appleDevice/protocol/AFCProtocol.js +85 -66
  220. package/build/src/run/ios/appleDevice/protocol/AFCProtocol.js.map +1 -1
  221. package/build/src/run/ios/appleDevice/protocol/AbstractProtocol.js +41 -15
  222. package/build/src/run/ios/appleDevice/protocol/AbstractProtocol.js.map +1 -1
  223. package/build/src/run/ios/appleDevice/protocol/GDBProtocol.js +30 -11
  224. package/build/src/run/ios/appleDevice/protocol/GDBProtocol.js.map +1 -1
  225. package/build/src/run/ios/appleDevice/protocol/LockdownProtocol.js +39 -14
  226. package/build/src/run/ios/appleDevice/protocol/LockdownProtocol.js.map +1 -1
  227. package/build/src/run/ios/appleDevice/protocol/UsbmuxProtocol.js +36 -11
  228. package/build/src/run/ios/appleDevice/protocol/UsbmuxProtocol.js.map +1 -1
  229. package/build/src/run/ios/codeSigning/Security.js +40 -21
  230. package/build/src/run/ios/codeSigning/Security.js.map +1 -1
  231. package/build/src/run/ios/codeSigning/configureCodeSigning.js +55 -28
  232. package/build/src/run/ios/codeSigning/configureCodeSigning.js.map +1 -1
  233. package/build/src/run/ios/codeSigning/resolveCertificateSigningIdentity.js +67 -36
  234. package/build/src/run/ios/codeSigning/resolveCertificateSigningIdentity.js.map +1 -1
  235. package/build/src/run/ios/codeSigning/settings.js +11 -3
  236. package/build/src/run/ios/codeSigning/settings.js.map +1 -1
  237. package/build/src/run/ios/codeSigning/simulatorCodeSigning.js +30 -10
  238. package/build/src/run/ios/codeSigning/simulatorCodeSigning.js.map +1 -1
  239. package/build/src/run/ios/codeSigning/xcodeCodeSigning.js +33 -15
  240. package/build/src/run/ios/codeSigning/xcodeCodeSigning.js.map +1 -1
  241. package/build/src/run/ios/index.js +63 -35
  242. package/build/src/run/ios/index.js.map +1 -1
  243. package/build/src/run/ios/launchApp.js +65 -32
  244. package/build/src/run/ios/launchApp.js.map +1 -1
  245. package/build/src/run/ios/options/promptDevice.js +24 -14
  246. package/build/src/run/ios/options/promptDevice.js.map +1 -1
  247. package/build/src/run/ios/options/resolveDevice.js +64 -41
  248. package/build/src/run/ios/options/resolveDevice.js.map +1 -1
  249. package/build/src/run/ios/options/resolveNativeScheme.js +80 -39
  250. package/build/src/run/ios/options/resolveNativeScheme.js.map +1 -1
  251. package/build/src/run/ios/options/resolveOptions.js +15 -12
  252. package/build/src/run/ios/options/resolveOptions.js.map +1 -1
  253. package/build/src/run/ios/options/resolveXcodeProject.js +13 -4
  254. package/build/src/run/ios/options/resolveXcodeProject.js.map +1 -1
  255. package/build/src/run/ios/runIosAsync.js +71 -42
  256. package/build/src/run/ios/runIosAsync.js.map +1 -1
  257. package/build/src/run/resolveBundlerProps.js +8 -5
  258. package/build/src/run/resolveBundlerProps.js.map +1 -1
  259. package/build/src/run/startBundler.js +60 -27
  260. package/build/src/run/startBundler.js.map +1 -1
  261. package/build/src/start/detectDevClient.js +32 -0
  262. package/build/src/start/detectDevClient.js.map +1 -0
  263. package/build/src/start/doctor/Prerequisite.js +15 -7
  264. package/build/src/start/doctor/Prerequisite.js.map +1 -1
  265. package/build/src/start/doctor/SecurityBinPrerequisite.js +13 -4
  266. package/build/src/start/doctor/SecurityBinPrerequisite.js.map +1 -1
  267. package/build/src/start/doctor/apple/SimulatorAppPrerequisite.js +57 -24
  268. package/build/src/start/doctor/apple/SimulatorAppPrerequisite.js.map +1 -1
  269. package/build/src/start/doctor/apple/XcodeDeveloperDiskImagePrerequisite.js +57 -24
  270. package/build/src/start/doctor/apple/XcodeDeveloperDiskImagePrerequisite.js.map +1 -1
  271. package/build/src/start/doctor/apple/XcodePrerequisite.js +132 -57
  272. package/build/src/start/doctor/apple/XcodePrerequisite.js.map +1 -1
  273. package/build/src/start/doctor/apple/XcrunPrerequisite.js +34 -13
  274. package/build/src/start/doctor/apple/XcrunPrerequisite.js.map +1 -1
  275. package/build/src/start/doctor/dependencies/bundledNativeModules.js +69 -30
  276. package/build/src/start/doctor/dependencies/bundledNativeModules.js.map +1 -1
  277. package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js +120 -57
  278. package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js.map +1 -1
  279. package/build/src/start/doctor/dependencies/getMissingPackages.js +38 -12
  280. package/build/src/start/doctor/dependencies/getMissingPackages.js.map +1 -1
  281. package/build/src/start/doctor/dependencies/getVersionedPackages.js +29 -15
  282. package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
  283. package/build/src/start/doctor/dependencies/resolvePackages.js +39 -15
  284. package/build/src/start/doctor/dependencies/resolvePackages.js.map +1 -1
  285. package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +88 -55
  286. package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -1
  287. package/build/src/start/doctor/ngrok/ExternalModule.js +88 -39
  288. package/build/src/start/doctor/ngrok/ExternalModule.js.map +1 -1
  289. package/build/src/start/doctor/ngrok/NgrokResolver.js +12 -5
  290. package/build/src/start/doctor/ngrok/NgrokResolver.js.map +1 -1
  291. package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js +75 -45
  292. package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js.map +1 -1
  293. package/build/src/start/doctor/typescript/updateTSConfig.js +81 -40
  294. package/build/src/start/doctor/typescript/updateTSConfig.js.map +1 -1
  295. package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js +70 -32
  296. package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js.map +1 -1
  297. package/build/src/start/index.js +62 -42
  298. package/build/src/start/index.js.map +1 -1
  299. package/build/src/start/interface/KeyPressHandler.js +43 -22
  300. package/build/src/start/interface/KeyPressHandler.js.map +1 -1
  301. package/build/src/start/interface/commandsTable.js +81 -41
  302. package/build/src/start/interface/commandsTable.js.map +1 -1
  303. package/build/src/start/interface/interactiveActions.js +91 -68
  304. package/build/src/start/interface/interactiveActions.js.map +1 -1
  305. package/build/src/start/interface/startInterface.js +84 -57
  306. package/build/src/start/interface/startInterface.js.map +1 -1
  307. package/build/src/start/platforms/AppIdResolver.js +16 -7
  308. package/build/src/start/platforms/AppIdResolver.js.map +1 -1
  309. package/build/src/start/platforms/DeviceManager.js +47 -20
  310. package/build/src/start/platforms/DeviceManager.js.map +1 -1
  311. package/build/src/start/platforms/ExpoGoInstaller.js +81 -45
  312. package/build/src/start/platforms/ExpoGoInstaller.js.map +1 -1
  313. package/build/src/start/platforms/PlatformManager.js +42 -20
  314. package/build/src/start/platforms/PlatformManager.js.map +1 -1
  315. package/build/src/start/platforms/android/ADBServer.js +28 -13
  316. package/build/src/start/platforms/android/ADBServer.js.map +1 -1
  317. package/build/src/start/platforms/android/AndroidAppIdResolver.js +18 -10
  318. package/build/src/start/platforms/android/AndroidAppIdResolver.js.map +1 -1
  319. package/build/src/start/platforms/android/AndroidDeviceManager.js +86 -54
  320. package/build/src/start/platforms/android/AndroidDeviceManager.js.map +1 -1
  321. package/build/src/start/platforms/android/AndroidPlatformManager.js +9 -6
  322. package/build/src/start/platforms/android/AndroidPlatformManager.js.map +1 -1
  323. package/build/src/start/platforms/android/AndroidSdk.js +38 -11
  324. package/build/src/start/platforms/android/AndroidSdk.js.map +1 -1
  325. package/build/src/start/platforms/android/activateWindow.js +54 -21
  326. package/build/src/start/platforms/android/activateWindow.js.map +1 -1
  327. package/build/src/start/platforms/android/adb.js +89 -51
  328. package/build/src/start/platforms/android/adb.js.map +1 -1
  329. package/build/src/start/platforms/android/adbReverse.js +57 -31
  330. package/build/src/start/platforms/android/adbReverse.js.map +1 -1
  331. package/build/src/start/platforms/android/emulator.js +89 -44
  332. package/build/src/start/platforms/android/emulator.js.map +1 -1
  333. package/build/src/start/platforms/android/getDevices.js +11 -10
  334. package/build/src/start/platforms/android/getDevices.js.map +1 -1
  335. package/build/src/start/platforms/android/gradle.js +38 -14
  336. package/build/src/start/platforms/android/gradle.js.map +1 -1
  337. package/build/src/start/platforms/android/promptAndroidDevice.js +22 -16
  338. package/build/src/start/platforms/android/promptAndroidDevice.js.map +1 -1
  339. package/build/src/start/platforms/ios/AppleAppIdResolver.js +31 -10
  340. package/build/src/start/platforms/ios/AppleAppIdResolver.js.map +1 -1
  341. package/build/src/start/platforms/ios/AppleDeviceManager.js +120 -62
  342. package/build/src/start/platforms/ios/AppleDeviceManager.js.map +1 -1
  343. package/build/src/start/platforms/ios/ApplePlatformManager.js +7 -4
  344. package/build/src/start/platforms/ios/ApplePlatformManager.js.map +1 -1
  345. package/build/src/start/platforms/ios/assertSystemRequirements.js +11 -7
  346. package/build/src/start/platforms/ios/assertSystemRequirements.js.map +1 -1
  347. package/build/src/start/platforms/ios/ensureSimulatorAppRunning.js +60 -27
  348. package/build/src/start/platforms/ios/ensureSimulatorAppRunning.js.map +1 -1
  349. package/build/src/start/platforms/ios/getBestSimulator.js +60 -30
  350. package/build/src/start/platforms/ios/getBestSimulator.js.map +1 -1
  351. package/build/src/start/platforms/ios/promptAppleDevice.js +25 -13
  352. package/build/src/start/platforms/ios/promptAppleDevice.js.map +1 -1
  353. package/build/src/start/platforms/ios/simctl.js +75 -46
  354. package/build/src/start/platforms/ios/simctl.js.map +1 -1
  355. package/build/src/start/platforms/ios/simctlLogging.js +100 -47
  356. package/build/src/start/platforms/ios/simctlLogging.js.map +1 -1
  357. package/build/src/start/platforms/ios/xcrun.js +21 -6
  358. package/build/src/start/platforms/ios/xcrun.js.map +1 -1
  359. package/build/src/start/project/devices.js +19 -16
  360. package/build/src/start/project/devices.js.map +1 -1
  361. package/build/src/start/project/dotExpo.js +37 -11
  362. package/build/src/start/project/dotExpo.js.map +1 -1
  363. package/build/src/start/project/settings.js +6 -4
  364. package/build/src/start/project/settings.js.map +1 -1
  365. package/build/src/start/resolveOptions.js +52 -27
  366. package/build/src/start/resolveOptions.js.map +1 -1
  367. package/build/src/start/server/AsyncNgrok.js +91 -47
  368. package/build/src/start/server/AsyncNgrok.js.map +1 -1
  369. package/build/src/start/server/BundlerDevServer.js +77 -45
  370. package/build/src/start/server/BundlerDevServer.js.map +1 -1
  371. package/build/src/start/server/DevServerManager.js +100 -70
  372. package/build/src/start/server/DevServerManager.js.map +1 -1
  373. package/build/src/start/server/DevToolsPluginManager.js +35 -18
  374. package/build/src/start/server/DevToolsPluginManager.js.map +1 -1
  375. package/build/src/start/server/DevelopmentSession.js +57 -33
  376. package/build/src/start/server/DevelopmentSession.js.map +1 -1
  377. package/build/src/start/server/ReactDevToolsProxy.js +37 -11
  378. package/build/src/start/server/ReactDevToolsProxy.js.map +1 -1
  379. package/build/src/start/server/UrlCreator.js +61 -27
  380. package/build/src/start/server/UrlCreator.js.map +1 -1
  381. package/build/src/start/server/getStaticRenderFunctions.js +125 -77
  382. package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
  383. package/build/src/start/server/metro/MetroBundlerDevServer.js +333 -158
  384. package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
  385. package/build/src/start/server/metro/MetroTerminalReporter.js +50 -28
  386. package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
  387. package/build/src/start/server/metro/TerminalReporter.js +40 -12
  388. package/build/src/start/server/metro/TerminalReporter.js.map +1 -1
  389. package/build/src/start/server/metro/TerminalReporter.types.js.map +1 -1
  390. package/build/src/start/server/metro/createExpoMetroResolver.js +82 -35
  391. package/build/src/start/server/metro/createExpoMetroResolver.js.map +1 -1
  392. package/build/src/start/server/metro/createJResolver.js +143 -73
  393. package/build/src/start/server/metro/createJResolver.js.map +1 -1
  394. package/build/src/start/server/metro/createServerRouteMiddleware.js +47 -38
  395. package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
  396. package/build/src/start/server/metro/debugging/MessageHandler.js +30 -0
  397. package/build/src/start/server/metro/debugging/MessageHandler.js.map +1 -0
  398. package/build/src/start/server/metro/debugging/createDebugMiddleware.js +18 -14
  399. package/build/src/start/server/metro/debugging/createDebugMiddleware.js.map +1 -1
  400. package/build/src/start/server/metro/debugging/createHandlersFactory.js +64 -0
  401. package/build/src/start/server/metro/debugging/createHandlersFactory.js.map +1 -0
  402. package/build/src/start/server/metro/debugging/{inspectorHandlers/utils.js → getDebuggerType.js} +6 -8
  403. package/build/src/start/server/metro/debugging/getDebuggerType.js.map +1 -0
  404. package/build/src/start/server/metro/debugging/{inspectorHandlers → messageHandlers}/NetworkResponse.js +12 -6
  405. package/build/src/start/server/metro/debugging/messageHandlers/NetworkResponse.js.map +1 -0
  406. package/build/src/start/server/metro/debugging/messageHandlers/PageReload.js +26 -0
  407. package/build/src/start/server/metro/debugging/messageHandlers/PageReload.js.map +1 -0
  408. package/build/src/start/server/metro/debugging/messageHandlers/VscodeDebuggerGetPossibleBreakpoints.js +28 -0
  409. package/build/src/start/server/metro/debugging/messageHandlers/VscodeDebuggerGetPossibleBreakpoints.js.map +1 -0
  410. package/build/src/start/server/metro/debugging/messageHandlers/VscodeDebuggerSetBreakpointByUrl.js +25 -0
  411. package/build/src/start/server/metro/debugging/messageHandlers/VscodeDebuggerSetBreakpointByUrl.js.map +1 -0
  412. package/build/src/start/server/metro/debugging/messageHandlers/VscodeRuntimeCallFunctionOn.js +31 -0
  413. package/build/src/start/server/metro/debugging/messageHandlers/VscodeRuntimeCallFunctionOn.js.map +1 -0
  414. package/build/src/start/server/metro/debugging/{inspectorHandlers → messageHandlers}/VscodeRuntimeGetProperties.js +14 -7
  415. package/build/src/start/server/metro/debugging/messageHandlers/VscodeRuntimeGetProperties.js.map +1 -0
  416. package/build/src/start/server/metro/debugging/pageIsSupported.js +17 -0
  417. package/build/src/start/server/metro/debugging/pageIsSupported.js.map +1 -0
  418. package/build/src/start/server/metro/debugging/types.js.map +1 -0
  419. package/build/src/start/server/metro/externals.js +67 -69
  420. package/build/src/start/server/metro/externals.js.map +1 -1
  421. package/build/src/start/server/metro/fetchRouterManifest.js +26 -7
  422. package/build/src/start/server/metro/fetchRouterManifest.js.map +1 -1
  423. package/build/src/start/server/metro/formatFileCandidates.js +28 -18
  424. package/build/src/start/server/metro/formatFileCandidates.js.map +1 -1
  425. package/build/src/start/server/metro/getCssModulesFromBundler.js +44 -12
  426. package/build/src/start/server/metro/getCssModulesFromBundler.js.map +1 -1
  427. package/build/src/start/server/metro/instantiateMetro.js +141 -62
  428. package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
  429. package/build/src/start/server/metro/metroErrorInterface.js +75 -47
  430. package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
  431. package/build/src/start/server/metro/metroErrors.js +11 -2
  432. package/build/src/start/server/metro/metroErrors.js.map +1 -1
  433. package/build/src/start/server/metro/metroVirtualModules.js +90 -0
  434. package/build/src/start/server/metro/metroVirtualModules.js.map +1 -0
  435. package/build/src/start/server/metro/metroWatchTypeScriptFiles.js +12 -3
  436. package/build/src/start/server/metro/metroWatchTypeScriptFiles.js.map +1 -1
  437. package/build/src/start/server/metro/router.js +64 -30
  438. package/build/src/start/server/metro/router.js.map +1 -1
  439. package/build/src/start/server/metro/runServer-fork.js +68 -19
  440. package/build/src/start/server/metro/runServer-fork.js.map +1 -1
  441. package/build/src/start/server/metro/serializeHtml.js +32 -19
  442. package/build/src/start/server/metro/serializeHtml.js.map +1 -1
  443. package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js +19 -5
  444. package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js.map +1 -1
  445. package/build/src/start/server/metro/withMetroMultiPlatform.js +232 -104
  446. package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
  447. package/build/src/start/server/metro/withMetroResolvers.js +95 -47
  448. package/build/src/start/server/metro/withMetroResolvers.js.map +1 -1
  449. package/build/src/start/server/middleware/ContextModuleSourceMapsMiddleware.js +4 -1
  450. package/build/src/start/server/middleware/ContextModuleSourceMapsMiddleware.js.map +1 -1
  451. package/build/src/start/server/middleware/CorsMiddleware.js +4 -1
  452. package/build/src/start/server/middleware/CorsMiddleware.js.map +1 -1
  453. package/build/src/start/server/middleware/CreateFileMiddleware.js +33 -13
  454. package/build/src/start/server/middleware/CreateFileMiddleware.js.map +1 -1
  455. package/build/src/start/server/middleware/DevToolsPluginMiddleware.js +27 -12
  456. package/build/src/start/server/middleware/DevToolsPluginMiddleware.js.map +1 -1
  457. package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js +65 -28
  458. package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js.map +1 -1
  459. package/build/src/start/server/middleware/ExpoMiddleware.js +54 -22
  460. package/build/src/start/server/middleware/ExpoMiddleware.js.map +1 -1
  461. package/build/src/start/server/middleware/FaviconMiddleware.js +8 -5
  462. package/build/src/start/server/middleware/FaviconMiddleware.js.map +1 -1
  463. package/build/src/start/server/middleware/HistoryFallbackMiddleware.js +6 -3
  464. package/build/src/start/server/middleware/HistoryFallbackMiddleware.js.map +1 -1
  465. package/build/src/start/server/middleware/InterstitialPageMiddleware.js +58 -21
  466. package/build/src/start/server/middleware/InterstitialPageMiddleware.js.map +1 -1
  467. package/build/src/start/server/middleware/ManifestMiddleware.js +117 -63
  468. package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
  469. package/build/src/start/server/middleware/ReactDevToolsPageMiddleware.js +35 -10
  470. package/build/src/start/server/middleware/ReactDevToolsPageMiddleware.js.map +1 -1
  471. package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js +54 -27
  472. package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js.map +1 -1
  473. package/build/src/start/server/middleware/ServeStaticMiddleware.js +31 -10
  474. package/build/src/start/server/middleware/ServeStaticMiddleware.js.map +1 -1
  475. package/build/src/start/server/middleware/inspector/JsInspector.js +45 -22
  476. package/build/src/start/server/middleware/inspector/JsInspector.js.map +1 -1
  477. package/build/src/start/server/middleware/inspector/LaunchBrowser.js +25 -11
  478. package/build/src/start/server/middleware/inspector/LaunchBrowser.js.map +1 -1
  479. package/build/src/start/server/middleware/inspector/LaunchBrowser.types.js +4 -2
  480. package/build/src/start/server/middleware/inspector/LaunchBrowser.types.js.map +1 -1
  481. package/build/src/start/server/middleware/inspector/LaunchBrowserImplLinux.js +36 -14
  482. package/build/src/start/server/middleware/inspector/LaunchBrowserImplLinux.js.map +1 -1
  483. package/build/src/start/server/middleware/inspector/LaunchBrowserImplMacOS.js +84 -38
  484. package/build/src/start/server/middleware/inspector/LaunchBrowserImplMacOS.js.map +1 -1
  485. package/build/src/start/server/middleware/inspector/LaunchBrowserImplWindows.js +42 -20
  486. package/build/src/start/server/middleware/inspector/LaunchBrowserImplWindows.js.map +1 -1
  487. package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js +40 -13
  488. package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js.map +1 -1
  489. package/build/src/start/server/middleware/inspector/middlwareMutations.js +11 -4
  490. package/build/src/start/server/middleware/inspector/middlwareMutations.js.map +1 -1
  491. package/build/src/start/server/middleware/metroOptions.js +36 -18
  492. package/build/src/start/server/middleware/metroOptions.js.map +1 -1
  493. package/build/src/start/server/middleware/mutations.js +11 -4
  494. package/build/src/start/server/middleware/mutations.js.map +1 -1
  495. package/build/src/start/server/middleware/resolveAssets.js +78 -42
  496. package/build/src/start/server/middleware/resolveAssets.js.map +1 -1
  497. package/build/src/start/server/middleware/resolvePlatform.js +21 -7
  498. package/build/src/start/server/middleware/resolvePlatform.js.map +1 -1
  499. package/build/src/start/server/middleware/suppressErrorMiddleware.js +4 -1
  500. package/build/src/start/server/middleware/suppressErrorMiddleware.js.map +1 -1
  501. package/build/src/start/server/openPlatforms.js +7 -6
  502. package/build/src/start/server/openPlatforms.js.map +1 -1
  503. package/build/src/start/server/platformBundlers.js +12 -3
  504. package/build/src/start/server/platformBundlers.js.map +1 -1
  505. package/build/src/start/server/serverLogLikeMetro.js +93 -40
  506. package/build/src/start/server/serverLogLikeMetro.js.map +1 -1
  507. package/build/src/start/server/type-generation/expo-env.js +26 -6
  508. package/build/src/start/server/type-generation/expo-env.js.map +1 -1
  509. package/build/src/start/server/type-generation/routes.js +137 -82
  510. package/build/src/start/server/type-generation/routes.js.map +1 -1
  511. package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js +44 -23
  512. package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js.map +1 -1
  513. package/build/src/start/server/type-generation/tsconfig.js +41 -16
  514. package/build/src/start/server/type-generation/tsconfig.js.map +1 -1
  515. package/build/src/start/server/webTemplate.js +43 -19
  516. package/build/src/start/server/webTemplate.js.map +1 -1
  517. package/build/src/start/server/webpack/WebpackBundlerDevServer.js +105 -56
  518. package/build/src/start/server/webpack/WebpackBundlerDevServer.js.map +1 -1
  519. package/build/src/start/server/webpack/compile.js +60 -27
  520. package/build/src/start/server/webpack/compile.js.map +1 -1
  521. package/build/src/start/server/webpack/formatWebpackMessages.js +35 -25
  522. package/build/src/start/server/webpack/formatWebpackMessages.js.map +1 -1
  523. package/build/src/start/server/webpack/resolveFromProject.js +20 -6
  524. package/build/src/start/server/webpack/resolveFromProject.js.map +1 -1
  525. package/build/src/start/server/webpack/tls.js +84 -34
  526. package/build/src/start/server/webpack/tls.js.map +1 -1
  527. package/build/src/start/startAsync.js +98 -52
  528. package/build/src/start/startAsync.js.map +1 -1
  529. package/build/src/utils/FileNotifier.js +73 -28
  530. package/build/src/utils/FileNotifier.js.map +1 -1
  531. package/build/src/utils/analytics/getDevClientProperties.js +48 -22
  532. package/build/src/utils/analytics/getDevClientProperties.js.map +1 -1
  533. package/build/src/utils/analytics/getMetroDebugProperties.js +4 -1
  534. package/build/src/utils/analytics/getMetroDebugProperties.js.map +1 -1
  535. package/build/src/utils/analytics/getMetroProperties.js +4 -1
  536. package/build/src/utils/analytics/getMetroProperties.js.map +1 -1
  537. package/build/src/utils/analytics/metroDebuggerMiddleware.js +14 -6
  538. package/build/src/utils/analytics/metroDebuggerMiddleware.js.map +1 -1
  539. package/build/src/utils/ansi.js +5 -2
  540. package/build/src/utils/ansi.js.map +1 -1
  541. package/build/src/utils/args.js +83 -31
  542. package/build/src/utils/args.js.map +1 -1
  543. package/build/src/utils/array.js +16 -9
  544. package/build/src/utils/array.js.map +1 -1
  545. package/build/src/utils/cocoapods.js +127 -67
  546. package/build/src/utils/cocoapods.js.map +1 -1
  547. package/build/src/utils/codesigning.js +144 -72
  548. package/build/src/utils/codesigning.js.map +1 -1
  549. package/build/src/utils/createFileTransform.js +34 -71
  550. package/build/src/utils/createFileTransform.js.map +1 -1
  551. package/build/src/utils/delay.js +13 -6
  552. package/build/src/utils/delay.js.map +1 -1
  553. package/build/src/utils/dir.js +50 -40
  554. package/build/src/utils/dir.js.map +1 -1
  555. package/build/src/utils/downloadAppAsync.js +51 -18
  556. package/build/src/utils/downloadAppAsync.js.map +1 -1
  557. package/build/src/utils/downloadExpoGoAsync.js +47 -26
  558. package/build/src/utils/downloadExpoGoAsync.js.map +1 -1
  559. package/build/src/utils/editor.js +65 -27
  560. package/build/src/utils/editor.js.map +1 -1
  561. package/build/src/utils/env.js +44 -33
  562. package/build/src/utils/env.js.map +1 -1
  563. package/build/src/utils/errors.js +35 -12
  564. package/build/src/utils/errors.js.map +1 -1
  565. package/build/src/utils/exit.js +10 -7
  566. package/build/src/utils/exit.js.map +1 -1
  567. package/build/src/utils/findUp.js +38 -8
  568. package/build/src/utils/findUp.js.map +1 -1
  569. package/build/src/utils/fn.js +11 -3
  570. package/build/src/utils/fn.js.map +1 -1
  571. package/build/src/utils/getOrPromptApplicationId.js +84 -46
  572. package/build/src/utils/getOrPromptApplicationId.js.map +1 -1
  573. package/build/src/utils/getRunningProcess.js +63 -25
  574. package/build/src/utils/getRunningProcess.js.map +1 -1
  575. package/build/src/utils/git.js +76 -38
  576. package/build/src/utils/git.js.map +1 -1
  577. package/build/src/utils/glob.js +23 -12
  578. package/build/src/utils/glob.js.map +1 -1
  579. package/build/src/utils/interactive.js +5 -2
  580. package/build/src/utils/interactive.js.map +1 -1
  581. package/build/src/utils/ip.js +12 -3
  582. package/build/src/utils/ip.js.map +1 -1
  583. package/build/src/utils/isModuleSymlinked.js +20 -5
  584. package/build/src/utils/isModuleSymlinked.js.map +1 -1
  585. package/build/src/utils/link.js +28 -8
  586. package/build/src/utils/link.js.map +1 -1
  587. package/build/src/utils/mergeGitIgnorePaths.js +45 -28
  588. package/build/src/utils/mergeGitIgnorePaths.js.map +1 -1
  589. package/build/src/utils/modifyConfigAsync.js +69 -31
  590. package/build/src/utils/modifyConfigAsync.js.map +1 -1
  591. package/build/src/utils/modifyConfigPlugins.js +50 -23
  592. package/build/src/utils/modifyConfigPlugins.js.map +1 -1
  593. package/build/src/utils/nodeEnv.js +8 -1
  594. package/build/src/utils/nodeEnv.js.map +1 -1
  595. package/build/src/utils/nodeModules.js +29 -8
  596. package/build/src/utils/nodeModules.js.map +1 -1
  597. package/build/src/utils/npm.js +86 -31
  598. package/build/src/utils/npm.js.map +1 -1
  599. package/build/src/utils/obj.js +12 -4
  600. package/build/src/utils/obj.js.map +1 -1
  601. package/build/src/utils/open.js +13 -4
  602. package/build/src/utils/open.js.map +1 -1
  603. package/build/src/utils/ora.js +38 -22
  604. package/build/src/utils/ora.js.map +1 -1
  605. package/build/src/utils/plist.js +73 -29
  606. package/build/src/utils/plist.js.map +1 -1
  607. package/build/src/utils/port.js +74 -36
  608. package/build/src/utils/port.js.map +1 -1
  609. package/build/src/utils/profile.js +56 -29
  610. package/build/src/utils/profile.js.map +1 -1
  611. package/build/src/utils/progress.js +23 -13
  612. package/build/src/utils/progress.js.map +1 -1
  613. package/build/src/utils/prompts.js +45 -28
  614. package/build/src/utils/prompts.js.map +1 -1
  615. package/build/src/utils/resolveArgs.js +23 -20
  616. package/build/src/utils/resolveArgs.js.map +1 -1
  617. package/build/src/utils/scheme.js +128 -52
  618. package/build/src/utils/scheme.js.map +1 -1
  619. package/build/src/utils/strings.js +11 -4
  620. package/build/src/utils/strings.js.map +1 -1
  621. package/build/src/utils/tar.js +56 -23
  622. package/build/src/utils/tar.js.map +1 -1
  623. package/build/src/utils/telemetry/DetachedClient.js +90 -0
  624. package/build/src/utils/telemetry/DetachedClient.js.map +1 -0
  625. package/build/src/utils/telemetry/RudderClient.js +101 -0
  626. package/build/src/utils/telemetry/RudderClient.js.map +1 -0
  627. package/build/src/utils/telemetry/flushDetached.js +44 -0
  628. package/build/src/utils/telemetry/flushDetached.js.map +1 -0
  629. package/build/src/utils/telemetry/getContext.js +112 -0
  630. package/build/src/utils/telemetry/getContext.js.map +1 -0
  631. package/build/src/utils/telemetry/index.js +37 -0
  632. package/build/src/utils/telemetry/index.js.map +1 -0
  633. package/build/src/utils/telemetry/types.js +6 -0
  634. package/build/src/utils/telemetry/types.js.map +1 -0
  635. package/build/src/utils/template.js +27 -2
  636. package/build/src/utils/template.js.map +1 -1
  637. package/build/src/utils/terminal.js +5 -2
  638. package/build/src/utils/terminal.js.map +1 -1
  639. package/build/src/utils/tsconfig/evaluateTsConfig.js +32 -14
  640. package/build/src/utils/tsconfig/evaluateTsConfig.js.map +1 -1
  641. package/build/src/utils/tsconfig/loadTsConfigPaths.js +34 -14
  642. package/build/src/utils/tsconfig/loadTsConfigPaths.js.map +1 -1
  643. package/build/src/utils/tsconfig/matchTsConfigPathAlias.js +8 -4
  644. package/build/src/utils/tsconfig/matchTsConfigPathAlias.js.map +1 -1
  645. package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js +20 -11
  646. package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js.map +1 -1
  647. package/build/src/utils/url.js +35 -19
  648. package/build/src/utils/url.js.map +1 -1
  649. package/build/src/utils/validateApplicationId.js +47 -28
  650. package/build/src/utils/validateApplicationId.js.map +1 -1
  651. package/build/src/utils/variadic.js +15 -11
  652. package/build/src/utils/variadic.js.map +1 -1
  653. package/build/src/whoami/index.js +43 -25
  654. package/build/src/whoami/index.js.map +1 -1
  655. package/build/src/whoami/whoamiAsync.js +50 -23
  656. package/build/src/whoami/whoamiAsync.js.map +1 -1
  657. package/package.json +16 -17
  658. package/static/canary/react-native/Libraries/Renderer/implementations/ReactFabric-dev.js +27907 -0
  659. package/static/canary/react-native/Libraries/Renderer/implementations/ReactFabric-prod.js +9494 -0
  660. package/static/canary/react-native/Libraries/Renderer/implementations/ReactFabric-profiling.js +10015 -0
  661. package/static/canary/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +28375 -0
  662. package/static/canary/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +9714 -0
  663. package/build/src/run/android/resolveGradleProps.js +0 -37
  664. package/build/src/run/android/resolveGradleProps.js.map +0 -1
  665. package/build/src/start/server/metro/bundleApiRoutes.js +0 -52
  666. package/build/src/start/server/metro/bundleApiRoutes.js.map +0 -1
  667. package/build/src/start/server/metro/debugging/InspectorDevice.js +0 -80
  668. package/build/src/start/server/metro/debugging/InspectorDevice.js.map +0 -1
  669. package/build/src/start/server/metro/debugging/InspectorProxy.js +0 -116
  670. package/build/src/start/server/metro/debugging/InspectorProxy.js.map +0 -1
  671. package/build/src/start/server/metro/debugging/inspectorHandlers/NetworkResponse.js.map +0 -1
  672. package/build/src/start/server/metro/debugging/inspectorHandlers/PageReload.js +0 -22
  673. package/build/src/start/server/metro/debugging/inspectorHandlers/PageReload.js.map +0 -1
  674. package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerGetPossibleBreakpoints.js +0 -21
  675. package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerGetPossibleBreakpoints.js.map +0 -1
  676. package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerScriptParsed.js +0 -56
  677. package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerScriptParsed.js.map +0 -1
  678. package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerSetBreakpointByUrl.js +0 -18
  679. package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerSetBreakpointByUrl.js.map +0 -1
  680. package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeRuntimeCallFunctionOn.js +0 -24
  681. package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeRuntimeCallFunctionOn.js.map +0 -1
  682. package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeRuntimeGetProperties.js.map +0 -1
  683. package/build/src/start/server/metro/debugging/inspectorHandlers/types.js.map +0 -1
  684. package/build/src/start/server/metro/debugging/inspectorHandlers/utils.js.map +0 -1
  685. package/build/src/start/server/type-generation/__typetests__/fixtures/basic.js +0 -38
  686. package/build/src/start/server/type-generation/__typetests__/fixtures/basic.js.map +0 -1
  687. package/build/src/start/server/type-generation/__typetests__/generateFixtures.js +0 -38
  688. package/build/src/start/server/type-generation/__typetests__/generateFixtures.js.map +0 -1
  689. package/build/src/start/server/type-generation/__typetests__/route.test.js +0 -184
  690. package/build/src/start/server/type-generation/__typetests__/route.test.js.map +0 -1
  691. package/build/src/utils/analytics/rudderstackClient.js +0 -147
  692. package/build/src/utils/analytics/rudderstackClient.js.map +0 -1
  693. /package/build/src/start/server/metro/debugging/{inspectorHandlers/types.js → types.js} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/server/metro/withMetroMultiPlatform.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { ExpoConfig, Platform } from '@expo/config';\nimport fs from 'fs';\nimport { ConfigT } from 'metro-config';\nimport { Resolution, ResolutionContext, CustomResolutionContext } from 'metro-resolver';\nimport * as metroResolver from 'metro-resolver';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport { createFastResolver } from './createExpoMetroResolver';\nimport {\n EXTERNAL_REQUIRE_NATIVE_POLYFILL,\n EXTERNAL_REQUIRE_POLYFILL,\n METRO_SHIMS_FOLDER,\n getNodeExternalModuleId,\n isNodeExternal,\n setupNodeExternals,\n setupShimFiles,\n} from './externals';\nimport { isFailedToResolveNameError, isFailedToResolvePathError } from './metroErrors';\nimport {\n withMetroErrorReportingResolver,\n withMetroMutatedResolverContext,\n withMetroResolvers,\n} from './withMetroResolvers';\nimport { Log } from '../../../log';\nimport { FileNotifier } from '../../../utils/FileNotifier';\nimport { env } from '../../../utils/env';\nimport { installExitHooks } from '../../../utils/exit';\nimport { isInteractive } from '../../../utils/interactive';\nimport { loadTsConfigPathsAsync, TsConfigPaths } from '../../../utils/tsconfig/loadTsConfigPaths';\nimport { resolveWithTsConfigPaths } from '../../../utils/tsconfig/resolveWithTsConfigPaths';\nimport { PlatformBundlers } from '../platformBundlers';\n\ntype Mutable<T> = { -readonly [K in keyof T]: T[K] };\n\nconst debug = require('debug')('expo:start:server:metro:multi-platform') as typeof console.log;\n\nfunction withWebPolyfills(config: ConfigT): ConfigT {\n const originalGetPolyfills = config.serializer.getPolyfills\n ? config.serializer.getPolyfills.bind(config.serializer)\n : () => [];\n\n const getPolyfills = (ctx: { platform: string | null }): readonly string[] => {\n if (ctx.platform === 'web') {\n return [\n // NOTE: We might need this for all platforms\n path.join(config.projectRoot, EXTERNAL_REQUIRE_POLYFILL),\n // TODO: runtime polyfills, i.e. Fast Refresh, error overlay, React Dev Tools...\n ];\n }\n // Generally uses `rn-get-polyfills`\n const polyfills = originalGetPolyfills(ctx);\n\n return [...polyfills, path.join(config.projectRoot, EXTERNAL_REQUIRE_NATIVE_POLYFILL)];\n };\n\n return {\n ...config,\n serializer: {\n ...config.serializer,\n getPolyfills,\n },\n };\n}\n\nfunction normalizeSlashes(p: string) {\n return p.replace(/\\\\/g, '/');\n}\n\nexport function getNodejsExtensions(srcExts: readonly string[]): string[] {\n const mjsExts = srcExts.filter((ext) => /mjs$/.test(ext));\n const nodejsSourceExtensions = srcExts.filter((ext) => !/mjs$/.test(ext));\n // find index of last `*.js` extension\n const jsIndex = nodejsSourceExtensions.reduce((index, ext, i) => {\n return /jsx?$/.test(ext) ? i : index;\n }, -1);\n\n // insert `*.mjs` extensions after `*.js` extensions\n nodejsSourceExtensions.splice(jsIndex + 1, 0, ...mjsExts);\n\n return nodejsSourceExtensions;\n}\n\n/**\n * Apply custom resolvers to do the following:\n * - Disable `.native.js` extensions on web.\n * - Alias `react-native` to `react-native-web` on web.\n * - Redirect `react-native-web/dist/modules/AssetRegistry/index.js` to `@react-native/assets/registry.js` on web.\n * - Add support for `tsconfig.json`/`jsconfig.json` aliases via `compilerOptions.paths`.\n */\nexport function withExtendedResolver(\n config: ConfigT,\n {\n tsconfig,\n isTsconfigPathsEnabled,\n isFastResolverEnabled,\n isExporting,\n }: {\n tsconfig: TsConfigPaths | null;\n isTsconfigPathsEnabled?: boolean;\n isFastResolverEnabled?: boolean;\n isExporting?: boolean;\n }\n) {\n if (isFastResolverEnabled) {\n Log.warn(`Experimental bundling features are enabled.`);\n }\n\n // Get the `transformer.assetRegistryPath`\n // this needs to be unified since you can't dynamically\n // swap out the transformer based on platform.\n const assetRegistryPath = fs.realpathSync(\n path.resolve(resolveFrom(config.projectRoot, '@react-native/assets-registry/registry.js'))\n );\n\n const defaultResolver = metroResolver.resolve;\n const resolver = isFastResolverEnabled\n ? createFastResolver({\n preserveSymlinks: config.resolver?.unstable_enableSymlinks ?? true,\n blockList: Array.isArray(config.resolver?.blockList)\n ? config.resolver?.blockList\n : [config.resolver?.blockList],\n })\n : defaultResolver;\n\n const aliases: { [key: string]: Record<string, string> } = {\n web: {\n 'react-native': 'react-native-web',\n 'react-native/index': 'react-native-web',\n },\n };\n\n const universalAliases: [RegExp, string][] = [];\n\n // This package is currently always installed as it is included in the `expo` package.\n if (resolveFrom.silent(config.projectRoot, '@expo/vector-icons')) {\n debug('Enabling alias: react-native-vector-icons -> @expo/vector-icons');\n universalAliases.push([/^react-native-vector-icons(\\/.*)?/, '@expo/vector-icons$1']);\n }\n\n const preferredMainFields: { [key: string]: string[] } = {\n // Defaults from Expo Webpack. Most packages using `react-native` don't support web\n // in the `react-native` field, so we should prefer the `browser` field.\n // https://github.com/expo/router/issues/37\n web: ['browser', 'module', 'main'],\n };\n\n let tsConfigResolve =\n isTsconfigPathsEnabled && (tsconfig?.paths || tsconfig?.baseUrl != null)\n ? resolveWithTsConfigPaths.bind(resolveWithTsConfigPaths, {\n paths: tsconfig.paths ?? {},\n baseUrl: tsconfig.baseUrl ?? config.projectRoot,\n hasBaseUrl: !!tsconfig.baseUrl,\n })\n : null;\n\n // TODO: Move this to be a transform key for invalidation.\n if (!isExporting && isInteractive()) {\n if (isTsconfigPathsEnabled) {\n // TODO: We should track all the files that used imports and invalidate them\n // currently the user will need to save all the files that use imports to\n // use the new aliases.\n const configWatcher = new FileNotifier(config.projectRoot, [\n './tsconfig.json',\n './jsconfig.json',\n ]);\n configWatcher.startObserving(() => {\n debug('Reloading tsconfig.json');\n loadTsConfigPathsAsync(config.projectRoot).then((tsConfigPaths) => {\n if (tsConfigPaths?.paths && !!Object.keys(tsConfigPaths.paths).length) {\n debug('Enabling tsconfig.json paths support');\n tsConfigResolve = resolveWithTsConfigPaths.bind(resolveWithTsConfigPaths, {\n paths: tsConfigPaths.paths ?? {},\n baseUrl: tsConfigPaths.baseUrl ?? config.projectRoot,\n hasBaseUrl: !!tsConfigPaths.baseUrl,\n });\n } else {\n debug('Disabling tsconfig.json paths support');\n tsConfigResolve = null;\n }\n });\n });\n\n // TODO: This probably prevents the process from exiting.\n installExitHooks(() => {\n configWatcher.stopObserving();\n });\n } else {\n debug('Skipping tsconfig.json paths support');\n }\n }\n\n let nodejsSourceExtensions: string[] | null = null;\n\n const shimsFolder = path.join(config.projectRoot, METRO_SHIMS_FOLDER);\n\n function getStrictResolver(\n { resolveRequest, ...context }: ResolutionContext,\n platform: string | null\n ) {\n return function doResolve(moduleName: string): Resolution {\n return resolver(context, moduleName, platform);\n };\n }\n\n function getOptionalResolver(context: ResolutionContext, platform: string | null) {\n const doResolve = getStrictResolver(context, platform);\n return function optionalResolve(moduleName: string): Resolution | null {\n try {\n return doResolve(moduleName);\n } catch (error) {\n // If the error is directly related to a resolver not being able to resolve a module, then\n // we can ignore the error and try the next resolver. Otherwise, we should throw the error.\n const isResolutionError =\n isFailedToResolveNameError(error) || isFailedToResolvePathError(error);\n if (!isResolutionError) {\n throw error;\n }\n }\n return null;\n };\n }\n\n const metroConfigWithCustomResolver = withMetroResolvers(config, [\n // tsconfig paths\n (context: ResolutionContext, moduleName: string, platform: string | null) => {\n return (\n tsConfigResolve?.(\n {\n originModulePath: context.originModulePath,\n moduleName,\n },\n getOptionalResolver(context, platform)\n ) ?? null\n );\n },\n\n // Node.js externals support\n (context: ResolutionContext, moduleName: string, platform: string | null) => {\n // This is a web-only feature, we may extend the shimming to native platforms in the future.\n if (platform !== 'web') {\n return null;\n }\n\n const moduleId = isNodeExternal(moduleName);\n if (!moduleId) {\n return null;\n }\n\n if (\n // In browser runtimes, we want to either resolve a local node module by the same name, or shim the module to\n // prevent crashing when Node.js built-ins are imported.\n context.customResolverOptions?.environment !== 'node'\n ) {\n // Perform optional resolve first. If the module doesn't exist (no module in the node_modules)\n // then we can mock the file to use an empty module.\n const result = getOptionalResolver(context, platform)(moduleName);\n return (\n result ?? {\n // In this case, mock the file to use an empty module.\n type: 'empty',\n }\n );\n }\n\n const redirectedModuleName = getNodeExternalModuleId(context.originModulePath, moduleId);\n debug(`Redirecting Node.js external \"${moduleId}\" to \"${redirectedModuleName}\"`);\n return getStrictResolver(context, platform)(redirectedModuleName);\n },\n\n // Basic moduleId aliases\n (context: ResolutionContext, moduleName: string, platform: string | null) => {\n // Conditionally remap `react-native` to `react-native-web` on web in\n // a way that doesn't require Babel to resolve the alias.\n if (platform && platform in aliases && aliases[platform][moduleName]) {\n const redirectedModuleName = aliases[platform][moduleName];\n return getStrictResolver(context, platform)(redirectedModuleName);\n }\n\n for (const [matcher, alias] of universalAliases) {\n const match = moduleName.match(matcher);\n if (match) {\n const aliasedModule = alias.replace(\n /\\$(\\d+)/g,\n (_, index) => match[parseInt(index, 10)] ?? ''\n );\n const doResolve = getStrictResolver(context, platform);\n debug(`Alias \"${moduleName}\" to \"${aliasedModule}\"`);\n return doResolve(aliasedModule);\n }\n }\n\n return null;\n },\n\n // HACK(EvanBacon):\n // React Native uses `event-target-shim` incorrectly and this causes the native runtime\n // to fail to load. This is a temporary workaround until we can fix this upstream.\n // https://github.com/facebook/react-native/pull/38628\n (context: ResolutionContext, moduleName: string, platform: string | null) => {\n if (platform !== 'web' && moduleName === 'event-target-shim') {\n debug('For event-target-shim to use js:', context.originModulePath);\n const doResolve = getStrictResolver(context, platform);\n return doResolve('event-target-shim/dist/event-target-shim.js');\n }\n\n return null;\n },\n\n // TODO: Reduce these as much as possible in the future.\n // Complex post-resolution rewrites.\n (context: ResolutionContext, moduleName: string, platform: string | null) => {\n const doResolve = getStrictResolver(context, platform);\n\n const result = doResolve(moduleName);\n\n if (result.type !== 'sourceFile') {\n return result;\n }\n\n // Replace the web resolver with the original one.\n // This is basically an alias for web-only.\n // TODO: Drop this in favor of the standalone asset registry module.\n if (shouldAliasAssetRegistryForWeb(platform, result)) {\n // @ts-expect-error: `readonly` for some reason.\n result.filePath = assetRegistryPath;\n }\n\n if (platform === 'web' && result.filePath.includes('node_modules')) {\n // Replace with static shims\n\n const normalName = normalizeSlashes(result.filePath)\n // Drop everything up until the `node_modules` folder.\n .replace(/.*node_modules\\//, '');\n\n const shimPath = path.join(shimsFolder, normalName);\n if (fs.existsSync(shimPath)) {\n // @ts-expect-error: `readonly` for some reason.\n result.filePath = shimPath;\n }\n }\n\n return result;\n },\n ]);\n\n // Ensure we mutate the resolution context to include the custom resolver options for server and web.\n const metroConfigWithCustomContext = withMetroMutatedResolverContext(\n metroConfigWithCustomResolver,\n (\n immutableContext: CustomResolutionContext,\n moduleName: string,\n platform: string | null\n ): CustomResolutionContext => {\n const context: Mutable<CustomResolutionContext> = {\n ...immutableContext,\n preferNativePlatform: platform !== 'web',\n };\n\n if (context.customResolverOptions?.environment === 'node') {\n // Adjust nodejs source extensions to sort mjs after js, including platform variants.\n if (nodejsSourceExtensions === null) {\n nodejsSourceExtensions = getNodejsExtensions(context.sourceExts);\n }\n context.sourceExts = nodejsSourceExtensions;\n\n context.unstable_enablePackageExports = true;\n context.unstable_conditionNames = ['node', 'require'];\n context.unstable_conditionsByPlatform = {};\n // Node.js runtimes should only be importing main at the moment.\n // This is a temporary fix until we can support the package.json exports.\n context.mainFields = ['main', 'module'];\n } else {\n // Non-server changes\n\n if (!env.EXPO_METRO_NO_MAIN_FIELD_OVERRIDE && platform && platform in preferredMainFields) {\n context.mainFields = preferredMainFields[platform];\n }\n }\n\n return context;\n }\n );\n\n return withMetroErrorReportingResolver(metroConfigWithCustomContext);\n}\n\n/** @returns `true` if the incoming resolution should be swapped on web. */\nexport function shouldAliasAssetRegistryForWeb(\n platform: string | null,\n result: Resolution\n): boolean {\n return (\n platform === 'web' &&\n result?.type === 'sourceFile' &&\n typeof result?.filePath === 'string' &&\n normalizeSlashes(result.filePath).endsWith(\n 'react-native-web/dist/modules/AssetRegistry/index.js'\n )\n );\n}\n/** @returns `true` if the incoming resolution should be swapped. */\nexport function shouldAliasModule(\n input: {\n platform: string | null;\n result: Resolution;\n },\n alias: { platform: string; output: string }\n): boolean {\n return (\n input.platform === alias.platform &&\n input.result?.type === 'sourceFile' &&\n typeof input.result?.filePath === 'string' &&\n normalizeSlashes(input.result.filePath).endsWith(alias.output)\n );\n}\n\n/** Add support for `react-native-web` and the Web platform. */\nexport async function withMetroMultiPlatformAsync(\n projectRoot: string,\n {\n config,\n exp,\n platformBundlers,\n isTsconfigPathsEnabled,\n webOutput,\n isFastResolverEnabled,\n isExporting,\n }: {\n config: ConfigT;\n exp: ExpoConfig;\n isTsconfigPathsEnabled: boolean;\n platformBundlers: PlatformBundlers;\n webOutput?: 'single' | 'static' | 'server';\n isFastResolverEnabled?: boolean;\n isExporting?: boolean;\n }\n) {\n if (!config.projectRoot) {\n // @ts-expect-error: read-only types\n config.projectRoot = projectRoot;\n }\n\n // Required for @expo/metro-runtime to format paths in the web LogBox.\n process.env.EXPO_PUBLIC_PROJECT_ROOT = process.env.EXPO_PUBLIC_PROJECT_ROOT ?? projectRoot;\n\n if (['static', 'server'].includes(webOutput ?? '')) {\n // Enable static rendering in runtime space.\n process.env.EXPO_PUBLIC_USE_STATIC = '1';\n }\n\n // This is used for running Expo CLI in development against projects outside the monorepo.\n if (!isDirectoryIn(__dirname, projectRoot)) {\n if (!config.watchFolders) {\n // @ts-expect-error: watchFolders is readonly\n config.watchFolders = [];\n }\n // @ts-expect-error: watchFolders is readonly\n config.watchFolders.push(path.join(require.resolve('metro-runtime/package.json'), '../..'));\n }\n\n // @ts-expect-error\n config.transformer._expoRouterWebRendering = webOutput;\n // @ts-expect-error: Invalidate the cache when the location of expo-router changes on-disk.\n config.transformer._expoRouterPath = resolveFrom.silent(projectRoot, 'expo-router');\n\n let tsconfig: null | TsConfigPaths = null;\n\n if (isTsconfigPathsEnabled) {\n tsconfig = await loadTsConfigPathsAsync(projectRoot);\n }\n\n await setupShimFiles(projectRoot);\n await setupNodeExternals(projectRoot);\n\n let expoConfigPlatforms = Object.entries(platformBundlers)\n .filter(\n ([platform, bundler]) => bundler === 'metro' && exp.platforms?.includes(platform as Platform)\n )\n .map(([platform]) => platform);\n\n if (Array.isArray(config.resolver.platforms)) {\n expoConfigPlatforms = [...new Set(expoConfigPlatforms.concat(config.resolver.platforms))];\n }\n\n // @ts-expect-error: typed as `readonly`.\n config.resolver.platforms = expoConfigPlatforms;\n\n config = withWebPolyfills(config);\n\n return withExtendedResolver(config, {\n tsconfig,\n isExporting,\n isTsconfigPathsEnabled,\n isFastResolverEnabled,\n });\n}\n\nfunction isDirectoryIn(a: string, b: string) {\n return b.startsWith(a) && b.length > a.length;\n}\n"],"names":["getNodejsExtensions","withExtendedResolver","shouldAliasAssetRegistryForWeb","shouldAliasModule","withMetroMultiPlatformAsync","metroResolver","debug","require","withWebPolyfills","config","originalGetPolyfills","serializer","getPolyfills","bind","ctx","platform","path","join","projectRoot","EXTERNAL_REQUIRE_POLYFILL","polyfills","EXTERNAL_REQUIRE_NATIVE_POLYFILL","normalizeSlashes","p","replace","srcExts","mjsExts","filter","ext","test","nodejsSourceExtensions","jsIndex","reduce","index","i","splice","tsconfig","isTsconfigPathsEnabled","isFastResolverEnabled","isExporting","Log","warn","assetRegistryPath","fs","realpathSync","resolve","resolveFrom","defaultResolver","resolver","createFastResolver","preserveSymlinks","unstable_enableSymlinks","blockList","Array","isArray","aliases","web","universalAliases","silent","push","preferredMainFields","tsConfigResolve","paths","baseUrl","resolveWithTsConfigPaths","hasBaseUrl","isInteractive","configWatcher","FileNotifier","startObserving","loadTsConfigPathsAsync","then","tsConfigPaths","Object","keys","length","installExitHooks","stopObserving","shimsFolder","METRO_SHIMS_FOLDER","getStrictResolver","resolveRequest","context","doResolve","moduleName","getOptionalResolver","optionalResolve","error","isResolutionError","isFailedToResolveNameError","isFailedToResolvePathError","metroConfigWithCustomResolver","withMetroResolvers","originModulePath","moduleId","isNodeExternal","customResolverOptions","environment","result","type","redirectedModuleName","getNodeExternalModuleId","matcher","alias","match","aliasedModule","_","parseInt","filePath","includes","normalName","shimPath","existsSync","metroConfigWithCustomContext","withMetroMutatedResolverContext","immutableContext","preferNativePlatform","sourceExts","unstable_enablePackageExports","unstable_conditionNames","unstable_conditionsByPlatform","mainFields","env","EXPO_METRO_NO_MAIN_FIELD_OVERRIDE","withMetroErrorReportingResolver","endsWith","input","output","exp","platformBundlers","webOutput","process","EXPO_PUBLIC_PROJECT_ROOT","EXPO_PUBLIC_USE_STATIC","isDirectoryIn","__dirname","watchFolders","transformer","_expoRouterWebRendering","_expoRouterPath","setupShimFiles","setupNodeExternals","expoConfigPlatforms","entries","bundler","platforms","map","Set","concat","a","b","startsWith"],"mappings":"AAMA;;;;QAqEgBA,mBAAmB,GAAnBA,mBAAmB;QAqBnBC,oBAAoB,GAApBA,oBAAoB;QA0SpBC,8BAA8B,GAA9BA,8BAA8B;QAc9BC,iBAAiB,GAAjBA,iBAAiB;QAgBXC,2BAA2B,GAA3BA,2BAA2B;AAjalC,IAAA,GAAI,kCAAJ,IAAI,EAAA;AAGPC,IAAAA,aAAa,mCAAM,gBAAgB,EAAtB;AACR,IAAA,KAAM,kCAAN,MAAM,EAAA;A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G,CAACiB,SAAS,SAAU,GAAvBjB,KAAAA,CAAuB,GAAvBA,GAAa,CAAEnB,QAAQ,CAAC9F,QAAQ,CAAa,CAAA,CAAA;KAAA,CAC9F,CACAmI,GAAG,CAAC,CAAC,CAACnI,QAAQ,CAAC,GAAKA,QAAQ;IAAA,CAAC,AAAC;IAEjC,IAAIsC,KAAK,CAACC,OAAO,CAAC7C,MAAM,CAACuC,QAAQ,CAACiG,SAAS,CAAC,EAAE;QAC5CH,mBAAmB,GAAG;eAAI,IAAIK,GAAG,CAACL,mBAAmB,CAACM,MAAM,CAAC3I,MAAM,CAACuC,QAAQ,CAACiG,SAAS,CAAC,CAAC;SAAC,CAAC;KAC3F;IAED,yCAAyC;IACzCxI,MAAM,CAACuC,QAAQ,CAACiG,SAAS,GAAGH,mBAAmB,CAAC;IAEhDrI,MAAM,GAAGD,gBAAgB,CAACC,MAAM,CAAC,CAAC;IAElC,OAAOR,oBAAoB,CAACQ,MAAM,EAAE;QAClC2B,QAAQ;QACRG,WAAW;QACXF,sBAAsB;QACtBC,qBAAqB;KACtB,CAAC,CAAC;CACJ;AAED,SAASgG,aAAa,CAACe,CAAS,EAAEC,CAAS,EAAE;IAC3C,OAAOA,CAAC,CAACC,UAAU,CAACF,CAAC,CAAC,IAAIC,CAAC,CAAC3E,MAAM,GAAG0E,CAAC,CAAC1E,MAAM,CAAC;CAC/C"}
1
+ {"version":3,"sources":["../../../../../src/start/server/metro/withMetroMultiPlatform.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { ExpoConfig, Platform } from '@expo/config';\nimport fs from 'fs';\nimport Bundler from 'metro/src/Bundler';\nimport { ConfigT } from 'metro-config';\nimport { Resolution, ResolutionContext, CustomResolutionContext } from 'metro-resolver';\nimport * as metroResolver from 'metro-resolver';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport { createFastResolver } from './createExpoMetroResolver';\nimport { isNodeExternal, shouldCreateVirtualCanary, shouldCreateVirtualShim } from './externals';\nimport { isFailedToResolveNameError, isFailedToResolvePathError } from './metroErrors';\nimport { getMetroBundlerWithVirtualModules } from './metroVirtualModules';\nimport {\n withMetroErrorReportingResolver,\n withMetroMutatedResolverContext,\n withMetroResolvers,\n} from './withMetroResolvers';\nimport { Log } from '../../../log';\nimport { FileNotifier } from '../../../utils/FileNotifier';\nimport { env } from '../../../utils/env';\nimport { installExitHooks } from '../../../utils/exit';\nimport { isInteractive } from '../../../utils/interactive';\nimport { loadTsConfigPathsAsync, TsConfigPaths } from '../../../utils/tsconfig/loadTsConfigPaths';\nimport { resolveWithTsConfigPaths } from '../../../utils/tsconfig/resolveWithTsConfigPaths';\nimport { isServerEnvironment } from '../middleware/metroOptions';\nimport { PlatformBundlers } from '../platformBundlers';\n\ntype Mutable<T> = { -readonly [K in keyof T]: T[K] };\n\nconst debug = require('debug')('expo:start:server:metro:multi-platform') as typeof console.log;\n\nfunction withWebPolyfills(\n config: ConfigT,\n {\n getMetroBundler,\n }: {\n getMetroBundler: () => Bundler;\n }\n): ConfigT {\n const originalGetPolyfills = config.serializer.getPolyfills\n ? config.serializer.getPolyfills.bind(config.serializer)\n : () => [];\n\n const getPolyfills = (ctx: { platform: string | null }): readonly string[] => {\n const virtualModuleId = `\\0polyfill:external-require`;\n\n const contents = (() => {\n if (ctx.platform === 'web') {\n return `global.$$require_external = typeof window === \"undefined\" ? require : () => null;`;\n } else {\n // Wrap in try/catch to support Android.\n return 'try { global.$$require_external = typeof expo === \"undefined\" ? eval(\"require\") : (moduleId) => { throw new Error(`Node.js standard library module ${moduleId} is not available in this JavaScript environment`);} } catch { global.$$require_external = (moduleId) => { throw new Error(`Node.js standard library module ${moduleId} is not available in this JavaScript environment`);} }';\n }\n })();\n getMetroBundlerWithVirtualModules(getMetroBundler()).setVirtualModule(\n virtualModuleId,\n contents\n );\n\n if (ctx.platform === 'web') {\n return [virtualModuleId];\n }\n\n // Generally uses `rn-get-polyfills`\n const polyfills = originalGetPolyfills(ctx);\n return [...polyfills, virtualModuleId];\n };\n\n return {\n ...config,\n serializer: {\n ...config.serializer,\n getPolyfills,\n },\n };\n}\n\nfunction normalizeSlashes(p: string) {\n return p.replace(/\\\\/g, '/');\n}\n\nexport function getNodejsExtensions(srcExts: readonly string[]): string[] {\n const mjsExts = srcExts.filter((ext) => /mjs$/.test(ext));\n const nodejsSourceExtensions = srcExts.filter((ext) => !/mjs$/.test(ext));\n // find index of last `*.js` extension\n const jsIndex = nodejsSourceExtensions.reduce((index, ext, i) => {\n return /jsx?$/.test(ext) ? i : index;\n }, -1);\n\n // insert `*.mjs` extensions after `*.js` extensions\n nodejsSourceExtensions.splice(jsIndex + 1, 0, ...mjsExts);\n\n return nodejsSourceExtensions;\n}\n\n/**\n * Apply custom resolvers to do the following:\n * - Disable `.native.js` extensions on web.\n * - Alias `react-native` to `react-native-web` on web.\n * - Redirect `react-native-web/dist/modules/AssetRegistry/index.js` to `@react-native/assets/registry.js` on web.\n * - Add support for `tsconfig.json`/`jsconfig.json` aliases via `compilerOptions.paths`.\n * - Alias react-native renderer code to a vendored React canary build on native.\n */\nexport function withExtendedResolver(\n config: ConfigT,\n {\n tsconfig,\n isTsconfigPathsEnabled,\n isFastResolverEnabled,\n isExporting,\n isReactCanaryEnabled,\n getMetroBundler,\n }: {\n tsconfig: TsConfigPaths | null;\n isTsconfigPathsEnabled?: boolean;\n isFastResolverEnabled?: boolean;\n isExporting?: boolean;\n isReactCanaryEnabled?: boolean;\n getMetroBundler: () => Bundler;\n }\n) {\n if (isFastResolverEnabled) {\n Log.warn(`Experimental bundling features are enabled.`);\n }\n if (isReactCanaryEnabled) {\n Log.warn(`Experimental React Canary version is enabled.`);\n }\n\n // Get the `transformer.assetRegistryPath`\n // this needs to be unified since you can't dynamically\n // swap out the transformer based on platform.\n const assetRegistryPath = fs.realpathSync(\n path.resolve(resolveFrom(config.projectRoot, '@react-native/assets-registry/registry.js'))\n );\n\n const defaultResolver = metroResolver.resolve;\n const resolver = isFastResolverEnabled\n ? createFastResolver({\n preserveSymlinks: config.resolver?.unstable_enableSymlinks ?? true,\n blockList: Array.isArray(config.resolver?.blockList)\n ? config.resolver?.blockList\n : [config.resolver?.blockList],\n })\n : defaultResolver;\n\n const aliases: { [key: string]: Record<string, string> } = {\n web: {\n 'react-native': 'react-native-web',\n 'react-native/index': 'react-native-web',\n },\n };\n\n const universalAliases: [RegExp, string][] = [];\n\n // This package is currently always installed as it is included in the `expo` package.\n if (resolveFrom.silent(config.projectRoot, '@expo/vector-icons')) {\n debug('Enabling alias: react-native-vector-icons -> @expo/vector-icons');\n universalAliases.push([/^react-native-vector-icons(\\/.*)?/, '@expo/vector-icons$1']);\n }\n\n const preferredMainFields: { [key: string]: string[] } = {\n // Defaults from Expo Webpack. Most packages using `react-native` don't support web\n // in the `react-native` field, so we should prefer the `browser` field.\n // https://github.com/expo/router/issues/37\n web: ['browser', 'module', 'main'],\n };\n\n let tsConfigResolve =\n isTsconfigPathsEnabled && (tsconfig?.paths || tsconfig?.baseUrl != null)\n ? resolveWithTsConfigPaths.bind(resolveWithTsConfigPaths, {\n paths: tsconfig.paths ?? {},\n baseUrl: tsconfig.baseUrl ?? config.projectRoot,\n hasBaseUrl: !!tsconfig.baseUrl,\n })\n : null;\n\n // TODO: Move this to be a transform key for invalidation.\n if (!isExporting && isInteractive()) {\n if (isTsconfigPathsEnabled) {\n // TODO: We should track all the files that used imports and invalidate them\n // currently the user will need to save all the files that use imports to\n // use the new aliases.\n const configWatcher = new FileNotifier(config.projectRoot, [\n './tsconfig.json',\n './jsconfig.json',\n ]);\n configWatcher.startObserving(() => {\n debug('Reloading tsconfig.json');\n loadTsConfigPathsAsync(config.projectRoot).then((tsConfigPaths) => {\n if (tsConfigPaths?.paths && !!Object.keys(tsConfigPaths.paths).length) {\n debug('Enabling tsconfig.json paths support');\n tsConfigResolve = resolveWithTsConfigPaths.bind(resolveWithTsConfigPaths, {\n paths: tsConfigPaths.paths ?? {},\n baseUrl: tsConfigPaths.baseUrl ?? config.projectRoot,\n hasBaseUrl: !!tsConfigPaths.baseUrl,\n });\n } else {\n debug('Disabling tsconfig.json paths support');\n tsConfigResolve = null;\n }\n });\n });\n\n // TODO: This probably prevents the process from exiting.\n installExitHooks(() => {\n configWatcher.stopObserving();\n });\n } else {\n debug('Skipping tsconfig.json paths support');\n }\n }\n\n let nodejsSourceExtensions: string[] | null = null;\n\n function getStrictResolver(\n { resolveRequest, ...context }: ResolutionContext,\n platform: string | null\n ) {\n return function doResolve(moduleName: string): Resolution {\n return resolver(context, moduleName, platform);\n };\n }\n\n function getOptionalResolver(context: ResolutionContext, platform: string | null) {\n const doResolve = getStrictResolver(context, platform);\n return function optionalResolve(moduleName: string): Resolution | null {\n try {\n return doResolve(moduleName);\n } catch (error) {\n // If the error is directly related to a resolver not being able to resolve a module, then\n // we can ignore the error and try the next resolver. Otherwise, we should throw the error.\n const isResolutionError =\n isFailedToResolveNameError(error) || isFailedToResolvePathError(error);\n if (!isResolutionError) {\n throw error;\n }\n }\n return null;\n };\n }\n\n const metroConfigWithCustomResolver = withMetroResolvers(config, [\n // Mock out production react imports in development.\n (context: ResolutionContext, moduleName: string, platform: string | null) => {\n // This resolution is dev-only to prevent bundling the production React packages in development.\n // @ts-expect-error: dev is not on type.\n if (!context.dev) return null;\n\n if (\n // Match react-native renderers.\n (platform !== 'web' &&\n context.originModulePath.match(/[\\\\/]node_modules[\\\\/]react-native[\\\\/]/) &&\n moduleName.match(/([\\\\/]ReactFabric|ReactNativeRenderer)-prod/)) ||\n // Match react production imports.\n (moduleName.match(/\\.production(\\.min)?\\.js$/) &&\n // Match if the import originated from a react package.\n context.originModulePath.match(/[\\\\/]node_modules[\\\\/](react[-\\\\/]|scheduler[\\\\/])/))\n ) {\n debug(`Skipping production module: ${moduleName}`);\n // /Users/path/to/expo/node_modules/react/index.js ./cjs/react.production.min.js\n // /Users/path/to/expo/node_modules/react/jsx-dev-runtime.js ./cjs/react-jsx-dev-runtime.production.min.js\n // /Users/path/to/expo/node_modules/react-is/index.js ./cjs/react-is.production.min.js\n // /Users/path/to/expo/node_modules/react-refresh/runtime.js ./cjs/react-refresh-runtime.production.min.js\n // /Users/path/to/expo/node_modules/react-native/node_modules/scheduler/index.native.js ./cjs/scheduler.native.production.min.js\n // /Users/path/to/expo/node_modules/react-native/node_modules/react-is/index.js ./cjs/react-is.production.min.js\n return {\n type: 'empty',\n };\n }\n return null;\n },\n // tsconfig paths\n (context: ResolutionContext, moduleName: string, platform: string | null) => {\n return (\n tsConfigResolve?.(\n {\n originModulePath: context.originModulePath,\n moduleName,\n },\n getOptionalResolver(context, platform)\n ) ?? null\n );\n },\n\n // Node.js externals support\n (context: ResolutionContext, moduleName: string, platform: string | null) => {\n const isServer =\n context.customResolverOptions?.environment === 'node' ||\n context.customResolverOptions?.environment === 'react-server';\n\n if (platform !== 'web' && !isServer) {\n // This is a web/server-only feature, we may extend the shimming to native platforms in the future.\n return null;\n }\n\n const moduleId = isNodeExternal(moduleName);\n if (!moduleId) {\n return null;\n }\n\n if (\n // In browser runtimes, we want to either resolve a local node module by the same name, or shim the module to\n // prevent crashing when Node.js built-ins are imported.\n !isServer\n ) {\n // Perform optional resolve first. If the module doesn't exist (no module in the node_modules)\n // then we can mock the file to use an empty module.\n const result = getOptionalResolver(context, platform)(moduleName);\n return (\n result ?? {\n // In this case, mock the file to use an empty module.\n type: 'empty',\n }\n );\n }\n\n const contents = `module.exports=$$require_external('node:${moduleId}');`;\n debug(`Virtualizing Node.js \"${moduleId}\"`);\n const virtualModuleId = `\\0node:${moduleId}`;\n getMetroBundlerWithVirtualModules(getMetroBundler()).setVirtualModule(\n virtualModuleId,\n contents\n );\n return {\n type: 'sourceFile',\n filePath: virtualModuleId,\n };\n },\n\n // Basic moduleId aliases\n (context: ResolutionContext, moduleName: string, platform: string | null) => {\n // Conditionally remap `react-native` to `react-native-web` on web in\n // a way that doesn't require Babel to resolve the alias.\n if (platform && platform in aliases && aliases[platform][moduleName]) {\n const redirectedModuleName = aliases[platform][moduleName];\n return getStrictResolver(context, platform)(redirectedModuleName);\n }\n\n for (const [matcher, alias] of universalAliases) {\n const match = moduleName.match(matcher);\n if (match) {\n const aliasedModule = alias.replace(\n /\\$(\\d+)/g,\n (_, index) => match[parseInt(index, 10)] ?? ''\n );\n const doResolve = getStrictResolver(context, platform);\n debug(`Alias \"${moduleName}\" to \"${aliasedModule}\"`);\n return doResolve(aliasedModule);\n }\n }\n\n return null;\n },\n\n // HACK(EvanBacon):\n // React Native uses `event-target-shim` incorrectly and this causes the native runtime\n // to fail to load. This is a temporary workaround until we can fix this upstream.\n // https://github.com/facebook/react-native/pull/38628\n (context: ResolutionContext, moduleName: string, platform: string | null) => {\n if (platform !== 'web' && moduleName === 'event-target-shim') {\n debug('For event-target-shim to use js:', context.originModulePath);\n const doResolve = getStrictResolver(context, platform);\n return doResolve('event-target-shim/dist/event-target-shim.js');\n }\n\n return null;\n },\n\n // TODO: Reduce these as much as possible in the future.\n // Complex post-resolution rewrites.\n (context: ResolutionContext, moduleName: string, platform: string | null) => {\n const doResolve = getStrictResolver(context, platform);\n\n const result = doResolve(moduleName);\n\n if (result.type !== 'sourceFile') {\n return result;\n }\n\n if (platform === 'web') {\n // Replace the web resolver with the original one.\n // This is basically an alias for web-only.\n // TODO: Drop this in favor of the standalone asset registry module.\n if (shouldAliasAssetRegistryForWeb(platform, result)) {\n // @ts-expect-error: `readonly` for some reason.\n result.filePath = assetRegistryPath;\n }\n\n if (platform === 'web' && result.filePath.includes('node_modules')) {\n // Replace with static shims\n\n const normalName = normalizeSlashes(result.filePath)\n // Drop everything up until the `node_modules` folder.\n .replace(/.*node_modules\\//, '');\n\n const shimFile = shouldCreateVirtualShim(normalName);\n if (shimFile) {\n const virtualId = `\\0shim:${normalName}`;\n const bundler = getMetroBundlerWithVirtualModules(getMetroBundler());\n if (!bundler.hasVirtualModule(virtualId)) {\n bundler.setVirtualModule(virtualId, fs.readFileSync(shimFile, 'utf8'));\n }\n debug(`Redirecting module \"${result.filePath}\" to shim`);\n\n return {\n ...result,\n filePath: virtualId,\n };\n }\n }\n } else {\n // When server components are enabled, redirect React Native's renderer to the canary build\n // this will enable the use hook and other requisite features from React 19.\n if (isReactCanaryEnabled && result.filePath.includes('node_modules')) {\n const normalName = normalizeSlashes(result.filePath)\n // Drop everything up until the `node_modules` folder.\n .replace(/.*node_modules\\//, '');\n\n const canaryFile = shouldCreateVirtualCanary(normalName);\n if (canaryFile) {\n debug(`Redirecting React Native module \"${result.filePath}\" to canary build`);\n return {\n ...result,\n filePath: canaryFile,\n };\n }\n }\n }\n\n return result;\n },\n ]);\n\n // Ensure we mutate the resolution context to include the custom resolver options for server and web.\n const metroConfigWithCustomContext = withMetroMutatedResolverContext(\n metroConfigWithCustomResolver,\n (\n immutableContext: CustomResolutionContext,\n moduleName: string,\n platform: string | null\n ): CustomResolutionContext => {\n const context: Mutable<CustomResolutionContext> = {\n ...immutableContext,\n preferNativePlatform: platform !== 'web',\n };\n\n if (isServerEnvironment(context.customResolverOptions?.environment)) {\n // Adjust nodejs source extensions to sort mjs after js, including platform variants.\n if (nodejsSourceExtensions === null) {\n nodejsSourceExtensions = getNodejsExtensions(context.sourceExts);\n }\n context.sourceExts = nodejsSourceExtensions;\n\n context.unstable_enablePackageExports = true;\n context.unstable_conditionNames = ['node', 'require'];\n context.unstable_conditionsByPlatform = {};\n // Node.js runtimes should only be importing main at the moment.\n // This is a temporary fix until we can support the package.json exports.\n context.mainFields = ['main', 'module'];\n\n // Enable react-server import conditions.\n if (context.customResolverOptions?.environment === 'react-server') {\n context.unstable_conditionNames = ['node', 'require', 'react-server', 'server'];\n }\n } else {\n // Non-server changes\n\n if (!env.EXPO_METRO_NO_MAIN_FIELD_OVERRIDE && platform && platform in preferredMainFields) {\n context.mainFields = preferredMainFields[platform];\n }\n }\n\n return context;\n }\n );\n\n return withMetroErrorReportingResolver(metroConfigWithCustomContext);\n}\n\n/** @returns `true` if the incoming resolution should be swapped on web. */\nexport function shouldAliasAssetRegistryForWeb(\n platform: string | null,\n result: Resolution\n): boolean {\n return (\n platform === 'web' &&\n result?.type === 'sourceFile' &&\n typeof result?.filePath === 'string' &&\n normalizeSlashes(result.filePath).endsWith(\n 'react-native-web/dist/modules/AssetRegistry/index.js'\n )\n );\n}\n/** @returns `true` if the incoming resolution should be swapped. */\nexport function shouldAliasModule(\n input: {\n platform: string | null;\n result: Resolution;\n },\n alias: { platform: string; output: string }\n): boolean {\n return (\n input.platform === alias.platform &&\n input.result?.type === 'sourceFile' &&\n typeof input.result?.filePath === 'string' &&\n normalizeSlashes(input.result.filePath).endsWith(alias.output)\n );\n}\n\n/** Add support for `react-native-web` and the Web platform. */\nexport async function withMetroMultiPlatformAsync(\n projectRoot: string,\n {\n config,\n exp,\n platformBundlers,\n isTsconfigPathsEnabled,\n webOutput,\n isFastResolverEnabled,\n isExporting,\n isReactCanaryEnabled,\n getMetroBundler,\n }: {\n config: ConfigT;\n exp: ExpoConfig;\n isTsconfigPathsEnabled: boolean;\n platformBundlers: PlatformBundlers;\n webOutput?: 'single' | 'static' | 'server';\n isFastResolverEnabled?: boolean;\n isExporting?: boolean;\n isReactCanaryEnabled: boolean;\n getMetroBundler: () => Bundler;\n }\n) {\n if (!config.projectRoot) {\n // @ts-expect-error: read-only types\n config.projectRoot = projectRoot;\n }\n\n // Required for @expo/metro-runtime to format paths in the web LogBox.\n process.env.EXPO_PUBLIC_PROJECT_ROOT = process.env.EXPO_PUBLIC_PROJECT_ROOT ?? projectRoot;\n\n if (['static', 'server'].includes(webOutput ?? '')) {\n // Enable static rendering in runtime space.\n process.env.EXPO_PUBLIC_USE_STATIC = '1';\n }\n\n // This is used for running Expo CLI in development against projects outside the monorepo.\n if (!isDirectoryIn(__dirname, projectRoot)) {\n if (!config.watchFolders) {\n // @ts-expect-error: watchFolders is readonly\n config.watchFolders = [];\n }\n // @ts-expect-error: watchFolders is readonly\n config.watchFolders.push(path.join(require.resolve('metro-runtime/package.json'), '../..'));\n }\n\n // @ts-expect-error\n config.transformer._expoRouterWebRendering = webOutput;\n // @ts-expect-error: Invalidate the cache when the location of expo-router changes on-disk.\n config.transformer._expoRouterPath = resolveFrom.silent(projectRoot, 'expo-router');\n\n let tsconfig: null | TsConfigPaths = null;\n\n if (isTsconfigPathsEnabled) {\n tsconfig = await loadTsConfigPathsAsync(projectRoot);\n }\n\n let expoConfigPlatforms = Object.entries(platformBundlers)\n .filter(\n ([platform, bundler]) => bundler === 'metro' && exp.platforms?.includes(platform as Platform)\n )\n .map(([platform]) => platform);\n\n if (Array.isArray(config.resolver.platforms)) {\n expoConfigPlatforms = [...new Set(expoConfigPlatforms.concat(config.resolver.platforms))];\n }\n\n // @ts-expect-error: typed as `readonly`.\n config.resolver.platforms = expoConfigPlatforms;\n\n config = withWebPolyfills(config, { getMetroBundler });\n\n return withExtendedResolver(config, {\n tsconfig,\n isExporting,\n isTsconfigPathsEnabled,\n isFastResolverEnabled,\n isReactCanaryEnabled,\n getMetroBundler,\n });\n}\n\nfunction isDirectoryIn(a: string, b: string) {\n return b.startsWith(a) && b.length > a.length;\n}\n"],"names":["getNodejsExtensions","withExtendedResolver","shouldAliasAssetRegistryForWeb","shouldAliasModule","withMetroMultiPlatformAsync","debug","require","withWebPolyfills","config","getMetroBundler","originalGetPolyfills","serializer","getPolyfills","bind","ctx","virtualModuleId","contents","platform","getMetroBundlerWithVirtualModules","setVirtualModule","polyfills","normalizeSlashes","p","replace","srcExts","mjsExts","filter","ext","test","nodejsSourceExtensions","jsIndex","reduce","index","i","splice","tsconfig","isTsconfigPathsEnabled","isFastResolverEnabled","isExporting","isReactCanaryEnabled","Log","warn","assetRegistryPath","fs","realpathSync","path","resolve","resolveFrom","projectRoot","defaultResolver","metroResolver","resolver","createFastResolver","preserveSymlinks","unstable_enableSymlinks","blockList","Array","isArray","aliases","web","universalAliases","silent","push","preferredMainFields","tsConfigResolve","paths","baseUrl","resolveWithTsConfigPaths","hasBaseUrl","isInteractive","configWatcher","FileNotifier","startObserving","loadTsConfigPathsAsync","then","tsConfigPaths","Object","keys","length","installExitHooks","stopObserving","getStrictResolver","resolveRequest","context","doResolve","moduleName","getOptionalResolver","optionalResolve","error","isResolutionError","isFailedToResolveNameError","isFailedToResolvePathError","metroConfigWithCustomResolver","withMetroResolvers","dev","originModulePath","match","type","isServer","customResolverOptions","environment","moduleId","isNodeExternal","result","filePath","redirectedModuleName","matcher","alias","aliasedModule","_","parseInt","includes","normalName","shimFile","shouldCreateVirtualShim","virtualId","bundler","hasVirtualModule","readFileSync","canaryFile","shouldCreateVirtualCanary","metroConfigWithCustomContext","withMetroMutatedResolverContext","immutableContext","preferNativePlatform","isServerEnvironment","sourceExts","unstable_enablePackageExports","unstable_conditionNames","unstable_conditionsByPlatform","mainFields","env","EXPO_METRO_NO_MAIN_FIELD_OVERRIDE","withMetroErrorReportingResolver","endsWith","input","output","exp","platformBundlers","webOutput","process","EXPO_PUBLIC_PROJECT_ROOT","EXPO_PUBLIC_USE_STATIC","isDirectoryIn","__dirname","watchFolders","join","transformer","_expoRouterWebRendering","_expoRouterPath","expoConfigPlatforms","entries","platforms","map","Set","concat","a","b","startsWith"],"mappings":"AAAA;;;;;CAKC,GACD;;;;;;;;;;;IAkFgBA,mBAAmB,MAAnBA,mBAAmB;IAsBnBC,oBAAoB,MAApBA,oBAAoB;IAyXpBC,8BAA8B,MAA9BA,8BAA8B;IAc9BC,iBAAiB,MAAjBA,iBAAiB;IAgBXC,2BAA2B,MAA3BA,2BAA2B;;;8DA9flC,IAAI;;;;;;;+DAIY,gBAAgB;;;;;;;8DAC9B,MAAM;;;;;;;8DACC,cAAc;;;;;;yCAEH,2BAA2B;2BACqB,aAAa;6BACzB,eAAe;qCACpC,uBAAuB;oCAKlE,sBAAsB;qBACT,cAAc;8BACL,6BAA6B;qBACtC,oBAAoB;sBACP,qBAAqB;6BACxB,4BAA4B;mCACJ,2CAA2C;0CACxD,kDAAkD;8BACvD,4BAA4B;;;;;;;;;;;;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IAAII,GAAG,CAACJ,mBAAmB,CAACK,MAAM,CAACnJ,MAAM,CAAC2C,QAAQ,CAACqG,SAAS,CAAC,CAAC;SAAC,CAAC;IAC5F,CAAC;IAED,yCAAyC;IACzChJ,MAAM,CAAC2C,QAAQ,CAACqG,SAAS,GAAGF,mBAAmB,CAAC;IAEhD9I,MAAM,GAAGD,gBAAgB,CAACC,MAAM,EAAE;QAAEC,eAAe;KAAE,CAAC,CAAC;IAEvD,OAAOR,oBAAoB,CAACO,MAAM,EAAE;QAClC2B,QAAQ;QACRG,WAAW;QACXF,sBAAsB;QACtBC,qBAAqB;QACrBE,oBAAoB;QACpB9B,eAAe;KAChB,CAAC,CAAC;AACL,CAAC;AAED,SAASsI,aAAa,CAACa,CAAS,EAAEC,CAAS,EAAE;IAC3C,OAAOA,CAAC,CAACC,UAAU,CAACF,CAAC,CAAC,IAAIC,CAAC,CAAC/E,MAAM,GAAG8E,CAAC,CAAC9E,MAAM,CAAC;AAChD,CAAC"}
@@ -1,46 +1,95 @@
1
- "use strict";
1
+ /**
2
+ * Copyright © 2022 650 Industries.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */ "use strict";
2
7
  Object.defineProperty(exports, "__esModule", {
3
8
  value: true
4
9
  });
5
- exports.getDefaultMetroResolver = getDefaultMetroResolver;
6
- exports.withMetroResolvers = withMetroResolvers;
7
- exports.withMetroMutatedResolverContext = withMetroMutatedResolverContext;
8
- exports.withMetroErrorReportingResolver = withMetroErrorReportingResolver;
9
- var _chalk = _interopRequireDefault(require("chalk"));
10
- var metroResolver = _interopRequireWildcard(require("metro-resolver"));
11
- var _path = _interopRequireDefault(require("path"));
12
- var _metroErrors = require("./metroErrors");
13
- var _env = require("../../../utils/env");
10
+ function _export(target, all) {
11
+ for(var name in all)Object.defineProperty(target, name, {
12
+ enumerable: true,
13
+ get: all[name]
14
+ });
15
+ }
16
+ _export(exports, {
17
+ getDefaultMetroResolver: ()=>getDefaultMetroResolver,
18
+ withMetroResolvers: ()=>withMetroResolvers,
19
+ withMetroMutatedResolverContext: ()=>withMetroMutatedResolverContext,
20
+ withMetroErrorReportingResolver: ()=>withMetroErrorReportingResolver
21
+ });
22
+ function _chalk() {
23
+ const data = /*#__PURE__*/ _interopRequireDefault(require("chalk"));
24
+ _chalk = function() {
25
+ return data;
26
+ };
27
+ return data;
28
+ }
29
+ function _metroResolver() {
30
+ const data = /*#__PURE__*/ _interopRequireWildcard(require("metro-resolver"));
31
+ _metroResolver = function() {
32
+ return data;
33
+ };
34
+ return data;
35
+ }
36
+ function _path() {
37
+ const data = /*#__PURE__*/ _interopRequireDefault(require("path"));
38
+ _path = function() {
39
+ return data;
40
+ };
41
+ return data;
42
+ }
43
+ const _metroErrors = require("./metroErrors");
44
+ const _env = require("../../../utils/env");
14
45
  function _interopRequireDefault(obj) {
15
46
  return obj && obj.__esModule ? obj : {
16
47
  default: obj
17
48
  };
18
49
  }
19
- function _interopRequireWildcard(obj) {
20
- if (obj && obj.__esModule) {
50
+ function _getRequireWildcardCache(nodeInterop) {
51
+ if (typeof WeakMap !== "function") return null;
52
+ var cacheBabelInterop = new WeakMap();
53
+ var cacheNodeInterop = new WeakMap();
54
+ return (_getRequireWildcardCache = function(nodeInterop) {
55
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
56
+ })(nodeInterop);
57
+ }
58
+ function _interopRequireWildcard(obj, nodeInterop) {
59
+ if (!nodeInterop && obj && obj.__esModule) {
21
60
  return obj;
22
- } else {
23
- var newObj = {};
24
- if (obj != null) {
25
- for(var key in obj){
26
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
27
- var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
28
- if (desc.get || desc.set) {
29
- Object.defineProperty(newObj, key, desc);
30
- } else {
31
- newObj[key] = obj[key];
32
- }
33
- }
61
+ }
62
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
63
+ return {
64
+ default: obj
65
+ };
66
+ }
67
+ var cache = _getRequireWildcardCache(nodeInterop);
68
+ if (cache && cache.has(obj)) {
69
+ return cache.get(obj);
70
+ }
71
+ var newObj = {};
72
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
73
+ for(var key in obj){
74
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
75
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
76
+ if (desc && (desc.get || desc.set)) {
77
+ Object.defineProperty(newObj, key, desc);
78
+ } else {
79
+ newObj[key] = obj[key];
34
80
  }
35
81
  }
36
- newObj.default = obj;
37
- return newObj;
38
82
  }
83
+ newObj.default = obj;
84
+ if (cache) {
85
+ cache.set(obj, newObj);
86
+ }
87
+ return newObj;
39
88
  }
40
89
  const debug = require("debug")("expo:metro:withMetroResolvers");
41
90
  function getDefaultMetroResolver(projectRoot) {
42
91
  return (context, moduleName, platform)=>{
43
- return metroResolver.resolve(context, moduleName, platform);
92
+ return _metroResolver().resolve(context, moduleName, platform);
44
93
  };
45
94
  }
46
95
  function optionsKeyForContext(context) {
@@ -59,7 +108,7 @@ function withMetroResolvers(config, resolvers) {
59
108
  ...config,
60
109
  resolver: {
61
110
  ...config.resolver,
62
- resolveRequest (context, moduleName1, platform1) {
111
+ resolveRequest (context, moduleName, platform) {
63
112
  const upstreamResolveRequest = context.resolveRequest;
64
113
  const universalContext = {
65
114
  ...context,
@@ -73,7 +122,7 @@ function withMetroResolvers(config, resolvers) {
73
122
  } catch (error) {
74
123
  // If the error is directly related to a resolver not being able to resolve a module, then
75
124
  // we can ignore the error and try the next resolver. Otherwise, we should throw the error.
76
- const isResolutionError = (0, _metroErrors).isFailedToResolveNameError(error) || (0, _metroErrors).isFailedToResolvePathError(error);
125
+ const isResolutionError = (0, _metroErrors.isFailedToResolveNameError)(error) || (0, _metroErrors.isFailedToResolvePathError)(error);
77
126
  if (!isResolutionError) {
78
127
  throw error;
79
128
  }
@@ -94,15 +143,15 @@ function withMetroResolvers(config, resolvers) {
94
143
  // return context.resolveRequest(context, moduleName, platform);
95
144
  // };
96
145
  const firstResolver = originalResolveRequest != null ? originalResolveRequest : universalContext.resolveRequest;
97
- return firstResolver(universalContext, moduleName1, platform1);
146
+ return firstResolver(universalContext, moduleName, platform);
98
147
  }
99
148
  }
100
149
  };
101
150
  }
102
151
  function withMetroMutatedResolverContext(config, getContext) {
103
- var ref2;
152
+ var ref;
104
153
  const defaultResolveRequest = getDefaultMetroResolver(config.projectRoot);
105
- const originalResolveRequest = (ref2 = config.resolver) == null ? void 0 : ref2.resolveRequest;
154
+ const originalResolveRequest = (ref = config.resolver) == null ? void 0 : ref.resolveRequest;
106
155
  return {
107
156
  ...config,
108
157
  resolver: {
@@ -117,11 +166,11 @@ function withMetroMutatedResolverContext(config, getContext) {
117
166
  };
118
167
  }
119
168
  function withMetroErrorReportingResolver(config) {
120
- var ref4;
169
+ var ref;
121
170
  if (!_env.env.EXPO_METRO_UNSTABLE_ERRORS) {
122
171
  return config;
123
172
  }
124
- const originalResolveRequest = (ref4 = config.resolver) == null ? void 0 : ref4.resolveRequest;
173
+ const originalResolveRequest = (ref = config.resolver) == null ? void 0 : ref.resolveRequest;
125
174
  function mutateResolutionError(error, context, moduleName, platform) {
126
175
  var ref;
127
176
  if (!platform) {
@@ -143,8 +192,7 @@ function withMetroErrorReportingResolver(config) {
143
192
  // search comparing origin to path
144
193
  const found = [
145
194
  ...mapByTarget.values()
146
- ].find((resolution)=>resolution.path === origin
147
- );
195
+ ].find((resolution)=>resolution.path === origin);
148
196
  if (found) {
149
197
  inverseOrigin.push({
150
198
  origin,
@@ -158,8 +206,8 @@ function withMetroErrorReportingResolver(config) {
158
206
  const pad = (num)=>{
159
207
  return new Array(num).fill(" ").join("");
160
208
  };
161
- var ref3;
162
- const root = (ref3 = (ref = config.server) == null ? void 0 : ref.unstable_serverRoot) != null ? ref3 : config.projectRoot;
209
+ var ref1;
210
+ const root = (ref1 = (ref = config.server) == null ? void 0 : ref.unstable_serverRoot) != null ? ref1 : config.projectRoot;
163
211
  const recurseBackWithLimit = (req, limit, count = 0)=>{
164
212
  const results = {
165
213
  origin: req.origin,
@@ -191,25 +239,25 @@ function withMetroErrorReportingResolver(config) {
191
239
  35);
192
240
  if (inverseTree.previous.length > 0) {
193
241
  debug("Found inverse graph:", JSON.stringify(inverseTree, null, 2));
194
- let extraMessage = _chalk.default.bold("Import stack:");
242
+ let extraMessage = _chalk().default.bold("Import stack:");
195
243
  const printRecursive = (tree, depth = 0)=>{
196
- let filename = _path.default.relative(root, tree.origin);
244
+ let filename = _path().default.relative(root, tree.origin);
197
245
  if (filename.match(/\?ctx=[\w\d]+$/)) {
198
- filename = filename.replace(/\?ctx=[\w\d]+$/, _chalk.default.dim(" (require.context)"));
246
+ filename = filename.replace(/\?ctx=[\w\d]+$/, _chalk().default.dim(" (require.context)"));
199
247
  } else {
200
- let formattedRequest = _chalk.default.green(`"${tree.request}"`);
248
+ let formattedRequest = _chalk().default.green(`"${tree.request}"`);
201
249
  if (// If bundling for web and the import is pulling internals from outside of react-native
202
250
  // then mark it as an invalid import.
203
251
  platform === "web" && !/^(node_modules\/)?react-native\//.test(filename) && tree.request.match(/^react-native\/.*/)) {
204
- formattedRequest = formattedRequest + _chalk.default`\n {yellow Importing react-native internals is not supported on web.}`;
252
+ formattedRequest = formattedRequest + (0, _chalk().default)`\n {yellow Importing react-native internals is not supported on web.}`;
205
253
  }
206
- filename = filename + _chalk.default`\n{gray |} {cyan import} ${formattedRequest}\n`;
254
+ filename = filename + (0, _chalk().default)`\n{gray |} {cyan import} ${formattedRequest}\n`;
207
255
  }
208
- let line = "\n" + pad(depth) + _chalk.default.gray(" ") + filename;
256
+ let line = "\n" + pad(depth) + _chalk().default.gray(" ") + filename;
209
257
  if (filename.match(/node_modules/)) {
210
- line = _chalk.default.gray(// Bold the node module name
258
+ line = _chalk().default.gray(// Bold the node module name
211
259
  line.replace(/node_modules\/([^/]+)/, (_match, p1)=>{
212
- return "node_modules/" + _chalk.default.bold(p1);
260
+ return "node_modules/" + _chalk().default.bold(p1);
213
261
  }));
214
262
  }
215
263
  extraMessage += line;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/server/metro/withMetroResolvers.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport chalk from 'chalk';\nimport { ConfigT as MetroConfig } from 'metro-config';\nimport type { ResolutionContext, CustomResolutionContext } from 'metro-resolver';\nimport * as metroResolver from 'metro-resolver';\nimport path from 'path';\n\nimport { isFailedToResolveNameError, isFailedToResolvePathError } from './metroErrors';\nimport { env } from '../../../utils/env';\n\nconst debug = require('debug')('expo:metro:withMetroResolvers') as typeof console.log;\n\nexport type MetroResolver = NonNullable<MetroConfig['resolver']['resolveRequest']>;\n\n/** Expo Metro Resolvers can return `null` to skip without throwing an error. Metro Resolvers will throw either a `FailedToResolveNameError` or `FailedToResolvePathError`. */\nexport type ExpoCustomMetroResolver = (\n ...args: Parameters<MetroResolver>\n) => ReturnType<MetroResolver> | null;\n\n/** @returns `MetroResolver` utilizing the upstream `resolve` method. */\nexport function getDefaultMetroResolver(projectRoot: string): MetroResolver {\n return (context: ResolutionContext, moduleName: string, platform: string | null) => {\n return metroResolver.resolve(context, moduleName, platform);\n };\n}\n\nfunction optionsKeyForContext(context: ResolutionContext) {\n const canonicalize = require('metro-core/src/canonicalize');\n\n // Compound key for the resolver cache\n return JSON.stringify(context.customResolverOptions ?? {}, canonicalize) ?? '';\n}\n\n/**\n * Extend the Metro config `resolver.resolveRequest` method with additional resolvers that can\n * exit early by returning a `Resolution` or skip to the next resolver by returning `null`.\n *\n * @param config Metro config.\n * @param resolvers custom MetroResolver to chain.\n * @returns a new `MetroConfig` with the `resolver.resolveRequest` method chained.\n */\nexport function withMetroResolvers(\n config: MetroConfig,\n resolvers: ExpoCustomMetroResolver[]\n): MetroConfig {\n debug(\n `Appending ${\n resolvers.length\n } custom resolvers to Metro config. (has custom resolver: ${!!config.resolver?.resolveRequest})`\n );\n // const hasUserDefinedResolver = !!config.resolver?.resolveRequest;\n // const defaultResolveRequest = getDefaultMetroResolver(projectRoot);\n const originalResolveRequest = config.resolver?.resolveRequest;\n\n return {\n ...config,\n resolver: {\n ...config.resolver,\n resolveRequest(context, moduleName, platform) {\n const upstreamResolveRequest = context.resolveRequest;\n\n const universalContext = {\n ...context,\n resolveRequest(\n ctx: CustomResolutionContext,\n moduleName: string,\n platform: string | null\n ) {\n for (const resolver of resolvers) {\n try {\n const res = resolver(ctx, moduleName, platform);\n if (res) {\n return res;\n }\n } catch (error: any) {\n // If the error is directly related to a resolver not being able to resolve a module, then\n // we can ignore the error and try the next resolver. Otherwise, we should throw the error.\n const isResolutionError =\n isFailedToResolveNameError(error) || isFailedToResolvePathError(error);\n if (!isResolutionError) {\n throw error;\n }\n debug(\n `Custom resolver threw: ${error.constructor.name}. (module: ${moduleName}, platform: ${platform})`\n );\n }\n }\n // If we haven't returned by now, use the original resolver or upstream resolver.\n return upstreamResolveRequest(ctx, moduleName, platform);\n },\n };\n\n // If the user defined a resolver, run it first and depend on the documented\n // chaining logic: https://facebook.github.io/metro/docs/resolution/#resolution-algorithm\n //\n // config.resolver.resolveRequest = (context, moduleName, platform) => {\n //\n // // Do work...\n //\n // return context.resolveRequest(context, moduleName, platform);\n // };\n const firstResolver = originalResolveRequest ?? universalContext.resolveRequest;\n return firstResolver(universalContext, moduleName, platform);\n },\n },\n };\n}\n\n/**\n * Hook into the Metro resolver chain and mutate the context so users can resolve against our custom assumptions.\n * For example, this will set `preferNativePlatform` to false when bundling for web.\n * */\nexport function withMetroMutatedResolverContext(\n config: MetroConfig,\n getContext: (\n ctx: CustomResolutionContext,\n moduleName: string,\n platform: string | null\n ) => CustomResolutionContext\n): MetroConfig {\n const defaultResolveRequest = getDefaultMetroResolver(config.projectRoot);\n const originalResolveRequest = config.resolver?.resolveRequest;\n\n return {\n ...config,\n resolver: {\n ...config.resolver,\n resolveRequest(context, moduleName, platform) {\n const universalContext = getContext(context, moduleName, platform);\n const firstResolver =\n originalResolveRequest ?? universalContext.resolveRequest ?? defaultResolveRequest;\n return firstResolver(universalContext, moduleName, platform);\n },\n },\n };\n}\n\nexport function withMetroErrorReportingResolver(config: MetroConfig): MetroConfig {\n if (!env.EXPO_METRO_UNSTABLE_ERRORS) {\n return config;\n }\n\n const originalResolveRequest = config.resolver?.resolveRequest;\n\n function mutateResolutionError(\n error: Error,\n context: ResolutionContext,\n moduleName: string,\n platform: string | null\n ) {\n if (!platform) {\n debug('Cannot mutate resolution error');\n return error;\n }\n\n const mapByOrigin = depGraph.get(optionsKeyForContext(context));\n const mapByPlatform = mapByOrigin?.get(platform);\n\n if (!mapByPlatform) {\n return error;\n }\n\n // collect all references inversely using some expensive lookup\n\n const getReferences = (origin: string) => {\n const inverseOrigin: { origin: string; previous: string; request: string }[] = [];\n\n if (!mapByPlatform) {\n return inverseOrigin;\n }\n\n for (const [originKey, mapByTarget] of mapByPlatform) {\n // search comparing origin to path\n\n const found = [...mapByTarget.values()].find((resolution) => resolution.path === origin);\n if (found) {\n inverseOrigin.push({\n origin,\n previous: originKey,\n request: found.request,\n });\n }\n }\n\n return inverseOrigin;\n };\n\n const pad = (num: number) => {\n return new Array(num).fill(' ').join('');\n };\n\n const root = config.server?.unstable_serverRoot ?? config.projectRoot;\n\n type InverseDepResult = {\n origin: string;\n request: string;\n previous: InverseDepResult[];\n };\n const recurseBackWithLimit = (\n req: { origin: string; request: string },\n limit: number,\n count: number = 0\n ) => {\n const results: InverseDepResult = {\n origin: req.origin,\n request: req.request,\n previous: [],\n };\n\n if (count >= limit) {\n return results;\n }\n\n const inverse = getReferences(req.origin);\n for (const match of inverse) {\n // Use more qualified name if possible\n // results.origin = match.origin;\n // Found entry point\n if (req.origin === match.previous) {\n continue;\n }\n results.previous.push(\n recurseBackWithLimit({ origin: match.previous, request: match.request }, limit, count + 1)\n );\n }\n return results;\n };\n\n const inverseTree = recurseBackWithLimit(\n { origin: context.originModulePath, request: moduleName },\n // TODO: Do we need to expose this?\n 35\n );\n\n if (inverseTree.previous.length > 0) {\n debug('Found inverse graph:', JSON.stringify(inverseTree, null, 2));\n let extraMessage = chalk.bold('Import stack:');\n const printRecursive = (tree: InverseDepResult, depth: number = 0) => {\n let filename = path.relative(root, tree.origin);\n if (filename.match(/\\?ctx=[\\w\\d]+$/)) {\n filename = filename.replace(/\\?ctx=[\\w\\d]+$/, chalk.dim(' (require.context)'));\n } else {\n let formattedRequest = chalk.green(`\"${tree.request}\"`);\n\n if (\n // If bundling for web and the import is pulling internals from outside of react-native\n // then mark it as an invalid import.\n platform === 'web' &&\n !/^(node_modules\\/)?react-native\\//.test(filename) &&\n tree.request.match(/^react-native\\/.*/)\n ) {\n formattedRequest =\n formattedRequest +\n chalk`\\n {yellow Importing react-native internals is not supported on web.}`;\n }\n\n filename = filename + chalk`\\n{gray |} {cyan import} ${formattedRequest}\\n`;\n }\n let line = '\\n' + pad(depth) + chalk.gray(' ') + filename;\n if (filename.match(/node_modules/)) {\n line = chalk.gray(\n // Bold the node module name\n line.replace(/node_modules\\/([^/]+)/, (_match, p1) => {\n return 'node_modules/' + chalk.bold(p1);\n })\n );\n }\n extraMessage += line;\n for (const child of tree.previous) {\n printRecursive(\n child,\n // Only add depth if there are multiple children\n tree.previous.length > 1 ? depth + 1 : depth\n );\n }\n };\n printRecursive(inverseTree);\n\n // @ts-expect-error\n error._expoImportStack = extraMessage;\n } else {\n debug('Found no inverse tree for:', context.originModulePath);\n }\n\n return error;\n }\n\n const depGraph: Map<\n // custom options\n string,\n Map<\n // platform\n string,\n Map<\n // origin module name\n string,\n Set<{\n // required module name\n path: string;\n // This isn't entirely accurate since a module can be imported multiple times in a file,\n // and use different names. But it's good enough for now.\n request: string;\n }>\n >\n >\n > = new Map();\n\n return {\n ...config,\n resolver: {\n ...config.resolver,\n resolveRequest(context, moduleName, platform) {\n const storeResult = (res: NonNullable<ReturnType<ExpoCustomMetroResolver>>) => {\n if (!platform) return;\n\n const key = optionsKeyForContext(context);\n if (!depGraph.has(key)) depGraph.set(key, new Map());\n const mapByTarget = depGraph.get(key);\n if (!mapByTarget!.has(platform)) mapByTarget!.set(platform, new Map());\n const mapByPlatform = mapByTarget!.get(platform);\n if (!mapByPlatform!.has(context.originModulePath))\n mapByPlatform!.set(context.originModulePath, new Set());\n const setForModule = mapByPlatform!.get(context.originModulePath)!;\n\n const qualifiedModuleName = res?.type === 'sourceFile' ? res.filePath : moduleName;\n setForModule.add({ path: qualifiedModuleName, request: moduleName });\n };\n\n // If the user defined a resolver, run it first and depend on the documented\n // chaining logic: https://facebook.github.io/metro/docs/resolution/#resolution-algorithm\n //\n // config.resolver.resolveRequest = (context, moduleName, platform) => {\n //\n // // Do work...\n //\n // return context.resolveRequest(context, moduleName, platform);\n // };\n try {\n const firstResolver = originalResolveRequest ?? context.resolveRequest;\n const res = firstResolver(context, moduleName, platform);\n storeResult(res);\n return res;\n } catch (error: any) {\n throw mutateResolutionError(error, context, moduleName, platform);\n }\n },\n },\n };\n}\n"],"names":["getDefaultMetroResolver","withMetroResolvers","withMetroMutatedResolverContext","withMetroErrorReportingResolver","metroResolver","debug","require","projectRoot","context","moduleName","platform","resolve","optionsKeyForContext","canonicalize","JSON","stringify","customResolverOptions","config","resolvers","length","resolver","resolveRequest","originalResolveRequest","upstreamResolveRequest","universalContext","ctx","res","error","isResolutionError","isFailedToResolveNameError","isFailedToResolvePathError","constructor","name","firstResolver","getContext","defaultResolveRequest","env","EXPO_METRO_UNSTABLE_ERRORS","mutateResolutionError","mapByOrigin","depGraph","get","mapByPlatform","getReferences","origin","inverseOrigin","originKey","mapByTarget","found","values","find","resolution","path","push","previous","request","pad","num","Array","fill","join","root","server","unstable_serverRoot","recurseBackWithLimit","req","limit","count","results","inverse","match","inverseTree","originModulePath","extraMessage","chalk","bold","printRecursive","tree","depth","filename","relative","replace","dim","formattedRequest","green","test","line","gray","_match","p1","child","_expoImportStack","Map","storeResult","key","has","set","Set","setForModule","qualifiedModuleName","type","filePath","add"],"mappings":"AAMA;;;;QAmBgBA,uBAAuB,GAAvBA,uBAAuB;QAqBvBC,kBAAkB,GAAlBA,kBAAkB;QAuElBC,+BAA+B,GAA/BA,+BAA+B;QAyB/BC,+BAA+B,GAA/BA,+BAA+B;AAxI7B,IAAA,MAAO,kCAAP,OAAO,EAAA;AAGbC,IAAAA,aAAa,mCAAM,gBAAgB,EAAtB;AACR,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEgD,IAAA,YAAe,WAAf,eAAe,CAAA;AAClE,IAAA,IAAoB,WAApB,oBAAoB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAExC,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,+BAA+B,CAAC,AAAsB,AAAC;AAU/E,SAASN,uBAAuB,CAACO,WAAmB,EAAiB;IAC1E,OAAO,CAACC,OAA0B,EAAEC,UAAkB,EAAEC,QAAuB,GAAK;QAClF,OAAON,aAAa,CAACO,OAAO,CAACH,OAAO,EAAEC,UAAU,EAAEC,QAAQ,CAAC,CAAC;KAC7D,CAAC;CACH;AAED,SAASE,oBAAoB,CAACJ,OAA0B,EAAE;IACxD,MAAMK,YAAY,GAAGP,OAAO,CAAC,6BAA6B,CAAC,AAAC;QAGtCE,sBAA6B,EAA5CM,GAAiE;IADxE,sCAAsC;IACtC,OAAOA,CAAAA,GAAiE,GAAjEA,IAAI,CAACC,SAAS,CAACP,CAAAA,sBAA6B,GAA7BA,OAAO,CAACQ,qBAAqB,YAA7BR,sBAA6B,GAAI,EAAE,EAAEK,YAAY,CAAC,YAAjEC,GAAiE,GAAI,EAAE,CAAC;CAChF;AAUM,SAASb,kBAAkB,CAChCgB,MAAmB,EACnBC,SAAoC,EACvB;QAImDD,GAAe,EAIhDA,IAAe;IAP9CZ,KAAK,CACH,CAAC,UAAU,EACTa,SAAS,CAACC,MAAM,CACjB,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ACF,iBAAiB;gBACjB,EAAE;gBACF,iEAAiE;gBACjE,KAAK;gBACL,IAAI;oBACF,MAAMwB,aAAa,GAAGX,sBAAsB,WAAtBA,sBAAsB,GAAId,OAAO,CAACa,cAAc,AAAC;oBACvE,MAAMK,GAAG,GAAGO,aAAa,CAACzB,OAAO,EAAEC,UAAU,EAAEC,QAAQ,CAAC,AAAC;oBACzDmF,WAAW,CAACnE,GAAG,CAAC,CAAC;oBACjB,OAAOA,GAAG,CAAC;iBACZ,CAAC,OAAOC,KAAK,EAAO;oBACnB,MAAMW,qBAAqB,CAACX,KAAK,EAAEnB,OAAO,EAAEC,UAAU,EAAEC,QAAQ,CAAC,CAAC;iBACnE;aACF;SACF;KACF,CAAC;CACH"}
1
+ {"version":3,"sources":["../../../../../src/start/server/metro/withMetroResolvers.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport chalk from 'chalk';\nimport { ConfigT as MetroConfig } from 'metro-config';\nimport type { ResolutionContext, CustomResolutionContext } from 'metro-resolver';\nimport * as metroResolver from 'metro-resolver';\nimport path from 'path';\n\nimport { isFailedToResolveNameError, isFailedToResolvePathError } from './metroErrors';\nimport { env } from '../../../utils/env';\n\nconst debug = require('debug')('expo:metro:withMetroResolvers') as typeof console.log;\n\nexport type MetroResolver = NonNullable<MetroConfig['resolver']['resolveRequest']>;\n\n/** Expo Metro Resolvers can return `null` to skip without throwing an error. Metro Resolvers will throw either a `FailedToResolveNameError` or `FailedToResolvePathError`. */\nexport type ExpoCustomMetroResolver = (\n ...args: Parameters<MetroResolver>\n) => ReturnType<MetroResolver> | null;\n\n/** @returns `MetroResolver` utilizing the upstream `resolve` method. */\nexport function getDefaultMetroResolver(projectRoot: string): MetroResolver {\n return (context: ResolutionContext, moduleName: string, platform: string | null) => {\n return metroResolver.resolve(context, moduleName, platform);\n };\n}\n\nfunction optionsKeyForContext(context: ResolutionContext) {\n const canonicalize = require('metro-core/src/canonicalize');\n\n // Compound key for the resolver cache\n return JSON.stringify(context.customResolverOptions ?? {}, canonicalize) ?? '';\n}\n\n/**\n * Extend the Metro config `resolver.resolveRequest` method with additional resolvers that can\n * exit early by returning a `Resolution` or skip to the next resolver by returning `null`.\n *\n * @param config Metro config.\n * @param resolvers custom MetroResolver to chain.\n * @returns a new `MetroConfig` with the `resolver.resolveRequest` method chained.\n */\nexport function withMetroResolvers(\n config: MetroConfig,\n resolvers: ExpoCustomMetroResolver[]\n): MetroConfig {\n debug(\n `Appending ${\n resolvers.length\n } custom resolvers to Metro config. (has custom resolver: ${!!config.resolver?.resolveRequest})`\n );\n // const hasUserDefinedResolver = !!config.resolver?.resolveRequest;\n // const defaultResolveRequest = getDefaultMetroResolver(projectRoot);\n const originalResolveRequest = config.resolver?.resolveRequest;\n\n return {\n ...config,\n resolver: {\n ...config.resolver,\n resolveRequest(context, moduleName, platform) {\n const upstreamResolveRequest = context.resolveRequest;\n\n const universalContext = {\n ...context,\n resolveRequest(\n ctx: CustomResolutionContext,\n moduleName: string,\n platform: string | null\n ) {\n for (const resolver of resolvers) {\n try {\n const res = resolver(ctx, moduleName, platform);\n if (res) {\n return res;\n }\n } catch (error: any) {\n // If the error is directly related to a resolver not being able to resolve a module, then\n // we can ignore the error and try the next resolver. Otherwise, we should throw the error.\n const isResolutionError =\n isFailedToResolveNameError(error) || isFailedToResolvePathError(error);\n if (!isResolutionError) {\n throw error;\n }\n debug(\n `Custom resolver threw: ${error.constructor.name}. (module: ${moduleName}, platform: ${platform})`\n );\n }\n }\n // If we haven't returned by now, use the original resolver or upstream resolver.\n return upstreamResolveRequest(ctx, moduleName, platform);\n },\n };\n\n // If the user defined a resolver, run it first and depend on the documented\n // chaining logic: https://facebook.github.io/metro/docs/resolution/#resolution-algorithm\n //\n // config.resolver.resolveRequest = (context, moduleName, platform) => {\n //\n // // Do work...\n //\n // return context.resolveRequest(context, moduleName, platform);\n // };\n const firstResolver = originalResolveRequest ?? universalContext.resolveRequest;\n return firstResolver(universalContext, moduleName, platform);\n },\n },\n };\n}\n\n/**\n * Hook into the Metro resolver chain and mutate the context so users can resolve against our custom assumptions.\n * For example, this will set `preferNativePlatform` to false when bundling for web.\n * */\nexport function withMetroMutatedResolverContext(\n config: MetroConfig,\n getContext: (\n ctx: CustomResolutionContext,\n moduleName: string,\n platform: string | null\n ) => CustomResolutionContext\n): MetroConfig {\n const defaultResolveRequest = getDefaultMetroResolver(config.projectRoot);\n const originalResolveRequest = config.resolver?.resolveRequest;\n\n return {\n ...config,\n resolver: {\n ...config.resolver,\n resolveRequest(context, moduleName, platform) {\n const universalContext = getContext(context, moduleName, platform);\n const firstResolver =\n originalResolveRequest ?? universalContext.resolveRequest ?? defaultResolveRequest;\n return firstResolver(universalContext, moduleName, platform);\n },\n },\n };\n}\n\nexport function withMetroErrorReportingResolver(config: MetroConfig): MetroConfig {\n if (!env.EXPO_METRO_UNSTABLE_ERRORS) {\n return config;\n }\n\n const originalResolveRequest = config.resolver?.resolveRequest;\n\n function mutateResolutionError(\n error: Error,\n context: ResolutionContext,\n moduleName: string,\n platform: string | null\n ) {\n if (!platform) {\n debug('Cannot mutate resolution error');\n return error;\n }\n\n const mapByOrigin = depGraph.get(optionsKeyForContext(context));\n const mapByPlatform = mapByOrigin?.get(platform);\n\n if (!mapByPlatform) {\n return error;\n }\n\n // collect all references inversely using some expensive lookup\n\n const getReferences = (origin: string) => {\n const inverseOrigin: { origin: string; previous: string; request: string }[] = [];\n\n if (!mapByPlatform) {\n return inverseOrigin;\n }\n\n for (const [originKey, mapByTarget] of mapByPlatform) {\n // search comparing origin to path\n\n const found = [...mapByTarget.values()].find((resolution) => resolution.path === origin);\n if (found) {\n inverseOrigin.push({\n origin,\n previous: originKey,\n request: found.request,\n });\n }\n }\n\n return inverseOrigin;\n };\n\n const pad = (num: number) => {\n return new Array(num).fill(' ').join('');\n };\n\n const root = config.server?.unstable_serverRoot ?? config.projectRoot;\n\n type InverseDepResult = {\n origin: string;\n request: string;\n previous: InverseDepResult[];\n };\n const recurseBackWithLimit = (\n req: { origin: string; request: string },\n limit: number,\n count: number = 0\n ) => {\n const results: InverseDepResult = {\n origin: req.origin,\n request: req.request,\n previous: [],\n };\n\n if (count >= limit) {\n return results;\n }\n\n const inverse = getReferences(req.origin);\n for (const match of inverse) {\n // Use more qualified name if possible\n // results.origin = match.origin;\n // Found entry point\n if (req.origin === match.previous) {\n continue;\n }\n results.previous.push(\n recurseBackWithLimit({ origin: match.previous, request: match.request }, limit, count + 1)\n );\n }\n return results;\n };\n\n const inverseTree = recurseBackWithLimit(\n { origin: context.originModulePath, request: moduleName },\n // TODO: Do we need to expose this?\n 35\n );\n\n if (inverseTree.previous.length > 0) {\n debug('Found inverse graph:', JSON.stringify(inverseTree, null, 2));\n let extraMessage = chalk.bold('Import stack:');\n const printRecursive = (tree: InverseDepResult, depth: number = 0) => {\n let filename = path.relative(root, tree.origin);\n if (filename.match(/\\?ctx=[\\w\\d]+$/)) {\n filename = filename.replace(/\\?ctx=[\\w\\d]+$/, chalk.dim(' (require.context)'));\n } else {\n let formattedRequest = chalk.green(`\"${tree.request}\"`);\n\n if (\n // If bundling for web and the import is pulling internals from outside of react-native\n // then mark it as an invalid import.\n platform === 'web' &&\n !/^(node_modules\\/)?react-native\\//.test(filename) &&\n tree.request.match(/^react-native\\/.*/)\n ) {\n formattedRequest =\n formattedRequest +\n chalk`\\n {yellow Importing react-native internals is not supported on web.}`;\n }\n\n filename = filename + chalk`\\n{gray |} {cyan import} ${formattedRequest}\\n`;\n }\n let line = '\\n' + pad(depth) + chalk.gray(' ') + filename;\n if (filename.match(/node_modules/)) {\n line = chalk.gray(\n // Bold the node module name\n line.replace(/node_modules\\/([^/]+)/, (_match, p1) => {\n return 'node_modules/' + chalk.bold(p1);\n })\n );\n }\n extraMessage += line;\n for (const child of tree.previous) {\n printRecursive(\n child,\n // Only add depth if there are multiple children\n tree.previous.length > 1 ? depth + 1 : depth\n );\n }\n };\n printRecursive(inverseTree);\n\n // @ts-expect-error\n error._expoImportStack = extraMessage;\n } else {\n debug('Found no inverse tree for:', context.originModulePath);\n }\n\n return error;\n }\n\n const depGraph: Map<\n // custom options\n string,\n Map<\n // platform\n string,\n Map<\n // origin module name\n string,\n Set<{\n // required module name\n path: string;\n // This isn't entirely accurate since a module can be imported multiple times in a file,\n // and use different names. But it's good enough for now.\n request: string;\n }>\n >\n >\n > = new Map();\n\n return {\n ...config,\n resolver: {\n ...config.resolver,\n resolveRequest(context, moduleName, platform) {\n const storeResult = (res: NonNullable<ReturnType<ExpoCustomMetroResolver>>) => {\n if (!platform) return;\n\n const key = optionsKeyForContext(context);\n if (!depGraph.has(key)) depGraph.set(key, new Map());\n const mapByTarget = depGraph.get(key);\n if (!mapByTarget!.has(platform)) mapByTarget!.set(platform, new Map());\n const mapByPlatform = mapByTarget!.get(platform);\n if (!mapByPlatform!.has(context.originModulePath))\n mapByPlatform!.set(context.originModulePath, new Set());\n const setForModule = mapByPlatform!.get(context.originModulePath)!;\n\n const qualifiedModuleName = res?.type === 'sourceFile' ? res.filePath : moduleName;\n setForModule.add({ path: qualifiedModuleName, request: moduleName });\n };\n\n // If the user defined a resolver, run it first and depend on the documented\n // chaining logic: https://facebook.github.io/metro/docs/resolution/#resolution-algorithm\n //\n // config.resolver.resolveRequest = (context, moduleName, platform) => {\n //\n // // Do work...\n //\n // return context.resolveRequest(context, moduleName, platform);\n // };\n try {\n const firstResolver = originalResolveRequest ?? context.resolveRequest;\n const res = firstResolver(context, moduleName, platform);\n storeResult(res);\n return res;\n } catch (error: any) {\n throw mutateResolutionError(error, context, moduleName, platform);\n }\n },\n },\n };\n}\n"],"names":["getDefaultMetroResolver","withMetroResolvers","withMetroMutatedResolverContext","withMetroErrorReportingResolver","debug","require","projectRoot","context","moduleName","platform","metroResolver","resolve","optionsKeyForContext","canonicalize","JSON","stringify","customResolverOptions","config","resolvers","length","resolver","resolveRequest","originalResolveRequest","upstreamResolveRequest","universalContext","ctx","res","error","isResolutionError","isFailedToResolveNameError","isFailedToResolvePathError","constructor","name","firstResolver","getContext","defaultResolveRequest","env","EXPO_METRO_UNSTABLE_ERRORS","mutateResolutionError","mapByOrigin","depGraph","get","mapByPlatform","getReferences","origin","inverseOrigin","originKey","mapByTarget","found","values","find","resolution","path","push","previous","request","pad","num","Array","fill","join","root","server","unstable_serverRoot","recurseBackWithLimit","req","limit","count","results","inverse","match","inverseTree","originModulePath","extraMessage","chalk","bold","printRecursive","tree","depth","filename","relative","replace","dim","formattedRequest","green","test","line","gray","_match","p1","child","_expoImportStack","Map","storeResult","key","has","set","Set","setForModule","qualifiedModuleName","type","filePath","add"],"mappings":"AAAA;;;;;CAKC,GACD;;;;;;;;;;;IAmBgBA,uBAAuB,MAAvBA,uBAAuB;IAqBvBC,kBAAkB,MAAlBA,kBAAkB;IAuElBC,+BAA+B,MAA/BA,+BAA+B;IAyB/BC,+BAA+B,MAA/BA,+BAA+B;;;8DAxI7B,OAAO;;;;;;;+DAGM,gBAAgB;;;;;;;8DAC9B,MAAM;;;;;;6BAEgD,eAAe;qBAClE,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAExC,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,+BAA+B,CAAC,AAAsB,AAAC;AAU/E,SAASL,uBAAuB,CAACM,WAAmB,EAAiB;IAC1E,OAAO,CAACC,OAA0B,EAAEC,UAAkB,EAAEC,QAAuB,GAAK;QAClF,OAAOC,cAAa,EAAA,CAACC,OAAO,CAACJ,OAAO,EAAEC,UAAU,EAAEC,QAAQ,CAAC,CAAC;IAC9D,CAAC,CAAC;AACJ,CAAC;AAED,SAASG,oBAAoB,CAACL,OAA0B,EAAE;IACxD,MAAMM,YAAY,GAAGR,OAAO,CAAC,6BAA6B,CAAC,AAAC;QAGtCE,sBAA6B,EAA5CO,GAAiE;IADxE,sCAAsC;IACtC,OAAOA,CAAAA,GAAiE,GAAjEA,IAAI,C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ACiE,gBAAgB,EAAE,IAAIyB,GAAG,EAAE,CAAC,CAAC;oBAC1D,MAAMC,YAAY,GAAGxD,aAAa,CAAED,GAAG,CAAClC,OAAO,CAACiE,gBAAgB,CAAC,AAAC,AAAC;oBAEnE,MAAM2B,mBAAmB,GAAGzE,CAAAA,GAAG,QAAM,GAATA,KAAAA,CAAS,GAATA,GAAG,CAAE0E,IAAI,CAAA,KAAK,YAAY,GAAG1E,GAAG,CAAC2E,QAAQ,GAAG7F,UAAU,AAAC;oBACnF0F,YAAY,CAACI,GAAG,CAAC;wBAAElD,IAAI,EAAE+C,mBAAmB;wBAAE5C,OAAO,EAAE/C,UAAU;qBAAE,CAAC,CAAC;gBACvE,CAAC,AAAC;gBAEF,4EAA4E;gBAC5E,yFAAyF;gBACzF,EAAE;gBACF,wEAAwE;gBACxE,EAAE;gBACF,iBAAiB;gBACjB,EAAE;gBACF,iEAAiE;gBACjE,KAAK;gBACL,IAAI;oBACF,MAAMyB,aAAa,GAAGX,sBAAsB,WAAtBA,sBAAsB,GAAIf,OAAO,CAACc,cAAc,AAAC;oBACvE,MAAMK,GAAG,GAAGO,aAAa,CAAC1B,OAAO,EAAEC,UAAU,EAAEC,QAAQ,CAAC,AAAC;oBACzDoF,WAAW,CAACnE,GAAG,CAAC,CAAC;oBACjB,OAAOA,GAAG,CAAC;gBACb,EAAE,OAAOC,KAAK,EAAO;oBACnB,MAAMW,qBAAqB,CAACX,KAAK,EAAEpB,OAAO,EAAEC,UAAU,EAAEC,QAAQ,CAAC,CAAC;gBACpE,CAAC;YACH,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
@@ -2,6 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
+ Object.defineProperty(exports, "ContextModuleSourceMapsMiddleware", {
6
+ enumerable: true,
7
+ get: ()=>ContextModuleSourceMapsMiddleware
8
+ });
5
9
  const debug = require("debug")("expo:start:server:middleware:metro-context-modules");
6
10
  class ContextModuleSourceMapsMiddleware {
7
11
  getHandler() {
@@ -22,6 +26,5 @@ class ContextModuleSourceMapsMiddleware {
22
26
  };
23
27
  }
24
28
  }
25
- exports.ContextModuleSourceMapsMiddleware = ContextModuleSourceMapsMiddleware;
26
29
 
27
30
  //# sourceMappingURL=ContextModuleSourceMapsMiddleware.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/server/middleware/ContextModuleSourceMapsMiddleware.ts"],"sourcesContent":["import { ServerRequest, ServerResponse } from './server.types';\n\nconst debug = require('debug')(\n 'expo:start:server:middleware:metro-context-modules'\n) as typeof console.log;\n\n/**\n * Source maps for `require.context` modules aren't supported in the Metro dev server\n * we should intercept the request and return a noop response to prevent Chrome/Metro\n * from erroring out.\n */\nexport class ContextModuleSourceMapsMiddleware {\n getHandler() {\n return (req: ServerRequest, res: ServerResponse, next: any) => {\n if (!req?.url || (req.method !== 'GET' && req.method !== 'HEAD')) {\n return next();\n }\n\n if (req.url.match(/%3Fctx=[\\d\\w\\W]+\\.map\\?/)) {\n debug('Skipping sourcemap request for context module %s', req.url);\n // Return a noop response for the sourcemap\n res.writeHead(200, {\n 'Content-Type': 'application/json',\n });\n res.end('{}');\n return;\n }\n\n next();\n };\n }\n}\n"],"names":["debug","require","ContextModuleSourceMapsMiddleware","getHandler","req","res","next","url","method","match","writeHead","end"],"mappings":"AAAA;;;;AAEA,MAAMA,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAC5B,oDAAoD,CACrD,AAAsB,AAAC;AAOjB,MAAMC,iCAAiC;IAC5CC,UAAU,GAAG;QACX,OAAO,CAACC,GAAkB,EAAEC,GAAmB,EAAEC,IAAS,GAAK;YAC7D,IAAI,CAACF,CAAAA,GAAG,QAAK,GAARA,KAAAA,CAAQ,GAARA,GAAG,CAAEG,GAAG,CAAA,IAAKH,GAAG,CAACI,MAAM,KAAK,KAAK,IAAIJ,GAAG,CAACI,MAAM,KAAK,MAAM,AAAC,EAAE;gBAChE,OAAOF,IAAI,EAAE,CAAC;aACf;YAED,IAAIF,GAAG,CAACG,GAAG,CAACE,KAAK,2BAA2B,EAAE;gBAC5CT,KAAK,CAAC,kDAAkD,EAAEI,GAAG,CAACG,GAAG,CAAC,CAAC;gBACnE,2CAA2C;gBAC3CF,GAAG,CAACK,SAAS,CAAC,GAAG,EAAE;oBACjB,cAAc,EAAE,kBAAkB;iBACnC,CAAC,CAAC;gBACHL,GAAG,CAACM,GAAG,CAAC,IAAI,CAAC,CAAC;gBACd,OAAO;aACR;YAEDL,IAAI,EAAE,CAAC;SACR,CAAC;KACH;CACF;QApBYJ,iCAAiC,GAAjCA,iCAAiC"}
1
+ {"version":3,"sources":["../../../../../src/start/server/middleware/ContextModuleSourceMapsMiddleware.ts"],"sourcesContent":["import { ServerRequest, ServerResponse } from './server.types';\n\nconst debug = require('debug')(\n 'expo:start:server:middleware:metro-context-modules'\n) as typeof console.log;\n\n/**\n * Source maps for `require.context` modules aren't supported in the Metro dev server\n * we should intercept the request and return a noop response to prevent Chrome/Metro\n * from erroring out.\n */\nexport class ContextModuleSourceMapsMiddleware {\n getHandler() {\n return (req: ServerRequest, res: ServerResponse, next: any) => {\n if (!req?.url || (req.method !== 'GET' && req.method !== 'HEAD')) {\n return next();\n }\n\n if (req.url.match(/%3Fctx=[\\d\\w\\W]+\\.map\\?/)) {\n debug('Skipping sourcemap request for context module %s', req.url);\n // Return a noop response for the sourcemap\n res.writeHead(200, {\n 'Content-Type': 'application/json',\n });\n res.end('{}');\n return;\n }\n\n next();\n };\n }\n}\n"],"names":["ContextModuleSourceMapsMiddleware","debug","require","getHandler","req","res","next","url","method","match","writeHead","end"],"mappings":"AAAA;;;;+BAWaA,mCAAiC;;aAAjCA,iCAAiC;;AAT9C,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAC5B,oDAAoD,CACrD,AAAsB,AAAC;AAOjB,MAAMF,iCAAiC;IAC5CG,UAAU,GAAG;QACX,OAAO,CAACC,GAAkB,EAAEC,GAAmB,EAAEC,IAAS,GAAK;YAC7D,IAAI,CAACF,CAAAA,GAAG,QAAK,GAARA,KAAAA,CAAQ,GAARA,GAAG,CAAEG,GAAG,CAAA,IAAKH,GAAG,CAACI,MAAM,KAAK,KAAK,IAAIJ,GAAG,CAACI,MAAM,KAAK,MAAM,AAAC,EAAE;gBAChE,OAAOF,IAAI,EAAE,CAAC;YAChB,CAAC;YAED,IAAIF,GAAG,CAACG,GAAG,CAACE,KAAK,2BAA2B,EAAE;gBAC5CR,KAAK,CAAC,kDAAkD,EAAEG,GAAG,CAACG,GAAG,CAAC,CAAC;gBACnE,2CAA2C;gBAC3CF,GAAG,CAACK,SAAS,CAAC,GAAG,EAAE;oBACjB,cAAc,EAAE,kBAAkB;iBACnC,CAAC,CAAC;gBACHL,GAAG,CAACM,GAAG,CAAC,IAAI,CAAC,CAAC;gBACd,OAAO;YACT,CAAC;YAEDL,IAAI,EAAE,CAAC;QACT,CAAC,CAAC;IACJ;CACD"}
@@ -2,7 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- exports.createCorsMiddleware = createCorsMiddleware;
5
+ Object.defineProperty(exports, "createCorsMiddleware", {
6
+ enumerable: true,
7
+ get: ()=>createCorsMiddleware
8
+ });
6
9
  const DEFAULT_ALLOWED_CORS_HOSTNAMES = [
7
10
  "localhost",
8
11
  "chrome-devtools-frontend.appspot.com",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/server/middleware/CorsMiddleware.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config';\n\nimport type { ServerRequest, ServerResponse } from './server.types';\n\nconst DEFAULT_ALLOWED_CORS_HOSTNAMES = [\n 'localhost',\n 'chrome-devtools-frontend.appspot.com', // Support remote Chrome DevTools frontend\n 'devtools', // Support local Chrome DevTools `devtools://devtools`\n];\n\nexport function createCorsMiddleware(exp: ExpoConfig) {\n const allowedHostnames = [...DEFAULT_ALLOWED_CORS_HOSTNAMES];\n // Support for expo-router API routes\n if (exp.extra?.router?.headOrigin) {\n allowedHostnames.push(new URL(exp.extra.router.headOrigin).hostname);\n }\n if (exp.extra?.router?.origin) {\n allowedHostnames.push(new URL(exp.extra.router.origin).hostname);\n }\n\n return (req: ServerRequest, res: ServerResponse, next: (err?: Error) => void) => {\n if (typeof req.headers.origin === 'string') {\n const { hostname } = new URL(req.headers.origin);\n if (!allowedHostnames.includes(hostname)) {\n next(\n new Error(\n `Unauthorized request from ${req.headers.origin}. ` +\n 'This may happen because of a conflicting browser extension to intercept HTTP requests. ' +\n 'Please try again without browser extensions or using incognito mode.'\n )\n );\n return;\n }\n\n res.setHeader('Access-Control-Allow-Origin', req.headers.origin);\n maybePreventMetroResetCorsHeader(req, res);\n }\n\n // Block MIME-type sniffing.\n res.setHeader('X-Content-Type-Options', 'nosniff');\n\n next();\n };\n}\n\n// When accessing source maps,\n// metro will overwrite the `Access-Control-Allow-Origin` header with hardcoded `devtools://devtools` value.\n// https://github.com/facebook/metro/blob/a7f8955e6d2424b0d5f73d4bcdaf22560e1d5f27/packages/metro/src/Server.js#L540\n// This is a workaround to prevent this behavior.\nfunction maybePreventMetroResetCorsHeader(req: ServerRequest, res: ServerResponse) {\n const pathname = req.url ? new URL(req.url, `http://${req.headers.host}`).pathname : '';\n if (pathname.endsWith('.map')) {\n const setHeader = res.setHeader.bind(res);\n res.setHeader = (key, ...args) => {\n if (key !== 'Access-Control-Allow-Origin') {\n setHeader(key, ...args);\n }\n return res;\n };\n }\n}\n"],"names":["createCorsMiddleware","DEFAULT_ALLOWED_CORS_HOSTNAMES","exp","allowedHostnames","extra","router","headOrigin","push","URL","hostname","origin","req","res","next","headers","includes","Error","setHeader","maybePreventMetroResetCorsHeader","pathname","url","host","endsWith","bind","key","args"],"mappings":"AAAA;;;;QAUgBA,oBAAoB,GAApBA,oBAAoB;AANpC,MAAMC,8BAA8B,GAAG;IACrC,WAAW;IACX,sCAAsC;IACtC,UAAU;CACX,AAAC;AAEK,SAASD,oBAAoB,CAACE,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N,GAAG,CAACG,OAAO,CAACJ,MAAM,CAAC,CAAC;YACjEQ,gCAAgC,CAACP,GAAG,EAAEC,GAAG,CAAC,CAAC;SAC5C;QAED,4BAA4B;QAC5BA,GAAG,CAACK,SAAS,CAAC,wBAAwB,EAAE,SAAS,CAAC,CAAC;QAEnDJ,IAAI,EAAE,CAAC;KACR,CAAC;CACH;AAED,8BAA8B;AAC9B,4GAA4G;AAC5G,oHAAoH;AACpH,iDAAiD;AACjD,SAASK,gCAAgC,CAACP,GAAkB,EAAEC,GAAmB,EAAE;IACjF,MAAMO,QAAQ,GAAGR,GAAG,CAACS,GAAG,GAAG,IAAIZ,GAAG,CAACG,GAAG,CAACS,GAAG,EAAE,CAAC,OAAO,EAAET,GAAG,CAACG,OAAO,CAACO,IAAI,CAAC,CAAC,CAAC,CAACF,QAAQ,GAAG,EAAE,AAAC;IACxF,IAAIA,QAAQ,CAACG,QAAQ,CAAC,MAAM,CAAC,EAAE;QAC7B,MAAML,SAAS,GAAGL,GAAG,CAACK,SAAS,CAACM,IAAI,CAACX,GAAG,CAAC,AAAC;QAC1CA,GAAG,CAACK,SAAS,GAAG,CAACO,GAAG,EAAKC,GAAAA,IAAI,GAAK;YAChC,IAAID,GAAG,KAAK,6BAA6B,EAAE;gBACzCP,SAAS,CAACO,GAAG,KAAKC,IAAI,CAAC,CAAC;aACzB;YACD,OAAOb,GAAG,CAAC;SACZ,CAAC;KACH;CACF"}
1
+ {"version":3,"sources":["../../../../../src/start/server/middleware/CorsMiddleware.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config';\n\nimport type { ServerRequest, ServerResponse } from './server.types';\n\nconst DEFAULT_ALLOWED_CORS_HOSTNAMES = [\n 'localhost',\n 'chrome-devtools-frontend.appspot.com', // Support remote Chrome DevTools frontend\n 'devtools', // Support local Chrome DevTools `devtools://devtools`\n];\n\nexport function createCorsMiddleware(exp: ExpoConfig) {\n const allowedHostnames = [...DEFAULT_ALLOWED_CORS_HOSTNAMES];\n // Support for expo-router API routes\n if (exp.extra?.router?.headOrigin) {\n allowedHostnames.push(new URL(exp.extra.router.headOrigin).hostname);\n }\n if (exp.extra?.router?.origin) {\n allowedHostnames.push(new URL(exp.extra.router.origin).hostname);\n }\n\n return (req: ServerRequest, res: ServerResponse, next: (err?: Error) => void) => {\n if (typeof req.headers.origin === 'string') {\n const { hostname } = new URL(req.headers.origin);\n if (!allowedHostnames.includes(hostname)) {\n next(\n new Error(\n `Unauthorized request from ${req.headers.origin}. ` +\n 'This may happen because of a conflicting browser extension to intercept HTTP requests. ' +\n 'Please try again without browser extensions or using incognito mode.'\n )\n );\n return;\n }\n\n res.setHeader('Access-Control-Allow-Origin', req.headers.origin);\n maybePreventMetroResetCorsHeader(req, res);\n }\n\n // Block MIME-type sniffing.\n res.setHeader('X-Content-Type-Options', 'nosniff');\n\n next();\n };\n}\n\n// When accessing source maps,\n// metro will overwrite the `Access-Control-Allow-Origin` header with hardcoded `devtools://devtools` value.\n// https://github.com/facebook/metro/blob/a7f8955e6d2424b0d5f73d4bcdaf22560e1d5f27/packages/metro/src/Server.js#L540\n// This is a workaround to prevent this behavior.\nfunction maybePreventMetroResetCorsHeader(req: ServerRequest, res: ServerResponse) {\n const pathname = req.url ? new URL(req.url, `http://${req.headers.host}`).pathname : '';\n if (pathname.endsWith('.map')) {\n const setHeader = res.setHeader.bind(res);\n res.setHeader = (key, ...args) => {\n if (key !== 'Access-Control-Allow-Origin') {\n setHeader(key, ...args);\n }\n return res;\n };\n }\n}\n"],"names":["createCorsMiddleware","DEFAULT_ALLOWED_CORS_HOSTNAMES","exp","allowedHostnames","extra","router","headOrigin","push","URL","hostname","origin","req","res","next","headers","includes","Error","setHeader","maybePreventMetroResetCorsHeader","pathname","url","host","endsWith","bind","key","args"],"mappings":"AAAA;;;;+BAUgBA,sBAAoB;;aAApBA,oBAAoB;;AANpC,MAAMC,8BAA8B,GAAG;IACrC,WAAW;IACX,sCAAsC;IACtC,UAAU;CACX,AAAC;AAEK,SAASD,o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