@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
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  exports.directoryExistsAsync = directoryExistsAsync;
6
6
  exports.fileExistsAsync = fileExistsAsync;
7
- exports.removeAsync = exports.copyAsync = exports.copySync = exports.ensureDirectoryAsync = void 0;
7
+ exports.removeAsync = exports.copyAsync = exports.copySync = exports.ensureDirectory = exports.ensureDirectoryAsync = void 0;
8
8
  var _fsExtra = _interopRequireDefault(require("fs-extra"));
9
9
  function _interopRequireDefault(obj) {
10
10
  return obj && obj.__esModule ? obj : {
@@ -28,6 +28,11 @@ const ensureDirectoryAsync = (path)=>_fsExtra.default.promises.mkdir(path, {
28
28
  })
29
29
  ;
30
30
  exports.ensureDirectoryAsync = ensureDirectoryAsync;
31
+ const ensureDirectory = (path)=>_fsExtra.default.mkdirSync(path, {
32
+ recursive: true
33
+ })
34
+ ;
35
+ exports.ensureDirectory = ensureDirectory;
31
36
  const copySync = _fsExtra.default.copySync;
32
37
  exports.copySync = copySync;
33
38
  const copyAsync = _fsExtra.default.copy;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/dir.ts"],"sourcesContent":["import fs from 'fs-extra';\n\nexport async function directoryExistsAsync(file: string): Promise<boolean> {\n return (await fs.promises.stat(file).catch(() => null))?.isDirectory() ?? false;\n}\n\nexport async function fileExistsAsync(file: string): Promise<boolean> {\n return (await fs.promises.stat(file).catch(() => null))?.isFile() ?? false;\n}\n\nexport const ensureDirectoryAsync = (path: string) => fs.promises.mkdir(path, { recursive: true });\n\nexport const copySync = fs.copySync;\n\nexport const copyAsync = fs.copy;\n\nexport const removeAsync = fs.remove;\n"],"names":["directoryExistsAsync","fileExistsAsync","file","fs","promises","stat","catch","isDirectory","isFile","ensureDirectoryAsync","path","mkdir","recursive","copySync","copyAsync","copy","removeAsync","remove"],"mappings":"AAAA;;;;QAEsBA,oBAAoB,GAApBA,oBAAoB;QAIpBC,eAAe,GAAfA,eAAe;;AANtB,IAAA,QAAU,kCAAV,UAAU,EAAA;;;;;;AAElB,eAAeD,oBAAoB,CAACE,IAAY,EAAoB;QAClE,GAAgD;QAAhD,IAA+D;IAAtE,OAAO,CAAA,IAA+D,GAA/D,CAAA,GAAgD,GAA/C,MAAMC,QAAE,QAAA,CAACC,QAAQ,CAACC,IAAI,CAACH,IAAI,CAAC,CAACI,KAAK,CAAC,IAAM,IAAI;IAAA,CAAC,SAAc,GAA7D,KAAA,CAA6D,GAA7D,GAAgD,CAAEC,WAAW,EAAE,YAA/D,IAA+D,GAAI,KAAK,CAAC;CACjF;AAEM,eAAeN,eAAe,CAACC,IAAY,EAAoB;QAC7D,GAAgD;QAAhD,IAA0D;IAAjE,OAAO,CAAA,IAA0D,GAA1D,CAAA,GAAgD,GAA/C,MAAMC,QAAE,QAAA,CAACC,QAAQ,CAACC,IAAI,CAACH,IAAI,CAAC,CAACI,KAAK,CAAC,IAAM,IAAI;IAAA,CAAC,SAAS,GAAxD,KAAA,CAAwD,GAAxD,GAAgD,CAAEE,MAAM,EAAE,YAA1D,IAA0D,GAAI,KAAK,CAAC;CAC5E;AAEM,MAAMC,oBAAoB,GAAG,CAACC,IAAY,GAAKP,QAAE,QAAA,CAACC,QAAQ,CAACO,KAAK,CAACD,IAAI,EAAE;QAAEE,SAAS,EAAE,IAAI;KAAE,CAAC;AAAC;QAAtFH,oBAAoB,GAApBA,oBAAoB;AAE1B,MAAMI,QAAQ,GAAGV,QAAE,QAAA,CAACU,QAAQ,AAAC;QAAvBA,QAAQ,GAARA,QAAQ;AAEd,MAAMC,SAAS,GAAGX,QAAE,QAAA,CAACY,IAAI,AAAC;QAApBD,SAAS,GAATA,SAAS;AAEf,MAAME,WAAW,GAAGb,QAAE,QAAA,CAACc,MAAM,AAAC;QAAxBD,WAAW,GAAXA,WAAW"}
1
+ {"version":3,"sources":["../../../src/utils/dir.ts"],"sourcesContent":["import fs from 'fs-extra';\n\nexport async function directoryExistsAsync(file: string): Promise<boolean> {\n return (await fs.promises.stat(file).catch(() => null))?.isDirectory() ?? false;\n}\n\nexport async function fileExistsAsync(file: string): Promise<boolean> {\n return (await fs.promises.stat(file).catch(() => null))?.isFile() ?? false;\n}\n\nexport const ensureDirectoryAsync = (path: string) => fs.promises.mkdir(path, { recursive: true });\n\nexport const ensureDirectory = (path: string) => fs.mkdirSync(path, { recursive: true });\n\nexport const copySync = fs.copySync;\n\nexport const copyAsync = fs.copy;\n\nexport const removeAsync = fs.remove;\n"],"names":["directoryExistsAsync","fileExistsAsync","file","fs","promises","stat","catch","isDirectory","isFile","ensureDirectoryAsync","path","mkdir","recursive","ensureDirectory","mkdirSync","copySync","copyAsync","copy","removeAsync","remove"],"mappings":"AAAA;;;;QAEsBA,oBAAoB,GAApBA,oBAAoB;QAIpBC,eAAe,GAAfA,eAAe;;AANtB,IAAA,QAAU,kCAAV,UAAU,EAAA;;;;;;AAElB,eAAeD,oBAAoB,CAACE,IAAY,EAAoB;QAClE,GAAgD;QAAhD,IAA+D;IAAtE,OAAO,CAAA,IAA+D,GAA/D,CAAA,GAAgD,GAA/C,MAAMC,QAAE,QAAA,CAACC,QAAQ,CAACC,IAAI,CAACH,IAAI,CAAC,CAACI,KAAK,CAAC,IAAM,IAAI;IAAA,CAAC,SAAc,GAA7D,KAAA,CAA6D,GAA7D,GAAgD,CAAEC,WAAW,EAAE,YAA/D,IAA+D,GAAI,KAAK,CAAC;CACjF;AAEM,eAAeN,eAAe,CAACC,IAAY,EAAoB;QAC7D,GAAgD;QAAhD,IAA0D;IAAjE,OAAO,CAAA,IAA0D,GAA1D,CAAA,GAAgD,GAA/C,MAAMC,QAAE,QAAA,CAACC,QAAQ,CAACC,IAAI,CAACH,IAAI,CAAC,CAACI,KAAK,CAAC,IAAM,IAAI;IAAA,CAAC,SAAS,GAAxD,KAAA,CAAwD,GAAxD,GAAgD,CAAEE,MAAM,EAAE,YAA1D,IAA0D,GAAI,KAAK,CAAC;CAC5E;AAEM,MAAMC,oBAAoB,GAAG,CAACC,IAAY,GAAKP,QAAE,QAAA,CAACC,QAAQ,CAACO,KAAK,CAACD,IAAI,EAAE;QAAEE,SAAS,EAAE,IAAI;KAAE,CAAC;AAAC;QAAtFH,oBAAoB,GAApBA,oBAAoB;AAE1B,MAAMI,eAAe,GAAG,CAACH,IAAY,GAAKP,QAAE,QAAA,CAACW,SAAS,CAACJ,IAAI,EAAE;QAAEE,SAAS,EAAE,IAAI;KAAE,CAAC;AAAC;QAA5EC,eAAe,GAAfA,eAAe;AAErB,MAAME,QAAQ,GAAGZ,QAAE,QAAA,CAACY,QAAQ,AAAC;QAAvBA,QAAQ,GAARA,QAAQ;AAEd,MAAMC,SAAS,GAAGb,QAAE,QAAA,CAACc,IAAI,AAAC;QAApBD,SAAS,GAATA,SAAS;AAEf,MAAME,WAAW,GAAGf,QAAE,QAAA,CAACgB,MAAM,AAAC;QAAxBD,WAAW,GAAXA,WAAW"}
@@ -11,7 +11,6 @@ var _tempy = _interopRequireDefault(require("tempy"));
11
11
  var _util = require("util");
12
12
  var _client = require("../api/rest/client");
13
13
  var _wrapFetchWithProgress = require("../api/rest/wrapFetchWithProgress");
14
- var _log = require("../log");
15
14
  var _dir = require("./dir");
16
15
  var _errors = require("./errors");
17
16
  var _tar = require("./tar");
@@ -20,6 +19,7 @@ function _interopRequireDefault(obj) {
20
19
  default: obj
21
20
  };
22
21
  }
22
+ const debug = require("debug")("expo:utils:downloadAppAsync");
23
23
  const TIMER_DURATION = 30000;
24
24
  const pipeline = (0, _util).promisify(_stream.Stream.pipeline);
25
25
  async function downloadAsync({ url , outputPath , cacheDirectory , onProgress }) {
@@ -33,6 +33,7 @@ async function downloadAsync({ url , outputPath , cacheDirectory , onProgress }
33
33
  cacheDirectory
34
34
  });
35
35
  }
