@expo/cli 55.0.11 → 55.0.13-canary-20260424-7bedc9d

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 (526) hide show
  1. package/README.md +7 -6
  2. package/build/bin/cli +4 -4
  3. package/build/bin/cli.map +1 -1
  4. package/build/metro-require/require.js +4 -4
  5. package/build/src/api/endpoint.js +3 -3
  6. package/build/src/api/endpoint.js.map +1 -1
  7. package/build/src/api/getExpoSchema.js +3 -3
  8. package/build/src/api/getExpoSchema.js.map +1 -1
  9. package/build/src/api/graphql/client.js +5 -5
  10. package/build/src/api/graphql/client.js.map +1 -1
  11. package/build/src/api/rest/cache/FileSystemResponseCache.js.map +1 -1
  12. package/build/src/api/rest/cache/ResponseCache.js +5 -5
  13. package/build/src/api/rest/cache/ResponseCache.js.map +1 -1
  14. package/build/src/api/rest/client.js +8 -8
  15. package/build/src/api/rest/client.js.map +1 -1
  16. package/build/src/api/rest/wrapFetchWithBaseUrl.js.map +1 -1
  17. package/build/src/api/rest/wrapFetchWithOffline.js.map +1 -1
  18. package/build/src/api/rest/wrapFetchWithProgress.js.map +1 -1
  19. package/build/src/api/rest/wrapFetchWithUserAgent.js.map +1 -1
  20. package/build/src/api/updateDevelopmentSession.js +4 -4
  21. package/build/src/api/updateDevelopmentSession.js.map +1 -1
  22. package/build/src/api/user/UserSettings.js +11 -11
  23. package/build/src/api/user/UserSettings.js.map +1 -1
  24. package/build/src/api/user/actions.js +3 -3
  25. package/build/src/api/user/actions.js.map +1 -1
  26. package/build/src/api/user/expoSsoLauncher.js.map +1 -1
  27. package/build/src/api/user/otp.js +4 -4
  28. package/build/src/api/user/otp.js.map +1 -1
  29. package/build/src/api/user/user.js +7 -7
  30. package/build/src/api/user/user.js.map +1 -1
  31. package/build/src/config/configAsync.js +3 -3
  32. package/build/src/config/configAsync.js.map +1 -1
  33. package/build/src/config/index.js.map +1 -1
  34. package/build/src/customize/customizeAsync.js.map +1 -1
  35. package/build/src/customize/generate.js +7 -4
  36. package/build/src/customize/generate.js.map +1 -1
  37. package/build/src/customize/index.js.map +1 -1
  38. package/build/src/customize/templates.js +3 -3
  39. package/build/src/customize/templates.js.map +1 -1
  40. package/build/src/events/index.js +23 -24
  41. package/build/src/events/index.js.map +1 -1
  42. package/build/src/events/stream.js +94 -24
  43. package/build/src/events/stream.js.map +1 -1
  44. package/build/src/expoUpdatesExports.js +50 -7
  45. package/build/src/expoUpdatesExports.js.map +1 -1
  46. package/build/src/export/createMetadataJson.js +9 -3
  47. package/build/src/export/createMetadataJson.js.map +1 -1
  48. package/build/src/export/embed/exportEmbedAsync.js +29 -16
  49. package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
  50. package/build/src/export/embed/exportServer.js.map +1 -1
  51. package/build/src/export/embed/index.js +6 -1
  52. package/build/src/export/embed/index.js.map +1 -1
  53. package/build/src/export/embed/resolveOptions.js +7 -6
  54. package/build/src/export/embed/resolveOptions.js.map +1 -1
  55. package/build/src/export/embed/xcodeCompilerLogger.js +7 -7
  56. package/build/src/export/embed/xcodeCompilerLogger.js.map +1 -1
  57. package/build/src/export/exportApp.js +14 -6
  58. package/build/src/export/exportApp.js.map +1 -1
  59. package/build/src/export/exportAssets.js +5 -5
  60. package/build/src/export/exportAssets.js.map +1 -1
  61. package/build/src/export/exportAsync.js.map +1 -1
  62. package/build/src/export/exportDomComponents.js +16 -9
  63. package/build/src/export/exportDomComponents.js.map +1 -1
  64. package/build/src/export/exportHermes.js +14 -12
  65. package/build/src/export/exportHermes.js.map +1 -1
  66. package/build/src/export/exportStaticAsync.js +52 -13
  67. package/build/src/export/exportStaticAsync.js.map +1 -1
  68. package/build/src/export/favicon.js +4 -4
  69. package/build/src/export/favicon.js.map +1 -1
  70. package/build/src/export/getPublicExpoManifest.js.map +1 -1
  71. package/build/src/export/getResolvedLocales.js.map +1 -1
  72. package/build/src/export/html.js +3 -3
  73. package/build/src/export/html.js.map +1 -1
  74. package/build/src/export/index.js +2 -0
  75. package/build/src/export/index.js.map +1 -1
  76. package/build/src/export/metroAssetLocalPath.js +4 -4
  77. package/build/src/export/metroAssetLocalPath.js.map +1 -1
  78. package/build/src/export/persistMetroAssets.js +6 -6
  79. package/build/src/export/persistMetroAssets.js.map +1 -1
  80. package/build/src/export/publicFolder.js +3 -3
  81. package/build/src/export/publicFolder.js.map +1 -1
  82. package/build/src/export/resolveOptions.js +3 -3
  83. package/build/src/export/resolveOptions.js.map +1 -1
  84. package/build/src/export/saveAssets.js +3 -3
  85. package/build/src/export/saveAssets.js.map +1 -1
  86. package/build/src/export/web/exportWebAsync.js.map +1 -1
  87. package/build/src/export/web/index.js.map +1 -1
  88. package/build/src/export/writeContents.js.map +1 -1
  89. package/build/src/install/checkPackages.js +1 -28
  90. package/build/src/install/checkPackages.js.map +1 -1
  91. package/build/src/install/fixPackages.js.map +1 -1
  92. package/build/src/install/index.js.map +1 -1
  93. package/build/src/install/installAsync.js +3 -3
  94. package/build/src/install/installAsync.js.map +1 -1
  95. package/build/src/install/installExpoPackage.js.map +1 -1
  96. package/build/src/install/resolveOptions.js.map +1 -1
  97. package/build/src/install/utils/autoAddConfigPlugins.js +3 -3
  98. package/build/src/install/utils/autoAddConfigPlugins.js.map +1 -1
  99. package/build/src/lint/ESlintPrerequisite.js.map +1 -1
  100. package/build/src/log.js +11 -11
  101. package/build/src/log.js.map +1 -1
  102. package/build/src/login/index.js.map +1 -1
  103. package/build/src/logout/index.js.map +1 -1
  104. package/build/src/prebuild/clearNativeFolder.js +44 -6
  105. package/build/src/prebuild/clearNativeFolder.js.map +1 -1
  106. package/build/src/prebuild/configureProjectAsync.js.map +1 -1
  107. package/build/src/prebuild/copyTemplateFiles.js +3 -3
  108. package/build/src/prebuild/copyTemplateFiles.js.map +1 -1
  109. package/build/src/prebuild/ensureConfigAsync.js.map +1 -1
  110. package/build/src/prebuild/index.js.map +1 -1
  111. package/build/src/prebuild/prebuildAsync.js +18 -0
  112. package/build/src/prebuild/prebuildAsync.js.map +1 -1
  113. package/build/src/prebuild/renameTemplateAppName.js +8 -5
  114. package/build/src/prebuild/renameTemplateAppName.js.map +1 -1
  115. package/build/src/prebuild/resolveOptions.js +7 -7
  116. package/build/src/prebuild/resolveOptions.js.map +1 -1
  117. package/build/src/prebuild/resolveTemplate.js.map +1 -1
  118. package/build/src/prebuild/updateFromTemplate.js +3 -3
  119. package/build/src/prebuild/updateFromTemplate.js.map +1 -1
  120. package/build/src/prebuild/updatePackageJson.js +7 -7
  121. package/build/src/prebuild/updatePackageJson.js.map +1 -1
  122. package/build/src/prebuild/validateTemplatePlatforms.js.map +1 -1
  123. package/build/src/register/index.js.map +1 -1
  124. package/build/src/run/android/index.js.map +1 -1
  125. package/build/src/run/android/resolveGradlePropsAsync.js.map +1 -1
  126. package/build/src/run/android/resolveInstallApkName.js.map +1 -1
  127. package/build/src/run/android/resolveLaunchProps.js +7 -5
  128. package/build/src/run/android/resolveLaunchProps.js.map +1 -1
  129. package/build/src/run/android/resolveOptions.js.map +1 -1
  130. package/build/src/run/android/runAndroidAsync.js.map +1 -1
  131. package/build/src/run/ensureNativeProject.js.map +1 -1
  132. package/build/src/run/hints.js +4 -4
  133. package/build/src/run/hints.js.map +1 -1
  134. package/build/src/run/index.js.map +1 -1
  135. package/build/src/run/ios/XcodeBuild.js +140 -23
  136. package/build/src/run/ios/XcodeBuild.js.map +1 -1
  137. package/build/src/run/ios/appleDevice/AppleDevice.js +6 -5
  138. package/build/src/run/ios/appleDevice/AppleDevice.js.map +1 -1
  139. package/build/src/run/ios/appleDevice/ClientManager.js.map +1 -1
  140. package/build/src/run/ios/appleDevice/client/AFCClient.js +10 -16
  141. package/build/src/run/ios/appleDevice/client/AFCClient.js.map +1 -1
  142. package/build/src/run/ios/appleDevice/client/DebugserverClient.js +1 -1
  143. package/build/src/run/ios/appleDevice/client/DebugserverClient.js.map +1 -1
  144. package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js +2 -1
  145. package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js.map +1 -1
  146. package/build/src/run/ios/appleDevice/client/LockdowndClient.js.map +1 -1
  147. package/build/src/run/ios/appleDevice/client/MobileImageMounterClient.js.map +1 -1
  148. package/build/src/run/ios/appleDevice/client/ServiceClient.js +3 -3
  149. package/build/src/run/ios/appleDevice/client/ServiceClient.js.map +1 -1
  150. package/build/src/run/ios/appleDevice/client/UsbmuxdClient.js.map +1 -1
  151. package/build/src/run/ios/appleDevice/installOnDeviceAsync.js +3 -3
  152. package/build/src/run/ios/appleDevice/installOnDeviceAsync.js.map +1 -1
  153. package/build/src/run/ios/appleDevice/protocol/AFCProtocol.js +16 -13
  154. package/build/src/run/ios/appleDevice/protocol/AFCProtocol.js.map +1 -1
  155. package/build/src/run/ios/appleDevice/protocol/AbstractProtocol.js +6 -6
  156. package/build/src/run/ios/appleDevice/protocol/AbstractProtocol.js.map +1 -1
  157. package/build/src/run/ios/appleDevice/protocol/GDBProtocol.js +5 -5
  158. package/build/src/run/ios/appleDevice/protocol/GDBProtocol.js.map +1 -1
  159. package/build/src/run/ios/appleDevice/protocol/LockdownProtocol.js +7 -7
  160. package/build/src/run/ios/appleDevice/protocol/LockdownProtocol.js.map +1 -1
  161. package/build/src/run/ios/appleDevice/protocol/UsbmuxProtocol.js +5 -5
  162. package/build/src/run/ios/appleDevice/protocol/UsbmuxProtocol.js.map +1 -1
  163. package/build/src/run/ios/codeSigning/Security.js +8 -8
  164. package/build/src/run/ios/codeSigning/Security.js.map +1 -1
  165. package/build/src/run/ios/codeSigning/configureCodeSigning.js +5 -3
  166. package/build/src/run/ios/codeSigning/configureCodeSigning.js.map +1 -1
  167. package/build/src/run/ios/codeSigning/resolveCertificateSigningIdentity.js +7 -5
  168. package/build/src/run/ios/codeSigning/resolveCertificateSigningIdentity.js.map +1 -1
  169. package/build/src/run/ios/codeSigning/settings.js +3 -3
  170. package/build/src/run/ios/codeSigning/settings.js.map +1 -1
  171. package/build/src/run/ios/codeSigning/xcodeCodeSigning.js +4 -4
  172. package/build/src/run/ios/codeSigning/xcodeCodeSigning.js.map +1 -1
  173. package/build/src/run/ios/index.js +8 -1
  174. package/build/src/run/ios/index.js.map +1 -1
  175. package/build/src/run/ios/launchApp.js +4 -4
  176. package/build/src/run/ios/launchApp.js.map +1 -1
  177. package/build/src/run/ios/options/appleDestinations.js.map +1 -1
  178. package/build/src/run/ios/options/promptDevice.js +3 -3
  179. package/build/src/run/ios/options/promptDevice.js.map +1 -1
  180. package/build/src/run/ios/options/resolveDevice.js +8 -3
  181. package/build/src/run/ios/options/resolveDevice.js.map +1 -1
  182. package/build/src/run/ios/options/resolveNativeScheme.js +4 -4
  183. package/build/src/run/ios/options/resolveNativeScheme.js.map +1 -1
  184. package/build/src/run/ios/options/resolveOptions.js +9 -4
  185. package/build/src/run/ios/options/resolveOptions.js.map +1 -1
  186. package/build/src/run/ios/options/resolveXcodeProject.js.map +1 -1
  187. package/build/src/run/ios/runIosAsync.js +39 -0
  188. package/build/src/run/ios/runIosAsync.js.map +1 -1
  189. package/build/src/run/ios/validateExternalBinary.js.map +1 -1
  190. package/build/src/run/startBundler.js +4 -0
  191. package/build/src/run/startBundler.js.map +1 -1
  192. package/build/src/serve/index.js +4 -1
  193. package/build/src/serve/index.js.map +1 -1
  194. package/build/src/start/detectDevClient.js +3 -3
  195. package/build/src/start/detectDevClient.js.map +1 -1
  196. package/build/src/start/doctor/Prerequisite.js +4 -4
  197. package/build/src/start/doctor/Prerequisite.js.map +1 -1
  198. package/build/src/start/doctor/apple/SimulatorAppPrerequisite.js +39 -2
  199. package/build/src/start/doctor/apple/SimulatorAppPrerequisite.js.map +1 -1
  200. package/build/src/start/doctor/apple/XcodePrerequisite.js +3 -3
  201. package/build/src/start/doctor/apple/XcodePrerequisite.js.map +1 -1
  202. package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js +3 -3
  203. package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js.map +1 -1
  204. package/build/src/start/doctor/dependencies/getMissingPackages.js +5 -5
  205. package/build/src/start/doctor/dependencies/getMissingPackages.js.map +1 -1
  206. package/build/src/start/doctor/dependencies/getVersionedPackages.js +5 -5
  207. package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
  208. package/build/src/start/doctor/dependencies/resolvePackages.js +4 -4
  209. package/build/src/start/doctor/dependencies/resolvePackages.js.map +1 -1
  210. package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +5 -5
  211. package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -1
  212. package/build/src/start/doctor/ngrok/ExternalModule.js +14 -9
  213. package/build/src/start/doctor/ngrok/ExternalModule.js.map +1 -1
  214. package/build/src/start/doctor/ngrok/NgrokResolver.js +3 -3
  215. package/build/src/start/doctor/ngrok/NgrokResolver.js.map +1 -1
  216. package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js.map +1 -1
  217. package/build/src/start/doctor/typescript/updateTSConfig.js +3 -3
  218. package/build/src/start/doctor/typescript/updateTSConfig.js.map +1 -1
  219. package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js +18 -14
  220. package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js.map +1 -1
  221. package/build/src/start/index.js +2 -0
  222. package/build/src/start/index.js.map +1 -1
  223. package/build/src/start/interface/KeyPressHandler.js.map +1 -1
  224. package/build/src/start/interface/cliExtensionMenuItemHandler.js.map +1 -1
  225. package/build/src/start/interface/commandsTable.js +6 -6
  226. package/build/src/start/interface/commandsTable.js.map +1 -1
  227. package/build/src/start/interface/createDevToolsMenuItems.js.map +1 -1
  228. package/build/src/start/interface/interactiveActions.js.map +1 -1
  229. package/build/src/start/interface/startInterface.js.map +1 -1
  230. package/build/src/start/platforms/AppIdResolver.js.map +1 -1
  231. package/build/src/start/platforms/DeviceManager.js.map +1 -1
  232. package/build/src/start/platforms/ExpoGoInstaller.js +13 -4
  233. package/build/src/start/platforms/ExpoGoInstaller.js.map +1 -1
  234. package/build/src/start/platforms/PlatformManager.js.map +1 -1
  235. package/build/src/start/platforms/android/AndroidAppIdResolver.js.map +1 -1
  236. package/build/src/start/platforms/android/AndroidDeviceManager.js.map +1 -1
  237. package/build/src/start/platforms/android/AndroidPlatformManager.js.map +1 -1
  238. package/build/src/start/platforms/android/activateWindow.js.map +1 -1
  239. package/build/src/start/platforms/android/adb.js +20 -19
  240. package/build/src/start/platforms/android/adb.js.map +1 -1
  241. package/build/src/start/platforms/android/adbReverse.js +4 -4
  242. package/build/src/start/platforms/android/adbReverse.js.map +1 -1
  243. package/build/src/start/platforms/android/emulator.js +5 -5
  244. package/build/src/start/platforms/android/emulator.js.map +1 -1
  245. package/build/src/start/platforms/android/getDevices.js.map +1 -1
  246. package/build/src/start/platforms/android/gradle.js +5 -5
  247. package/build/src/start/platforms/android/gradle.js.map +1 -1
  248. package/build/src/start/platforms/android/promptAndroidDevice.js +3 -3
  249. package/build/src/start/platforms/android/promptAndroidDevice.js.map +1 -1
  250. package/build/src/start/platforms/ios/AppleAppIdResolver.js.map +1 -1
  251. package/build/src/start/platforms/ios/AppleDeviceManager.js +13 -5
  252. package/build/src/start/platforms/ios/AppleDeviceManager.js.map +1 -1
  253. package/build/src/start/platforms/ios/ApplePlatformManager.js +11 -0
  254. package/build/src/start/platforms/ios/ApplePlatformManager.js.map +1 -1
  255. package/build/src/start/platforms/ios/devicectl.js +8 -7
  256. package/build/src/start/platforms/ios/devicectl.js.map +1 -1
  257. package/build/src/start/platforms/ios/ensureSimulatorAppRunning.js.map +1 -1
  258. package/build/src/start/platforms/ios/getBestSimulator.js +5 -5
  259. package/build/src/start/platforms/ios/getBestSimulator.js.map +1 -1
  260. package/build/src/start/platforms/ios/promptAppleDevice.js +5 -4
  261. package/build/src/start/platforms/ios/promptAppleDevice.js.map +1 -1
  262. package/build/src/start/platforms/ios/simctl.js +21 -19
  263. package/build/src/start/platforms/ios/simctl.js.map +1 -1
  264. package/build/src/start/platforms/ios/simctlLogging.js +3 -3
  265. package/build/src/start/platforms/ios/simctlLogging.js.map +1 -1
  266. package/build/src/start/platforms/ios/xcrun.js +3 -3
  267. package/build/src/start/platforms/ios/xcrun.js.map +1 -1
  268. package/build/src/start/project/devices.js +6 -6
  269. package/build/src/start/project/devices.js.map +1 -1
  270. package/build/src/start/project/dotExpo.js +4 -3
  271. package/build/src/start/project/dotExpo.js.map +1 -1
  272. package/build/src/start/resolveOptions.js +5 -5
  273. package/build/src/start/resolveOptions.js.map +1 -1
  274. package/build/src/start/server/AsyncNgrok.js +1 -1
  275. package/build/src/start/server/AsyncNgrok.js.map +1 -1
  276. package/build/src/start/server/AsyncWsTunnel.js.map +1 -1
  277. package/build/src/start/server/Bonjour.js +8 -3
  278. package/build/src/start/server/Bonjour.js.map +1 -1
  279. package/build/src/start/server/BundlerDevServer.js +29 -11
  280. package/build/src/start/server/BundlerDevServer.js.map +1 -1
  281. package/build/src/start/server/DevServerManager.js.map +1 -1
  282. package/build/src/start/server/DevToolsPlugin.js.map +1 -1
  283. package/build/src/start/server/DevToolsPlugin.schema.js +3 -3
  284. package/build/src/start/server/DevToolsPlugin.schema.js.map +1 -1
  285. package/build/src/start/server/DevToolsPluginCliExtensionExecutor.js +1 -1
  286. package/build/src/start/server/DevToolsPluginCliExtensionExecutor.js.map +1 -1
  287. package/build/src/start/server/DevToolsPluginCliExtensionResults.js.map +1 -1
  288. package/build/src/start/server/DevToolsPluginManager.js +3 -3
  289. package/build/src/start/server/DevToolsPluginManager.js.map +1 -1
  290. package/build/src/start/server/DevelopmentSession.js +1 -1
  291. package/build/src/start/server/DevelopmentSession.js.map +1 -1
  292. package/build/src/start/server/MCPDevToolsPluginCLIExtensions.js.map +1 -1
  293. package/build/src/start/server/UrlCreator.js.map +1 -1
  294. package/build/src/start/server/createMCPDevToolsExtensionSchema.js +5 -3
  295. package/build/src/start/server/createMCPDevToolsExtensionSchema.js.map +1 -1
  296. package/build/src/start/server/getStaticRenderFunctions.js +5 -5
  297. package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
  298. package/build/src/start/server/metro/MetroBundlerDevServer.js +24 -17
  299. package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
  300. package/build/src/start/server/metro/MetroTerminalReporter.js +7 -7
  301. package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
  302. package/build/src/start/server/metro/TerminalReporter.js +4 -4
  303. package/build/src/start/server/metro/TerminalReporter.js.map +1 -1
  304. package/build/src/start/server/metro/createExpoAutolinkingResolver.js +11 -5
  305. package/build/src/start/server/metro/createExpoAutolinkingResolver.js.map +1 -1
  306. package/build/src/start/server/metro/createExpoFallbackResolver.js +39 -0
  307. package/build/src/start/server/metro/createExpoFallbackResolver.js.map +1 -1
  308. package/build/src/start/server/metro/createServerComponentsMiddleware.js +9 -9
  309. package/build/src/start/server/metro/createServerComponentsMiddleware.js.map +1 -1
  310. package/build/src/start/server/metro/debugging/MessageHandler.js.map +1 -1
  311. package/build/src/start/server/metro/debugging/attachAtlas.js +3 -3
  312. package/build/src/start/server/metro/debugging/attachAtlas.js.map +1 -1
  313. package/build/src/start/server/metro/debugging/createDebugMiddleware.js.map +1 -1
  314. package/build/src/start/server/metro/debugging/createHandlersFactory.js.map +1 -1
  315. package/build/src/start/server/metro/debugging/messageHandlers/NetworkResponse.js +3 -3
  316. package/build/src/start/server/metro/debugging/messageHandlers/NetworkResponse.js.map +1 -1
  317. package/build/src/start/server/metro/debugging/pageIsSupported.js.map +1 -1
  318. package/build/src/start/server/metro/dev-server/compression.js.map +1 -1
  319. package/build/src/start/server/metro/dev-server/createMetroMiddleware.js +78 -19
  320. package/build/src/start/server/metro/dev-server/createMetroMiddleware.js.map +1 -1
  321. package/build/src/start/server/metro/dev-server/utils/socketMessages.js +3 -3
  322. package/build/src/start/server/metro/dev-server/utils/socketMessages.js.map +1 -1
  323. package/build/src/start/server/metro/errors/FailedToResolveNativeOnlyModuleError.js.map +1 -1
  324. package/build/src/start/server/metro/externals.js +4 -4
  325. package/build/src/start/server/metro/externals.js.map +1 -1
  326. package/build/src/start/server/metro/fetchRouterManifest.js +3 -3
  327. package/build/src/start/server/metro/fetchRouterManifest.js.map +1 -1
  328. package/build/src/start/server/metro/getCssModulesFromBundler.js +3 -3
  329. package/build/src/start/server/metro/getCssModulesFromBundler.js.map +1 -1
  330. package/build/src/start/server/metro/instantiateMetro.js +23 -10
  331. package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
  332. package/build/src/start/server/metro/log-box/LogBoxLog.js.map +1 -1
  333. package/build/src/start/server/metro/log-box/LogBoxSymbolication.js +4 -4
  334. package/build/src/start/server/metro/log-box/LogBoxSymbolication.js.map +1 -1
  335. package/build/src/start/server/metro/log-box/formatProjectFilePath.js +3 -3
  336. package/build/src/start/server/metro/log-box/formatProjectFilePath.js.map +1 -1
  337. package/build/src/start/server/metro/metroErrorInterface.js +11 -11
  338. package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
  339. package/build/src/start/server/metro/metroErrors.js +3 -3
  340. package/build/src/start/server/metro/metroErrors.js.map +1 -1
  341. package/build/src/start/server/metro/resolveLoader.js +3 -3
  342. package/build/src/start/server/metro/resolveLoader.js.map +1 -1
  343. package/build/src/start/server/metro/router.js +13 -13
  344. package/build/src/start/server/metro/router.js.map +1 -1
  345. package/build/src/start/server/metro/runServer-fork.js +3 -2
  346. package/build/src/start/server/metro/runServer-fork.js.map +1 -1
  347. package/build/src/start/server/metro/serializeHtml.js +33 -11
  348. package/build/src/start/server/metro/serializeHtml.js.map +1 -1
  349. package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js +4 -4
  350. package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js.map +1 -1
  351. package/build/src/start/server/metro/withMetroErrorReportingResolver.js +5 -4
  352. package/build/src/start/server/metro/withMetroErrorReportingResolver.js.map +1 -1
  353. package/build/src/start/server/metro/withMetroMultiPlatform.js +41 -13
  354. package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
  355. package/build/src/start/server/metro/withMetroResolvers.js +4 -4
  356. package/build/src/start/server/metro/withMetroResolvers.js.map +1 -1
  357. package/build/src/start/server/middleware/ContextModuleSourceMapsMiddleware.js.map +1 -1
  358. package/build/src/start/server/middleware/CorsMiddleware.js +3 -3
  359. package/build/src/start/server/middleware/CorsMiddleware.js.map +1 -1
  360. package/build/src/start/server/middleware/CreateFileMiddleware.js.map +1 -1
  361. package/build/src/start/server/middleware/DevToolsPluginMiddleware.js +3 -3
  362. package/build/src/start/server/middleware/DevToolsPluginMiddleware.js.map +1 -1
  363. package/build/src/start/server/middleware/DomComponentsMiddleware.js +18 -12
  364. package/build/src/start/server/middleware/DomComponentsMiddleware.js.map +1 -1
  365. package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js +3 -3
  366. package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js.map +1 -1
  367. package/build/src/start/server/middleware/ExpoMiddleware.js +3 -3
  368. package/build/src/start/server/middleware/ExpoMiddleware.js.map +1 -1
  369. package/build/src/start/server/middleware/FaviconMiddleware.js.map +1 -1
  370. package/build/src/start/server/middleware/HistoryFallbackMiddleware.js.map +1 -1
  371. package/build/src/start/server/middleware/InterstitialPageMiddleware.js +3 -3
  372. package/build/src/start/server/middleware/InterstitialPageMiddleware.js.map +1 -1
  373. package/build/src/start/server/middleware/ManifestMiddleware.js +7 -44
  374. package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
  375. package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js.map +1 -1
  376. package/build/src/start/server/middleware/ServeStaticMiddleware.js.map +1 -1
  377. package/build/src/start/server/middleware/inspector/JsInspector.js +5 -5
  378. package/build/src/start/server/middleware/inspector/JsInspector.js.map +1 -1
  379. package/build/src/start/server/middleware/inspector/middlwareMutations.js +3 -3
  380. package/build/src/start/server/middleware/inspector/middlwareMutations.js.map +1 -1
  381. package/build/src/start/server/middleware/metroOptions.js +19 -16
  382. package/build/src/start/server/middleware/metroOptions.js.map +1 -1
  383. package/build/src/start/server/middleware/mutations.js +3 -3
  384. package/build/src/start/server/middleware/mutations.js.map +1 -1
  385. package/build/src/start/server/middleware/resolveAssets.js +4 -4
  386. package/build/src/start/server/middleware/resolveAssets.js.map +1 -1
  387. package/build/src/start/server/middleware/resolvePlatform.js +5 -5
  388. package/build/src/start/server/middleware/resolvePlatform.js.map +1 -1
  389. package/build/src/start/server/middleware/resolveRuntimeVersionWithExpoUpdatesAsync.js.map +1 -1
  390. package/build/src/start/server/openPlatforms.js.map +1 -1
  391. package/build/src/start/server/serverLogLikeMetro.js +6 -6
  392. package/build/src/start/server/serverLogLikeMetro.js.map +1 -1
  393. package/build/src/start/server/type-generation/expo-env.js +3 -3
  394. package/build/src/start/server/type-generation/expo-env.js.map +1 -1
  395. package/build/src/start/server/type-generation/routes.js +12 -52
  396. package/build/src/start/server/type-generation/routes.js.map +1 -1
  397. package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js.map +1 -1
  398. package/build/src/start/server/type-generation/tsconfig.js +5 -5
  399. package/build/src/start/server/type-generation/tsconfig.js.map +1 -1
  400. package/build/src/start/server/webTemplate.js +3 -3
  401. package/build/src/start/server/webTemplate.js.map +1 -1
  402. package/build/src/start/server/webpack/WebpackBundlerDevServer.js +3 -3
  403. package/build/src/start/server/webpack/WebpackBundlerDevServer.js.map +1 -1
  404. package/build/src/start/server/webpack/formatWebpackMessages.js.map +1 -1
  405. package/build/src/start/server/webpack/resolveFromProject.js +4 -4
  406. package/build/src/start/server/webpack/resolveFromProject.js.map +1 -1
  407. package/build/src/start/server/webpack/tls.js +3 -3
  408. package/build/src/start/server/webpack/tls.js.map +1 -1
  409. package/build/src/start/startAsync.js +10 -1
  410. package/build/src/start/startAsync.js.map +1 -1
  411. package/build/src/types.d.ts +2 -0
  412. package/build/src/utils/FileNotifier.js +1 -1
  413. package/build/src/utils/FileNotifier.js.map +1 -1
  414. package/build/src/utils/args.js +5 -5
  415. package/build/src/utils/args.js.map +1 -1
  416. package/build/src/utils/array.js +8 -8
  417. package/build/src/utils/array.js.map +1 -1
  418. package/build/src/utils/build-cache-providers/helpers.js +4 -4
  419. package/build/src/utils/build-cache-providers/helpers.js.map +1 -1
  420. package/build/src/utils/build-cache-providers/index.js +5 -5
  421. package/build/src/utils/build-cache-providers/index.js.map +1 -1
  422. package/build/src/utils/cocoapods.js +4 -4
  423. package/build/src/utils/cocoapods.js.map +1 -1
  424. package/build/src/utils/codesigning.js +6 -6
  425. package/build/src/utils/codesigning.js.map +1 -1
  426. package/build/src/utils/createTempPath.js +3 -3
  427. package/build/src/utils/createTempPath.js.map +1 -1
  428. package/build/src/utils/delay.js +4 -4
  429. package/build/src/utils/delay.js.map +1 -1
  430. package/build/src/utils/dir.js +11 -11
  431. package/build/src/utils/dir.js.map +1 -1
  432. package/build/src/utils/downloadAppAsync.js.map +1 -1
  433. package/build/src/utils/downloadExpoGoAsync.js +4 -4
  434. package/build/src/utils/downloadExpoGoAsync.js.map +1 -1
  435. package/build/src/utils/editor.js +4 -4
  436. package/build/src/utils/editor.js.map +1 -1
  437. package/build/src/utils/env.js +4 -7
  438. package/build/src/utils/env.js.map +1 -1
  439. package/build/src/utils/errors.js +6 -6
  440. package/build/src/utils/errors.js.map +1 -1
  441. package/build/src/utils/exit.js +3 -3
  442. package/build/src/utils/exit.js.map +1 -1
  443. package/build/src/utils/expoUpdatesCli.js +5 -5
  444. package/build/src/utils/expoUpdatesCli.js.map +1 -1
  445. package/build/src/utils/fetch.js +4 -4
  446. package/build/src/utils/fetch.js.map +1 -1
  447. package/build/src/utils/filePath.js +3 -29
  448. package/build/src/utils/filePath.js.map +1 -1
  449. package/build/src/utils/findUp.js +3 -3
  450. package/build/src/utils/findUp.js.map +1 -1
  451. package/build/src/utils/fn.js +3 -3
  452. package/build/src/utils/fn.js.map +1 -1
  453. package/build/src/utils/freeport.js +3 -3
  454. package/build/src/utils/freeport.js.map +1 -1
  455. package/build/src/utils/getOrPromptApplicationId.js +3 -3
  456. package/build/src/utils/getOrPromptApplicationId.js.map +1 -1
  457. package/build/src/utils/getRunningProcess.js +5 -5
  458. package/build/src/utils/getRunningProcess.js.map +1 -1
  459. package/build/src/utils/git.js +3 -3
  460. package/build/src/utils/git.js.map +1 -1
  461. package/build/src/utils/glob.js +3 -3
  462. package/build/src/utils/glob.js.map +1 -1
  463. package/build/src/utils/ip.js +4 -4
  464. package/build/src/utils/ip.js.map +1 -1
  465. package/build/src/utils/link.js +3 -3
  466. package/build/src/utils/link.js.map +1 -1
  467. package/build/src/utils/mergeGitIgnorePaths.js +10 -10
  468. package/build/src/utils/mergeGitIgnorePaths.js.map +1 -1
  469. package/build/src/utils/modifyConfigAsync.js +3 -3
  470. package/build/src/utils/modifyConfigAsync.js.map +1 -1
  471. package/build/src/utils/net.js +3 -3
  472. package/build/src/utils/net.js.map +1 -1
  473. package/build/src/utils/nodeEnv.js +6 -6
  474. package/build/src/utils/nodeEnv.js.map +1 -1
  475. package/build/src/utils/npm.js +10 -9
  476. package/build/src/utils/npm.js.map +1 -1
  477. package/build/src/utils/obj.js +4 -4
  478. package/build/src/utils/obj.js.map +1 -1
  479. package/build/src/utils/ora.js +4 -4
  480. package/build/src/utils/ora.js.map +1 -1
  481. package/build/src/utils/plist.js +5 -4
  482. package/build/src/utils/plist.js.map +1 -1
  483. package/build/src/utils/port.js +5 -5
  484. package/build/src/utils/port.js.map +1 -1
  485. package/build/src/utils/progress.js +4 -4
  486. package/build/src/utils/progress.js.map +1 -1
  487. package/build/src/utils/prompts.js +11 -11
  488. package/build/src/utils/prompts.js.map +1 -1
  489. package/build/src/utils/qr.js.map +1 -1
  490. package/build/src/utils/resolveArgs.js +10 -9
  491. package/build/src/utils/resolveArgs.js.map +1 -1
  492. package/build/src/utils/resolveWatchFolders.js +67 -0
  493. package/build/src/utils/resolveWatchFolders.js.map +1 -0
  494. package/build/src/utils/scheme.js +4 -4
  495. package/build/src/utils/scheme.js.map +1 -1
  496. package/build/src/utils/strings.js.map +1 -1
  497. package/build/src/utils/tar.js +6 -5
  498. package/build/src/utils/tar.js.map +1 -1
  499. package/build/src/utils/telemetry/Telemetry.js.map +1 -1
  500. package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
  501. package/build/src/utils/telemetry/clients/FetchClient.js.map +1 -1
  502. package/build/src/utils/telemetry/clients/flushFetchDetached.js +5 -1
  503. package/build/src/utils/telemetry/clients/flushFetchDetached.js.map +1 -1
  504. package/build/src/utils/telemetry/index.js +4 -4
  505. package/build/src/utils/telemetry/index.js.map +1 -1
  506. package/build/src/utils/telemetry/utils/constants.js +3 -3
  507. package/build/src/utils/telemetry/utils/constants.js.map +1 -1
  508. package/build/src/utils/telemetry/utils/context.js +3 -2
  509. package/build/src/utils/telemetry/utils/context.js.map +1 -1
  510. package/build/src/utils/tsconfig/evaluateTsConfig.js +3 -3
  511. package/build/src/utils/tsconfig/evaluateTsConfig.js.map +1 -1
  512. package/build/src/utils/tsconfig/loadTsConfigPaths.js +3 -3
  513. package/build/src/utils/tsconfig/loadTsConfigPaths.js.map +1 -1
  514. package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js +2 -1
  515. package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js.map +1 -1
  516. package/build/src/utils/url.js +6 -6
  517. package/build/src/utils/url.js.map +1 -1
  518. package/build/src/utils/validateApplicationId.js +12 -12
  519. package/build/src/utils/validateApplicationId.js.map +1 -1
  520. package/build/src/utils/variadic.js +4 -4
  521. package/build/src/utils/variadic.js.map +1 -1
  522. package/build/src/whoami/index.js.map +1 -1
  523. package/main.js +3 -0
  524. package/package.json +51 -37
  525. package/build/src/utils/resolveGlobal.js +0 -195
  526. package/build/src/utils/resolveGlobal.js.map +0 -1
