@expo/cli 0.1.3 → 0.2.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 (289) hide show
  1. package/build/bin/cli +89 -4
  2. package/build/bin/cli.map +1 -1
  3. package/build/src/api/rest/wrapFetchWithOffline.js +2 -23
  4. package/build/src/api/rest/wrapFetchWithOffline.js.map +1 -1
  5. package/build/src/customize/customizeAsync.js +40 -0
  6. package/build/src/customize/customizeAsync.js.map +1 -0
  7. package/build/src/customize/generate.js +77 -0
  8. package/build/src/customize/generate.js.map +1 -0
  9. package/build/src/customize/index.js +41 -0
  10. package/build/src/customize/index.js.map +1 -0
  11. package/build/src/customize/resolveOptions.js +18 -0
  12. package/build/src/customize/resolveOptions.js.map +1 -0
  13. package/build/src/customize/templates.js +118 -0
  14. package/build/src/customize/templates.js.map +1 -0
  15. package/build/src/export/createMetadataJson.js +10 -7
  16. package/build/src/export/createMetadataJson.js.map +1 -1
  17. package/build/src/export/exportApp.js +32 -0
  18. package/build/src/export/exportApp.js.map +1 -1
  19. package/build/src/export/exportAssets.js +2 -3
  20. package/build/src/export/exportAssets.js.map +1 -1
  21. package/build/src/export/fork-bundleAsync.js +51 -34
  22. package/build/src/export/fork-bundleAsync.js.map +1 -1
  23. package/build/src/export/index.js +15 -10
  24. package/build/src/export/index.js.map +1 -1
  25. package/build/src/export/printBundleSizes.js +27 -48
  26. package/build/src/export/printBundleSizes.js.map +1 -1
  27. package/build/src/export/resolveOptions.js +44 -5
  28. package/build/src/export/resolveOptions.js.map +1 -1
  29. package/build/src/export/saveAssets.js +2 -1
  30. package/build/src/export/saveAssets.js.map +1 -1
  31. package/build/src/export/web/exportWebAsync.js +37 -0
  32. package/build/src/export/web/exportWebAsync.js.map +1 -0
  33. package/build/src/export/web/index.js +66 -0
  34. package/build/src/export/web/index.js.map +1 -0
  35. package/build/src/export/web/resolveOptions.js +13 -0
  36. package/build/src/export/web/resolveOptions.js.map +1 -0
  37. package/build/src/export/writeContents.js.map +1 -1
  38. package/build/src/install/checkPackages.js +2 -1
  39. package/build/src/install/checkPackages.js.map +1 -1
  40. package/build/src/install/index.js +1 -0
  41. package/build/src/install/index.js.map +1 -1
  42. package/build/src/install/installAsync.js +13 -5
  43. package/build/src/install/installAsync.js.map +1 -1
  44. package/build/src/install/resolveOptions.js +12 -65
  45. package/build/src/install/resolveOptions.js.map +1 -1
  46. package/build/src/install/utils/autoAddConfigPlugins.js +5 -26
  47. package/build/src/install/utils/autoAddConfigPlugins.js.map +1 -1
  48. package/build/src/log.js.map +1 -1
  49. package/build/src/prebuild/copyTemplateFiles.js +5 -23
  50. package/build/src/prebuild/copyTemplateFiles.js.map +1 -1
  51. package/build/src/prebuild/index.js +18 -12
  52. package/build/src/prebuild/index.js.map +1 -1
  53. package/build/src/prebuild/prebuildAsync.js +11 -12
  54. package/build/src/prebuild/prebuildAsync.js.map +1 -1
  55. package/build/src/prebuild/resolveOptions.js +17 -0
  56. package/build/src/prebuild/resolveOptions.js.map +1 -1
  57. package/build/src/prebuild/resolveTemplate.js +2 -1
  58. package/build/src/prebuild/resolveTemplate.js.map +1 -1
  59. package/build/src/prebuild/updatePackageJson.js +5 -5
  60. package/build/src/prebuild/updatePackageJson.js.map +1 -1
  61. package/build/src/run/android/resolveInstallApkName.js +5 -26
  62. package/build/src/run/android/resolveInstallApkName.js.map +1 -1
  63. package/build/src/run/android/runAndroidAsync.js +3 -3
  64. package/build/src/run/android/runAndroidAsync.js.map +1 -1
  65. package/build/src/run/ensureNativeProject.js +3 -0
  66. package/build/src/run/ensureNativeProject.js.map +1 -1
  67. package/build/src/run/hints.js +1 -1
  68. package/build/src/run/hints.js.map +1 -1
  69. package/build/src/run/ios/XcodeBuild.js +275 -0
  70. package/build/src/run/ios/XcodeBuild.js.map +1 -0
  71. package/build/src/run/ios/XcodeBuild.types.js +6 -0
  72. package/build/src/run/ios/XcodeBuild.types.js.map +1 -0
  73. package/build/src/run/ios/appleDevice/AppleDevice.js +161 -0
  74. package/build/src/run/ios/appleDevice/AppleDevice.js.map +1 -0
  75. package/build/src/run/ios/appleDevice/ClientManager.js +161 -0
  76. package/build/src/run/ios/appleDevice/ClientManager.js.map +1 -0
  77. package/build/src/run/ios/appleDevice/client/AFCClient.js +195 -0
  78. package/build/src/run/ios/appleDevice/client/AFCClient.js.map +1 -0
  79. package/build/src/run/ios/appleDevice/client/DebugserverClient.js +107 -0
  80. package/build/src/run/ios/appleDevice/client/DebugserverClient.js.map +1 -0
  81. package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js +97 -0
  82. package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js.map +1 -0
  83. package/build/src/run/ios/appleDevice/client/LockdowndClient.js +140 -0
  84. package/build/src/run/ios/appleDevice/client/LockdowndClient.js.map +1 -0
  85. package/build/src/run/ios/appleDevice/client/MobileImageMounterClient.js +91 -0
  86. package/build/src/run/ios/appleDevice/client/MobileImageMounterClient.js.map +1 -0
  87. package/build/src/run/ios/appleDevice/client/ServiceClient.js +21 -0
  88. package/build/src/run/ios/appleDevice/client/ServiceClient.js.map +1 -0
  89. package/build/src/run/ios/appleDevice/client/UsbmuxdClient.js +117 -0
  90. package/build/src/run/ios/appleDevice/client/UsbmuxdClient.js.map +1 -0
  91. package/build/src/run/ios/appleDevice/installOnDeviceAsync.js +90 -0
  92. package/build/src/run/ios/appleDevice/installOnDeviceAsync.js.map +1 -0
  93. package/build/src/run/ios/appleDevice/protocol/AFCProtocol.js +332 -0
  94. package/build/src/run/ios/appleDevice/protocol/AFCProtocol.js.map +1 -0
  95. package/build/src/run/ios/appleDevice/protocol/AbstractProtocol.js +115 -0
  96. package/build/src/run/ios/appleDevice/protocol/AbstractProtocol.js.map +1 -0
  97. package/build/src/run/ios/appleDevice/protocol/GDBProtocol.js +126 -0
  98. package/build/src/run/ios/appleDevice/protocol/GDBProtocol.js.map +1 -0
  99. package/build/src/run/ios/appleDevice/protocol/LockdownProtocol.js +74 -0
  100. package/build/src/run/ios/appleDevice/protocol/LockdownProtocol.js.map +1 -0
  101. package/build/src/run/ios/appleDevice/protocol/UsbmuxProtocol.js +65 -0
  102. package/build/src/run/ios/appleDevice/protocol/UsbmuxProtocol.js.map +1 -0
  103. package/build/src/run/ios/codeSigning/Security.js +85 -0
  104. package/build/src/run/ios/codeSigning/Security.js.map +1 -0
  105. package/build/src/run/ios/codeSigning/configureCodeSigning.js +77 -0
  106. package/build/src/run/ios/codeSigning/configureCodeSigning.js.map +1 -0
  107. package/build/src/run/ios/codeSigning/resolveCertificateSigningIdentity.js +102 -0
  108. package/build/src/run/ios/codeSigning/resolveCertificateSigningIdentity.js.map +1 -0
  109. package/build/src/run/ios/codeSigning/settings.js +21 -0
  110. package/build/src/run/ios/codeSigning/settings.js.map +1 -0
  111. package/build/src/run/ios/codeSigning/xcodeCodeSigning.js +76 -0
  112. package/build/src/run/ios/codeSigning/xcodeCodeSigning.js.map +1 -0
  113. package/build/src/run/ios/index.js +98 -0
  114. package/build/src/run/ios/index.js.map +1 -0
  115. package/build/src/run/ios/launchApp.js +75 -0
  116. package/build/src/run/ios/launchApp.js.map +1 -0
  117. package/build/src/run/ios/options/promptDevice.js +50 -0
  118. package/build/src/run/ios/options/promptDevice.js.map +1 -0
  119. package/build/src/run/ios/options/resolveDevice.js +92 -0
  120. package/build/src/run/ios/options/resolveDevice.js.map +1 -0
  121. package/build/src/run/ios/options/resolveNativeScheme.js +92 -0
  122. package/build/src/run/ios/options/resolveNativeScheme.js.map +1 -0
  123. package/build/src/run/ios/options/resolveOptions.js +44 -0
  124. package/build/src/run/ios/options/resolveOptions.js.map +1 -0
  125. package/build/src/run/ios/options/resolveXcodeProject.js +39 -0
  126. package/build/src/run/ios/options/resolveXcodeProject.js.map +1 -0
  127. package/build/src/run/ios/runIosAsync.js +85 -0
  128. package/build/src/run/ios/runIosAsync.js.map +1 -0
  129. package/build/src/run/resolveBundlerProps.js +9 -6
  130. package/build/src/run/resolveBundlerProps.js.map +1 -1
  131. package/build/src/run/startBundler.js +4 -2
  132. package/build/src/run/startBundler.js.map +1 -1
  133. package/build/src/start/doctor/Prerequisite.js +4 -4
  134. package/build/src/start/doctor/Prerequisite.js.map +1 -1
  135. package/build/src/start/doctor/SecurityBinPrerequisite.js +27 -0
  136. package/build/src/start/doctor/SecurityBinPrerequisite.js.map +1 -0
  137. package/build/src/start/doctor/apple/SimulatorAppPrerequisite.js +2 -0
  138. package/build/src/start/doctor/apple/SimulatorAppPrerequisite.js.map +1 -1
  139. package/build/src/start/doctor/apple/XcodeDeveloperDiskImagePrerequisite.js +69 -0
  140. package/build/src/start/doctor/apple/XcodeDeveloperDiskImagePrerequisite.js.map +1 -0
  141. package/build/src/start/doctor/apple/XcodePrerequisite.js +2 -0
  142. package/build/src/start/doctor/apple/XcodePrerequisite.js.map +1 -1
  143. package/build/src/start/doctor/dependencies/bundledNativeModules.js +3 -2
  144. package/build/src/start/doctor/dependencies/bundledNativeModules.js.map +1 -1
  145. package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js +7 -13
  146. package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js.map +1 -1
  147. package/build/src/start/doctor/dependencies/getMissingPackages.js +3 -24
  148. package/build/src/start/doctor/dependencies/getMissingPackages.js.map +1 -1
  149. package/build/src/start/doctor/dependencies/getVersionedPackages.js +2 -23
  150. package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
  151. package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +17 -9
  152. package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -1
  153. package/build/src/start/doctor/ngrok/ExternalModule.js +2 -1
  154. package/build/src/start/doctor/ngrok/ExternalModule.js.map +1 -1
  155. package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js +4 -3
  156. package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js.map +1 -1
  157. package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js +32 -31
  158. package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js.map +1 -1
  159. package/build/src/start/interface/KeyPressHandler.js +2 -0
  160. package/build/src/start/interface/KeyPressHandler.js.map +1 -1
  161. package/build/src/start/interface/interactiveActions.js +5 -5
  162. package/build/src/start/interface/interactiveActions.js.map +1 -1
  163. package/build/src/start/interface/startInterface.js +3 -2
  164. package/build/src/start/interface/startInterface.js.map +1 -1
  165. package/build/src/start/platforms/ExpoGoInstaller.js +2 -1
  166. package/build/src/start/platforms/ExpoGoInstaller.js.map +1 -1
  167. package/build/src/start/platforms/PlatformManager.js +4 -24
  168. package/build/src/start/platforms/PlatformManager.js.map +1 -1
  169. package/build/src/start/platforms/android/ADBServer.js +17 -32
  170. package/build/src/start/platforms/android/ADBServer.js.map +1 -1
  171. package/build/src/start/platforms/android/AndroidSdk.js +41 -0
  172. package/build/src/start/platforms/android/AndroidSdk.js.map +1 -0
  173. package/build/src/start/platforms/android/activateWindow.js +4 -4
  174. package/build/src/start/platforms/android/activateWindow.js.map +1 -1
  175. package/build/src/start/platforms/android/adb.js +8 -3
  176. package/build/src/start/platforms/android/adb.js.map +1 -1
  177. package/build/src/start/platforms/android/adbReverse.js +3 -2
  178. package/build/src/start/platforms/android/adbReverse.js.map +1 -1
  179. package/build/src/start/platforms/android/emulator.js +8 -0
  180. package/build/src/start/platforms/android/emulator.js.map +1 -1
  181. package/build/src/start/platforms/android/gradle.js +2 -2
  182. package/build/src/start/platforms/android/gradle.js.map +1 -1
  183. package/build/src/start/platforms/android/promptAndroidDevice.js +1 -5
  184. package/build/src/start/platforms/android/promptAndroidDevice.js.map +1 -1
  185. package/build/src/start/platforms/ios/AppleDeviceManager.js +5 -1
  186. package/build/src/start/platforms/ios/AppleDeviceManager.js.map +1 -1
  187. package/build/src/start/platforms/ios/getBestSimulator.js +4 -4
  188. package/build/src/start/platforms/ios/getBestSimulator.js.map +1 -1
  189. package/build/src/start/platforms/ios/promptAppleDevice.js +1 -5
  190. package/build/src/start/platforms/ios/promptAppleDevice.js.map +1 -1
  191. package/build/src/start/platforms/ios/simctl.js +14 -0
  192. package/build/src/start/platforms/ios/simctl.js.map +1 -1
  193. package/build/src/start/platforms/ios/simctlLogging.js +220 -0
  194. package/build/src/start/platforms/ios/simctlLogging.js.map +1 -0
  195. package/build/src/start/platforms/ios/xcrun.js +2 -23
  196. package/build/src/start/platforms/ios/xcrun.js.map +1 -1
  197. package/build/src/start/project/devices.js +2 -0
  198. package/build/src/start/project/devices.js.map +1 -1
  199. package/build/src/start/server/AsyncNgrok.js +6 -5
  200. package/build/src/start/server/AsyncNgrok.js.map +1 -1
  201. package/build/src/start/server/BundlerDevServer.js +15 -8
  202. package/build/src/start/server/BundlerDevServer.js.map +1 -1
  203. package/build/src/start/server/DevServerManager.js +15 -5
  204. package/build/src/start/server/DevServerManager.js.map +1 -1
  205. package/build/src/start/server/DevelopmentSession.js +4 -0
  206. package/build/src/start/server/DevelopmentSession.js.map +1 -1
  207. package/build/src/start/server/UrlCreator.js +10 -3
  208. package/build/src/start/server/UrlCreator.js.map +1 -1
  209. package/build/src/start/server/metro/MetroBundlerDevServer.js +9 -0
  210. package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
  211. package/build/src/start/server/metro/TerminalReporter.js +5 -0
  212. package/build/src/start/server/metro/TerminalReporter.js.map +1 -1
  213. package/build/src/start/server/metro/instantiateMetro.js +11 -1
  214. package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
  215. package/build/src/start/server/metro/resolveFromProject.js +8 -0
  216. package/build/src/start/server/metro/resolveFromProject.js.map +1 -1
  217. package/build/src/start/server/metro/withMetroMultiPlatform.js +115 -0
  218. package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -0
  219. package/build/src/start/server/middleware/ClassicManifestMiddleware.js +1 -1
  220. package/build/src/start/server/middleware/ExpoMiddleware.js +9 -4
  221. package/build/src/start/server/middleware/ExpoMiddleware.js.map +1 -1
  222. package/build/src/start/server/middleware/HistoryFallbackMiddleware.js +24 -0
  223. package/build/src/start/server/middleware/HistoryFallbackMiddleware.js.map +1 -0
  224. package/build/src/start/server/middleware/InterstitialPageMiddleware.js +2 -0
  225. package/build/src/start/server/middleware/InterstitialPageMiddleware.js.map +1 -1
  226. package/build/src/start/server/middleware/ManifestMiddleware.js +57 -6
  227. package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
  228. package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js +6 -1
  229. package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js.map +1 -1
  230. package/build/src/start/server/middleware/ServeStaticMiddleware.js +62 -0
  231. package/build/src/start/server/middleware/ServeStaticMiddleware.js.map +1 -0
  232. package/build/src/start/server/platformBundlers.js +18 -0
  233. package/build/src/start/server/platformBundlers.js.map +1 -0
  234. package/build/src/start/server/webTemplate.js +68 -0
  235. package/build/src/start/server/webTemplate.js.map +1 -0
  236. package/build/src/start/server/webpack/WebpackBundlerDevServer.js +59 -19
  237. package/build/src/start/server/webpack/WebpackBundlerDevServer.js.map +1 -1
  238. package/build/src/start/server/webpack/compile.js +64 -0
  239. package/build/src/start/server/webpack/compile.js.map +1 -0
  240. package/build/src/start/startAsync.js +21 -17
  241. package/build/src/start/startAsync.js.map +1 -1
  242. package/build/src/utils/FileNotifier.js +5 -2
  243. package/build/src/utils/FileNotifier.js.map +1 -1
  244. package/build/src/utils/analytics/rudderstackClient.js +30 -3
  245. package/build/src/utils/analytics/rudderstackClient.js.map +1 -1
  246. package/build/src/utils/cocoapods.js +47 -0
  247. package/build/src/utils/cocoapods.js.map +1 -1
  248. package/build/src/utils/dir.js +6 -1
  249. package/build/src/utils/dir.js.map +1 -1
  250. package/build/src/utils/downloadAppAsync.js +3 -2
  251. package/build/src/utils/downloadAppAsync.js.map +1 -1
  252. package/build/src/utils/downloadExpoGoAsync.js +7 -32
  253. package/build/src/utils/downloadExpoGoAsync.js.map +1 -1
  254. package/build/src/utils/editor.js +3 -2
  255. package/build/src/utils/editor.js.map +1 -1
  256. package/build/src/utils/env.js +3 -0
  257. package/build/src/utils/env.js.map +1 -1
  258. package/build/src/utils/exit.js +4 -25
  259. package/build/src/utils/exit.js.map +1 -1
  260. package/build/src/utils/getRunningProcess.js +6 -2
  261. package/build/src/utils/getRunningProcess.js.map +1 -1
  262. package/build/src/utils/nodeModules.js +13 -102
  263. package/build/src/utils/nodeModules.js.map +1 -1
  264. package/build/src/utils/npm.js +3 -24
  265. package/build/src/utils/npm.js.map +1 -1
  266. package/build/src/utils/ora.js +1 -13
  267. package/build/src/utils/ora.js.map +1 -1
  268. package/build/src/utils/plist.js +59 -0
  269. package/build/src/utils/plist.js.map +1 -0
  270. package/build/src/utils/progress.js +46 -0
  271. package/build/src/utils/progress.js.map +1 -1
  272. package/build/src/utils/prompts.js +19 -3
  273. package/build/src/utils/prompts.js.map +1 -1
  274. package/build/src/utils/resolveArgs.js +4 -1
  275. package/build/src/utils/resolveArgs.js.map +1 -1
  276. package/build/src/utils/tar.js +3 -0
  277. package/build/src/utils/tar.js.map +1 -1
  278. package/build/src/utils/terminal.js +10 -0
  279. package/build/src/utils/terminal.js.map +1 -0
  280. package/build/src/utils/validateApplicationId.js +9 -2
  281. package/build/src/utils/validateApplicationId.js.map +1 -1
  282. package/build/src/utils/variadic.js +47 -0
  283. package/build/src/utils/variadic.js.map +1 -0
  284. package/package.json +14 -10
  285. package/static/template/babel.config.js +6 -0
  286. package/static/template/index.html +117 -0
  287. package/static/template/metro.config.js +4 -0
  288. package/static/template/serve.json +13 -0
  289. package/static/template/webpack.config.js +7 -0
