@depup/expo__cli 55.0.23-depup.0 → 57.0.9-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (594) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +13 -15
  3. package/build/bin/cli +4 -4
  4. package/build/bin/cli.map +1 -1
  5. package/build/src/api/endpoint.js +4 -4
  6. package/build/src/api/endpoint.js.map +1 -1
  7. package/build/src/api/getExpoSchema.js +3 -3
  8. package/build/src/api/getExpoSchema.js.map +1 -1
  9. package/build/src/api/graphql/client.js +26 -14
  10. package/build/src/api/graphql/client.js.map +1 -1
  11. package/build/src/api/graphql/mutations/TunnelMutation.js +31 -0
  12. package/build/src/api/graphql/mutations/TunnelMutation.js.map +1 -0
  13. package/build/src/api/rest/cache/FileSystemResponseCache.js.map +1 -1
  14. package/build/src/api/rest/cache/ResponseCache.js +5 -5
  15. package/build/src/api/rest/cache/ResponseCache.js.map +1 -1
  16. package/build/src/api/rest/client.js +35 -20
  17. package/build/src/api/rest/client.js.map +1 -1
  18. package/build/src/api/rest/wrapFetchWithBaseUrl.js.map +1 -1
  19. package/build/src/api/rest/wrapFetchWithOffline.js.map +1 -1
  20. package/build/src/api/rest/wrapFetchWithProgress.js.map +1 -1
  21. package/build/src/api/rest/wrapFetchWithUserAgent.js.map +1 -1
  22. package/build/src/api/updateDevelopmentSession.js +6 -5
  23. package/build/src/api/updateDevelopmentSession.js.map +1 -1
  24. package/build/src/api/user/UserSettings.js +28 -15
  25. package/build/src/api/user/UserSettings.js.map +1 -1
  26. package/build/src/api/user/actions.js +10 -3
  27. package/build/src/api/user/actions.js.map +1 -1
  28. package/build/src/api/user/expoSsoLauncher.js +76 -24
  29. package/build/src/api/user/expoSsoLauncher.js.map +1 -1
  30. package/build/src/api/user/otp.js +4 -4
  31. package/build/src/api/user/otp.js.map +1 -1
  32. package/build/src/api/user/user.js +19 -7
  33. package/build/src/api/user/user.js.map +1 -1
  34. package/build/src/config/configAsync.js +3 -3
  35. package/build/src/config/configAsync.js.map +1 -1
  36. package/build/src/config/index.js.map +1 -1
  37. package/build/src/customize/customizeAsync.js.map +1 -1
  38. package/build/src/customize/generate.js +7 -4
  39. package/build/src/customize/generate.js.map +1 -1
  40. package/build/src/customize/index.js.map +1 -1
  41. package/build/src/customize/templates.js +4 -6
  42. package/build/src/customize/templates.js.map +1 -1
  43. package/build/src/customize/typescript.js.map +1 -1
  44. package/build/src/events/index.js +19 -15
  45. package/build/src/events/index.js.map +1 -1
  46. package/build/src/events/stream.js +94 -24
  47. package/build/src/events/stream.js.map +1 -1
  48. package/build/src/expoUpdatesExports.js +4 -4
  49. package/build/src/expoUpdatesExports.js.map +1 -1
  50. package/build/src/export/createMetadataJson.js +2 -1
  51. package/build/src/export/createMetadataJson.js.map +1 -1
  52. package/build/src/export/embed/exportEmbedAsync.js +45 -20
  53. package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
  54. package/build/src/export/embed/exportServer.js +1 -1
  55. package/build/src/export/embed/exportServer.js.map +1 -1
  56. package/build/src/export/embed/index.js.map +1 -1
  57. package/build/src/export/embed/resolveOptions.js +7 -6
  58. package/build/src/export/embed/resolveOptions.js.map +1 -1
  59. package/build/src/export/embed/xcodeCompilerLogger.js +7 -7
  60. package/build/src/export/embed/xcodeCompilerLogger.js.map +1 -1
  61. package/build/src/export/exportApp.js +32 -28
  62. package/build/src/export/exportApp.js.map +1 -1
  63. package/build/src/export/exportAssets.js +5 -5
  64. package/build/src/export/exportAssets.js.map +1 -1
  65. package/build/src/export/exportAsync.js.map +1 -1
  66. package/build/src/export/exportDomComponents.js +5 -5
  67. package/build/src/export/exportDomComponents.js.map +1 -1
  68. package/build/src/export/exportHermes.js +23 -13
  69. package/build/src/export/exportHermes.js.map +1 -1
  70. package/build/src/export/exportStaticAsync.js +30 -21
  71. package/build/src/export/exportStaticAsync.js.map +1 -1
  72. package/build/src/export/favicon.js +26 -34
  73. package/build/src/export/favicon.js.map +1 -1
  74. package/build/src/export/getPublicExpoManifest.js.map +1 -1
  75. package/build/src/export/getResolvedLocales.js.map +1 -1
  76. package/build/src/export/html.js +3 -3
  77. package/build/src/export/html.js.map +1 -1
  78. package/build/src/export/index.js +2 -0
  79. package/build/src/export/index.js.map +1 -1
  80. package/build/src/export/metroAssetLocalPath.js +4 -4
  81. package/build/src/export/metroAssetLocalPath.js.map +1 -1
  82. package/build/src/export/persistMetroAssets.js +6 -6
  83. package/build/src/export/persistMetroAssets.js.map +1 -1
  84. package/build/src/export/publicFolder.js +16 -4
  85. package/build/src/export/publicFolder.js.map +1 -1
  86. package/build/src/export/resolveOptions.js +12 -13
  87. package/build/src/export/resolveOptions.js.map +1 -1
  88. package/build/src/export/saveAssets.js +3 -3
  89. package/build/src/export/saveAssets.js.map +1 -1
  90. package/build/src/export/static.js +6 -0
  91. package/build/src/export/static.js.map +1 -0
  92. package/build/src/export/web/exportWebAsync.js.map +1 -1
  93. package/build/src/export/web/index.js.map +1 -1
  94. package/build/src/export/writeContents.js.map +1 -1
  95. package/build/src/install/checkPackages.js +1 -28
  96. package/build/src/install/checkPackages.js.map +1 -1
  97. package/build/src/install/fixPackages.js.map +1 -1
  98. package/build/src/install/index.js.map +1 -1
  99. package/build/src/install/installAsync.js +3 -3
  100. package/build/src/install/installAsync.js.map +1 -1
  101. package/build/src/install/installExpoPackage.js.map +1 -1
  102. package/build/src/install/resolveOptions.js.map +1 -1
  103. package/build/src/install/utils/autoAddConfigPlugins.js +3 -3
  104. package/build/src/install/utils/autoAddConfigPlugins.js.map +1 -1
  105. package/build/src/install/utils/checkPackagesCompatibility.js +32 -16
  106. package/build/src/install/utils/checkPackagesCompatibility.js.map +1 -1
  107. package/build/src/lint/ESlintPrerequisite.js.map +1 -1
  108. package/build/src/log.js +32 -14
  109. package/build/src/log.js.map +1 -1
  110. package/build/src/login/index.js +25 -5
  111. package/build/src/login/index.js.map +1 -1
  112. package/build/src/logout/index.js.map +1 -1
  113. package/build/src/prebuild/clearNativeFolder.js +49 -14
  114. package/build/src/prebuild/clearNativeFolder.js.map +1 -1
  115. package/build/src/prebuild/configureProjectAsync.js.map +1 -1
  116. package/build/src/prebuild/copyTemplateFiles.js +3 -3
  117. package/build/src/prebuild/copyTemplateFiles.js.map +1 -1
  118. package/build/src/prebuild/ensureConfigAsync.js.map +1 -1
  119. package/build/src/prebuild/index.js +3 -2
  120. package/build/src/prebuild/index.js.map +1 -1
  121. package/build/src/prebuild/prebuildAsync.js +31 -6
  122. package/build/src/prebuild/prebuildAsync.js.map +1 -1
  123. package/build/src/prebuild/renameTemplateAppName.js +8 -5
  124. package/build/src/prebuild/renameTemplateAppName.js.map +1 -1
  125. package/build/src/prebuild/resolveOptions.js +7 -7
  126. package/build/src/prebuild/resolveOptions.js.map +1 -1
  127. package/build/src/prebuild/resolveTemplate.js +10 -5
  128. package/build/src/prebuild/resolveTemplate.js.map +1 -1
  129. package/build/src/prebuild/updateFromTemplate.js +3 -3
  130. package/build/src/prebuild/updateFromTemplate.js.map +1 -1
  131. package/build/src/prebuild/updatePackageJson.js +7 -7
  132. package/build/src/prebuild/updatePackageJson.js.map +1 -1
  133. package/build/src/prebuild/validateTemplatePlatforms.js.map +1 -1
  134. package/build/src/register/index.js.map +1 -1
  135. package/build/src/run/android/index.js.map +1 -1
  136. package/build/src/run/android/resolveGradlePropsAsync.js +3 -4
  137. package/build/src/run/android/resolveGradlePropsAsync.js.map +1 -1
  138. package/build/src/run/android/resolveInstallApkName.js +48 -1
  139. package/build/src/run/android/resolveInstallApkName.js.map +1 -1
  140. package/build/src/run/android/resolveLaunchProps.js +4 -1
  141. package/build/src/run/android/resolveLaunchProps.js.map +1 -1
  142. package/build/src/run/android/resolveOptions.js.map +1 -1
  143. package/build/src/run/android/runAndroidAsync.js.map +1 -1
  144. package/build/src/run/ensureNativeProject.js.map +1 -1
  145. package/build/src/run/hints.js +4 -4
  146. package/build/src/run/hints.js.map +1 -1
  147. package/build/src/run/index.js.map +1 -1
  148. package/build/src/run/ios/XcodeBuild.js +163 -23
  149. package/build/src/run/ios/XcodeBuild.js.map +1 -1
  150. package/build/src/run/ios/appleDevice/AppleDevice.js +6 -5
  151. package/build/src/run/ios/appleDevice/AppleDevice.js.map +1 -1
  152. package/build/src/run/ios/appleDevice/ClientManager.js.map +1 -1
  153. package/build/src/run/ios/appleDevice/client/AFCClient.js +10 -16
  154. package/build/src/run/ios/appleDevice/client/AFCClient.js.map +1 -1
  155. package/build/src/run/ios/appleDevice/client/DebugserverClient.js +1 -1
  156. package/build/src/run/ios/appleDevice/client/DebugserverClient.js.map +1 -1
  157. package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js +2 -1
  158. package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js.map +1 -1
  159. package/build/src/run/ios/appleDevice/client/LockdowndClient.js +1 -1
  160. package/build/src/run/ios/appleDevice/client/LockdowndClient.js.map +1 -1
  161. package/build/src/run/ios/appleDevice/client/MobileImageMounterClient.js.map +1 -1
  162. package/build/src/run/ios/appleDevice/client/ServiceClient.js +3 -3
  163. package/build/src/run/ios/appleDevice/client/ServiceClient.js.map +1 -1
  164. package/build/src/run/ios/appleDevice/client/UsbmuxdClient.js.map +1 -1
  165. package/build/src/run/ios/appleDevice/installOnDeviceAsync.js +3 -3
  166. package/build/src/run/ios/appleDevice/installOnDeviceAsync.js.map +1 -1
  167. package/build/src/run/ios/appleDevice/protocol/AFCProtocol.js +16 -13
  168. package/build/src/run/ios/appleDevice/protocol/AFCProtocol.js.map +1 -1
  169. package/build/src/run/ios/appleDevice/protocol/AbstractProtocol.js +6 -6
  170. package/build/src/run/ios/appleDevice/protocol/AbstractProtocol.js.map +1 -1
  171. package/build/src/run/ios/appleDevice/protocol/GDBProtocol.js +5 -5
  172. package/build/src/run/ios/appleDevice/protocol/GDBProtocol.js.map +1 -1
  173. package/build/src/run/ios/appleDevice/protocol/LockdownProtocol.js +7 -7
  174. package/build/src/run/ios/appleDevice/protocol/LockdownProtocol.js.map +1 -1
  175. package/build/src/run/ios/appleDevice/protocol/UsbmuxProtocol.js +5 -5
  176. package/build/src/run/ios/appleDevice/protocol/UsbmuxProtocol.js.map +1 -1
  177. package/build/src/run/ios/codeSigning/Security.js +8 -8
  178. package/build/src/run/ios/codeSigning/Security.js.map +1 -1
  179. package/build/src/run/ios/codeSigning/configureCodeSigning.js +5 -3
  180. package/build/src/run/ios/codeSigning/configureCodeSigning.js.map +1 -1
  181. package/build/src/run/ios/codeSigning/resolveCertificateSigningIdentity.js +7 -5
  182. package/build/src/run/ios/codeSigning/resolveCertificateSigningIdentity.js.map +1 -1
  183. package/build/src/run/ios/codeSigning/settings.js +3 -3
  184. package/build/src/run/ios/codeSigning/settings.js.map +1 -1
  185. package/build/src/run/ios/codeSigning/xcodeCodeSigning.js +4 -4
  186. package/build/src/run/ios/codeSigning/xcodeCodeSigning.js.map +1 -1
  187. package/build/src/run/ios/index.js +8 -1
  188. package/build/src/run/ios/index.js.map +1 -1
  189. package/build/src/run/ios/launchApp.js +3 -3
  190. package/build/src/run/ios/launchApp.js.map +1 -1
  191. package/build/src/run/ios/options/appleDestinations.js.map +1 -1
  192. package/build/src/run/ios/options/promptDevice.js +3 -3
  193. package/build/src/run/ios/options/promptDevice.js.map +1 -1
  194. package/build/src/run/ios/options/resolveDevice.js +8 -3
  195. package/build/src/run/ios/options/resolveDevice.js.map +1 -1
  196. package/build/src/run/ios/options/resolveNativeScheme.js +4 -4
  197. package/build/src/run/ios/options/resolveNativeScheme.js.map +1 -1
  198. package/build/src/run/ios/options/resolveOptions.js +9 -4
  199. package/build/src/run/ios/options/resolveOptions.js.map +1 -1
  200. package/build/src/run/ios/options/resolveXcodeProject.js.map +1 -1
  201. package/build/src/run/ios/runIosAsync.js +39 -0
  202. package/build/src/run/ios/runIosAsync.js.map +1 -1
  203. package/build/src/run/ios/validateExternalBinary.js.map +1 -1
  204. package/build/src/run/startBundler.js +4 -0
  205. package/build/src/run/startBundler.js.map +1 -1
  206. package/build/src/serve/index.js +4 -1
  207. package/build/src/serve/index.js.map +1 -1
  208. package/build/src/serve/serveAsync.js +23 -11
  209. package/build/src/serve/serveAsync.js.map +1 -1
  210. package/build/src/serve/static.js +69 -0
  211. package/build/src/serve/static.js.map +1 -0
  212. package/build/src/start/checkDependenciesOnStart.js +131 -0
  213. package/build/src/start/checkDependenciesOnStart.js.map +1 -0
  214. package/build/src/start/detectDevClient.js +3 -3
  215. package/build/src/start/detectDevClient.js.map +1 -1
  216. package/build/src/start/doctor/Prerequisite.js +4 -4
  217. package/build/src/start/doctor/Prerequisite.js.map +1 -1
  218. package/build/src/start/doctor/apple/SimulatorAppPrerequisite.js +53 -91
  219. package/build/src/start/doctor/apple/SimulatorAppPrerequisite.js.map +1 -1
  220. package/build/src/start/doctor/apple/XcodePrerequisite.js +3 -3
  221. package/build/src/start/doctor/apple/XcodePrerequisite.js.map +1 -1
  222. package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js +3 -3
  223. package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js.map +1 -1
  224. package/build/src/start/doctor/dependencies/getMissingPackages.js +5 -5
  225. package/build/src/start/doctor/dependencies/getMissingPackages.js.map +1 -1
  226. package/build/src/start/doctor/dependencies/getVersionedPackages.js +5 -5
  227. package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
  228. package/build/src/start/doctor/dependencies/reactNativeTv.js +149 -0
  229. package/build/src/start/doctor/dependencies/reactNativeTv.js.map +1 -0
  230. package/build/src/start/doctor/dependencies/resolvePackages.js +4 -4
  231. package/build/src/start/doctor/dependencies/resolvePackages.js.map +1 -1
  232. package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +33 -8
  233. package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -1
  234. package/build/src/start/doctor/ngrok/ExternalModule.js +3 -3
  235. package/build/src/start/doctor/ngrok/ExternalModule.js.map +1 -1
  236. package/build/src/start/doctor/ngrok/NgrokResolver.js +3 -3
  237. package/build/src/start/doctor/ngrok/NgrokResolver.js.map +1 -1
  238. package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js.map +1 -1
  239. package/build/src/start/doctor/typescript/updateTSConfig.js +3 -3
  240. package/build/src/start/doctor/typescript/updateTSConfig.js.map +1 -1
  241. package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js +5 -12
  242. package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js.map +1 -1
  243. package/build/src/start/index.js +2 -0
  244. package/build/src/start/index.js.map +1 -1
  245. package/build/src/start/interface/KeyPressHandler.js.map +1 -1
  246. package/build/src/start/interface/cliExtensionMenuItemHandler.js.map +1 -1
  247. package/build/src/start/interface/commandsTable.js +6 -6
  248. package/build/src/start/interface/commandsTable.js.map +1 -1
  249. package/build/src/start/interface/createDevToolsMenuItems.js.map +1 -1
  250. package/build/src/start/interface/interactiveActions.js +49 -6
  251. package/build/src/start/interface/interactiveActions.js.map +1 -1
  252. package/build/src/start/interface/startInterface.js +13 -4
  253. package/build/src/start/interface/startInterface.js.map +1 -1
  254. package/build/src/start/platforms/AppIdResolver.js +4 -0
  255. package/build/src/start/platforms/AppIdResolver.js.map +1 -1
  256. package/build/src/start/platforms/DeviceManager.js.map +1 -1
  257. package/build/src/start/platforms/ExpoGoInstaller.js +13 -4
  258. package/build/src/start/platforms/ExpoGoInstaller.js.map +1 -1
  259. package/build/src/start/platforms/PlatformManager.js.map +1 -1
  260. package/build/src/start/platforms/android/AndroidAppIdResolver.js.map +1 -1
  261. package/build/src/start/platforms/android/AndroidDeviceManager.js.map +1 -1
  262. package/build/src/start/platforms/android/AndroidPlatformManager.js.map +1 -1
  263. package/build/src/start/platforms/android/activateWindow.js.map +1 -1
  264. package/build/src/start/platforms/android/adb.js +36 -34
  265. package/build/src/start/platforms/android/adb.js.map +1 -1
  266. package/build/src/start/platforms/android/adbReverse.js +4 -4
  267. package/build/src/start/platforms/android/adbReverse.js.map +1 -1
  268. package/build/src/start/platforms/android/emulator.js +5 -5
  269. package/build/src/start/platforms/android/emulator.js.map +1 -1
  270. package/build/src/start/platforms/android/getDevices.js.map +1 -1
  271. package/build/src/start/platforms/android/gradle.js +5 -5
  272. package/build/src/start/platforms/android/gradle.js.map +1 -1
  273. package/build/src/start/platforms/android/promptAndroidDevice.js +3 -3
  274. package/build/src/start/platforms/android/promptAndroidDevice.js.map +1 -1
  275. package/build/src/start/platforms/ios/AppleAppIdResolver.js.map +1 -1
  276. package/build/src/start/platforms/ios/AppleDeviceManager.js +20 -6
  277. package/build/src/start/platforms/ios/AppleDeviceManager.js.map +1 -1
  278. package/build/src/start/platforms/ios/ApplePlatformManager.js +11 -0
  279. package/build/src/start/platforms/ios/ApplePlatformManager.js.map +1 -1
  280. package/build/src/start/platforms/ios/devicectl.js +7 -7
  281. package/build/src/start/platforms/ios/devicectl.js.map +1 -1
  282. package/build/src/start/platforms/ios/ensureSimulatorAppRunning.js +26 -11
  283. package/build/src/start/platforms/ios/ensureSimulatorAppRunning.js.map +1 -1
  284. package/build/src/start/platforms/ios/getBestSimulator.js +5 -5
  285. package/build/src/start/platforms/ios/getBestSimulator.js.map +1 -1
  286. package/build/src/start/platforms/ios/promptAppleDevice.js +5 -4
  287. package/build/src/start/platforms/ios/promptAppleDevice.js.map +1 -1
  288. package/build/src/start/platforms/ios/simctl.js +25 -19
  289. package/build/src/start/platforms/ios/simctl.js.map +1 -1
  290. package/build/src/start/platforms/ios/simctlLogging.js +3 -3
  291. package/build/src/start/platforms/ios/simctlLogging.js.map +1 -1
  292. package/build/src/start/platforms/ios/xcrun.js +3 -3
  293. package/build/src/start/platforms/ios/xcrun.js.map +1 -1
  294. package/build/src/start/project/devices.js +6 -6
  295. package/build/src/start/project/devices.js.map +1 -1
  296. package/build/src/start/project/dotExpo.js +4 -3
  297. package/build/src/start/project/dotExpo.js.map +1 -1
  298. package/build/src/start/resolveOptions.js +7 -7
  299. package/build/src/start/resolveOptions.js.map +1 -1
  300. package/build/src/start/server/AsyncNgrok.js +1 -1
  301. package/build/src/start/server/AsyncNgrok.js.map +1 -1
  302. package/build/src/start/server/AsyncWsTunnel.js +120 -35
  303. package/build/src/start/server/AsyncWsTunnel.js.map +1 -1
  304. package/build/src/start/server/Bonjour.js +8 -3
  305. package/build/src/start/server/Bonjour.js.map +1 -1
  306. package/build/src/start/server/BundlerDevServer.js +23 -9
  307. package/build/src/start/server/BundlerDevServer.js.map +1 -1
  308. package/build/src/start/server/DevServerManager.js.map +1 -1
  309. package/build/src/start/server/DevToolsPlugin.js +63 -3
  310. package/build/src/start/server/DevToolsPlugin.js.map +1 -1
  311. package/build/src/start/server/DevToolsPlugin.schema.js +8 -3
  312. package/build/src/start/server/DevToolsPlugin.schema.js.map +1 -1
  313. package/build/src/start/server/DevToolsPluginCliExtensionExecutor.js +58 -23
  314. package/build/src/start/server/DevToolsPluginCliExtensionExecutor.js.map +1 -1
  315. package/build/src/start/server/DevToolsPluginCliExtensionResults.js +29 -0
  316. package/build/src/start/server/DevToolsPluginCliExtensionResults.js.map +1 -1
  317. package/build/src/start/server/DevToolsPluginManager.js +20 -6
  318. package/build/src/start/server/DevToolsPluginManager.js.map +1 -1
  319. package/build/src/start/server/DevToolsPluginServerHelpers.js +83 -0
  320. package/build/src/start/server/DevToolsPluginServerHelpers.js.map +1 -0
  321. package/build/src/start/server/DevelopmentSession.js +41 -24
  322. package/build/src/start/server/DevelopmentSession.js.map +1 -1
  323. package/build/src/start/server/MCP.js +10 -3
  324. package/build/src/start/server/MCP.js.map +1 -1
  325. package/build/src/start/server/MCPDevToolsPluginCLIExtensions.js +15 -5
  326. package/build/src/start/server/MCPDevToolsPluginCLIExtensions.js.map +1 -1
  327. package/build/src/start/server/UrlCreator.js +14 -1
  328. package/build/src/start/server/UrlCreator.js.map +1 -1
  329. package/build/src/start/server/createMCPDevToolsExtensionSchema.js +18 -4
  330. package/build/src/start/server/createMCPDevToolsExtensionSchema.js.map +1 -1
  331. package/build/src/start/server/getStaticRenderFunctions.js +13 -24
  332. package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
  333. package/build/src/start/server/metro/MetroBundlerDevServer.js +239 -108
  334. package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
  335. package/build/src/start/server/metro/MetroTerminalReporter.js +67 -16
  336. package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
  337. package/build/src/start/server/metro/TerminalReporter.js +22 -4
  338. package/build/src/start/server/metro/TerminalReporter.js.map +1 -1
  339. package/build/src/start/server/metro/createExpoAutolinkingResolver.js +25 -12
  340. package/build/src/start/server/metro/createExpoAutolinkingResolver.js.map +1 -1
  341. package/build/src/start/server/metro/createExpoFallbackResolver.js.map +1 -1
  342. package/build/src/start/server/metro/createFileMap-fork.js +196 -0
  343. package/build/src/start/server/metro/createFileMap-fork.js.map +1 -0
  344. package/build/src/start/server/metro/createServerComponentsMiddleware.js +22 -22
  345. package/build/src/start/server/metro/createServerComponentsMiddleware.js.map +1 -1
  346. package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
  347. package/build/src/start/server/metro/createTypescriptResolver.js +410 -0
  348. package/build/src/start/server/metro/createTypescriptResolver.js.map +1 -0
  349. package/build/src/start/server/metro/debugging/MessageHandler.js.map +1 -1
  350. package/build/src/start/server/metro/debugging/attachAtlas.js +3 -3
  351. package/build/src/start/server/metro/debugging/attachAtlas.js.map +1 -1
  352. package/build/src/start/server/metro/debugging/createDebugMiddleware.js +6 -5
  353. package/build/src/start/server/metro/debugging/createDebugMiddleware.js.map +1 -1
  354. package/build/src/start/server/metro/debugging/createHandlersFactory.js.map +1 -1
  355. package/build/src/start/server/metro/debugging/messageHandlers/NetworkResponse.js +20 -4
  356. package/build/src/start/server/metro/debugging/messageHandlers/NetworkResponse.js.map +1 -1
  357. package/build/src/start/server/metro/debugging/pageIsSupported.js.map +1 -1
  358. package/build/src/start/server/metro/dev-server/compression.js.map +1 -1
  359. package/build/src/start/server/metro/dev-server/createMessageSocket.js +13 -2
  360. package/build/src/start/server/metro/dev-server/createMessageSocket.js.map +1 -1
  361. package/build/src/start/server/metro/dev-server/createMetroMiddleware.js +9 -2
  362. package/build/src/start/server/metro/dev-server/createMetroMiddleware.js.map +1 -1
  363. package/build/src/start/server/metro/dev-server/utils/socketMessages.js +3 -3
  364. package/build/src/start/server/metro/dev-server/utils/socketMessages.js.map +1 -1
  365. package/build/src/start/server/metro/errors/FailedToResolveNativeOnlyModuleError.js.map +1 -1
  366. package/build/src/start/server/metro/externals.js +4 -4
  367. package/build/src/start/server/metro/externals.js.map +1 -1
  368. package/build/src/start/server/metro/fetchRouterManifest.js +3 -3
  369. package/build/src/start/server/metro/fetchRouterManifest.js.map +1 -1
  370. package/build/src/start/server/metro/getCssModulesFromBundler.js +3 -3
  371. package/build/src/start/server/metro/getCssModulesFromBundler.js.map +1 -1
  372. package/build/src/start/server/metro/instantiateMetro.js +141 -57
  373. package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
  374. package/build/src/start/server/metro/log-box/LogBoxLog.js.map +1 -1
  375. package/build/src/start/server/metro/log-box/LogBoxSymbolication.js +4 -4
  376. package/build/src/start/server/metro/log-box/LogBoxSymbolication.js.map +1 -1
  377. package/build/src/start/server/metro/log-box/formatProjectFilePath.js +3 -3
  378. package/build/src/start/server/metro/log-box/formatProjectFilePath.js.map +1 -1
  379. package/build/src/start/server/metro/metroErrorInterface.js +16 -13
  380. package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
  381. package/build/src/start/server/metro/metroErrors.js +3 -3
  382. package/build/src/start/server/metro/metroErrors.js.map +1 -1
  383. package/build/src/start/server/metro/metroWatchTypeScriptFiles.js +48 -16
  384. package/build/src/start/server/metro/metroWatchTypeScriptFiles.js.map +1 -1
  385. package/build/src/start/server/metro/resolveLoader.js +3 -3
  386. package/build/src/start/server/metro/resolveLoader.js.map +1 -1
  387. package/build/src/start/server/metro/router.js +23 -14
  388. package/build/src/start/server/metro/router.js.map +1 -1
  389. package/build/src/start/server/metro/runServer-fork.js +13 -10
  390. package/build/src/start/server/metro/runServer-fork.js.map +1 -1
  391. package/build/src/start/server/metro/serializeHtml.js +29 -13
  392. package/build/src/start/server/metro/serializeHtml.js.map +1 -1
  393. package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js +36 -34
  394. package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js.map +1 -1
  395. package/build/src/start/server/metro/withMetroErrorReportingResolver.js +53 -30
  396. package/build/src/start/server/metro/withMetroErrorReportingResolver.js.map +1 -1
  397. package/build/src/start/server/metro/withMetroMultiPlatform.js +187 -126
  398. package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
  399. package/build/src/start/server/metro/withMetroResolvers.js +4 -4
  400. package/build/src/start/server/metro/withMetroResolvers.js.map +1 -1
  401. package/build/src/start/server/middleware/ContextModuleSourceMapsMiddleware.js.map +1 -1
  402. package/build/src/start/server/middleware/CorsMiddleware.js +3 -3
  403. package/build/src/start/server/middleware/CorsMiddleware.js.map +1 -1
  404. package/build/src/start/server/middleware/CreateFileMiddleware.js.map +1 -1
  405. package/build/src/start/server/middleware/DevToolsPluginMiddleware.js +60 -9
  406. package/build/src/start/server/middleware/DevToolsPluginMiddleware.js.map +1 -1
  407. package/build/src/start/server/middleware/DomComponentsMiddleware.js +16 -12
  408. package/build/src/start/server/middleware/DomComponentsMiddleware.js.map +1 -1
  409. package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js +6 -4
  410. package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js.map +1 -1
  411. package/build/src/start/server/middleware/ExpoMiddleware.js +3 -3
  412. package/build/src/start/server/middleware/ExpoMiddleware.js.map +1 -1
  413. package/build/src/start/server/middleware/FaviconMiddleware.js.map +1 -1
  414. package/build/src/start/server/middleware/HistoryFallbackMiddleware.js.map +1 -1
  415. package/build/src/start/server/middleware/InterstitialPageMiddleware.js +13 -8
  416. package/build/src/start/server/middleware/InterstitialPageMiddleware.js.map +1 -1
  417. package/build/src/start/server/middleware/ManifestMiddleware.js +15 -6
  418. package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
  419. package/build/src/start/server/middleware/OpenMiddleware.js +150 -0
  420. package/build/src/start/server/middleware/OpenMiddleware.js.map +1 -0
  421. package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js +13 -4
  422. package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js.map +1 -1
  423. package/build/src/start/server/middleware/ServeStaticMiddleware.js +2 -9
  424. package/build/src/start/server/middleware/ServeStaticMiddleware.js.map +1 -1
  425. package/build/src/start/server/middleware/domPolyfills.js +60 -0
  426. package/build/src/start/server/middleware/domPolyfills.js.map +1 -0
  427. package/build/src/start/server/middleware/inspector/JsInspector.js +6 -31
  428. package/build/src/start/server/middleware/inspector/JsInspector.js.map +1 -1
  429. package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js +14 -24
  430. package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js.map +1 -1
  431. package/build/src/start/server/middleware/inspector/middlwareMutations.js +3 -3
  432. package/build/src/start/server/middleware/inspector/middlwareMutations.js.map +1 -1
  433. package/build/src/start/server/middleware/metroOptions.js +15 -14
  434. package/build/src/start/server/middleware/metroOptions.js.map +1 -1
  435. package/build/src/start/server/middleware/mutations.js +3 -3
  436. package/build/src/start/server/middleware/mutations.js.map +1 -1
  437. package/build/src/start/server/middleware/openHandlers.js +157 -0
  438. package/build/src/start/server/middleware/openHandlers.js.map +1 -0
  439. package/build/src/start/server/middleware/resolveAssets.js +4 -4
  440. package/build/src/start/server/middleware/resolveAssets.js.map +1 -1
  441. package/build/src/start/server/middleware/resolvePlatform.js +9 -7
  442. package/build/src/start/server/middleware/resolvePlatform.js.map +1 -1
  443. package/build/src/start/server/middleware/resolveRuntimeVersionWithExpoUpdatesAsync.js.map +1 -1
  444. package/build/src/start/server/openPlatforms.js.map +1 -1
  445. package/build/src/start/server/platformBundlers.js +3 -1
  446. package/build/src/start/server/platformBundlers.js.map +1 -1
  447. package/build/src/start/server/serverLogLikeMetro.js +13 -36
  448. package/build/src/start/server/serverLogLikeMetro.js.map +1 -1
  449. package/build/src/start/server/type-generation/expo-env.js +3 -3
  450. package/build/src/start/server/type-generation/expo-env.js.map +1 -1
  451. package/build/src/start/server/type-generation/routes.js +14 -55
  452. package/build/src/start/server/type-generation/routes.js.map +1 -1
  453. package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js.map +1 -1
  454. package/build/src/start/server/type-generation/tsconfig.js +5 -5
  455. package/build/src/start/server/type-generation/tsconfig.js.map +1 -1
  456. package/build/src/start/server/webTemplate.js +12 -10
  457. package/build/src/start/server/webTemplate.js.map +1 -1
  458. package/build/src/start/server/webpack/WebpackBundlerDevServer.js +3 -3
  459. package/build/src/start/server/webpack/WebpackBundlerDevServer.js.map +1 -1
  460. package/build/src/start/server/webpack/formatWebpackMessages.js.map +1 -1
  461. package/build/src/start/server/webpack/resolveFromProject.js +4 -4
  462. package/build/src/start/server/webpack/resolveFromProject.js.map +1 -1
  463. package/build/src/start/server/webpack/tls.js +3 -3
  464. package/build/src/start/server/webpack/tls.js.map +1 -1
  465. package/build/src/start/startAsync.js +21 -11
  466. package/build/src/start/startAsync.js.map +1 -1
  467. package/build/src/types.d.ts +2 -0
  468. package/build/src/utils/FileNotifier.js +1 -1
  469. package/build/src/utils/FileNotifier.js.map +1 -1
  470. package/build/src/utils/args.js +5 -5
  471. package/build/src/utils/args.js.map +1 -1
  472. package/build/src/utils/array.js +8 -8
  473. package/build/src/utils/array.js.map +1 -1
  474. package/build/src/utils/build-cache-providers/helpers.js +4 -4
  475. package/build/src/utils/build-cache-providers/helpers.js.map +1 -1
  476. package/build/src/utils/build-cache-providers/index.js +5 -5
  477. package/build/src/utils/build-cache-providers/index.js.map +1 -1
  478. package/build/src/utils/cocoapods.js +5 -5
  479. package/build/src/utils/cocoapods.js.map +1 -1
  480. package/build/src/utils/codesigning.js +12 -6
  481. package/build/src/utils/codesigning.js.map +1 -1
  482. package/build/src/utils/composeMetroIgnorePatterns.js +69 -0
  483. package/build/src/utils/composeMetroIgnorePatterns.js.map +1 -0
  484. package/build/src/utils/createTempPath.js +3 -3
  485. package/build/src/utils/createTempPath.js.map +1 -1
  486. package/build/src/utils/delay.js +4 -4
  487. package/build/src/utils/delay.js.map +1 -1
  488. package/build/src/utils/dir.js +21 -11
  489. package/build/src/utils/dir.js.map +1 -1
  490. package/build/src/utils/downloadAppAsync.js.map +1 -1
  491. package/build/src/utils/downloadExpoGoAsync.js +4 -4
  492. package/build/src/utils/downloadExpoGoAsync.js.map +1 -1
  493. package/build/src/utils/editor.js +4 -4
  494. package/build/src/utils/editor.js.map +1 -1
  495. package/build/src/utils/env.js +39 -13
  496. package/build/src/utils/env.js.map +1 -1
  497. package/build/src/utils/errors.js +6 -6
  498. package/build/src/utils/errors.js.map +1 -1
  499. package/build/src/utils/exit.js +15 -19
  500. package/build/src/utils/exit.js.map +1 -1
  501. package/build/src/utils/expoUpdatesCli.js +5 -5
  502. package/build/src/utils/expoUpdatesCli.js.map +1 -1
  503. package/build/src/utils/fetch.js +4 -4
  504. package/build/src/utils/fetch.js.map +1 -1
  505. package/build/src/utils/findUp.js +3 -3
  506. package/build/src/utils/findUp.js.map +1 -1
  507. package/build/src/utils/fn.js +3 -3
  508. package/build/src/utils/fn.js.map +1 -1
  509. package/build/src/utils/freeport.js +3 -3
  510. package/build/src/utils/freeport.js.map +1 -1
  511. package/build/src/utils/getOrPromptApplicationId.js +3 -5
  512. package/build/src/utils/getOrPromptApplicationId.js.map +1 -1
  513. package/build/src/utils/getRunningProcess.js +5 -5
  514. package/build/src/utils/getRunningProcess.js.map +1 -1
  515. package/build/src/utils/git.js +3 -3
  516. package/build/src/utils/git.js.map +1 -1
  517. package/build/src/utils/glob.js +3 -3
  518. package/build/src/utils/glob.js.map +1 -1
  519. package/build/src/utils/ip.js +4 -4
  520. package/build/src/utils/ip.js.map +1 -1
  521. package/build/src/utils/link.js +3 -3
  522. package/build/src/utils/link.js.map +1 -1
  523. package/build/src/utils/mergeGitIgnorePaths.js +10 -10
  524. package/build/src/utils/mergeGitIgnorePaths.js.map +1 -1
  525. package/build/src/utils/modifyConfigAsync.js +3 -3
  526. package/build/src/utils/modifyConfigAsync.js.map +1 -1
  527. package/build/src/utils/net.js +23 -4
  528. package/build/src/utils/net.js.map +1 -1
  529. package/build/src/utils/nodeEnv.js +6 -6
  530. package/build/src/utils/nodeEnv.js.map +1 -1
  531. package/build/src/utils/npm.js +10 -9
  532. package/build/src/utils/npm.js.map +1 -1
  533. package/build/src/utils/obj.js +4 -4
  534. package/build/src/utils/obj.js.map +1 -1
  535. package/build/src/utils/open.js +240 -11
  536. package/build/src/utils/open.js.map +1 -1
  537. package/build/src/utils/ora.js +4 -4
  538. package/build/src/utils/ora.js.map +1 -1
  539. package/build/src/utils/plist.js +5 -4
  540. package/build/src/utils/plist.js.map +1 -1
  541. package/build/src/utils/port.js +12 -5
  542. package/build/src/utils/port.js.map +1 -1
  543. package/build/src/utils/progress.js +4 -4
  544. package/build/src/utils/progress.js.map +1 -1
  545. package/build/src/utils/prompts.js +11 -11
  546. package/build/src/utils/prompts.js.map +1 -1
  547. package/build/src/utils/qr.js +5 -4
  548. package/build/src/utils/qr.js.map +1 -1
  549. package/build/src/utils/resolveArgs.js +10 -9
  550. package/build/src/utils/resolveArgs.js.map +1 -1
  551. package/build/src/utils/scheme.js +4 -4
  552. package/build/src/utils/scheme.js.map +1 -1
  553. package/build/src/utils/strings.js.map +1 -1
  554. package/build/src/utils/tar.js +8 -7
  555. package/build/src/utils/tar.js.map +1 -1
  556. package/build/src/utils/telemetry/Telemetry.js +5 -0
  557. package/build/src/utils/telemetry/Telemetry.js.map +1 -1
  558. package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
  559. package/build/src/utils/telemetry/clients/FetchClient.js.map +1 -1
  560. package/build/src/utils/telemetry/clients/flushFetchDetached.js +5 -1
  561. package/build/src/utils/telemetry/clients/flushFetchDetached.js.map +1 -1
  562. package/build/src/utils/telemetry/index.js +4 -4
  563. package/build/src/utils/telemetry/index.js.map +1 -1
  564. package/build/src/utils/telemetry/utils/agent.js +42 -0
  565. package/build/src/utils/telemetry/utils/agent.js.map +1 -0
  566. package/build/src/utils/telemetry/utils/constants.js +3 -3
  567. package/build/src/utils/telemetry/utils/constants.js.map +1 -1
  568. package/build/src/utils/telemetry/utils/context.js +3 -2
  569. package/build/src/utils/telemetry/utils/context.js.map +1 -1
  570. package/build/src/utils/url.js +5 -17
  571. package/build/src/utils/url.js.map +1 -1
  572. package/build/src/utils/validateApplicationId.js +12 -12
  573. package/build/src/utils/validateApplicationId.js.map +1 -1
  574. package/build/src/utils/variadic.js +4 -4
  575. package/build/src/utils/variadic.js.map +1 -1
  576. package/build/src/whoami/index.js.map +1 -1
  577. package/changes.json +18 -26
  578. package/main.js +3 -0
  579. package/package.json +88 -80
  580. package/static/loading-page/index.html +45 -3
  581. package/static/template/+html.tsx +14 -5
  582. package/add-module.js +0 -8
  583. package/build/src/start/server/middleware/inspector/CdpClient.js +0 -81
  584. package/build/src/start/server/middleware/inspector/CdpClient.js.map +0 -1
  585. package/build/src/utils/resolveWatchFolders.js +0 -67
  586. package/build/src/utils/resolveWatchFolders.js.map +0 -1
  587. package/build/src/utils/tsconfig/evaluateTsConfig.js +0 -87
  588. package/build/src/utils/tsconfig/evaluateTsConfig.js.map +0 -1
  589. package/build/src/utils/tsconfig/loadTsConfigPaths.js +0 -84
  590. package/build/src/utils/tsconfig/loadTsConfigPaths.js.map +0 -1
  591. package/build/src/utils/tsconfig/matchTsConfigPathAlias.js +0 -94
  592. package/build/src/utils/tsconfig/matchTsConfigPathAlias.js.map +0 -1
  593. package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js +0 -62
  594. package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/platforms/android/AndroidPlatformManager.ts"],"sourcesContent":["import { AndroidAppIdResolver } from './AndroidAppIdResolver';\nimport { AndroidDeviceManager } from './AndroidDeviceManager';\nimport { Device } from './adb';\nimport { startAdbReverseAsync } from './adbReverse';\nimport { CommandError } from '../../../utils/errors';\nimport { memoize } from '../../../utils/fn';\nimport { learnMore } from '../../../utils/link';\nimport { hasDirectDevClientDependency } from '../../detectDevClient';\nimport { AppIdResolver } from '../AppIdResolver';\nimport { BaseOpenInCustomProps, BaseResolveDeviceProps, PlatformManager } from '../PlatformManager';\n\nconst debug = require('debug')(\n 'expo:start:platforms:platformManager:android'\n) as typeof console.log;\n\nexport interface AndroidOpenInCustomProps extends BaseOpenInCustomProps {\n /**\n * The Android app intent to launch through `adb shell am start -n <launchActivity>`.\n */\n launchActivity?: string;\n /**\n * The custom app id to launch, provided through `--app-id`.\n * By default, the app id is identical to the package name.\n * When using product flavors, the app id might be customized.\n */\n customAppId?: string;\n}\n\nexport class AndroidPlatformManager extends PlatformManager<Device, AndroidOpenInCustomProps> {\n /** The last used custom launch props, should be reused whenever launching custom runtime without launch props */\n private lastCustomRuntimeLaunchProps?: AndroidOpenInCustomProps;\n /** Memoized method to detect if dev client is installed */\n private hasDevClientInstalled: () => boolean;\n\n constructor(\n protected projectRoot: string,\n protected port: number,\n options: {\n /** Get the base URL for the dev server hosting this platform manager. */\n getDevServerUrl: () => string | null;\n /** Expo Go URL */\n getExpoGoUrl: () => string;\n /** Get redirect URL for native disambiguation. */\n getRedirectUrl: () => string | null;\n /** Dev Client URL. */\n getCustomRuntimeUrl: (props?: { scheme?: string }) => string | null;\n }\n ) {\n super(projectRoot, {\n platform: 'android',\n ...options,\n resolveDeviceAsync: AndroidDeviceManager.resolveAsync,\n });\n\n this.hasDevClientInstalled = memoize(hasDirectDevClientDependency.bind(this, projectRoot));\n }\n\n async openAsync(\n options:\n | { runtime: 'expo' | 'web' }\n | { runtime: 'custom'; props?: Partial<AndroidOpenInCustomProps> },\n resolveSettings?: BaseResolveDeviceProps<Device>\n ): Promise<{ url: string }> {\n await startAdbReverseAsync([this.port]);\n\n if (options.runtime === 'custom') {\n // Store the resolved launch properties for future \"openAsync\" request.\n // This reuses the same launch properties when opening through the CLI interface (pressing `a`).\n if (options.props) {\n this.lastCustomRuntimeLaunchProps = options.props;\n } else if (!options.props && this.lastCustomRuntimeLaunchProps) {\n options.props = this.lastCustomRuntimeLaunchProps;\n }\n\n // Handle projects that need to launch with a custom app id and launch activity\n return this.openProjectInCustomRuntimeWithCustomAppIdAsync(options, resolveSettings);\n }\n\n return super.openAsync(options, resolveSettings);\n }\n\n /**\n * Launch the custom runtime project, using the provided custom app id and launch activity.\n * Instead of \"open url\", this will launch the activity directly.\n * If dev client is installed, it will also pass the dev client URL to the activity.\n */\n async openProjectInCustomRuntimeWithCustomAppIdAsync(\n options: { runtime: 'custom'; props?: Partial<AndroidOpenInCustomProps> },\n resolveSettings?: Partial<BaseResolveDeviceProps<Device>>\n ) {\n // Fall back to default dev client URL open behavior if no custom app id or launch activity is provided\n if (!options.props?.customAppId || !options.props?.launchActivity) {\n return super.openProjectInCustomRuntimeAsync(resolveSettings, options.props);\n }\n\n const { customAppId, launchActivity } = options.props;\n const url = this.hasDevClientInstalled()\n ? (this.props.getCustomRuntimeUrl({ scheme: options.props.scheme }) ?? undefined)\n : undefined;\n\n debug(`Opening custom runtime using launch activity: ${launchActivity} --`, options.props);\n\n const deviceManager = (await this.props.resolveDeviceAsync(\n resolveSettings\n )) as AndroidDeviceManager;\n\n if (!(await deviceManager.isAppInstalledAndIfSoReturnContainerPathForIOSAsync(customAppId))) {\n throw new CommandError(\n `No development build (${customAppId}) for this project is installed. ` +\n `Install a development build on the target device and try again.\\n${learnMore(\n 'https://docs.expo.dev/development/build/'\n )}`\n );\n }\n\n deviceManager.logOpeningUrl(url ?? launchActivity);\n await deviceManager.activateWindowAsync();\n await deviceManager.launchActivityAsync(launchActivity, url);\n\n return { url: url ?? launchActivity };\n }\n\n _getAppIdResolver(): AppIdResolver {\n return new AndroidAppIdResolver(this.projectRoot);\n }\n\n _resolveAlternativeLaunchUrl(\n applicationId: string,\n props?: Partial<AndroidOpenInCustomProps>\n ): string {\n return props?.launchActivity ?? `${applicationId}/.MainActivity`;\n }\n}\n"],"names":["AndroidPlatformManager","debug","require","PlatformManager","constructor","projectRoot","port","options","platform","resolveDeviceAsync","AndroidDeviceManager","resolveAsync","hasDevClientInstalled","memoize","hasDirectDevClientDependency","bind","openAsync","resolveSettings","startAdbReverseAsync","runtime","props","lastCustomRuntimeLaunchProps","openProjectInCustomRuntimeWithCustomAppIdAsync","customAppId","launchActivity","openProjectInCustomRuntimeAsync","url","getCustomRuntimeUrl","scheme","undefined","deviceManager","isAppInstalledAndIfSoReturnContainerPathForIOSAsync","CommandError","learnMore","logOpeningUrl","activateWindowAsync","launchActivityAsync","_getAppIdResolver","AndroidAppIdResolver","_resolveAlternativeLaunchUrl","applicationId"],"mappings":";;;;+BA4BaA;;;eAAAA;;;sCA5BwB;sCACA;4BAEA;wBACR;oBACL;sBACE;iCACmB;iCAEkC;AAE/E,MAAMC,QAAQC,QAAQ,SACpB;AAgBK,MAAMF,+BAA+BG,gCAAe;IAMzDC,YACE,AAAUC,WAAmB,EAC7B,AAAUC,IAAY,EACtBC,OASC,CACD;QACA,KAAK,CAACF,aAAa;YACjBG,UAAU;YACV,GAAGD,OAAO;YACVE,oBAAoBC,0CAAoB,CAACC,YAAY;QACvD,SAjBUN,cAAAA,kBACAC,OAAAA;QAkBV,IAAI,CAACM,qBAAqB,GAAGC,IAAAA,WAAO,EAACC,6CAA4B,CAACC,IAAI,CAAC,IAAI,EAAEV;IAC/E;IAEA,MAAMW,UACJT,OAEoE,EACpEU,eAAgD,EACtB;QAC1B,MAAMC,IAAAA,gCAAoB,EAAC;YAAC,IAAI,CAACZ,IAAI;SAAC;QAEtC,IAAIC,QAAQY,OAAO,KAAK,UAAU;YAChC,uEAAuE;YACvE,gGAAgG;YAChG,IAAIZ,QAAQa,KAAK,EAAE;gBACjB,IAAI,CAACC,4BAA4B,GAAGd,QAAQa,KAAK;YACnD,OAAO,IAAI,CAACb,QAAQa,KAAK,IAAI,IAAI,CAACC,4BAA4B,EAAE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kC,6BACEC,aAAqB,EACrBpB,KAAyC,EACjC;QACR,OAAOA,CAAAA,yBAAAA,MAAOI,cAAc,KAAI,GAAGgB,cAAc,cAAc,CAAC;IAClE;AACF"}
1
+ {"version":3,"sources":["../../../../../src/start/platforms/android/AndroidPlatformManager.ts"],"sourcesContent":["import { AndroidAppIdResolver } from './AndroidAppIdResolver';\nimport { AndroidDeviceManager } from './AndroidDeviceManager';\nimport type { Device } from './adb';\nimport { startAdbReverseAsync } from './adbReverse';\nimport { CommandError } from '../../../utils/errors';\nimport { memoize } from '../../../utils/fn';\nimport { learnMore } from '../../../utils/link';\nimport { hasDirectDevClientDependency } from '../../detectDevClient';\nimport type { AppIdResolver } from '../AppIdResolver';\nimport type { BaseOpenInCustomProps, BaseResolveDeviceProps } from '../PlatformManager';\nimport { PlatformManager } from '../PlatformManager';\n\nconst debug = require('debug')(\n 'expo:start:platforms:platformManager:android'\n) as typeof console.log;\n\nexport interface AndroidOpenInCustomProps extends BaseOpenInCustomProps {\n /**\n * The Android app intent to launch through `adb shell am start -n <launchActivity>`.\n */\n launchActivity?: string;\n /**\n * The custom app id to launch, provided through `--app-id`.\n * By default, the app id is identical to the package name.\n * When using product flavors, the app id might be customized.\n */\n customAppId?: string;\n}\n\nexport class AndroidPlatformManager extends PlatformManager<Device, AndroidOpenInCustomProps> {\n /** The last used custom launch props, should be reused whenever launching custom runtime without launch props */\n private lastCustomRuntimeLaunchProps?: AndroidOpenInCustomProps;\n /** Memoized method to detect if dev client is installed */\n private hasDevClientInstalled: () => boolean;\n\n constructor(\n protected projectRoot: string,\n protected port: number,\n options: {\n /** Get the base URL for the dev server hosting this platform manager. */\n getDevServerUrl: () => string | null;\n /** Expo Go URL */\n getExpoGoUrl: () => string;\n /** Get redirect URL for native disambiguation. */\n getRedirectUrl: () => string | null;\n /** Dev Client URL. */\n getCustomRuntimeUrl: (props?: { scheme?: string }) => string | null;\n }\n ) {\n super(projectRoot, {\n platform: 'android',\n ...options,\n resolveDeviceAsync: AndroidDeviceManager.resolveAsync,\n });\n\n this.hasDevClientInstalled = memoize(hasDirectDevClientDependency.bind(this, projectRoot));\n }\n\n async openAsync(\n options:\n | { runtime: 'expo' | 'web' }\n | { runtime: 'custom'; props?: Partial<AndroidOpenInCustomProps> },\n resolveSettings?: BaseResolveDeviceProps<Device>\n ): Promise<{ url: string }> {\n await startAdbReverseAsync([this.port]);\n\n if (options.runtime === 'custom') {\n // Store the resolved launch properties for future \"openAsync\" request.\n // This reuses the same launch properties when opening through the CLI interface (pressing `a`).\n if (options.props) {\n this.lastCustomRuntimeLaunchProps = options.props;\n } else if (!options.props && this.lastCustomRuntimeLaunchProps) {\n options.props = this.lastCustomRuntimeLaunchProps;\n }\n\n // Handle projects that need to launch with a custom app id and launch activity\n return this.openProjectInCustomRuntimeWithCustomAppIdAsync(options, resolveSettings);\n }\n\n return super.openAsync(options, resolveSettings);\n }\n\n /**\n * Launch the custom runtime project, using the provided custom app id and launch activity.\n * Instead of \"open url\", this will launch the activity directly.\n * If dev client is installed, it will also pass the dev client URL to the activity.\n */\n async openProjectInCustomRuntimeWithCustomAppIdAsync(\n options: { runtime: 'custom'; props?: Partial<AndroidOpenInCustomProps> },\n resolveSettings?: Partial<BaseResolveDeviceProps<Device>>\n ) {\n // Fall back to default dev client URL open behavior if no custom app id or launch activity is provided\n if (!options.props?.customAppId || !options.props?.launchActivity) {\n return super.openProjectInCustomRuntimeAsync(resolveSettings, options.props);\n }\n\n const { customAppId, launchActivity } = options.props;\n const url = this.hasDevClientInstalled()\n ? (this.props.getCustomRuntimeUrl({ scheme: options.props.scheme }) ?? undefined)\n : undefined;\n\n debug(`Opening custom runtime using launch activity: ${launchActivity} --`, options.props);\n\n const deviceManager = (await this.props.resolveDeviceAsync(\n resolveSettings\n )) as AndroidDeviceManager;\n\n if (!(await deviceManager.isAppInstalledAndIfSoReturnContainerPathForIOSAsync(customAppId))) {\n throw new CommandError(\n `No development build (${customAppId}) for this project is installed. ` +\n `Install a development build on the target device and try again.\\n${learnMore(\n 'https://docs.expo.dev/development/build/'\n )}`\n );\n }\n\n deviceManager.logOpeningUrl(url ?? launchActivity);\n await deviceManager.activateWindowAsync();\n await deviceManager.launchActivityAsync(launchActivity, url);\n\n return { url: url ?? launchActivity };\n }\n\n _getAppIdResolver(): AppIdResolver {\n return new AndroidAppIdResolver(this.projectRoot);\n }\n\n _resolveAlternativeLaunchUrl(\n applicationId: string,\n props?: Partial<AndroidOpenInCustomProps>\n ): string {\n return props?.launchActivity ?? `${applicationId}/.MainActivity`;\n }\n}\n"],"names":["AndroidPlatformManager","debug","require","PlatformManager","projectRoot","port","options","platform","resolveDeviceAsync","AndroidDeviceManager","resolveAsync","hasDevClientInstalled","memoize","hasDirectDevClientDependency","bind","openAsync","resolveSettings","startAdbReverseAsync","runtime","props","lastCustomRuntimeLaunchProps","openProjectInCustomRuntimeWithCustomAppIdAsync","customAppId","launchActivity","openProjectInCustomRuntimeAsync","url","getCustomRuntimeUrl","scheme","undefined","deviceManager","isAppInstalledAndIfSoReturnContainerPathForIOSAsync","CommandError","learnMore","logOpeningUrl","activateWindowAsync","launchActivityAsync","_getAppIdResolver","AndroidAppIdResolver","_resolveAlternativeLaunchUrl","applicationId"],"mappings":";;;;+BA6BaA;;;eAAAA;;;sCA7BwB;sCACA;4BAEA;wBACR;oBACL;sBACE;iCACmB;iCAGb;AAEhC,MAAMC,QAAQC,QAAQ,SACpB;AAgBK,MAAMF,+BAA+BG,gCAAe;IAMzD,YACE,AAAUC,WAAmB,EAC7B,AAAUC,IAAY,EACtBC,OASC,CACD;QACA,KAAK,CAACF,aAAa;YACjBG,UAAU;YACV,GAAGD,OAAO;YACVE,oBAAoBC,0CAAoB,CAACC,YAAY;QACvD,SAjBUN,cAAAA,kBACAC,OAAAA;QAkBV,IAAI,CAACM,qBAAqB,GAAGC,IAAAA,WAAO,EAACC,6CAA4B,CAACC,IAAI,CAAC,IAAI,EAAEV;IAC/E;IAEA,MAAMW,UACJT,OAEoE,EACpEU,eA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CAAC,GACrE,CAAC,iEAAiE,EAAEU,IAAAA,eAAS,EAC3E,6CACC;QAET;QAEAH,cAAcI,aAAa,CAACR,OAAOF;QACnC,MAAMM,cAAcK,mBAAmB;QACvC,MAAML,cAAcM,mBAAmB,CAACZ,gBAAgBE;QAExD,OAAO;YAAEA,KAAKA,OAAOF;QAAe;IACtC;IAEAa,oBAAmC;QACjC,OAAO,IAAIC,0CAAoB,CAAC,IAAI,CAACjC,WAAW;IAClD;IAEAkC,6BACEC,aAAqB,EACrBpB,KAAyC,EACjC;QACR,OAAOA,CAAAA,yBAAAA,MAAOI,cAAc,KAAI,GAAGgB,cAAc,cAAc,CAAC;IAClE;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/platforms/android/activateWindow.ts"],"sourcesContent":["import * as osascript from '@expo/osascript';\nimport { execFileSync } from 'child_process';\n\nimport { Device } from './adb';\n\nconst debug = require('debug')('expo:start:platforms:android:activateWindow') as typeof console.log;\n\nfunction getUnixPID(port: number | string): string {\n // Runs like `lsof -i:8081 -P -t -sTCP:LISTEN`\n const args = [`-i:${port}`, '-P', '-t', '-sTCP:LISTEN'];\n debug('lsof ' + args.join(' '));\n return execFileSync('lsof', args, {\n encoding: 'utf8',\n stdio: ['pipe', 'pipe', 'ignore'],\n })\n .split('\\n')[0]\n ?.trim?.();\n}\n\n/** Activate the Emulator window on macOS. */\nexport async function activateWindowAsync(device: Pick<Device, 'type' | 'pid'>): Promise<boolean> {\n debug(`Activating window for device (pid: ${device.pid}, type: ${device.type})`);\n if (\n // only mac is supported for now.\n process.platform !== 'darwin' ||\n // can only focus emulators\n device.type !== 'emulator'\n ) {\n return false;\n }\n\n // Google Emulator ID: `emulator-5554` -> `5554`\n const androidPid = device.pid!.match(/-(\\d+)/)?.[1];\n if (!androidPid) {\n return false;\n }\n // Unix PID\n const pid = getUnixPID(androidPid);\n\n if (!pid) {\n return false;\n }\n debug(`Activate window for pid:`, pid);\n try {\n await osascript.execAsync(`\n tell application \"System Events\"\n set frontmost of the first process whose unix id is ${pid} to true\n end tell`);\n return true;\n } catch {\n // noop -- this feature is very specific and subject to failure.\n return false;\n }\n}\n"],"names":["activateWindowAsync","debug","require","getUnixPID","port","execFileSync","args","join","encoding","stdio","split","trim","device","pid","type","process","platform","androidPid","match","osascript","execAsync"],"mappings":";;;;+BAoBsBA;;;eAAAA;;;;iEApBK;;;;;;;yBACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAI7B,MAAMC,QAAQC,QAAQ,SAAS;AAE/B,SAASC,WAAWC,IAAqB;QAIhCC,2BAAAA;IAHP,8CAA8C;IAC9C,MAAMC,OAAO;QAAC,CAAC,GAAG,EAAEF,MAAM;QAAE;QAAM;QAAM;KAAe;IACvDH,MAAM,UAAUK,KAAKC,IAAI,CAAC;IAC1B,QAAOF,uBAAAA,IAAAA,6BAAY,EAAC,QAAQC,MAAM;QAChCE,UAAU;QACVC,OAAO;YAAC;YAAQ;YAAQ;SAAS;IACnC,GACGC,KAAK,CAAC,KAAK,CAAC,EAAE,sBAJVL,4BAAAA,qBAKHM,IAAI,qBALDN,+BAAAA;AAMT;AAGO,eAAeL,oBAAoBY,MAAoC;QAYzDA;IAXnBX,MAAM,CAAC,mCAAmC,EAAEW,OAAOC,GAAG,CAAC,QAAQ,EAAED,OAAOE,IAAI,CAAC,CAAC,CAAC;IAC/E,IACE,iCAAiC;IACjCC,QAAQC,QAAQ,KAAK,YACrB,2BAA2B;IAC3BJ,OAAOE,IAAI,KAAK,YAChB;QACA,OAAO;IACT;IAEA,gDAAgD;IAChD,MAAMG,cAAaL,oBAAAA,OAAOC,GAAG,CAAEK,KAAK,CAAC,8BAAlBN,iBAA6B,CAAC,EAAE;IACnD,IAAI,CAACK,YAAY;QACf,OAAO;IACT;IACA,WAAW;IACX,MAAMJ,MAAMV,WAAWc;IAEvB,IAAI,CAACJ,KAAK;QACR,OAAO;IACT;IACAZ,MAAM,CAAC,wBAAwB,CAAC,EAAEY;IAClC,IAAI;QACF,MAAMM,aAAUC,SAAS,CAAC,CAAC;;0DAE2B,EAAEP,IAAI;YACpD,CAAC;QACT,OAAO;IACT,EAAE,OAAM;QACN,gEAAgE;QAChE,OAAO;IACT;AACF"}
1
+ {"version":3,"sources":["../../../../../src/start/platforms/android/activateWindow.ts"],"sourcesContent":["import * as osascript from '@expo/osascript';\nimport { execFileSync } from 'child_process';\n\nimport type { Device } from './adb';\n\nconst debug = require('debug')('expo:start:platforms:android:activateWindow') as typeof console.log;\n\nfunction getUnixPID(port: number | string): string | undefined {\n // Runs like `lsof -i:8081 -P -t -sTCP:LISTEN`\n const args = [`-i:${port}`, '-P', '-t', '-sTCP:LISTEN'];\n debug('lsof ' + args.join(' '));\n return execFileSync('lsof', args, {\n encoding: 'utf8',\n stdio: ['pipe', 'pipe', 'ignore'],\n })\n .split('\\n')[0]\n ?.trim?.();\n}\n\n/** Activate the Emulator window on macOS. */\nexport async function activateWindowAsync(device: Pick<Device, 'type' | 'pid'>): Promise<boolean> {\n debug(`Activating window for device (pid: ${device.pid}, type: ${device.type})`);\n if (\n // only mac is supported for now.\n process.platform !== 'darwin' ||\n // can only focus emulators\n device.type !== 'emulator'\n ) {\n return false;\n }\n\n // Google Emulator ID: `emulator-5554` -> `5554`\n const androidPid = device.pid!.match(/-(\\d+)/)?.[1];\n if (!androidPid) {\n return false;\n }\n // Unix PID\n const pid = getUnixPID(androidPid);\n\n if (!pid) {\n return false;\n }\n debug(`Activate window for pid:`, pid);\n try {\n await osascript.execAsync(`\n tell application \"System Events\"\n set frontmost of the first process whose unix id is ${pid} to true\n end tell`);\n return true;\n } catch {\n // noop -- this feature is very specific and subject to failure.\n return false;\n }\n}\n"],"names":["activateWindowAsync","debug","require","getUnixPID","port","execFileSync","args","join","encoding","stdio","split","trim","device","pid","type","process","platform","androidPid","match","osascript","execAsync"],"mappings":";;;;+BAoBsBA;;;eAAAA;;;;iEApBK;;;;;;;yBACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAI7B,MAAMC,QAAQC,QAAQ,SAAS;AAE/B,SAASC,WAAWC,IAAqB;QAIhCC,2BAAAA;IAHP,8CAA8C;IAC9C,MAAMC,OAAO;QAAC,CAAC,GAAG,EAAEF,MAAM;QAAE;QAAM;QAAM;KAAe;IACvDH,MAAM,UAAUK,KAAKC,IAAI,CAAC;IAC1B,QAAOF,uBAAAA,IAAAA,6BAAY,EAAC,QAAQC,MAAM;QAChCE,UAAU;QACVC,OAAO;YAAC;YAAQ;YAAQ;SAAS;IACnC,GACGC,KAAK,CAAC,KAAK,CAAC,EAAE,sBAJVL,4BAAAA,qBAKHM,IAAI,qBALDN,+BAAAA;AAMT;AAGO,eAAeL,oBAAoBY,MAAoC;QAYzDA;IAXnBX,MAAM,CAAC,mCAAmC,EAAEW,OAAOC,GAAG,CAAC,QAAQ,EAAED,OAAOE,IAAI,CAAC,CAAC,CAAC;IAC/E,IACE,iCAAiC;IACjCC,QAAQC,QAAQ,KAAK,YACrB,2BAA2B;IAC3BJ,OAAOE,IAAI,KAAK,YAChB;QACA,OAAO;IACT;IAEA,gDAAgD;IAChD,MAAMG,cAAaL,oBAAAA,OAAOC,GAAG,CAAEK,KAAK,CAAC,8BAAlBN,iBAA6B,CAAC,EAAE;IACnD,IAAI,CAACK,YAAY;QACf,OAAO;IACT;IACA,WAAW;IACX,MAAMJ,MAAMV,WAAWc;IAEvB,IAAI,CAACJ,KAAK;QACR,OAAO;IACT;IACAZ,MAAM,CAAC,wBAAwB,CAAC,EAAEY;IAClC,IAAI;QACF,MAAMM,aAAUC,SAAS,CAAC,CAAC;;0DAE2B,EAAEP,IAAI;YACpD,CAAC;QACT,OAAO;IACT,EAAE,OAAM;QACN,gEAAgE;QAChE,OAAO;IACT;AACF"}
@@ -5,59 +5,62 @@ 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
- DeviceABI: function() {
12
+ get DeviceABI () {
13
13
  return DeviceABI;
14
14
  },
15
- adbArgs: function() {
15
+ get adbArgs () {
16
16
  return adbArgs;
17
17
  },
18
- getAdbNameForDeviceIdAsync: function() {
18
+ get adbShellArgs () {
19
+ return adbShellArgs;
20
+ },
21
+ get getAdbNameForDeviceIdAsync () {
19
22
  return getAdbNameForDeviceIdAsync;
20
23
  },
21
- getAttachedDevicesAsync: function() {
24
+ get getAttachedDevicesAsync () {
22
25
  return getAttachedDevicesAsync;
23
26
  },
24
- getDeviceABIsAsync: function() {
27
+ get getDeviceABIsAsync () {
25
28
  return getDeviceABIsAsync;
26
29
  },
27
- getPackageInfoAsync: function() {
30
+ get getPackageInfoAsync () {
28
31
  return getPackageInfoAsync;
29
32
  },
30
- getPropertyDataForDeviceAsync: function() {
33
+ get getPropertyDataForDeviceAsync () {
31
34
  return getPropertyDataForDeviceAsync;
32
35
  },
33
- getServer: function() {
36
+ get getServer () {
34
37
  return getServer;
35
38
  },
36
- installAsync: function() {
39
+ get installAsync () {
37
40
  return installAsync;
38
41
  },
39
- isBootAnimationCompleteAsync: function() {
42
+ get isBootAnimationCompleteAsync () {
40
43
  return isBootAnimationCompleteAsync;
41
44
  },
42
- isDeviceBootedAsync: function() {
45
+ get isDeviceBootedAsync () {
43
46
  return isDeviceBootedAsync;
44
47
  },
45
- isPackageInstalledAsync: function() {
48
+ get isPackageInstalledAsync () {
46
49
  return isPackageInstalledAsync;
47
50
  },
48
- launchActivityAsync: function() {
51
+ get launchActivityAsync () {
49
52
  return launchActivityAsync;
50
53
  },
51
- logUnauthorized: function() {
54
+ get logUnauthorized () {
52
55
  return logUnauthorized;
53
56
  },
54
- openUrlAsync: function() {
57
+ get openUrlAsync () {
55
58
  return openUrlAsync;
56
59
  },
57
- sanitizeAdbDeviceName: function() {
60
+ get sanitizeAdbDeviceName () {
58
61
  return sanitizeAdbDeviceName;
59
62
  },
60
- uninstallAsync: function() {
63
+ get uninstallAsync () {
61
64
  return uninstallAsync;
62
65
  }
63
66
  });
@@ -159,7 +162,7 @@ function logUnauthorized(device) {
159
162
  _log.warn(`\nThis computer is not authorized for developing on ${_chalk().default.bold(device.name)}. ${_chalk().default.dim((0, _link.learnMore)('https://expo.fyi/authorize-android-device'))}`);
160
163
  }
161
164
  async function isPackageInstalledAsync(device, androidPackage) {
162
- const packages = await getServer().runAsync(adbArgs(device.pid, 'shell', 'pm', 'list', 'packages', '--user', _env.env.EXPO_ADB_USER, androidPackage));
165
+ const packages = await getServer().runAsync(adbShellArgs(device.pid, 'pm', 'list', 'packages', '--user', _env.env.EXPO_ADB_USER, androidPackage));
163
166
  const lines = packages.split(/\r?\n/);
164
167
  for(let i = 0; i < lines.length; i++){
165
168
  const line = lines[i].trim();
@@ -170,8 +173,7 @@ async function isPackageInstalledAsync(device, androidPackage) {
170
173
  return false;
171
174
  }
172
175
  async function launchActivityAsync(device, { launchActivity, url }) {
173
- const args = [
174
- 'shell',
176
+ const command = [
175
177
  'am',
176
178
  'start',
177
179
  // FLAG_ACTIVITY_SINGLE_TOP -- If set, the activity will not be launched if it is already running at the top of the history stack.
@@ -182,13 +184,12 @@ async function launchActivityAsync(device, { launchActivity, url }) {
182
184
  launchActivity
183
185
  ];
184
186
  if (url) {
185
- args.push('-d', url);
187
+ command.push('-d', url);
186
188
  }
187
- return openAsync(adbArgs(device.pid, ...args));
189
+ return openAsync(adbShellArgs(device.pid, ...command));
188
190
  }
189
191
  async function openUrlAsync(device, { url }) {
190
- return openAsync(adbArgs(device.pid, 'shell', 'am', 'start', '-a', 'android.intent.action.VIEW', '-d', // ADB requires ampersands to be escaped.
191
- url.replace(/&/g, String.raw`\&`)));
192
+ return openAsync(adbShellArgs(device.pid, 'am', 'start', '-a', 'android.intent.action.VIEW', '-d', url));
192
193
  }
193
194
  /** Runs a generic command watches for common errors in order to throw with an expected code. */ async function openAsync(args) {
194
195
  const results = await getServer().runAsync(args);
@@ -201,7 +202,7 @@ async function uninstallAsync(device, { appId }) {
201
202
  return await getServer().runAsync(adbArgs(device.pid, 'uninstall', '--user', _env.env.EXPO_ADB_USER, appId));
202
203
  }
203
204
  async function getPackageInfoAsync(device, { appId }) {
204
- return await getServer().runAsync(adbArgs(device.pid, 'shell', 'dumpsys', 'package', appId));
205
+ return await getServer().runAsync(adbShellArgs(device.pid, 'dumpsys', 'package', appId));
205
206
  }
206
207
  async function installAsync(device, { filePath }) {
207
208
  // TODO: Handle the `INSTALL_FAILED_INSUFFICIENT_STORAGE` error.
@@ -214,6 +215,12 @@ function adbArgs(pid, ...options) {
214
215
  }
215
216
  return args.concat(options);
216
217
  }
218
+ function adbShellArgs(pid, ...command) {
219
+ return adbArgs(pid, 'shell', ...command.map(shellQuote));
220
+ }
221
+ function shellQuote(value) {
222
+ return `'${value.replace(/'/g, `'\\''`)}'`;
223
+ }
217
224
  async function getAttachedDevicesAsync() {
218
225
  const output = await getServer().runAsync([
219
226
  'devices',
@@ -306,10 +313,11 @@ async function isDeviceBootedAsync({ name } = {}) {
306
313
  }
307
314
  async function isBootAnimationCompleteAsync(pid) {
308
315
  try {
316
+ var _props_PROP_BOOT_ANIMATION_STATE;
309
317
  const props = await getPropertyDataForDeviceAsync({
310
318
  pid
311
319
  }, PROP_BOOT_ANIMATION_STATE);
312
- return !!props[PROP_BOOT_ANIMATION_STATE].match(/stopped/);
320
+ return !!((_props_PROP_BOOT_ANIMATION_STATE = props[PROP_BOOT_ANIMATION_STATE]) == null ? void 0 : _props_PROP_BOOT_ANIMATION_STATE.match(/stopped/));
313
321
  } catch {
314
322
  return false;
315
323
  }
@@ -325,13 +333,7 @@ async function getDeviceABIsAsync(device) {
325
333
  ];
326
334
  }
327
335
  async function getPropertyDataForDeviceAsync(device, prop) {
328
- // @ts-ignore
329
- const propCommand = adbArgs(...[
330
- device.pid,
331
- 'shell',
332
- 'getprop',
333
- prop
334
- ].filter(Boolean));
336
+ const propCommand = prop ? adbShellArgs(device.pid, 'getprop', prop) : adbShellArgs(device.pid, 'getprop');
335
337
  try {
336
338
  // Prevent reading as UTF8.
337
339
  const results = await getServer().getFileOutputAsync(propCommand);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/platforms/android/adb.ts"],"sourcesContent":["import chalk from 'chalk';\nimport os from 'os';\n\nimport { ADBServer } from './ADBServer';\nimport * as Log from '../../../log';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { learnMore } from '../../../utils/link';\n\nconst debug = require('debug')('expo:start:platforms:android:adb') as typeof console.log;\n\nexport enum DeviceABI {\n // The arch specific android target platforms are soft-deprecated.\n // Instead of using TargetPlatform as a combination arch + platform\n // the code will be updated to carry arch information in [DarwinArch]\n // and [AndroidArch].\n arm = 'arm',\n arm64 = 'arm64',\n x64 = 'x64',\n x86 = 'x86',\n x8664 = 'x86_64',\n arm64v8a = 'arm64-v8a',\n armeabiV7a = 'armeabi-v7a',\n armeabi = 'armeabi',\n universal = 'universal',\n}\n\n/** Represents a connected Android device. */\nexport type Device = {\n /** Process ID. */\n pid?: string;\n /** Name of the device, also used as the ID for opening devices. */\n name: string;\n /** Is emulator or connected device. */\n type: 'emulator' | 'device';\n /** Is the device booted (emulator). */\n isBooted: boolean;\n /** Is device authorized for developing. https://expo.fyi/authorize-android-device */\n isAuthorized: boolean;\n /** The connection type to ADB, only available when `type: device` */\n connectionType?: 'USB' | 'Network';\n};\n\ntype DeviceContext = Pick<Device, 'pid'>;\n\ntype DeviceProperties = Record<string, string>;\n\nconst CANT_START_ACTIVITY_ERROR = 'Activity not started, unable to resolve Intent';\n// http://developer.android.com/ndk/guides/abis.html\nconst PROP_CPU_NAME = 'ro.product.cpu.abi';\n\nconst PROP_CPU_ABI_LIST_NAME = 'ro.product.cpu.abilist';\n\n// Can sometimes be null\n// http://developer.android.com/ndk/guides/abis.html\nconst PROP_BOOT_ANIMATION_STATE = 'init.svc.bootanim';\n\nlet _server: ADBServer | null;\n\n/** Return the lazily loaded ADB server instance. */\nexport function getServer() {\n _server ??= new ADBServer();\n return _server;\n}\n\n/** Logs an FYI message about authorizing your device. */\nexport function logUnauthorized(device: Device) {\n Log.warn(\n `\\nThis computer is not authorized for developing on ${chalk.bold(device.name)}. ${chalk.dim(\n learnMore('https://expo.fyi/authorize-android-device')\n )}`\n );\n}\n\n/** Returns true if the provided package name is installed on the provided Android device. */\nexport async function isPackageInstalledAsync(\n device: DeviceContext,\n androidPackage: string\n): Promise<boolean> {\n const packages = await getServer().runAsync(\n adbArgs(\n device.pid,\n 'shell',\n 'pm',\n 'list',\n 'packages',\n '--user',\n env.EXPO_ADB_USER,\n androidPackage\n )\n );\n\n const lines = packages.split(/\\r?\\n/);\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i].trim();\n if (line === `package:${androidPackage}`) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * @param device.pid Process ID of the Android device to launch.\n * @param props.launchActivity Activity to launch `[application identifier]/.[main activity name]`, ex: `com.bacon.app/.MainActivity`\n * @param props.url Optional (dev client) URL to launch\n */\nexport async function launchActivityAsync(\n device: DeviceContext,\n {\n launchActivity,\n url,\n }: {\n launchActivity: string;\n url?: string;\n }\n) {\n const args: string[] = [\n 'shell',\n 'am',\n 'start',\n // FLAG_ACTIVITY_SINGLE_TOP -- If set, the activity will not be launched if it is already running at the top of the history stack.\n '-f',\n '0x20000000',\n // Activity to open first: com.bacon.app/.MainActivity\n '-n',\n launchActivity,\n ];\n\n if (url) {\n args.push('-d', url);\n }\n\n return openAsync(adbArgs(device.pid, ...args));\n}\n\n/**\n * @param device.pid Process ID of the Android device to launch.\n * @param props.url URL to launch.\n */\nexport async function openUrlAsync(\n device: DeviceContext,\n {\n url,\n }: {\n url: string;\n }\n) {\n return openAsync(\n adbArgs(\n device.pid,\n 'shell',\n 'am',\n 'start',\n '-a',\n 'android.intent.action.VIEW',\n '-d',\n // ADB requires ampersands to be escaped.\n url.replace(/&/g, String.raw`\\&`)\n )\n );\n}\n\n/** Runs a generic command watches for common errors in order to throw with an expected code. */\nasync function openAsync(args: string[]): Promise<string> {\n const results = await getServer().runAsync(args);\n if (\n results.includes(CANT_START_ACTIVITY_ERROR) ||\n results.match(/Error: Activity class .* does not exist\\./g)\n ) {\n throw new CommandError('APP_NOT_INSTALLED', results.substring(results.indexOf('Error: ')));\n }\n return results;\n}\n\n/** Uninstall an app given its Android package name. */\nexport async function uninstallAsync(\n device: DeviceContext,\n { appId }: { appId: string }\n): Promise<string> {\n return await getServer().runAsync(\n adbArgs(device.pid, 'uninstall', '--user', env.EXPO_ADB_USER, appId)\n );\n}\n\n/** Get package info from an app based on its Android package name. */\nexport async function getPackageInfoAsync(\n device: DeviceContext,\n { appId }: { appId: string }\n): Promise<string> {\n return await getServer().runAsync(adbArgs(device.pid, 'shell', 'dumpsys', 'package', appId));\n}\n\n/** Install an app on a connected device. */\nexport async function installAsync(device: DeviceContext, { filePath }: { filePath: string }) {\n // TODO: Handle the `INSTALL_FAILED_INSUFFICIENT_STORAGE` error.\n return await getServer().runAsync(\n adbArgs(device.pid, 'install', '-r', '-d', '--user', env.EXPO_ADB_USER, filePath)\n );\n}\n\n/** Format ADB args with process ID. */\nexport function adbArgs(pid: Device['pid'], ...options: string[]): string[] {\n const args = [];\n if (pid) {\n args.push('-s', pid);\n }\n\n return args.concat(options);\n}\n\n// TODO: This is very expensive for some operations.\nexport async function getAttachedDevicesAsync(): Promise<Device[]> {\n const output = await getServer().runAsync(['devices', '-l']);\n\n const splitItems = output\n .trim()\n .replace(/\\n$/, '')\n .split(os.EOL)\n // Filter ADB trace logs from the output, e.g.\n // adb D 03-06 15:25:53 63677 4018815 adb_client.cpp:393] adb_query: host:devices-l\n // 03-04 12:29:44.557 16415 16415 D adb : commandline.cpp:1646 Using server socket: tcp:172.27.192.1:5037\n // 03-04 12:29:44.557 16415 16415 D adb : adb_client.cpp:160 _adb_connect: host:version\n .filter((line) => !line.match(/\\.cpp:[0-9]+/));\n\n // First line is `\"List of devices attached\"`, remove it\n // @ts-ignore: todo\n const attachedDevices: {\n props: string[];\n type: Device['type'];\n isAuthorized: Device['isAuthorized'];\n isBooted: Device['isBooted'];\n connectionType?: Device['connectionType'];\n }[] = splitItems\n .slice(1, splitItems.length)\n .map((line) => {\n // unauthorized: ['FA8251A00719', 'unauthorized', 'usb:338690048X', 'transport_id:5']\n // authorized: ['FA8251A00719', 'device', 'usb:336592896X', 'product:walleye', 'model:Pixel_2', 'device:walleye', 'transport_id:4']\n // emulator: ['emulator-5554', 'offline', 'transport_id:1']\n const props = line.split(' ').filter(Boolean);\n const type = line.includes('emulator') ? 'emulator' : 'device';\n\n let connectionType;\n if (type === 'device' && line.includes('usb:')) {\n connectionType = 'USB';\n } else if (type === 'device' && line.includes('_adb-tls-connect.')) {\n connectionType = 'Network';\n }\n\n const isBooted = type === 'emulator' || props[1] !== 'offline';\n const isAuthorized =\n connectionType === 'Network'\n ? line.includes('model:') // Network connected devices show `model:<name>` when authorized\n : props[1] !== 'unauthorized';\n\n return { props, type, isAuthorized, isBooted, connectionType };\n })\n .filter(({ props: [pid] }) => !!pid);\n\n const devicePromises = attachedDevices.map<Promise<Device>>(async (props) => {\n const {\n type,\n props: [pid, ...deviceInfo],\n isAuthorized,\n isBooted,\n } = props;\n\n let name: string | null = null;\n\n if (type === 'device') {\n if (isAuthorized) {\n // Possibly formatted like `model:Pixel_2`\n // Transform to `Pixel_2`\n const modelItem = deviceInfo.find((info) => info.includes('model:'));\n if (modelItem) {\n name = modelItem.replace('model:', '');\n }\n }\n // unauthorized devices don't have a name available to read\n if (!name) {\n // Device FA8251A00719\n name = `Device ${pid}`;\n }\n } else {\n // Given an emulator pid, get the emulator name which can be used to start the emulator later.\n name = (await getAdbNameForDeviceIdAsync({ pid })) ?? '';\n }\n\n return props.connectionType\n ? { pid, name, type, isAuthorized, isBooted, connectionType: props.connectionType }\n : { pid, name, type, isAuthorized, isBooted };\n });\n\n return Promise.all(devicePromises);\n}\n\n/**\n * Return the Emulator name for an emulator ID, this can be used to determine if an emulator is booted.\n *\n * @param device.pid a value like `emulator-5554` from `abd devices`\n */\nexport async function getAdbNameForDeviceIdAsync(device: DeviceContext): Promise<string | null> {\n const results = await getServer().runAsync(adbArgs(device.pid, 'emu', 'avd', 'name'));\n\n if (results.match(/could not connect to TCP port .*: Connection refused/)) {\n // Can also occur when the emulator does not exist.\n throw new CommandError('EMULATOR_NOT_FOUND', results);\n }\n\n return sanitizeAdbDeviceName(results) ?? null;\n}\n\nexport async function isDeviceBootedAsync({\n name,\n}: { name?: string } = {}): Promise<Device | null> {\n const devices = await getAttachedDevicesAsync();\n\n if (!name) {\n return devices[0] ?? null;\n }\n\n return devices.find((device) => device.name === name) ?? null;\n}\n\n/**\n * Returns true when a device's splash screen animation has stopped.\n * This can be used to detect when a device is fully booted and ready to use.\n *\n * @param pid\n */\nexport async function isBootAnimationCompleteAsync(pid?: string): Promise<boolean> {\n try {\n const props = await getPropertyDataForDeviceAsync({ pid }, PROP_BOOT_ANIMATION_STATE);\n return !!props[PROP_BOOT_ANIMATION_STATE].match(/stopped/);\n } catch {\n return false;\n }\n}\n\n/** Get a list of ABIs for the provided device. */\nexport async function getDeviceABIsAsync(\n device: Pick<Device, 'name' | 'pid'>\n): Promise<DeviceABI[]> {\n const cpuAbiList = (await getPropertyDataForDeviceAsync(device, PROP_CPU_ABI_LIST_NAME))[\n PROP_CPU_ABI_LIST_NAME\n ];\n\n if (cpuAbiList) {\n return cpuAbiList.trim().split(',') as DeviceABI[];\n }\n\n const abi = (await getPropertyDataForDeviceAsync(device, PROP_CPU_NAME))[\n PROP_CPU_NAME\n ] as DeviceABI;\n return [abi];\n}\n\nexport async function getPropertyDataForDeviceAsync(\n device: DeviceContext,\n prop?: string\n): Promise<DeviceProperties> {\n // @ts-ignore\n const propCommand = adbArgs(...[device.pid, 'shell', 'getprop', prop].filter(Boolean));\n try {\n // Prevent reading as UTF8.\n const results = await getServer().getFileOutputAsync(propCommand);\n // Like:\n // [wifi.direct.interface]: [p2p-dev-wlan0]\n // [wifi.interface]: [wlan0]\n\n if (prop) {\n debug(`Property data: (device pid: ${device.pid}, prop: ${prop}, data: ${results})`);\n return {\n [prop]: results,\n };\n }\n const props = parseAdbDeviceProperties(results);\n\n debug(`Parsed data:`, props);\n\n return props;\n } catch (error: any) {\n // TODO: Ensure error has message and not stderr\n throw new CommandError(`Failed to get properties for device (${device.pid}): ${error.message}`);\n }\n}\n\nfunction parseAdbDeviceProperties(devicePropertiesString: string) {\n const properties: DeviceProperties = {};\n const propertyExp = /\\[(.*?)\\]: \\[(.*?)\\]/gm;\n for (const match of devicePropertiesString.matchAll(propertyExp)) {\n properties[match[1]] = match[2];\n }\n return properties;\n}\n\n/**\n * Sanitize the ADB device name to only get the actual device name.\n * On Windows, we need to do \\r, \\n, and \\r\\n filtering to get the name.\n */\nexport function sanitizeAdbDeviceName(deviceName: string) {\n return deviceName\n .trim()\n .split(/[\\r\\n]+/)\n .shift();\n}\n"],"names":["DeviceABI","adbArgs","getAdbNameForDeviceIdAsync","getAttachedDevicesAsync","getDeviceABIsAsync","getPackageInfoAsync","getPropertyDataForDeviceAsync","getServer","installAsync","isBootAnimationCompleteAsync","isDeviceBootedAsync","isPackageInstalledAsync","launchActivityAsync","logUnauthorized","openUrlAsync","sanitizeAdbDeviceName","uninstallAsync","debug","require","CANT_START_ACTIVITY_ERROR","PROP_CPU_NAME","PROP_CPU_ABI_LIST_NAME","PROP_BOOT_ANIMATION_STATE","_server","ADBServer","device","Log","warn","chalk","bold","name","dim","learnMore","androidPackage","packages","runAsync","pid","env","EXPO_ADB_USER","lines","split","i","length","line","trim","launchActivity","url","args","push","openAsync","replace","String","raw","results","includes","match","CommandError","substring","indexOf","appId","filePath","options","concat","output","splitItems","os","EOL","filter","attachedDevices","slice","map","props","Boolean","type","connectionType","isBooted","isAuthorized","devicePromises","deviceInfo","modelItem","find","info","Promise","all","devices","cpuAbiList","abi","prop","propCommand","getFileOutputAsync","parseAdbDeviceProperties","error","message","devicePropertiesString","properties","propertyExp","matchAll","deviceName","shift"],"mappings":";;;;;;;;;;;IAWYA,SAAS;eAATA;;IA+LIC,OAAO;eAAPA;;IAmGMC,0BAA0B;eAA1BA;;IAzFAC,uBAAuB;eAAvBA;;IAgIAC,kBAAkB;eAAlBA;;IA1JAC,mBAAmB;eAAnBA;;IA2KAC,6BAA6B;eAA7BA;;IAzSNC,SAAS;eAATA;;IAsIMC,YAAY;eAAZA;;IAwIAC,4BAA4B;eAA5BA;;IAlBAC,mBAAmB;eAAnBA;;IA7OAC,uBAAuB;eAAvBA;;IAgCAC,mBAAmB;eAAnBA;;IAzCNC,eAAe;eAAfA;;IA0EMC,YAAY;eAAZA;;IAoQNC,qBAAqB;eAArBA;;IAhOMC,cAAc;eAAdA;;;;gEAhLJ;;;;;;;gEACH;;;;;;2BAEW;6DACL;qBACD;wBACS;sBACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE1B,MAAMC,QAAQC,QAAQ,SAAS;AAExB,IAAA,AAAKlB,mCAAAA;IACV,kEAAkE;IAClE,mEAAmE;IACnE,qEAAqE;IACrE,qBAAqB;;;;;;;;;;WAJXA;;AAoCZ,MAAMmB,4BAA4B;AAClC,oDAAoD;AACpD,MAAMC,gBAAgB;AAEtB,MAAMC,yBAAyB;AAE/B,wBAAwB;AACxB,oDAAoD;AACpD,MAAMC,4BAA4B;AAElC,IAAIC;AAGG,SAAShB;IACdgB,YAAY,IAAIC,oBAAS;IACzB,OAAOD;AACT;AAGO,SAASV,gBAAgBY,MAAc;IAC5CC,KAAIC,IAAI,CACN,CAAC,oDAAoD,EAAEC,gBAAK,CAACC,IAAI,CAACJ,OAAOK,IAAI,EAAE,EAAE,EAAEF,gBAAK,CAACG,GAAG,CAC1FC,IAAAA,eAAS,EAAC,+CACT;AAEP;AAGO,eAAerB,wBACpBc,MAAqB,EACrBQ,cAAsB;IAEtB,MAAMC,WAAW,MAAM3B,Y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,2CAA2C;QAC3C,4BAA4B;QAE5B,IAAID,MAAM;YACRtE,MAAM,CAAC,4BAA4B,EAAEQ,OAAOW,GAAG,CAAC,QAAQ,EAAEmD,KAAK,QAAQ,EAAElC,QAAQ,CAAC,CAAC;YACnF,OAAO;gBACL,CAACkC,KAAK,EAAElC;YACV;QACF;QACA,MAAMkB,QAAQmB,yBAAyBrC;QAEvCpC,MAAM,CAAC,YAAY,CAAC,EAAEsD;QAEtB,OAAOA;IACT,EAAE,OAAOoB,OAAY;QACnB,gDAAgD;QAChD,MAAM,IAAInC,oBAAY,CAAC,CAAC,qCAAqC,EAAE/B,OAAOW,GAAG,CAAC,GAAG,EAAEuD,MAAMC,OAAO,EAAE;IAChG;AACF;AAEA,SAASF,yBAAyBG,sBAA8B;IAC9D,MAAMC,aAA+B,CAAC;IACtC,MAAMC,cAAc;IACpB,KAAK,MAAMxC,SAASsC,uBAAuBG,QAAQ,CAACD,aAAc;QAChED,UAAU,CAACvC,KAAK,CAAC,EAAE,CAAC,GAAGA,KAAK,CAAC,EAAE;IACjC;IACA,OAAOuC;AACT;AAMO,SAAS/E,sBAAsBkF,UAAkB;IACtD,OAAOA,WACJrD,IAAI,GACJJ,KAAK,CAAC,WACN0D,KAAK;AACV"}
1
+ {"version":3,"sources":["../../../../../src/start/platforms/android/adb.ts"],"sourcesContent":["import chalk from 'chalk';\nimport os from 'os';\n\nimport { ADBServer } from './ADBServer';\nimport * as Log from '../../../log';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { learnMore } from '../../../utils/link';\n\nconst debug = require('debug')('expo:start:platforms:android:adb') as typeof console.log;\n\nexport enum DeviceABI {\n // The arch specific android target platforms are soft-deprecated.\n // Instead of using TargetPlatform as a combination arch + platform\n // the code will be updated to carry arch information in [DarwinArch]\n // and [AndroidArch].\n arm = 'arm',\n arm64 = 'arm64',\n x64 = 'x64',\n x86 = 'x86',\n x8664 = 'x86_64',\n arm64v8a = 'arm64-v8a',\n armeabiV7a = 'armeabi-v7a',\n armeabi = 'armeabi',\n universal = 'universal',\n}\n\n/** Represents a connected Android device. */\nexport type Device = {\n /** Process ID. */\n pid?: string;\n /** Name of the device, also used as the ID for opening devices. */\n name: string;\n /** Is emulator or connected device. */\n type: 'emulator' | 'device';\n /** Is the device booted (emulator). */\n isBooted: boolean;\n /** Is device authorized for developing. https://expo.fyi/authorize-android-device */\n isAuthorized: boolean;\n /** The connection type to ADB, only available when `type: device` */\n connectionType?: 'USB' | 'Network';\n};\n\ntype DeviceContext = Pick<Device, 'pid'>;\n\ntype DeviceProperties = Record<string, string>;\n\nconst CANT_START_ACTIVITY_ERROR = 'Activity not started, unable to resolve Intent';\n// http://developer.android.com/ndk/guides/abis.html\nconst PROP_CPU_NAME = 'ro.product.cpu.abi';\n\nconst PROP_CPU_ABI_LIST_NAME = 'ro.product.cpu.abilist';\n\n// Can sometimes be null\n// http://developer.android.com/ndk/guides/abis.html\nconst PROP_BOOT_ANIMATION_STATE = 'init.svc.bootanim';\n\nlet _server: ADBServer | null;\n\n/** Return the lazily loaded ADB server instance. */\nexport function getServer() {\n _server ??= new ADBServer();\n return _server;\n}\n\n/** Logs an FYI message about authorizing your device. */\nexport function logUnauthorized(device: Device) {\n Log.warn(\n `\\nThis computer is not authorized for developing on ${chalk.bold(device.name)}. ${chalk.dim(\n learnMore('https://expo.fyi/authorize-android-device')\n )}`\n );\n}\n\n/** Returns true if the provided package name is installed on the provided Android device. */\nexport async function isPackageInstalledAsync(\n device: DeviceContext,\n androidPackage: string\n): Promise<boolean> {\n const packages = await getServer().runAsync(\n adbShellArgs(device.pid, 'pm', 'list', 'packages', '--user', env.EXPO_ADB_USER, androidPackage)\n );\n\n const lines = packages.split(/\\r?\\n/);\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i]!.trim();\n if (line === `package:${androidPackage}`) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * @param device.pid Process ID of the Android device to launch.\n * @param props.launchActivity Activity to launch `[application identifier]/.[main activity name]`, ex: `com.bacon.app/.MainActivity`\n * @param props.url Optional (dev client) URL to launch\n */\nexport async function launchActivityAsync(\n device: DeviceContext,\n {\n launchActivity,\n url,\n }: {\n launchActivity: string;\n url?: string;\n }\n) {\n const command: string[] = [\n 'am',\n 'start',\n // FLAG_ACTIVITY_SINGLE_TOP -- If set, the activity will not be launched if it is already running at the top of the history stack.\n '-f',\n '0x20000000',\n // Activity to open first: com.bacon.app/.MainActivity\n '-n',\n launchActivity,\n ];\n\n if (url) {\n command.push('-d', url);\n }\n\n return openAsync(adbShellArgs(device.pid, ...command));\n}\n\n/**\n * @param device.pid Process ID of the Android device to launch.\n * @param props.url URL to launch.\n */\nexport async function openUrlAsync(\n device: DeviceContext,\n {\n url,\n }: {\n url: string;\n }\n) {\n return openAsync(\n adbShellArgs(device.pid, 'am', 'start', '-a', 'android.intent.action.VIEW', '-d', url)\n );\n}\n\n/** Runs a generic command watches for common errors in order to throw with an expected code. */\nasync function openAsync(args: string[]): Promise<string> {\n const results = await getServer().runAsync(args);\n if (\n results.includes(CANT_START_ACTIVITY_ERROR) ||\n results.match(/Error: Activity class .* does not exist\\./g)\n ) {\n throw new CommandError('APP_NOT_INSTALLED', results.substring(results.indexOf('Error: ')));\n }\n return results;\n}\n\n/** Uninstall an app given its Android package name. */\nexport async function uninstallAsync(\n device: DeviceContext,\n { appId }: { appId: string }\n): Promise<string> {\n return await getServer().runAsync(\n adbArgs(device.pid, 'uninstall', '--user', env.EXPO_ADB_USER, appId)\n );\n}\n\n/** Get package info from an app based on its Android package name. */\nexport async function getPackageInfoAsync(\n device: DeviceContext,\n { appId }: { appId: string }\n): Promise<string> {\n return await getServer().runAsync(adbShellArgs(device.pid, 'dumpsys', 'package', appId));\n}\n\n/** Install an app on a connected device. */\nexport async function installAsync(device: DeviceContext, { filePath }: { filePath: string }) {\n // TODO: Handle the `INSTALL_FAILED_INSUFFICIENT_STORAGE` error.\n return await getServer().runAsync(\n adbArgs(device.pid, 'install', '-r', '-d', '--user', env.EXPO_ADB_USER, filePath)\n );\n}\n\n/** Format ADB args with process ID. */\nexport function adbArgs(pid: Device['pid'], ...options: string[]): string[] {\n const args = [];\n if (pid) {\n args.push('-s', pid);\n }\n\n return args.concat(options);\n}\n\n/**\n * `adb shell` concatenates trailing args and runs the result through `sh -c` on\n * the device, so unquoted metacharacters in tainted tokens execute on-device.\n */\nexport function adbShellArgs(pid: Device['pid'], ...command: string[]): string[] {\n return adbArgs(pid, 'shell', ...command.map(shellQuote));\n}\n\nfunction shellQuote(value: string): string {\n return `'${value.replace(/'/g, `'\\\\''`)}'`;\n}\n\n// TODO: This is very expensive for some operations.\nexport async function getAttachedDevicesAsync(): Promise<Device[]> {\n const output = await getServer().runAsync(['devices', '-l']);\n\n const splitItems = output\n .trim()\n .replace(/\\n$/, '')\n .split(os.EOL)\n // Filter ADB trace logs from the output, e.g.\n // adb D 03-06 15:25:53 63677 4018815 adb_client.cpp:393] adb_query: host:devices-l\n // 03-04 12:29:44.557 16415 16415 D adb : commandline.cpp:1646 Using server socket: tcp:172.27.192.1:5037\n // 03-04 12:29:44.557 16415 16415 D adb : adb_client.cpp:160 _adb_connect: host:version\n .filter((line) => !line.match(/\\.cpp:[0-9]+/));\n\n // First line is `\"List of devices attached\"`, remove it\n // @ts-ignore: todo\n const attachedDevices: {\n props: string[];\n type: Device['type'];\n isAuthorized: Device['isAuthorized'];\n isBooted: Device['isBooted'];\n connectionType?: Device['connectionType'];\n }[] = splitItems\n .slice(1, splitItems.length)\n .map((line) => {\n // unauthorized: ['FA8251A00719', 'unauthorized', 'usb:338690048X', 'transport_id:5']\n // authorized: ['FA8251A00719', 'device', 'usb:336592896X', 'product:walleye', 'model:Pixel_2', 'device:walleye', 'transport_id:4']\n // emulator: ['emulator-5554', 'offline', 'transport_id:1']\n const props = line.split(' ').filter(Boolean);\n const type = line.includes('emulator') ? 'emulator' : 'device';\n\n let connectionType;\n if (type === 'device' && line.includes('usb:')) {\n connectionType = 'USB';\n } else if (type === 'device' && line.includes('_adb-tls-connect.')) {\n connectionType = 'Network';\n }\n\n const isBooted = type === 'emulator' || props[1] !== 'offline';\n const isAuthorized =\n connectionType === 'Network'\n ? line.includes('model:') // Network connected devices show `model:<name>` when authorized\n : props[1] !== 'unauthorized';\n\n return { props, type, isAuthorized, isBooted, connectionType };\n })\n .filter(({ props: [pid] }) => !!pid);\n\n const devicePromises = attachedDevices.map<Promise<Device>>(async (props) => {\n const {\n type,\n props: [pid, ...deviceInfo],\n isAuthorized,\n isBooted,\n } = props;\n\n let name: string | null = null;\n\n if (type === 'device') {\n if (isAuthorized) {\n // Possibly formatted like `model:Pixel_2`\n // Transform to `Pixel_2`\n const modelItem = deviceInfo.find((info) => info.includes('model:'));\n if (modelItem) {\n name = modelItem.replace('model:', '');\n }\n }\n // unauthorized devices don't have a name available to read\n if (!name) {\n // Device FA8251A00719\n name = `Device ${pid}`;\n }\n } else {\n // Given an emulator pid, get the emulator name which can be used to start the emulator later.\n name = (await getAdbNameForDeviceIdAsync({ pid })) ?? '';\n }\n\n return props.connectionType\n ? { pid, name, type, isAuthorized, isBooted, connectionType: props.connectionType }\n : { pid, name, type, isAuthorized, isBooted };\n });\n\n return Promise.all(devicePromises);\n}\n\n/**\n * Return the Emulator name for an emulator ID, this can be used to determine if an emulator is booted.\n *\n * @param device.pid a value like `emulator-5554` from `abd devices`\n */\nexport async function getAdbNameForDeviceIdAsync(device: DeviceContext): Promise<string | null> {\n const results = await getServer().runAsync(adbArgs(device.pid, 'emu', 'avd', 'name'));\n\n if (results.match(/could not connect to TCP port .*: Connection refused/)) {\n // Can also occur when the emulator does not exist.\n throw new CommandError('EMULATOR_NOT_FOUND', results);\n }\n\n return sanitizeAdbDeviceName(results) ?? null;\n}\n\nexport async function isDeviceBootedAsync({\n name,\n}: { name?: string } = {}): Promise<Device | null> {\n const devices = await getAttachedDevicesAsync();\n\n if (!name) {\n return devices[0] ?? null;\n }\n\n return devices.find((device) => device.name === name) ?? null;\n}\n\n/**\n * Returns true when a device's splash screen animation has stopped.\n * This can be used to detect when a device is fully booted and ready to use.\n *\n * @param pid\n */\nexport async function isBootAnimationCompleteAsync(pid?: string): Promise<boolean> {\n try {\n const props = await getPropertyDataForDeviceAsync({ pid }, PROP_BOOT_ANIMATION_STATE);\n return !!props[PROP_BOOT_ANIMATION_STATE]?.match(/stopped/);\n } catch {\n return false;\n }\n}\n\n/** Get a list of ABIs for the provided device. */\nexport async function getDeviceABIsAsync(\n device: Pick<Device, 'name' | 'pid'>\n): Promise<DeviceABI[]> {\n const cpuAbiList = (await getPropertyDataForDeviceAsync(device, PROP_CPU_ABI_LIST_NAME))[\n PROP_CPU_ABI_LIST_NAME\n ];\n\n if (cpuAbiList) {\n return cpuAbiList.trim().split(',') as DeviceABI[];\n }\n\n const abi = (await getPropertyDataForDeviceAsync(device, PROP_CPU_NAME))[\n PROP_CPU_NAME\n ] as DeviceABI;\n return [abi];\n}\n\nexport async function getPropertyDataForDeviceAsync(\n device: DeviceContext,\n prop?: string\n): Promise<DeviceProperties> {\n const propCommand = prop\n ? adbShellArgs(device.pid, 'getprop', prop)\n : adbShellArgs(device.pid, 'getprop');\n try {\n // Prevent reading as UTF8.\n const results = await getServer().getFileOutputAsync(propCommand);\n // Like:\n // [wifi.direct.interface]: [p2p-dev-wlan0]\n // [wifi.interface]: [wlan0]\n\n if (prop) {\n debug(`Property data: (device pid: ${device.pid}, prop: ${prop}, data: ${results})`);\n return {\n [prop]: results,\n };\n }\n const props = parseAdbDeviceProperties(results);\n\n debug(`Parsed data:`, props);\n\n return props;\n } catch (error: any) {\n // TODO: Ensure error has message and not stderr\n throw new CommandError(`Failed to get properties for device (${device.pid}): ${error.message}`);\n }\n}\n\nfunction parseAdbDeviceProperties(devicePropertiesString: string) {\n const properties: DeviceProperties = {};\n const propertyExp = /\\[(.*?)\\]: \\[(.*?)\\]/gm;\n for (const match of devicePropertiesString.matchAll(propertyExp)) {\n properties[match[1]!] = match[2]!;\n }\n return properties;\n}\n\n/**\n * Sanitize the ADB device name to only get the actual device name.\n * On Windows, we need to do \\r, \\n, and \\r\\n filtering to get the name.\n */\nexport function sanitizeAdbDeviceName(deviceName: string) {\n return deviceName\n .trim()\n .split(/[\\r\\n]+/)\n .shift();\n}\n"],"names":["DeviceABI","adbArgs","adbShellArgs","getAdbNameForDeviceIdAsync","getAttachedDevicesAsync","getDeviceABIsAsync","getPackageInfoAsync","getPropertyDataForDeviceAsync","getServer","installAsync","isBootAnimationCompleteAsync","isDeviceBootedAsync","isPackageInstalledAsync","launchActivityAsync","logUnauthorized","openUrlAsync","sanitizeAdbDeviceName","uninstallAsync","debug","require","CANT_START_ACTIVITY_ERROR","PROP_CPU_NAME","PROP_CPU_ABI_LIST_NAME","PROP_BOOT_ANIMATION_STATE","_server","ADBServer","device","Log","warn","chalk","bold","name","dim","learnMore","androidPackage","packages","runAsync","pid","env","EXPO_ADB_USER","lines","split","i","length","line","trim","launchActivity","url","command","push","openAsync","args","results","includes","match","CommandError","substring","indexOf","appId","filePath","options","concat","map","shellQuote","value","replace","output","splitItems","os","EOL","filter","attachedDevices","slice","props","Boolean","type","connectionType","isBooted","isAuthorized","devicePromises","deviceInfo","modelItem","find","info","Promise","all","devices","cpuAbiList","abi","prop","propCommand","getFileOutputAsync","parseAdbDeviceProperties","error","message","devicePropertiesString","properties","propertyExp","matchAll","deviceName","shift"],"mappings":";;;;;;;;;;;QAWYA;eAAAA;;QA2KIC;eAAAA;;QAaAC;eAAAA;;QAkGMC;eAAAA;;QAzFAC;eAAAA;;QAgIAC;eAAAA;;QAtKAC;eAAAA;;QAuLAC;eAAAA;;QAjSNC;eAAAA;;QAkHMC;eAAAA;;QAoJAC;eAAAA;;QAlBAC;eAAAA;;QArOAC;eAAAA;;QAuBAC;eAAAA;;QAhCNC;eAAAA;;QAgEMC;eAAAA;;QAuQNC;eAAAA;;QA7OMC;eAAAA;;;;gEA5JJ;;;;;;;gEACH;;;;;;2BAEW;6DACL;qBACD;wBACS;sBACH;;;;;;;;;;;;;;;;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AAG,CAAC,GAAG,EAAEwD,MAAMC,OAAO,EAAE;IAChG;AACF;AAEA,SAASF,yBAAyBG,sBAA8B;IAC9D,MAAMC,aAA+B,CAAC;IACtC,MAAMC,cAAc;IACpB,KAAK,MAAM3C,SAASyC,uBAAuBG,QAAQ,CAACD,aAAc;QAChED,UAAU,CAAC1C,KAAK,CAAC,EAAE,CAAE,GAAGA,KAAK,CAAC,EAAE;IAClC;IACA,OAAO0C;AACT;AAMO,SAAShF,sBAAsBmF,UAAkB;IACtD,OAAOA,WACJtD,IAAI,GACJJ,KAAK,CAAC,WACN2D,KAAK;AACV"}
@@ -5,17 +5,17 @@ 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
- hasAdbReverseAsync: function() {
12
+ get hasAdbReverseAsync () {
13
13
  return hasAdbReverseAsync;
14
14
  },
15
- startAdbReverseAsync: function() {
15
+ get startAdbReverseAsync () {
16
16
  return startAdbReverseAsync;
17
17
  },
18
- stopAdbReverseAsync: function() {
18
+ get stopAdbReverseAsync () {
19
19
  return stopAdbReverseAsync;
20
20
  }
21
21
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/platforms/android/adbReverse.ts"],"sourcesContent":["import { assertSdkRoot } from './AndroidSdk';\nimport { adbArgs, Device, getAttachedDevicesAsync, getServer, logUnauthorized } from './adb';\nimport * as Log from '../../../log';\nimport { installExitHooks } from '../../../utils/exit';\n\nconst debug = require('debug')('expo:start:platforms:android:adbReverse') as typeof console.log;\n\nlet removeExitHook: (() => void) | null = null;\n\nexport function hasAdbReverseAsync(): boolean {\n try {\n return !!assertSdkRoot();\n } catch (error: any) {\n debug('Failed to resolve the Android SDK path, skipping ADB: %s', error.message);\n return false;\n }\n}\n\nexport async function startAdbReverseAsync(ports: number[]): Promise<boolean> {\n // Install cleanup automatically...\n removeExitHook = installExitHooks(() => {\n stopAdbReverseAsync(ports);\n });\n\n const devices = await getAttachedDevicesAsync();\n for (const device of devices) {\n for (const port of ports) {\n if (!(await adbReverseAsync(device, port))) {\n debug(`Failed to start reverse port ${port} on device \"${device.name}\"`);\n return false;\n }\n }\n }\n return true;\n}\n\nexport async function stopAdbReverseAsync(ports: number[]): Promise<void> {\n removeExitHook?.();\n\n const devices = await getAttachedDevicesAsync();\n for (const device of devices) {\n for (const port of ports) {\n await adbReverseRemoveAsync(device, port);\n }\n }\n}\n\nasync function adbReverseAsync(device: Device, port: number): Promise<boolean> {\n if (!device.isAuthorized) {\n logUnauthorized(device);\n return false;\n }\n\n try {\n await getServer().runAsync(adbArgs(device.pid, 'reverse', `tcp:${port}`, `tcp:${port}`));\n return true;\n } catch (error: any) {\n Log.warn(`[ADB] Couldn't reverse port ${port}: ${error.message}`);\n return false;\n }\n}\n\nasync function adbReverseRemoveAsync(device: Device, port: number): Promise<boolean> {\n if (!device.isAuthorized) {\n return false;\n }\n\n try {\n await getServer().runAsync(adbArgs(device.pid, 'reverse', '--remove', `tcp:${port}`));\n return true;\n } catch (error: any) {\n // Don't send this to warn because we call this preemptively sometimes\n debug(`Could not unforward port ${port}: ${error.message}`);\n return false;\n }\n}\n"],"names":["hasAdbReverseAsync","startAdbReverseAsync","stopAdbReverseAsync","debug","require","removeExitHook","assertSdkRoot","error","message","ports","installExitHooks","devices","getAttachedDevicesAsync","device","port","adbReverseAsync","name","adbReverseRemoveAsync","isAuthorized","logUnauthorized","getServer","runAsync","adbArgs","pid","Log","warn"],"mappings":";;;;;;;;;;;IASgBA,kBAAkB;eAAlBA;;IASMC,oBAAoB;eAApBA;;IAkBAC,mBAAmB;eAAnBA;;;4BApCQ;qBACuD;6DAChE;sBACY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEjC,MAAMC,QAAQC,QAAQ,SAAS;AAE/B,IAAIC,iBAAsC;AA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AAOK,YAAY,EAAE;QACxB,OAAO;IACT;IAEA,IAAI;QACF,MAAME,IAAAA,cAAS,IAAGC,QAAQ,CAACC,IAAAA,YAAO,EAACT,OAAOU,GAAG,EAAE,WAAW,YAAY,CAAC,IAAI,EAAET,MAAM;QACnF,OAAO;IACT,EAAE,OAAOP,OAAY;QACnB,sEAAsE;QACtEJ,MAAM,CAAC,yBAAyB,EAAEW,KAAK,EAAE,EAAEP,MAAMC,OAAO,EAAE;QAC1D,OAAO;IACT;AACF"}
1
+ {"version":3,"sources":["../../../../../src/start/platforms/android/adbReverse.ts"],"sourcesContent":["import { assertSdkRoot } from './AndroidSdk';\nimport type { Device } from './adb';\nimport { adbArgs, getAttachedDevicesAsync, getServer, logUnauthorized } from './adb';\nimport * as Log from '../../../log';\nimport { installExitHooks } from '../../../utils/exit';\n\nconst debug = require('debug')('expo:start:platforms:android:adbReverse') as typeof console.log;\n\nlet removeExitHook: (() => void) | null = null;\n\nexport function hasAdbReverseAsync(): boolean {\n try {\n return !!assertSdkRoot();\n } catch (error: any) {\n debug('Failed to resolve the Android SDK path, skipping ADB: %s', error.message);\n return false;\n }\n}\n\nexport async function startAdbReverseAsync(ports: number[]): Promise<boolean> {\n // Install cleanup automatically...\n removeExitHook = installExitHooks(() => {\n stopAdbReverseAsync(ports);\n });\n\n const devices = await getAttachedDevicesAsync();\n for (const device of devices) {\n for (const port of ports) {\n if (!(await adbReverseAsync(device, port))) {\n debug(`Failed to start reverse port ${port} on device \"${device.name}\"`);\n return false;\n }\n }\n }\n return true;\n}\n\nexport async function stopAdbReverseAsync(ports: number[]): Promise<void> {\n removeExitHook?.();\n\n const devices = await getAttachedDevicesAsync();\n for (const device of devices) {\n for (const port of ports) {\n await adbReverseRemoveAsync(device, port);\n }\n }\n}\n\nasync function adbReverseAsync(device: Device, port: number): Promise<boolean> {\n if (!device.isAuthorized) {\n logUnauthorized(device);\n return false;\n }\n\n try {\n await getServer().runAsync(adbArgs(device.pid, 'reverse', `tcp:${port}`, `tcp:${port}`));\n return true;\n } catch (error: any) {\n Log.warn(`[ADB] Couldn't reverse port ${port}: ${error.message}`);\n return false;\n }\n}\n\nasync function adbReverseRemoveAsync(device: Device, port: number): Promise<boolean> {\n if (!device.isAuthorized) {\n return false;\n }\n\n try {\n await getServer().runAsync(adbArgs(device.pid, 'reverse', '--remove', `tcp:${port}`));\n return true;\n } catch (error: any) {\n // Don't send this to warn because we call this preemptively sometimes\n debug(`Could not unforward port ${port}: ${error.message}`);\n return false;\n }\n}\n"],"names":["hasAdbReverseAsync","startAdbReverseAsync","stopAdbReverseAsync","debug","require","removeExitHook","assertSdkRoot","error","message","ports","installExitHooks","devices","getAttachedDevicesAsync","device","port","adbReverseAsync","name","adbReverseRemoveAsync","isAuthorized","logUnauthorized","getServer","runAsync","adbArgs","pid","Log","warn"],"mappings":";;;;;;;;;;;QAUgBA;eAAAA;;QASMC;eAAAA;;QAkBAC;eAAAA;;;4BArCQ;qBAE+C;6DACxD;sBACY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEjC,MAAMC,QAAQC,QAAQ,SAAS;AAE/B,IAAIC,iBAAsC;AAEnC,SAASL;IACd,IAAI;QACF,OAAO,CAAC,CAACM,IAAAA,yBAAa;IACxB,EAAE,OAAOC,OAAY;QACnBJ,MAAM,4DAA4DI,MAAMC,OAAO;QAC/E,OAAO;IACT;AACF;AAEO,eAAeP,qBAAqBQ,KAAe;IACxD,mCAAmC;IACnCJ,iBAAiBK,IAAAA,sBAAgB,EAAC;QAChCR,oBAAoBO;IACtB;IAEA,MAAME,UAAU,MAAMC,IAAAA,4BAAuB;IAC7C,KAAK,MAAMC,UAAUF,QAAS;QAC5B,KAAK,MAAMG,QAAQL,MAAO;YACxB,IAAI,CAAE,MAAMM,gBAAgBF,QAAQC,OAAQ;gBAC1CX,MAAM,CAAC,6BAA6B,EAAEW,KAAK,YAAY,EAAED,OAAOG,IAAI,CAAC,CAAC,CAAC;gBACvE,OAAO;YACT;QACF;IACF;IACA,OAAO;AACT;AAEO,eAAed,oBAAoBO,KAAe;IACvDJ,kCAAAA;IAEA,MAAMM,UAAU,MAAMC,IAAAA,4BAAuB;IAC7C,KAAK,MAAMC,UAAUF,QAAS;QAC5B,KAAK,MAAMG,QAAQL,MAAO;YACxB,MAAMQ,sBAAsBJ,QAAQC;QACtC;IACF;AACF;AAEA,eAAeC,gBAAgBF,MAAc,EAAEC,IAAY;IACzD,IAAI,CAACD,OAAOK,YAAY,EAAE;QACxBC,IAAAA,oBAAe,EAACN;QAChB,OAAO;IACT;IAEA,IAAI;QACF,MAAMO,IAAAA,cAAS,IAAGC,QAAQ,CAACC,IAAAA,YAAO,EAACT,OAAOU,GAAG,EAAE,WAAW,CAAC,IAAI,EAAET,MAAM,EAAE,CAAC,IAAI,EAAEA,MAAM;QACtF,OAAO;IACT,EAAE,OAAOP,OAAY;QACnBiB,KAAIC,IAAI,CAAC,CAAC,4BAA4B,EAAEX,KAAK,EAAE,EAAEP,MAAMC,OAAO,EAAE;QAChE,OAAO;IACT;AACF;AAEA,eAAeS,sBAAsBJ,MAAc,EAAEC,IAAY;IAC/D,IAAI,CAACD,OAAOK,YAAY,EAAE;QACxB,OAAO;IACT;IAEA,IAAI;QACF,MAAME,IAAAA,cAAS,IAAGC,QAAQ,CAACC,IAAAA,YAAO,EAACT,OAAOU,GAAG,EAAE,WAAW,YAAY,CAAC,IAAI,EAAET,MAAM;QACnF,OAAO;IACT,EAAE,OAAOP,OAAY;QACnB,sEAAsE;QACtEJ,MAAM,CAAC,yBAAyB,EAAEW,KAAK,EAAE,EAAEP,MAAMC,OAAO,EAAE;QAC1D,OAAO;IACT;AACF"}
@@ -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
- EMULATOR_MAX_WAIT_TIMEOUT: function() {
12
+ get EMULATOR_MAX_WAIT_TIMEOUT () {
13
13
  return EMULATOR_MAX_WAIT_TIMEOUT;
14
14
  },
15
- listAvdsAsync: function() {
15
+ get listAvdsAsync () {
16
16
  return listAvdsAsync;
17
17
  },
18
- startDeviceAsync: function() {
18
+ get startDeviceAsync () {
19
19
  return startDeviceAsync;
20
20
  },
21
- whichEmulator: function() {
21
+ get whichEmulator () {
22
22
  return whichEmulator;
23
23
  }
24
24
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/platforms/android/emulator.ts"],"sourcesContent":["import spawnAsync from '@expo/spawn-async';\nimport chalk from 'chalk';\nimport { spawn } from 'child_process';\nimport os from 'os';\n\nimport { Device, getAttachedDevicesAsync, isBootAnimationCompleteAsync } from './adb';\nimport * as Log from '../../../log';\nimport { AbortCommandError } from '../../../utils/errors';\nimport { installExitHooks } from '../../../utils/exit';\n\nexport const EMULATOR_MAX_WAIT_TIMEOUT = 60 * 1000 * 3;\n\nexport function whichEmulator(): string {\n // https://developer.android.com/studio/command-line/variables\n // TODO: Add ANDROID_SDK_ROOT support as well https://github.com/expo/expo/pull/16516#discussion_r820037917\n if (process.env.ANDROID_HOME) {\n return `${process.env.ANDROID_HOME}/emulator/emulator`;\n }\n return 'emulator';\n}\n\n/** Returns a list of emulator names. */\nexport async function listAvdsAsync(): Promise<Device[]> {\n try {\n const { stdout } = await spawnAsync(whichEmulator(), ['-list-avds']);\n return (\n stdout\n .split(os.EOL)\n .filter(Boolean)\n /**\n * AVD IDs cannot contain spaces. This removes extra info lines from the output. e.g.\n * \"INFO | Storing crashdata in: /tmp/android-brent/emu-crash-34.1.18.db\n */\n .filter((name) => !name.trim().includes(' '))\n .map((name) => ({\n name,\n type: 'emulator',\n // unsure from this\n isBooted: false,\n isAuthorized: true,\n }))\n );\n } catch {\n return [];\n }\n}\n\n/** Start an Android device and wait until it is booted. */\nexport async function startDeviceAsync(\n device: Pick<Device, 'name'>,\n {\n timeout = EMULATOR_MAX_WAIT_TIMEOUT,\n interval = 1000,\n }: {\n /** Time in milliseconds to wait before asserting a timeout error. */\n timeout?: number;\n interval?: number;\n } = {}\n): Promise<Device> {\n Log.log(`\\u203A Opening emulator ${chalk.bold(device.name)}`);\n\n // Start a process to open an emulator\n const emulatorProcess = spawn(\n whichEmulator(),\n [\n `@${device.name}`,\n // disable animation for faster boot -- this might make it harder to detect if it mounted properly tho\n //'-no-boot-anim'\n ],\n {\n stdio: 'ignore',\n detached: true,\n }\n );\n\n emulatorProcess.unref();\n\n return new Promise<Device>((resolve, reject) => {\n const waitTimer = setInterval(async () => {\n try {\n const bootedDevices = await getAttachedDevicesAsync();\n const connected = bootedDevices.find(({ name }) => name === device.name);\n if (connected) {\n const isBooted = await isBootAnimationCompleteAsync(connected.pid);\n if (isBooted) {\n stopWaiting();\n resolve(connected);\n }\n }\n } catch (error) {\n stopWaiting();\n reject(error);\n }\n }, interval);\n\n // Reject command after timeout\n const maxTimer = setTimeout(() => {\n const manualCommand = `${whichEmulator()} @${device.name}`;\n stopWaitingAndReject(\n `It took too long to start the Android emulator: ${device.name}. You can try starting the emulator manually from the terminal with: ${manualCommand}`\n );\n }, timeout);\n\n const stopWaiting = () => {\n clearTimeout(maxTimer);\n clearInterval(waitTimer);\n removeExitHook();\n };\n\n const stopWaitingAndReject = (message: string) => {\n stopWaiting();\n reject(new Error(message));\n };\n\n const removeExitHook = installExitHooks((signal) => {\n stopWaiting();\n emulatorProcess.kill(signal);\n reject(new AbortCommandError());\n });\n\n emulatorProcess.on('error', ({ message }) => stopWaitingAndReject(message));\n\n emulatorProcess.on('exit', () => {\n const manualCommand = `${whichEmulator()} @${device.name}`;\n stopWaitingAndReject(\n `The emulator (${device.name}) quit before it finished opening. You can try starting the emulator manually from the terminal with: ${manualCommand}`\n );\n });\n });\n}\n"],"names":["EMULATOR_MAX_WAIT_TIMEOUT","listAvdsAsync","startDeviceAsync","whichEmulator","process","env","ANDROID_HOME","stdout","spawnAsync","split","os","EOL","filter","Boolean","name","trim","includes","map","type","isBooted","isAuthorized","device","timeout","interval","Log","log","chalk","bold","emulatorProcess","spawn","stdio","detached","unref","Promise","resolve","reject","waitTimer","setInterval","bootedDevices","getAttachedDevicesAsync","connected","find","isBootAnimationCompleteAsync","pid","stopWaiting","error","maxTimer","setTimeout","manualCommand","stopWaitingAndReject","clearTimeout","clearInterval","removeExitHook","message","Error","installExitHooks","signal","kill","AbortCommandError","on"],"mappings":";;;;;;;;;;;IAUaA,yBAAyB;eAAzBA;;IAYSC,aAAa;eAAbA;;IA0BAC,gBAAgB;eAAhBA;;IApCNC,aAAa;eAAbA;;;;gEAZO;;;;;;;gEACL;;;;;;;yBACI;;;;;;;gEACP;;;;;;qBAE+D;6DACzD;wBACa;sBACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE1B,MAAMH,4BAA4B,KAAK,OAAO;AAE9C,SAASG;IACd,8DAA8D;IAC9D,2GAA2G;IAC3G,IAAIC,QAAQC,GAAG,CAACC,YAAY,EAAE;QAC5B,OAAO,GAAGF,QAAQC,GAAG,CAACC,YAAY,CAAC,kBAAkB,CAAC;IACxD;IACA,OAAO;AACT;AAGO,eAAeL;IACpB,IAAI;QACF,MAAM,EAAEM,MAAM,EAAE,GAAG,MAAMC,IAAAA,qBAAU,EAACL,iBAAiB;YAAC;SAAa;QACnE,OACEI,OACGE,KAAK,CAACC,aAAE,CAACC,GAAG,EACZC,MAAM,CAACC,QACR;;;SAGC,IACAD,MAAM,CAAC,CAACE,OAAS,CAACA,KAAKC,IAAI,GAAGC,QAAQ,CAAC,MACvCC,GAAG,CAAC,CAACH,OAAU,CAAA;gBACdA;gBACAI,MAAM;gBACN,mBAAmB;gBACnBC,UAAU;gBACVC,cAAc;YAChB,CAAA;IAEN,EAAE,OAAM;QACN,OAAO,EAAE;IACX;AACF;AAGO,eAAelB,iBACpBmB,MAA4B,EAC5B,EACEC,UAAUtB,yBAAyB,EACn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CAAC,SAAS,CAAC,EAAEN,OAAO,EAAE,GAAKJ,qBAAqBI;QAElEzB,gBAAgB+B,EAAE,CAAC,QAAQ;YACzB,MAAMX,gBAAgB,GAAG7C,gBAAgB,EAAE,EAAEkB,OAAOP,IAAI,EAAE;YAC1DmC,qBACE,CAAC,cAAc,EAAE5B,OAAOP,IAAI,CAAC,sGAAsG,EAAEkC,eAAe;QAExJ;IACF;AACF"}
1
+ {"version":3,"sources":["../../../../../src/start/platforms/android/emulator.ts"],"sourcesContent":["import spawnAsync from '@expo/spawn-async';\nimport chalk from 'chalk';\nimport { spawn } from 'child_process';\nimport os from 'os';\n\nimport type { Device } from './adb';\nimport { getAttachedDevicesAsync, isBootAnimationCompleteAsync } from './adb';\nimport * as Log from '../../../log';\nimport { AbortCommandError } from '../../../utils/errors';\nimport { installExitHooks } from '../../../utils/exit';\n\nexport const EMULATOR_MAX_WAIT_TIMEOUT = 60 * 1000 * 3;\n\nexport function whichEmulator(): string {\n // https://developer.android.com/studio/command-line/variables\n // TODO: Add ANDROID_SDK_ROOT support as well https://github.com/expo/expo/pull/16516#discussion_r820037917\n if (process.env.ANDROID_HOME) {\n return `${process.env.ANDROID_HOME}/emulator/emulator`;\n }\n return 'emulator';\n}\n\n/** Returns a list of emulator names. */\nexport async function listAvdsAsync(): Promise<Device[]> {\n try {\n const { stdout } = await spawnAsync(whichEmulator(), ['-list-avds']);\n return (\n stdout\n .split(os.EOL)\n .filter(Boolean)\n /**\n * AVD IDs cannot contain spaces. This removes extra info lines from the output. e.g.\n * \"INFO | Storing crashdata in: /tmp/android-brent/emu-crash-34.1.18.db\n */\n .filter((name) => !name.trim().includes(' '))\n .map((name) => ({\n name,\n type: 'emulator',\n // unsure from this\n isBooted: false,\n isAuthorized: true,\n }))\n );\n } catch {\n return [];\n }\n}\n\n/** Start an Android device and wait until it is booted. */\nexport async function startDeviceAsync(\n device: Pick<Device, 'name'>,\n {\n timeout = EMULATOR_MAX_WAIT_TIMEOUT,\n interval = 1000,\n }: {\n /** Time in milliseconds to wait before asserting a timeout error. */\n timeout?: number;\n interval?: number;\n } = {}\n): Promise<Device> {\n Log.log(`\\u203A Opening emulator ${chalk.bold(device.name)}`);\n\n // Start a process to open an emulator\n const emulatorProcess = spawn(\n whichEmulator(),\n [\n `@${device.name}`,\n // disable animation for faster boot -- this might make it harder to detect if it mounted properly tho\n //'-no-boot-anim'\n ],\n {\n stdio: 'ignore',\n detached: true,\n }\n );\n\n emulatorProcess.unref();\n\n return new Promise<Device>((resolve, reject) => {\n const waitTimer = setInterval(async () => {\n try {\n const bootedDevices = await getAttachedDevicesAsync();\n const connected = bootedDevices.find(({ name }) => name === device.name);\n if (connected) {\n const isBooted = await isBootAnimationCompleteAsync(connected.pid);\n if (isBooted) {\n stopWaiting();\n resolve(connected);\n }\n }\n } catch (error) {\n stopWaiting();\n reject(error);\n }\n }, interval);\n\n // Reject command after timeout\n const maxTimer = setTimeout(() => {\n const manualCommand = `${whichEmulator()} @${device.name}`;\n stopWaitingAndReject(\n `It took too long to start the Android emulator: ${device.name}. You can try starting the emulator manually from the terminal with: ${manualCommand}`\n );\n }, timeout);\n\n const stopWaiting = () => {\n clearTimeout(maxTimer);\n clearInterval(waitTimer);\n removeExitHook();\n };\n\n const stopWaitingAndReject = (message: string) => {\n stopWaiting();\n reject(new Error(message));\n };\n\n const removeExitHook = installExitHooks((signal) => {\n stopWaiting();\n emulatorProcess.kill(signal);\n reject(new AbortCommandError());\n });\n\n emulatorProcess.on('error', ({ message }) => stopWaitingAndReject(message));\n\n emulatorProcess.on('exit', () => {\n const manualCommand = `${whichEmulator()} @${device.name}`;\n stopWaitingAndReject(\n `The emulator (${device.name}) quit before it finished opening. You can try starting the emulator manually from the terminal with: ${manualCommand}`\n );\n });\n });\n}\n"],"names":["EMULATOR_MAX_WAIT_TIMEOUT","listAvdsAsync","startDeviceAsync","whichEmulator","process","env","ANDROID_HOME","stdout","spawnAsync","split","os","EOL","filter","Boolean","name","trim","includes","map","type","isBooted","isAuthorized","device","timeout","interval","Log","log","chalk","bold","emulatorProcess","spawn","stdio","detached","unref","Promise","resolve","reject","waitTimer","setInterval","bootedDevices","getAttachedDevicesAsync","connected","find","isBootAnimationCompleteAsync","pid","stopWaiting","error","maxTimer","setTimeout","manualCommand","stopWaitingAndReject","clearTimeout","clearInterval","removeExitHook","message","Error","installExitHooks","signal","kill","AbortCommandError","on"],"mappings":";;;;;;;;;;;QAWaA;eAAAA;;QAYSC;eAAAA;;QA0BAC;eAAAA;;QApCNC;eAAAA;;;;gEAbO;;;;;;;gEACL;;;;;;;yBACI;;;;;;;gEACP;;;;;;qBAGuD;6DACjD;wBACa;sBACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE1B,MAAMH,4BAA4B,KAAK,OAAO;AAE9C,SAASG;IACd,8DAA8D;IAC9D,2GAA2G;IAC3G,IAAIC,QAAQC,GAAG,CAACC,YAAY,EAAE;QAC5B,OAAO,GAAGF,QAAQC,GAAG,CAACC,YAAY,CAAC,kBAAkB,CAAC;IACxD;IACA,OAAO;AACT;AAGO,eAAeL;IACpB,IAAI;QACF,MAAM,EAAEM,MAAM,EAAE,GAAG,MAAMC,IAAAA,qBAAU,EAACL,iBAAiB;YAAC;SAAa;QACnE,OACEI,OACGE,KAAK,CAACC,aAAE,CAACC,GAAG,EACZC,MAAM,CAACC,QACR;;;SAGC,IACAD,MAAM,CAAC,CAACE,OAAS,CAACA,KAAKC,IAAI,GAAGC,QAAQ,CAAC,MACvCC,GAAG,CAAC,CAACH,OAAU,CAAA;gBACdA;gBACAI,MAAM;gBACN,mBAAmB;gBACnBC,UAAU;gBACVC,cAAc;YAChB,CAAA;IAEN,EAAE,OAAM;QACN,OAAO,EAAE;IACX;AACF;AAGO,eAAelB,iBACpBmB,MAA4B,EAC5B,EACEC,UAAUtB,yBAAyB,EACnCuB,WAAW,IAAI,EAKhB,GAAG,CAAC,CAAC;IAENC,KAAIC,GAAG,CAAC,CAAC,wBAAw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,CAAC,QAAQ;YACzB,MAAMX,gBAAgB,GAAG7C,gBAAgB,EAAE,EAAEkB,OAAOP,IAAI,EAAE;YAC1DmC,qBACE,CAAC,cAAc,EAAE5B,OAAOP,IAAI,CAAC,sGAAsG,EAAEkC,eAAe;QAExJ;IACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/platforms/android/getDevices.ts"],"sourcesContent":["import { Device, getAttachedDevicesAsync } from './adb';\nimport { listAvdsAsync } from './emulator';\nimport { CommandError } from '../../../utils/errors';\n\n/** Get a list of all devices including offline emulators. Asserts if no devices are available. */\nexport async function getDevicesAsync(): Promise<Device[]> {\n const bootedDevices = await getAttachedDevicesAsync();\n\n const data = await listAvdsAsync();\n const connectedNames = bootedDevices.map(({ name }) => name);\n\n const offlineEmulators = data\n .filter(({ name }) => !connectedNames.includes(name))\n .map(({ name, type }) => {\n return {\n name,\n type,\n isBooted: false,\n // TODO: Are emulators always authorized?\n isAuthorized: true,\n };\n });\n\n const allDevices = bootedDevices.concat(offlineEmulators);\n\n if (!allDevices.length) {\n throw new CommandError(\n [\n `No Android connected device found, and no emulators could be started automatically.`,\n `Connect a device or create an emulator (https://docs.expo.dev/workflow/android-studio-emulator).`,\n `Then follow the instructions here to enable USB debugging:`,\n `https://developer.android.com/studio/run/device.html#developer-device-options. If you are using Genymotion go to Settings -> ADB, select \"Use custom Android SDK tools\", and point it at your Android SDK directory.`,\n ].join('\\n')\n );\n }\n\n return allDevices;\n}\n"],"names":["getDevicesAsync","bootedDevices","getAttachedDevicesAsync","data","listAvdsAsync","connectedNames","map","name","offlineEmulators","filter","includes","type","isBooted","isAuthorized","allDevices","concat","length","CommandError","join"],"mappings":";;;;+BAKsBA;;;eAAAA;;;qBAL0B;0BAClB;wBACD;AAGtB,eAAeA;IACpB,MAAMC,gBAAgB,MAAMC,IAAAA,4BAAuB;IAEnD,MAAMC,OAAO,MAAMC,IAAAA,uBAAa;IAChC,MAAMC,iBAAiBJ,cAAcK,GAAG,CAAC,CAAC,EAAEC,IAAI,EAAE,GAAKA;IAEvD,MAAMC,mBAAmBL,KACtBM,MAAM,CAAC,CAAC,EAAEF,IAAI,EAAE,GAAK,CAACF,eAAeK,QAAQ,CAACH,OAC9CD,GAAG,CAAC,CAAC,EAAEC,IAAI,EAAEI,IAAI,EAAE;QAClB,OAAO;YACLJ;YACAI;YACAC,UAAU;YACV,yCAAyC;YACzCC,cAAc;QAChB;IACF;IAEF,MAAMC,aAAab,cAAcc,MAAM,CAACP;IAExC,IAAI,CAACM,WAAWE,MAAM,EAAE;QACtB,MAAM,IAAIC,oBAAY,CACpB;YACE,CAAC,mFAAmF,CAAC;YACrF,CAAC,gGAAgG,CAAC;YAClG,CAAC,0DAA0D,CAAC;YAC5D,CAAC,oNAAoN,CAAC;SACvN,CAACC,IAAI,CAAC;IAEX;IAEA,OAAOJ;AACT"}
1
+ {"version":3,"sources":["../../../../../src/start/platforms/android/getDevices.ts"],"sourcesContent":["import type { Device } from './adb';\nimport { getAttachedDevicesAsync } from './adb';\nimport { listAvdsAsync } from './emulator';\nimport { CommandError } from '../../../utils/errors';\n\n/** Get a list of all devices including offline emulators. Asserts if no devices are available. */\nexport async function getDevicesAsync(): Promise<Device[]> {\n const bootedDevices = await getAttachedDevicesAsync();\n\n const data = await listAvdsAsync();\n const connectedNames = bootedDevices.map(({ name }) => name);\n\n const offlineEmulators = data\n .filter(({ name }) => !connectedNames.includes(name))\n .map(({ name, type }) => {\n return {\n name,\n type,\n isBooted: false,\n // TODO: Are emulators always authorized?\n isAuthorized: true,\n };\n });\n\n const allDevices = bootedDevices.concat(offlineEmulators);\n\n if (!allDevices.length) {\n throw new CommandError(\n [\n `No Android connected device found, and no emulators could be started automatically.`,\n `Connect a device or create an emulator (https://docs.expo.dev/workflow/android-studio-emulator).`,\n `Then follow the instructions here to enable USB debugging:`,\n `https://developer.android.com/studio/run/device.html#developer-device-options. If you are using Genymotion go to Settings -> ADB, select \"Use custom Android SDK tools\", and point it at your Android SDK directory.`,\n ].join('\\n')\n );\n }\n\n return allDevices;\n}\n"],"names":["getDevicesAsync","bootedDevices","getAttachedDevicesAsync","data","listAvdsAsync","connectedNames","map","name","offlineEmulators","filter","includes","type","isBooted","isAuthorized","allDevices","concat","length","CommandError","join"],"mappings":";;;;+BAMsBA;;;eAAAA;;;qBALkB;0BACV;wBACD;AAGtB,eAAeA;IACpB,MAAMC,gBAAgB,MAAMC,IAAAA,4BAAuB;IAEnD,MAAMC,OAAO,MAAMC,IAAAA,uBAAa;IAChC,MAAMC,iBAAiBJ,cAAcK,GAAG,CAAC,CAAC,EAAEC,IAAI,EAAE,GAAKA;IAEvD,MAAMC,mBAAmBL,KACtBM,MAAM,CAAC,CAAC,EAAEF,IAAI,EAAE,GAAK,CAACF,eAAeK,QAAQ,CAACH,OAC9CD,GAAG,CAAC,CAAC,EAAEC,IAAI,EAAEI,IAAI,EAAE;QAClB,OAAO;YACLJ;YACAI;YACAC,UAAU;YACV,yCAAyC;YACzCC,cAAc;QAChB;IACF;IAEF,MAAMC,aAAab,cAAcc,MAAM,CAACP;IAExC,IAAI,CAACM,WAAWE,MAAM,EAAE;QACtB,MAAM,IAAIC,oBAAY,CACpB;YACE,CAAC,mFAAmF,CAAC;YACrF,CAAC,gGAAgG,CAAC;YAClG,CAAC,0DAA0D,CAAC;YAC5D,CAAC,oNAAoN,CAAC;SACvN,CAACC,IAAI,CAAC;IAEX;IAEA,OAAOJ;AACT"}
@@ -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
- assembleAsync: function() {
12
+ get assembleAsync () {
13
13
  return assembleAsync;
14
14
  },
15
- formatGradleArguments: function() {
15
+ get formatGradleArguments () {
16
16
  return formatGradleArguments;
17
17
  },
18
- installAsync: function() {
18
+ get installAsync () {
19
19
  return installAsync;
20
20
  },
21
- spawnGradleAsync: function() {
21
+ get spawnGradleAsync () {
22
22
  return spawnGradleAsync;
23
23
  }
24
24
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/platforms/android/gradle.ts"],"sourcesContent":["import spawnAsync, { SpawnResult } from '@expo/spawn-async';\nimport path from 'path';\n\nimport { env } from '../../../utils/env';\nimport { AbortCommandError } from '../../../utils/errors';\n\nconst debug = require('debug')('expo:start:platforms:android:gradle') as typeof console.log;\n\nfunction upperFirst(name: string) {\n return name.charAt(0).toUpperCase() + name.slice(1);\n}\n\n/** Format gradle assemble arguments. Exposed for testing. */\nexport function formatGradleArguments(\n cmd: 'assemble' | 'install',\n {\n appName,\n variant,\n tasks = [cmd + upperFirst(variant)],\n }: { tasks?: string[]; variant: string; appName: string }\n): string[] {\n return appName ? tasks.map((task) => `${appName}:${task}`) : tasks;\n}\n\nfunction resolveGradleWPath(androidProjectPath: string): string {\n return path.join(androidProjectPath, process.platform === 'win32' ? 'gradlew.bat' : 'gradlew');\n}\n\nfunction getPortArg(port: number): string {\n return `-PreactNativeDevServerPort=${port}`;\n}\n\nfunction getActiveArchArg(architectures: string): string {\n return `-PreactNativeArchitectures=${architectures}`;\n}\n\n/**\n * Build the Android project using Gradle.\n *\n * @param androidProjectPath - Path to the Android project like `projectRoot/android`.\n * @param props.variant - Variant to install.\n * @param props.appName - Name of the 'app' folder, this appears to always be `app`.\n * @param props.port - Dev server port to pass to the install command.\n * @param props.buildCache - Should use the `--build-cache` flag, enabling the [Gradle build cache](https://docs.gradle.org/current/userguide/build_cache.html).\n * @param props.architectures - Architectures to build for.\n * @returns - A promise resolving to spawn results.\n */\nexport async function assembleAsync(\n androidProjectPath: string,\n {\n variant,\n port,\n appName,\n buildCache,\n architectures,\n eagerBundleOptions,\n }: {\n variant: string;\n port?: number;\n appName: string;\n buildCache?: boolean;\n architectures?: string;\n eagerBundleOptions?: string;\n }\n): Promise<SpawnResult> {\n const task = formatGradleArguments('assemble', { variant, appName });\n const args = [\n ...task,\n // ignore linting errors\n '-x',\n 'lint',\n // ignore tests\n '-x',\n 'test',\n '--configure-on-demand',\n ];\n\n if (buildCache) args.push('--build-cache');\n\n // Generate a profile under `/android/app/build/reports/profile`\n if (env.EXPO_PROFILE) args.push('--profile');\n\n return await spawnGradleAsync(androidProjectPath, {\n port,\n architectures,\n args,\n env: eagerBundleOptions\n ? {\n __EXPO_EAGER_BUNDLE_OPTIONS: eagerBundleOptions,\n }\n : {},\n });\n}\n\n/**\n * Install an app on device or emulator using `gradlew install`.\n *\n * @param androidProjectPath - Path to the Android project like `projectRoot/android`.\n * @param props.variant - Variant to install.\n * @param props.appName - Name of the 'app' folder, this appears to always be `app`.\n * @param props.port - Dev server port to pass to the install command.\n * @returns - A promise resolving to spawn results.\n */\nexport async function installAsync(\n androidProjectPath: string,\n {\n variant,\n appName,\n port,\n }: {\n variant: string;\n appName: string;\n port?: number;\n }\n): Promise<SpawnResult> {\n const args = formatGradleArguments('install', { variant, appName });\n return await spawnGradleAsync(androidProjectPath, { port, args });\n}\n\nexport async function spawnGradleAsync(\n projectRoot: string,\n {\n port,\n architectures,\n args,\n env,\n }: { port?: number; architectures?: string; args: string[]; env?: Record<string, string> }\n): Promise<SpawnResult> {\n const gradlew = resolveGradleWPath(projectRoot);\n if (port != null) args.push(getPortArg(port));\n if (architectures) args.push(getActiveArchArg(architectures));\n debug(` ${gradlew} ${args.join(' ')}`);\n try {\n return await spawnAsync(gradlew, args, {\n cwd: projectRoot,\n stdio: 'inherit',\n env: {\n ...process.env,\n ...(env ?? {}),\n },\n });\n } catch (error: any) {\n // User aborted the command with ctrl-c\n if (error.status === 130) {\n // Fail silently\n throw new AbortCommandError();\n }\n throw error;\n }\n}\n"],"names":["assembleAsync","formatGradleArguments","installAsync","spawnGradleAsync","debug","require","upperFirst","name","charAt","toUpperCase","slice","cmd","appName","variant","tasks","map","task","resolveGradleWPath","androidProjectPath","path","join","process","platform","getPortArg","port","getActiveArchArg","architectures","buildCache","eagerBundleOptions","args","push","env","EXPO_PROFILE","__EXPO_EAGER_BUNDLE_OPTIONS","projectRoot","gradlew","spawnAsync","cwd","stdio","error","status","AbortCommandError"],"mappings":";;;;;;;;;;;IA+CsBA,aAAa;eAAbA;;IAlCNC,qBAAqB;eAArBA;;IA0FMC,YAAY;eAAZA;;IAgBAC,gBAAgB;eAAhBA;;;;gEAvHkB;;;;;;;gEACvB;;;;;;qBAEG;wBACc;;;;;;AAElC,MAAMC,QAAQC,QAAQ,SAAS;AAE/B,SAASC,WAAWC,IAAY;IAC9B,OAAOA,KAAKC,MAAM,CAAC,GAAGC,WAAW,KAAKF,KAAKG,KAAK,CAAC;AACnD;AAGO,SAAST,sBACdU,GAA2B,EAC3B,EACEC,OAAO,EACPC,OAAO,EACPC,QAAQ;IAACH,MAAML,WAAWO;CAAS,EACoB;IAEzD,OAAOD,UAAUE,MAAMC,GAAG,CAAC,CAACC,OAAS,GAAGJ,QAAQ,CAAC,EAAEI,MAAM,IAAIF;AAC/D;AAEA,SAASG,mBAAmBC,kBAA0B;IACpD,OAAOC,eAAI,CAACC,IAAI,CAACF,oBAAoBG,QAAQC,QAAQ,KAAK,UAAU,gBAAgB;AACtF;AAEA,SAASC,WAAWC,IAAY;IAC9B,OAAO,CAAC,2BAA2B,EAAEA,MAAM;AAC7C;AAEA,SAASC,iBAAiBC,aAAqB;IAC7C,OAAO,CAAC,2BAA2B,EAAEA,eAAe;AACtD;AAaO,eAAe1B,cACpBkB,kBAA0B,EAC1B,EACEL,OAAO,EACPW,IAAI,EACJZ,OAAO,EACPe,UAAU,EACVD,aAAa,EACbE,kBAAkB,EAQnB;IAED,MAAMZ,OAAOf,sBAAsB,YAAY;QAAEY;QAASD;IAAQ;IAClE,MAAMiB,OAAO;WACRb;QACH,wBAAwB;QACxB;QACA;QACA,eAAe;QACf;QACA;QACA;KACD;IAED,IAAIW,YAAYE,KAAKC,IAAI,CAAC;IAE1B,gEAAgE;IAChE,IAAIC,QAAG,CAACC,YAAY,EAAEH,KAAKC,IAAI,CAAC;IAEhC,OAAO,MAAM3B,iBAAiBe,oBAAoB;QAChDM;QACAE;QACAG;QACAE,KAAKH,qBACD;YACEK,6BAA6BL;QAC/B,IACA,CAAC;IACP;AACF;AAWO,eAAe1B,aACpBgB,kBAA0B,EAC1B,EACEL,OAAO,EACPD,OAAO,EACPY,IAAI,EAKL;IAED,MAAMK,OAAO5B,sBAAsB,WAAW;QAAEY;QAASD;IAAQ;IACjE,OAAO,MAAMT,iBAAiBe,oBAAoB;QAAEM;QAAMK;IAAK;AACjE;AAEO,eAAe1B,iBACpB+B,WAAmB,EACnB,EACEV,IAAI,EACJE,aAAa,EACbG,IAAI,EACJE,GAAG,EACqF;IAE1F,MAAMI,UAAUlB,mBAAmBiB;IACnC,IAAIV,QAAQ,MAAMK,KAAKC,IAAI,CAACP,WAAWC;IACvC,IAAIE,eAAeG,KAAKC,IAAI,CAACL,iBAAiBC;IAC9CtB,MAAM,CAAC,EAAE,EAAE+B,QAAQ,CAAC,EAAEN,KAAKT,IAAI,CAAC,MAAM;IACtC,IAAI;QACF,OAAO,MAAMgB,IAAAA,qBAAU,EAACD,SAASN,MAAM;YACrCQ,KAAKH;YACLI,OAAO;YACPP,KAAK;gBACH,GAAGV,QAAQU,GAAG;gBACd,GAAIA,OAAO,CAAC,CAAC;YACf;QACF;IACF,EAAE,OAAOQ,OAAY;QACnB,uCAAuC;QACvC,IAAIA,MAAMC,MAAM,KAAK,KAAK;YACxB,gBAAgB;YAChB,MAAM,IAAIC,yBAAiB;QAC7B;QACA,MAAMF;IACR;AACF"}
1
+ {"version":3,"sources":["../../../../../src/start/platforms/android/gradle.ts"],"sourcesContent":["import type { SpawnResult } from '@expo/spawn-async';\nimport spawnAsync from '@expo/spawn-async';\nimport path from 'path';\n\nimport { env } from '../../../utils/env';\nimport { AbortCommandError } from '../../../utils/errors';\n\nconst debug = require('debug')('expo:start:platforms:android:gradle') as typeof console.log;\n\nfunction upperFirst(name: string) {\n return name.charAt(0).toUpperCase() + name.slice(1);\n}\n\n/** Format gradle assemble arguments. Exposed for testing. */\nexport function formatGradleArguments(\n cmd: 'assemble' | 'install',\n {\n appName,\n variant,\n tasks = [cmd + upperFirst(variant)],\n }: { tasks?: string[]; variant: string; appName: string }\n): string[] {\n return appName ? tasks.map((task) => `${appName}:${task}`) : tasks;\n}\n\nfunction resolveGradleWPath(androidProjectPath: string): string {\n return path.join(androidProjectPath, process.platform === 'win32' ? 'gradlew.bat' : 'gradlew');\n}\n\nfunction getPortArg(port: number): string {\n return `-PreactNativeDevServerPort=${port}`;\n}\n\nfunction getActiveArchArg(architectures: string): string {\n return `-PreactNativeArchitectures=${architectures}`;\n}\n\n/**\n * Build the Android project using Gradle.\n *\n * @param androidProjectPath - Path to the Android project like `projectRoot/android`.\n * @param props.variant - Variant to install.\n * @param props.appName - Name of the 'app' folder, this appears to always be `app`.\n * @param props.port - Dev server port to pass to the install command.\n * @param props.buildCache - Should use the `--build-cache` flag, enabling the [Gradle build cache](https://docs.gradle.org/current/userguide/build_cache.html).\n * @param props.architectures - Architectures to build for.\n * @returns - A promise resolving to spawn results.\n */\nexport async function assembleAsync(\n androidProjectPath: string,\n {\n variant,\n port,\n appName,\n buildCache,\n architectures,\n eagerBundleOptions,\n }: {\n variant: string;\n port?: number;\n appName: string;\n buildCache?: boolean;\n architectures?: string;\n eagerBundleOptions?: string;\n }\n): Promise<SpawnResult> {\n const task = formatGradleArguments('assemble', { variant, appName });\n const args = [\n ...task,\n // ignore linting errors\n '-x',\n 'lint',\n // ignore tests\n '-x',\n 'test',\n '--configure-on-demand',\n ];\n\n if (buildCache) args.push('--build-cache');\n\n // Generate a profile under `/android/app/build/reports/profile`\n if (env.EXPO_PROFILE) args.push('--profile');\n\n return await spawnGradleAsync(androidProjectPath, {\n port,\n architectures,\n args,\n env: eagerBundleOptions\n ? {\n __EXPO_EAGER_BUNDLE_OPTIONS: eagerBundleOptions,\n }\n : {},\n });\n}\n\n/**\n * Install an app on device or emulator using `gradlew install`.\n *\n * @param androidProjectPath - Path to the Android project like `projectRoot/android`.\n * @param props.variant - Variant to install.\n * @param props.appName - Name of the 'app' folder, this appears to always be `app`.\n * @param props.port - Dev server port to pass to the install command.\n * @returns - A promise resolving to spawn results.\n */\nexport async function installAsync(\n androidProjectPath: string,\n {\n variant,\n appName,\n port,\n }: {\n variant: string;\n appName: string;\n port?: number;\n }\n): Promise<SpawnResult> {\n const args = formatGradleArguments('install', { variant, appName });\n return await spawnGradleAsync(androidProjectPath, { port, args });\n}\n\nexport async function spawnGradleAsync(\n projectRoot: string,\n {\n port,\n architectures,\n args,\n env,\n }: { port?: number; architectures?: string; args: string[]; env?: Record<string, string> }\n): Promise<SpawnResult> {\n const gradlew = resolveGradleWPath(projectRoot);\n if (port != null) args.push(getPortArg(port));\n if (architectures) args.push(getActiveArchArg(architectures));\n debug(` ${gradlew} ${args.join(' ')}`);\n try {\n return await spawnAsync(gradlew, args, {\n cwd: projectRoot,\n stdio: 'inherit',\n env: {\n ...process.env,\n ...(env ?? {}),\n },\n });\n } catch (error: any) {\n // User aborted the command with ctrl-c\n if (error.status === 130) {\n // Fail silently\n throw new AbortCommandError();\n }\n throw error;\n }\n}\n"],"names":["assembleAsync","formatGradleArguments","installAsync","spawnGradleAsync","debug","require","upperFirst","name","charAt","toUpperCase","slice","cmd","appName","variant","tasks","map","task","resolveGradleWPath","androidProjectPath","path","join","process","platform","getPortArg","port","getActiveArchArg","architectures","buildCache","eagerBundleOptions","args","push","env","EXPO_PROFILE","__EXPO_EAGER_BUNDLE_OPTIONS","projectRoot","gradlew","spawnAsync","cwd","stdio","error","status","AbortCommandError"],"mappings":";;;;;;;;;;;QAgDsBA;eAAAA;;QAlCNC;eAAAA;;QA0FMC;eAAAA;;QAgBAC;eAAAA;;;;gEAvHC;;;;;;;gEACN;;;;;;qBAEG;wBACc;;;;;;AAElC,MAAMC,QAAQC,QAAQ,SAAS;AAE/B,SAASC,WAAWC,IAA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IAAK;AACjE;AAEO,eAAe1B,iBACpB+B,WAAmB,EACnB,EACEV,IAAI,EACJE,aAAa,EACbG,IAAI,EACJE,GAAG,EACqF;IAE1F,MAAMI,UAAUlB,mBAAmBiB;IACnC,IAAIV,QAAQ,MAAMK,KAAKC,IAAI,CAACP,WAAWC;IACvC,IAAIE,eAAeG,KAAKC,IAAI,CAACL,iBAAiBC;IAC9CtB,MAAM,CAAC,EAAE,EAAE+B,QAAQ,CAAC,EAAEN,KAAKT,IAAI,CAAC,MAAM;IACtC,IAAI;QACF,OAAO,MAAMgB,IAAAA,qBAAU,EAACD,SAASN,MAAM;YACrCQ,KAAKH;YACLI,OAAO;YACPP,KAAK;gBACH,GAAGV,QAAQU,GAAG;gBACd,GAAIA,OAAO,CAAC,CAAC;YACf;QACF;IACF,EAAE,OAAOQ,OAAY;QACnB,uCAAuC;QACvC,IAAIA,MAAMC,MAAM,KAAK,KAAK;YACxB,gBAAgB;YAChB,MAAM,IAAIC,yBAAiB;QAC7B;QACA,MAAMF;IACR;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
- formatDeviceChoice: function() {
12
+ get formatDeviceChoice () {
13
13
  return formatDeviceChoice;
14
14
  },
15
- promptForDeviceAsync: function() {
15
+ get promptForDeviceAsync () {
16
16
  return promptForDeviceAsync;
17
17
  }
18
18
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/platforms/android/promptAndroidDevice.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport { Device, logUnauthorized } from './adb';\nimport { AbortCommandError } from '../../../utils/errors';\nimport { createSelectionFilter, promptAsync } from '../../../utils/prompts';\n\nexport async function promptForDeviceAsync(devices: Device[]): Promise<Device> {\n // TODO: provide an option to add or download more simulators\n\n const { value } = await promptAsync({\n type: 'autocomplete',\n name: 'value',\n limit: 11,\n message: 'Select a device/emulator',\n choices: devices.map((item) => formatDeviceChoice(item)),\n suggest: createSelectionFilter(),\n });\n\n const device = devices.find(({ name }) => name === value);\n\n if (device?.isAuthorized === false) {\n logUnauthorized(device);\n throw new AbortCommandError();\n }\n\n return device!;\n}\n\n/**\n * Format the device for prompt list.\n * @internal - Exposed for testing.\n */\nexport function formatDeviceChoice(device: Device): { title: string; value: string } {\n const symbol = getDeviceChoiceSymbol(device);\n const name = getDeviceChoiceName(device);\n const type = chalk.dim(device.isAuthorized ? device.type : 'unauthorized');\n\n return {\n value: device.name,\n title: `${symbol}${name} (${type})`,\n };\n}\n\n/** Get the styled symbol of the device, based on ADB connection type (usb vs network) */\nfunction getDeviceChoiceSymbol(device: Device) {\n if (device.type === 'device' && device.connectionType === 'Network') {\n return '🌐 ';\n }\n\n if (device.type === 'device') {\n return '🔌 ';\n }\n\n return '';\n}\n\n/** Get the styled name of the device, based on device state */\nfunction getDeviceChoiceName(device: Device) {\n // Use no style changes for a disconnected device that is available to be opened.\n if (!device.isBooted) {\n return device.name;\n }\n\n // A device that is connected and ready to be used should be bolded to match iOS.\n if (device.isAuthorized) {\n return chalk.bold(device.name);\n }\n\n // Devices that are unauthorized and connected cannot be used, but they are connected so gray them out.\n return chalk.bold(chalk.gray(device.name));\n}\n"],"names":["formatDeviceChoice","promptForDeviceAsync","devices","value","promptAsync","type","name","limit","message","choices","map","item","suggest","createSelectionFilter","device","find","isAuthorized","logUnauthorized","AbortCommandError","symbol","getDeviceChoiceSymbol","getDeviceChoiceName","chalk","dim","title","connectionType","isBooted","bold","gray"],"mappings":";;;;;;;;;;;IAgCgBA,kBAAkB;eAAlBA;;IA1BMC,oBAAoB;eAApBA;;;;gEANJ;;;;;;qBAEsB;wBACN;yBACiB;;;;;;AAE5C,eAAeA,qBAAqBC,OAAiB;IAC1D,6DAA6D;IAE7D,MAAM,EAAEC,KAAK,EAAE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../../../../../src/start/platforms/android/promptAndroidDevice.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport type { Device } from './adb';\nimport { logUnauthorized } from './adb';\nimport { AbortCommandError } from '../../../utils/errors';\nimport { createSelectionFilter, promptAsync } from '../../../utils/prompts';\n\nexport async function promptForDeviceAsync(devices: Device[]): Promise<Device> {\n // TODO: provide an option to add or download more simulators\n\n const { value } = await promptAsync({\n type: 'autocomplete',\n name: 'value',\n limit: 11,\n message: 'Select a device/emulator',\n choices: devices.map((item) => formatDeviceChoice(item)),\n suggest: createSelectionFilter(),\n });\n\n const device = devices.find(({ name }) => name === value);\n\n if (device?.isAuthorized === false) {\n logUnauthorized(device);\n throw new AbortCommandError();\n }\n\n return device!;\n}\n\n/**\n * Format the device for prompt list.\n * @internal - Exposed for testing.\n */\nexport function formatDeviceChoice(device: Device): { title: string; value: string } {\n const symbol = getDeviceChoiceSymbol(device);\n const name = getDeviceChoiceName(device);\n const type = chalk.dim(device.isAuthorized ? device.type : 'unauthorized');\n\n return {\n value: device.name,\n title: `${symbol}${name} (${type})`,\n };\n}\n\n/** Get the styled symbol of the device, based on ADB connection type (usb vs network) */\nfunction getDeviceChoiceSymbol(device: Device) {\n if (device.type === 'device' && device.connectionType === 'Network') {\n return '🌐 ';\n }\n\n if (device.type === 'device') {\n return '🔌 ';\n }\n\n return '';\n}\n\n/** Get the styled name of the device, based on device state */\nfunction getDeviceChoiceName(device: Device) {\n // Use no style changes for a disconnected device that is available to be opened.\n if (!device.isBooted) {\n return device.name;\n }\n\n // A device that is connected and ready to be used should be bolded to match iOS.\n if (device.isAuthorized) {\n return chalk.bold(device.name);\n }\n\n // Devices that are unauthorized and connected cannot be used, but they are connected so gray them out.\n return chalk.bold(chalk.gray(device.name));\n}\n"],"names":["formatDeviceChoice","promptForDeviceAsync","devices","value","promptAsync","type","name","limit","message","choices","map","item","suggest","createSelectionFilter","device","find","isAuthorized","logUnauthorized","AbortCommandError","symbol","getDeviceChoiceSymbol","getDeviceChoi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jF,IAAIQ,OAAOE,YAAY,EAAE;QACvB,OAAOM,gBAAK,CAACK,IAAI,CAACb,OAAOR,IAAI;IAC/B;IAEA,uGAAuG;IACvG,OAAOgB,gBAAK,CAACK,IAAI,CAACL,gBAAK,CAACM,IAAI,CAACd,OAAOR,IAAI;AAC1C"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/platforms/ios/AppleAppIdResolver.ts"],"sourcesContent":["import { IOSConfig } from '@expo/config-plugins';\nimport plist from '@expo/plist';\nimport fs from 'fs';\n\nimport { AppIdResolver } from '../AppIdResolver';\n\nconst debug = require('debug')('expo:start:platforms:ios:AppleAppIdResolver') as typeof console.log;\n\n/** Resolves the iOS bundle identifier from the Expo config or native files. */\nexport class AppleAppIdResolver extends AppIdResolver {\n constructor(projectRoot: string) {\n super(projectRoot, 'ios', 'ios.bundleIdentifier');\n }\n\n /** @return `true` if the app has valid `*.pbxproj` file */\n async hasNativeProjectAsync(): Promise<boolean> {\n try {\n // Never returns nullish values.\n return !!IOSConfig.Paths.getAllPBXProjectPaths(this.projectRoot).length;\n } catch (error: any) {\n debug('Expected error checking for native project:', error.message);\n return false;\n }\n }\n\n async resolveAppIdFromNativeAsync(): Promise<string | null> {\n // Check xcode project\n try {\n const bundleId = IOSConfig.BundleIdentifier.getBundleIdentifierFromPbxproj(this.projectRoot);\n if (bundleId) {\n return bundleId;\n }\n } catch (error: any) {\n debug('Expected error resolving the bundle identifier from the pbxproj:', error);\n }\n\n // Check Info.plist\n try {\n const infoPlistPath = IOSConfig.Paths.getInfoPlistPath(this.projectRoot);\n const data = await plist.parse(fs.readFileSync(infoPlistPath, 'utf8'));\n if (data.CFBundleIdentifier && !data.CFBundleIdentifier.startsWith('$(')) {\n return data.CFBundleIdentifier;\n }\n } catch (error) {\n debug('Expected error resolving the bundle identifier from the project Info.plist:', error);\n }\n\n return null;\n }\n}\n"],"names":["AppleAppIdResolver","debug","require","AppIdResolver","constructor","projectRoot","hasNativeProjectAsync","IOSConfig","Paths","getAllPBXProjectPaths","length","error","message","resolveAppIdFromNativeAsync","bundleId","BundleIdentifier","getBundleIdentifierFromPbxproj","infoPlistPath","getInfoPlistPath","data","plist","parse","fs","readFileSync","CFBundleIdentifier","startsWith"],"mappings":";;;;+BASaA;;;eAAAA;;;;yBATa;;;;;;;gEACR;;;;;;;gEACH;;;;;;+BAEe;;;;;;AAE9B,MAAMC,QAAQC,QAAQ,SAAS;AAGxB,MAAMF,2BAA2BG,4BAAa;IACnDC,YAAYC,WAAmB,CAAE;QAC/B,KAAK,CAACA,aAAa,OAAO;IAC5B;IAEA,yDAAyD,GACzD,MAAMC,wBAA0C;QAC9C,IAAI;YACF,gCAAgC;YAChC,OAAO,CAAC,CAACC,0BAAS,CAACC,KAAK,CAACC,qBAAqB,CAAC,IAAI,CAACJ,WAAW,EAAEK,MAAM;QACzE,EAAE,OAAOC,OAAY;YACnBV,MAAM,+CAA+CU,MAAMC,OAAO;YAClE,OAAO;QACT;IACF;IAEA,MAAMC,8BAAsD;QAC1D,sBAAsB;QACtB,IAAI;YACF,MAAMC,WAAWP,0BAAS,CAACQ,gBAAgB,CAACC,8BAA8B,CAAC,IAAI,CAACX,WAAW;YAC3F,IAAIS,UAAU;gBACZ,OAAOA;YACT;QACF,EAAE,OAAOH,OAAY;YACnBV,MAAM,oEAAoEU;QAC5E;QAEA,mBAAmB;QACnB,IAAI;YACF,MAAMM,gBAAgBV,0BAAS,CAACC,KAAK,CAACU,gBAAgB,CAAC,IAAI,CAACb,WAAW;YACvE,MAAMc,OAAO,MAAMC,gBAAK,CAACC,KAAK,CAACC,aAAE,CAACC,YAAY,CAACN,eAAe;YAC9D,IAAIE,KAAKK,kBAAkB,IAAI,CAACL,KAAKK,kBAAkB,CAACC,UAAU,CAAC,OAAO;gBACxE,OAAON,KAAKK,kBAAkB;YAChC;QACF,EAAE,OAAOb,OAAO;YACdV,MAAM,+EAA+EU;QACvF;QAEA,OAAO;IACT;AACF"}
1
+ {"version":3,"sources":["../../../../../src/start/platforms/ios/AppleAppIdResolver.ts"],"sourcesContent":["import { IOSConfig } from '@expo/config-plugins';\nimport plist from '@expo/plist';\nimport fs from 'fs';\n\nimport { AppIdResolver } from '../AppIdResolver';\n\nconst debug = require('debug')('expo:start:platforms:ios:AppleAppIdResolver') as typeof console.log;\n\n/** Resolves the iOS bundle identifier from the Expo config or native files. */\nexport class AppleAppIdResolver extends AppIdResolver {\n constructor(projectRoot: string) {\n super(projectRoot, 'ios', 'ios.bundleIdentifier');\n }\n\n /** @return `true` if the app has valid `*.pbxproj` file */\n async hasNativeProjectAsync(): Promise<boolean> {\n try {\n // Never returns nullish values.\n return !!IOSConfig.Paths.getAllPBXProjectPaths(this.projectRoot).length;\n } catch (error: any) {\n debug('Expected error checking for native project:', error.message);\n return false;\n }\n }\n\n async resolveAppIdFromNativeAsync(): Promise<string | null> {\n // Check xcode project\n try {\n const bundleId = IOSConfig.BundleIdentifier.getBundleIdentifierFromPbxproj(this.projectRoot);\n if (bundleId) {\n return bundleId;\n }\n } catch (error: any) {\n debug('Expected error resolving the bundle identifier from the pbxproj:', error);\n }\n\n // Check Info.plist\n try {\n const infoPlistPath = IOSConfig.Paths.getInfoPlistPath(this.projectRoot);\n const data = await plist.parse(fs.readFileSync(infoPlistPath, 'utf8'));\n if (data.CFBundleIdentifier && !data.CFBundleIdentifier.startsWith('$(')) {\n return data.CFBundleIdentifier;\n }\n } catch (error) {\n debug('Expected error resolving the bundle identifier from the project Info.plist:', error);\n }\n\n return null;\n }\n}\n"],"names":["AppleAppIdResolver","debug","require","AppIdResolver","projectRoot","hasNativeProjectAsync","IOSConfig","Paths","getAllPBXProjectPaths","length","error","message","resolveAppIdFromNativeAsync","bundleId","BundleIdentifier","getBundleIdentifierFromPbxproj","infoPlistPath","getInfoPlistPath","data","plist","parse","fs","readFileSync","CFBundleIdentifier","startsWith"],"mappings":";;;;+BASaA;;;eAAAA;;;;yBATa;;;;;;;gEACR;;;;;;;gEACH;;;;;;+BAEe;;;;;;AAE9B,MAAMC,QAAQC,QAAQ,SAAS;AAGxB,MAAMF,2BAA2BG,4BAAa;IACnD,YAAYC,WAAmB,CAAE;QAC/B,KAAK,CAACA,aAAa,OAAO;IAC5B;IAEA,yDAAyD,GACzD,MAAMC,wBAA0C;QAC9C,IAAI;YACF,gCAAgC;YAChC,OAAO,CAAC,CAACC,0BAAS,CAACC,KAAK,CAACC,qBAAqB,CAAC,IAAI,CAACJ,WAAW,EAAEK,MAAM;QACzE,EAAE,OAAOC,OAAY;YACnBT,MAAM,+CAA+CS,MAAMC,OAAO;YAClE,OAAO;QACT;IACF;IAEA,MAAMC,8BAAsD;QAC1D,sBAAsB;QACtB,IAAI;YACF,MAAMC,WAAWP,0BAAS,CAACQ,gBAAgB,CAACC,8BAA8B,CAAC,IAAI,CAACX,WAAW;YAC3F,IAAIS,UAAU;gBACZ,OAAOA;YACT;QACF,EAAE,OAAOH,OAAY;YACnBT,MAAM,oEAAoES;QAC5E;QAEA,mBAAmB;QACnB,IAAI;YACF,MAAMM,gBAAgBV,0BAAS,CAACC,KAAK,CAACU,gBAAgB,CAAC,IAAI,CAACb,WAAW;YACvE,MAAMc,OAAO,MAAMC,gBAAK,CAACC,KAAK,CAACC,aAAE,CAACC,YAAY,CAACN,eAAe;YAC9D,IAAIE,KAAKK,kBAAkB,IAAI,CAACL,KAAKK,kBAAkB,CAACC,UAAU,CAAC,OAAO;gBACxE,OAAON,KAAKK,kBAAkB;YAChC;QACF,EAAE,OAAOb,OAAO;YACdT,MAAM,+EAA+ES;QACvF;QAEA,OAAO;IACT;AACF"}