package/README.md CHANGED
@@ -68,7 +68,7 @@ This CLI has the following purposes:
68
68
  To develop the CLI run (defaults to watch mode):
69
69
 
70
70
  ```
71
- yarn build
71
+ pnpm build
72
72
  ```
73
73
 
74
74
  We highly recommend setting up an alias for the Expo CLI so you can try it in projects all around your computer. Open your **.zshrc** or other config file and add:
@@ -110,16 +110,17 @@ Then you can run it and visit `chrome://inspect/#devices` in Chrome, and press *
110
110
 
111
111
  ## Testing
112
112
 
113
- There are two testing scripts:
113
+ There are three testing scripts:
114
114
 
115
- - `yarn test`: Controlled unit and integration tests.
116
- - `yarn test:e2e`: End to end testing for CLI commands. This requires the files to be built with `yarn build`.
115
+ - `pnpm test`: Controlled unit and integration tests
116
+ - `pnpm test:e2e`: End to end testing for CLI commands
117
+ - `pnpm test:playwright`: End to end testing for Expo SDK in general with the CLI
117
118
 
118
119
  ---
119
120
 
120
- - You can target a specific set of tests with the `--watch` flag. Example: `yarn test --watch config`.
121
+ - You can target a specific set of tests with the `--watch` flag. Example: `pnpm test --watch config`.
121
122
  - We use backticks for `it` blocks. Example <code>it(`works`)</code>.
122
- - If a pull request is fully self-contained to the `packages/@expo/cli/` folder (i.e. no `yarn.lock` modifications, etc.) then most native CI tests will be skipped, making CI pass faster in PRs.
123
+ - If a pull request is fully self-contained to the `packages/@expo/cli/` folder (i.e. no `pnpm-lock.yaml` modifications, etc.) then most native CI tests will be skipped, making CI pass faster in PRs.
123
124
 
124
125
  ### Unit Testing Guidelines
125
126
 
package/build/bin/cli CHANGED
@@ -139,14 +139,14 @@ const args = (0, _arg().default)({
139
139
  });
140
140
  if (args['--version']) {
141
141
  // Version is added in the build script.
142
- console.log("55.0.11");
142
+ console.log("55.0.13-canary-20260424-7bedc9d");
143
143
  process.exit(0);
144
144
  }
145
145
  if (args['--non-interactive']) {
146
146
  console.warn(_chalk().default.yellow` {bold --non-interactive} is not supported, use {bold $CI=1} instead`);
147
147
  }
148
148
  // Check if we are running `npx expo <subcommand>` or `npx expo`
149
- const isSubcommand = Boolean(commands[args._[0]]);
149
+ const isSubcommand = !!(args._[0] && commands[args._[0]]);
150
150
  // Handle `--help` flag