@@ -7,7 +7,6 @@ exports.getBestUnbootedSimulatorAsync = getBestUnbootedSimulatorAsync;
7
7
  exports.getSelectableSimulatorsAsync = getSelectableSimulatorsAsync;
8
8
  exports.getBestSimulatorAsync = getBestSimulatorAsync;
9
9
  var _childProcess = require("child_process");
10
- var Log = _interopRequireWildcard(require("../../../log"));
11
10
  var _errors = require("../../../utils/errors");
12
11
  var SimControl = _interopRequireWildcard(require("./simctl"));
13
12
  function _interopRequireWildcard(obj) {
@@ -31,6 +30,7 @@ function _interopRequireWildcard(obj) {
31
30
  return newObj;
32
31
  }
33
32
  }
33
+ const debug = require("debug")("expo:start:platforms:ios:getBestSimulator");
34
34
  /**
35
35
  * Returns the default device stored in the Simulator.app settings.
36
36
  * This helps us to get the device that the user opened most recently regardless of which tool they used.
@@ -49,16 +49,16 @@ async function getBestBootedSimulatorAsync({ osType } = {}) {
49
49
  // This should prevent opening a second simulator in the chance that default
50
50
  // simulator doesn't match what the Simulator app would open by default.
51
51
  if ((simulatorOpenedByApp == null ? void 0 : simulatorOpenedByApp.udid) && (!osType || osType && simulatorOpenedByApp.osType === osType)) {
52
- Log.debug(`First booted simulator: ${simulatorOpenedByApp == null ? void 0 : simulatorOpenedByApp.windowName}`);
52
+ debug(`First booted simulator: ${simulatorOpenedByApp == null ? void 0 : simulatorOpenedByApp.windowName}`);
53
53
  return simulatorOpenedByApp;
54
54
  }
55
- Log.debug(`No booted simulator matching requirements (osType: ${osType}).`);
55
+ debug(`No booted simulator matching requirements (osType: ${osType}).`);
56
56
  return null;
57
57
  }
58
58
  async function getBestUnbootedSimulatorAsync({ osType } = {}) {
59
59
  var ref;
60
60
  const defaultId = getDefaultSimulatorDeviceUDID();
61
- Log.debug(`Default simulator ID: ${defaultId}`);
61
+ debug(`Default simulator ID: ${defaultId}`);
62
62
  if (defaultId && !osType) {
63
63
  return defaultId;
64
64
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/platforms/ios/getBestSimulator.ts"],"sourcesContent":["import { execSync } from 'child_process';\n\nimport * as Log from '../../../log';\nimport { CommandError } from '../../../utils/errors';\nimport * as SimControl from './simctl';\n\ntype DeviceContext = Partial<Pick<SimControl.Device, 'osType'>>;\n\n/**\n * Returns the default device stored in the Simulator.app settings.\n * This helps us to get the device that the user opened most recently regardless of which tool they used.\n */\nfunction getDefaultSimulatorDeviceUDID() {\n try {\n const defaultDeviceUDID = execSync(\n `defaults read com.apple.iphonesimulator CurrentDeviceUDID`,\n { stdio: 'pipe' }\n ).toString();\n return defaultDeviceUDID.trim();\n } catch {\n return null;\n }\n}\n\nexport async function getBestBootedSimulatorAsync({\n osType,\n}: DeviceContext = {}): Promise<SimControl.Device | null> {\n const [simulatorOpenedByApp] = await SimControl.getBootedSimulatorsAsync();\n // This should prevent opening a second simulator in the chance that default\n // simulator doesn't match what the Simulator app would open by default.\n if (\n simulatorOpenedByApp?.udid &&\n (!osType || (osType && simulatorOpenedByApp.osType === osType))\n ) {\n Log.debug(`First booted simulator: ${simulatorOpenedByApp?.windowName}`);\n return simulatorOpenedByApp;\n }\n\n Log.debug(`No booted simulator matching requirements (osType: ${osType}).`);\n return null;\n}\n\n/**\n * Returns the most preferred simulator UDID without booting anything.\n *\n * 1. If the simulator app defines a default simulator and the osType is not defined.\n * 2. If the osType is defined, then check if the default udid matches the osType.\n * 3. If all else fails, return the first found simulator.\n */\nexport async function getBestUnbootedSimulatorAsync({ osType }: DeviceContext = {}): Promise<\n string | null\n> {\n const defaultId = getDefaultSimulatorDeviceUDID();\n Log.debug(`Default simulator ID: ${defaultId}`);\n\n if (defaultId && !osType) {\n return defaultId;\n }\n\n const simulators = await getSelectableSimulatorsAsync({ osType });\n\n if (!simulators.length) {\n // TODO: Prompt to install the simulators\n throw new CommandError(\n 'UNSUPPORTED_OS_TYPE',\n `No ${osType || 'iOS'} devices available in Simulator.app`\n );\n }\n\n // If the default udid is defined, then check to ensure its osType matches the required os.\n if (defaultId) {\n const defaultSimulator = simulators.find((device) => device.udid === defaultId);\n if (defaultSimulator?.osType === osType) {\n return defaultId;\n }\n }\n\n // Return first selectable device.\n return simulators[0]?.udid ?? null;\n}\n\n/**\n * Get all simulators supported by Expo Go (iOS only).\n */\nexport async function getSelectableSimulatorsAsync({ osType = 'iOS' }: DeviceContext = {}): Promise<\n SimControl.Device[]\n> {\n const simulators = await SimControl.getDevicesAsync();\n return simulators.filter((device) => device.isAvailable && device.osType === osType);\n}\n\n/**\n * Get 'best' simulator for the user based on:\n * 1. Currently booted simulator.\n * 2. Last simulator that was opened.\n * 3. First simulator that was opened.\n */\nexport async function getBestSimulatorAsync({ osType }: DeviceContext): Promise<string | null> {\n const simulatorOpenedByApp = await getBestBootedSimulatorAsync({ osType });\n\n if (simulatorOpenedByApp) {\n return simulatorOpenedByApp.udid;\n }\n\n return await getBestUnbootedSimulatorAsync({ osType });\n}\n"],"names":["getBestBootedSimulatorAsync","getBestUnbootedSimulatorAsync","getSelectableSimulatorsAsync","getBestSimulatorAsync","Log","SimControl","getDefaultSimulatorDeviceUDID","defaultDeviceUDID","execSync","stdio","toString","trim","osType","simulatorOpenedByApp","getBootedSimulatorsAsync","udid","debug","windowName","simulators","defaultId","length","CommandError","defaultSimulator","find","device","getDevicesAsync","filter","isAvailable"],"mappings":"AAAA;;;;QAwBsBA,2BAA2B,GAA3BA,2BAA2B;QAyB3BC,6BAA6B,GAA7BA,6BAA6B;QAmC7BC,4BAA4B,GAA5BA,4BAA4B;QAa5BC,qBAAqB,GAArBA,qBAAqB;AAjGlB,IAAA,aAAe,WAAf,eAAe,CAAA;AAE5BC,IAAAA,GAAG,mCAAM,cAAc,EAApB;AACc,IAAA,OAAuB,WAAvB,uBAAuB,CAAA;AACxCC,IAAAA,UAAU,mCAAM,UAAU,EAAhB;;;;;;;;;;;;;;;;;;;;;;AAItB;;;GAGG,CACH,SAASC,6BAA6B,GAAG;IACvC,IAAI;QACF,MAAMC,iBAAiB,GAAGC,CAAAA,GAAAA,aAAQ,AAGjC,CAAA,SAHiC,CAChC,CAAC,yDAAyD,CAAC,EAC3D;YAAEC,KAAK,EAAE,MAAM;SAAE,CAClB,CAACC,QAAQ,EAAE,AAAC;QACb,OAAOH,iBAAiB,CAACI,IAAI,EAAE,CAAC;KACjC,CAAC,OAAM;QACN,OAAO,IAAI,CAAC;KACb;CACF;AAEM,eAAeX,2BAA2B,CAAC,EAChDY,MAAM,CAAA,EACQ,GAAG,EAAE,EAAqC;IACxD,MAAM,CAACC,oBAAoB,CAAC,GAAG,MAAMR,UAAU,CAACS,w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,SAAS;QAAA,CAAC,AAAC;QAChF,IAAIG,CAAAA,gBAAgB,QAAQ,GAAxBA,KAAAA,CAAwB,GAAxBA,gBAAgB,CAAEV,MAAM,CAAA,KAAKA,MAAM,EAAE;YACvC,OAAOO,SAAS,CAAC;SAClB;KACF;QAGMD,IAAmB;IAD1B,kCAAkC;IAClC,OAAOA,CAAAA,IAAmB,GAAnBA,CAAAA,GAAa,GAAbA,UAAU,CAAC,CAAC,CAAC,SAAM,GAAnBA,KAAAA,CAAmB,GAAnBA,GAAa,CAAEH,IAAI,YAAnBG,IAAmB,GAAI,IAAI,CAAC;CACpC;AAKM,eAAehB,4BAA4B,CAAC,EAAEU,MAAM,EAAG,KAAK,CAAA,EAAiB,GAAG,EAAE,EAEvF;IACA,MAAMM,UAAU,GAAG,MAAMb,UAAU,CAACoB,eAAe,EAAE,AAAC;IACtD,OAAOP,UAAU,CAACQ,MAAM,CAAC,CAACF,MAAM,GAAKA,MAAM,CAACG,WAAW,IAAIH,MAAM,CAACZ,MAAM,KAAKA,MAAM;IAAA,CAAC,CAAC;CACtF;AAQM,eAAeT,qBAAqB,CAAC,EAAES,MAAM,CAAA,EAAiB,EAA0B;IAC7F,MAAMC,oBAAoB,GAAG,MAAMb,2BAA2B,CAAC;QAAEY,MAAM;KAAE,CAAC,AAAC;IAE3E,IAAIC,oBAAoB,EAAE;QACxB,OAAOA,oBAAoB,CAACE,IAAI,CAAC;KAClC;IAED,OAAO,MAAMd,6BAA6B,CAAC;QAAEW,MAAM;KAAE,CAAC,CAAC;CACxD"}
1
+ {"version":3,"sources":["../../../../../src/start/platforms/ios/getBestSimulator.ts"],"sourcesContent":["import { execSync } from 'child_process';\n\nimport { CommandError } from '../../../utils/errors';\nimport * as SimControl from './simctl';\n\nconst debug = require('debug')('expo:start:platforms:ios:getBestSimulator') as typeof console.log;\n\ntype DeviceContext = Partial<Pick<SimControl.Device, 'osType'>>;\n\n/**\n * Returns the default device stored in the Simulator.app settings.\n * This helps us to get the device that the user opened most recently regardless of which tool they used.\n */\nfunction getDefaultSimulatorDeviceUDID() {\n try {\n const defaultDeviceUDID = execSync(\n `defaults read com.apple.iphonesimulator CurrentDeviceUDID`,\n { stdio: 'pipe' }\n ).toString();\n return defaultDeviceUDID.trim();\n } catch {\n return null;\n }\n}\n\nexport async function getBestBootedSimulatorAsync({\n osType,\n}: DeviceContext = {}): Promise<SimControl.Device | null> {\n const [simulatorOpenedByApp] = await SimControl.getBootedSimulatorsAsync();\n // This should prevent opening a second simulator in the chance that default\n // simulator doesn't match what the Simulator app would open by default.\n if (\n simulatorOpenedByApp?.udid &&\n (!osType || (osType && simulatorOpenedByApp.osType === osType))\n ) {\n debug(`First booted simulator: ${simulatorOpenedByApp?.windowName}`);\n return simulatorOpenedByApp;\n }\n\n debug(`No booted simulator matching requirements (osType: ${osType}).`);\n return null;\n}\n\n/**\n * Returns the most preferred simulator UDID without booting anything.\n *\n * 1. If the simulator app defines a default simulator and the osType is not defined.\n * 2. If the osType is defined, then check if the default udid matches the osType.\n * 3. If all else fails, return the first found simulator.\n */\nexport async function getBestUnbootedSimulatorAsync({ osType }: DeviceContext = {}): Promise<\n string | null\n> {\n const defaultId = getDefaultSimulatorDeviceUDID();\n debug(`Default simulator ID: ${defaultId}`);\n\n if (defaultId && !osType) {\n return defaultId;\n }\n\n const simulators = await getSelectableSimulatorsAsync({ osType });\n\n if (!simulators.length) {\n // TODO: Prompt to install the simulators\n throw new CommandError(\n 'UNSUPPORTED_OS_TYPE',\n `No ${osType || 'iOS'} devices available in Simulator.app`\n );\n }\n\n // If the default udid is defined, then check to ensure its osType matches the required os.\n if (defaultId) {\n const defaultSimulator = simulators.find((device) => device.udid === defaultId);\n if (defaultSimulator?.osType === osType) {\n return defaultId;\n }\n }\n\n // Return first selectable device.\n return simulators[0]?.udid ?? null;\n}\n\n/**\n * Get all simulators supported by Expo Go (iOS only).\n */\nexport async function getSelectableSimulatorsAsync({ osType = 'iOS' }: DeviceContext = {}): Promise<\n SimControl.Device[]\n> {\n const simulators = await SimControl.getDevicesAsync();\n return simulators.filter((device) => device.isAvailable && device.osType === osType);\n}\n\n/**\n * Get 'best' simulator for the user based on:\n * 1. Currently booted simulator.\n * 2. Last simulator that was opened.\n * 3. First simulator that was opened.\n */\nexport async function getBestSimulatorAsync({ osType }: DeviceContext): Promise<string | null> {\n const simulatorOpenedByApp = await getBestBootedSimulatorAsync({ osType });\n\n if (simulatorOpenedByApp) {\n return simulatorOpenedByApp.udid;\n }\n\n return await getBestUnbootedSimulatorAsync({ osType });\n}\n"],"names":["getBestBootedSimulatorAsync","getBestUnbootedSimulatorAsync","getSelectableSimulatorsAsync","getBestSimulatorAsync","SimControl","debug","require","getDefaultSimulatorDeviceUDID","defaultDeviceUDID","execSync","stdio","toString","trim","osType","simulatorOpenedByApp","getBootedSimulatorsAsync","udid","windowName","simulators","defaultId","length","CommandError","defaultSimulator","find","device","getDevicesAsync","filter","isAvailable"],"mappings":"AAAA;;;;QAyBsBA,2BAA2B,GAA3BA,2BAA2B;QAyB3BC,6BAA6B,GAA7BA,6BAA6B;QAmC7BC,4BAA4B,GAA5BA,4BAA4B;QAa5BC,qBAAqB,GAArBA,qBAAqB;AAlGlB,IAAA,aAAe,WAAf,eAAe,CAAA;AAEX,IAAA,OAAuB,WAAvB,uBAAuB,CAAA;AACxCC,IAAAA,UAAU,mCAAM,UAAU,EAAhB;;;;;;;;;;;;;;;;;;;;;;AAEtB,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,2CAA2C,CAAC,AAAsB,AAAC;AAIlG;;;GAGG,CACH,SAASC,6BAA6B,GAAG;IACvC,IAAI;QACF,MAAMC,iBAAiB,GAAGC,CAAAA,GAAAA,aAAQ,AAGjC,CAAA,SAHiC,CAChC,CAAC,yDAAyD,CAAC,EAC3D;YAAEC,KAAK,EAAE,MAAM;SAAE,CAClB,CAACC,QAAQ,EAAE,AAAC;QACb,OAAOH,iBAAiB,CAACI,IAAI,EAAE,CAAC;KACjC,C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H;IAED,2FAA2F;IAC3F,IAAIM,SAAS,EAAE;QACb,MAAMG,gBAAgB,GAAGJ,UAAU,CAACK,IAAI,CAAC,CAACC,MAAM,GAAKA,MAAM,CAACR,IAAI,KAAKG,SAAS;QAAA,CAAC,AAAC;QAChF,IAAIG,CAAAA,gBAAgB,QAAQ,GAAxBA,KAAAA,CAAwB,GAAxBA,gBAAgB,CAAET,MAAM,CAAA,KAAKA,MAAM,EAAE;YACvC,OAAOM,SAAS,CAAC;SAClB;KACF;QAGMD,IAAmB;IAD1B,kCAAkC;IAClC,OAAOA,CAAAA,IAAmB,GAAnBA,CAAAA,GAAa,GAAbA,UAAU,CAAC,CAAC,CAAC,SAAM,GAAnBA,KAAAA,CAAmB,GAAnBA,GAAa,CAAEF,IAAI,YAAnBE,IAAmB,GAAI,IAAI,CAAC;CACpC;AAKM,eAAehB,4BAA4B,CAAC,EAAEW,MAAM,EAAG,KAAK,CAAA,EAAiB,GAAG,EAAE,EAEvF;IACA,MAAMK,UAAU,GAAG,MAAMd,UAAU,CAACqB,eAAe,EAAE,AAAC;IACtD,OAAOP,UAAU,CAACQ,MAAM,CAAC,CAACF,MAAM,GAAKA,MAAM,CAACG,WAAW,IAAIH,MAAM,CAACX,MAAM,KAAKA,MAAM;IAAA,CAAC,CAAC;CACtF;AAQM,eAAeV,qBAAqB,CAAC,EAAEU,MAAM,CAAA,EAAiB,EAA0B;IAC7F,MAAMC,oBAAoB,GAAG,MAAMd,2BAA2B,CAAC;QAAEa,MAAM;KAAE,CAAC,AAAC;IAE3E,IAAIC,oBAAoB,EAAE;QACxB,OAAOA,oBAAoB,CAACE,IAAI,CAAC;KAClC;IAED,OAAO,MAAMf,6BAA6B,CAAC;QAAEY,MAAM;KAAE,CAAC,CAAC;CACxD"}
@@ -48,11 +48,7 @@ async function promptAppleDeviceInternalAsync(devices) {
48
48
  value: item.udid
49
49
  };
50
50
  }),