36
+ debug(`Downloading ${url} to ${outputPath}`);
36
37
  const res = await (0, _wrapFetchWithProgress).wrapFetchWithProgress(fetchInstance)(url, {
37
38
  timeout: TIMER_DURATION,
38
39
  onProgress
@@ -57,7 +58,7 @@ async function downloadAppAsync({ url , outputPath , extract =false , cacheDirec
57
58
  cacheDirectory,
58
59
  onProgress
59
60
  });
60
- _log.Log.debug(`Extracting ${tmpPath} to ${outputPath}`);
61
+ debug(`Extracting ${tmpPath} to ${outputPath}`);
61
62
  await (0, _dir).ensureDirectoryAsync(outputPath);
62
63
  await (0, _tar).extractAsync(tmpPath, outputPath);
63
64
  } else {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/downloadAppAsync.ts"],"sourcesContent":["import fs from 'fs';\nimport fetch from 'node-fetch';\nimport path from 'path';\nimport { Stream } from 'stream';\nimport temporary from 'tempy';\nimport { promisify } from 'util';\n\nimport { createCachedFetch } from '../api/rest/client';\nimport { FetchLike, ProgressCallback } from '../api/rest/client.types';\nimport { wrapFetchWithProgress } from '../api/rest/wrapFetchWithProgress';\nimport { Log } from '../log';\nimport { ensureDirectoryAsync } from './dir';\nimport { CommandError } from './errors';\nimport { extractAsync } from './tar';\n\nconst TIMER_DURATION = 30000;\n\nconst pipeline = promisify(Stream.pipeline);\n\nasync function downloadAsync({\n url,\n outputPath,\n cacheDirectory,\n onProgress,\n}: {\n url: string;\n outputPath: string;\n cacheDirectory?: string;\n onProgress?: ProgressCallback;\n}) {\n let fetchInstance: FetchLike = fetch;\n if (cacheDirectory) {\n // Reconstruct the cached fetch since caching could be disabled.\n fetchInstance = createCachedFetch({\n // We'll use a 1 week cache for versions so older values get flushed out eventually.\n ttl: 1000 * 60 * 60 * 24 * 7,\n // Users can also nuke their `~/.expo` directory to clear the cache.\n cacheDirectory,\n });\n }\n\n const res = await wrapFetchWithProgress(fetchInstance)(url, {\n timeout: TIMER_DURATION,\n onProgress,\n });\n if (!res.ok) {\n throw new CommandError(\n 'FILE_DOWNLOAD',\n `Unexpected response: ${res.statusText}. From url: ${url}`\n );\n }\n return pipeline(res.body, fs.createWriteStream(outputPath));\n}\n\nexport async function downloadAppAsync({\n url,\n outputPath,\n extract = false,\n cacheDirectory,\n onProgress,\n}: {\n url: string;\n outputPath: string;\n extract?: boolean;\n cacheDirectory?: string;\n onProgress?: ProgressCallback;\n}): Promise<void> {\n if (extract) {\n // For iOS we download the ipa to a file then pass that file into the extractor.\n // In the future we should just pipe the `res.body -> tar.extract` directly.\n // I tried this and it created some weird errors where observing the data stream\n // would corrupt the file causing tar to fail with `TAR_BAD_ARCHIVE`.\n const tmpPath = temporary.file({ name: path.basename(outputPath) });\n await downloadAsync({ url, outputPath: tmpPath, cacheDirectory, onProgress });\n Log.debug(`Extracting ${tmpPath} to ${outputPath}`);\n await ensureDirectoryAsync(outputPath);\n await extractAsync(tmpPath, outputPath);\n } else {\n await ensureDirectoryAsync(path.dirname(outputPath));\n await downloadAsync({ url, outputPath, cacheDirectory, onProgress });\n }\n}\n"],"names":["downloadAppAsync","TIMER_DURATION","pipeline","promisify","Stream","downloadAsync","url","outputPath","cacheDirectory","onProgress","fetchInstance","fetch","createCachedFetch","ttl","res","wrapFetchWithProgress","timeout","ok","CommandError","statusText","body","fs","createWriteStream","extract","tmpPath","temporary","file","name","path","basename","Log","debug","ensureDirectoryAsync","extractAsync","dirname"],"mappings":"AAAA;;;;QAsDsBA,gBAAgB,GAAhBA,gBAAgB;AAtDvB,IAAA,GAAI,kCAAJ,IAAI,EAAA;AACD,IAAA,UAAY,kCAAZ,YAAY,EAAA;AACb,IAAA,KAAM,kCAAN,MAAM,EAAA;AACA,IAAA,OAAQ,WAAR,QAAQ,CAAA;AACT,IAAA,MAAO,kCAAP,OAAO,EAAA;AACH,IAAA,KAAM,WAAN,MAAM,CAAA;AAEE,IAAA,OAAoB,WAApB,oBAAoB,CAAA;AAEhB,IAAA,sBAAmC,WAAnC,mCAAmC,CAAA;AACrD,IAAA,IAAQ,WAAR,QAAQ,CAAA;AACS,IAAA,IAAO,WAAP,OAAO,CAAA;AACf,IAAA,OAAU,WAAV,UAAU,CAAA;AACV,IAAA,IAAO,WAAP,OAAO,CAAA;;;;;;AAEpC,MAAMC,cAAc,GAAG,KAAK,AAAC;AAE7B,MAAMC,QAAQ,GAAGC,CAAAA,GAAAA,KAAS,AAAiB,CAAA,UAAjB,CAACC,OAAM,OAAA,CAACF,QAAQ,CAAC,AAAC;AAE5C,eAAeG,aAAa,CAAC,EAC3BC,GAAG,CAAA,EACHC,UAAU,CAAA,EACVC,cAAc,CAAA,EACdC,UAAU,CAAA,EAMX,EAAE;IACD,IAAIC,aAAa,GAAcC,UAAK,QAAA,AAAC;IACrC,IAAIH,cAAc,EAAE;QAClB,gEAAgE;QAChEE,aAAa,GAAGE,CAAAA,GAAAA,OAAi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;QACpD,MAAMyB,CAAAA,GAAAA,IAAoB,AAAY,CAAA,qBAAZ,CAACzB,UAAU,CAAC,CAAC;QACvC,MAAM0B,CAAAA,GAAAA,IAAY,AAAqB,CAAA,aAArB,CAACT,OAAO,EAAEjB,UAAU,CAAC,CAAC;KACzC,MAAM;QACL,MAAMyB,CAAAA,GAAAA,IAAoB,AAA0B,CAAA,qBAA1B,CAACJ,KAAI,QAAA,CAACM,OAAO,CAAC3B,UAAU,CAAC,CAAC,CAAC;QACrD,MAAMF,aAAa,CAAC;YAAEC,GAAG;YAAEC,UAAU;YAAEC,cAAc;YAAEC,UAAU;SAAE,CAAC,CAAC;KACtE;CACF"}
1
+ {"version":3,"sources":["../../../src/utils/downloadAppAsync.ts"],"sourcesContent":["import fs from 'fs';\nimport fetch from 'node-fetch';\nimport path from 'path';\nimport { Stream } from 'stream';\nimport temporary from 'tempy';\nimport { promisify } from 'util';\n\nimport { createCachedFetch } from '../api/rest/client';\nimport { FetchLike, ProgressCallback } from '../api/rest/client.types';\nimport { wrapFetchWithProgress } from '../api/rest/wrapFetchWithProgress';\nimport { ensureDirectoryAsync } from './dir';\nimport { CommandError } from './errors';\nimport { extractAsync } from './tar';\n\nconst debug = require('debug')('expo:utils:downloadAppAsync') as typeof console.log;\n\nconst TIMER_DURATION = 30000;\n\nconst pipeline = promisify(Stream.pipeline);\n\nasync function downloadAsync({\n url,\n outputPath,\n cacheDirectory,\n onProgress,\n}: {\n url: string;\n outputPath: string;\n cacheDirectory?: string;\n onProgress?: ProgressCallback;\n}) {\n let fetchInstance: FetchLike = fetch;\n if (cacheDirectory) {\n // Reconstruct the cached fetch since caching could be disabled.\n fetchInstance = createCachedFetch({\n // We'll use a 1 week cache for versions so older values get flushed out eventually.\n ttl: 1000 * 60 * 60 * 24 * 7,\n // Users can also nuke their `~/.expo` directory to clear the cache.\n cacheDirectory,\n });\n }\n\n debug(`Downloading ${url} to ${outputPath}`);\n const res = await wrapFetchWithProgress(fetchInstance)(url, {\n timeout: TIMER_DURATION,\n onProgress,\n });\n if (!res.ok) {\n throw new CommandError(\n 'FILE_DOWNLOAD',\n `Unexpected response: ${res.statusText}. From url: ${url}`\n );\n }\n return pipeline(res.body, fs.createWriteStream(outputPath));\n}\n\nexport async function downloadAppAsync({\n url,\n outputPath,\n extract = false,\n cacheDirectory,\n onProgress,\n}: {\n url: string;\n outputPath: string;\n extract?: boolean;\n cacheDirectory?: string;\n onProgress?: ProgressCallback;\n}): Promise<void> {\n if (extract) {\n // For iOS we download the ipa to a file then pass that file into the extractor.\n // In the future we should just pipe the `res.body -> tar.extract` directly.\n // I tried this and it created some weird errors where observing the data stream\n // would corrupt the file causing tar to fail with `TAR_BAD_ARCHIVE`.\n const tmpPath = temporary.file({ name: path.basename(outputPath) });\n await downloadAsync({ url, outputPath: tmpPath, cacheDirectory, onProgress });\n debug(`Extracting ${tmpPath} to ${outputPath}`);\n await ensureDirectoryAsync(outputPath);\n await extractAsync(tmpPath, outputPath);\n } else {\n await ensureDirectoryAsync(path.dirname(outputPath));\n await downloadAsync({ url, outputPath, cacheDirectory, onProgress });\n }\n}\n"],"names":["downloadAppAsync","debug","require","TIMER_DURATION","pipeline","promisify","Stream","downloadAsync","url","outputPath","cacheDirectory","onProgress","fetchInstance","fetch","createCachedFetch","ttl","res","wrapFetchWithProgress","timeout","ok","CommandError","statusText","body","fs","createWriteStream","extract","tmpPath","temporary","file","name","path","basename","ensureDirectoryAsync","extractAsync","dirname"],"mappings":"AAAA;;;;QAwDsBA,gBAAgB,GAAhBA,gBAAgB;AAxDvB,IAAA,GAAI,kCAAJ,IAAI,EAAA;AACD,IAAA,UAAY,kCAAZ,YAAY,EAAA;AACb,IAAA,KAAM,kCAAN,MAAM,EAAA;AACA,IAAA,OAAQ,WAAR,QAAQ,CAAA;AACT,IAAA,MAAO,kCAAP,OAAO,EAAA;AACH,IAAA,KAAM,WAAN,MAAM,CAAA;AAEE,IAAA,OAAoB,WAApB,oBAAoB,CAAA;AAEhB,IAAA,s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;IACD,OAAOJ,QAAQ,CAACY,GAAG,CAACM,IAAI,EAAEC,GAAE,QAAA,CAACC,iBAAiB,CAACf,UAAU,CAAC,CAAC,CAAC;CAC7D;AAEM,eAAeT,gBAAgB,CAAC,EACrCQ,GAAG,CAAA,EACHC,UAAU,CAAA,EACVgB,OAAO,EAAG,KAAK,CAAA,EACff,cAAc,CAAA,EACdC,UAAU,CAAA,EAOX,EAAiB;IAChB,IAAIc,OAAO,EAAE;QACX,gFAAgF;QAChF,4EAA4E;QAC5E,gFAAgF;QAChF,qEAAqE;QACrE,MAAMC,OAAO,GAAGC,MAAS,QAAA,CAACC,IAAI,CAAC;YAAEC,IAAI,EAAEC,KAAI,QAAA,CAACC,QAAQ,CAACtB,UAAU,CAAC;SAAE,CAAC,AAAC;QACpE,MAAMF,aAAa,CAAC;YAAEC,GAAG;YAAEC,UAAU,EAAEiB,OAAO;YAAEhB,cAAc;YAAEC,UAAU;SAAE,CAAC,CAAC;QAC9EV,KAAK,CAAC,CAAC,WAAW,EAAEyB,OAAO,CAAC,IAAI,EAAEjB,UAAU,CAAC,CAAC,CAAC,CAAC;QAChD,MAAMuB,CAAAA,GAAAA,IAAoB,AAAY,CAAA,qBAAZ,CAACvB,UAAU,CAAC,CAAC;QACvC,MAAMwB,CAAAA,GAAAA,IAAY,AAAqB,CAAA,aAArB,CAACP,OAAO,EAAEjB,UAAU,CAAC,CAAC;KACzC,MAAM;QACL,MAAMuB,CAAAA,GAAAA,IAAoB,AAA0B,CAAA,qBAA1B,CAACF,KAAI,QAAA,CAACI,OAAO,CAACzB,UAAU,CAAC,CAAC,CAAC;QACrD,MAAMF,aAAa,CAAC;YAAEC,GAAG;YAAEC,UAAU;YAAEC,cAAc;YAAEC,UAAU;SAAE,CAAC,CAAC;KACtE;CACF"}
@@ -5,39 +5,17 @@ Object.defineProperty(exports, "__esModule", {
5
5
  exports.downloadExpoGoAsync = downloadExpoGoAsync;
6
6
  var _getUserState = require("@expo/config/build/getUserState");
7
7
  var _path = _interopRequireDefault(require("path"));
8
- var _progress = _interopRequireDefault(require("progress"));
9
8
  var _getVersions = require("../api/getVersions");
10
- var Log = _interopRequireWildcard(require("../log"));
11
9
  var _downloadAppAsync = require("./downloadAppAsync");
12
10
  var _errors = require("./errors");
13
11
  var _profile = require("./profile");
14
- var _progress1 = require("./progress");
12
+ var _progress = require("./progress");
15
13
  function _interopRequireDefault(obj) {
16
14
  return obj && obj.__esModule ? obj : {
17
15
  default: obj
18
16
  };
19
17
  }
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
- }
18
+ const debug = require("debug")("expo:utils:downloadExpoGo");
41
19
  const platformSettings = {
42
20
  ios: {
43
21
  versionsKey: "iosClientUrl",
@@ -54,29 +32,27 @@ const platformSettings = {
54
32
  };
55
33
  async function downloadExpoGoAsync(platform, { url , sdkVersion }) {
56
34
  const { getFilePath , versionsKey , shouldExtractResults } = platformSettings[platform];
57
- const bar = new _progress.default("Downloading the Expo Go app [:bar] :percent :etas", {
35
+ const bar = (0, _progress).createProgressBar("Downloading the Expo Go app [:bar] :percent :etas", {
58
36
  width: 64,
59
37
  total: 100,
60
38
  clear: true,
61
39
  complete: "=",
62
40
  incomplete: " "
63
41
  });
64
- // TODO: Auto track progress
65
- (0, _progress1).setProgressBar(bar);
66
42
  if (!url) {
67
43
  if (!sdkVersion) {
68
44
  throw new _errors.CommandError(`Unable to determine which Expo Go version to install (platform: ${platform})`);
69
45
  }
70
46
  const versions = await (0, _getVersions).getReleasedVersionsAsync();
71
47
  const version = versions[sdkVersion];
72
- Log.debug(`Installing Expo Go version for SDK ${sdkVersion} at URL: ${version[versionsKey]}`);
48
+ debug(`Installing Expo Go version for SDK ${sdkVersion} at URL: ${version[versionsKey]}`);
73
49
  url = version[versionsKey];
74
50
  }
75
51
  const filename = _path.default.parse(url).name;
76
52
  try {
77
53
  const outputPath = getFilePath(filename);
78
- Log.debug(`Downloading Expo Go from "${url}" to "${outputPath}".`);
79
- Log.debug(`The requested copy of Expo Go might already be cached in: "${(0, _getUserState).getExpoHomeDirectory()}". You can disable the cache with EXPO_NO_CACHE=1`);
54
+ debug(`Downloading Expo Go from "${url}" to "${outputPath}".`);
55
+ debug(`The requested copy of Expo Go might already be cached in: "${(0, _getUserState).getExpoHomeDirectory()}". You can disable the cache with EXPO_NO_CACHE=1`);
80
56
  await (0, _profile).profile(_downloadAppAsync.downloadAppAsync)({
81
57
  url,
82
58
  // Save all encrypted cache data to `~/.expo/expo-go`
@@ -91,8 +67,7 @@ async function downloadExpoGoAsync(platform, { url , sdkVersion }) {
91
67
  });
92
68
  return outputPath;
93
69
  } finally{
94
- bar.terminate();
95
- (0, _progress1).setProgressBar(null);
70
+ bar == null ? void 0 : bar.terminate();
96
71
  }
97
72
  }
98
73
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/downloadExpoGoAsync.ts"],"sourcesContent":["import { getExpoHomeDirectory } from '@expo/config/build/getUserState';\nimport path from 'path';\nimport ProgressBar from 'progress';\n\nimport { getReleasedVersionsAsync, SDKVersion } from '../api/getVersions';\nimport * as Log from '../log';\nimport { downloadAppAsync } from './downloadAppAsync';\nimport { CommandError } from './errors';\nimport { profile } from './profile';\nimport { setProgressBar } from './progress';\n\nconst platformSettings: Record<\n string,\n {\n shouldExtractResults: boolean;\n versionsKey: keyof SDKVersion;\n getFilePath: (filename: string) => string;\n }\n> = {\n ios: {\n versionsKey: 'iosClientUrl',\n getFilePath: (filename) =>\n path.join(getExpoHomeDirectory(), 'ios-simulator-app-cache', `${filename}.app`),\n shouldExtractResults: true,\n },\n android: {\n versionsKey: 'androidClientUrl',\n getFilePath: (filename) =>\n path.join(getExpoHomeDirectory(), 'android-apk-cache', `${filename}.apk`),\n shouldExtractResults: false,\n },\n};\n\n/** Download the Expo Go app from the Expo servers (if only it was this easy for every app). */\nexport async function downloadExpoGoAsync(\n platform: keyof typeof platformSettings,\n {\n url,\n sdkVersion,\n }: {\n url?: string;\n sdkVersion?: string;\n }\n): Promise<string> {\n const { getFilePath, versionsKey, shouldExtractResults } = platformSettings[platform];\n\n const bar = new ProgressBar('Downloading the Expo Go app [:bar] :percent :etas', {\n width: 64,\n total: 100,\n clear: true,\n complete: '=',\n incomplete: ' ',\n });\n // TODO: Auto track progress\n setProgressBar(bar);\n\n if (!url) {\n if (!sdkVersion) {\n throw new CommandError(\n `Unable to determine which Expo Go version to install (platform: ${platform})`\n );\n }\n const versions = await getReleasedVersionsAsync();\n const version = versions[sdkVersion];\n Log.debug(`Installing Expo Go version for SDK ${sdkVersion} at URL: ${version[versionsKey]}`);\n url = version[versionsKey] as string;\n }\n\n const filename = path.parse(url).name;\n\n try {\n const outputPath = getFilePath(filename);\n Log.debug(`Downloading Expo Go from \"${url}\" to \"${outputPath}\".`);\n Log.debug(\n `The requested copy of Expo Go might already be cached in: \"${getExpoHomeDirectory()}\". You can disable the cache with EXPO_NO_CACHE=1`\n );\n await profile(downloadAppAsync)({\n url,\n // Save all encrypted cache data to `~/.expo/expo-go`\n cacheDirectory: 'expo-go',\n outputPath,\n extract: shouldExtractResults,\n onProgress({ progress }) {\n if (bar) {\n bar.tick(1, progress);\n }\n },\n });\n return outputPath;\n } finally {\n bar.terminate();\n setProgressBar(null);\n }\n}\n"],"names":["downloadExpoGoAsync","Log","platformSettings","ios","versionsKey","getFilePath","filename","path","join","getExpoHomeDirectory","shouldExtractResults","android","platform","url","sdkVersion","bar","ProgressBar","width","total","clear","complete","incomplete","setProgressBar","CommandError","versions","getReleasedVersionsAsync","version","debug","parse","name","outputPath","profile","downloadAppAsync","cacheDirectory","extract","onProgress","progress","tick","terminate"],"mappings":"AAAA;;;;QAkCsBA,mBAAmB,GAAnBA,mBAAmB;AAlCJ,IAAA,aAAiC,WAAjC,iCAAiC,CAAA;AACrD,IAAA,KAAM,kCAAN,MAAM,EAAA;AACC,IAAA,SAAU,kCAAV,UAAU,EAAA;AAEmB,IAAA,YAAoB,WAApB,oBAAoB,CAAA;AAC7DC,IAAAA,GAAG,mCAAM,QAAQ,EAAd;AACkB,IAAA,iBAAoB,WAApB,oBAAoB,CAAA;AACxB,IAAA,OAAU,WAAV,UAAU,CAAA;AACf,IAAA,QAAW,WAAX,WAAW,CAAA;AACJ,IAAA,UAAY,WAAZ,YAAY,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3C,MAAMC,gBAAgB,GAOlB;IACFC,GAAG,EAAE;QACHC,WAAW,EAAE,cAAc;QAC3BC,WAAW,EAAE,CAACC,QAAQ,GACpBC,KAAI,QAAA,CAACC,IAAI,CAACC,CAAAA,GAAAA,aAAoB,AAAE,CAAA,qBAAF,EAAE,EAAE,yBAAyB,EAAE,CAAC,EAAEH,QAAQ,CAAC,IAAI,CAAC,CAAC;QAAA;QACjFI,oBAAoB,EAAE,IAAI;KAC3B;IACDC,OAAO,EAAE;QACPP,WAAW,EAAE,kBAAkB;QAC/BC,WAAW,EAAE,CAACC,QAAQ,GACpBC,KAAI,QAAA,CAACC,IAAI,CAACC,CAAAA,GAAAA,aAAoB,AAAE,CAAA,qBAAF,EAAE,EAAE,mBAAmB,EAAE,CAAC,EAAEH,QAAQ,CAAC,IAAI,CAAC,CAAC;QAAA;QAC3EI,oBAAoB,EAAE,KAAK;KAC5B;CACF,AAAC;AAGK,eAAeV,mBAAmB,CACvCY,QAAuC,EACvC,EACEC,GAAG,CAAA,EACHC,UAAU,CAAA,EAIX,EACgB;IACjB,MAAM,EAAET,WAAW,CAAA,EAAED,WAAW,CAAA,EAAEM,oBAAoB,CAAA,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CAAC,CACxI,CAAC;QACF,MAAMsB,CAAAA,GAAAA,QAAO,AAAkB,CAAA,QAAlB,CAACC,iBAAgB,iBAAA,CAAC,CAAC;YAC9BnB,GAAG;YACH,qDAAqD;YACrDoB,cAAc,EAAE,SAAS;YACzBH,UAAU;YACVI,OAAO,EAAExB,oBAAoB;YAC7ByB,UAAU,EAAC,EAAEC,QAAQ,CAAA,EAAE,EAAE;gBACvB,IAAIrB,GAAG,EAAE;oBACPA,GAAG,CAACsB,IAAI,CAAC,CAAC,EAAED,QAAQ,CAAC,CAAC;iBACvB;aACF;SACF,CAAC,CAAC;QACH,OAAON,UAAU,CAAC;KACnB,QAAS;QACRf,GAAG,CAACuB,SAAS,EAAE,CAAC;QAChBhB,CAAAA,GAAAA,UAAc,AAAM,CAAA,eAAN,CAAC,IAAI,CAAC,CAAC;KACtB;CACF"}
1
+ {"version":3,"sources":["../../../src/utils/downloadExpoGoAsync.ts"],"sourcesContent":["import { getExpoHomeDirectory } from '@expo/config/build/getUserState';\nimport path from 'path';\n\nimport { getReleasedVersionsAsync, SDKVersion } from '../api/getVersions';\nimport { downloadAppAsync } from './downloadAppAsync';\nimport { CommandError } from './errors';\nimport { profile } from './profile';\nimport { createProgressBar } from './progress';\n\nconst debug = require('debug')('expo:utils:downloadExpoGo') as typeof console.log;\n\nconst platformSettings: Record<\n string,\n {\n shouldExtractResults: boolean;\n versionsKey: keyof SDKVersion;\n getFilePath: (filename: string) => string;\n }\n> = {\n ios: {\n versionsKey: 'iosClientUrl',\n getFilePath: (filename) =>\n path.join(getExpoHomeDirectory(), 'ios-simulator-app-cache', `${filename}.app`),\n shouldExtractResults: true,\n },\n android: {\n versionsKey: 'androidClientUrl',\n getFilePath: (filename) =>\n path.join(getExpoHomeDirectory(), 'android-apk-cache', `${filename}.apk`),\n shouldExtractResults: false,\n },\n};\n\n/** Download the Expo Go app from the Expo servers (if only it was this easy for every app). */\nexport async function downloadExpoGoAsync(\n platform: keyof typeof platformSettings,\n {\n url,\n sdkVersion,\n }: {\n url?: string;\n sdkVersion?: string;\n }\n): Promise<string> {\n const { getFilePath, versionsKey, shouldExtractResults } = platformSettings[platform];\n\n const bar = createProgressBar('Downloading the Expo Go app [:bar] :percent :etas', {\n width: 64,\n total: 100,\n clear: true,\n complete: '=',\n incomplete: ' ',\n });\n\n if (!url) {\n if (!sdkVersion) {\n throw new CommandError(\n `Unable to determine which Expo Go version to install (platform: ${platform})`\n );\n }\n const versions = await getReleasedVersionsAsync();\n const version = versions[sdkVersion];\n debug(`Installing Expo Go version for SDK ${sdkVersion} at URL: ${version[versionsKey]}`);\n url = version[versionsKey] as string;\n }\n\n const filename = path.parse(url).name;\n\n try {\n const outputPath = getFilePath(filename);\n debug(`Downloading Expo Go from \"${url}\" to \"${outputPath}\".`);\n debug(\n `The requested copy of Expo Go might already be cached in: \"${getExpoHomeDirectory()}\". You can disable the cache with EXPO_NO_CACHE=1`\n );\n await profile(downloadAppAsync)({\n url,\n // Save all encrypted cache data to `~/.expo/expo-go`\n cacheDirectory: 'expo-go',\n outputPath,\n extract: shouldExtractResults,\n onProgress({ progress }) {\n if (bar) {\n bar.tick(1, progress);\n }\n },\n });\n return outputPath;\n } finally {\n bar?.terminate();\n }\n}\n"],"names":["downloadExpoGoAsync","debug","require","platformSettings","ios","versionsKey","getFilePath","filename","path","join","getExpoHomeDirectory","shouldExtractResults","android","platform","url","sdkVersion","bar","createProgressBar","width","total","clear","complete","incomplete","CommandError","versions","getReleasedVersionsAsync","version","parse","name","outputPath","profile","downloadAppAsync","cacheDirectory","extract","onProgress","progress","tick","terminate"],"mappings":"AAAA;;;;QAkCsBA,mBAAmB,GAAnBA,mBAAmB;AAlCJ,IAAA,aAAiC,WAAjC,iCAAiC,CAAA;AACrD,IAAA,KAAM,kCAAN,MAAM,EAAA;AAE8B,IAAA,YAAoB,WAApB,oBAAoB,CAAA;AACxC,IAAA,iBAAoB,WAApB,oBAAoB,CAAA;AACxB,IAAA,OAAU,WAAV,UAAU,CAAA;A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A,CAAc,GAAdA,GAAG,CAAEqB,SAAS,EAAE,AAxFpB,CAwFqB;KAClB;CACF"}
@@ -33,6 +33,7 @@ function _interopRequireWildcard(obj) {
33
33
  return newObj;
34
34
  }
35
35
  }
36
+ const debug = require("debug")("expo:utils:editor");
36
37
  function guessEditor() {
37
38
  try {
38
39
  return _envEditor.default.defaultEditor();
@@ -42,7 +43,7 @@ function guessEditor() {
42
43
  }
43
44
  async function openInEditorAsync(path) {
44
45
  const editor = guessEditor();
45
- Log.debug(`Opening ${path} in ${editor == null ? void 0 : editor.name} (bin: ${editor == null ? void 0 : editor.binary}, id: ${editor == null ? void 0 : editor.id})`);
46
+ debug(`Opening ${path} in ${editor == null ? void 0 : editor.name} (bin: ${editor == null ? void 0 : editor.binary}, id: ${editor == null ? void 0 : editor.id})`);
46
47
  if (editor) {
47
48
  try {
48
49
  await (0, _spawnAsync).default(editor.binary, [
@@ -50,7 +51,7 @@ async function openInEditorAsync(path) {
50
51
  ]);
51
52
  return true;
52
53
  } catch (error) {
53
- Log.debug(`Failed to auto open path in editor (path: ${path}, binary: ${editor.binary}):`, error);
54
+ debug(`Failed to auto open path in editor (path: ${path}, binary: ${editor.binary}):`, error);
54
55
  }
55
56
  }
56
57
  Log.error('Could not open editor, you can set it by defining the $EDITOR environment variable with the binary of your editor. (e.g. "vscode" or "atom")');
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/editor.ts"],"sourcesContent":["import spawnAsync from '@expo/spawn-async';\nimport editors from 'env-editor';\n\nimport * as Log from '../log';\n\n/** Guess what the default editor is and default to VSCode. */\nexport function guessEditor(): editors.Editor {\n try {\n return editors.defaultEditor();\n } catch {\n return editors.getEditor('vscode');\n }\n}\n\n/** Open a file path in a given editor. */\nexport async function openInEditorAsync(path: string): Promise<boolean> {\n const editor = guessEditor();\n\n Log.debug(`Opening ${path} in ${editor?.name} (bin: ${editor?.binary}, id: ${editor?.id})`);\n if (editor) {\n try {\n await spawnAsync(editor.binary, [path]);\n return true;\n } catch (error: any) {\n Log.debug(\n `Failed to auto open path in editor (path: ${path}, binary: ${editor.binary}):`,\n error\n );\n }\n }\n\n Log.error(\n 'Could not open editor, you can set it by defining the $EDITOR environment variable with the binary of your editor. (e.g. \"vscode\" or \"atom\")'\n );\n return false;\n}\n"],"names":["guessEditor","openInEditorAsync","Log","editors","defaultEditor","getEditor","path","editor","debug","name","binary","id","spawnAsync","error"],"mappings":"AAAA;;;;QAMgBA,WAAW,GAAXA,WAAW;QASLC,iBAAiB,GAAjBA,iBAAiB;AAfhB,IAAA,WAAmB,kCAAnB,mBAAmB,EAAA;AACtB,IAAA,UAAY,kCAAZ,YAAY,EAAA;AAEpBC,IAAAA,GAAG,mCAAM,QAAQ,EAAd;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGR,SAASF,WAAW,GAAmB;IAC5C,IAAI;QACF,OAAOG,UAAO,QAAA,CAACC,aAAa,EAAE,CAAC;KAChC,CAAC,OAAM;QACN,OAAOD,UAAO,QAAA,CAACE,SAAS,CAAC,QAAQ,CAAC,CAAC;KACpC;CACF;AAGM,eAAeJ,iBAAiB,CAACK,IAAY,EAAoB;IACtE,MAAMC,MAAM,GAAGP,WAAW,EAAE,AAAC;IAE7BE,GAAG,CAACM,KAAK,CAAC,CAAC,QAAQ,EAAEF,IAAI,CAAC,IAAI,EAAEC,MAAM,QAAM,GAAZA,KAAAA,CAAY,GAAZA,MAAM,CAAEE,IAAI,CAAC,OAAO,EAAEF,MAAM,QAAQ,GAAdA,KAAAA,CAAc,GAAdA,MAAM,CAAEG,MAAM,CAAC,MAAM,EAAEH,MAAM,QAAI,GAAVA,KAAAA,CAAU,GAAVA,MAAM,CAAEI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5F,IAAIJ,MAAM,EAAE;QACV,IAAI;YACF,MAAMK,CAAAA,GAAAA,WAAU,AAAuB,CAAA,QAAvB,CAACL,MAAM,CAACG,MAAM,EAAE;gBAACJ,IAAI;aAAC,CAAC,CAAC;YACxC,OAAO,IAAI,CAAC;SACb,CAAC,OAAOO,KAAK,EAAO;YACnBX,GAAG,CAACM,KAAK,CACP,CAAC,0CAA0C,EAAEF,IAAI,CAAC,UAAU,EAAEC,MAAM,CAACG,MAAM,CAAC,EAAE,CAAC,EAC/EG,KAAK,CACN,CAAC;SACH;KACF;IAEDX,GAAG,CAACW,KAAK,CACP,8IAA8I,CAC/I,CAAC;IACF,OAAO,KAAK,CAAC;CACd"}
1
+ {"version":3,"sources":["../../../src/utils/editor.ts"],"sourcesContent":["import spawnAsync from '@expo/spawn-async';\nimport editors from 'env-editor';\n\nimport * as Log from '../log';\n\nconst debug = require('debug')('expo:utils:editor') as typeof console.log;\n\n/** Guess what the default editor is and default to VSCode. */\nexport function guessEditor(): editors.Editor {\n try {\n return editors.defaultEditor();\n } catch {\n return editors.getEditor('vscode');\n }\n}\n\n/** Open a file path in a given editor. */\nexport async function openInEditorAsync(path: string): Promise<boolean> {\n const editor = guessEditor();\n\n debug(`Opening ${path} in ${editor?.name} (bin: ${editor?.binary}, id: ${editor?.id})`);\n if (editor) {\n try {\n await spawnAsync(editor.binary, [path]);\n return true;\n } catch (error: any) {\n debug(`Failed to auto open path in editor (path: ${path}, binary: ${editor.binary}):`, error);\n }\n }\n\n Log.error(\n 'Could not open editor, you can set it by defining the $EDITOR environment variable with the binary of your editor. (e.g. \"vscode\" or \"atom\")'\n );\n return false;\n}\n"],"names":["guessEditor","openInEditorAsync","Log","debug","require","editors","defaultEditor","getEditor","path","editor","name","binary","id","spawnAsync","error"],"mappings":"AAAA;;;;QAQgBA,WAAW,GAAXA,WAAW;QASLC,iBAAiB,GAAjBA,iBAAiB;AAjBhB,IAAA,WAAmB,kCAAnB,mBAAmB,EAAA;AACtB,IAAA,UAAY,kCAAZ,YAAY,EAAA;AAEpBC,IAAAA,GAAG,mCAAM,QAAQ,EAAd;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEf,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,mBAAmB,CAAC,AAAsB,AAAC;AAGnE,SAASJ,WAAW,GAAmB;IAC5C,IAAI;QACF,OAAOK,UAAO,QAAA,CAACC,aAAa,EAAE,CAAC;KAChC,CAAC,OAAM;QACN,OAAOD,UAAO,QAAA,CAACE,SAAS,CAAC,QAAQ,CAAC,CAAC;KACpC;CACF;AAGM,eAAeN,iBAAiB,CAACO,IAAY,EAAoB;IACtE,MAAMC,MAAM,GAAGT,WAAW,EAAE,AAAC;IAE7BG,KAAK,CAAC,CAAC,QAAQ,EAAEK,IAAI,CAAC,IAAI,EAAEC,MAAM,QAAM,GAAZA,KAAAA,CAAY,GAAZA,MAAM,CAAEC,IAAI,CAAC,OAAO,EAAED,MAAM,QAAQ,GAAdA,KAAAA,CAAc,GAAdA,MAAM,CAAEE,MAAM,CAAC,MAAM,EAAEF,MAAM,QAAI,GAAVA,KAAAA,CAAU,GAAVA,MAAM,CAAEG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACxF,IAAIH,MAAM,EAAE;QACV,IAAI;YACF,MAAMI,CAAAA,GAAAA,WAAU,AAAuB,CAAA,QAAvB,CAACJ,MAAM,CAACE,MAAM,EAAE;gBAACH,IAAI;aAAC,CAAC,CAAC;YACxC,OAAO,IAAI,CAAC;SACb,CAAC,OAAOM,KAAK,EAAO;YACnBX,KAAK,CAAC,CAAC,0CAA0C,EAAEK,IAAI,CAAC,UAAU,EAAEC,MAAM,CAACE,MAAM,CAAC,EAAE,CAAC,EAAEG,KAAK,CAAC,CAAC;SAC/F;KACF;IAEDZ,GAAG,CAACY,KAAK,CACP,8IAA8I,CAC/I,CAAC;IACF,OAAO,KAAK,CAAC;CACd"}
@@ -55,6 +55,9 @@ class Env {
55
55
  /** Skip validating the manifest during `export`. */ get EXPO_SKIP_MANIFEST_VALIDATION_TOKEN() {
56
56
  return !!(0, _getenv).string("EXPO_SKIP_MANIFEST_VALIDATION_TOKEN");
57
57
  }
58
+ /** Public folder path relative to the project root. Default to `public` */ get EXPO_PUBLIC_FOLDER() {
59
+ return (0, _getenv).string("EXPO_PUBLIC_FOLDER", "public");
60
+ }
58
61
  }
59
62
  const env = new Env();
60
63
  exports.env = env;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/env.ts"],"sourcesContent":["import { boolish, int, string } from 'getenv';\n\n// @expo/webpack-config -> expo-pwa -> @expo/image-utils: EXPO_IMAGE_UTILS_NO_SHARP\n\n// TODO: EXPO_CLI_USERNAME, EXPO_CLI_PASSWORD\n\nclass Env {\n /** Enable profiling metrics */\n get EXPO_PROFILE() {\n return boolish('EXPO_PROFILE', false);\n }\n\n /** Enable debug logging */\n get EXPO_DEBUG() {\n return boolish('EXPO_DEBUG', false);\n }\n\n /** Enable the beta version of Expo (TODO: Should this just be in the beta version of expo releases?) */\n get EXPO_BETA() {\n return boolish('EXPO_BETA', false);\n }\n\n /** Enable staging API environment */\n get EXPO_STAGING() {\n return boolish('EXPO_STAGING', false);\n }\n\n /** Enable local API environment */\n get EXPO_LOCAL() {\n return boolish('EXPO_LOCAL', false);\n }\n\n /** Is running in non-interactive CI mode */\n get CI() {\n return boolish('CI', false);\n }\n\n /** Disable telemetry (analytics) */\n get EXPO_NO_TELEMETRY() {\n return boolish('EXPO_NO_TELEMETRY', false);\n }\n\n /** local directory to the universe repo for testing locally */\n get EXPO_UNIVERSE_DIR() {\n return string('EXPO_UNIVERSE_DIR', '');\n }\n\n /** @deprecated Default Webpack host string */\n get WEB_HOST() {\n return string('WEB_HOST', '0.0.0.0');\n }\n\n /** Skip warning users about a dirty git status */\n get EXPO_NO_GIT_STATUS() {\n return boolish('EXPO_NO_GIT_STATUS', false);\n }\n /** Disable auto web setup */\n get EXPO_NO_WEB_SETUP() {\n return boolish('EXPO_NO_WEB_SETUP', false);\n }\n /** Disable auto TypeScript setup */\n get EXPO_NO_TYPESCRIPT_SETUP() {\n return boolish('EXPO_NO_TYPESCRIPT_SETUP', false);\n }\n /** Disable all API caches. Does not disable bundler caches. */\n get EXPO_NO_CACHE() {\n return boolish('EXPO_NO_CACHE', false);\n }\n /** Enable the experimental interstitial app select page. */\n get EXPO_ENABLE_INTERSTITIAL_PAGE() {\n return boolish('EXPO_ENABLE_INTERSTITIAL_PAGE', false);\n }\n /** The React Metro port that's baked into react-native scripts and tools. */\n get RCT_METRO_PORT() {\n return int('RCT_METRO_PORT', 0);\n }\n /** Skip validating the manifest during `export`. */\n get EXPO_SKIP_MANIFEST_VALIDATION_TOKEN(): boolean {\n return !!string('EXPO_SKIP_MANIFEST_VALIDATION_TOKEN');\n }\n}\n\nexport const env = new Env();\n"],"names":["Env","EXPO_PROFILE","boolish","EXPO_DEBUG","EXPO_BETA","EXPO_STAGING","EXPO_LOCAL","CI","EXPO_NO_TELEMETRY","EXPO_UNIVERSE_DIR","string","WEB_HOST","EXPO_NO_GIT_STATUS","EXPO_NO_WEB_SETUP","EXPO_NO_TYPESCRIPT_SETUP","EXPO_NO_CACHE","EXPO_ENABLE_INTERSTITIAL_PAGE","RCT_METRO_PORT","int","EXPO_SKIP_MANIFEST_VALIDATION_TOKEN","env"],"mappings":"AAAA;;;;;AAAqC,IAAA,OAAQ,WAAR,QAAQ,CAAA;AAE7C,mFAAmF;AAEnF,6CAA6C;AAE7C,MAAMA,GAAG;IACP,+BAA+B,CAC/B,IAAIC,YAAY,GAAG;QACjB,OAAOC,CAAAA,GAAAA,OAAO,AAAuB,CAAA,QAAvB,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;KACvC;IAED,2BAA2B,CAC3B,IAAIC,UAAU,GAAG;QACf,OAAOD,CAAAA,GAAAA,OAAO,AAAqB,CAAA,QAArB,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;KACrC;IAED,wGAAwG,CACxG,IAAIE,SAAS,GAAG;QACd,OAAOF,CAAAA,GAAAA,OAAO,AAAoB,CAAA,QAApB,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;KACpC;IAED,qCAAqC,CACrC,IAAIG,YAAY,GAAG;QACjB,OAAOH,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ClB,OAAOb,CAAAA,GAAAA,OAAO,AAAwB,CAAA,QAAxB,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;KACxC;IACD,4DAA4D,CAC5D,IAAIc,6BAA6B,GAAG;QAClC,OAAOd,CAAAA,GAAAA,OAAO,AAAwC,CAAA,QAAxC,CAAC,+BAA+B,EAAE,KAAK,CAAC,CAAC;KACxD;IACD,6EAA6E,CAC7E,IAAIe,cAAc,GAAG;QACnB,OAAOC,CAAAA,GAAAA,OAAG,AAAqB,CAAA,IAArB,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC;KACjC;IACD,oDAAoD,CACpD,IAAIC,mCAAmC,GAAY;QACjD,OAAO,CAAC,CAACT,CAAAA,GAAAA,OAAM,AAAuC,CAAA,OAAvC,CAAC,qCAAqC,CAAC,CAAC;KACxD;CACF;AAEM,MAAMU,GAAG,GAAG,IAAIpB,GAAG,EAAE,AAAC;QAAhBoB,GAAG,GAAHA,GAAG"}
1
+ {"version":3,"sources":["../../../src/utils/env.ts"],"sourcesContent":["import { boolish, int, string } from 'getenv';\n\n// @expo/webpack-config -> expo-pwa -> @expo/image-utils: EXPO_IMAGE_UTILS_NO_SHARP\n\n// TODO: EXPO_CLI_USERNAME, EXPO_CLI_PASSWORD\n\nclass Env {\n /** Enable profiling metrics */\n get EXPO_PROFILE() {\n return boolish('EXPO_PROFILE', false);\n }\n\n /** Enable debug logging */\n get EXPO_DEBUG() {\n return boolish('EXPO_DEBUG', false);\n }\n\n /** Enable the beta version of Expo (TODO: Should this just be in the beta version of expo releases?) */\n get EXPO_BETA() {\n return boolish('EXPO_BETA', false);\n }\n\n /** Enable staging API environment */\n get EXPO_STAGING() {\n return boolish('EXPO_STAGING', false);\n }\n\n /** Enable local API environment */\n get EXPO_LOCAL() {\n return boolish('EXPO_LOCAL', false);\n }\n\n /** Is running in non-interactive CI mode */\n get CI() {\n return boolish('CI', false);\n }\n\n /** Disable telemetry (analytics) */\n get EXPO_NO_TELEMETRY() {\n return boolish('EXPO_NO_TELEMETRY', false);\n }\n\n /** local directory to the universe repo for testing locally */\n get EXPO_UNIVERSE_DIR() {\n return string('EXPO_UNIVERSE_DIR', '');\n }\n\n /** @deprecated Default Webpack host string */\n get WEB_HOST() {\n return string('WEB_HOST', '0.0.0.0');\n }\n\n /** Skip warning users about a dirty git status */\n get EXPO_NO_GIT_STATUS() {\n return boolish('EXPO_NO_GIT_STATUS', false);\n }\n /** Disable auto web setup */\n get EXPO_NO_WEB_SETUP() {\n return boolish('EXPO_NO_WEB_SETUP', false);\n }\n /** Disable auto TypeScript setup */\n get EXPO_NO_TYPESCRIPT_SETUP() {\n return boolish('EXPO_NO_TYPESCRIPT_SETUP', false);\n }\n /** Disable all API caches. Does not disable bundler caches. */\n get EXPO_NO_CACHE() {\n return boolish('EXPO_NO_CACHE', false);\n }\n /** Enable the experimental interstitial app select page. */\n get EXPO_ENABLE_INTERSTITIAL_PAGE() {\n return boolish('EXPO_ENABLE_INTERSTITIAL_PAGE', false);\n }\n /** The React Metro port that's baked into react-native scripts and tools. */\n get RCT_METRO_PORT() {\n return int('RCT_METRO_PORT', 0);\n }\n /** Skip validating the manifest during `export`. */\n get EXPO_SKIP_MANIFEST_VALIDATION_TOKEN(): boolean {\n return !!string('EXPO_SKIP_MANIFEST_VALIDATION_TOKEN');\n }\n\n /** Public folder path relative to the project root. Default to `public` */\n get EXPO_PUBLIC_FOLDER(): string {\n return string('EXPO_PUBLIC_FOLDER', 'public');\n }\n}\n\nexport const env = new Env();\n"],"names":["Env","EXPO_PROFILE","boolish","EXPO_DEBUG","EXPO_BETA","EXPO_STAGING","EXPO_LOCAL","CI","EXPO_NO_TELEMETRY","EXPO_UNIVERSE_DIR","string","WEB_HOST","EXPO_NO_GIT_STATUS","EXPO_NO_WEB_SETUP","EXPO_NO_TYPESCRIPT_SETUP","EXPO_NO_CACHE","EXPO_ENABLE_INTERSTITIAL_PAGE","RCT_METRO_PORT","int","EXPO_SKIP_MANIFEST_VALIDATION_TOKEN","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AC;KAC/C;CACF;AAEM,MAAMW,GAAG,GAAG,IAAIrB,GAAG,EAAE,AAAC;QAAhBqB,GAAG,GAAHA,GAAG"}
@@ -3,29 +3,8 @@ Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
5
  exports.installExitHooks = installExitHooks;
6
- var Log = _interopRequireWildcard(require("../log"));
7
6
  var _fn = require("./fn");
8
- function _interopRequireWildcard(obj) {
9
- if (obj && obj.__esModule) {
10
- return obj;
11
- } else {
12
- var newObj = {};
13
- if (obj != null) {
14
- for(var key in obj){
15
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
16
- var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
17
- if (desc.get || desc.set) {
18
- Object.defineProperty(newObj, key, desc);
19
- } else {
20
- newObj[key] = obj[key];
21
- }
22
- }
23
- }
24
- }
25
- newObj.default = obj;
26
- return newObj;
27
- }
28
- }
7
+ const debug = require("debug")("expo:utils:exit");
29
8
  const PRE_EXIT_SIGNALS = [
30
9
  "SIGHUP",
31
10
  "SIGINT",
@@ -57,16 +36,16 @@ function installExitHooks(asyncExitHook) {
57
36
  // Create a function that runs before the process exits and guards against running multiple times.
58
37
  function createExitHook(signal) {
59
38
  return (0, _fn).guardAsync(async ()=>{
60
- Log.debug(`pre-exit (signal: ${signal}, queue length: ${queue.length})`);
39
+ debug(`pre-exit (signal: ${signal}, queue length: ${queue.length})`);
61
40
  for (const [index, hookAsync] of Object.entries(queue)){
62
41
  try {
63
42
  await hookAsync(signal);
64
43
  } catch (error) {
65
- Log.debug(`Error in exit hook: %O (queue: ${index})`, error);
44
+ debug(`Error in exit hook: %O (queue: ${index})`, error);
66
45
  }
67
46
  }
68
47
  var _exitCode;
69
- Log.debug(`post-exit (code: ${(_exitCode = process.exitCode) != null ? _exitCode : 0})`);
48
+ debug(`post-exit (code: ${(_exitCode = process.exitCode) != null ? _exitCode : 0})`);
70
49
  process.exit();
71
50
  });
72
51
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/exit.ts"],"sourcesContent":["import * as Log from '../log';\nimport { guardAsync } from './fn';\n\ntype AsyncExitHook = (signal: NodeJS.Signals) => void | Promise<void>;\n\nconst PRE_EXIT_SIGNALS: NodeJS.Signals[] = ['SIGHUP', 'SIGINT', 'SIGTERM', 'SIGBREAK'];\n\n// We create a queue since Node.js throws an error if we try to append too many listeners:\n// (node:4405) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 SIGINT listeners added to [process]. Use emitter.setMaxListeners() to increase limit\nconst queue: AsyncExitHook[] = [];\n\nlet unsubscribe: (() => void) | null = null;\n\n/** Add functions that run before the process exits. Returns a function for removing the listeners. */\nexport function installExitHooks(asyncExitHook: AsyncExitHook): () => void {\n // We need to instantiate the master listener the first time the queue is used.\n if (!queue.length) {\n // Track the master listener so we can remove it later.\n unsubscribe = attachMasterListener();\n }\n\n queue.push(asyncExitHook);\n\n return () => {\n const index = queue.indexOf(asyncExitHook);\n if (index >= 0) {\n queue.splice(index, 1);\n }\n // Clean up the master listener if we don't need it anymore.\n if (!queue.length) {\n unsubscribe?.();\n }\n };\n}\n\n// Create a function that runs before the process exits and guards against running multiple times.\nfunction createExitHook(signal: NodeJS.Signals) {\n return guardAsync(async () => {\n Log.debug(`pre-exit (signal: ${signal}, queue length: ${queue.length})`);\n\n for (const [index, hookAsync] of Object.entries(queue)) {\n try {\n await hookAsync(signal);\n } catch (error: any) {\n Log.debug(`Error in exit hook: %O (queue: ${index})`, error);\n }\n }\n\n Log.debug(`post-exit (code: ${process.exitCode ?? 0})`);\n\n process.exit();\n });\n}\n\nfunction attachMasterListener() {\n const hooks: [NodeJS.Signals, () => any][] = [];\n for (const signal of PRE_EXIT_SIGNALS) {\n const hook = createExitHook(signal);\n hooks.push([signal, hook]);\n process.on(signal, hook);\n }\n return () => {\n for (const [signal, hook] of hooks) {\n process.removeListener(signal, hook);\n }\n };\n}\n"],"names":["installExitHooks","Log","PRE_EXIT_SIGNALS","queue","unsubscribe","asyncExitHook","length","attachMasterListener","push","index","indexOf","splice","createExitHook","signal","guardAsync","debug","hookAsync","Object","entries","error","process","exitCode","exit","hooks","hook","on","removeListener"],"mappings":"AAAA;;;;QAcgBA,gBAAgB,GAAhBA,gBAAgB;AAdpBC,IAAAA,GAAG,mCAAM,QAAQ,EAAd;AACY,IAAA,GAAM,WAAN,MAAM,CAAA;;;;;;;;;;;;;;;;;;;;;;AAIjC,MAAMC,gBAAgB,GAAqB;IAAC,QAAQ;IAAE,QAAQ;IAAE,SAAS;IAAE,UAAU;CAAC,AAAC;AAEvF,0FAA0F;AAC1F,+KAA+K;AAC/K,MAAMC,KAAK,GAAoB,EAAE,AAAC;AAElC,IAAIC,WAAW,GAAwB,IAAI,AAAC;AAGrC,SAASJ,gBAAgB,CAACK,aAA4B,EAAc;IACzE,+EAA+E;IAC/E,IAAI,CAACF,KAAK,CAACG,MAAM,EAAE;QACjB,uDAAuD;QACvDF,WAAW,GAAGG,oBAAoB,EAAE,CAAC;KACtC;IAEDJ,KAAK,CAACK,IAAI,CAACH,aAAa,CAAC,CAAC;IAE1B,OAAO,IAAM;QACX,MAAMI,KAAK,GAAGN,KAAK,CAACO,OAAO,CAACL,aAAa,CAAC,AAAC;QAC3C,IAAII,KAAK,IAAI,CAAC,EAAE;YACdN,KAAK,CAACQ,MAAM,CAACF,KAAK,EAAE,CAAC,CAAC,CAAC;SACxB;QACD,4DAA4D;QAC5D,IAAI,CAACN,KAAK,CAACG,MAAM,EAAE;YACjBF,WAAW,QAAI,GAAfA,KAAAA,CAAe,GAAfA,WAAW,EAAI,AA9BrB,CA8BsB;SACjB;KACF,CAAC;CACH;AAED,kGAAkG;AAClG,SAASQ,cAAc,CAACC,MAAsB,EAAE;IAC9C,OAAOC,CAAAA,GAAAA,GAAU,AAcf,CAAA,WAde,CAAC,UAAY;QAC5Bb,GAAG,CAACc,KAAK,CAAC,CAAC,kBAAkB,EAAEF,MAAM,CAAC,gBAAgB,EAAEV,KAAK,CAACG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAEzE,KAAK,MAAM,CAACG,KAAK,EAAEO,SAAS,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACf,KAAK,CAAC,CAAE;YACtD,IAAI;gBACF,MAAMa,SAAS,CAACH,MAAM,CAAC,CAAC;aACzB,CAAC,OAAOM,KAAK,EAAO;gBACnBlB,GAAG,CAACc,KAAK,CAAC,CAAC,+BAA+B,EAAEN,KAAK,CAAC,CAAC,CAAC,EAAEU,KAAK,CAAC,CAAC;aAC9D;SACF;YAE6BC,SAAgB;QAA9CnB,GAAG,CAACc,KAAK,CAAC,CAAC,iBAAiB,EAAEK,CAAAA,SAAgB,GAAhBA,OAAO,CAACC,QAAQ,YAAhBD,SAAgB,GAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAExDA,OAAO,CAACE,IAAI,EAAE,CAAC;KAChB,CAAC,CAAC;CACJ;AAED,SAASf,oBAAoB,GAAG;IAC9B,MAAMgB,KAAK,GAAkC,EAAE,AAAC;IAChD,KAAK,MAAMV,OAAM,IAAIX,gBAAgB,CAAE;QACrC,MAAMsB,IAAI,GAAGZ,cAAc,CAACC,OAAM,CAAC,AAAC;QACpCU,KAAK,CAACf,IAAI,CAAC;YAACK,OAAM;YAAEW,IAAI;SAAC,CAAC,CAAC;QAC3BJ,OAAO,CAACK,EAAE,CAACZ,OAAM,EAAEW,IAAI,CAAC,CAAC;KAC1B;IACD,OAAO,IAAM;QACX,KAAK,MAAM,CAACX,MAAM,EAAEW,IAAI,CAAC,IAAID,KAAK,CAAE;YAClCH,OAAO,CAACM,cAAc,CAACb,MAAM,EAAEW,IAAI,CAAC,CAAC;SACtC;KACF,CAAC;CACH"}
1
+ {"version":3,"sources":["../../../src/utils/exit.ts"],"sourcesContent":["import { guardAsync } from './fn';\n\nconst debug = require('debug')('expo:utils:exit') as typeof console.log;\n\ntype AsyncExitHook = (signal: NodeJS.Signals) => void | Promise<void>;\n\nconst PRE_EXIT_SIGNALS: NodeJS.Signals[] = ['SIGHUP', 'SIGINT', 'SIGTERM', 'SIGBREAK'];\n\n// We create a queue since Node.js throws an error if we try to append too many listeners:\n// (node:4405) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 SIGINT listeners added to [process]. Use emitter.setMaxListeners() to increase limit\nconst queue: AsyncExitHook[] = [];\n\nlet unsubscribe: (() => void) | null = null;\n\n/** Add functions that run before the process exits. Returns a function for removing the listeners. */\nexport function installExitHooks(asyncExitHook: AsyncExitHook): () => void {\n // We need to instantiate the master listener the first time the queue is used.\n if (!queue.length) {\n // Track the master listener so we can remove it later.\n unsubscribe = attachMasterListener();\n }\n\n queue.push(asyncExitHook);\n\n return () => {\n const index = queue.indexOf(asyncExitHook);\n if (index >= 0) {\n queue.splice(index, 1);\n }\n // Clean up the master listener if we don't need it anymore.\n if (!queue.length) {\n unsubscribe?.();\n }\n };\n}\n\n// Create a function that runs before the process exits and guards against running multiple times.\nfunction createExitHook(signal: NodeJS.Signals) {\n return guardAsync(async () => {\n debug(`pre-exit (signal: ${signal}, queue length: ${queue.length})`);\n\n for (const [index, hookAsync] of Object.entries(queue)) {\n try {\n await hookAsync(signal);\n } catch (error: any) {\n debug(`Error in exit hook: %O (queue: ${index})`, error);\n }\n }\n\n debug(`post-exit (code: ${process.exitCode ?? 0})`);\n\n process.exit();\n });\n}\n\nfunction attachMasterListener() {\n const hooks: [NodeJS.Signals, () => any][] = [];\n for (const signal of PRE_EXIT_SIGNALS) {\n const hook = createExitHook(signal);\n hooks.push([signal, hook]);\n process.on(signal, hook);\n }\n return () => {\n for (const [signal, hook] of hooks) {\n process.removeListener(signal, hook);\n }\n };\n}\n"],"names":["installExitHooks","debug","require","PRE_EXIT_SIGNALS","queue","unsubscribe","asyncExitHook","length","attachMasterListener","push","index","indexOf","splice","createExitHook","signal","guardAsync","hookAsync","Object","entries","error","process","exitCode","exit","hooks","hook","on","removeListener"],"mappings":"AAAA;;;;QAegBA,gBAA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;YACtD,IAAI;gBACF,MAAMY,SAAS,CAACF,MAAM,CAAC,CAAC;aACzB,CAAC,OAAOK,KAAK,EAAO;gBACnBlB,KAAK,CAAC,CAAC,+BAA+B,EAAES,KAAK,CAAC,CAAC,CAAC,EAAES,KAAK,CAAC,CAAC;aAC1D;SACF;YAEyBC,SAAgB;QAA1CnB,KAAK,CAAC,CAAC,iBAAiB,EAAEmB,CAAAA,SAAgB,GAAhBA,OAAO,CAACC,QAAQ,YAAhBD,SAAgB,GAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAEpDA,OAAO,CAACE,IAAI,EAAE,CAAC;KAChB,CAAC,CAAC;CACJ;AAED,SAASd,oBAAoB,GAAG;IAC9B,MAAMe,KAAK,GAAkC,EAAE,AAAC;IAChD,KAAK,MAAMT,OAAM,IAAIX,gBAAgB,CAAE;QACrC,MAAMqB,IAAI,GAAGX,cAAc,CAACC,OAAM,CAAC,AAAC;QACpCS,KAAK,CAACd,IAAI,CAAC;YAACK,OAAM;YAAEU,IAAI;SAAC,CAAC,CAAC;QAC3BJ,OAAO,CAACK,EAAE,CAACX,OAAM,EAAEU,IAAI,CAAC,CAAC;KAC1B;IACD,OAAO,IAAM;QACX,KAAK,MAAM,CAACV,MAAM,EAAEU,IAAI,CAAC,IAAID,KAAK,CAAE;YAClCH,OAAO,CAACM,cAAc,CAACZ,MAAM,EAAEU,IAAI,CAAC,CAAC;SACtC;KACF,CAAC;CACH"}
@@ -28,6 +28,7 @@ function _interopRequireWildcard(obj) {
28
28
  return newObj;
29
29
  }
30
30
  }
31
+ const debug = require("debug")("expo:utils:getRunningProcess");
31
32
  const defaultOptions = {
32
33
  encoding: "utf8",
33
34
  stdio: [
@@ -44,8 +45,11 @@ function getPID(port) {
44
45
  "-t",
45
46
  "-sTCP:LISTEN"
46
47
  ], defaultOptions).split("\n")[0].trim();
47
- return Number(results);
48
- } catch {
48
+ const pid = Number(results);
49
+ debug(`pid: ${pid} for port: ${port}`);
50
+ return pid;
51
+ } catch (error) {
52
+ debug(`No pid found for port: ${port}. Error: ${error}`);
49
53
  return null;
50
54
  }
51
55
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/getRunningProcess.ts"],"sourcesContent":["import { execFileSync, execSync, ExecSyncOptionsWithStringEncoding } from 'child_process';\nimport * as path from 'path';\n\nconst defaultOptions: ExecSyncOptionsWithStringEncoding = {\n encoding: 'utf8',\n stdio: ['pipe', 'pipe', 'ignore'],\n};\n\n/** Returns a pid value for a running port like `63828` or null if nothing is running on the given port. */\nexport function getPID(port: number): number | null {\n try {\n const results = execFileSync('lsof', [`-i:${port}`, '-P', '-t', '-sTCP:LISTEN'], defaultOptions)\n .split('\\n')[0]\n .trim();\n return Number(results);\n } catch {\n return null;\n }\n}\n\n/** Get `package.json` `name` field for a given directory. Returns `null` if none exist. */\nfunction getPackageName(packageRoot: string): string | null {\n const packageJson = path.join(packageRoot, 'package.json');\n try {\n return require(packageJson).name || null;\n } catch {\n return null;\n }\n}\n\n/** Returns a command like `node /Users/evanbacon/.../bin/expo start` or the package.json name. */\nfunction getProcessCommand(pid: number, procDirectory: string): string {\n const name = getPackageName(procDirectory);\n\n if (name) {\n return name;\n }\n return execSync(`ps -o command -p ${pid} | sed -n 2p`, defaultOptions).replace(/\\n$/, '').trim();\n}\n\n/** Get directory for a given process ID. */\nexport function getDirectoryOfProcessById(processId: number): string {\n return execSync(\n `lsof -p ${processId} | awk '$4==\"cwd\" {for (i=9; i<=NF; i++) printf \"%s \", $i}'`,\n defaultOptions\n ).trim();\n}\n\n/** Get information about a running process given a port. Returns null if no process is running on the given port. */\nexport function getRunningProcess(port: number): {\n /** The PID value for the port. */\n pid: number;\n /** Get the directory for the running process. */\n directory: string;\n /** The command running the process like `node /Users/evanbacon/.../bin/expo start` or the `package.json` name like `my-app`. */\n command: string;\n} | null {\n // 63828\n const pid = getPID(port);\n if (!pid) {\n return null;\n }\n\n try {\n // /Users/evanbacon/Documents/GitHub/lab/myapp\n const directory = getDirectoryOfProcessById(pid);\n // /Users/evanbacon/Documents/GitHub/lab/myapp/package.json\n const command = getProcessCommand(pid, directory);\n // TODO: Have a better message for reusing another process.\n return { pid, directory, command };\n } catch {\n return null;\n }\n}\n"],"names":["getPID","getDirectoryOfProcessById","getRunningProcess","path","defaultOptions","encoding","stdio","port","results","execFileSync","split","trim","Number","getPackageName","packageRoot","packageJson","join","require","name","getProcessCommand","pid","procDirectory","execSync","replace","processId","directory","command"],"mappings":"AAAA;;;;QASgBA,MAAM,GAANA,MAAM;QAgCNC,yBAAyB,GAAzBA,yBAAyB;QAQzBC,iBAAiB,GAAjBA,iBAAiB;AAjDyC,IAAA,aAAe,WAAf,eAAe,CAAA;AAC7EC,IAAAA,IAAI,mCAAM,MAAM,EAAZ;;;;;;;;;;;;;;;;;;;;;;AAEhB,MAAMC,cAAc,GAAsC;IACxDC,QAAQ,EAAE,MAAM;IAChBC,KAAK,EAAE;QAAC,MAAM;QAAE,MAAM;QAAE,QAAQ;KAAC;CAClC,AAAC;AAGK,SAASN,MAAM,CAACO,IAAY,EAAiB;IAClD,IAAI;QACF,MAAMC,OAAO,GAAGC,CAAAA,GAAAA,aAAY,AAAoE,CAAA,aAApE,CAAC,MAAM,EAAE;YAAC,CAAC,GAAG,EAAEF,IAAI,CAAC,CAAC;YAAE,IAAI;YAAE,IAAI;YAAE,cAAc;SAAC,EAAEH,cAAc,CAAC,CAC7FM,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CACdC,IAAI,EAAE,AAAC;QACV,OAAOC,MAAM,CAACJ,OAAO,CAAC,CAAC;KACxB,CAAC,OAAM;QACN,OAAO,IAAI,CAAC;KACb;CACF;AAED,2FAA2F,CAC3F,SAASK,cAAc,CAACC,WAAmB,EAAiB;IAC1D,MAAMC,WAAW,GAAGZ,IAAI,CAACa,IAAI,CAACF,WAAW,EAAE,cAAc,CAAC,AAAC;IAC3D,IAAI;QACF,OAAOG,OAAO,CAACF,WAAW,CAAC,CAACG,IAAI,IAAI,IAAI,CAAC;KAC1C,CAAC,OAAM;QACN,OAAO,IAAI,CAAC;KACb;CACF;AAED,kGAAkG,CAClG,SAASC,iBAAiB,CAACC,GAAW,EAAEC,aAAqB,EAAU;IACrE,MAAMH,IAAI,GAAGL,cAAc,CAACQ,aAAa,CAAC,AAAC;IAE3C,IAAIH,IAAI,EAAE;QACR,OAAOA,IAAI,CAAC;KACb;IACD,OAAOI,CAAAA,GAAAA,aAAQ,AAAuD,CAAA,SAAvD,CAAC,CAAC,iBAAiB,EAAEF,GAAG,CAAC,YAAY,CAAC,EAAEhB,cAAc,CAAC,CAACmB,OAAO,QAAQ,EAAE,CAAC,CAACZ,IAAI,EAAE,CAAC;CAClG;AAGM,SAASV,yBAAyB,CAACuB,SAAiB,EAAU;IACnE,OAAOF,CAAAA,GAAAA,aAAQ,AAGd,CAAA,SAHc,CACb,CAAC,QAAQ,EAAEE,SAAS,CAAC,2DAA2D,CAAC,EACjFpB,cAAc,CACf,CAACO,IAAI,EAAE,CAAC;CACV;AAGM,SAAST,iBAAiB,CAACK,IAAY,EAOrC;IACP,QAAQ;IACR,MAAMa,GAAG,GAAGpB,MAAM,CAACO,IAAI,CAAC,AAAC;IACzB,IAAI,CAACa,GAAG,EAAE;QACR,OAAO,IAAI,CAAC;KACb;IAED,IAAI;QACF,8CAA8C;QAC9C,MAAMK,SAAS,GAAGxB,yBAAyB,CAACmB,GAAG,CAAC,AAAC;QACjD,2DAA2D;QAC3D,MAAMM,OAAO,GAAGP,iBAAiB,CAACC,GAAG,EAAEK,SAAS,CAAC,AAAC;QAClD,2DAA2D;QAC3D,OAAO;YAAEL,GAAG;YAAEK,SAAS;YAAEC,OAAO;SAAE,CAAC;KACpC,CAAC,OAAM;QACN,OAAO,IAAI,CAAC;KACb;CACF"}
1
+ {"version":3,"sources":["../../../src/utils/getRunningProcess.ts"],"sourcesContent":["import { execFileSync, execSync, ExecSyncOptionsWithStringEncoding } from 'child_process';\nimport * as path from 'path';\n\nconst debug = require('debug')('expo:utils:getRunningProcess') as typeof console.log;\n\nconst defaultOptions: ExecSyncOptionsWithStringEncoding = {\n encoding: 'utf8',\n stdio: ['pipe', 'pipe', 'ignore'],\n};\n\n/** Returns a pid value for a running port like `63828` or null if nothing is running on the given port. */\nexport function getPID(port: number): number | null {\n try {\n const results = execFileSync('lsof', [`-i:${port}`, '-P', '-t', '-sTCP:LISTEN'], defaultOptions)\n .split('\\n')[0]\n .trim();\n const pid = Number(results);\n debug(`pid: ${pid} for port: ${port}`);\n return pid;\n } catch (error: any) {\n debug(`No pid found for port: ${port}. Error: ${error}`);\n return null;\n }\n}\n\n/** Get `package.json` `name` field for a given directory. Returns `null` if none exist. */\nfunction getPackageName(packageRoot: string): string | null {\n const packageJson = path.join(packageRoot, 'package.json');\n try {\n return require(packageJson).name || null;\n } catch {\n return null;\n }\n}\n\n/** Returns a command like `node /Users/evanbacon/.../bin/expo start` or the package.json name. */\nfunction getProcessCommand(pid: number, procDirectory: string): string {\n const name = getPackageName(procDirectory);\n\n if (name) {\n return name;\n }\n return execSync(`ps -o command -p ${pid} | sed -n 2p`, defaultOptions).replace(/\\n$/, '').trim();\n}\n\n/** Get directory for a given process ID. */\nexport function getDirectoryOfProcessById(processId: number): string {\n return execSync(\n `lsof -p ${processId} | awk '$4==\"cwd\" {for (i=9; i<=NF; i++) printf \"%s \", $i}'`,\n defaultOptions\n ).trim();\n}\n\n/** Get information about a running process given a port. Returns null if no process is running on the given port. */\nexport function getRunningProcess(port: number): {\n /** The PID value for the port. */\n pid: number;\n /** Get the directory for the running process. */\n directory: string;\n /** The command running the process like `node /Users/evanbacon/.../bin/expo start` or the `package.json` name like `my-app`. */\n command: string;\n} | null {\n // 63828\n const pid = getPID(port);\n if (!pid) {\n return null;\n }\n\n try {\n // /Users/evanbacon/Documents/GitHub/lab/myapp\n const directory = getDirectoryOfProcessById(pid);\n // /Users/evanbacon/Documents/GitHub/lab/myapp/package.json\n const command = getProcessCommand(pid, directory);\n // TODO: Have a better message for reusing another process.\n return { pid, directory, command };\n } catch {\n return null;\n }\n}\n"],"names":["getPID","getDirectoryOfProcessById","getRunningProcess","path","debug","require","defaultOptions","encoding","stdio","port","results","execFileSync","split","trim","pid","Number","error","getPackageName","packageRoot","packageJson","join","name","getProcessCommand","procDirectory","execSync","replace","processId","directory","command"],"mappings":"AAAA;;;;QAWgBA,MAAM,GAANA,MAAM;QAmCNC,yBAAyB,GAAzBA,yBAAyB;QAQzBC,iBAAiB,GAAjBA,iBAAiB;AAtDyC,IAAA,aAAe,WAAf,eAAe,CAAA;AAC7EC,IAAAA,IAAI,mCAAM,MAAM,EAAZ;;;;;;;;;;;;;;;;;;;;;;AAEhB,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,8BAA8B,CAAC,AAAsB,AAAC;AAErF,MAAMC,cAAc,GAAsC;IACxDC,QAAQ,EAAE,MAAM;IAChBC,KAAK,EAAE;QAAC,MAAM;QAAE,MAAM;QAAE,QAAQ;KAAC;CAClC,AAAC;AAGK,SAASR,MAAM,CAACS,IAAY,EAAiB;IAClD,IAAI;QACF,MAAMC,OAAO,GAAGC,CAAAA,GAAAA,aAAY,AAAoE,CAAA,aAApE,CAAC,MAAM,EAAE;YAAC,CAAC,GAAG,EAAEF,IAAI,CAAC,CAAC;YAAE,IAAI;YAAE,IAAI;YAAE,cAAc;SAAC,EAAEH,cAAc,CAAC,CAC7FM,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CACdC,IAAI,EAAE,AAAC;QACV,MAAMC,GAAG,GAAGC,MAAM,CAACL,OAAO,CAAC,AAAC;QAC5BN,KAAK,CAAC,CAAC,KAAK,EAAEU,GAAG,CAAC,WAAW,EAAEL,IAAI,CAAC,CAAC,CAAC,CAAC;QACvC,OAAOK,GAAG,CAAC;KACZ,CAAC,OAAOE,KAAK,EAAO;QACnBZ,KAAK,CAAC,CAAC,uBAAuB,EAAEK,IAAI,CAAC,SAAS,EAAEO,KAAK,CAAC,CAAC,CA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OAAO;YAAEb,GAAG;YAAEa,SAAS;YAAEC,OAAO;SAAE,CAAC;KACpC,CAAC,OAAM;QACN,OAAO,IAAI,CAAC;KACb;CACF"}
@@ -2,117 +2,28 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- exports.resolvePackageManager = resolvePackageManager;
6
- exports.installNodeDependenciesAsync = installNodeDependenciesAsync;
7
- var PackageManager = _interopRequireWildcard(require("@expo/package-manager"));
5
+ exports.clearNodeModulesAsync = clearNodeModulesAsync;
8
6
  var _chalk = _interopRequireDefault(require("chalk"));
9
7
  var _fs = _interopRequireDefault(require("fs"));
10
- var _jsYaml = _interopRequireDefault(require("js-yaml"));
11
8
  var _path = _interopRequireDefault(require("path"));
12
- var _semver = _interopRequireDefault(require("semver"));
13
- var Log = _interopRequireWildcard(require("../log"));
14
- var _env = require("./env");
15
- var _errors = require("./errors");
16
9
  var _ora = require("./ora");
17
10
  function _interopRequireDefault(obj) {
18
11
  return obj && obj.__esModule ? obj : {
19
12
  default: obj
20
13
  };
21
14
  }
22
- function _interopRequireWildcard(obj) {
23
- if (obj && obj.__esModule) {
24
- return obj;
25
- } else {
26
- var newObj = {};
27
- if (obj != null) {
28
- for(var key in obj){
29
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
30
- var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
31
- if (desc.get || desc.set) {
32
- Object.defineProperty(newObj, key, desc);
33
- } else {
34
- newObj[key] = obj[key];
35
- }
36
- }
37
- }
38
- }
39
- newObj.default = obj;
40
- return newObj;
41
- }
42
- }
43
- function resolvePackageManager(options) {
44
- let packageManager = "npm";
45
- if (options.yarn || !options.npm && PackageManager.shouldUseYarn()) {
46
- packageManager = "yarn";
47
- } else {
48
- packageManager = "npm";
49
- }
50
- if (options.install) {
51
- Log.log(packageManager === "yarn" ? `🧶 Using Yarn to install packages. ${_chalk.default.dim("Pass --npm to use npm instead.")}` : "\uD83D\uDCE6 Using npm to install packages.");
52
- }
53
- return packageManager;
54
- }
55
- async function installNodeDependenciesAsync(projectRoot, packageManager, flags = {}) {
56
- var _silent;
57
- // Default to silent unless debugging.
58
- const isSilent = (_silent = flags.silent) != null ? _silent : !_env.env.EXPO_DEBUG;
59
- if (flags.clean && packageManager !== "yarn") {
60
- // This step can take a couple seconds, if the installation logs are enabled (with EXPO_DEBUG) then it
61
- // ends up looking odd to see "Installing JavaScript dependencies" for ~5 seconds before the logs start showing up.
62
- const cleanJsDepsStep = (0, _ora).logNewSection("Cleaning JavaScript dependencies");
63
- const time = Date.now();
64
- // nuke the node modules
65
- // TODO: this is substantially slower, we should find a better alternative to ensuring the modules are installed.
66
- await _fs.default.promises.rm("node_modules", {
67
- recursive: true,
68
- force: true
69
- });
70
- cleanJsDepsStep.succeed(`Cleaned JavaScript dependencies ${_chalk.default.gray(Date.now() - time + "ms")}`);
71
- }
72
- const installJsDepsStep = (0, _ora).logNewSection("Installing JavaScript dependencies");
73
- try {
74
- const time = Date.now();
75
- await installNodeDependenciesInternalAsync(projectRoot, packageManager, {
76
- silent: isSilent
77
- });
78
- installJsDepsStep.succeed(`Installed JavaScript dependencies ${_chalk.default.gray(Date.now() - time + "ms")}`);
79
- } catch {
80
- const message = `Something went wrong installing JavaScript dependencies, check your ${packageManager} logfile or run ${_chalk.default.bold(`${packageManager} install`)} again manually.`;
81
- installJsDepsStep.fail(_chalk.default.red(message));
82
- // TODO: actually show the error message from the package manager! :O
83
- throw new _errors.SilentError(message);
84
- }
85
- }
86
- async function installNodeDependenciesInternalAsync(projectRoot, packageManager, flags) {
87
- const options = {
88
- cwd: projectRoot,
89
- silent: flags.silent
90
- };
91
- if (packageManager === "yarn") {
92
- const yarn = new PackageManager.YarnPackageManager(options);
93
- const version = await yarn.versionAsync();
94
- const nodeLinker = await yarn.getConfigAsync("nodeLinker");
95
- if (_semver.default.satisfies(version, ">=2.0.0-rc.24") && nodeLinker !== "node-modules") {
96
- const yarnRc = _path.default.join(projectRoot, ".yarnrc.yml");
97
- let yamlString = "";
98
- try {
99
- yamlString = _fs.default.readFileSync(yarnRc, "utf8");
100
- } catch (error) {
101
- if (error.code !== "ENOENT") {
102
- throw error;
103
- }
104
- }
105
- const config = yamlString ? _jsYaml.default.safeLoad(yamlString) : {};
106
- // @ts-ignore
107
- config.nodeLinker = "node-modules";
108
- !flags.silent && Log.warn(`Yarn v${version} detected, enabling experimental Yarn v2 support using the node-modules plugin.`);
109
- !flags.silent && Log.log(`Writing ${yarnRc}...`);
110
- _fs.default.writeFileSync(yarnRc, _jsYaml.default.safeDump(config));
111
- }
112
- await yarn.installAsync();
113
- } else {
114
- await new PackageManager.NpmPackageManager(options).installAsync();
115
- }
15
+ async function clearNodeModulesAsync(projectRoot) {
16
+ // This step can take a couple seconds, if the installation logs are enabled (with EXPO_DEBUG) then it
17
+ // ends up looking odd to see "Installing JavaScript dependencies" for ~5 seconds before the logs start showing up.
18
+ const cleanJsDepsStep = (0, _ora).logNewSection("Cleaning JavaScript dependencies");
19
+ const time = Date.now();
20
+ // nuke the node modules
21
+ // TODO: this is substantially slower, we should find a better alternative to ensuring the modules are installed.
22
+ await _fs.default.promises.rm(_path.default.join(projectRoot, "node_modules"), {
23
+ recursive: true,
24
+ force: true
25
+ });
26
+ cleanJsDepsStep.succeed(`Cleaned JavaScript dependencies ${_chalk.default.gray(Date.now() - time + "ms")}`);
116
27
  }
117
28
 
118
29
  //# sourceMappingURL=nodeModules.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/nodeModules.ts"],"sourcesContent":["import * as PackageManager from '@expo/package-manager';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport yaml from 'js-yaml';\nimport path from 'path';\nimport semver from 'semver';\n\nimport * as Log from '../log';\nimport { env } from './env';\nimport { SilentError } from './errors';\nimport { logNewSection } from './ora';\n\nexport type PackageManagerName = 'npm' | 'yarn';\n\nexport function resolvePackageManager(options: {\n yarn?: boolean;\n npm?: boolean;\n install?: boolean;\n}): PackageManagerName {\n let packageManager: PackageManagerName = 'npm';\n if (options.yarn || (!options.npm && PackageManager.shouldUseYarn())) {\n packageManager = 'yarn';\n } else {\n packageManager = 'npm';\n }\n if (options.install) {\n Log.log(\n packageManager === 'yarn'\n ? `🧶 Using Yarn to install packages. ${chalk.dim('Pass --npm to use npm instead.')}`\n : '📦 Using npm to install packages.'\n );\n }\n\n return packageManager;\n}\n\nexport async function installNodeDependenciesAsync(\n projectRoot: string,\n packageManager: PackageManagerName,\n flags: { silent?: boolean; clean?: boolean } = {}\n) {\n // Default to silent unless debugging.\n const isSilent = flags.silent ?? !env.EXPO_DEBUG;\n if (flags.clean && packageManager !== 'yarn') {\n // This step can take a couple seconds, if the installation logs are enabled (with EXPO_DEBUG) then it\n // ends up looking odd to see \"Installing JavaScript dependencies\" for ~5 seconds before the logs start showing up.\n const cleanJsDepsStep = logNewSection('Cleaning JavaScript dependencies');\n const time = Date.now();\n // nuke the node modules\n // TODO: this is substantially slower, we should find a better alternative to ensuring the modules are installed.\n await fs.promises.rm('node_modules', { recursive: true, force: true });\n cleanJsDepsStep.succeed(\n `Cleaned JavaScript dependencies ${chalk.gray(Date.now() - time + 'ms')}`\n );\n }\n\n const installJsDepsStep = logNewSection('Installing JavaScript dependencies');\n try {\n const time = Date.now();\n await installNodeDependenciesInternalAsync(projectRoot, packageManager, { silent: isSilent });\n installJsDepsStep.succeed(\n `Installed JavaScript dependencies ${chalk.gray(Date.now() - time + 'ms')}`\n );\n } catch {\n const message = `Something went wrong installing JavaScript dependencies, check your ${packageManager} logfile or run ${chalk.bold(\n `${packageManager} install`\n )} again manually.`;\n installJsDepsStep.fail(chalk.red(message));\n // TODO: actually show the error message from the package manager! :O\n throw new SilentError(message);\n }\n}\n\nasync function installNodeDependenciesInternalAsync(\n projectRoot: string,\n packageManager: PackageManagerName,\n flags: { silent: boolean }\n) {\n const options = { cwd: projectRoot, silent: flags.silent };\n if (packageManager === 'yarn') {\n const yarn = new PackageManager.YarnPackageManager(options);\n const version = await yarn.versionAsync();\n const nodeLinker = await yarn.getConfigAsync('nodeLinker');\n if (semver.satisfies(version, '>=2.0.0-rc.24') && nodeLinker !== 'node-modules') {\n const yarnRc = path.join(projectRoot, '.yarnrc.yml');\n let yamlString = '';\n try {\n yamlString = fs.readFileSync(yarnRc, 'utf8');\n } catch (error: any) {\n if (error.code !== 'ENOENT') {\n throw error;\n }\n }\n const config = yamlString ? yaml.safeLoad(yamlString) : {};\n // @ts-ignore\n config.nodeLinker = 'node-modules';\n !flags.silent &&\n Log.warn(\n `Yarn v${version} detected, enabling experimental Yarn v2 support using the node-modules plugin.`\n );\n !flags.silent && Log.log(`Writing ${yarnRc}...`);\n fs.writeFileSync(yarnRc, yaml.safeDump(config));\n }\n await yarn.installAsync();\n } else {\n await new PackageManager.NpmPackageManager(options).installAsync();\n }\n}\n"],"names":["resolvePackageManager","installNodeDependenciesAsync","PackageManager","Log","options","packageManager","yarn","npm","shouldUseYarn","install","log","chalk","dim","projectRoot","flags","isSilent","silent","env","EXPO_DEBUG","clean","cleanJsDepsStep","logNewSection","time","Date","now","fs","promises","rm","recursive","force","succeed","gray","installJsDepsStep","installNodeDependenciesInternalAsync","message","bold","fail","red","SilentError","cwd","YarnPackageManager","version","versionAsync","nodeLinker","getConfigAsync","semver","satisfies","yarnRc","path","join","yamlString","readFileSync","error","code","config","yaml","safeLoad","warn","writeFileSync","safeDump","installAsync","NpmPackageManager"],"mappings":"AAAA;;;;QAcgBA,qBAAqB,GAArBA,qBAAqB;QAsBfC,4BAA4B,GAA5BA,4BAA4B;AApCtCC,IAAAA,cAAc,mCAAM,uBAAuB,EAA7B;AACR,IAAA,MAAO,kCAAP,OAAO,EAAA;AACV,IAAA,GAAI,kCAAJ,IAAI,EAAA;AACF,IAAA,OAAS,kCAAT,SAAS,EAAA;AACT,IAAA,KAAM,kCAAN,MAAM,EAAA;AACJ,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AAEfC,IAAAA,GAAG,mCA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AY,EAAE,CAAC;KAC3B,MAAM;QACL,MAAM,IAAI1D,cAAc,CAAC2D,iBAAiB,CAACzD,OAAO,CAAC,CAACwD,YAAY,EAAE,CAAC;KACpE;CACF"}
1
+ {"version":3,"sources":["../../../src/utils/nodeModules.ts"],"sourcesContent":["import chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { logNewSection } from './ora';\n\nexport async function clearNodeModulesAsync(projectRoot: string) {\n // This step can take a couple seconds, if the installation logs are enabled (with EXPO_DEBUG) then it\n // ends up looking odd to see \"Installing JavaScript dependencies\" for ~5 seconds before the logs start showing up.\n const cleanJsDepsStep = logNewSection('Cleaning JavaScript dependencies');\n const time = Date.now();\n // nuke the node modules\n // TODO: this is substantially slower, we should find a better alternative to ensuring the modules are installed.\n await fs.promises.rm(path.join(projectRoot, 'node_modules'), { recursive: true, force: true });\n cleanJsDepsStep.succeed(\n `Cleaned JavaScript dependencies ${chalk.gray(Date.now() - time + 'ms')}`\n );\n}\n"],"names":["clearNodeModulesAsync","projectRoot","cleanJsDepsStep","logNewSection","time","Date","now","fs","promises","rm","path","join","recursive","force","succeed","chalk","gray"],"mappings":"AAAA;;;;QAMsBA,qBAAqB,GAArBA,qBAAqB;AANzB,IAAA,MAAO,kCAAP,OAAO,EAAA;AACV,IAAA,GAAI,kCAAJ,IAAI,EAAA;AACF,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEO,IAAA,IAAO,WAAP,OAAO,CAAA;;;;;;AAE9B,eAAeA,qBAAqB,CAACC,WAAmB,EAAE;IAC/D,sGAAsG;IACtG,mHAAmH;IACnH,MAAMC,eAAe,GAAGC,CAAAA,GAAAA,IAAa,AAAoC,CAAA,cAApC,CAAC,kCAAkC,CAAC,AAAC;IAC1E,MAAMC,IAAI,GAAGC,IAAI,CAACC,GAAG,EAAE,AAAC;IACxB,wBAAwB;IACxB,iHAAiH;IACjH,MAAMC,GAAE,QAAA,CAACC,QAAQ,CAACC,EAAE,CAACC,KAAI,QAAA,CAACC,IAAI,CAACV,WAAW,EAAE,cAAc,CAAC,EAAE;QAAEW,SAAS,EAAE,IAAI;QAAEC,KAAK,EAAE,IAAI;KAAE,CAAC,CAAC;IAC/FX,eAAe,CAACY,OAAO,CACrB,CAAC,gCAAgC,EAAEC,MAAK,QAAA,CAACC,IAAI,CAACX,IAAI,CAACC,GAAG,EAAE,GAAGF,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAC1E,CAAC;CACH"}