151
151
  if (!isSubcommand && args['--help']) {
152
152
  const { login, logout, whoami, register, start, install, add, export: _export, config, customize, prebuild, 'run:ios': runIos, 'run:android': runAndroid, // NOTE(EvanBacon): Don't document this command as it's a temporary
@@ -236,7 +236,7 @@ if (!isSubcommand) {
236
236
  };
237
237
  // TODO: Log telemetry about invalid command used.
238
238
  const subcommand = args._[0];
239
- if (subcommand in migrationMap) {
239
+ if (subcommand && subcommand in migrationMap) {
240
240
  const replacement = migrationMap[subcommand];
241
241
  console.log();
242
242
  const instruction = subcommand === 'upgrade' ? 'follow this guide' : 'use';
@@ -248,7 +248,7 @@ if (!isSubcommand) {
248
248
  'send',
249
249
  'client:ios'
250
250
  ];
251
- if (deprecated.includes(subcommand)) {
251
+ if (subcommand && deprecated.includes(subcommand)) {
252
252
  console.log();
253
253
  console.log(_chalk().default.yellow` {gray $} {bold expo ${subcommand}} is deprecated`);
254
254
  console.log();
package/build/bin/cli.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../bin/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport arg from 'arg';\nimport chalk from 'chalk';\nimport Debug from 'debug';\nimport { boolish } from 'getenv';\n\nimport { installEventLogger } from '../src/events';\n\n// Setup event logger output\n// NOTE: Done before any console output\ninstallEventLogger();\n\n// Check Node.js version and issue a loud warning if it's too outdated\n// This is sent to stderr (console.error) so it doesn't interfere with programmatic commands\nconst NODE_MIN = [20, 19, 4];\nconst nodeVersion = process.version?.slice(1).split('.', 3).map(Number);\nif (nodeVersion[0] < NODE_MIN[0] || (nodeVersion[0] === NODE_MIN[0] && nodeVersion[1] < NODE_MIN[1])) {\n console.error(\n chalk.red`{bold Node.js (${process.version}) is outdated and unsupported.}`\n + chalk.red` Please update to a newer Node.js LTS version (required: >=${NODE_MIN.join('.')})\\n`\n + chalk.red`Go to: https://nodejs.org/en/download\\n`\n );\n}\n\n// Setup before requiring `debug`.\nif (boolish('EXPO_DEBUG', false)) {\n Debug.enable('expo:*');\n} else if (Debug.enabled('expo:')) {\n process.env.EXPO_DEBUG = '1';\n}\n\nconst defaultCmd = 'start';\n\nexport type Command = (argv?: string[]) => void;\n\nconst commands: { [command: string]: () => Promise<Command> } = {\n // Add a new command here\n // NOTE(EvanBacon): Ensure every bundler-related command sets `NODE_ENV` as expected for the command.\n run: () => import('../src/run/index.js').then((i) => i.expoRun),\n 'run:ios': () => import('../src/run/ios/index.js').then((i) => i.expoRunIos),\n 'run:android': () => import('../src/run/android/index.js').then((i) => i.expoRunAndroid),\n start: () => import('../src/start/index.js').then((i) => i.expoStart),\n prebuild: () => import('../src/prebuild/index.js').then((i) => i.expoPrebuild),\n config: () => import('../src/config/index.js').then((i) => i.expoConfig),\n export: () => import('../src/export/index.js').then((i) => i.expoExport),\n 'export:web': () => import('../src/export/web/index.js').then((i) => i.expoExportWeb),\n 'export:embed': () => import('../src/export/embed/index.js').then((i) => i.expoExportEmbed),\n\n serve: () => import('../src/serve/index.js').then((i) => i.expoServe),\n\n // Auxiliary commands\n install: () => import('../src/install/index.js').then((i) => i.expoInstall),\n add: () => import('../src/install/index.js').then((i) => i.expoInstall),\n customize: () => import('../src/customize/index.js').then((i) => i.expoCustomize),\n lint: () => import('../src/lint/index.js').then((i) => i.expoLint),\n\n // Auth\n login: () => import('../src/login/index.js').then((i) => i.expoLogin),\n logout: () => import('../src/logout/index.js').then((i) => i.expoLogout),\n register: () => import('../src/register/index.js').then((i) => i.expoRegister),\n whoami: () => import('../src/whoami/index.js').then((i) => i.expoWhoami),\n};\n\nconst args = arg(\n {\n // Types\n '--version': Boolean,\n '--help': Boolean,\n // NOTE(EvanBacon): This is here to silence warnings from processes that\n // expect the global expo-cli.\n '--non-interactive': Boolean,\n\n // Aliases\n '-v': '--version',\n '-h': '--help',\n },\n {\n permissive: true,\n }\n);\n\nif (args['--version']) {\n // Version is added in the build script.\n console.log(process.env.__EXPO_VERSION);\n process.exit(0);\n}\n\nif (args['--non-interactive']) {\n console.warn(chalk.yellow` {bold --non-interactive} is not supported, use {bold $CI=1} instead`);\n}\n\n// Check if we are running `npx expo <subcommand>` or `npx expo`\nconst isSubcommand = Boolean(commands[args._[0]]);\n\n// Handle `--help` flag\nif (!isSubcommand && args['--help']) {\n const {\n login,\n logout,\n whoami,\n register,\n start,\n install,\n add,\n export: _export,\n config,\n customize,\n prebuild,\n 'run:ios': runIos,\n 'run:android': runAndroid,\n // NOTE(EvanBacon): Don't document this command as it's a temporary\n // workaround until we can use `expo export` for all production bundling.\n // https://github.com/expo/expo/pull/21396/files#r1121025873\n 'export:embed': exportEmbed_unused,\n // The export:web command is deprecated. Hide it from the help prompt.\n 'export:web': exportWeb_unused,\n // Other ignored commands, these are intentially not listed in the `--help` output\n run: _run,\n // NOTE(cedric): Still pending the migration to ESLint's flat config\n lint: _lint,\n serve,\n // All other commands\n ...others\n } = commands;\n\n console.log(chalk`\n {bold Usage}\n {dim $} npx expo <command>\n\n {bold Commands}\n ${Object.keys({ start, export: _export, ...others }).join(', ')}\n ${Object.keys({ 'run:ios': runIos, 'run:android': runAndroid, prebuild }).join(', ')}\n ${Object.keys({ install, customize, config, serve }).join(', ')}\n {dim ${Object.keys({ login, logout, whoami, register }).join(', ')}}\n\n {bold Options}\n --version, -v Version number\n --help, -h Usage info\n\n For more info run a command with the {bold --help} flag\n {dim $} npx expo start --help\n`);\n\n process.exit(0);\n}\n\n// NOTE(EvanBacon): Squat some directory names to help with migration,\n// users can still use folders named \"send\" or \"eject\" by using the fully qualified `npx expo start ./send`.\nif (!isSubcommand) {\n const migrationMap: Record<string, string> = {\n init: 'npx create-expo-app',\n eject: 'npx expo prebuild',\n web: 'npx expo start --web',\n 'start:web': 'npx expo start --web',\n 'build:ios': 'eas build -p ios',\n 'build:android': 'eas build -p android',\n 'client:install:ios': 'npx expo start --ios',\n 'client:install:android': 'npx expo start --android',\n doctor: 'npx expo-doctor',\n upgrade: 'https://docs.expo.dev/workflow/upgrading-expo-sdk-walkthrough/',\n 'customize:web': 'npx expo customize',\n\n publish: 'eas update',\n 'publish:set': 'eas update',\n 'publish:rollback': 'eas update',\n 'publish:history': 'eas update',\n 'publish:details': 'eas update',\n\n 'build:web': 'npx expo export:web',\n\n 'credentials:manager': `eas credentials`,\n 'fetch:ios:certs': `eas credentials`,\n 'fetch:android:keystore': `eas credentials`,\n 'fetch:android:hashes': `eas credentials`,\n 'fetch:android:upload-cert': `eas credentials`,\n 'push:android:upload': `eas credentials`,\n 'push:android:show': `eas credentials`,\n 'push:android:clear': `eas credentials`,\n url: `eas build:list`,\n 'url:ipa': `eas build:list`,\n 'url:apk': `eas build:list`,\n webhooks: `eas webhook`,\n 'webhooks:add': `eas webhook:create`,\n 'webhooks:remove': `eas webhook:delete`,\n 'webhooks:update': `eas webhook:update`,\n\n 'build:status': `eas build:list`,\n 'upload:android': `eas submit -p android`,\n 'upload:ios': `eas submit -p ios`,\n };\n\n // TODO: Log telemetry about invalid command used.\n const subcommand = args._[0];\n if (subcommand in migrationMap) {\n const replacement = migrationMap[subcommand];\n console.log();\n const instruction = subcommand === 'upgrade' ? 'follow this guide' : 'use';\n console.log(\n chalk.yellow` {gray $} {bold expo ${subcommand}} is not supported in the local CLI, please ${instruction} {bold ${replacement}} instead`\n );\n console.log();\n process.exit(1);\n }\n const deprecated = ['send', 'client:ios'];\n if (deprecated.includes(subcommand)) {\n console.log();\n console.log(chalk.yellow` {gray $} {bold expo ${subcommand}} is deprecated`);\n console.log();\n process.exit(1);\n }\n}\n\nconst command = isSubcommand ? args._[0] : defaultCmd;\nconst commandArgs = isSubcommand ? args._.slice(1) : args._;\n\n// Push the help flag to the subcommand args.\nif (args['--help']) {\n commandArgs.push('--help');\n}\n\n// Install exit hooks\nprocess.on('SIGINT', () => process.exit(0));\nprocess.on('SIGTERM', () => process.exit(0));\n\ncommands[command]().then((exec) => {\n exec(commandArgs);\n\n // NOTE(EvanBacon): Track some basic telemetry events indicating the command\n // that was run. This can be disabled with the $EXPO_NO_TELEMETRY environment variable.\n // We do this to determine how well deprecations are going before removing a command.\n if (!boolish('EXPO_NO_TELEMETRY', false)) {\n const { recordCommand } =\n require('../src/utils/telemetry') as typeof import('../src/utils/telemetry');\n recordCommand(command);\n }\n});\n"],"names":["process","installEventLogger","NODE_MIN","nodeVersion","version","slice","split","map","Number","console","error","chalk","red","join","boolish","Debug","enable","enabled","env","EXPO_DEBUG","defaultCmd","commands","run","then","i","expoRun","expoRunIos","expoRunAndroid","start","expoStart","prebuild","expoPrebuild","config","expoConfig","export","expoExport","expoExportWeb","expoExportEmbed","serve","expoServe","install","expoInstall","add","customize","expoCustomize","lint","expoLint","login","expoLogin","logout","expoLogout","register","expoRegister","whoami","expoWhoami","args","arg","Boolean","permissive","log","__EXPO_VERSION","exit","warn","yellow","isSubcommand","_","_export","runIos","runAndroid","exportEmbed_unused","exportWeb_unused","_run","_lint","others","Object","keys","migrationMap","init","eject","web","doctor","upgrade","publish","url","webhooks","subcommand","replacement","instruction","deprecated","includes","command","commandArgs","push","on","exec","recordCommand","require"],"mappings":";;;;;;gEACgB;;;;;;;gEACE;;;;;;;gEACA;;;;;;;yBACM;;;;;;wBAEW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IASfA;AAPpB,4BAA4B;AAC5B,uCAAuC;AACvCC,IAAAA,0BAAkB;AAElB,sEAAsE;AACtE,4FAA4F;AAC5F,MAAMC,WAAW;IAAC;IAAI;IAAI;CAAE;AAC5B,MAAMC,eAAcH,mBAAAA,QAAQI,OAAO,qBAAfJ,iBAAiBK,KAAK,CAAC,GAAGC,KAAK,CAAC,KAAK,GAAGC,GAAG,CAACC;AAChE,IAAIL,WAAW,CAAC,EAAE,GAAGD,QAAQ,CAAC,EAAE,IAAKC,WAAW,CAAC,EAAE,KAAKD,QAAQ,CAAC,EAAE,IAAIC,WAAW,CAAC,EAAE,GAAGD,QAAQ,CAAC,EAAE,EAAG;IACpGO,QAAQC,KAAK,CACXC,gBAAK,CAACC,GAAG,CAAC,eAAe,EAAEZ,QAAQI,OAAO,CAAC,+BAA+B,CAAC,GACvEO,gBAAK,CAACC,GAAG,CAAC,2DAA2D,EAAEV,SAASW,IAAI,CAAC,KAAK,GAAG,CAAC,GAC9FF,gBAAK,CAACC,GAAG,CAAC,uCAAuC,CAAC;AAE1D;AAEA,kCAAkC;A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c3B,eAAeT,KAAKU,CAAC,CAAC5D,KAAK,CAAC,KAAKkD,KAAKU,CAAC;AAE3D,6CAA6C;AAC7C,IAAIV,IAAI,CAAC,SAAS,EAAE;IAClBoC,YAAYC,IAAI,CAAC;AACnB;AAEA,qBAAqB;AACrB5F,QAAQ6F,EAAE,CAAC,UAAU,IAAM7F,QAAQ6D,IAAI,CAAC;AACxC7D,QAAQ6F,EAAE,CAAC,WAAW,IAAM7F,QAAQ6D,IAAI,CAAC;AAEzCxC,QAAQ,CAACqE,QAAQ,GAAGnE,IAAI,CAAC,CAACuE;IACxBA,KAAKH;IAEL,4EAA4E;IAC5E,uFAAuF;IACvF,qFAAqF;IACrF,IAAI,CAAC7E,IAAAA,iBAAO,EAAC,qBAAqB,QAAQ;QACxC,MAAM,EAAEiF,aAAa,EAAE,GACrBC,QAAQ;QACVD,cAAcL;IAChB;AACF"}
1
+ {"version":3,"sources":["../../bin/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport arg from 'arg';\nimport chalk from 'chalk';\nimport Debug from 'debug';\nimport { boolish } from 'getenv';\n\nimport { installEventLogger } from '../src/events';\n\n// Setup event logger output\n// NOTE: Done before any console output\ninstallEventLogger();\n\n// Check Node.js version and issue a loud warning if it's too outdated\n// This is sent to stderr (console.error) so it doesn't interfere with programmatic commands\nconst NODE_MIN = [20, 19, 4] as const;\nconst nodeVersion = process.version?.slice(1).split('.', 3).map(Number);\nif (nodeVersion[0]! < NODE_MIN[0] || (nodeVersion[0] === NODE_MIN[0] && nodeVersion[1]! < NODE_MIN[1])) {\n console.error(\n chalk.red`{bold Node.js (${process.version}) is outdated and unsupported.}`\n + chalk.red` Please update to a newer Node.js LTS version (required: >=${NODE_MIN.join('.')})\\n`\n + chalk.red`Go to: https://nodejs.org/en/download\\n`\n );\n}\n\n// Setup before requiring `debug`.\nif (boolish('EXPO_DEBUG', false)) {\n Debug.enable('expo:*');\n} else if (Debug.enabled('expo:')) {\n process.env.EXPO_DEBUG = '1';\n}\n\nconst defaultCmd = 'start';\n\nexport type Command = (argv?: string[]) => void;\n\nconst commands: { [command: string]: () => Promise<Command> } = {\n // Add a new command here\n // NOTE(EvanBacon): Ensure every bundler-related command sets `NODE_ENV` as expected for the command.\n run: () => import('../src/run/index.js').then((i) => i.expoRun),\n 'run:ios': () => import('../src/run/ios/index.js').then((i) => i.expoRunIos),\n 'run:android': () => import('../src/run/android/index.js').then((i) => i.expoRunAndroid),\n start: () => import('../src/start/index.js').then((i) => i.expoStart),\n prebuild: () => import('../src/prebuild/index.js').then((i) => i.expoPrebuild),\n config: () => import('../src/config/index.js').then((i) => i.expoConfig),\n export: () => import('../src/export/index.js').then((i) => i.expoExport),\n 'export:web': () => import('../src/export/web/index.js').then((i) => i.expoExportWeb),\n 'export:embed': () => import('../src/export/embed/index.js').then((i) => i.expoExportEmbed),\n\n serve: () => import('../src/serve/index.js').then((i) => i.expoServe),\n\n // Auxiliary commands\n install: () => import('../src/install/index.js').then((i) => i.expoInstall),\n add: () => import('../src/install/index.js').then((i) => i.expoInstall),\n customize: () => import('../src/customize/index.js').then((i) => i.expoCustomize),\n lint: () => import('../src/lint/index.js').then((i) => i.expoLint),\n\n // Auth\n login: () => import('../src/login/index.js').then((i) => i.expoLogin),\n logout: () => import('../src/logout/index.js').then((i) => i.expoLogout),\n register: () => import('../src/register/index.js').then((i) => i.expoRegister),\n whoami: () => import('../src/whoami/index.js').then((i) => i.expoWhoami),\n};\n\nconst args = arg(\n {\n // Types\n '--version': Boolean,\n '--help': Boolean,\n // NOTE(EvanBacon): This is here to silence warnings from processes that\n // expect the global expo-cli.\n '--non-interactive': Boolean,\n\n // Aliases\n '-v': '--version',\n '-h': '--help',\n },\n {\n permissive: true,\n }\n);\n\nif (args['--version']) {\n // Version is added in the build script.\n console.log(process.env.__EXPO_VERSION);\n process.exit(0);\n}\n\nif (args['--non-interactive']) {\n console.warn(chalk.yellow` {bold --non-interactive} is not supported, use {bold $CI=1} instead`);\n}\n\n// Check if we are running `npx expo <subcommand>` or `npx expo`\nconst isSubcommand = !!(args._[0] && commands[args._[0]]);\n\n// Handle `--help` flag\nif (!isSubcommand && args['--help']) {\n const {\n login,\n logout,\n whoami,\n register,\n start,\n install,\n add,\n export: _export,\n config,\n customize,\n prebuild,\n 'run:ios': runIos,\n 'run:android': runAndroid,\n // NOTE(EvanBacon): Don't document this command as it's a temporary\n // workaround until we can use `expo export` for all production bundling.\n // https://github.com/expo/expo/pull/21396/files#r1121025873\n 'export:embed': exportEmbed_unused,\n // The export:web command is deprecated. Hide it from the help prompt.\n 'export:web': exportWeb_unused,\n // Other ignored commands, these are intentially not listed in the `--help` output\n run: _run,\n // NOTE(cedric): Still pending the migration to ESLint's flat config\n lint: _lint,\n serve,\n // All other commands\n ...others\n } = commands;\n\n console.log(chalk`\n {bold Usage}\n {dim $} npx expo <command>\n\n {bold Commands}\n ${Object.keys({ start, export: _export, ...others }).join(', ')}\n ${Object.keys({ 'run:ios': runIos, 'run:android': runAndroid, prebuild }).join(', ')}\n ${Object.keys({ install, customize, config, serve }).join(', ')}\n {dim ${Object.keys({ login, logout, whoami, register }).join(', ')}}\n\n {bold Options}\n --version, -v Version number\n --help, -h Usage info\n\n For more info run a command with the {bold --help} flag\n {dim $} npx expo start --help\n`);\n\n process.exit(0);\n}\n\n// NOTE(EvanBacon): Squat some directory names to help with migration,\n// users can still use folders named \"send\" or \"eject\" by using the fully qualified `npx expo start ./send`.\nif (!isSubcommand) {\n const migrationMap: Record<string, string> = {\n init: 'npx create-expo-app',\n eject: 'npx expo prebuild',\n web: 'npx expo start --web',\n 'start:web': 'npx expo start --web',\n 'build:ios': 'eas build -p ios',\n 'build:android': 'eas build -p android',\n 'client:install:ios': 'npx expo start --ios',\n 'client:install:android': 'npx expo start --android',\n doctor: 'npx expo-doctor',\n upgrade: 'https://docs.expo.dev/workflow/upgrading-expo-sdk-walkthrough/',\n 'customize:web': 'npx expo customize',\n\n publish: 'eas update',\n 'publish:set': 'eas update',\n 'publish:rollback': 'eas update',\n 'publish:history': 'eas update',\n 'publish:details': 'eas update',\n\n 'build:web': 'npx expo export:web',\n\n 'credentials:manager': `eas credentials`,\n 'fetch:ios:certs': `eas credentials`,\n 'fetch:android:keystore': `eas credentials`,\n 'fetch:android:hashes': `eas credentials`,\n 'fetch:android:upload-cert': `eas credentials`,\n 'push:android:upload': `eas credentials`,\n 'push:android:show': `eas credentials`,\n 'push:android:clear': `eas credentials`,\n url: `eas build:list`,\n 'url:ipa': `eas build:list`,\n 'url:apk': `eas build:list`,\n webhooks: `eas webhook`,\n 'webhooks:add': `eas webhook:create`,\n 'webhooks:remove': `eas webhook:delete`,\n 'webhooks:update': `eas webhook:update`,\n\n 'build:status': `eas build:list`,\n 'upload:android': `eas submit -p android`,\n 'upload:ios': `eas submit -p ios`,\n };\n\n // TODO: Log telemetry about invalid command used.\n const subcommand = args._[0];\n if (subcommand && subcommand in migrationMap) {\n const replacement = migrationMap[subcommand];\n console.log();\n const instruction = subcommand === 'upgrade' ? 'follow this guide' : 'use';\n console.log(\n chalk.yellow` {gray $} {bold expo ${subcommand}} is not supported in the local CLI, please ${instruction} {bold ${replacement}} instead`\n );\n console.log();\n process.exit(1);\n }\n const deprecated = ['send', 'client:ios'];\n if (subcommand && deprecated.includes(subcommand)) {\n console.log();\n console.log(chalk.yellow` {gray $} {bold expo ${subcommand}} is deprecated`);\n console.log();\n process.exit(1);\n }\n}\n\nconst command = isSubcommand ? args._[0]! : defaultCmd;\nconst commandArgs = isSubcommand ? args._.slice(1) : args._;\n\n// Push the help flag to the subcommand args.\nif (args['--help']) {\n commandArgs.push('--help');\n}\n\n// Install exit hooks\nprocess.on('SIGINT', () => process.exit(0));\nprocess.on('SIGTERM', () => process.exit(0));\n\ncommands[command]!().then((exec) => {\n exec(commandArgs);\n\n // NOTE(EvanBacon): Track some basic telemetry events indicating the command\n // that was run. This can be disabled with the $EXPO_NO_TELEMETRY environment variable.\n // We do this to determine how well deprecations are going before removing a command.\n if (!boolish('EXPO_NO_TELEMETRY', false)) {\n const { recordCommand } =\n require('../src/utils/telemetry') as typeof import('../src/utils/telemetry');\n recordCommand(command);\n }\n});\n"],"names":["process","installEventLogger","NODE_MIN","nodeVersion","version","slice","split","map","Number","console","error","chalk","red","join","boolish","Debug","enable","enabled","env","EXPO_DEBUG","defaultCmd","commands","run","then","i","expoRun","expoRunIos","expoRunAndroid","start","expoStart","prebuild","expoPrebuild","config","expoConfig","export","expoExport","expoExportWeb","expoExportEmbed","serve","expoServe","install","expoInstall","add","customize","expoCustomize","lint","expoLint","login","expoLogin","logout","expoLogout","register","expoRegister","whoami","expoWhoami","args","arg","Boolean","permissive","log","__EXPO_VERSION","exit","warn","yellow","isSubcommand","_","_export","runIos","runAndroid","exportEmbed_unused","exportWeb_unused","_run","_lint","others","Object","keys","migrationMap","init","eject","web","doctor","upgrade","publish","url","webhooks","subcommand","replacement","instruction","deprecated","includes","command","commandArgs","push","on","exec","recordCommand","require"],"mappings":";;;;;;gEACgB;;;;;;;gEACE;;;;;;;gEACA;;;;;;;yBACM;;;;;;wBAEW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IASfA;AAPpB,4BAA4B;AAC5B,uCAAuC;AACvCC,IAAAA,0BAAkB;AAElB,sEAAsE;AACtE,4FAA4F;AAC5F,MAAMC,WAAW;IAAC;IAAI;IAAI;CAAE;AAC5B,MAAMC,eAAcH,mBAAAA,QAAQI,OAAO,qBAAfJ,iBAAiBK,KAAK,CAAC,GAAGC,KAAK,CAAC,KAAK,GAAGC,GAAG,CAACC;AAChE,IAAIL,WAAW,CAAC,EAAE,GAAID,QAAQ,CAAC,EAAE,IAAKC,WAAW,CAAC,EAAE,KAAKD,QAAQ,CAAC,EAAE,IAAIC,WAAW,CAAC,EAAE,GAAID,QAAQ,CAAC,EAAE,EAAG;IACtGO,QAAQC,KAAK,CACXC,gBAAK,CAACC,GAAG,CAAC,eAAe,EAAEZ,QAAQI,OAAO,CAAC,+BAA+B,CAAC,GACvEO,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AChD,gBAAK,CAACoD,MAAM,CAAC,sBAAsB,EAAEsB,WAAW,eAAe,CAAC;QAC5E5E,QAAQkD,GAAG;QACX3D,QAAQ6D,IAAI,CAAC;IACf;AACF;AAEA,MAAM6B,UAAU1B,eAAeT,KAAKU,CAAC,CAAC,EAAE,GAAI7C;AAC5C,MAAMuE,cAAc3B,eAAeT,KAAKU,CAAC,CAAC5D,KAAK,CAAC,KAAKkD,KAAKU,CAAC;AAE3D,6CAA6C;AAC7C,IAAIV,IAAI,CAAC,SAAS,EAAE;IAClBoC,YAAYC,IAAI,CAAC;AACnB;AAEA,qBAAqB;AACrB5F,QAAQ6F,EAAE,CAAC,UAAU,IAAM7F,QAAQ6D,IAAI,CAAC;AACxC7D,QAAQ6F,EAAE,CAAC,WAAW,IAAM7F,QAAQ6D,IAAI,CAAC;AAEzCxC,QAAQ,CAACqE,QAAQ,GAAInE,IAAI,CAAC,CAACuE;IACzBA,KAAKH;IAEL,4EAA4E;IAC5E,uFAAuF;IACvF,qFAAqF;IACrF,IAAI,CAAC7E,IAAAA,iBAAO,EAAC,qBAAqB,QAAQ;QACxC,MAAM,EAAEiF,aAAa,EAAE,GACrBC,QAAQ;QACVD,cAAcL;IAChB;AACF"}
@@ -84,22 +84,22 @@ function shouldPrintRequireCycle(modules) {
84
84
  const isIgnored = (module)=>module != null && regExps.some((regExp)=>regExp.test(module));
85
85
  return modules.every((module)=>!isIgnored(module));
86
86
  }
87
- function metroImportDefault(moduleId) {
87
+ function metroImportDefault(moduleId, moduleIdHint) {
88
88
  var _modules_get;
89
89
  if (modules.has(moduleId) && ((_modules_get = modules.get(moduleId)) == null ? void 0 : _modules_get.importedDefault) !== EMPTY) {
90
90
  return modules.get(moduleId).importedDefault;
91
91
  }
92
- const exports = metroRequire(moduleId);
92
+ const exports = metroRequire(moduleId, moduleIdHint);
93
93
  const importedDefault = exports && exports.__esModule ? exports.default : exports;
94
94
  return modules.get(moduleId).importedDefault = importedDefault;
95
95
  }
96
96
  metroRequire.importDefault = metroImportDefault;
97
- function metroImportAll(moduleId) {
97
+ function metroImportAll(moduleId, moduleIdHint) {
98
98
  var _modules_get;
99
99
  if (modules.has(moduleId) && ((_modules_get = modules.get(moduleId)) == null ? void 0 : _modules_get.importedAll) !== EMPTY) {
100
100
  return modules.get(moduleId).importedAll;
101
101
  }
102
- const exports = metroRequire(moduleId);
102
+ const exports = metroRequire(moduleId, moduleIdHint);
103
103
  let importedAll;
104
104
  if (exports && exports.__esModule) {
105
105
  importedAll = exports;
@@ -5,14 +5,14 @@ Object.defineProperty(exports, "__esModule", {
5
5
  function _export(target, all) {
6
6
  for(var name in all)Object.defineProperty(target, name, {
7
7
  enumerable: true,
8
- get: all[name]
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- getExpoApiBaseUrl: function() {
12
+ get getExpoApiBaseUrl () {
13
13
  return getExpoApiBaseUrl;
14
14
  },
15
- getExpoWebsiteBaseUrl: function() {
15
+ get getExpoWebsiteBaseUrl () {
16
16
  return getExpoWebsiteBaseUrl;
17
17
  }
18
18
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/api/endpoint.ts"],"sourcesContent":["import { env } from '../utils/env';\n\n/** Get the URL for the expo.dev API. */\nexport function getExpoApiBaseUrl(): string {\n if (env.EXPO_STAGING) {\n return `https://staging-api.expo.dev`;\n } else if (env.EXPO_LOCAL) {\n return `http://127.0.0.1:3000`;\n } else {\n return `https://api.expo.dev`;\n }\n}\n\n/** Get the URL for the expo.dev website. */\nexport function getExpoWebsiteBaseUrl(): string {\n if (env.EXPO_STAGING) {\n return `https://staging.expo.dev`;\n } else if (env.EXPO_LOCAL) {\n return `http://127.0.0.1:3001`;\n } else {\n return `https://expo.dev`;\n }\n}\n"],"names":["getExpoApiBaseUrl","getExpoWebsiteBaseUrl","env","EXPO_STAGING","EXPO_LOCAL"],"mappings":";;;;;;;;;;;IAGgBA,iBAAiB;eAAjBA;;IAWAC,qBAAqB;eAArBA;;;qBAdI;AAGb,SAASD;IACd,IAAIE,QAAG,CAACC,YAAY,EAAE;QACpB,OAAO,CAAC,4BAA4B,CAAC;IACvC,OAAO,IAAID,QAAG,CAACE,UAAU,EAAE;QACzB,OAAO,CAAC,qBAAqB,CAAC;IAChC,OAAO;QACL,OAAO,CAAC,oBAAoB,CAAC;IAC/B;AACF;AAGO,SAASH;IACd,IAAIC,QAAG,CAACC,YAAY,EAAE;QACpB,OAAO,CAAC,wBAAwB,CAAC;IACnC,OAAO,IAAID,QAAG,CAACE,UAAU,EAAE;QACzB,OAAO,CAAC,qBAAqB,CAAC;IAChC,OAAO;QACL,OAAO,CAAC,gBAAgB,CAAC;IAC3B;AACF"}
1
+ {"version":3,"sources":["../../../src/api/endpoint.ts"],"sourcesContent":["import { env } from '../utils/env';\n\n/** Get the URL for the expo.dev API. */\nexport function getExpoApiBaseUrl(): string {\n if (env.EXPO_STAGING) {\n return `https://staging-api.expo.dev`;\n } else if (env.EXPO_LOCAL) {\n return `http://127.0.0.1:3000`;\n } else {\n return `https://api.expo.dev`;\n }\n}\n\n/** Get the URL for the expo.dev website. */\nexport function getExpoWebsiteBaseUrl(): string {\n if (env.EXPO_STAGING) {\n return `https://staging.expo.dev`;\n } else if (env.EXPO_LOCAL) {\n return `http://127.0.0.1:3001`;\n } else {\n return `https://expo.dev`;\n }\n}\n"],"names":["getExpoApiBaseUrl","getExpoWebsiteBaseUrl","env","EXPO_STAGING","EXPO_LOCAL"],"mappings":";;;;;;;;;;;QAGgBA;eAAAA;;QAWAC;eAAAA;;;qBAdI;AAGb,SAASD;IACd,IAAIE,QAAG,CAACC,YAAY,EAAE;QACpB,OAAO,CAAC,4BAA4B,CAAC;IACvC,OAAO,IAAID,QAAG,CAACE,UAAU,EAAE;QACzB,OAAO,CAAC,qBAAqB,CAAC;IAChC,OAAO;QACL,OAAO,CAAC,oBAAoB,CAAC;IAC/B;AACF;AAGO,SAASH;IACd,IAAIC,QAAG,CAACC,YAAY,EAAE;QACpB,OAAO,CAAC,wBAAwB,CAAC;IACnC,OAAO,IAAID,QAAG,CAACE,UAAU,EAAE;QACzB,OAAO,CAAC,qBAAqB,CAAC;IAChC,OAAO;QACL,OAAO,CAAC,gBAAgB,CAAC;IAC3B;AACF"}
@@ -5,14 +5,14 @@ Object.defineProperty(exports, "__esModule", {
5
5
  function _export(target, all) {
6
6
  for(var name in all)Object.defineProperty(target, name, {
7
7
  enumerable: true,
8
- get: all[name]
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- _getSchemaAsync: function() {
12
+ get _getSchemaAsync () {
13
13
  return _getSchemaAsync;
14
14
  },
15
- getAssetSchemasAsync: function() {
15
+ get getAssetSchemasAsync () {
16
16
  return getAssetSchemasAsync;
17
17
  }
18
18
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/api/getExpoSchema.ts"],"sourcesContent":["import type { JSONObject } from '@expo/json-file';\nimport { derefSchema } from '@expo/schema-utils';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { createCachedFetch, getResponseDataOrThrow } from './rest/client';\nimport { env } from '../utils/env';\nimport { CommandError } from '../utils/errors';\n\nexport type Schema = any;\n\nexport type AssetSchema = {\n fieldPath: string;\n};\n\nconst schemaJson: { [sdkVersion: string]: Schema } = {};\n\nexport async function _getSchemaAsync(sdkVersion: string): Promise<Schema> {\n const json = await getSchemaJSONAsync(sdkVersion);\n return derefSchema(json.schema);\n}\n\n/**\n * Array of schema nodes that refer to assets along with their field path (eg. 'notification.icon')\n *\n * @param sdkVersion\n */\nexport async function getAssetSchemasAsync(sdkVersion: string = 'UNVERSIONED'): Promise<string[]> {\n // If no SDK version is available then fall back to unversioned\n const schema = await _getSchemaAsync(sdkVersion);\n const assetSchemas: string[] = [];\n const visit = (node: Schema, fieldPath: string) => {\n if (node.meta && node.meta.asset) {\n assetSchemas.push(fieldPath);\n }\n const properties = node.properties;\n if (properties) {\n Object.keys(properties).forEach((property) =>\n visit(properties[property], `${fieldPath}${fieldPath.length > 0 ? '.' : ''}${property}`)\n );\n }\n };\n visit(schema, '');\n\n return assetSchemas;\n}\n\nasync function getSchemaJSONAsync(sdkVersion: string): Promise<{ schema: Schema }> {\n if (env.EXPO_UNIVERSE_DIR) {\n return JSON.parse(\n fs\n .readFileSync(\n path.join(\n env.EXPO_UNIVERSE_DIR,\n 'server',\n 'www',\n 'xdl-schemas',\n 'UNVERSIONED-schema.json'\n )\n )\n .toString()\n );\n }\n\n if (!schemaJson[sdkVersion]) {\n try {\n schemaJson[sdkVersion] = await getConfigurationSchemaAsync(sdkVersion);\n } catch (e: any) {\n if (e.code === 'INVALID_JSON') {\n throw new CommandError('INVALID_JSON', `Couldn't read schema from server`);\n }\n\n throw e;\n }\n }\n\n return schemaJson[sdkVersion];\n}\n\nasync function getConfigurationSchemaAsync(sdkVersion: string): Promise<JSONObject> {\n // Reconstruct the cached fetch since caching could be disabled.\n const fetchAsync = createCachedFetch({\n cacheDirectory: 'schema-cache',\n // We'll use a 1 week cache for versions so older versions get flushed out eventually.\n ttl: 1000 * 60 * 60 * 24 * 7,\n });\n const response = await fetchAsync(`project/configuration/schema/${sdkVersion}`);\n const json = await response.json();\n\n return getResponseDataOrThrow<JSONObject>(json);\n}\n"],"names":["_getSchemaAsync","getAssetSchemasAsync","schemaJson","sdkVersion","json","getSchemaJSONAsync","derefSchema","schema","assetSchemas","visit","node","fieldPath","meta","asset","push","properties","Object","keys","forEach","property","length","env","EXPO_UNIVERSE_DIR","JSON","parse","fs","readFileSync","path","join","toString","getConfigurationSchemaAsync","e","code","CommandError","fetchAsync","createCachedFetch","cacheDirectory","ttl","response","getResponseDataOrThrow"],"mappings":";;;;;;;;;;;IAiBsBA,eAAe;eAAfA;;IAUAC,oBAAoB;eAApBA;;;;yBA1BM;;;;;;;gEACb;;;;;;;gEACE;;;;;;wBAEyC;qBACtC;wBACS;;;;;;AAQ7B,MAAMC,aAA+C,CAAC;AAE/C,eAAeF,gBA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AChB,sFAAsF;QACtFC,KAAK,OAAO,KAAK,KAAK,KAAK;IAC7B;IACA,MAAMC,WAAW,MAAMJ,WAAW,CAAC,6BAA6B,EAAE/B,YAAY;IAC9E,MAAMC,OAAO,MAAMkC,SAASlC,IAAI;IAEhC,OAAOmC,IAAAA,8BAAsB,EAAanC;AAC5C"}
1
+ {"version":3,"sources":["../../../src/api/getExpoSchema.ts"],"sourcesContent":["import type { JSONObject } from '@expo/json-file';\nimport { derefSchema } from '@expo/schema-utils';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { createCachedFetch, getResponseDataOrThrow } from './rest/client';\nimport { env } from '../utils/env';\nimport { CommandError } from '../utils/errors';\n\nexport type Schema = any;\n\nexport type AssetSchema = {\n fieldPath: string;\n};\n\nconst schemaJson: { [sdkVersion: string]: Schema } = {};\n\nexport async function _getSchemaAsync(sdkVersion: string): Promise<Schema> {\n const json = await getSchemaJSONAsync(sdkVersion);\n return derefSchema(json.schema);\n}\n\n/**\n * Array of schema nodes that refer to assets along with their field path (eg. 'notification.icon')\n *\n * @param sdkVersion\n */\nexport async function getAssetSchemasAsync(sdkVersion: string = 'UNVERSIONED'): Promise<string[]> {\n // If no SDK version is available then fall back to unversioned\n const schema = await _getSchemaAsync(sdkVersion);\n const assetSchemas: string[] = [];\n const visit = (node: Schema, fieldPath: string) => {\n if (node.meta && node.meta.asset) {\n assetSchemas.push(fieldPath);\n }\n const properties = node.properties;\n if (properties) {\n Object.keys(properties).forEach((property) =>\n visit(properties[property], `${fieldPath}${fieldPath.length > 0 ? '.' : ''}${property}`)\n );\n }\n };\n visit(schema, '');\n\n return assetSchemas;\n}\n\nasync function getSchemaJSONAsync(sdkVersion: string): Promise<{ schema: Schema }> {\n if (env.EXPO_UNIVERSE_DIR) {\n return JSON.parse(\n fs\n .readFileSync(\n path.join(\n env.EXPO_UNIVERSE_DIR,\n 'server',\n 'www',\n 'xdl-schemas',\n 'UNVERSIONED-schema.json'\n )\n )\n .toString()\n );\n }\n\n if (!schemaJson[sdkVersion]) {\n try {\n schemaJson[sdkVersion] = await getConfigurationSchemaAsync(sdkVersion);\n } catch (e: any) {\n if (e.code === 'INVALID_JSON') {\n throw new CommandError('INVALID_JSON', `Couldn't read schema from server`);\n }\n\n throw e;\n }\n }\n\n return schemaJson[sdkVersion];\n}\n\nasync function getConfigurationSchemaAsync(sdkVersion: string): Promise<JSONObject> {\n // Reconstruct the cached fetch since caching could be disabled.\n const fetchAsync = createCachedFetch({\n cacheDirectory: 'schema-cache',\n // We'll use a 1 week cache for versions so older versions get flushed out eventually.\n ttl: 1000 * 60 * 60 * 24 * 7,\n });\n const response = await fetchAsync(`project/configuration/schema/${sdkVersion}`);\n const json = await response.json();\n\n return getResponseDataOrThrow<JSONObject>(json);\n}\n"],"names":["_getSchemaAsync","getAssetSchemasAsync","schemaJson","sdkVersion","json","getSchemaJSONAsync","derefSchema","schema","assetSchemas","visit","node","fieldPath","meta","asset","push","properties","Object","keys","forEach","property","length","env","EXPO_UNIVERSE_DIR","JSON","parse","fs","readFileSync","path","join","toString","getConfigurationSchemaAsync","e","code","CommandError","fetchAsync","createCachedFetch","cacheDirectory","ttl","response","getResponseDataOrThrow"],"mappings":";;;;;;;;;;;QAiBsBA;eAAAA;;QAUAC;eAAAA;;;;yBA1BM;;;;;;;gEACb;;;;;;;gEACE;;;;;;wBAEyC;qBACtC;wBACS;;;;;;AAQ7B,MAAMC,aAA+C,CAAC;AAE/C,eAAeF,gBAAgBG,UAAkB;IACtD,MAAMC,OAAO,MAAMC,mBAAmBF;IACtC,OAAOG,IAAAA,0BAAW,EAACF,KAAKG,MAAM;AAChC;AAOO,eAAeN,qBAAqBE,aAAqB,aAAa;IAC3E,+DAA+D;IAC/D,MAAMI,SAAS,MAAMP,gBAAgBG;IACrC,MAAMK,eAAyB,EAAE;IACjC,MAAMC,QAAQ,CAACC,MAAcC;QAC3B,IAAID,KAAKE,IAAI,IAAIF,KAAKE,IAAI,CAACC,KAAK,EAAE;YAChCL,aAAaM,IAAI,CAACH;QACpB;QACA,MAAMI,aAAaL,KAAKK,UAAU;QAClC,IAAIA,YAAY;YACdC,OAAOC,IAAI,CAACF,YAAYG,OAAO,CAAC,CAACC,WAC/BV,MAAMM,UAAU,CAACI,SAAS,EAAE,GAAGR,YAAYA,UAAUS,MAAM,GAAG,IAAI,MAAM,KAAKD,UAAU;QAE3F;IACF;IACAV,MAAMF,QAAQ;IAEd,OAAOC;AACT;AAEA,eAAeH,mBAAmBF,UAAkB;IAClD,IAAIkB,QAAG,CAACC,iBAAiB,EAAE;QACzB,OAAOC,KAAKC,KAAK,CACfC,aAAE,CACCC,YAAY,CACXC,eAAI,CAACC,IAAI,CACPP,QAAG,CAACC,iBAAiB,EACrB,UACA,OACA,eACA,4BAGHO,QAAQ;IAEf;IAEA,IAAI,CAAC3B,UAAU,CAACC,WAAW,EAAE;QAC3B,IAAI;YACFD,UAAU,CAACC,WAAW,GAAG,MAAM2B,4BAA4B3B;QAC7D,EAAE,OAAO4B,GAAQ;YACf,IAAIA,EAAEC,IAAI,KAAK,gBAAgB;gBAC7B,MAAM,IAAIC,oBAAY,CAAC,gBAAgB,CAAC,gCAAgC,CAAC;YAC3E;YAEA,MAAMF;QACR;IACF;IAEA,OAAO7B,UAAU,CAACC,WAAW;AAC/B;AAEA,eAAe2B,4BAA4B3B,UAAkB;IAC3D,gEAAgE;IAChE,MAAM+B,aAAaC,IAAAA,yBAAiB,EAAC;QACnCC,gBAAgB;QAChB,sFAAsF;QACtFC,KAAK,OAAO,KAAK,KAAK,KAAK;IAC7B;IACA,MAAMC,WAAW,MAAMJ,WAAW,CAAC,6BAA6B,EAAE/B,YAAY;IAC9E,MAAMC,OAAO,MAAMkC,SAASlC,IAAI;IAEhC,OAAOmC,IAAAA,8BAAsB,EAAanC;AAC5C"}
@@ -5,20 +5,20 @@ Object.defineProperty(exports, "__esModule", {
5
5
  function _export(target, all) {
6
6
  for(var name in all)Object.defineProperty(target, name, {
7
7
  enumerable: true,
8
- get: all[name]
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- UnexpectedServerData: function() {
12
+ get UnexpectedServerData () {
13
13
  return _client.UnexpectedServerData;
14
14
  },
15
- UnexpectedServerError: function() {
15
+ get UnexpectedServerError () {
16
16
  return _client.UnexpectedServerError;
17
17
  },
18
- graphql: function() {
18
+ get graphql () {
19
19
  return graphql;
20
20
  },
21
- query: function() {
21
+ get query () {
22
22
  return query;
23
23
  }
24
24
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/api/graphql/client.ts"],"sourcesContent":["import * as Log from '../../log';\nimport { fetch, type Response } from '../../utils/fetch';\nimport { getExpoApiBaseUrl } from '../endpoint';\nimport {\n getResponseDataOrThrow,\n UnexpectedServerData,\n UnexpectedServerError,\n} from '../rest/client';\nimport { FetchLike } from '../rest/client.types';\nimport { wrapFetchWithOffline } from '../rest/wrapFetchWithOffline';\nimport { wrapFetchWithUserAgent } from '../rest/wrapFetchWithUserAgent';\nimport { getAccessToken, getSession } from '../user/UserSettings';\n\ntype JSONObject = Record<string, unknown>;\ntype EmptyVariables = Record<string, never>;\n\nexport type StaticDocumentNode<Result extends JSONObject, Variables extends JSONObject> = string & {\n readonly __graphql: (vars: Variables) => Result;\n};\n\nexport function graphql<Result extends JSONObject, Variables extends JSONObject = EmptyVariables>(\n query: string\n): StaticDocumentNode<Result, Variables> {\n return query.trim() as StaticDocumentNode<Result, Variables>;\n}\n\nexport { UnexpectedServerError, UnexpectedServerData };\n\nexport interface QueryOptions {\n headers?: Record<string, string>;\n}\n\nexport const query = (() => {\n const url = getExpoApiBaseUrl() + '/graphql';\n\n let _fetch: FetchLike | undefined;\n const wrappedFetch: FetchLike = (...args) => {\n if (!_fetch) {\n _fetch = wrapFetchWithOffline(wrapFetchWithUserAgent(fetch));\n }\n return _fetch(...args);\n };\n\n const randomDelay = (attemptCount: number) =>\n new Promise((resolve) => {\n setTimeout(resolve, Math.min(500 + Math.random() * 1000 * attemptCount, 4_000));\n });\n\n const getFetchHeaders = (): Record<string, string> => {\n const token = getAccessToken();\n const headers: Record<string, string> = {\n 'content-type': 'application/json',\n accept: 'application/graphql-response+json, application/graphql+json, application/json',\n };\n let sessionSecret: string | undefined;\n if (token) {\n headers.authorization = `Bearer ${token}`;\n } else if ((sessionSecret = getSession()?.sessionSecret)) {\n headers['expo-session'] = sessionSecret;\n }\n return headers;\n };\n\n // NOTE(@kitten): This only sorted keys one level deep since this is sufficient for most cases\n const stringifySorted = (variables: JSONObject): string =>\n JSON.stringify(\n Object.keys(variables)\n .sort()\n .reduce((acc, key) => {\n acc[key] = variables[key];\n return acc;\n }, {} as JSONObject)\n );\n\n let cache: Record<string, Map<string, unknown>> = {};\n let cacheKey: string | undefined;\n\n function resetCache() {\n cache = {};\n }\n\n return async function query<Result extends JSONObject, Variables extends JSONObject>(\n query: StaticDocumentNode<Result, Variables>,\n variables: Variables,\n options?: QueryOptions\n ): Promise<Result> {\n let isTransient = false;\n let response: Response | undefined;\n let data: Result | null | undefined;\n let error: unknown;\n\n // Pre-instantiate headers and reset the cache if they've changed\n const headers = { ...getFetchHeaders(), ...options?.headers };\n const headersKey = stringifySorted(headers);\n if (!cacheKey || cacheKey !== headersKey) {\n resetCache();\n }\n\n // Retrieve a cached result, if we have any via a `query => variables => Result` cache key\n const variablesKey = stringifySorted(variables);\n const queryCache = cache[query] || (cache[query] = new Map());\n if (queryCache.has(variablesKey)) {\n data = queryCache.get(variablesKey) as Result;\n }\n\n // Retry the query if it fails due to an unknown or transient error\n for (let attemptCount = 0; attemptCount < 3 && !data; attemptCount++) {\n // Add a random delay on each subsequent attempt\n if (attemptCount > 0) {\n await randomDelay(attemptCount);\n }\n\n try {\n response = await wrappedFetch(url, {\n ...options,\n method: 'POST',\n body: JSON.stringify({ query, variables }),\n headers,\n });\n } catch (networkError) {\n error = networkError || error;\n continue;\n }\n\n const json = await response.json();\n if (typeof json === 'object' && json) {\n // If we have a transient error, we retry immediately and discard the data\n // Otherwise, we store the first available error and get the data\n if ('errors' in json && Array.isArray(json.errors)) {\n isTransient = json.errors.some((e: any) => e?.extensions?.isTransient);\n if (isTransient) {\n data = undefined;\n continue;\n } else {\n error = json.errors[0] || error;\n }\n }\n\n try {\n data = getResponseDataOrThrow<Result | null>(json);\n } catch (dataError) {\n // We only use the data error, if we don't have an error already\n if (!error) {\n error = dataError || error;\n }\n continue;\n }\n }\n }\n\n // Store the data in the cache, and only return a result if we have any values\n if (data) {\n queryCache.set(variablesKey, data);\n const keys = Object.keys(data);\n if (keys.length > 0 && keys.some((key) => data[key as keyof typeof data] != null)) {\n return data;\n }\n }\n\n // If we have an error, rethrow it wrapped in our custom errors\n if (error) {\n if (isTransient) {\n Log.error(`We've encountered a transient error, please try again shortly.`);\n }\n const wrappedError = new UnexpectedServerError('' + (error as any).message);\n wrappedError.cause = error;\n throw wrappedError;\n } else if (response && !response.ok) {\n throw new UnexpectedServerError(`Unexpected server error: ${response.statusText}`);\n } else {\n throw new UnexpectedServerData('Unexpected server error: No returned query result');\n }\n };\n})();\n"],"names":["UnexpectedServerData","UnexpectedServerError","graphql","query","trim","url","getExpoApiBaseUrl","_fetch","wrappedFetch","args","wrapFetchWithOffline","wrapFetchWithUserAgent","fetch","randomDelay","attemptCount","Promise","resolve","setTimeout","Math","min","random","getFetchHeaders","getSession","token","getAccessToken","headers","accept","sessionSecret","authorization","stringifySorted","variables","JSON","stringify","Object","keys","sort","reduce","acc","key","cache","cacheKey","resetCache","options","isTransient","response","data","error","headersKey","variablesKey","queryCache","Map","has","get","method","body","networkError","json","Array","isArray","errors","some","e","extensions","undefined","getResponseDataOrThrow","dataError","set","length","Log","wrappedError","message","cause","ok","statusText"],"mappings":";;;;;;;;;;;IA0BgCA,oBAAoB;eAApBA,4BAAoB;;IAA3CC,qBAAqB;eAArBA,6BAAqB;;IANdC,OAAO;eAAPA;;IAYHC,KAAK;eAALA;;;6DAhCQ;uBACgB;0BACH;wBAK3B;sCAE8B;wCACE;8BAC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B,IAAAA,8BAAsB,EAAgBR;gBAC/C,EAAE,OAAOS,WAAW;oBAClB,gEAAgE;oBAChE,IAAI,CAACnB,OAAO;wBACVA,QAAQmB,aAAanB;oBACvB;oBACA;gBACF;YACF;QACF;QAEA,8EAA8E;QAC9E,IAAID,MAAM;YACRI,WAAWiB,GAAG,CAAClB,cAAcH;YAC7B,MAAMX,OAAOD,OAAOC,IAAI,CAACW;YACzB,IAAIX,KAAKiC,MAAM,GAAG,KAAKjC,KAAK0B,IAAI,CAAC,CAACtB,MAAQO,IAAI,CAACP,IAAyB,IAAI,OAAO;gBACjF,OAAOO;YACT;QACF;QAEA,+DAA+D;QAC/D,IAAIC,OAAO;YACT,IAAIH,aAAa;gBACfyB,KAAItB,KAAK,CAAC,CAAC,8DAA8D,CAAC;YAC5E;YACA,MAAMuB,eAAe,IAAIpE,6BAAqB,CAAC,KAAK,AAAC6C,MAAcwB,OAAO;YAC1ED,aAAaE,KAAK,GAAGzB;YACrB,MAAMuB;QACR,OAAO,IAAIzB,YAAY,CAACA,SAAS4B,EAAE,EAAE;YACnC,MAAM,IAAIvE,6BAAqB,CAAC,CAAC,yBAAyB,EAAE2C,SAAS6B,UAAU,EAAE;QACnF,OAAO;YACL,MAAM,IAAIzE,4BAAoB,CAAC;QACjC;IACF;AACF,CAAA"}
1
+ {"version":3,"sources":["../../../../src/api/graphql/client.ts"],"sourcesContent":["import * as Log from '../../log';\nimport { fetch, type Response } from '../../utils/fetch';\nimport { getExpoApiBaseUrl } from '../endpoint';\nimport {\n getResponseDataOrThrow,\n UnexpectedServerData,\n UnexpectedServerError,\n} from '../rest/client';\nimport type { FetchLike } from '../rest/client.types';\nimport { wrapFetchWithOffline } from '../rest/wrapFetchWithOffline';\nimport { wrapFetchWithUserAgent } from '../rest/wrapFetchWithUserAgent';\nimport { getAccessToken, getSession } from '../user/UserSettings';\n\ntype JSONObject = Record<string, unknown>;\ntype EmptyVariables = Record<string, never>;\n\nexport type StaticDocumentNode<Result extends JSONObject, Variables extends JSONObject> = string & {\n readonly __graphql: (vars: Variables) => Result;\n};\n\nexport function graphql<Result extends JSONObject, Variables extends JSONObject = EmptyVariables>(\n query: string\n): StaticDocumentNode<Result, Variables> {\n return query.trim() as StaticDocumentNode<Result, Variables>;\n}\n\nexport { UnexpectedServerError, UnexpectedServerData };\n\nexport interface QueryOptions {\n headers?: Record<string, string>;\n}\n\nexport const query = (() => {\n const url = getExpoApiBaseUrl() + '/graphql';\n\n let _fetch: FetchLike | undefined;\n const wrappedFetch: FetchLike = (...args) => {\n if (!_fetch) {\n _fetch = wrapFetchWithOffline(wrapFetchWithUserAgent(fetch));\n }\n return _fetch(...args);\n };\n\n const randomDelay = (attemptCount: number) =>\n new Promise((resolve) => {\n setTimeout(resolve, Math.min(500 + Math.random() * 1000 * attemptCount, 4_000));\n });\n\n const getFetchHeaders = (): Record<string, string> => {\n const token = getAccessToken();\n const headers: Record<string, string> = {\n 'content-type': 'application/json',\n accept: 'application/graphql-response+json, application/graphql+json, application/json',\n };\n let sessionSecret: string | undefined;\n if (token) {\n headers.authorization = `Bearer ${token}`;\n } else if ((sessionSecret = getSession()?.sessionSecret)) {\n headers['expo-session'] = sessionSecret;\n }\n return headers;\n };\n\n // NOTE(@kitten): This only sorted keys one level deep since this is sufficient for most cases\n const stringifySorted = (variables: JSONObject): string =>\n JSON.stringify(\n Object.keys(variables)\n .sort()\n .reduce((acc, key) => {\n acc[key] = variables[key];\n return acc;\n }, {} as JSONObject)\n );\n\n let cache: Record<string, Map<string, unknown>> = {};\n let cacheKey: string | undefined;\n\n function resetCache() {\n cache = {};\n }\n\n return async function query<Result extends JSONObject, Variables extends JSONObject>(\n query: StaticDocumentNode<Result, Variables>,\n variables: Variables,\n options?: QueryOptions\n ): Promise<Result> {\n let isTransient = false;\n let response: Response | undefined;\n let data: Result | null | undefined;\n let error: unknown;\n\n // Pre-instantiate headers and reset the cache if they've changed\n const headers = { ...getFetchHeaders(), ...options?.headers };\n const headersKey = stringifySorted(headers);\n if (!cacheKey || cacheKey !== headersKey) {\n resetCache();\n }\n\n // Retrieve a cached result, if we have any via a `query => variables => Result` cache key\n const variablesKey = stringifySorted(variables);\n const queryCache = cache[query] || (cache[query] = new Map());\n if (queryCache.has(variablesKey)) {\n data = queryCache.get(variablesKey) as Result;\n }\n\n // Retry the query if it fails due to an unknown or transient error\n for (let attemptCount = 0; attemptCount < 3 && !data; attemptCount++) {\n // Add a random delay on each subsequent attempt\n if (attemptCount > 0) {\n await randomDelay(attemptCount);\n }\n\n try {\n response = await wrappedFetch(url, {\n ...options,\n method: 'POST',\n body: JSON.stringify({ query, variables }),\n headers,\n });\n } catch (networkError) {\n error = networkError || error;\n continue;\n }\n\n const json = await response.json();\n if (typeof json === 'object' && json) {\n // If we have a transient error, we retry immediately and discard the data\n // Otherwise, we store the first available error and get the data\n if ('errors' in json && Array.isArray(json.errors)) {\n isTransient = json.errors.some((e: any) => e?.extensions?.isTransient);\n if (isTransient) {\n data = undefined;\n continue;\n } else {\n error = json.errors[0] || error;\n }\n }\n\n try {\n data = getResponseDataOrThrow<Result | null>(json);\n } catch (dataError) {\n // We only use the data error, if we don't have an error already\n if (!error) {\n error = dataError || error;\n }\n continue;\n }\n }\n }\n\n // Store the data in the cache, and only return a result if we have any values\n if (data) {\n queryCache.set(variablesKey, data);\n const keys = Object.keys(data);\n if (keys.length > 0 && keys.some((key) => data[key as keyof typeof data] != null)) {\n return data;\n }\n }\n\n // If we have an error, rethrow it wrapped in our custom errors\n if (error) {\n if (isTransient) {\n Log.error(`We've encountered a transient error, please try again shortly.`);\n }\n const wrappedError = new UnexpectedServerError('' + (error as any).message);\n wrappedError.cause = error;\n throw wrappedError;\n } else if (response && !response.ok) {\n throw new UnexpectedServerError(`Unexpected server error: ${response.statusText}`);\n } else {\n throw new UnexpectedServerData('Unexpected server error: No returned query result');\n }\n };\n})();\n"],"names":["UnexpectedServerData","UnexpectedServerError","graphql","query","trim","url","getExpoApiBaseUrl","_fetch","wrappedFetch","args","wrapFetchWithOffline","wrapFetchWithUserAgent","fetch","randomDelay","attemptCount","Promise","resolve","setTimeout","Math","min","random","getFetchHeaders","getSession","token","getAccessToken","headers","accept","sessionSecret","authorization","stringifySorted","variables","JSON","stringify","Object","keys","sort","reduce","acc","key","cache","cacheKey","resetCache","options","isTransient","response","data","error","headersKey","variablesKey","queryCache","Map","has","get","method","body","networkError","json","Array","isArray","errors","some","e","extensions","undefined","getResponseDataOrThrow","dataError","set","length","Log","wrappedError","message","cause","ok","statusText"],"mappings":";;;;;;;;;;;QA0BgCA;eAAAA,4BAAoB;;QAA3CC;eAAAA,6BAAqB;;QANdC;eAAAA;;QAYHC;eAAAA;;;6DAhCQ;uBACgB;0BACH;wBAK3B;sCAE8B;wCACE;8BACI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASpC,SAASD,QACdC,KAAa;IAEb,OAAOA,MAAMC,IAAI;AACnB;AAQO,MAAMD,QAAQ,AAAC,CAAA;IACpB,MAAME,MAAMC,IAAAA,2BAAiB,MAAK;IAElC,IAAIC;IACJ,MAAMC,eAA0B,CAAC,GAAGC;QAClC,IAAI,CAACF,SAAQ;YACXA,UAASG,IAAAA,0CAAoB,EAACC,IAAAA,8CAAsB,EAACC,YAAK;QAC5D;QACA,OAAOL,WAAUE;IACnB;IAEA,MAAMI,cAAc,CAACC,eACnB,IAAIC,QAAQ,CAACC;YACXC,WAAWD,SAASE,KAAKC,GAAG,CAAC,MAAMD,KAAKE,MAAM,KAAK,OAAON,cAAc;QAC1E;IAEF,MAAMO,kBAAkB;YASMC;QAR5B,MAAMC,QAAQC,IAAAA,4BAAc;QAC5B,MAAMC,UAAkC;YACtC,gBAAgB;YAChBC,QAAQ;QACV;QACA,IAAIC;QACJ,IAAIJ,OAAO;YACTE,QAAQG,aAAa,GAAG,CAAC,OAAO,EAAEL,OAAO;QAC3C,OAAO,IAAKI,iBAAgBL,cAAAA,IAAAA,wBAAU,wBAAVA,YAAcK,aAAa,EAAG;YACxD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IzE,4BAAoB,CAAC;QACjC;IACF;AACF,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/api/rest/cache/FileSystemResponseCache.ts"],"sourcesContent":["import crypto from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport stream, { Readable } from 'node:stream';\nimport { ReadableStream } from 'node:stream/web';\n\nimport type { ResponseCache, ResponseCacheEntry } from './ResponseCache';\nimport { fileExistsAsync } from '../../../utils/dir';\n\ntype FileSystemResponseCacheInfo = ResponseCacheEntry['info'] & {\n /** The path to the cached body file */\n bodyPath?: string;\n /** If there is no response body */\n empty?: boolean;\n /** The expiration time, in milliseconds, when the response should be invalidated */\n expiration?: number;\n};\n\nexport class FileSystemResponseCache implements ResponseCache {\n /** The absolute path to the directory used to store responses */\n private cacheDirectory: string;\n /** Optional auto-expiration for all stored responses */\n private timeToLive?: number;\n\n constructor(options: { cacheDirectory: string; ttl?: number }) {\n this.cacheDirectory = options.cacheDirectory;\n this.timeToLive = options.ttl;\n }\n\n private getFilePaths(cacheKey: string) {\n // Create a hash of the cache key to use as filename\n const hash = crypto.createHash('sha256').update(cacheKey).digest('hex');\n return {\n info: path.join(this.cacheDirectory, `${hash}-info.json`),\n body: path.join(this.cacheDirectory, `${hash}-body.bin`),\n };\n }\n\n /** Retrieve the cache response, if any */\n async get(cacheKey: string): Promise<ResponseCacheEntry | undefined> {\n const paths = this.getFilePaths(cacheKey);\n\n if (!(await fileExistsAsync(paths.info))) {\n return undefined;\n }\n\n // Read and parse the info file\n const infoBuffer = await fs.promises.readFile(paths.info);\n\n try {\n const responseInfo: FileSystemResponseCacheInfo = JSON.parse(infoBuffer.toString());\n\n // Check if the response has expired\n if (responseInfo.expiration && responseInfo.expiration < Date.now()) {\n await this.remove(cacheKey);\n return undefined;\n }\n\n // Remove cache-specific data from the response info\n const { empty, expiration, bodyPath, ...cleanInfo } = responseInfo;\n\n // Create response body stream\n let responseBody: ReadableStream;\n if (empty) {\n responseBody = Readable.toWeb(Readable.from(Buffer.alloc(0)));\n } else {\n const bodyBuffer = await fs.promises.readFile(paths.body);\n responseBody = Readable.toWeb(Readable.from(bodyBuffer));\n }\n\n return {\n body: responseBody as globalThis.ReadableStream,\n info: cleanInfo,\n };\n } catch {\n // If file doesn't exist or other errors, return undefined\n return undefined;\n }\n }\n\n /** Store the response for caching */\n async set(\n cacheKey: string,\n response: ResponseCacheEntry\n ): Promise<ResponseCacheEntry | undefined> {\n await fs.promises.mkdir(this.cacheDirectory, { recursive: true });\n const paths = this.getFilePaths(cacheKey);\n\n // Create a copy of the response info, to add cache-specific data\n const responseInfo: FileSystemResponseCacheInfo = { ...response.info };\n\n // Add expiration time if the \"time to live\" is set\n if (typeof this.timeToLive === 'number') {\n responseInfo.expiration = Date.now() + this.timeToLive;\n }\n\n try {\n // Clone the response body stream since we need to read it twice\n const [forSize, forWrite] = response.body.tee();\n\n // Check if the body is empty by reading the first stream\n const reader = forSize.getReader();\n const { value } = await reader.read();\n reader.releaseLock();\n\n if (!value || value.length === 0) {\n responseInfo.empty = true;\n } else {\n // Create write stream and pipe response body to file\n const writeStream = fs.createWriteStream(paths.body);\n const nodeStream = Readable.fromWeb(forWrite as ReadableStream);\n nodeStream.pipe(writeStream);\n\n // Wait for the stream to finish\n await stream.promises.finished(writeStream);\n\n responseInfo.bodyPath = paths.body;\n }\n\n // Write info to file\n await fs.promises.writeFile(paths.info, JSON.stringify(responseInfo));\n\n return await this.get(cacheKey);\n } catch (error) {\n // Clean up any partially written files\n await this.remove(cacheKey);\n throw error;\n }\n }\n\n /** Remove the response from caching */\n async remove(cacheKey: string): Promise<void> {\n const paths = this.getFilePaths(cacheKey);\n await removeAllAsync(paths.info, paths.body);\n }\n}\n\nfunction removeAllAsync(...paths: string[]) {\n return Promise.all(\n paths.map((path) => fs.promises.rm(path, { recursive: true, force: true }).catch(() => {}))\n );\n}\n"],"names":["FileSystemResponseCache","constructor","options","cacheDirectory","timeToLive","ttl","getFilePaths","cacheKey","hash","crypto","createHash","update","digest","info","path","join","body","get","paths","fileExistsAsync","undefined","infoBuffer","fs","promises","readFile","responseInfo","JSON","parse","toString","expiration","Date","now","remove","empty","bodyPath","cleanInfo","responseBody","Readable","toWeb","from","Buffer","alloc","bodyBuffer","set","response","mkdir","recursive","forSize","forWrite","tee","reader","getReader","value","read","releaseLock","length","writeStream","createWriteStream","nodeStream","fromWeb","pipe","stream","finished","writeFile","stringify","error","removeAllAsync","Promise","all","map","rm","force","catch"],"mappings":";;;;+BAkBaA;;;eAAAA;;;;gEAlBM;;;;;;;gEACJ;;;;;;;gEACE;;;;;;;iEACgB;;;;;;qBAID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWzB,MAAMA;IAMXC,YAAYC,OAAiD,CAAE;QAC7D,IAAI,CAACC,cAAc,GAAGD,QAAQC,cAAc;QAC5C,IAAI,CAACC,UAAU,GAAGF,QAAQG,GAAG;IAC/B;IAEQC,aAAaC,QAAgB,EAAE;QACrC,oDAAoD;QACpD,MAAMC,OAAOC,qBAAM,CAACC,UAAU,CAAC,UAAUC,MAAM,CAACJ,UAAUK,MAAM,CAAC;QACjE,OAAO;YACLC,MAAMC,mBAAI,CAACC,IAAI,CAAC,IAAI,CAACZ,cAAc,EAAE,GAAGK,KAAK,UAAU,CAAC;YACxDQ,MAAMF,mBAAI,CAACC,IAAI,CAAC,IAAI,CAACZ,cAAc,EAAE,GAAGK,KAAK,SAAS,CAAC;QACzD;IACF;IAEA,wCAAwC,GACxC,MAAMS,IAAIV,QAAgB,EAA2C;QACnE,MAAMW,QAAQ,IAAI,CAACZ,YAAY,CAACC;QAEhC,IAAI,CAAE,MAAMY,IAAAA,oBAAe,EAACD,MAAML,IAAI,GAAI;YACxC,OAAOO;QACT;QAEA,+BAA+B;QAC/B,MAAMC,aAAa,MAAMC,iBAAE,CAACC,QAAQ,CAACC,QAAQ,CAACN,MAAML,IAAI;QAExD,IAAI;YACF,MAAMY,eAA4CC,KAAKC,KAA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QI,SAAS;YAChC,MAAM,EAAEC,KAAK,EAAE,GAAG,MAAMF,OAAOG,IAAI;YACnCH,OAAOI,WAAW;YAElB,IAAI,CAACF,SAASA,MAAMG,MAAM,KAAK,GAAG;gBAChC9B,aAAaQ,KAAK,GAAG;YACvB,OAAO;gBACL,qDAAqD;gBACrD,MAAMuB,cAAclC,iBAAE,CAACmC,iBAAiB,CAACvC,MAAMF,IAAI;gBACnD,MAAM0C,aAAarB,sBAAQ,CAACsB,OAAO,CAACX;gBACpCU,WAAWE,IAAI,CAACJ;gBAEhB,gCAAgC;gBAChC,MAAMK,qBAAM,CAACtC,QAAQ,CAACuC,QAAQ,CAACN;gBAE/B/B,aAAaS,QAAQ,GAAGhB,MAAMF,IAAI;YACpC;YAEA,qBAAqB;YACrB,MAAMM,iBAAE,CAACC,QAAQ,CAACwC,SAAS,CAAC7C,MAAML,IAAI,EAAEa,KAAKsC,SAAS,CAACvC;YAEvD,OAAO,MAAM,IAAI,CAACR,GAAG,CAACV;QACxB,EAAE,OAAO0D,OAAO;YACd,uCAAuC;YACvC,MAAM,IAAI,CAACjC,MAAM,CAACzB;YAClB,MAAM0D;QACR;IACF;IAEA,qCAAqC,GACrC,MAAMjC,OAAOzB,QAAgB,EAAiB;QAC5C,MAAMW,QAAQ,IAAI,CAACZ,YAAY,CAACC;QAChC,MAAM2D,eAAehD,MAAML,IAAI,EAAEK,MAAMF,IAAI;IAC7C;AACF;AAEA,SAASkD,eAAe,GAAGhD,KAAe;IACxC,OAAOiD,QAAQC,GAAG,CAChBlD,MAAMmD,GAAG,CAAC,CAACvD,OAASQ,iBAAE,CAACC,QAAQ,CAAC+C,EAAE,CAACxD,MAAM;YAAEgC,WAAW;YAAMyB,OAAO;QAAK,GAAGC,KAAK,CAAC,KAAO;AAE5F"}
1
+ {"version":3,"sources":["../../../../../src/api/rest/cache/FileSystemResponseCache.ts"],"sourcesContent":["import crypto from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport stream, { Readable } from 'node:stream';\nimport type { ReadableStream } from 'node:stream/web';\n\nimport type { ResponseCache, ResponseCacheEntry } from './ResponseCache';\nimport { fileExistsAsync } from '../../../utils/dir';\n\ntype FileSystemResponseCacheInfo = ResponseCacheEntry['info'] & {\n /** The path to the cached body file */\n bodyPath?: string;\n /** If there is no response body */\n empty?: boolean;\n /** The expiration time, in milliseconds, when the response should be invalidated */\n expiration?: number;\n};\n\nexport class FileSystemResponseCache implements ResponseCache {\n /** The absolute path to the directory used to store responses */\n private cacheDirectory: string;\n /** Optional auto-expiration for all stored responses */\n private timeToLive?: number;\n\n constructor(options: { cacheDirectory: string; ttl?: number }) {\n this.cacheDirectory = options.cacheDirectory;\n this.timeToLive = options.ttl;\n }\n\n private getFilePaths(cacheKey: string) {\n // Create a hash of the cache key to use as filename\n const hash = crypto.createHash('sha256').update(cacheKey).digest('hex');\n return {\n info: path.join(this.cacheDirectory, `${hash}-info.json`),\n body: path.join(this.cacheDirectory, `${hash}-body.bin`),\n };\n }\n\n /** Retrieve the cache response, if any */\n async get(cacheKey: string): Promise<ResponseCacheEntry | undefined> {\n const paths = this.getFilePaths(cacheKey);\n\n if (!(await fileExistsAsync(paths.info))) {\n return undefined;\n }\n\n // Read and parse the info file\n const infoBuffer = await fs.promises.readFile(paths.info);\n\n try {\n const responseInfo: FileSystemResponseCacheInfo = JSON.parse(infoBuffer.toString());\n\n // Check if the response has expired\n if (responseInfo.expiration && responseInfo.expiration < Date.now()) {\n await this.remove(cacheKey);\n return undefined;\n }\n\n // Remove cache-specific data from the response info\n const { empty, expiration, bodyPath, ...cleanInfo } = responseInfo;\n\n // Create response body stream\n let responseBody: ReadableStream;\n if (empty) {\n responseBody = Readable.toWeb(Readable.from(Buffer.alloc(0)));\n } else {\n const bodyBuffer = await fs.promises.readFile(paths.body);\n responseBody = Readable.toWeb(Readable.from(bodyBuffer));\n }\n\n return {\n body: responseBody as globalThis.ReadableStream,\n info: cleanInfo,\n };\n } catch {\n // If file doesn't exist or other errors, return undefined\n return undefined;\n }\n }\n\n /** Store the response for caching */\n async set(\n cacheKey: string,\n response: ResponseCacheEntry\n ): Promise<ResponseCacheEntry | undefined> {\n await fs.promises.mkdir(this.cacheDirectory, { recursive: true });\n const paths = this.getFilePaths(cacheKey);\n\n // Create a copy of the response info, to add cache-specific data\n const responseInfo: FileSystemResponseCacheInfo = { ...response.info };\n\n // Add expiration time if the \"time to live\" is set\n if (typeof this.timeToLive === 'number') {\n responseInfo.expiration = Date.now() + this.timeToLive;\n }\n\n try {\n // Clone the response body stream since we need to read it twice\n const [forSize, forWrite] = response.body.tee();\n\n // Check if the body is empty by reading the first stream\n const reader = forSize.getReader();\n const { value } = await reader.read();\n reader.releaseLock();\n\n if (!value || value.length === 0) {\n responseInfo.empty = true;\n } else {\n // Create write stream and pipe response body to file\n const writeStream = fs.createWriteStream(paths.body);\n const nodeStream = Readable.fromWeb(forWrite as ReadableStream);\n nodeStream.pipe(writeStream);\n\n // Wait for the stream to finish\n await stream.promises.finished(writeStream);\n\n responseInfo.bodyPath = paths.body;\n }\n\n // Write info to file\n await fs.promises.writeFile(paths.info, JSON.stringify(responseInfo));\n\n return await this.get(cacheKey);\n } catch (error) {\n // Clean up any partially written files\n await this.remove(cacheKey);\n throw error;\n }\n }\n\n /** Remove the response from caching */\n async remove(cacheKey: string): Promise<void> {\n const paths = this.getFilePaths(cacheKey);\n await removeAllAsync(paths.info, paths.body);\n }\n}\n\nfunction removeAllAsync(...paths: string[]) {\n return Promise.all(\n paths.map((path) => fs.promises.rm(path, { recursive: true, force: true }).catch(() => {}))\n );\n}\n"],"names":["FileSystemResponseCache","options","cacheDirectory","timeToLive","ttl","getFilePaths","cacheKey","hash","crypto","createHash","update","digest","info","path","join","body","get","paths","fileExistsAsync","undefined","infoBuffer","fs","promises","readFile","responseInfo","JSON","parse","toString","expiration","Date","now","remove","empty","bodyPath","cleanInfo","responseBody","Readable","toWeb","from","Buffer","alloc","bodyBuffer","set","response","mkdir","recursive","forSize","forWrite","tee","reader","getReader","value","read","releaseLock","length","writeStream","createWriteStream","nodeStream","fromWeb","pipe","stream","finished","writeFile","stringify","error","removeAllAsync","Promise","all","map","rm","force","catch"],"mappings":";;;;+BAkBaA;;;eAAAA;;;;gEAlBM;;;;;;;gEACJ;;;;;;;gEACE;;;;;;;iEACgB;;;;;;qBAID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWzB,MAAMA;IAMX,YAAYC,OAAiD,CAAE;QAC7D,IAAI,CAACC,cAAc,GAAGD,QAAQC,cAAc;QAC5C,IAAI,CAACC,UAAU,GAAGF,QAAQG,GAAG;IAC/B;IAEQC,aAAaC,QAAgB,EAAE;QACrC,oDAAoD;QACpD,MAAMC,OAAOC,qBAAM,CAACC,UAAU,CAAC,UAAUC,MAAM,CAACJ,UAAUK,MAAM,CAAC;QACjE,OAAO;YACLC,MAAMC,mBAAI,CAACC,IAAI,CAAC,IAAI,CAACZ,cAAc,EAAE,GAAGK,KAAK,UAAU,CAAC;YACxDQ,MAAMF,mBAAI,CAACC,IAAI,CAAC,IAAI,CAACZ,cAAc,EAAE,GAAGK,KAAK,SAAS,CAAC;QACzD;IACF;IAEA,wCAAwC,GACxC,MAAMS,IAAIV,QAAgB,EAA2C;QACnE,MAAMW,QAAQ,IAAI,CAACZ,YAAY,CAACC;QAEhC,IAAI,CAAE,MAAMY,IAAAA,oBAAe,EAACD,MAAML,IAAI,GAAI;YACxC,OAAOO;QACT;QAEA,+BAA+B;QAC/B,MAAMC,aAAa,MAAMC,iBAAE,CAACC,QAAQ,CAACC,QAAQ,CAACN,MAAML,IAAI;QAExD,IAAI;YACF,MAAMY,eAA4CC,KAAKC,KAAK,CAACN,WAAWO,QAAQ;YAEhF,oCAAoC;YACpC,IAAIH,aAAaI,UAAU,IAAIJ,aAAaI,UAAU,GAAGC,KAAKC,GAAG,IAAI;gBACnE,MAAM,IAAI,CAACC,MAAM,CAACzB;gBAClB,OAAOa;YACT;YAEA,oDAAoD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,qDAAqD;gBACrD,MAAMuB,cAAclC,iBAAE,CAACmC,iBAAiB,CAACvC,MAAMF,IAAI;gBACnD,MAAM0C,aAAarB,sBAAQ,CAACsB,OAAO,CAACX;gBACpCU,WAAWE,IAAI,CAACJ;gBAEhB,gCAAgC;gBAChC,MAAMK,qBAAM,CAACtC,QAAQ,CAACuC,QAAQ,CAACN;gBAE/B/B,aAAaS,QAAQ,GAAGhB,MAAMF,IAAI;YACpC;YAEA,qBAAqB;YACrB,MAAMM,iBAAE,CAACC,QAAQ,CAACwC,SAAS,CAAC7C,MAAML,IAAI,EAAEa,KAAKsC,SAAS,CAACvC;YAEvD,OAAO,MAAM,IAAI,CAACR,GAAG,CAACV;QACxB,EAAE,OAAO0D,OAAO;YACd,uCAAuC;YACvC,MAAM,IAAI,CAACjC,MAAM,CAACzB;YAClB,MAAM0D;QACR;IACF;IAEA,qCAAqC,GACrC,MAAMjC,OAAOzB,QAAgB,EAAiB;QAC5C,MAAMW,QAAQ,IAAI,CAACZ,YAAY,CAACC;QAChC,MAAM2D,eAAehD,MAAML,IAAI,EAAEK,MAAMF,IAAI;IAC7C;AACF;AAEA,SAASkD,eAAe,GAAGhD,KAAe;IACxC,OAAOiD,QAAQC,GAAG,CAChBlD,MAAMmD,GAAG,CAAC,CAACvD,OAASQ,iBAAE,CAACC,QAAQ,CAAC+C,EAAE,CAACxD,MAAM;YAAEgC,WAAW;YAAMyB,OAAO;QAAK,GAAGC,KAAK,CAAC,KAAO;AAE5F"}
@@ -5,20 +5,20 @@ Object.defineProperty(exports, "__esModule", {
5
5
  function _export(target, all) {
6
6
  for(var name in all)Object.defineProperty(target, name, {
7
7
  enumerable: true,
8
- get: all[name]
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- getRequestBodyCacheData: function() {
12
+ get getRequestBodyCacheData () {
13
13
  return getRequestBodyCacheData;
14
14
  },
15
- getRequestCacheKey: function() {
15
+ get getRequestCacheKey () {
16
16
  return getRequestCacheKey;
17
17
  },
18
- getRequestInfoCacheData: function() {
18
+ get getRequestInfoCacheData () {
19
19
  return getRequestInfoCacheData;
20
20
  },
21
- getResponseInfo: function() {
21
+ get getResponseInfo () {
22
22
  return getResponseInfo;
23
23
  }
24
24
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/api/rest/cache/ResponseCache.ts"],"sourcesContent":["import crypto from 'crypto';\nimport type { Response, RequestInfo, RequestInit } from 'fetch-nodeshim';\nimport { ReadStream } from 'fs';\n\nconst GLOBAL_CACHE_VERSION = 4;\n\nexport type ResponseCacheEntry = {\n body: ReadableStream;\n info: ReturnType<typeof getResponseInfo>;\n};\n\nexport interface ResponseCache {\n /** Load the response info from cache, if any */\n get(cacheKey: string): Promise<ResponseCacheEntry | undefined>;\n /** Store the response info to cache, and return the cached info */\n set(cacheKey: string, response: ResponseCacheEntry): Promise<ResponseCacheEntry | undefined>;\n /** Remove a response entry from the cache */\n remove(cacheKey: string): Promise<void>;\n}\n\nexport function getResponseInfo(response: Response) {\n const headers = Object.fromEntries(response.headers.entries());\n delete headers['set-cookie'];\n return {\n url: response.url,\n status: response.status,\n statusText: response.statusText,\n headers,\n };\n}\n\nexport function getRequestCacheKey(info: RequestInfo, init?: RequestInit) {\n const infoKeyData = getRequestInfoCacheData(info);\n const initKeyData = { body: init?.body ? getRequestBodyCacheData(init.body) : undefined };\n\n return crypto\n .createHash('md5')\n .update(JSON.stringify([infoKeyData, initKeyData, GLOBAL_CACHE_VERSION]))\n .digest('hex');\n}\n\n/** @internal Exposed for testing */\nexport function getRequestInfoCacheData(info: RequestInfo) {\n if (typeof info === 'string') {\n return { url: info };\n }\n\n if (info instanceof URL) {\n return { url: info.toString() };\n }\n\n if (info instanceof Request) {\n return {\n // cache: req.cache,\n credentials: info.credentials.toString(),\n destination: info.destination.toString(),\n headers: Object.fromEntries(info.headers.entries()),\n integrity: info.integrity,\n method: info.method,\n redirect: info.redirect,\n referrer: info.referrer,\n referrerPolicy: info.referrerPolicy,\n url: info.url.toString(),\n // body: // TODO\n };\n }\n\n throw new Error('Unsupported request info type for caching: ' + typeof info);\n}\n\n/** @internal Exposed for testing */\nexport function getRequestBodyCacheData(body: RequestInit['body']) {\n if (!body) {\n return body;\n }\n\n if (typeof body === 'string') {\n return body;\n }\n\n if (body instanceof URLSearchParams) {\n return body.toString();\n }\n\n // Supported for legacy purposes because node-fetch uses fs.readStream\n if (body instanceof ReadStream) {\n return body.path;\n }\n\n if (body.toString && body.toString() === '[object FormData]') {\n return new URLSearchParams(body as any).toString();\n }\n\n if (body instanceof Buffer) {\n return body.toString();\n }\n\n throw new Error(`Unsupported request body type for caching: ${typeof body}`);\n}\n"],"names":["getRequestBodyCacheData","getRequestCacheKey","getRequestInfoCacheData","getResponseInfo","GLOBAL_CACHE_VERSION","response","headers","Object","fromEntries","entries","url","status","statusText","info","init","infoKeyData","initKeyData","body","undefined","crypto","createHash","update","JSON","stringify","digest","URL","toString","Request","credentials","destination","integrity","method","redirect","referrer","referrerPolicy","Error","URLSearchParams","ReadStream","path","Buffer"],"mappings":";;;;;;;;;;;IAuEgBA,uBAAuB;eAAvBA;;IAxCAC,kBAAkB;eAAlBA;;IAWAC,uBAAuB;eAAvBA;;IAtBAC,eAAe;eAAfA;;;;gEApBG;;;;;;;yBAEQ;;;;;;;;;;;AAE3B,MAAMC,uBAAuB;AAgBtB,SAASD,gBAAgBE,QAAkB;IAChD,MAAMC,UAAUC,OAAOC,WAAW,CAACH,SAASC,OAAO,CAACG,OAAO;IAC3D,OAAOH,OAAO,CAAC,aAAa;IAC5B,OAAO;QACLI,KAAKL,SAASK,GAAG;QACjBC,QAAQN,SAASM,MAAM;QACvBC,YAAYP,SAASO,UAAU;QAC/BN;IACF;AACF;AAEO,SAASL,mBAAmBY,IAAiB,EAAEC,IAAkB;IACtE,MAAMC,cAAcb,wBAAwBW;IAC5C,MAAMG,cAAc;QAAEC,MAAMH,CAAAA,wBAAAA,KAAMG,IAAI,IAAGj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;QAC1B,OAAOtB,KAAKS,QAAQ;IACtB;IAEA,MAAM,IAAIS,MAAM,CAAC,2CAA2C,EAAE,OAAOlB,MAAM;AAC7E"}
1
+ {"version":3,"sources":["../../../../../src/api/rest/cache/ResponseCache.ts"],"sourcesContent":["import crypto from 'crypto';\nimport type { Response, RequestInfo, RequestInit } from 'fetch-nodeshim';\nimport { ReadStream } from 'fs';\n\nconst GLOBAL_CACHE_VERSION = 4;\n\nexport type ResponseCacheEntry = {\n body: ReadableStream;\n info: ReturnType<typeof getResponseInfo>;\n};\n\nexport interface ResponseCache {\n /** Load the response info from cache, if any */\n get(cacheKey: string): Promise<ResponseCacheEntry | undefined>;\n /** Store the response info to cache, and return the cached info */\n set(cacheKey: string, response: ResponseCacheEntry): Promise<ResponseCacheEntry | undefined>;\n /** Remove a response entry from the cache */\n remove(cacheKey: string): Promise<void>;\n}\n\nexport function getResponseInfo(response: Response) {\n const headers = Object.fromEntries(response.headers.entries());\n delete headers['set-cookie'];\n return {\n url: response.url,\n status: response.status,\n statusText: response.statusText,\n headers,\n };\n}\n\nexport function getRequestCacheKey(info: RequestInfo, init?: RequestInit) {\n const infoKeyData = getRequestInfoCacheData(info);\n const initKeyData = { body: init?.body ? getRequestBodyCacheData(init.body) : undefined };\n\n return crypto\n .createHash('md5')\n .update(JSON.stringify([infoKeyData, initKeyData, GLOBAL_CACHE_VERSION]))\n .digest('hex');\n}\n\n/** @internal Exposed for testing */\nexport function getRequestInfoCacheData(info: RequestInfo) {\n if (typeof info === 'string') {\n return { url: info };\n }\n\n if (info instanceof URL) {\n return { url: info.toString() };\n }\n\n if (info instanceof Request) {\n return {\n // cache: req.cache,\n credentials: info.credentials.toString(),\n destination: info.destination.toString(),\n headers: Object.fromEntries(info.headers.entries()),\n integrity: info.integrity,\n method: info.method,\n redirect: info.redirect,\n referrer: info.referrer,\n referrerPolicy: info.referrerPolicy,\n url: info.url.toString(),\n // body: // TODO\n };\n }\n\n throw new Error('Unsupported request info type for caching: ' + typeof info);\n}\n\n/** @internal Exposed for testing */\nexport function getRequestBodyCacheData(body: RequestInit['body']) {\n if (!body) {\n return body;\n }\n\n if (typeof body === 'string') {\n return body;\n }\n\n if (body instanceof URLSearchParams) {\n return body.toString();\n }\n\n // Supported for legacy purposes because node-fetch uses fs.readStream\n if (body instanceof ReadStream) {\n return body.path;\n }\n\n if (body.toString && body.toString() === '[object FormData]') {\n return new URLSearchParams(body as any).toString();\n }\n\n if (body instanceof Buffer) {\n return body.toString();\n }\n\n throw new Error(`Unsupported request body type for caching: ${typeof body}`);\n}\n"],"names":["getRequestBodyCacheData","getRequestCacheKey","getRequestInfoCacheData","getResponseInfo","GLOBAL_CACHE_VERSION","response","headers","Object","fromEntries","entries","url","status","statusText","info","init","infoKeyData","initKeyData","body","undefined","crypto","createHash","update","JSON","stringify","digest","URL","toString","Request","credentials","destination","integrity","method","redirect","referrer","referrerPolicy","Error","URLSearchParams","ReadStream","path","Buffer"],"mappings":";;;;;;;;;;;QAuEgBA;eAAAA;;QAxCAC;eAAAA;;QAWAC;eAAAA;;QAtBAC;eAAAA;;;;gEApBG;;;;;;;yBAEQ;;;;;;;;;;;AAE3B,MAAMC,uBAAuB;AAgBtB,SAASD,gBAAgBE,QAAkB;IAChD,MAAMC,UAAUC,OAAOC,WAAW,CAACH,SAASC,OAAO,CAACG,OAAO;IAC3D,OAAOH,OAAO,CAAC,aAAa;IAC5B,OAAO;QACLI,KAAKL,SAASK,GAAG;QACjBC,QAAQN,SAASM,MAAM;QACvBC,YAAYP,SAASO,UAAU;QAC/BN;IACF;AACF;AAEO,SAASL,mBAAmBY,IAAiB,EAAEC,IAAkB;IACtE,MAAMC,cAAcb,wBAAwBW;IAC5C,MAAMG,cAAc;QAAEC,MAAMH,CAAAA,wBAAAA,KAAMG,IAAI,IAAGjB,wBAAwBc,KAAKG,IAAI,IAAIC;IAAU;IAExF,OAAOC,iBAAM,CACVC,UAAU,CAAC,OACXC,MAAM,CAACC,KAAKC,SAAS,CAAC;QA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 +5,29 @@ Object.defineProperty(exports, "__esModule", {
5
5
  function _export(target, all) {
6
6
  for(var name in all)Object.defineProperty(target, name, {
7
7
  enumerable: true,
8
- get: all[name]
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- ApiV2Error: function() {
12
+ get ApiV2Error () {
13
13
  return ApiV2Error;
14
14
  },
15
- UnexpectedServerData: function() {
15
+ get UnexpectedServerData () {
16
16
  return UnexpectedServerData;
17
17
  },
18
- UnexpectedServerError: function() {
18
+ get UnexpectedServerError () {
19
19
  return UnexpectedServerError;
20
20
  },
21
- createCachedFetch: function() {
21
+ get createCachedFetch () {
22
22
  return createCachedFetch;
23
23
  },
24
- fetchAsync: function() {
24
+ get fetchAsync () {
25
25
  return fetchAsync;
26
26
  },
27
- getResponseDataOrThrow: function() {
27
+ get getResponseDataOrThrow () {
28
28
  return getResponseDataOrThrow;
29
29
  },
30
- wrapFetchWithCredentials: function() {
30
+ get wrapFetchWithCredentials () {
31
31
  return wrapFetchWithCredentials;
32
32
  }
33
33
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/api/rest/client.ts"],"sourcesContent":["import type { JSONValue } from '@expo/json-file';\nimport path from 'path';\n\nimport { wrapFetchWithCache } from './cache/wrapFetchWithCache';\nimport type { FetchLike } from './client.types';\nimport { wrapFetchWithBaseUrl } from './wrapFetchWithBaseUrl';\nimport { wrapFetchWithOffline } from './wrapFetchWithOffline';\nimport { wrapFetchWithProgress } from './wrapFetchWithProgress';\nimport { wrapFetchWithUserAgent } from './wrapFetchWithUserAgent';\nimport { env } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport { fetch } from '../../utils/fetch';\nimport { getExpoApiBaseUrl } from '../endpoint';\nimport { disableNetwork } from '../settings';\nimport { getAccessToken, getExpoHomeDirectory, getSession } from '../user/UserSettings';\n\nexport class ApiV2Error extends Error {\n readonly name = 'ApiV2Error';\n readonly code: string;\n readonly expoApiV2ErrorCode: string;\n readonly expoApiV2ErrorDetails?: JSONValue;\n readonly expoApiV2ErrorServerStack?: string;\n readonly expoApiV2ErrorMetadata?: object;\n readonly expoApiV2RequestId?: string;\n\n constructor(response: {\n message: string;\n code: string;\n stack?: string;\n details?: JSONValue;\n metadata?: object;\n requestId: string;\n }) {\n super(response.message);\n this.code = response.code;\n this.expoApiV2ErrorCode = response.code;\n this.expoApiV2ErrorDetails = response.details;\n this.expoApiV2ErrorServerStack = response.stack;\n this.expoApiV2ErrorMetadata = response.metadata;\n this.expoApiV2RequestId = response.requestId;\n }\n\n toString() {\n return `${super.toString()}${env.EXPO_DEBUG && this.expoApiV2RequestId ? ` (Request Id: ${this.expoApiV2RequestId})` : ''}`;\n }\n}\n\n/**\n * An Expo server error that didn't return the expected error JSON information.\n * The only 'expected' place for this is in testing, all other cases are bugs with the server.\n */\nexport class UnexpectedServerError extends Error {\n readonly name = 'UnexpectedServerError';\n}\n\n/**\n * An error defining that the server didn't return the expected error JSON information.\n * The only 'expected' place for this is in testing, all other cases are bugs with the client.\n */\nexport class UnexpectedServerData extends Error {\n readonly name = 'UnexpectedServerData';\n}\n\n/** Validate the response json contains `.data` property, or throw an unexpected server data error */\nexport function getResponseDataOrThrow<T = any>(json: unknown): T {\n if (!!json && typeof json === 'object' && 'data' in json) {\n return json.data as T;\n }\n\n throw new UnexpectedServerData(\n !!json && typeof json === 'object' ? JSON.stringify(json) : 'Unknown data received from server.'\n );\n}\n\n/**\n * @returns a `fetch` function that will inject user authentication information and handle errors from the Expo API.\n */\nexport function wrapFetchWithCredentials(fetchFunction: FetchLike): FetchLike {\n return async function fetchWithCredentials(url, options = {}) {\n if (Array.isArray(options.headers)) {\n throw new Error('request headers must be in object form');\n }\n\n const resolvedHeaders = options.headers ?? ({} as any);\n\n const token = getAccessToken();\n if (token) {\n resolvedHeaders.authorization = `Bearer ${token}`;\n } else {\n const sessionSecret = getSession()?.sessionSecret;\n if (sessionSecret) {\n resolvedHeaders['expo-session'] = sessionSecret;\n }\n }\n\n try {\n const response = await fetchFunction(url, {\n ...options,\n headers: resolvedHeaders,\n });\n\n // Handle expected API errors (4xx)\n if (response.status >= 400 && response.status < 500) {\n const body = await response.text();\n try {\n const data = JSON.parse(body);\n if (data?.errors?.length) {\n throw new ApiV2Error(data.errors[0]);\n }\n } catch (error: any) {\n // Server returned non-json response.\n if (error.message.includes('in JSON at position')) {\n throw new UnexpectedServerError(body);\n }\n throw error;\n }\n }\n\n return response;\n } catch (error: any) {\n // When running `expo start`, but wifi or internet has issues\n if (isNetworkError(error) || ('cause' in error && isNetworkError(error.cause))) {\n disableNetwork();\n\n throw new CommandError(\n 'OFFLINE',\n 'Network connection is unreliable. Try again with the environment variable `EXPO_OFFLINE=1` to skip network requests.'\n );\n }\n\n throw error;\n }\n };\n}\n\n/**\n * Determine if the provided error is related to a network issue.\n * When this returns true, offline mode should be enabled.\n * - `ENOTFOUND` is thrown when the DNS lookup failed\n * - `EAI_AGAIN` is thrown when DNS lookup failed due to a server-side error\n * - `UND_ERR_CONNECT_TIMEOUT` is thrown after DNS is resolved, but server can't be reached\n *\n * @see https://nodejs.org/api/errors.html\n * @see https://github.com/nodejs/undici#network-address-family-autoselection\n */\nfunction isNetworkError(error: Error & { code?: string }) {\n return (\n 'code' in error &&\n error.code &&\n ['ENOTFOUND', 'EAI_AGAIN', 'UND_ERR_CONNECT_TIMEOUT'].includes(error.code)\n );\n}\n\nconst fetchWithOffline = wrapFetchWithOffline(wrapFetchWithUserAgent(fetch));\n\nconst fetchWithBaseUrl = wrapFetchWithBaseUrl(fetchWithOffline, getExpoApiBaseUrl() + '/v2/');\n\nconst fetchWithCredentials = wrapFetchWithProgress(wrapFetchWithCredentials(fetchWithBaseUrl));\n\n/**\n * Create an instance of the fully qualified fetch command (auto authentication and api) but with caching in the '~/.expo' directory.\n * Caching is disabled automatically if the EXPO_NO_CACHE or EXPO_BETA environment variables are enabled.\n */\nexport function createCachedFetch({\n fetch = fetchWithCredentials,\n cacheDirectory,\n ttl,\n skipCache,\n}: {\n fetch?: FetchLike;\n cacheDirectory: string;\n ttl?: number;\n skipCache?: boolean;\n}): FetchLike {\n // Disable all caching in EXPO_BETA.\n if (skipCache || env.EXPO_BETA || env.EXPO_NO_CACHE) {\n return fetch;\n }\n\n const { FileSystemResponseCache } =\n require('./cache/FileSystemResponseCache') as typeof import('./cache/FileSystemResponseCache');\n\n return wrapFetchWithCache(\n fetch,\n new FileSystemResponseCache({\n cacheDirectory: path.join(getExpoHomeDirectory(), cacheDirectory),\n ttl,\n })\n );\n}\n\n/** Instance of fetch with automatic base URL pointing to the Expo API, user credential injection, and API error handling. Caching not included. */\nexport const fetchAsync = wrapFetchWithProgress(wrapFetchWithCredentials(fetchWithBaseUrl));\n"],"names":["ApiV2Error","UnexpectedServerData","UnexpectedServerError","createCachedFetch","fetchAsync","getResponseDataOrThrow","wrapFetchWithCredentials","Error","constructor","response","message","name","code","expoApiV2ErrorCode","expoApiV2ErrorDetails","details","expoApiV2ErrorServerStack","stack","expoApiV2ErrorMetadata","metadata","expoApiV2RequestId","requestId","toString","env","EXPO_DEBUG","json","data","JSON","stringify","fetchFunction","fetchWithCredentials","url","options","Array","isArray","headers","resolvedHeaders","token","getAccessToken","authorization","getSession","sessionSecret","status","body","text","parse","errors","length","error","includes","isNetworkError","cause","disableNetwork","CommandError","fetchWithOffline","wrapFetchWithOffline","wrapFetchWithUserAgent","fetch","fetchWithBaseUrl","wrapFetchWithBaseUrl","getExpoApiBaseUrl","wrapFetchWithProgress","cacheDirectory","ttl","skipCache","EXPO_BETA","EXPO_NO_CACHE","FileSystemResponseCache","require","wrapFetchWithCache","path","join","getExpoHomeDirectory"],"mappings":";;;;;;;;;;;IAgBaA,UAAU;eAAVA;;IA2CAC,oBAAoB;eAApBA;;IARAC,qBAAqB;eAArBA;;IAgHGC,iBAAiB;eAAjBA;;IA6BHC,UAAU;eAAVA;;IAhIGC,sBAAsB;eAAtBA;;IAaAC,wBAAwB;eAAxBA;;;;gEA5EC;;;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AAA,8CAAsB,EAACC,YAAK;AAE1E,MAAMC,mBAAmBC,IAAAA,0CAAoB,EAACL,kBAAkBM,IAAAA,2BAAiB,MAAK;AAEtF,MAAM9B,uBAAuB+B,IAAAA,4CAAqB,EAACvD,yBAAyBoD;AAMrE,SAASvD,kBAAkB,EAChCsD,QAAQ3B,oBAAoB,EAC5BgC,cAAc,EACdC,GAAG,EACHC,SAAS,EAMV;IACC,oCAAoC;IACpC,IAAIA,aAAazC,QAAG,CAAC0C,SAAS,IAAI1C,QAAG,CAAC2C,aAAa,EAAE;QACnD,OAAOT;IACT;IAEA,MAAM,EAAEU,uBAAuB,EAAE,GAC/BC,QAAQ;IAEV,OAAOC,IAAAA,sCAAkB,EACvBZ,OACA,IAAIU,wBAAwB;QAC1BL,gBAAgBQ,eAAI,CAACC,IAAI,CAACC,IAAAA,kCAAoB,KAAIV;QAClDC;IACF;AAEJ;AAGO,MAAM3D,aAAayD,IAAAA,4CAAqB,EAACvD,yBAAyBoD"}
1
+ {"version":3,"sources":["../../../../src/api/rest/client.ts"],"sourcesContent":["import type { JSONValue } from '@expo/json-file';\nimport path from 'path';\n\nimport { wrapFetchWithCache } from './cache/wrapFetchWithCache';\nimport type { FetchLike } from './client.types';\nimport { wrapFetchWithBaseUrl } from './wrapFetchWithBaseUrl';\nimport { wrapFetchWithOffline } from './wrapFetchWithOffline';\nimport { wrapFetchWithProgress } from './wrapFetchWithProgress';\nimport { wrapFetchWithUserAgent } from './wrapFetchWithUserAgent';\nimport { env } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport { fetch } from '../../utils/fetch';\nimport { getExpoApiBaseUrl } from '../endpoint';\nimport { disableNetwork } from '../settings';\nimport { getAccessToken, getExpoHomeDirectory, getSession } from '../user/UserSettings';\n\nexport class ApiV2Error extends Error {\n readonly name = 'ApiV2Error';\n readonly code: string;\n readonly expoApiV2ErrorCode: string;\n readonly expoApiV2ErrorDetails?: JSONValue;\n readonly expoApiV2ErrorServerStack?: string;\n readonly expoApiV2ErrorMetadata?: object;\n readonly expoApiV2RequestId?: string;\n\n constructor(response: {\n message: string;\n code: string;\n stack?: string;\n details?: JSONValue;\n metadata?: object;\n requestId: string;\n }) {\n super(response.message);\n this.code = response.code;\n this.expoApiV2ErrorCode = response.code;\n this.expoApiV2ErrorDetails = response.details;\n this.expoApiV2ErrorServerStack = response.stack;\n this.expoApiV2ErrorMetadata = response.metadata;\n this.expoApiV2RequestId = response.requestId;\n }\n\n toString() {\n return `${super.toString()}${env.EXPO_DEBUG && this.expoApiV2RequestId ? ` (Request Id: ${this.expoApiV2RequestId})` : ''}`;\n }\n}\n\n/**\n * An Expo server error that didn't return the expected error JSON information.\n * The only 'expected' place for this is in testing, all other cases are bugs with the server.\n */\nexport class UnexpectedServerError extends Error {\n readonly name = 'UnexpectedServerError';\n}\n\n/**\n * An error defining that the server didn't return the expected error JSON information.\n * The only 'expected' place for this is in testing, all other cases are bugs with the client.\n */\nexport class UnexpectedServerData extends Error {\n readonly name = 'UnexpectedServerData';\n}\n\n/** Validate the response json contains `.data` property, or throw an unexpected server data error */\nexport function getResponseDataOrThrow<T = any>(json: unknown): T {\n if (!!json && typeof json === 'object' && 'data' in json) {\n return json.data as T;\n }\n\n throw new UnexpectedServerData(\n !!json && typeof json === 'object' ? JSON.stringify(json) : 'Unknown data received from server.'\n );\n}\n\n/**\n * @returns a `fetch` function that will inject user authentication information and handle errors from the Expo API.\n */\nexport function wrapFetchWithCredentials(fetchFunction: FetchLike): FetchLike {\n return async function fetchWithCredentials(url, options = {}) {\n if (Array.isArray(options.headers)) {\n throw new Error('request headers must be in object form');\n }\n\n const resolvedHeaders = options.headers ?? ({} as any);\n\n const token = getAccessToken();\n if (token) {\n resolvedHeaders.authorization = `Bearer ${token}`;\n } else {\n const sessionSecret = getSession()?.sessionSecret;\n if (sessionSecret) {\n resolvedHeaders['expo-session'] = sessionSecret;\n }\n }\n\n try {\n const response = await fetchFunction(url, {\n ...options,\n headers: resolvedHeaders,\n });\n\n // Handle expected API errors (4xx)\n if (response.status >= 400 && response.status < 500) {\n const body = await response.text();\n try {\n const data = JSON.parse(body);\n if (data?.errors?.length) {\n throw new ApiV2Error(data.errors[0]);\n }\n } catch (error: any) {\n // Server returned non-json response.\n if (error.message.includes('in JSON at position')) {\n throw new UnexpectedServerError(body);\n }\n throw error;\n }\n }\n\n return response;\n } catch (error: any) {\n // When running `expo start`, but wifi or internet has issues\n if (isNetworkError(error) || ('cause' in error && isNetworkError(error.cause))) {\n disableNetwork();\n\n throw new CommandError(\n 'OFFLINE',\n 'Network connection is unreliable. Try again with the environment variable `EXPO_OFFLINE=1` to skip network requests.'\n );\n }\n\n throw error;\n }\n };\n}\n\n/**\n * Determine if the provided error is related to a network issue.\n * When this returns true, offline mode should be enabled.\n * - `ENOTFOUND` is thrown when the DNS lookup failed\n * - `EAI_AGAIN` is thrown when DNS lookup failed due to a server-side error\n * - `UND_ERR_CONNECT_TIMEOUT` is thrown after DNS is resolved, but server can't be reached\n *\n * @see https://nodejs.org/api/errors.html\n * @see https://github.com/nodejs/undici#network-address-family-autoselection\n */\nfunction isNetworkError(error: Error & { code?: string }) {\n return (\n 'code' in error &&\n error.code &&\n ['ENOTFOUND', 'EAI_AGAIN', 'UND_ERR_CONNECT_TIMEOUT'].includes(error.code)\n );\n}\n\nconst fetchWithOffline = wrapFetchWithOffline(wrapFetchWithUserAgent(fetch));\n\nconst fetchWithBaseUrl = wrapFetchWithBaseUrl(fetchWithOffline, getExpoApiBaseUrl() + '/v2/');\n\nconst fetchWithCredentials = wrapFetchWithProgress(wrapFetchWithCredentials(fetchWithBaseUrl));\n\n/**\n * Create an instance of the fully qualified fetch command (auto authentication and api) but with caching in the '~/.expo' directory.\n * Caching is disabled automatically if the EXPO_NO_CACHE or EXPO_BETA environment variables are enabled.\n */\nexport function createCachedFetch({\n fetch = fetchWithCredentials,\n cacheDirectory,\n ttl,\n skipCache,\n}: {\n fetch?: FetchLike;\n cacheDirectory: string;\n ttl?: number;\n skipCache?: boolean;\n}): FetchLike {\n // Disable all caching in EXPO_BETA.\n if (skipCache || env.EXPO_BETA || env.EXPO_NO_CACHE) {\n return fetch;\n }\n\n const { FileSystemResponseCache } =\n require('./cache/FileSystemResponseCache') as typeof import('./cache/FileSystemResponseCache');\n\n return wrapFetchWithCache(\n fetch,\n new FileSystemResponseCache({\n cacheDirectory: path.join(getExpoHomeDirectory(), cacheDirectory),\n ttl,\n })\n );\n}\n\n/** Instance of fetch with automatic base URL pointing to the Expo API, user credential injection, and API error handling. Caching not included. */\nexport const fetchAsync = wrapFetchWithProgress(wrapFetchWithCredentials(fetchWithBaseUrl));\n"],"names":["ApiV2Error","UnexpectedServerData","UnexpectedServerError","createCachedFetch","fetchAsync","getResponseDataOrThrow","wrapFetchWithCredentials","Error","response","message","name","code","expoApiV2ErrorCode","expoApiV2ErrorDetails","details","expoApiV2ErrorServerStack","stack","expoApiV2ErrorMetadata","metadata","expoApiV2RequestId","requestId","toString","env","EXPO_DEBUG","json","data","JSON","stringify","fetchFunction","fetchWithCredentials","url","options","Array","isArray","headers","resolvedHeaders","token","getAccessToken","authorization","getSession","sessionSecret","status","body","text","parse","errors","length","error","includes","isNetworkError","cause","disableNetwork","CommandError","fetchWithOffline","wrapFetchWithOffline","wrapFetchWithUserAgent","fetch","fetchWithBaseUrl","wrapFetchWithBaseUrl","getExpoApiBaseUrl","wrapFetchWithProgress","cacheDirectory","ttl","skipCache","EXPO_BETA","EXPO_NO_CACHE","FileSystemResponseCache","require","wrapFetchWithCache","path","join","getExpoHomeDirectory"],"mappings":";;;;;;;;;;;QAgBaA;eAAAA;;QA2CAC;eAAAA;;QARAC;eAAAA;;QAgHGC;eAAAA;;QA6BHC;eAAAA;;QAhIGC;eAAAA;;QAaAC;eAAAA;;;;gEA5EC;;;;;;oCAEkB;sCAEE;sCACA;uCACC;wCACC;qBACnB;wBACS;uBACP;0BACY;0BACH;8BACkC;;;;;;AAE1D,MAAMN,mBAAmBO;IAS9B,YAAYC,QAOX,CAAE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IAAAA,4CAAqB,EAACtD,yBAAyBmD;AAMrE,SAAStD,kBAAkB,EAChCqD,QAAQ3B,oBAAoB,EAC5BgC,cAAc,EACdC,GAAG,EACHC,SAAS,EAMV;IACC,oCAAoC;IACpC,IAAIA,aAAazC,QAAG,CAAC0C,SAAS,IAAI1C,QAAG,CAAC2C,aAAa,EAAE;QACnD,OAAOT;IACT;IAEA,MAAM,EAAEU,uBAAuB,EAAE,GAC/BC,QAAQ;IAEV,OAAOC,IAAAA,sCAAkB,EACvBZ,OACA,IAAIU,wBAAwB;QAC1BL,gBAAgBQ,eAAI,CAACC,IAAI,CAACC,IAAAA,kCAAoB,KAAIV;QAClDC;IACF;AAEJ;AAGO,MAAM1D,aAAawD,IAAAA,4CAAqB,EAACtD,yBAAyBmD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/api/rest/wrapFetchWithBaseUrl.ts"],"sourcesContent":["import { URL } from 'url';\n\nimport { FetchLike } from './client.types';\n\n// const debug = require('debug')('expo:api:fetch:base') as typeof console.log;\n\n/**\n * Wrap a fetch function with support for a predefined base URL.\n * This implementation works like the browser fetch, applying the input to a prefix base URL.\n */\nexport function wrapFetchWithBaseUrl(fetch: FetchLike, baseUrl: string): FetchLike {\n // NOTE(EvanBacon): DO NOT RETURN AN ASYNC WRAPPER. THIS BREAKS LOADING INDICATORS.\n return (url, init) => {\n if (typeof url !== 'string') {\n throw new TypeError('Custom fetch function only accepts a string URL as the first parameter');\n }\n const parsed = new URL(url, baseUrl);\n if (init?.searchParams) {\n parsed.search = init.searchParams.toString();\n }\n return fetch(parsed.toString(), init);\n };\n}\n"],"names":["wrapFetchWithBaseUrl","fetch","baseUrl","url","init","TypeError","parsed","URL","searchParams","search","toString"],"mappings":";;;;+BAUgBA;;;eAAAA;;;;yBAVI;;;;;;AAUb,SAASA,qBAAqBC,KAAgB,EAAEC,OAAe;IACpE,mFAAmF;IACnF,OAAO,CAACC,KAAKC;QACX,IAAI,OAAOD,QAAQ,UAAU;YAC3B,MAAM,IAAIE,UAAU;QACtB;QACA,MAAMC,SAAS,IAAIC,CAAAA,MAAE,KAAC,CAACJ,KAAKD;QAC5B,IAAIE,wBAAAA,KAAMI,YAAY,EAAE;YACtBF,OAAOG,MAAM,GAAGL,KAAKI,YAAY,CAACE,QAAQ;QAC5C;QACA,OAAOT,MAAMK,OAAOI,QAAQ,IAAIN;IAClC;AACF"}
1
+ {"version":3,"sources":["../../../../src/api/rest/wrapFetchWithBaseUrl.ts"],"sourcesContent":["import { URL } from 'url';\n\nimport type { FetchLike } from './client.types';\n\n// const debug = require('debug')('expo:api:fetch:base') as typeof console.log;\n\n/**\n * Wrap a fetch function with support for a predefined base URL.\n * This implementation works like the browser fetch, applying the input to a prefix base URL.\n */\nexport function wrapFetchWithBaseUrl(fetch: FetchLike, baseUrl: string): FetchLike {\n // NOTE(EvanBacon): DO NOT RETURN AN ASYNC WRAPPER. THIS BREAKS LOADING INDICATORS.\n return (url, init) => {\n if (typeof url !== 'string') {\n throw new TypeError('Custom fetch function only accepts a string URL as the first parameter');\n }\n const parsed = new URL(url, baseUrl);\n if (init?.searchParams) {\n parsed.search = init.searchParams.toString();\n }\n return fetch(parsed.toString(), init);\n };\n}\n"],"names":["wrapFetchWithBaseUrl","fetch","baseUrl","url","init","TypeError","parsed","URL","searchParams","search","toString"],"mappings":";;;;+BAUgBA;;;eAAAA;;;;yBAVI;;;;;;AAUb,SAASA,qBAAqBC,KAAgB,EAAEC,OAAe;IACpE,mFAAmF;IACnF,OAAO,CAACC,KAAKC;QACX,IAAI,OAAOD,QAAQ,UAAU;YAC3B,MAAM,IAAIE,UAAU;QACtB;QACA,MAAMC,SAAS,IAAIC,CAAAA,MAAE,KAAC,CAACJ,KAAKD;QAC5B,IAAIE,wBAAAA,KAAMI,YAAY,EAAE;YACtBF,OAAOG,MAAM,GAAGL,KAAKI,YAAY,CAACE,QAAQ;QAC5C;QACA,OAAOT,MAAMK,OAAOI,QAAQ,IAAIN;IAClC;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/api/rest/wrapFetchWithOffline.ts"],"sourcesContent":["import { FetchLike } from './client.types';\nimport { env } from '../../utils/env';\n\nconst debug = require('debug')('expo:api:fetch:offline') as typeof console.log;\n\n/** Wrap fetch with support for `EXPO_OFFLINE` to disable network requests. */\nexport function wrapFetchWithOffline(fetchFunction: FetchLike): FetchLike {\n // NOTE(EvanBacon): DO NOT RETURN AN ASYNC WRAPPER. THIS BREAKS LOADING INDICATORS.\n return function fetchWithOffline(url, options = {}) {\n if (env.EXPO_OFFLINE) {\n debug('Skipping network request: ' + url);\n const abortController = new AbortController();\n abortController.abort();\n options.signal = abortController.signal;\n }\n return fetchFunction(url, options);\n };\n}\n"],"names":["wrapFetchWithOffline","debug","require","fetchFunction","fetchWithOffline","url","options","env","EXPO_OFFLINE","abortController","AbortController","abort","signal"],"mappings":";;;;+BAMgBA;;;eAAAA;;;qBALI;AAEpB,MAAMC,QAAQC,QAAQ,SAAS;AAGxB,SAASF,qBAAqBG,aAAwB;IAC3D,mFAAmF;IACnF,OAAO,SAASC,iBAAiBC,GAAG,EAAEC,UAAU,CAAC,CAAC;QAChD,IAAIC,QAAG,CAACC,YAAY,EAAE;YACpBP,MAAM,+BAA+BI;YACrC,MAAMI,kBAAkB,IAAIC;YAC5BD,gBAAgBE,KAAK;YACrBL,QAAQM,MAAM,GAAGH,gBAAgBG,MAAM;QACzC;QACA,OAAOT,cAAcE,KAAKC;IAC5B;AACF"}
1
+ {"version":3,"sources":["../../../../src/api/rest/wrapFetchWithOffline.ts"],"sourcesContent":["import type { FetchLike } from './client.types';\nimport { env } from '../../utils/env';\n\nconst debug = require('debug')('expo:api:fetch:offline') as typeof console.log;\n\n/** Wrap fetch with support for `EXPO_OFFLINE` to disable network requests. */\nexport function wrapFetchWithOffline(fetchFunction: FetchLike): FetchLike {\n // NOTE(EvanBacon): DO NOT RETURN AN ASYNC WRAPPER. THIS BREAKS LOADING INDICATORS.\n return function fetchWithOffline(url, options = {}) {\n if (env.EXPO_OFFLINE) {\n debug('Skipping network request: ' + url);\n const abortController = new AbortController();\n abortController.abort();\n options.signal = abortController.signal;\n }\n return fetchFunction(url, options);\n };\n}\n"],"names":["wrapFetchWithOffline","debug","require","fetchFunction","fetchWithOffline","url","options","env","EXPO_OFFLINE","abortController","AbortController","abort","signal"],"mappings":";;;;+BAMgBA;;;eAAAA;;;qBALI;AAEpB,MAAMC,QAAQC,QAAQ,SAAS;AAGxB,SAASF,qBAAqBG,aAAwB;IAC3D,mFAAmF;IACnF,OAAO,SAASC,iBAAiBC,GAAG,EAAEC,UAAU,CAAC,CAAC;QAChD,IAAIC,QAAG,CAACC,YAAY,EAAE;YACpBP,MAAM,+BAA+BI;YACrC,MAAMI,kBAAkB,IAAIC;YAC5BD,gBAAgBE,KAAK;YACrBL,QAAQM,MAAM,GAAGH,gBAAgBG,MAAM;QACzC;QACA,OAAOT,cAAcE,KAAKC;IAC5B;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/api/rest/wrapFetchWithProgress.ts"],"sourcesContent":["import { FetchLike } from './client.types';\nimport * as Log from '../../log';\n\nconst debug = require('debug')('expo:api:fetch:progress') as typeof console.log;\n\nexport function wrapFetchWithProgress(fetch: FetchLike): FetchLike {\n return function fetchWithProgress(url, init) {\n return fetch(url, init).then((response) => {\n const onProgress = init?.onProgress;\n\n // Abort if no `onProgress` is provided, the request failed, or there is no response body\n if (!onProgress || !response.ok || !response.body) {\n return response;\n }\n\n // Calculate total progress size\n const contentLength = response.headers.get('Content-Length');\n const progressTotal = Number(contentLength);\n\n debug(`Download size: %d`, progressTotal);\n\n // Abort if the `Content-Length` header is missing or invalid\n if (!progressTotal || isNaN(progressTotal) || progressTotal < 0) {\n Log.warn(\n 'Progress callback not supported for network request because \"Content-Length\" header missing or invalid in response from URL:',\n url.toString()\n );\n return response;\n }\n\n debug(`Starting progress animation for: %s`, url);\n\n // Initialize the progression variables\n let progressCurrent = 0;\n const progressUpdate = () => {\n const progress = progressCurrent / progressTotal || 0;\n onProgress({\n progress,\n total: progressTotal,\n loaded: progressCurrent,\n });\n };\n\n // Create a new body-wrapping stream that handles the progression methods\n const bodyReader = response.body.getReader();\n const bodyWithProgress = new ReadableStream({\n start(controller) {\n function next() {\n bodyReader.read().then(({ done, value }) => {\n // Close the controller once stream is done\n if (done) return controller.close();\n\n // Update the progression\n progressCurrent += Buffer.byteLength(value);\n progressUpdate();\n\n // Continue the stream, and read the next chunk\n controller.enqueue(value);\n next();\n });\n }\n\n progressUpdate();\n next();\n },\n });\n\n // Return the new response with the wrapped body stream\n return new Response(bodyWithProgress as any, response);\n });\n };\n}\n"],"names":["wrapFetchWithProgress","debug","require","fetch","fetchWithProgress","url","init","then","response","onProgress","ok","body","contentLength","headers","get","progressTotal","Number","isNaN","Log","warn","toString","progressCurrent","progressUpdate","progress","total","loaded","bodyReader","getReader","bodyWithProgress","ReadableStream","start","controller","next","read","done","value","close","Buffer","byteLength","enqueue","Response"],"mappings":";;;;+BAKgBA;;;eAAAA;;;6DAJK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAErB,MAAMC,QAAQC,QAAQ,SAAS;AAExB,SAASF,sBAAsBG,KAAgB;IACpD,OAAO,SAASC,kBAAkBC,GAAG,EAAEC,IAAI;QACzC,OAAOH,MAAME,KAAKC,MAAMC,IAAI,CAAC,CAACC;YAC5B,MAAMC,aAAaH,wBAAAA,KAAMG,UAAU;YAEnC,yFAAyF;YACzF,IAAI,CAACA,cAAc,CAACD,SAASE,EAAE,IAAI,CAACF,SAASG,IAAI,EAAE;gBACjD,OAAOH;YACT;YAEA,gCAAgC;YAChC,MAAMI,gBAAgBJ,SAASK,OAAO,CAACC,GAAG,CAAC;YAC3C,MAAMC,gBAAgBC,OAAOJ;YAE7BX,MAAM,CAAC,iBAAiB,CAAC,EAAEc;YAE3B,6DAA6D;YAC7D,IAAI,CAACA,iBAAiBE,MAAMF,kBAAkBA,gBAAgB,GAAG;gBAC/DG,KAAIC,IAAI,CACN,gIACAd,IAAIe,QAAQ;gBAEd,OAAOZ;YACT;YAEAP,MAAM,CAAC,mCAAmC,CAAC,EAAEI;YAE7C,uCAAuC;YACvC,IAAIgB,kBAAkB;YACtB,MAAMC,iBAAiB;gBACrB,MAAMC,WAAWF,kBAAkBN,iBAAiB;gBACpDN,WAAW;oBACTc;oBACAC,OAAOT;oBACPU,QAAQJ;gBACV;YACF;YAEA,yEAAyE;YACzE,MAAMK,aAAalB,SAASG,IAAI,CAACgB,SAAS;YAC1C,MAAMC,mBAAmB,IAAIC,eAAe;gBAC1CC,OAAMC,UAAU;oBACd,SAASC;wBACPN,WAAWO,IAAI,GAAG1B,IAAI,CAAC,CAAC,EAAE2B,IAAI,EAAEC,KAAK,EAAE;4BACrC,2CAA2C;4BAC3C,IAAID,MAAM,OAAOH,WAAWK,KAAK;4BAEjC,yBAAyB;4BACzBf,mBAAmBgB,OAAOC,UAAU,CAACH;4BACrCb;4BAEA,+CAA+C;4BAC/CS,WAAWQ,OAAO,CAACJ;4BACnBH;wBACF;oBACF;oBAEAV;oBACAU;gBACF;YACF;YAEA,uDAAuD;YACvD,OAAO,IAAIQ,SAASZ,kBAAyBpB;QAC/C;IACF;AACF"}
1
+ {"version":3,"sources":["../../../../src/api/rest/wrapFetchWithProgress.ts"],"sourcesContent":["import type { FetchLike } from './client.types';\nimport * as Log from '../../log';\n\nconst debug = require('debug')('expo:api:fetch:progress') as typeof console.log;\n\nexport function wrapFetchWithProgress(fetch: FetchLike): FetchLike {\n return function fetchWithProgress(url, init) {\n return fetch(url, init).then((response) => {\n const onProgress = init?.onProgress;\n\n // Abort if no `onProgress` is provided, the request failed, or there is no response body\n if (!onProgress || !response.ok || !response.body) {\n return response;\n }\n\n // Calculate total progress size\n const contentLength = response.headers.get('Content-Length');\n const progressTotal = Number(contentLength);\n\n debug(`Download size: %d`, progressTotal);\n\n // Abort if the `Content-Length` header is missing or invalid\n if (!progressTotal || isNaN(progressTotal) || progressTotal < 0) {\n Log.warn(\n 'Progress callback not supported for network request because \"Content-Length\" header missing or invalid in response from URL:',\n url.toString()\n );\n return response;\n }\n\n debug(`Starting progress animation for: %s`, url);\n\n // Initialize the progression variables\n let progressCurrent = 0;\n const progressUpdate = () => {\n const progress = progressCurrent / progressTotal || 0;\n onProgress({\n progress,\n total: progressTotal,\n loaded: progressCurrent,\n });\n };\n\n // Create a new body-wrapping stream that handles the progression methods\n const bodyReader = response.body.getReader();\n const bodyWithProgress = new ReadableStream({\n start(controller) {\n function next() {\n bodyReader.read().then(({ done, value }) => {\n // Close the controller once stream is done\n if (done) return controller.close();\n\n // Update the progression\n progressCurrent += Buffer.byteLength(value);\n progressUpdate();\n\n // Continue the stream, and read the next chunk\n controller.enqueue(value);\n next();\n });\n }\n\n progressUpdate();\n next();\n },\n });\n\n // Return the new response with the wrapped body stream\n return new Response(bodyWithProgress as any, response);\n });\n };\n}\n"],"names":["wrapFetchWithProgress","debug","require","fetch","fetchWithProgress","url","init","then","response","onProgress","ok","body","contentLength","headers","get","progressTotal","Number","isNaN","Log","warn","toString","progressCurrent","progressUpdate","progress","total","loaded","bodyReader","getReader","bodyWithProgress","ReadableStream","start","controller","next","read","done","value","close","Buffer","byteLength","enqueue","Response"],"mappings":";;;;+BAKgBA;;;eAAAA;;;6DAJK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAErB,MAAMC,QAAQC,QAAQ,SAAS;AAExB,SAASF,sBAAsBG,KAAgB;IACpD,OAAO,SAASC,kBAAkBC,GAAG,EAAEC,IAAI;QACzC,OAAOH,MAAME,KAAKC,MAAMC,IAAI,CAAC,CAACC;YAC5B,MAAMC,aAAaH,wBAAAA,KAAMG,UAAU;YAEnC,yFAAyF;YACzF,IAAI,CAACA,cAAc,CAACD,SAASE,EAAE,IAAI,CAACF,SAASG,IAAI,EAAE;gBACjD,OAAOH;YACT;YAEA,gCAAgC;YAChC,MAAMI,gBAAgBJ,SAASK,OAAO,CAACC,GAAG,CAAC;YAC3C,MAAMC,gBAAgBC,OAAOJ;YAE7BX,MAAM,CAAC,iBAAiB,CAAC,EAAEc;YAE3B,6DAA6D;YAC7D,IAAI,CAACA,iBAAiBE,MAAMF,kBAAkBA,gBAAgB,GAAG;gBAC/DG,KAAIC,IAAI,CACN,gIACAd,IAAIe,QAAQ;gBAEd,OAAOZ;YACT;YAEAP,MAAM,CAAC,mCAAmC,CAAC,EAAEI;YAE7C,uCAAuC;YACvC,IAAIgB,kBAAkB;YACtB,MAAMC,iBAAiB;gBACrB,MAAMC,WAAWF,kBAAkBN,iBAAiB;gBACpDN,WAAW;oBACTc;oBACAC,OAAOT;oBACPU,QAAQJ;gBACV;YACF;YAEA,yEAAyE;YACzE,MAAMK,aAAalB,SAASG,IAAI,CAACgB,SAAS;YAC1C,MAAMC,mBAAmB,IAAIC,eAAe;gBAC1CC,OAAMC,UAAU;oBACd,SAASC;wBACPN,WAAWO,IAAI,GAAG1B,IAAI,CAAC,CAAC,EAAE2B,IAAI,EAAEC,KAAK,EAAE;4BACrC,2CAA2C;4BAC3C,IAAID,MAAM,OAAOH,WAAWK,KAAK;4BAEjC,yBAAyB;4BACzBf,mBAAmBgB,OAAOC,UAAU,CAACH;4BACrCb;4BAEA,+CAA+C;4BAC/CS,WAAWQ,OAAO,CAACJ;4BACnBH;wBACF;oBACF;oBAEAV;oBACAU;gBACF;YACF;YAEA,uDAAuD;YACvD,OAAO,IAAIQ,SAASZ,kBAAyBpB;QAC/C;IACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/api/rest/wrapFetchWithUserAgent.ts"],"sourcesContent":["import process from 'node:process';\n\nimport { FetchLike } from './client.types';\nimport { Headers } from '../../utils/fetch';\n\nexport function wrapFetchWithUserAgent(fetch: FetchLike): FetchLike {\n return (url, init = {}) => {\n const headers = new Headers(init.headers);\n // Version is added in the build script\n headers.append('User-Agent', `expo-cli/${process.env.__EXPO_VERSION}`);\n init.headers = headers;\n return fetch(url, init);\n };\n}\n"],"names":["wrapFetchWithUserAgent","fetch","url","init","headers","Headers","append","process","env","__EXPO_VERSION"],"mappings":";;;;+BAKgBA;;;eAAAA;;;;gEALI;;;;;;uBAGI;;;;;;AAEjB,SAASA,uBAAuBC,KAAgB;IACrD,OAAO,CAACC,KAAKC,OAAO,CAAC,CAAC;QACpB,MAAMC,UAAU,IAAIC,cAAO,CAACF,KAAKC,OAAO;QACxC,uCAAuC;QACvCA,QAAQE,MAAM,CAAC,cAAc,CAAC,SAAS,EAAEC,sBAAO,CAACC,GAAG,CAACC,cAAc,EAAE;QACrEN,KAAKC,OAAO,GAAGA;QACf,OAAOH,MAAMC,KAAKC;IACpB;AACF"}
1
+ {"version":3,"sources":["../../../../src/api/rest/wrapFetchWithUserAgent.ts"],"sourcesContent":["import process from 'node:process';\n\nimport type { FetchLike } from './client.types';\nimport { Headers } from '../../utils/fetch';\n\nexport function wrapFetchWithUserAgent(fetch: FetchLike): FetchLike {\n return (url, init = {}) => {\n const headers = new Headers(init.headers);\n // Version is added in the build script\n headers.append('User-Agent', `expo-cli/${process.env.__EXPO_VERSION}`);\n init.headers = headers;\n return fetch(url, init);\n };\n}\n"],"names":["wrapFetchWithUserAgent","fetch","url","init","headers","Headers","append","process","env","__EXPO_VERSION"],"mappings":";;;;+BAKgBA;;;eAAAA;;;;gEALI;;;;;;uBAGI;;;;;;AAEjB,SAASA,uBAAuBC,KAAgB;IACrD,OAAO,CAACC,KAAKC,OAAO,CAAC,CAAC;QACpB,MAAMC,UAAU,IAAIC,cAAO,CAACF,KAAKC,OAAO;QACxC,uCAAuC;QACvCA,QAAQE,MAAM,CAAC,cAAc,CAAC,SAAS,EAAEC,sBAAO,CAACC,GAAG,CAACC,cAAc,EAAE;QACrEN,KAAKC,OAAO,GAAGA;QACf,OAAOH,MAAMC,KAAKC;IACpB;AACF"}