51
- suggest: (input, choices)=>{
52
- const regex = new RegExp(input, "i");
53
- return choices.filter((choice)=>regex.test(choice.title)
54
- );
55
- }
51
+ suggest: (0, _prompts).createSelectionFilter()
56
52
  });
57
53
  return value;
58
54
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/platforms/ios/promptAppleDevice.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport { promptAsync } from '../../../utils/prompts';\nimport { getBestSimulatorAsync } from './getBestSimulator';\nimport { Device } from './simctl';\n\n/**\n * Sort the devices so the last simulator that was opened (user's default) is the first suggested.\n *\n * @param devices list of devices to sort.\n * @param osType optional sort by operating system.\n */\nexport async function sortDefaultDeviceToBeginningAsync(\n devices: Device[],\n osType?: Device['osType']\n): Promise<Device[]> {\n const defaultId = await getBestSimulatorAsync({ osType });\n if (defaultId) {\n let iterations = 0;\n while (devices[0].udid !== defaultId && iterations < devices.length) {\n devices.push(devices.shift()!);\n iterations++;\n }\n }\n return devices;\n}\n\n/** Prompt the user to select an Apple device, sorting the most likely option to the beginning. */\nexport async function promptAppleDeviceAsync(\n devices: Device[],\n osType?: Device['osType']\n): Promise<Device> {\n devices = await sortDefaultDeviceToBeginningAsync(devices, osType);\n const results = await promptAppleDeviceInternalAsync(devices);\n return devices.find(({ udid }) => results === udid)!;\n}\n\nasync function promptAppleDeviceInternalAsync(devices: Device[]): Promise<string> {\n // TODO: provide an option to add or download more simulators\n // TODO: Add support for physical devices too.\n\n const { value } = await promptAsync({\n type: 'autocomplete',\n name: 'value',\n limit: 11,\n message: 'Select a simulator',\n choices: devices.map((item) => {\n const isActive = item.state === 'Booted';\n const format = isActive ? chalk.bold : (text: string) => text;\n return {\n title: `${format(item.name)} ${chalk.dim(`(${item.osVersion})`)}`,\n value: item.udid,\n };\n }),\n suggest: (input: any, choices: any) => {\n const regex = new RegExp(input, 'i');\n return choices.filter((choice: any) => regex.test(choice.title));\n },\n });\n\n return value;\n}\n"],"names":["sortDefaultDeviceToBeginningAsync","promptAppleDeviceAsync","devices","osType","defaultId","getBestSimulatorAsync","iterations","udid","length","push","shift","results","promptAppleDeviceInternalAsync","find","value","promptAsync","type","name","limit","message","choices","map","item","isActive","state","format","chalk","bold","text","title","dim","osVersion","suggest","input","regex","RegExp","filter","choice","test"],"mappings":"AAAA;;;;QAYsBA,iCAAiC,GAAjCA,iCAAiC;QAgBjCC,sBAAsB,GAAtBA,sBAAsB;AA5B1B,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEG,IAAA,QAAwB,WAAxB,wBAAwB,CAAA;AACd,IAAA,iBAAoB,WAApB,oBAAoB,CAAA;;;;;;AASnD,eAAeD,iCAAiC,CACrDE,OAAiB,EACjBC,MAAyB,EACN;IACnB,MAAMC,SAAS,GAAG,MAAMC,CAAAA,GAAAA,iBAAqB,AAAY,CAAA,sBAAZ,CAAC;QAAEF,MAAM;KAAE,CAAC,AAAC;IAC1D,IAAIC,SAAS,EAAE;QACb,IAAIE,UAAU,GAAG,CAAC,AAAC;QACnB,MAAOJ,OAAO,CAAC,CAAC,CAAC,CAACK,IAAI,KAAKH,SAAS,IAAIE,UAAU,GAAGJ,OAAO,CAACM,MAAM,CAAE;YACnEN,OAAO,CAACO,IAAI,CAACP,OAAO,CAACQ,KAAK,EAAE,CAAE,CAAC;YAC/BJ,UAAU,EAAE,CAAC;SACd;KACF;IACD,OAAOJ,OAAO,CAAC;CAChB;AAGM,eAAeD,sBAAsB,CAC1CC,OAAiB,EACjBC,MAAyB,EACR;IACjBD,OAAO,GAAG,MAAMF,iCAAiC,CAACE,OAAO,EAAEC,MAAM,CAAC,CAAC;IACnE,MAAMQ,OAAO,GAAG,MAAMC,8BAA8B,CAACV,OAAO,CAAC,AAAC;IAC9D,OAAOA,OAAO,CAACW,IAAI,CAAC,CAAC,EAAEN,IAAI,CAAA,EAAE,GAAKI,OAAO,KAAKJ,IAAI;IAAA,CAAC,CAAE;CACtD;AAED,eAAeK,8BAA8B,CAACV,OAAiB,EAAmB;IAChF,6DAA6D;IAC7D,8CAA8C;IAE9C,MAAM,EAAEY,KAAK,CAAA,EAAE,GAAG,MAAMC,CAAAA,GAAAA,QAAW,AAiBjC,CAAA,YAjBiC,CAAC;QAClCC,IAAI,EAAE,cAAc;QACpBC,IAAI,EAAE,OAAO;QACbC,KAAK,EAAE,EAAE;QACTC,OAAO,EAAE,oBAAoB;QAC7BC,OAAO,EAAElB,OAAO,CAACmB,GAAG,CAAC,CAACC,IAAI,GAAK;YAC7B,MAAMC,QAAQ,GAAGD,IAAI,CAACE,KAAK,KAAK,QAAQ,AAAC;YACzC,MAAMC,MAAM,GAAGF,QAAQ,GAAGG,MAAK,QAAA,CAACC,IAAI,GAAG,CAACC,IAAY,GAAKA,IAAI;YAAC;YAC9D,OAAO;gBACLC,KAAK,EAAE,CAAC,EAAEJ,MAAM,CAACH,IAAI,CAACL,IAAI,CAAC,CAAC,CAAC,EAAES,MAAK,QAAA,CAACI,GAAG,CAAC,CAAC,CAAC,EAAER,IAAI,CAACS,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACjEjB,KAAK,EAAEQ,IAAI,CAACf,IAAI;aACjB,CAAC;SACH,CAAC;QACFyB,OAAO,EAAE,CAACC,KAAU,EAAEb,OAAY,GAAK;YACrC,MAAMc,KAAK,GAAG,IAAIC,MAAM,CAACF,KAAK,EAAE,GAAG,CAAC,AAAC;YACrC,OAAOb,OAAO,CAACgB,MAAM,CAAC,CAACC,MAAW,GAAKH,KAAK,CAACI,IAAI,CAACD,MAAM,CAACR,KAAK,CAAC;YAAA,CAAC,CAAC;SAClE;KACF,CAAC,AAAC;IAEH,OAAOf,KAAK,CAAC;CACd"}
1
+ {"version":3,"sources":["../../../../../src/start/platforms/ios/promptAppleDevice.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport { createSelectionFilter, promptAsync } from '../../../utils/prompts';\nimport { getBestSimulatorAsync } from './getBestSimulator';\nimport { Device } from './simctl';\n\n/**\n * Sort the devices so the last simulator that was opened (user's default) is the first suggested.\n *\n * @param devices list of devices to sort.\n * @param osType optional sort by operating system.\n */\nexport async function sortDefaultDeviceToBeginningAsync(\n devices: Device[],\n osType?: Device['osType']\n): Promise<Device[]> {\n const defaultId = await getBestSimulatorAsync({ osType });\n if (defaultId) {\n let iterations = 0;\n while (devices[0].udid !== defaultId && iterations < devices.length) {\n devices.push(devices.shift()!);\n iterations++;\n }\n }\n return devices;\n}\n\n/** Prompt the user to select an Apple device, sorting the most likely option to the beginning. */\nexport async function promptAppleDeviceAsync(\n devices: Device[],\n osType?: Device['osType']\n): Promise<Device> {\n devices = await sortDefaultDeviceToBeginningAsync(devices, osType);\n const results = await promptAppleDeviceInternalAsync(devices);\n return devices.find(({ udid }) => results === udid)!;\n}\n\nasync function promptAppleDeviceInternalAsync(devices: Device[]): Promise<string> {\n // TODO: provide an option to add or download more simulators\n // TODO: Add support for physical devices too.\n\n const { value } = await promptAsync({\n type: 'autocomplete',\n name: 'value',\n limit: 11,\n message: 'Select a simulator',\n choices: devices.map((item) => {\n const isActive = item.state === 'Booted';\n const format = isActive ? chalk.bold : (text: string) => text;\n return {\n title: `${format(item.name)} ${chalk.dim(`(${item.osVersion})`)}`,\n value: item.udid,\n };\n }),\n suggest: createSelectionFilter(),\n });\n\n return value;\n}\n"],"names":["sortDefaultDeviceToBeginningAsync","promptAppleDeviceAsync","devices","osType","defaultId","getBestSimulatorAsync","iterations","udid","length","push","shift","results","promptAppleDeviceInternalAsync","find","value","promptAsync","type","name","limit","message","choices","map","item","isActive","state","format","chalk","bold","text","title","dim","osVersion","suggest","createSelectionFilter"],"mappings":"AAAA;;;;QAYsBA,iCAAiC,GAAjCA,iCAAiC;QAgBjCC,sBAAsB,GAAtBA,sBAAsB;AA5B1B,IAAA,MAAO,kCAAP,OAAO,EAAA;AAE0B,IAAA,QAAwB,WAAxB,wBAAwB,CAAA;AACrC,IAAA,iBAAoB,WAApB,oBAAoB,CAAA;;;;;;AASnD,eAAeD,iCAAiC,CACrDE,OAAiB,EACjBC,MAAyB,EACN;IACnB,MAAMC,SAAS,GAAG,MAAMC,CAAAA,GAAAA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AC,EAAEJ,MAAM,CAACH,IAAI,CAACL,IAAI,CAAC,CAAC,CAAC,EAAES,MAAK,QAAA,CAACI,GAAG,CAAC,CAAC,CAAC,EAAER,IAAI,CAACS,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACjEjB,KAAK,EAAEQ,IAAI,CAACf,IAAI;aACjB,CAAC;SACH,CAAC;QACFyB,OAAO,EAAEC,CAAAA,GAAAA,QAAqB,AAAE,CAAA,sBAAF,EAAE;KACjC,CAAC,AAAC;IAEH,OAAOnB,KAAK,CAAC;CACd"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
+ exports.isOSType = isOSType;
5
6
  exports.getContainerPathAsync = getContainerPathAsync;
6
7
  exports.getInfoPlistValueAsync = getInfoPlistValueAsync;
7
8
  exports.openUrlAsync = openUrlAsync;
@@ -44,6 +45,19 @@ function _interopRequireWildcard(obj) {
44
45
  return newObj;
45
46
  }
46
47
  }
48
+ function isOSType(value) {
49
+ if (!value || typeof value !== "string") return false;
50
+ const knownTypes = [
51
+ "iOS",
52
+ "tvOS",
53
+ "watchOS",
54
+ "macOS"
55
+ ];
56
+ if (!knownTypes.includes(value)) {
57
+ Log.warn(`Unknown OS type: ${value}. Expected one of: ${knownTypes.join(", ")}`);
58
+ }
59
+ return true;
60
+ }
47
61
  async function getContainerPathAsync(device, { appId }) {
48
62
  try {
49
63
  const { stdout } = await simctlAsync([
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/platforms/ios/simctl.ts"],"sourcesContent":["import spawnAsync, { SpawnOptions, SpawnResult } from '@expo/spawn-async';\n\nimport * as Log from '../../../log';\nimport { CommandError } from '../../../utils/errors';\nimport { xcrunAsync } from './xcrun';\n\ntype DeviceState = 'Shutdown' | 'Booted';\n\ntype OSType = 'iOS' | 'tvOS' | 'watchOS' | 'macOS';\n\nexport type Device = {\n availabilityError?: 'runtime profile not found';\n /** '/Users/name/Library/Developer/CoreSimulator/Devices/00E55DC0-0364-49DF-9EC6-77BE587137D4/data' */\n dataPath: string;\n /** '/Users/name/Library/Logs/CoreSimulator/00E55DC0-0364-49DF-9EC6-77BE587137D4' */\n logPath: string;\n /** '00E55DC0-0364-49DF-9EC6-77BE587137D4' */\n udid: string;\n /** 'com.apple.CoreSimulator.SimRuntime.iOS-15-1' */\n runtime: string;\n /** If the device is \"available\" which generally means that the OS files haven't been deleted (this can happen when Xcode updates). */\n isAvailable: boolean;\n /** 'com.apple.CoreSimulator.SimDeviceType.iPhone-13-Pro' */\n deviceTypeIdentifier: string;\n state: DeviceState;\n /** 'iPhone 13 Pro' */\n name: string;\n /** Type of OS the device uses. */\n osType: OSType;\n /** '15.1' */\n osVersion: string;\n /** 'iPhone 13 Pro (15.1)' */\n windowName: string;\n};\n\ntype SimulatorDeviceList = {\n devices: {\n [runtime: string]: Device[];\n };\n};\n\ntype DeviceContext = Pick<Device, 'udid'>;\n\n/**\n * Returns the local path for the installed tar.app. Returns null when the app isn't installed.\n *\n * @param device context for selecting a device.\n * @param props.appId bundle identifier for app.\n * @returns local file path to installed app binary, e.g. '/Users/evanbacon/Library/Developer/CoreSimulator/Devices/EFEEA6EF-E3F5-4EDE-9B72-29EAFA7514AE/data/Containers/Bundle/Application/FA43A0C6-C2AD-442D-B8B1-EAF3E88CF3BF/Exponent-2.21.3.tar.app'\n */\nexport async function getContainerPathAsync(\n device: Partial<DeviceContext>,\n {\n appId,\n }: {\n appId: string;\n }\n): Promise<string | null> {\n try {\n const { stdout } = await simctlAsync(['get_app_container', resolveId(device), appId]);\n return stdout.trim();\n } catch (error: any) {\n if (error.stderr?.match(/No such file or directory/)) {\n return null;\n }\n throw error;\n }\n}\n\n/** Return a value from an installed app's Info.plist. */\nexport async function getInfoPlistValueAsync(\n device: Partial<DeviceContext>,\n {\n appId,\n key,\n }: {\n appId: string;\n key: string;\n }\n): Promise<string | null> {\n const containerPath = await getContainerPathAsync(device, { appId });\n if (containerPath) {\n try {\n const { output } = await spawnAsync('defaults', ['read', `${containerPath}/Info`, key], {\n stdio: 'pipe',\n });\n return output.join('\\n').trim();\n } catch {\n return null;\n }\n }\n return null;\n}\n\n/** Open a URL on a device. The url can have any protocol. */\nexport async function openUrlAsync(\n device: Partial<DeviceContext>,\n options: { url: string }\n): Promise<void> {\n try {\n // Skip logging since this is likely to fail.\n await simctlAsync(['openurl', resolveId(device), options.url]);\n } catch (error: any) {\n if (!error.stderr?.match(/Unable to lookup in current state: Shut/)) {\n throw error;\n }\n\n // If the device was in a weird in-between state (\"Shutting Down\" or \"Shutdown\"), then attempt to reboot it and try again.\n // This can happen when quitting the Simulator app, and immediately pressing `i` to reopen the project.\n\n // First boot the simulator\n await bootDeviceAsync({ udid: resolveId(device) });\n\n // Finally, try again...\n return await openUrlAsync(device, options);\n }\n}\n\n/** Open a simulator using a bundle identifier. If no app with a matching bundle identifier is installed then an error will be thrown. */\nexport async function openAppIdAsync(\n device: Partial<DeviceContext>,\n options: {\n appId: string;\n }\n): Promise<SpawnResult> {\n const results = await openAppIdInternalAsync(device, options);\n // Similar to 194, this is a conformance issue which indicates that the given device has no app that can handle our launch request.\n if (results.status === 4) {\n throw new CommandError('APP_NOT_INSTALLED', results.stderr);\n }\n return results;\n}\nasync function openAppIdInternalAsync(\n device: Partial<DeviceContext>,\n options: {\n appId: string;\n }\n): Promise<SpawnResult> {\n try {\n return await simctlAsync(['launch', resolveId(device), options.appId]);\n } catch (error: any) {\n if ('status' in error) {\n return error;\n }\n throw error;\n }\n}\n\n// This will only boot in headless mode if the Simulator app is not running.\nexport async function bootAsync(device: DeviceContext): Promise<Device | null> {\n await bootDeviceAsync(device);\n return isDeviceBootedAsync(device);\n}\n\n/** Returns a list of devices whose current state is 'Booted' as an array. */\nexport async function getBootedSimulatorsAsync(): Promise<Device[]> {\n const simulatorDeviceInfo = await getRuntimesAsync('devices');\n return Object.values(simulatorDeviceInfo.devices).flatMap((runtime) =>\n runtime.filter((device) => device.state === 'Booted')\n );\n}\n\n/** Returns the current device if its state is 'Booted'. */\nexport async function isDeviceBootedAsync(device: Partial<DeviceContext>): Promise<Device | null> {\n // Simulators can be booted even if the app isn't running :(\n const devices = await getBootedSimulatorsAsync();\n if (device.udid) {\n return devices.find((bootedDevice) => bootedDevice.udid === device.udid) ?? null;\n }\n\n return devices[0] ?? null;\n}\n\n/** Boot a device. */\nexport async function bootDeviceAsync(device: DeviceContext): Promise<void> {\n try {\n // Skip logging since this is likely to fail.\n await simctlAsync(['boot', device.udid]);\n } catch (error: any) {\n if (!error.stderr?.match(/Unable to boot device in current state: Booted/)) {\n throw error;\n }\n }\n}\n\n/** Install a binary file on the device. */\nexport async function installAsync(\n device: Partial<DeviceContext>,\n options: {\n /** Local absolute file path to an app binary that is built and provisioned for iOS simulators. */\n filePath: string;\n }\n): Promise<any> {\n return simctlAsync(['install', resolveId(device), options.filePath]);\n}\n\n/** Uninstall an app from the provided device. */\nexport async function uninstallAsync(\n device: Partial<DeviceContext>,\n options: {\n /** Bundle identifier */\n appId: string;\n }\n): Promise<any> {\n return simctlAsync(['uninstall', resolveId(device), options.appId]);\n}\n\nfunction parseSimControlJSONResults(input: string): any {\n try {\n return JSON.parse(input);\n } catch (error: any) {\n // Nov 15, 2020: Observed this can happen when opening the simulator and the simulator prompts the user to update the xcode command line tools.\n // Unexpected token I in JSON at position 0\n if (error.message.includes('Unexpected token')) {\n Log.error(`Apple's simctl returned malformed JSON:\\n${input}`);\n }\n throw error;\n }\n}\n\n/** Get all runtime devices given a certain type. */\nasync function getRuntimesAsync(\n type: 'devices' | 'devicetypes' | 'runtimes' | 'pairs',\n query?: string | 'available'\n): Promise<SimulatorDeviceList> {\n const result = await simctlAsync(['list', type, '--json', query]);\n const info = parseSimControlJSONResults(result.stdout) as SimulatorDeviceList;\n\n for (const runtime of Object.keys(info.devices)) {\n // Given a string like 'com.apple.CoreSimulator.SimRuntime.tvOS-13-4'\n const runtimeSuffix = runtime.split('com.apple.CoreSimulator.SimRuntime.').pop()!;\n // Create an array [tvOS, 13, 4]\n const [osType, ...osVersionComponents] = runtimeSuffix.split('-');\n // Join the end components [13, 4] -> '13.4'\n const osVersion = osVersionComponents.join('.');\n const sims = info.devices[runtime];\n for (const device of sims) {\n device.runtime = runtime;\n device.osVersion = osVersion;\n device.windowName = `${device.name} (${osVersion})`;\n device.osType = osType as OSType;\n }\n }\n return info;\n}\n\n/** Return a list of iOS simulators. */\nexport async function getDevicesAsync(): Promise<Device[]> {\n const simulatorDeviceInfo = await getRuntimesAsync('devices');\n return Object.values(simulatorDeviceInfo.devices).flat();\n}\n\n/** Run a `simctl` command. */\nexport async function simctlAsync(\n args: (string | undefined)[],\n options?: SpawnOptions\n): Promise<SpawnResult> {\n return xcrunAsync(['simctl', ...args], options);\n}\n\nfunction resolveId(device: Partial<DeviceContext>): string {\n return device.udid ?? 'booted';\n}\n"],"names":["getContainerPathAsync","getInfoPlistValueAsync","openUrlAsync","openAppIdAsync","bootAsync","getBootedSimulatorsAsync","isDeviceBootedAsync","bootDeviceAsync","installAsync","uninstallAsync","getDevicesAsync","simctlAsync","Log","device","appId","stdout","resolveId","trim","error","stderr","match","key","containerPath","output","spawnAsync","stdio","join","options","url","udid","results","openAppIdInternalAsync","status","CommandError","simulatorDeviceInfo","getRuntimesAsync","Object","values","devices","flatMap","runtime","filter","state","find","bootedDevice","filePath","parseSimControlJSONResults","input","JSON","parse","message","includes","type","query","result","info","keys","runtimeSuffix","split","pop","osType","osVersionComponents","osVersion","sims","windowName","name","flat","args","xcrunAsync"],"mappings":"AAAA;;;;QAkDsBA,qBAAqB,GAArBA,qBAAqB;QAoBrBC,sBAAsB,GAAtBA,sBAAsB;QAyBtBC,YAAY,GAAZA,YAAY;QAwBZC,cAAc,GAAdA,cAAc;QA8BdC,SAAS,GAATA,SAAS;QAMTC,wBAAwB,GAAxBA,wBAAwB;QAQxBC,mBAAmB,GAAnBA,mBAAmB;QAWnBC,eAAe,GAAfA,eAAe;QAYfC,YAAY,GAAZA,YAAY;QAW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DA,KAAW;IAAlB,OAAOA,CAAAA,KAAW,GAAXA,MAAM,CAACgB,IAAI,YAAXhB,KAAW,GAAI,QAAQ,CAAC;CAChC"}
1
+ {"version":3,"sources":["../../../../../src/start/platforms/ios/simctl.ts"],"sourcesContent":["import spawnAsync, { SpawnOptions, SpawnResult } from '@expo/spawn-async';\n\nimport * as Log from '../../../log';\nimport { CommandError } from '../../../utils/errors';\nimport { xcrunAsync } from './xcrun';\n\ntype DeviceState = 'Shutdown' | 'Booted';\n\nexport type OSType = 'iOS' | 'tvOS' | 'watchOS' | 'macOS';\n\nexport type Device = {\n availabilityError?: 'runtime profile not found';\n /** '/Users/name/Library/Developer/CoreSimulator/Devices/00E55DC0-0364-49DF-9EC6-77BE587137D4/data' */\n dataPath: string;\n /** @example `2811236352` */\n dataPathSize?: number;\n /** '/Users/name/Library/Logs/CoreSimulator/00E55DC0-0364-49DF-9EC6-77BE587137D4' */\n logPath: string;\n /** @example `479232` */\n logPathSize?: number;\n /** '00E55DC0-0364-49DF-9EC6-77BE587137D4' */\n udid: string;\n /** 'com.apple.CoreSimulator.SimRuntime.iOS-15-1' */\n runtime: string;\n /** If the device is \"available\" which generally means that the OS files haven't been deleted (this can happen when Xcode updates). */\n isAvailable: boolean;\n /** 'com.apple.CoreSimulator.SimDeviceType.iPhone-13-Pro' */\n deviceTypeIdentifier: string;\n state: DeviceState;\n /** 'iPhone 13 Pro' */\n name: string;\n /** Type of OS the device uses. */\n osType: OSType;\n /** '15.1' */\n osVersion: string;\n /** 'iPhone 13 Pro (15.1)' */\n windowName: string;\n};\n\ntype SimulatorDeviceList = {\n devices: {\n [runtime: string]: Device[];\n };\n};\n\ntype DeviceContext = Pick<Device, 'udid'>;\n\n/** Returns true if the given value is an `OSType`, if we don't recognize the value we continue anyways but warn. */\nexport function isOSType(value: any): value is OSType {\n if (!value || typeof value !== 'string') return false;\n\n const knownTypes = ['iOS', 'tvOS', 'watchOS', 'macOS'];\n if (!knownTypes.includes(value)) {\n Log.warn(`Unknown OS type: ${value}. Expected one of: ${knownTypes.join(', ')}`);\n }\n return true;\n}\n\n/**\n * Returns the local path for the installed tar.app. Returns null when the app isn't installed.\n *\n * @param device context for selecting a device.\n * @param props.appId bundle identifier for app.\n * @returns local file path to installed app binary, e.g. '/Users/evanbacon/Library/Developer/CoreSimulator/Devices/EFEEA6EF-E3F5-4EDE-9B72-29EAFA7514AE/data/Containers/Bundle/Application/FA43A0C6-C2AD-442D-B8B1-EAF3E88CF3BF/Exponent-2.21.3.tar.app'\n */\nexport async function getContainerPathAsync(\n device: Partial<DeviceContext>,\n {\n appId,\n }: {\n appId: string;\n }\n): Promise<string | null> {\n try {\n const { stdout } = await simctlAsync(['get_app_container', resolveId(device), appId]);\n return stdout.trim();\n } catch (error: any) {\n if (error.stderr?.match(/No such file or directory/)) {\n return null;\n }\n throw error;\n }\n}\n\n/** Return a value from an installed app's Info.plist. */\nexport async function getInfoPlistValueAsync(\n device: Partial<DeviceContext>,\n {\n appId,\n key,\n }: {\n appId: string;\n key: string;\n }\n): Promise<string | null> {\n const containerPath = await getContainerPathAsync(device, { appId });\n if (containerPath) {\n try {\n const { output } = await spawnAsync('defaults', ['read', `${containerPath}/Info`, key], {\n stdio: 'pipe',\n });\n return output.join('\\n').trim();\n } catch {\n return null;\n }\n }\n return null;\n}\n\n/** Open a URL on a device. The url can have any protocol. */\nexport async function openUrlAsync(\n device: Partial<DeviceContext>,\n options: { url: string }\n): Promise<void> {\n try {\n // Skip logging since this is likely to fail.\n await simctlAsync(['openurl', resolveId(device), options.url]);\n } catch (error: any) {\n if (!error.stderr?.match(/Unable to lookup in current state: Shut/)) {\n throw error;\n }\n\n // If the device was in a weird in-between state (\"Shutting Down\" or \"Shutdown\"), then attempt to reboot it and try again.\n // This can happen when quitting the Simulator app, and immediately pressing `i` to reopen the project.\n\n // First boot the simulator\n await bootDeviceAsync({ udid: resolveId(device) });\n\n // Finally, try again...\n return await openUrlAsync(device, options);\n }\n}\n\n/** Open a simulator using a bundle identifier. If no app with a matching bundle identifier is installed then an error will be thrown. */\nexport async function openAppIdAsync(\n device: Partial<DeviceContext>,\n options: {\n appId: string;\n }\n): Promise<SpawnResult> {\n const results = await openAppIdInternalAsync(device, options);\n // Similar to 194, this is a conformance issue which indicates that the given device has no app that can handle our launch request.\n if (results.status === 4) {\n throw new CommandError('APP_NOT_INSTALLED', results.stderr);\n }\n return results;\n}\nasync function openAppIdInternalAsync(\n device: Partial<DeviceContext>,\n options: {\n appId: string;\n }\n): Promise<SpawnResult> {\n try {\n return await simctlAsync(['launch', resolveId(device), options.appId]);\n } catch (error: any) {\n if ('status' in error) {\n return error;\n }\n throw error;\n }\n}\n\n// This will only boot in headless mode if the Simulator app is not running.\nexport async function bootAsync(device: DeviceContext): Promise<Device | null> {\n await bootDeviceAsync(device);\n return isDeviceBootedAsync(device);\n}\n\n/** Returns a list of devices whose current state is 'Booted' as an array. */\nexport async function getBootedSimulatorsAsync(): Promise<Device[]> {\n const simulatorDeviceInfo = await getRuntimesAsync('devices');\n return Object.values(simulatorDeviceInfo.devices).flatMap((runtime) =>\n runtime.filter((device) => device.state === 'Booted')\n );\n}\n\n/** Returns the current device if its state is 'Booted'. */\nexport async function isDeviceBootedAsync(device: Partial<DeviceContext>): Promise<Device | null> {\n // Simulators can be booted even if the app isn't running :(\n const devices = await getBootedSimulatorsAsync();\n if (device.udid) {\n return devices.find((bootedDevice) => bootedDevice.udid === device.udid) ?? null;\n }\n\n return devices[0] ?? null;\n}\n\n/** Boot a device. */\nexport async function bootDeviceAsync(device: DeviceContext): Promise<void> {\n try {\n // Skip logging since this is likely to fail.\n await simctlAsync(['boot', device.udid]);\n } catch (error: any) {\n if (!error.stderr?.match(/Unable to boot device in current state: Booted/)) {\n throw error;\n }\n }\n}\n\n/** Install a binary file on the device. */\nexport async function installAsync(\n device: Partial<DeviceContext>,\n options: {\n /** Local absolute file path to an app binary that is built and provisioned for iOS simulators. */\n filePath: string;\n }\n): Promise<any> {\n return simctlAsync(['install', resolveId(device), options.filePath]);\n}\n\n/** Uninstall an app from the provided device. */\nexport async function uninstallAsync(\n device: Partial<DeviceContext>,\n options: {\n /** Bundle identifier */\n appId: string;\n }\n): Promise<any> {\n return simctlAsync(['uninstall', resolveId(device), options.appId]);\n}\n\nfunction parseSimControlJSONResults(input: string): any {\n try {\n return JSON.parse(input);\n } catch (error: any) {\n // Nov 15, 2020: Observed this can happen when opening the simulator and the simulator prompts the user to update the xcode command line tools.\n // Unexpected token I in JSON at position 0\n if (error.message.includes('Unexpected token')) {\n Log.error(`Apple's simctl returned malformed JSON:\\n${input}`);\n }\n throw error;\n }\n}\n\n/** Get all runtime devices given a certain type. */\nasync function getRuntimesAsync(\n type: 'devices' | 'devicetypes' | 'runtimes' | 'pairs',\n query?: string | 'available'\n): Promise<SimulatorDeviceList> {\n const result = await simctlAsync(['list', type, '--json', query]);\n const info = parseSimControlJSONResults(result.stdout) as SimulatorDeviceList;\n\n for (const runtime of Object.keys(info.devices)) {\n // Given a string like 'com.apple.CoreSimulator.SimRuntime.tvOS-13-4'\n const runtimeSuffix = runtime.split('com.apple.CoreSimulator.SimRuntime.').pop()!;\n // Create an array [tvOS, 13, 4]\n const [osType, ...osVersionComponents] = runtimeSuffix.split('-');\n // Join the end components [13, 4] -> '13.4'\n const osVersion = osVersionComponents.join('.');\n const sims = info.devices[runtime];\n for (const device of sims) {\n device.runtime = runtime;\n device.osVersion = osVersion;\n device.windowName = `${device.name} (${osVersion})`;\n device.osType = osType as OSType;\n }\n }\n return info;\n}\n\n/** Return a list of iOS simulators. */\nexport async function getDevicesAsync(): Promise<Device[]> {\n const simulatorDeviceInfo = await getRuntimesAsync('devices');\n return Object.values(simulatorDeviceInfo.devices).flat();\n}\n\n/** Run a `simctl` command. */\nexport async function simctlAsync(\n args: (string | undefined)[],\n options?: SpawnOptions\n): Promise<SpawnResult> {\n return xcrunAsync(['simctl', ...args], options);\n}\n\nfunction resolveId(device: Partial<DeviceContext>): string {\n return device.udid ?? 'booted';\n}\n"],"names":["isOSType","getContainerPathAsync","getInfoPlistValueAsync","openUrlAsync","openAppIdAsync","bootAsync","getBootedSimulatorsAsync","isDeviceBootedAsync","bootDeviceAsync","installAsync","uninstallAsync","getDevicesAsync","simctlAsync","Log","value","knownTypes","includes","warn","join","device","appId","stdout","resolveId","trim","error","stderr","match","key","containerPath","output","spawnAsync","stdio","options","url","udid","results","openAppIdInternalAsync","status","CommandError","simulatorDeviceInfo","getRuntimesAsync","Object","values","devices","flatMap","runtime","filter","state","find","bootedDevice","filePath","parseSimControlJSONResults","input","JSON","parse","message","type","query","result","info","keys","runtimeSuffix","split","pop","osType","osVersionComponents","osVersion","sims","windowName","name","flat","args","xcrunAsync"],"mappings":"AAAA;;;;QAgDgBA,QAAQ,GAARA,QAAQ;QAiBFC,qBAAqB,GAArBA,qBAAqB;QAoBrBC,sBAAsB,GAAtBA,sBAAsB;QAyBtBC,YAAY,GAAZA,YAAY;QAwBZC,cAAc,GAAdA,cAAc;QA8BdC,SAAS,GAATA,SAAS;QAMTC,wBAAwB,GAAxBA,wBAAwB;QAQxBC,mBAAmB,GAAnBA,mBAAmB;QAWnBC,eAAe,GAAfA,eAAe;QAYfC,YAAY,GAAZA,YAAY;QAWZC,cAAc,GAAdA,cAAc;QAkDdC,eAAe,GAAfA,eAAe;QAMfC,WAAW,GAAXA,WAAW;AA5QqB,IAAA,WAAmB,kCAAnB,mBAAmB,EAAA;AAE7DC,IAAAA,GAAG,mCAAM,cAAc,EAApB;AACc,IAAA,OAAuB,WAAvB,uBAAuB,CAAA;AACzB,IAAA,MAAS,WAAT,SAAS,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4C7B,SAASb,QAAQ,CAACc,KAAU,EAAmB;IACpD,IAAI,CAACA,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE,OAAO,KAAK,CAAC;IAEtD,MAAMC,UAAU,GAAG;QAAC,KAAK;QAAE,MAAM;QAAE,SAAS;QAAE,OAAO;KAAC,AAAC;I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AAA,KAAW,GAAXA,MAAM,CAACe,IAAI,YAAXf,KAAW,GAAI,QAAQ,CAAC;CAChC"}
@@ -0,0 +1,220 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ exports.onMessage = onMessage;
6
+ var _chalk = _interopRequireDefault(require("chalk"));
7
+ var _childProcess = require("child_process");
8
+ var _os = require("os");
9
+ var _path = _interopRequireDefault(require("path"));
10
+ var _wrapAnsi = _interopRequireDefault(require("wrap-ansi"));
11
+ var Log = _interopRequireWildcard(require("../../../log"));
12
+ var _errors = require("../../../utils/errors");
13
+ var _exit = require("../../../utils/exit");
14
+ var _simctl = require("./simctl");
15
+ function _interopRequireDefault(obj) {
16
+ return obj && obj.__esModule ? obj : {
17
+ default: obj
18
+ };
19
+ }
20
+ function _interopRequireWildcard(obj) {
21
+ if (obj && obj.__esModule) {
22
+ return obj;
23
+ } else {
24
+ var newObj = {};
25
+ if (obj != null) {
26
+ for(var key in obj){
27
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
28
+ var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
29
+ if (desc.get || desc.set) {
30
+ Object.defineProperty(newObj, key, desc);
31
+ } else {
32
+ newObj[key] = obj[key];
33
+ }
34
+ }
35
+ }
36
+ }
37
+ newObj.default = obj;
38
+ return newObj;
39
+ }
40
+ }
41
+ class SimulatorLogStreamer {
42
+ static cache = [];
43
+ static getStreamer = (device, resolver)=>{
44
+ var ref;
45
+ return (ref = SimulatorLogStreamer.cache.find((streamer)=>streamer.device.udid === device.udid
46
+ )) != null ? ref : new SimulatorLogStreamer(device, resolver);
47
+ };
48
+ constructor(device, resolver){
49
+ this.device = device;
50
+ this.resolver = resolver;
51
+ this.childProcess = null;
52
+ this.off = null;
53
+ }
54
+ isAttached() {
55
+ return !!this.childProcess;
56
+ }
57
+ async resolvePidAsync() {
58
+ if ("pid" in this.resolver) {
59
+ return this.resolver.pid;
60
+ }
61
+ return getImageNameFromBundleIdentifierAsync(this.device.udid, this.resolver.appId);
62
+ }
63
+ async attachAsync() {
64
+ await this.detachAsync();
65
+ const pid = await this.resolvePidAsync();
66
+ if (!pid) {
67
+ throw new _errors.CommandError(`Could not find pid for ${this.device.udid}`);
68
+ }
69
+ // xcrun simctl spawn booted log stream --process --style json
70
+ this.childProcess = (0, _childProcess).spawn("xcrun", [
71
+ "simctl",
72
+ "spawn",
73
+ this.device.udid,
74
+ "log",
75
+ "stream",
76
+ "--process",
77
+ pid,
78
+ // ndjson provides a better format than json.
79
+ "--style",
80
+ "ndjson",
81
+ // Provide the source so we can filter logs better
82
+ "--source",
83
+ // log, activity, trace -- activity was related to layouts, trace didn't work, so that leaves log.
84
+ // Passing nothing combines all three, but we don't use activity.
85
+ "--type",
86
+ "log",
87
+ // backtrace doesn't seem very useful in basic cases.
88
+ // TODO: Maybe we can format as a stack trace for native errors.
89
+ "--no-backtrace",
90
+ ]);
91
+ this.childProcess.stdout.on("data", (data)=>{
92
+ // Sometimes more than one chunk comes at a time, here we split by system newline,
93
+ // then trim and filter.
94
+ const strings = data.toString().split(_os.EOL).map((value)=>value.trim()
95
+ )// This filters out the first log which says something like:
96
+ // Filtering the log data using "process BEGINSWITH[cd] "my-app" AND type == 1024"
97
+ .filter((value)=>value.startsWith("{")
98
+ );
99
+ strings.forEach((str)=>{
100
+ const simLog = parseMessageJson(str);
101
+ if (!simLog) {
102
+ return;
103
+ }
104
+ onMessage(simLog);
105
+ });
106
+ });
107
+ this.childProcess.on("error", ({ message })=>{
108
+ Log.debug("[simctl error]:", message);
109
+ });
110
+ this.off = (0, _exit).installExitHooks(()=>{
111
+ this.detachAsync.bind(this);
112
+ });
113
+ }
114
+ detachAsync() {
115
+ var _obj, ref2;
116
+ (ref2 = (_obj = this).off) == null ? void 0 : ref2.call(_obj);
117
+ this.off = null;
118
+ if (this.childProcess) {
119
+ return new Promise((resolve)=>{
120
+ var ref, ref1;
121
+ (ref = this.childProcess) == null ? void 0 : ref.on("close", resolve);
122
+ (ref1 = this.childProcess) == null ? void 0 : ref1.kill();
123
+ this.childProcess = null;
124
+ });
125
+ }
126
+ return Promise.resolve();
127
+ }
128
+ }
129
+ exports.SimulatorLogStreamer = SimulatorLogStreamer;
130
+ function parseMessageJson(data) {
131
+ const stringData = data.toString();
132
+ try {
133
+ return JSON.parse(stringData);
134
+ } catch {
135
+ Log.debug("Failed to parse simctl JSON message:\n" + stringData);
136
+ }
137
+ return null;
138
+ }
139
+ // There are a lot of networking logs in RN that aren't relevant to the user.
140
+ function isNetworkLog(simLog) {
141
+ var ref;
142
+ return simLog.subsystem === "com.apple.network" || simLog.category === "connection" || ((ref = simLog.source) == null ? void 0 : ref.image) === "CFNetwork";
143
+ }
144
+ function isReactLog(simLog) {
145
+ var ref;
146
+ return simLog.subsystem === "com.facebook.react.log" && ((ref = simLog.source) == null ? void 0 : ref.file) === "RCTLog.mm";
147
+ }
148
+ // It's not clear what these are but they aren't very useful.
149
+ // (The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated)
150
+ // We can add them later if need.
151
+ function isCoreTelephonyLog(simLog) {
152
+ // [CoreTelephony] Updating selectors failed with: Error Domain=NSCocoaErrorDomain Code=4099
153
+ // "The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated.}
154
+ return simLog.subsystem === "com.apple.CoreTelephony";
155
+ }
156
+ // https://stackoverflow.com/a/65313219/4047926
157
+ function isWebKitLog(simLog) {
158
+ // [WebKit] 0x1143ca500 - ProcessAssertion: Failed to acquire RBS Background assertion 'WebProcess Background Assertion' for process with PID 27084, error: Error Domain=RBSAssertionErrorDomain Code=3 "Target is not running or required target
159
+ // entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"Background" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Target is not running or required target entitlement is missing}
160
+ return simLog.subsystem === "com.apple.WebKit";
161
+ }
162
+ // Similar to WebKit logs
163
+ function isRunningBoardServicesLog(simLog) {
164
+ // [RunningBoardServices] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=3 "Target is not running or required target entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit"
165
+ // name:"Background" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Target is not running or required target entitlement is missing}>
166
+ return simLog.subsystem === "com.apple.runningboard";
167
+ }
168
+ function formatMessage(simLog) {
169
+ var ref;
170
+ var ref3;
171
+ // TODO: Maybe change "TCC" to "Consent" or "System".
172
+ const category = _chalk.default.gray(`[${(ref3 = (ref = simLog.source) == null ? void 0 : ref.image) != null ? ref3 : simLog.subsystem}]`);
173
+ const message = simLog.eventMessage;
174
+ return (0, _wrapAnsi).default(category + " " + message, process.stdout.columns || 80);
175
+ }
176
+ function onMessage(simLog) {
177
+ let hasLogged = false;
178
+ if (simLog.messageType === "Error") {
179
+ if (// Hide all networking errors which are mostly useless.
180
+ !isNetworkLog(simLog) && // Showing React errors will result in duplicate messages.
181
+ !isReactLog(simLog) && !isCoreTelephonyLog(simLog) && !isWebKitLog(simLog) && !isRunningBoardServicesLog(simLog)) {
182
+ hasLogged = true;
183
+ // Sim: This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSCameraUsageDescription key with a string value explaining to the user how the app uses this data.
184
+ Log.error(formatMessage(simLog));
185
+ }
186
+ } else if (simLog.eventMessage) {
187
+ var ref;
188
+ // If the source has a file (i.e. not a system log).
189
+ if (((ref = simLog.source) == null ? void 0 : ref.file) || simLog.eventMessage.includes("Terminating app due to uncaught exception")) {
190
+ hasLogged = true;
191
+ Log.log(formatMessage(simLog));
192
+ }
193
+ }
194
+ if (!hasLogged) {
195
+ Log.debug(formatMessage(simLog));
196
+ } else {
197
+ // console.log('DATA:', JSON.stringify(simLog));
198
+ }
199
+ }
200
+ /**
201
+ *
202
+ * @param udid
203
+ * @param bundleIdentifier
204
+ * @returns Image name like `Exponent` and `null` when the app is not installed on the provided simulator.
205
+ */ async function getImageNameFromBundleIdentifierAsync(udid, bundleIdentifier) {
206
+ const containerPath = await (0, _simctl).getContainerPathAsync({
207
+ udid
208
+ }, {
209
+ appId: bundleIdentifier
210
+ });
211
+ if (containerPath) {
212
+ return getImageNameFromContainerPath(containerPath);
213
+ }
214
+ return null;
215
+ }
216
+ function getImageNameFromContainerPath(binaryPath) {
217
+ return _path.default.basename(binaryPath).split(".")[0];
218
+ }
219
+
220
+ //# sourceMappingURL=simctlLogging.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/start/platforms/ios/simctlLogging.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { ChildProcessWithoutNullStreams, spawn } from 'child_process';\nimport { EOL } from 'os';\nimport path from 'path';\nimport wrapAnsi from 'wrap-ansi';\n\nimport * as Log from '../../../log';\nimport { CommandError } from '../../../utils/errors';\nimport { installExitHooks } from '../../../utils/exit';\nimport { Device, getContainerPathAsync } from './simctl';\n\nexport type SimControlLog = {\n /**\n * 258753568922927108\n */\n traceID: number;\n /**\n *\n * \"Connection 1: done\",\n */\n eventMessage: string;\n /**\n * \"logEvent\" | \"activityCreateEvent\",\n */\n eventType: 'logEvent' | 'activityCreateEvent';\n source: null | {\n /**\n * 'RCTDefaultLogFunction_block_invoke' | '__TCC_CRASHING_DUE_TO_PRIVACY_VIOLATION__'\n */\n symbol: string;\n line: number;\n /**\n * 'TCC' | 'Security' | 'CFNetwork' | 'libnetwork.dylib' | 'myapp'\n *\n * TCC is apple sys, it means \"Transparency, Consent, and Control\"\n */\n image: string;\n /**\n * 'RCTLog.mm' | ''\n */\n file: string;\n };\n /**\n * \"Connection %llu: done\"\n */\n formatString: string;\n /**\n * 0\n */\n activityIdentifier: number;\n subsystem:\n | ''\n | 'com.apple.network'\n | 'com.facebook.react.log'\n | 'com.apple.TCC'\n | 'com.apple.CoreTelephony'\n | 'com.apple.WebKit'\n | 'com.apple.runningboard'\n | string;\n category: '' | 'access' | 'connection' | 'plugin';\n /**\n * \"2021-03-15 15:36:28.004331-0700\"\n */\n timestamp: string;\n /**\n * 706567072091713\n */\n machTimestamp: number;\n /**\n * \"Default\"\n */\n messageType: 'Default' | 'Error';\n /**\n * 15192\n */\n processID: number;\n};\n\ntype ProcessResolver =\n | {\n pid: string;\n }\n | {\n appId: string;\n };\n\nexport class SimulatorLogStreamer {\n private childProcess: ChildProcessWithoutNullStreams | null = null;\n\n static cache: SimulatorLogStreamer[] = [];\n\n static getStreamer = (device: Pick<Device, 'udid'>, resolver: ProcessResolver) => {\n return (\n SimulatorLogStreamer.cache.find((streamer) => streamer.device.udid === device.udid) ??\n new SimulatorLogStreamer(device, resolver)\n );\n };\n\n constructor(public device: Pick<Device, 'udid'>, public resolver: ProcessResolver) {}\n\n isAttached() {\n return !!this.childProcess;\n }\n\n async resolvePidAsync() {\n if ('pid' in this.resolver) {\n return this.resolver.pid;\n }\n return getImageNameFromBundleIdentifierAsync(this.device.udid, this.resolver.appId);\n }\n\n async attachAsync() {\n await this.detachAsync();\n\n const pid = await this.resolvePidAsync();\n\n if (!pid) {\n throw new CommandError(`Could not find pid for ${this.device.udid}`);\n }\n\n // xcrun simctl spawn booted log stream --process --style json\n this.childProcess = spawn('xcrun', [\n 'simctl',\n 'spawn',\n this.device.udid,\n 'log',\n 'stream',\n '--process',\n pid,\n // ndjson provides a better format than json.\n '--style',\n 'ndjson',\n // Provide the source so we can filter logs better\n '--source',\n // log, activity, trace -- activity was related to layouts, trace didn't work, so that leaves log.\n // Passing nothing combines all three, but we don't use activity.\n '--type',\n 'log',\n // backtrace doesn't seem very useful in basic cases.\n // TODO: Maybe we can format as a stack trace for native errors.\n '--no-backtrace',\n ]);\n\n this.childProcess.stdout.on('data', (data: Buffer) => {\n // Sometimes more than one chunk comes at a time, here we split by system newline,\n // then trim and filter.\n const strings = data\n .toString()\n .split(EOL)\n .map((value) => value.trim())\n // This filters out the first log which says something like:\n // Filtering the log data using \"process BEGINSWITH[cd] \"my-app\" AND type == 1024\"\n .filter((value) => value.startsWith('{'));\n\n strings.forEach((str) => {\n const simLog = parseMessageJson(str);\n if (!simLog) {\n return;\n }\n onMessage(simLog);\n });\n });\n\n this.childProcess.on('error', ({ message }) => {\n Log.debug('[simctl error]:', message);\n });\n\n this.off = installExitHooks(() => {\n this.detachAsync.bind(this);\n });\n }\n\n private off: (() => void) | null = null;\n\n detachAsync() {\n this.off?.();\n this.off = null;\n if (this.childProcess) {\n return new Promise<void>((resolve) => {\n this.childProcess?.on('close', resolve);\n this.childProcess?.kill();\n this.childProcess = null;\n });\n }\n return Promise.resolve();\n }\n}\n\nfunction parseMessageJson(data: string) {\n const stringData = data.toString();\n try {\n return JSON.parse(stringData) as SimControlLog;\n } catch {\n Log.debug('Failed to parse simctl JSON message:\\n' + stringData);\n }\n return null;\n}\n\n// There are a lot of networking logs in RN that aren't relevant to the user.\nfunction isNetworkLog(simLog: SimControlLog): boolean {\n return (\n simLog.subsystem === 'com.apple.network' ||\n simLog.category === 'connection' ||\n simLog.source?.image === 'CFNetwork'\n );\n}\n\nfunction isReactLog(simLog: SimControlLog): boolean {\n return simLog.subsystem === 'com.facebook.react.log' && simLog.source?.file === 'RCTLog.mm';\n}\n\n// It's not clear what these are but they aren't very useful.\n// (The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated)\n// We can add them later if need.\nfunction isCoreTelephonyLog(simLog: SimControlLog): boolean {\n // [CoreTelephony] Updating selectors failed with: Error Domain=NSCocoaErrorDomain Code=4099\n // \"The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated.\" UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated.}\n return simLog.subsystem === 'com.apple.CoreTelephony';\n}\n\n// https://stackoverflow.com/a/65313219/4047926\nfunction isWebKitLog(simLog: SimControlLog): boolean {\n // [WebKit] 0x1143ca500 - ProcessAssertion: Failed to acquire RBS Background assertion 'WebProcess Background Assertion' for process with PID 27084, error: Error Domain=RBSAssertionErrorDomain Code=3 \"Target is not running or required target\n // entitlement is missing\" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:\"com.apple.webkit\" name:\"Background\" sourceEnvironment:\"(null)\">, NSLocalizedFailureReason=Target is not running or required target entitlement is missing}\n return simLog.subsystem === 'com.apple.WebKit';\n}\n\n// Similar to WebKit logs\nfunction isRunningBoardServicesLog(simLog: SimControlLog): boolean {\n // [RunningBoardServices] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=3 \"Target is not running or required target entitlement is missing\" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:\"com.apple.webkit\"\n // name:\"Background\" sourceEnvironment:\"(null)\">, NSLocalizedFailureReason=Target is not running or required target entitlement is missing}>\n return simLog.subsystem === 'com.apple.runningboard';\n}\n\nfunction formatMessage(simLog: SimControlLog): string {\n // TODO: Maybe change \"TCC\" to \"Consent\" or \"System\".\n const category = chalk.gray(`[${simLog.source?.image ?? simLog.subsystem}]`);\n const message = simLog.eventMessage;\n return wrapAnsi(category + ' ' + message, process.stdout.columns || 80);\n}\n\nexport function onMessage(simLog: SimControlLog) {\n let hasLogged = false;\n\n if (simLog.messageType === 'Error') {\n if (\n // Hide all networking errors which are mostly useless.\n !isNetworkLog(simLog) &&\n // Showing React errors will result in duplicate messages.\n !isReactLog(simLog) &&\n !isCoreTelephonyLog(simLog) &&\n !isWebKitLog(simLog) &&\n !isRunningBoardServicesLog(simLog)\n ) {\n hasLogged = true;\n // Sim: This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSCameraUsageDescription key with a string value explaining to the user how the app uses this data.\n Log.error(formatMessage(simLog));\n }\n } else if (simLog.eventMessage) {\n // If the source has a file (i.e. not a system log).\n if (\n simLog.source?.file ||\n simLog.eventMessage.includes('Terminating app due to uncaught exception')\n ) {\n hasLogged = true;\n Log.log(formatMessage(simLog));\n }\n }\n\n if (!hasLogged) {\n Log.debug(formatMessage(simLog));\n } else {\n // console.log('DATA:', JSON.stringify(simLog));\n }\n}\n\n/**\n *\n * @param udid\n * @param bundleIdentifier\n * @returns Image name like `Exponent` and `null` when the app is not installed on the provided simulator.\n */\nasync function getImageNameFromBundleIdentifierAsync(\n udid: string,\n bundleIdentifier: string\n): Promise<string | null> {\n const containerPath = await getContainerPathAsync({ udid }, { appId: bundleIdentifier });\n\n if (containerPath) {\n return getImageNameFromContainerPath(containerPath);\n }\n return null;\n}\n\nfunction getImageNameFromContainerPath(binaryPath: string): string {\n return path.basename(binaryPath).split('.')[0];\n}\n"],"names":["onMessage","Log","SimulatorLogStreamer","cache","getStreamer","device","resolver","find","streamer","udid","constructor","childProcess","off","isAttached","resolvePidAsync","pid","getImageNameFromBundleIdentifierAsync","appId","attachAsync","detachAsync","CommandError","spawn","stdout","on","data","strings","toString","split","EOL","map","value","trim","filter","startsWith","forEach","str","simLog","parseMessageJson","message","debug","installExitHooks","bind","Promise","resolve","kill","stringData","JSON","parse","isNetworkLog","subsystem","category","source","image","isReactLog","file","isCoreTelephonyLog","isWebKitLog","isRunningBoardServicesLog","formatMessage","chalk","gray","eventMessage","wrapAnsi","process","columns","hasLogged","messageType","error","includes","log","bundleIdentifier","containerPath","getContainerPathAsync","getImageNameFromContainerPath","binaryPath","path","basename"],"mappings":"AAAA;;;;QAiPgBA,SAAS,GAATA,SAAS;AAjPP,IAAA,MAAO,kCAAP,OAAO,EAAA;AAC6B,IAAA,aAAe,WAAf,eAAe,CAAA;AACjD,IAAA,GAAI,WAAJ,IAAI,CAAA;AACP,IAAA,KAAM,kCAAN,MAAM,EAAA;AACF,IAAA,SAAW,kCAAX,WAAW,EAAA;AAEpBC,IAAAA,GAAG,mCAAM,cAAc,EAApB;AACc,IAAA,OAAuB,WAAvB,uBAAuB,CAAA;AACnB,IAAA,KAAqB,WAArB,qBAAqB,CAAA;AACR,IAAA,OAAU,WAAV,UAAU,CAAA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C;KAClC,MAAM;IACL,gDAAgD;KACjD;CACF;AAED;;;;;GAKG,CACH,eAAepB,qCAAqC,CAClDP,IAAY,EACZ6D,gBAAwB,EACA;IACxB,MAAMC,aAAa,GAAG,MAAMC,CAAAA,GAAAA,OAAqB,AAAuC,CAAA,sBAAvC,CAAC;QAAE/D,IAAI;KAAE,EAAE;QAAEQ,KAAK,EAAEqD,gBAAgB;KAAE,CAAC,AAAC;IAEzF,IAAIC,aAAa,EAAE;QACjB,OAAOE,6BAA6B,CAACF,aAAa,CAAC,CAAC;KACrD;IACD,OAAO,IAAI,CAAC;CACb;AAED,SAASE,6BAA6B,CAACC,UAAkB,EAAU;IACjE,OAAOC,KAAI,QAAA,CAACC,QAAQ,CAACF,UAAU,CAAC,CAAC/C,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;CAChD"}
@@ -5,36 +5,15 @@ Object.defineProperty(exports, "__esModule", {
5
5
  exports.xcrunAsync = xcrunAsync;
6
6
  var _spawnAsync = _interopRequireDefault(require("@expo/spawn-async"));
7
7
  var _chalk = _interopRequireDefault(require("chalk"));
8
- var Log = _interopRequireWildcard(require("../../../log"));
9
8
  var _errors = require("../../../utils/errors");
10
9
  function _interopRequireDefault(obj) {
11
10
  return obj && obj.__esModule ? obj : {
12
11
  default: obj
13
12
  };
14
13
  }
15
- function _interopRequireWildcard(obj) {
16
- if (obj && obj.__esModule) {
17
- return obj;
18
- } else {
19
- var newObj = {};
20
- if (obj != null) {
21
- for(var key in obj){
22
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
23
- var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
24
- if (desc.get || desc.set) {
25
- Object.defineProperty(newObj, key, desc);
26
- } else {
27
- newObj[key] = obj[key];
28
- }
29
- }
30
- }
31
- }
32
- newObj.default = obj;
33
- return newObj;
34
- }
35
- }
14
+ const debug = require("debug")("expo:start:platforms:ios:xcrun");
36
15
  async function xcrunAsync(args, options) {
37
- Log.debug("Running: xcrun " + args.join(" "));
16
+ debug("Running: xcrun " + args.join(" "));
38
17
  try {
39
18
  return await (0, _spawnAsync).default("xcrun", args.filter(Boolean), options);
40
19
  } catch (e) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/platforms/ios/xcrun.ts"],"sourcesContent":["import spawnAsync, { SpawnOptions } from '@expo/spawn-async';\nimport chalk from 'chalk';\n\nimport * as Log from '../../../log';\nimport { CommandError } from '../../../utils/errors';\n\nexport async function xcrunAsync(args: (string | undefined)[], options?: SpawnOptions) {\n Log.debug('Running: xcrun ' + args.join(' '));\n try {\n return await spawnAsync('xcrun', args.filter(Boolean) as string[], options);\n } catch (e) {\n throwXcrunError(e);\n }\n}\n\nfunction throwXcrunError(e: any): never {\n if (isLicenseOutOfDate(e.stdout) || isLicenseOutOfDate(e.stderr)) {\n throw new CommandError(\n 'XCODE_LICENSE_NOT_ACCEPTED',\n 'Xcode license is not accepted. Please run `sudo xcodebuild -license`.'\n );\n } else if (e.stderr?.includes('not a developer tool or in PATH')) {\n throw new CommandError(\n 'SIMCTL_NOT_AVAILABLE',\n `You may need to run ${chalk.bold(\n 'sudo xcode-select -s /Applications/Xcode.app'\n )} and try again.`\n );\n }\n // Attempt to craft a better error message...\n if (Array.isArray(e.output)) {\n e.message += '\\n' + e.output.join('\\n').trim();\n } else if (e.stderr) {\n e.message += '\\n' + e.stderr;\n }\n throw e;\n}\n\nfunction isLicenseOutOfDate(text: string) {\n if (!text) {\n return false;\n }\n\n const lower = text.toLowerCase();\n return lower.includes('xcode') && lower.includes('license');\n}\n"],"names":["xcrunAsync","Log","args","options","debug","join","spawnAsync","filter","Boolean","e","throwXcrunError","isLicenseOutOfDate","stdout","stderr","CommandError","includes","chalk","bold","Array","isArray","output","message","trim","text","lower","toLowerCase"],"mappings":"AAAA;;;;QAMsBA,UAAU,GAAVA,UAAU;AANS,IAAA,WAAmB,kCAAnB,mBAAmB,EAAA;AAC1C,IAAA,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AAE,CAAC;KAChD,MAAM,IAAIb,CAAC,CAACI,MAAM,EAAE;QACnBJ,CAAC,CAACY,OAAO,IAAI,IAAI,GAAGZ,CAAC,CAACI,MAAM,CAAC;KAC9B;IACD,MAAMJ,CAAC,CAAC;CACT;AAED,SAASE,kBAAkB,CAACY,IAAY,EAAE;IACxC,IAAI,CAACA,IAAI,EAAE;QACT,OAAO,KAAK,CAAC;KACd;IAED,MAAMC,KAAK,GAAGD,IAAI,CAACE,WAAW,EAAE,AAAC;IACjC,OAAOD,KAAK,CAACT,QAAQ,CAAC,OAAO,CAAC,IAAIS,KAAK,CAACT,QAAQ,CAAC,SAAS,CAAC,CAAC;CAC7D"}
1
+ {"version":3,"sources":["../../../../../src/start/platforms/ios/xcrun.ts"],"sourcesContent":["import spawnAsync, { SpawnOptions } from '@expo/spawn-async';\nimport chalk from 'chalk';\n\nimport { CommandError } from '../../../utils/errors';\n\nconst debug = require('debug')('expo:start:platforms:ios:xcrun') as typeof console.log;\n\nexport async function xcrunAsync(args: (string | undefined)[], options?: SpawnOptions) {\n debug('Running: xcrun ' + args.join(' '));\n try {\n return await spawnAsync('xcrun', args.filter(Boolean) as string[], options);\n } catch (e) {\n throwXcrunError(e);\n }\n}\n\nfunction throwXcrunError(e: any): never {\n if (isLicenseOutOfDate(e.stdout) || isLicenseOutOfDate(e.stderr)) {\n throw new CommandError(\n 'XCODE_LICENSE_NOT_ACCEPTED',\n 'Xcode license is not accepted. Please run `sudo xcodebuild -license`.'\n );\n } else if (e.stderr?.includes('not a developer tool or in PATH')) {\n throw new CommandError(\n 'SIMCTL_NOT_AVAILABLE',\n `You may need to run ${chalk.bold(\n 'sudo xcode-select -s /Applications/Xcode.app'\n )} and try again.`\n );\n }\n // Attempt to craft a better error message...\n if (Array.isArray(e.output)) {\n e.message += '\\n' + e.output.join('\\n').trim();\n } else if (e.stderr) {\n e.message += '\\n' + e.stderr;\n }\n throw e;\n}\n\nfunction isLicenseOutOfDate(text: string) {\n if (!text) {\n return false;\n }\n\n const lower = text.toLowerCase();\n return lower.includes('xcode') && lower.includes('license');\n}\n"],"names":["xcrunAsync","debug","require","args","options","join","spawnAsync","filter","Boolean","e","throwXcrunError","isLicenseOutOfDate","stdout","stderr","CommandError","includes","chalk","bold","Array","isArray","output","message","trim","text","lower","toLowerCase"],"mappings":"AAAA;;;;QAOsBA,UAAU,GAAVA,UAAU;AAPS,IAAA,WAAmB,kCAAnB,mBAAmB,EAAA;AAC1C,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEI,IAAA,OAAuB,WAAvB,uBAAuB,CAAA;;;;;;AAEpD,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,gCAAgC,CAAC,AAAsB,AAAC;AAEhF,eAAeF,UAAU,CAACG,IAA4B,EAAEC,OAAsB,EAAE;IACrFH,KAAK,CAAC,iBAAiB,GAAGE,IAAI,CAACE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1C,IAAI;QACF,OAAO,MAAMC,CAAAA,GAAAA,WAAU,AAAoD,CAAA,QAApD,CAAC,OAAO,EAAEH,IAAI,CAACI,MAAM,CAACC,OAAO,CAAC,EAAcJ,OAAO,CAAC,CAAC;KAC7E,CAAC,OAAOK,CAAC,EAAE;QACVC,eAAe,CAACD,CAAC,CAAC,CAAC;KACpB;CACF;AAED,SAASC,eAAe,CAACD,CAAM,EAAS;QAM3BA,GAAQ;IALnB,IAAIE,kBAAkB,CAACF,CAAC,CAACG,MAAM,CAAC,IAAID,kBAAkB,CAACF,CAAC,CAACI,MAAM,CAAC,EAAE;QAChE,MAAM,IAAIC,OAAY,aAAA,CACpB,4BAA4B,EAC5B,uEAAuE,CACxE,CAAC;KACH,MAAM,IAAIL,CAAAA,GAAQ,GAARA,CAAC,CAACI,MAAM,SAAU,GAAlBJ,KAAAA,CAAkB,GAAlBA,GAAQ,CAAEM,QAAQ,CAAC,iCAAiC,CAAC,EAAE;QAChE,MAAM,IAAID,OAAY,aAAA,CACpB,sBAAsB,EACtB,CAAC,oBAAoB,EAAEE,MAAK,QAAA,CAACC,IAAI,CAC/B,8CAA8C,CAC/C,CAAC,eAAe,CAAC,CACnB,CAAC;KACH;IACD,6CAA6C;IAC7C,IAAIC,KAAK,CAACC,OAAO,CAACV,CAAC,CAACW,MAAM,CAAC,EAAE;QAC3BX,CAAC,CAACY,OAAO,IAAI,IAAI,GAAGZ,CAAC,CAACW,MAAM,CAACf,IAAI,CAAC,IAAI,CAAC,CAACiB,IAAI,EAAE,CAAC;KAChD,MAAM,IAAIb,CAAC,CAACI,MAAM,EAAE;QACnBJ,CAAC,CAACY,OAAO,IAAI,IAAI,GAAGZ,CAAC,CAACI,MAAM,CAAC;KAC9B;IACD,MAAMJ,CAAC,CAAC;CACT;AAED,SAASE,kBAAkB,CAACY,IAAY,EAAE;IACxC,IAAI,CAACA,IAAI,EAAE;QACT,OAAO,KAAK,CAAC;KACd;IAED,MAAMC,KAAK,GAAGD,IAAI,CAACE,WAAW,EAAE,AAAC;IACjC,OAAOD,KAAK,CAACT,QAAQ,CAAC,OAAO,CAAC,IAAIS,KAAK,CAACT,QAAQ,CAAC,SAAS,CAAC,CAAC;CAC7D"}
@@ -8,6 +8,7 @@ exports.setDevicesInfoAsync = setDevicesInfoAsync;
8
8
  exports.saveDevicesAsync = saveDevicesAsync;
9
9
  exports.DevicesFile = void 0;
10
10
  var _dotExpo = require("./dotExpo");
11
+ const debug = require("debug")("expo:start:project:devices");
11
12
  const DEVICES_FILE_NAME = "devices.json";
12
13
  const MILLISECONDS_IN_30_DAYS = 30 * 24 * 60 * 60 * 1000;
13
14
  const DevicesFile = (0, _dotExpo).createTemporaryProjectFile(DEVICES_FILE_NAME, {
@@ -54,6 +55,7 @@ async function saveDevicesAsync(projectRoot, deviceIds) {
54
55
  const newDeviceIds = typeof deviceIds === "string" ? [
55
56
  deviceIds
56
57
  ] : deviceIds;
58
+ debug(`Saving devices: ${newDeviceIds}`);
57
59
  const { devices } = await getDevicesInfoAsync(projectRoot);
58
60
  const newDevicesJson = devices.filter((device)=>!newDeviceIds.includes(device.installationId)
59
61
  ).concat(newDeviceIds.map((deviceId)=>({
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/start/project/devices.ts"],"sourcesContent":["import { createTemporaryProjectFile } from './dotExpo';\n\nexport type DeviceInfo = {\n installationId: string;\n lastUsed: number;\n};\n\nexport type DevicesInfo = {\n devices: DeviceInfo[];\n};\n\nconst DEVICES_FILE_NAME = 'devices.json';\n\nconst MILLISECONDS_IN_30_DAYS = 30 * 24 * 60 * 60 * 1000;\n\nexport const DevicesFile = createTemporaryProjectFile<DevicesInfo>(DEVICES_FILE_NAME, {\n devices: [],\n});\n\nlet devicesInfo: DevicesInfo | null = null;\n\nexport async function getDevicesInfoAsync(projectRoot: string): Promise<DevicesInfo> {\n if (devicesInfo) {\n return devicesInfo;\n }\n return readDevicesInfoAsync(projectRoot);\n}\n\nexport async function readDevicesInfoAsync(projectRoot: string): Promise<DevicesInfo> {\n try {\n devicesInfo = await DevicesFile.readAsync(projectRoot);\n\n // if the file on disk has old devices, filter them out here before we use them\n const filteredDevices = filterOldDevices(devicesInfo.devices);\n if (filteredDevices.length < devicesInfo.devices.length) {\n devicesInfo = {\n ...devicesInfo,\n devices: filteredDevices,\n };\n // save the newly filtered list for consistency\n try {\n await setDevicesInfoAsync(projectRoot, devicesInfo);\n } catch {\n // do nothing here, we'll just keep using the filtered list in memory for now\n }\n }\n\n return devicesInfo;\n } catch {\n return await DevicesFile.setAsync(projectRoot, { devices: [] });\n }\n}\n\nexport async function setDevicesInfoAsync(\n projectRoot: string,\n json: DevicesInfo\n): Promise<DevicesInfo> {\n devicesInfo = json;\n return await DevicesFile.setAsync(projectRoot, json);\n}\n\nexport async function saveDevicesAsync(\n projectRoot: string,\n deviceIds: string | string[]\n): Promise<void> {\n const currentTime = Date.now();\n const newDeviceIds = typeof deviceIds === 'string' ? [deviceIds] : deviceIds;\n\n const { devices } = await getDevicesInfoAsync(projectRoot);\n const newDevicesJson = devices\n .filter((device) => !newDeviceIds.includes(device.installationId))\n .concat(newDeviceIds.map((deviceId) => ({ installationId: deviceId, lastUsed: currentTime })));\n await setDevicesInfoAsync(projectRoot, { devices: filterOldDevices(newDevicesJson) });\n}\n\nfunction filterOldDevices(devices: DeviceInfo[]) {\n const currentTime = Date.now();\n return (\n devices\n // filter out any devices that haven't been used to open this project in 30 days\n .filter((device) => currentTime - device.lastUsed <= MILLISECONDS_IN_30_DAYS)\n // keep only the 10 most recently used devices\n .sort((a, b) => b.lastUsed - a.lastUsed)\n .slice(0, 10)\n );\n}\n"],"names":["getDevicesInfoAsync","readDevicesInfoAsync","setDevicesInfoAsync","saveDevicesAsync","DEVICES_FILE_NAME","MILLISECONDS_IN_30_DAYS","DevicesFile","createTemporaryProjectFile","devices","devicesInfo","projectRoot","readAsync","filteredDevices","filterOldDevices","length","setAsync","json","deviceIds","currentTime","Date","now","newDeviceIds","newDevicesJson","filter","device","includes","installationId","concat","map","deviceId","lastUsed","sort","a","b","slice"],"mappings":"AAAA;;;;QAqBsBA,mBAAmB,GAAnBA,mBAAmB;QAOnBC,oBAAoB,GAApBA,oBAAoB;QAyBpBC,mBAAmB,GAAnBA,mBAAmB;QAQnBC,gBAAgB,GAAhBA,gBAAgB;;AA7DK,IAAA,QAAW,WAAX,WAAW,CAAA;AAWtD,MAAMC,iBAAiB,GAAG,cAAc,AAAC;AAEzC,MAAMC,uBAAuB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,AAAC;AAElD,MAAMC,WAAW,GAAGC,CAAAA,GAAAA,QAA0B,AAEnD,CAAA,2BAFmD,CAAcH,iBAAiB,EAAE;IACpFI,OAAO,EAAE,EAAE;CACZ,CAAC,AAAC;QAFUF,WAAW,GAAXA,WAAW;AAIxB,IAAIG,WAAW,GAAuB,IAAI,AAAC;AAEpC,eAAeT,mBAAmB,CAACU,WAAmB,EAAwB;IACnF,IAAID,WAAW,EAAE;QACf,OAAOA,W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,MAAM,GAAK,CAACH,YAAY,CAACI,QAAQ,CAACD,MAAM,CAACE,cAAc,CAAC;IAAA,CAAC,CACjEC,MAAM,CAACN,YAAY,CAACO,GAAG,CAAC,CAACC,QAAQ,GAAK,CAAC;YAAEH,cAAc,EAAEG,QAAQ;YAAEC,QAAQ,EAAEZ,WAAW;SAAE,CAAC;IAAA,CAAC,CAAC,AAAC;IACjG,MAAMhB,mBAAmB,CAACQ,WAAW,EAAE;QAAEF,OAAO,EAAEK,gBAAgB,CAACS,cAAc,CAAC;KAAE,CAAC,CAAC;CACvF;AAED,SAAST,gBAAgB,CAACL,OAAqB,EAAE;IAC/C,MAAMU,WAAW,GAAGC,IAAI,CAACC,GAAG,EAAE,AAAC;IAC/B,OACEZ,OAAO,AACL,gFAAgF;KAC/Ee,MAAM,CAAC,CAACC,MAAM,GAAKN,WAAW,GAAGM,MAAM,CAACM,QAAQ,IAAIzB,uBAAuB;IAAA,CAAC,AAC7E,8CAA8C;KAC7C0B,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,GAAKA,CAAC,CAACH,QAAQ,GAAGE,CAAC,CAACF,QAAQ;IAAA,CAAC,CACvCI,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CACf;CACH"}
1
+ {"version":3,"sources":["../../../../src/start/project/devices.ts"],"sourcesContent":["import { createTemporaryProjectFile } from './dotExpo';\n\nconst debug = require('debug')('expo:start:project:devices') as typeof console.log;\n\nexport type DeviceInfo = {\n installationId: string;\n lastUsed: number;\n};\n\nexport type DevicesInfo = {\n devices: DeviceInfo[];\n};\n\nconst DEVICES_FILE_NAME = 'devices.json';\n\nconst MILLISECONDS_IN_30_DAYS = 30 * 24 * 60 * 60 * 1000;\n\nexport const DevicesFile = createTemporaryProjectFile<DevicesInfo>(DEVICES_FILE_NAME, {\n devices: [],\n});\n\nlet devicesInfo: DevicesInfo | null = null;\n\nexport async function getDevicesInfoAsync(projectRoot: string): Promise<DevicesInfo> {\n if (devicesInfo) {\n return devicesInfo;\n }\n return readDevicesInfoAsync(projectRoot);\n}\n\nexport async function readDevicesInfoAsync(projectRoot: string): Promise<DevicesInfo> {\n try {\n devicesInfo = await DevicesFile.readAsync(projectRoot);\n\n // if the file on disk has old devices, filter them out here before we use them\n const filteredDevices = filterOldDevices(devicesInfo.devices);\n if (filteredDevices.length < devicesInfo.devices.length) {\n devicesInfo = {\n ...devicesInfo,\n devices: filteredDevices,\n };\n // save the newly filtered list for consistency\n try {\n await setDevicesInfoAsync(projectRoot, devicesInfo);\n } catch {\n // do nothing here, we'll just keep using the filtered list in memory for now\n }\n }\n\n return devicesInfo;\n } catch {\n return await DevicesFile.setAsync(projectRoot, { devices: [] });\n }\n}\n\nexport async function setDevicesInfoAsync(\n projectRoot: string,\n json: DevicesInfo\n): Promise<DevicesInfo> {\n devicesInfo = json;\n return await DevicesFile.setAsync(projectRoot, json);\n}\n\nexport async function saveDevicesAsync(\n projectRoot: string,\n deviceIds: string | string[]\n): Promise<void> {\n const currentTime = Date.now();\n const newDeviceIds = typeof deviceIds === 'string' ? [deviceIds] : deviceIds;\n\n debug(`Saving devices: ${newDeviceIds}`);\n const { devices } = await getDevicesInfoAsync(projectRoot);\n const newDevicesJson = devices\n .filter((device) => !newDeviceIds.includes(device.installationId))\n .concat(newDeviceIds.map((deviceId) => ({ installationId: deviceId, lastUsed: currentTime })));\n await setDevicesInfoAsync(projectRoot, { devices: filterOldDevices(newDevicesJson) });\n}\n\nfunction filterOldDevices(devices: DeviceInfo[]) {\n const currentTime = Date.now();\n return (\n devices\n // filter out any devices that haven't been used to open this project in 30 days\n .filter((device) => currentTime - device.lastUsed <= MILLISECONDS_IN_30_DAYS)\n // keep only the 10 most recently used devices\n .sort((a, b) => b.lastUsed - a.lastUsed)\n .slice(0, 10)\n );\n}\n"],"names":["getDevicesInfoAsync","readDevicesInfoAsync","setDevicesInfoAsync","saveDevicesAsync","debug","require","DEVICES_FILE_NAME","MILLISECONDS_IN_30_DAYS","DevicesFile","createTemporaryProjectFile","devices","devicesInfo","projectRoot","readAsync","filteredDevices","filterOldDevices","length","setAsync","json","deviceIds","currentTime","Date","now","newDeviceIds","newDevicesJson","filter","device","includes","installationId","concat","map","deviceId","lastUsed","sort","a","b","slice"],"mappings":"AAAA;;;;QAuBsBA,mBAAmB,GAAnBA,mBAAmB;QAOnBC,oBAAoB,GAApBA,oBAAoB;QAyBpBC,mBAAmB,GAAnBA,mBAAmB;QAQnBC,gBAAgB,GAAhBA,gBAAgB;;AA/DK,IAAA,QAAW,WAAX,WAAW,CAAA;AAEtD,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,4BAA4B,CAAC,AAAsB,AAAC;AAWnF,MAAMC,iBAAiB,GAAG,cAAc,AAAC;AAEzC,MAAMC,uBAAuB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,AAAC;AAElD,MAAMC,WAAW,GAAGC,CAAAA,GAAAA,QAA0B,AAEnD,CAAA,2BAFmD,CAAcH,iBAAiB,EAAE;IACpFI,OAAO,EAAE,EAAE;CACZ,CAAC,AAAC;QAFUF,WAAW,GAAXA,WAAW;AAIxB,IAAIG,WAAW,GAAuB,IAAI,AAAC;AAEpC,eAAeX,mBAAmB,CAACY,WAAmB,EAAwB;IACnF,IAAID,WAAW,EAAE;QACf,OAAOA,WAAW,CAAC;KACpB;IACD,OAAOV,oBAAoB,CAACW,WAAW,CAAC,CAAC;CAC1C;AAEM,eAAeX,oBAAoB,CAACW,WAAmB,EAAwB;IACpF,IAAI;QACFD,WAAW,GAAG,MAAMH,WAAW,CAACK,SAAS,CAACD,WAAW,CAAC,CAAC;QAEvD,+EAA+E;QAC/E,MAAME,eAAe,GAAGC,gBAAgB,CAACJ,WAAW,CAACD,OAAO,CAAC,AAAC;QAC9D,IAAII,eAAe,CAACE,MAAM,GAAGL,WAAW,CAACD,OAAO,CAACM,MAAM,EAAE;YACvDL,WAAW,GAAG;gBACZ,GAAGA,WAAW;gBACdD,OAA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