@expo/cli 0.0.0 → 0.1.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 (336) hide show
  1. package/README.md +106 -0
  2. package/build/bin/cli +125 -0
  3. package/build/bin/cli.map +1 -0
  4. package/build/src/api/endpoint.js +17 -0
  5. package/build/src/api/endpoint.js.map +1 -0
  6. package/build/src/api/getExpoGoIntermediateCertificate.js +21 -0
  7. package/build/src/api/getExpoGoIntermediateCertificate.js.map +1 -0
  8. package/build/src/api/getExpoSchema.js +69 -0
  9. package/build/src/api/getExpoSchema.js.map +1 -0
  10. package/build/src/api/getNativeModuleVersions.js +31 -0
  11. package/build/src/api/getNativeModuleVersions.js.map +1 -0
  12. package/build/src/api/getProject.js +19 -0
  13. package/build/src/api/getProject.js.map +1 -0
  14. package/build/src/api/getProjectDevelopmentCertificate.js +24 -0
  15. package/build/src/api/getProjectDevelopmentCertificate.js.map +1 -0
  16. package/build/src/api/getVersions.js +37 -0
  17. package/build/src/api/getVersions.js.map +1 -0
  18. package/build/src/api/graphql/client.js +104 -0
  19. package/build/src/api/graphql/client.js.map +1 -0
  20. package/build/src/api/graphql/generated.js +113 -0
  21. package/build/src/api/graphql/generated.js.map +1 -0
  22. package/build/src/api/graphql/queries/UserQuery.js +43 -0
  23. package/build/src/api/graphql/queries/UserQuery.js.map +1 -0
  24. package/build/src/api/rest/cache/FileSystemCache.js +79 -0
  25. package/build/src/api/rest/cache/FileSystemCache.js.map +1 -0
  26. package/build/src/api/rest/cache/response.js +31 -0
  27. package/build/src/api/rest/cache/response.js.map +1 -0
  28. package/build/src/api/rest/cache/wrapFetchWithCache.js +156 -0
  29. package/build/src/api/rest/cache/wrapFetchWithCache.js.map +1 -0
  30. package/build/src/api/rest/client.js +94 -0
  31. package/build/src/api/rest/client.js.map +1 -0
  32. package/build/src/api/rest/client.types.js +6 -0
  33. package/build/src/api/rest/client.types.js.map +1 -0
  34. package/build/src/api/rest/wrapFetchWithBaseUrl.js +20 -0
  35. package/build/src/api/rest/wrapFetchWithBaseUrl.js.map +1 -0
  36. package/build/src/api/rest/wrapFetchWithOffline.js +39 -0
  37. package/build/src/api/rest/wrapFetchWithOffline.js.map +1 -0
  38. package/build/src/api/rest/wrapFetchWithProgress.js +59 -0
  39. package/build/src/api/rest/wrapFetchWithProgress.js.map +1 -0
  40. package/build/src/api/settings.js +11 -0
  41. package/build/src/api/settings.js.map +1 -0
  42. package/build/src/api/signManifest.js +38 -0
  43. package/build/src/api/signManifest.js.map +1 -0
  44. package/build/src/api/updateDevelopmentSession.js +74 -0
  45. package/build/src/api/updateDevelopmentSession.js.map +1 -0
  46. package/build/src/api/user/UserSettings.js +71 -0
  47. package/build/src/api/user/UserSettings.js.map +1 -0
  48. package/build/src/api/user/actions.js +97 -0
  49. package/build/src/api/user/actions.js.map +1 -0
  50. package/build/src/api/user/otp.js +139 -0
  51. package/build/src/api/user/otp.js.map +1 -0
  52. package/build/src/api/user/user.js +114 -0
  53. package/build/src/api/user/user.js.map +1 -0
  54. package/build/src/config/configAsync.js +118 -0
  55. package/build/src/config/configAsync.js.map +1 -0
  56. package/build/src/config/index.js +85 -0
  57. package/build/src/config/index.js.map +1 -0
  58. package/build/src/install/checkPackages.js +74 -0
  59. package/build/src/install/checkPackages.js.map +1 -0
  60. package/build/src/install/index.js +76 -0
  61. package/build/src/install/index.js.map +1 -0
  62. package/build/src/install/installAsync.js +103 -0
  63. package/build/src/install/installAsync.js.map +1 -0
  64. package/build/src/install/resolveOptions.js +99 -0
  65. package/build/src/install/resolveOptions.js.map +1 -0
  66. package/build/src/install/utils/autoAddConfigPlugins.js +87 -0
  67. package/build/src/install/utils/autoAddConfigPlugins.js.map +1 -0
  68. package/build/src/log.js +74 -0
  69. package/build/src/log.js.map +1 -0
  70. package/build/src/login/index.js +76 -0
  71. package/build/src/login/index.js.map +1 -0
  72. package/build/src/logout/index.js +63 -0
  73. package/build/src/logout/index.js.map +1 -0
  74. package/build/src/prebuild/clearNativeFolder.js +137 -0
  75. package/build/src/prebuild/clearNativeFolder.js.map +1 -0
  76. package/build/src/prebuild/configureProjectAsync.js +68 -0
  77. package/build/src/prebuild/configureProjectAsync.js.map +1 -0
  78. package/build/src/prebuild/copyTemplateFiles.js +124 -0
  79. package/build/src/prebuild/copyTemplateFiles.js.map +1 -0
  80. package/build/src/prebuild/ensureConfigAsync.js +86 -0
  81. package/build/src/prebuild/ensureConfigAsync.js.map +1 -0
  82. package/build/src/prebuild/index.js +101 -0
  83. package/build/src/prebuild/index.js.map +1 -0
  84. package/build/src/prebuild/prebuildAsync.js +112 -0
  85. package/build/src/prebuild/prebuildAsync.js.map +1 -0
  86. package/build/src/prebuild/resolveOptions.js +97 -0
  87. package/build/src/prebuild/resolveOptions.js.map +1 -0
  88. package/build/src/prebuild/resolveTemplate.js +157 -0
  89. package/build/src/prebuild/resolveTemplate.js.map +1 -0
  90. package/build/src/prebuild/updateFromTemplate.js +102 -0
  91. package/build/src/prebuild/updateFromTemplate.js.map +1 -0
  92. package/build/src/prebuild/updatePackageJson.js +236 -0
  93. package/build/src/prebuild/updatePackageJson.js.map +1 -0
  94. package/build/src/prebuild/writeMetroConfig.js +89 -0
  95. package/build/src/prebuild/writeMetroConfig.js.map +1 -0
  96. package/build/src/register/index.js +63 -0
  97. package/build/src/register/index.js.map +1 -0
  98. package/build/src/register/registerAsync.js +37 -0
  99. package/build/src/register/registerAsync.js.map +1 -0
  100. package/build/src/start/doctor/Prerequisite.js +47 -0
  101. package/build/src/start/doctor/Prerequisite.js.map +1 -0
  102. package/build/src/start/doctor/apple/SimulatorAppPrerequisite.js +68 -0
  103. package/build/src/start/doctor/apple/SimulatorAppPrerequisite.js.map +1 -0
  104. package/build/src/start/doctor/apple/XcodePrerequisite.js +115 -0
  105. package/build/src/start/doctor/apple/XcodePrerequisite.js.map +1 -0
  106. package/build/src/start/doctor/apple/XcrunPrerequisite.js +65 -0
  107. package/build/src/start/doctor/apple/XcrunPrerequisite.js.map +1 -0
  108. package/build/src/start/doctor/dependencies/bundledNativeModules.js +64 -0
  109. package/build/src/start/doctor/dependencies/bundledNativeModules.js.map +1 -0
  110. package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js +131 -0
  111. package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js.map +1 -0
  112. package/build/src/start/doctor/dependencies/getMissingPackages.js +95 -0
  113. package/build/src/start/doctor/dependencies/getMissingPackages.js.map +1 -0
  114. package/build/src/start/doctor/dependencies/getVersionedPackages.js +119 -0
  115. package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -0
  116. package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +147 -0
  117. package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -0
  118. package/build/src/start/doctor/ngrok/ExternalModule.js +164 -0
  119. package/build/src/start/doctor/ngrok/ExternalModule.js.map +1 -0
  120. package/build/src/start/doctor/ngrok/NgrokResolver.js +17 -0
  121. package/build/src/start/doctor/ngrok/NgrokResolver.js.map +1 -0
  122. package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js +142 -0
  123. package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js.map +1 -0
  124. package/build/src/start/doctor/typescript/updateTSConfig.js +92 -0
  125. package/build/src/start/doctor/typescript/updateTSConfig.js.map +1 -0
  126. package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js +112 -0
  127. package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js.map +1 -0
  128. package/build/src/start/index.js +126 -0
  129. package/build/src/start/index.js.map +1 -0
  130. package/build/src/start/interface/KeyPressHandler.js +99 -0
  131. package/build/src/start/interface/KeyPressHandler.js.map +1 -0
  132. package/build/src/start/interface/commandsTable.js +175 -0
  133. package/build/src/start/interface/commandsTable.js.map +1 -0
  134. package/build/src/start/interface/interactiveActions.js +134 -0
  135. package/build/src/start/interface/interactiveActions.js.map +1 -0
  136. package/build/src/start/interface/startInterface.js +217 -0
  137. package/build/src/start/interface/startInterface.js.map +1 -0
  138. package/build/src/start/platforms/AppIdResolver.js +44 -0
  139. package/build/src/start/platforms/AppIdResolver.js.map +1 -0
  140. package/build/src/start/platforms/DeviceManager.js +43 -0
  141. package/build/src/start/platforms/DeviceManager.js.map +1 -0
  142. package/build/src/start/platforms/ExpoGoInstaller.js +108 -0
  143. package/build/src/start/platforms/ExpoGoInstaller.js.map +1 -0
  144. package/build/src/start/platforms/PlatformManager.js +96 -0
  145. package/build/src/start/platforms/PlatformManager.js.map +1 -0
  146. package/build/src/start/platforms/android/ADBServer.js +127 -0
  147. package/build/src/start/platforms/android/ADBServer.js.map +1 -0
  148. package/build/src/start/platforms/android/AndroidAppIdResolver.js +40 -0
  149. package/build/src/start/platforms/android/AndroidAppIdResolver.js.map +1 -0
  150. package/build/src/start/platforms/android/AndroidDeviceManager.js +171 -0
  151. package/build/src/start/platforms/android/AndroidDeviceManager.js.map +1 -0
  152. package/build/src/start/platforms/android/AndroidPlatformManager.js +35 -0
  153. package/build/src/start/platforms/android/AndroidPlatformManager.js.map +1 -0
  154. package/build/src/start/platforms/android/activateWindow.js +78 -0
  155. package/build/src/start/platforms/android/activateWindow.js.map +1 -0
  156. package/build/src/start/platforms/android/adb.js +230 -0
  157. package/build/src/start/platforms/android/adb.js.map +1 -0
  158. package/build/src/start/platforms/android/adbReverse.js +84 -0
  159. package/build/src/start/platforms/android/adbReverse.js.map +1 -0
  160. package/build/src/start/platforms/android/emulator.js +118 -0
  161. package/build/src/start/platforms/android/emulator.js.map +1 -0
  162. package/build/src/start/platforms/android/getDevices.js +36 -0
  163. package/build/src/start/platforms/android/getDevices.js.map +1 -0
  164. package/build/src/start/platforms/android/promptAndroidDevice.js +60 -0
  165. package/build/src/start/platforms/android/promptAndroidDevice.js.map +1 -0
  166. package/build/src/start/platforms/ios/AppleAppIdResolver.js +46 -0
  167. package/build/src/start/platforms/ios/AppleAppIdResolver.js.map +1 -0
  168. package/build/src/start/platforms/ios/AppleDeviceManager.js +201 -0
  169. package/build/src/start/platforms/ios/AppleDeviceManager.js.map +1 -0
  170. package/build/src/start/platforms/ios/ApplePlatformManager.js +31 -0
  171. package/build/src/start/platforms/ios/ApplePlatformManager.js.map +1 -0
  172. package/build/src/start/platforms/ios/assertSystemRequirements.js +16 -0
  173. package/build/src/start/platforms/ios/assertSystemRequirements.js.map +1 -0
  174. package/build/src/start/platforms/ios/ensureSimulatorAppRunning.js +85 -0
  175. package/build/src/start/platforms/ios/ensureSimulatorAppRunning.js.map +1 -0
  176. package/build/src/start/platforms/ios/getBestSimulator.js +101 -0
  177. package/build/src/start/platforms/ios/getBestSimulator.js.map +1 -0
  178. package/build/src/start/platforms/ios/promptAppleDevice.js +60 -0
  179. package/build/src/start/platforms/ios/promptAppleDevice.js.map +1 -0
  180. package/build/src/start/platforms/ios/simctl.js +229 -0
  181. package/build/src/start/platforms/ios/simctl.js.map +1 -0
  182. package/build/src/start/platforms/ios/xcrun.js +67 -0
  183. package/build/src/start/platforms/ios/xcrun.js.map +1 -0
  184. package/build/src/start/project/devices.js +77 -0
  185. package/build/src/start/project/devices.js.map +1 -0
  186. package/build/src/start/project/dotExpo.js +74 -0
  187. package/build/src/start/project/dotExpo.js.map +1 -0
  188. package/build/src/start/project/settings.js +13 -0
  189. package/build/src/start/project/settings.js.map +1 -0
  190. package/build/src/start/resolveOptions.js +156 -0
  191. package/build/src/start/resolveOptions.js.map +1 -0
  192. package/build/src/start/server/AsyncNgrok.js +173 -0
  193. package/build/src/start/server/AsyncNgrok.js.map +1 -0
  194. package/build/src/start/server/BundlerDevServer.js +252 -0
  195. package/build/src/start/server/BundlerDevServer.js.map +1 -0
  196. package/build/src/start/server/DevServerManager.js +142 -0
  197. package/build/src/start/server/DevServerManager.js.map +1 -0
  198. package/build/src/start/server/DevelopmentSession.js +104 -0
  199. package/build/src/start/server/DevelopmentSession.js.map +1 -0
  200. package/build/src/start/server/UrlCreator.js +158 -0
  201. package/build/src/start/server/UrlCreator.js.map +1 -0
  202. package/build/src/start/server/metro/MetroBundlerDevServer.js +100 -0
  203. package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -0
  204. package/build/src/start/server/metro/MetroTerminalReporter.js +178 -0
  205. package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -0
  206. package/build/src/start/server/metro/TerminalReporter.js +87 -0
  207. package/build/src/start/server/metro/TerminalReporter.js.map +1 -0
  208. package/build/src/start/server/metro/TerminalReporter.types.js +6 -0
  209. package/build/src/start/server/metro/TerminalReporter.types.js.map +1 -0
  210. package/build/src/start/server/metro/instantiateMetro.js +53 -0
  211. package/build/src/start/server/metro/instantiateMetro.js.map +1 -0
  212. package/build/src/start/server/metro/resolveFromProject.js +38 -0
  213. package/build/src/start/server/metro/resolveFromProject.js.map +1 -0
  214. package/build/src/start/server/middleware/ClassicManifestMiddleware.js +145 -0
  215. package/build/src/start/server/middleware/ClassicManifestMiddleware.js.map +1 -0
  216. package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js +185 -0
  217. package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js.map +1 -0
  218. package/build/src/start/server/middleware/ExpoMiddleware.js +78 -0
  219. package/build/src/start/server/middleware/ExpoMiddleware.js.map +1 -0
  220. package/build/src/start/server/middleware/InterstitialPageMiddleware.js +70 -0
  221. package/build/src/start/server/middleware/InterstitialPageMiddleware.js.map +1 -0
  222. package/build/src/start/server/middleware/ManifestMiddleware.js +177 -0
  223. package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -0
  224. package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js +69 -0
  225. package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js.map +1 -0
  226. package/build/src/start/server/middleware/createDevServerMiddleware.js +24 -0
  227. package/build/src/start/server/middleware/createDevServerMiddleware.js.map +1 -0
  228. package/build/src/start/server/middleware/resolveAssets.js +107 -0
  229. package/build/src/start/server/middleware/resolveAssets.js.map +1 -0
  230. package/build/src/start/server/middleware/resolveEntryPoint.js +37 -0
  231. package/build/src/start/server/middleware/resolveEntryPoint.js.map +1 -0
  232. package/build/src/start/server/middleware/resolvePlatform.js +32 -0
  233. package/build/src/start/server/middleware/resolvePlatform.js.map +1 -0
  234. package/build/src/start/server/middleware/server.types.js +6 -0
  235. package/build/src/start/server/middleware/server.types.js.map +1 -0
  236. package/build/src/start/server/openPlatforms.js +30 -0
  237. package/build/src/start/server/openPlatforms.js.map +1 -0
  238. package/build/src/start/server/webpack/WebpackBundlerDevServer.js +303 -0
  239. package/build/src/start/server/webpack/WebpackBundlerDevServer.js.map +1 -0
  240. package/build/src/start/server/webpack/formatWebpackMessages.js +94 -0
  241. package/build/src/start/server/webpack/formatWebpackMessages.js.map +1 -0
  242. package/build/src/start/server/webpack/resolveFromProject.js +43 -0
  243. package/build/src/start/server/webpack/resolveFromProject.js.map +1 -0
  244. package/build/src/start/server/webpack/tls.js +72 -0
  245. package/build/src/start/server/webpack/tls.js.map +1 -0
  246. package/build/src/start/startAsync.js +150 -0
  247. package/build/src/start/startAsync.js.map +1 -0
  248. package/build/src/utils/FileNotifier.js +71 -0
  249. package/build/src/utils/FileNotifier.js.map +1 -0
  250. package/build/src/utils/analytics/getDevClientProperties.js +41 -0
  251. package/build/src/utils/analytics/getDevClientProperties.js.map +1 -0
  252. package/build/src/utils/analytics/rudderstackClient.js +106 -0
  253. package/build/src/utils/analytics/rudderstackClient.js.map +1 -0
  254. package/build/src/utils/ansi.js +17 -0
  255. package/build/src/utils/ansi.js.map +1 -0
  256. package/build/src/utils/args.js +63 -0
  257. package/build/src/utils/args.js.map +1 -0
  258. package/build/src/utils/array.js +27 -0
  259. package/build/src/utils/array.js.map +1 -0
  260. package/build/src/utils/cocoapods.js +143 -0
  261. package/build/src/utils/cocoapods.js.map +1 -0
  262. package/build/src/utils/codesigning.js +283 -0
  263. package/build/src/utils/codesigning.js.map +1 -0
  264. package/build/src/utils/createFileTransform.js +89 -0
  265. package/build/src/utils/createFileTransform.js.map +1 -0
  266. package/build/src/utils/delay.js +39 -0
  267. package/build/src/utils/delay.js.map +1 -0
  268. package/build/src/utils/dir.js +34 -0
  269. package/build/src/utils/dir.js.map +1 -0
  270. package/build/src/utils/downloadAppAsync.js +71 -0
  271. package/build/src/utils/downloadAppAsync.js.map +1 -0
  272. package/build/src/utils/downloadExpoGoAsync.js +93 -0
  273. package/build/src/utils/downloadExpoGoAsync.js.map +1 -0
  274. package/build/src/utils/editor.js +60 -0
  275. package/build/src/utils/editor.js.map +1 -0
  276. package/build/src/utils/env.js +59 -0
  277. package/build/src/utils/env.js.map +1 -0
  278. package/build/src/utils/errors.js +69 -0
  279. package/build/src/utils/errors.js.map +1 -0
  280. package/build/src/utils/exit.js +90 -0
  281. package/build/src/utils/exit.js.map +1 -0
  282. package/build/src/utils/findUp.js +33 -0
  283. package/build/src/utils/findUp.js.map +1 -0
  284. package/build/src/utils/fn.js +32 -0
  285. package/build/src/utils/fn.js.map +1 -0
  286. package/build/src/utils/getOrPromptApplicationId.js +183 -0
  287. package/build/src/utils/getOrPromptApplicationId.js.map +1 -0
  288. package/build/src/utils/getRunningProcess.js +92 -0
  289. package/build/src/utils/getRunningProcess.js.map +1 -0
  290. package/build/src/utils/git.js +88 -0
  291. package/build/src/utils/git.js.map +1 -0
  292. package/build/src/utils/glob.js +65 -0
  293. package/build/src/utils/glob.js.map +1 -0
  294. package/build/src/utils/ip.js +16 -0
  295. package/build/src/utils/ip.js.map +1 -0
  296. package/build/src/utils/isModuleSymlinked.js +37 -0
  297. package/build/src/utils/isModuleSymlinked.js.map +1 -0
  298. package/build/src/utils/link.js +31 -0
  299. package/build/src/utils/link.js.map +1 -0
  300. package/build/src/utils/mergeGitIgnorePaths.js +112 -0
  301. package/build/src/utils/mergeGitIgnorePaths.js.map +1 -0
  302. package/build/src/utils/modifyConfigAsync.js +68 -0
  303. package/build/src/utils/modifyConfigAsync.js.map +1 -0
  304. package/build/src/utils/modifyConfigPlugins.js +51 -0
  305. package/build/src/utils/modifyConfigPlugins.js.map +1 -0
  306. package/build/src/utils/nodeModules.js +118 -0
  307. package/build/src/utils/nodeModules.js.map +1 -0
  308. package/build/src/utils/npm.js +144 -0
  309. package/build/src/utils/npm.js.map +1 -0
  310. package/build/src/utils/obj.js +45 -0
  311. package/build/src/utils/obj.js.map +1 -0
  312. package/build/src/utils/ora.js +102 -0
  313. package/build/src/utils/ora.js.map +1 -0
  314. package/build/src/utils/port.js +130 -0
  315. package/build/src/utils/port.js.map +1 -0
  316. package/build/src/utils/profile.js +63 -0
  317. package/build/src/utils/profile.js.map +1 -0
  318. package/build/src/utils/progress.js +15 -0
  319. package/build/src/utils/progress.js.map +1 -0
  320. package/build/src/utils/prompts.js +127 -0
  321. package/build/src/utils/prompts.js.map +1 -0
  322. package/build/src/utils/scheme.js +106 -0
  323. package/build/src/utils/scheme.js.map +1 -0
  324. package/build/src/utils/tar.js +59 -0
  325. package/build/src/utils/tar.js.map +1 -0
  326. package/build/src/utils/url.js +67 -0
  327. package/build/src/utils/url.js.map +1 -0
  328. package/build/src/utils/validateApplicationId.js +90 -0
  329. package/build/src/utils/validateApplicationId.js.map +1 -0
  330. package/build/src/whoami/index.js +63 -0
  331. package/build/src/whoami/index.js.map +1 -0
  332. package/build/src/whoami/whoamiAsync.js +44 -0
  333. package/build/src/whoami/whoamiAsync.js.map +1 -0
  334. package/package.json +128 -4
  335. package/static/loading-page/index.html +270 -0
  336. package/index.js +0 -0
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ var _promises = _interopRequireDefault(require("fs/promises"));
6
+ var _path = _interopRequireDefault(require("path"));
7
+ var Log = _interopRequireWildcard(require("../../../log"));
8
+ var _dir = require("../../../utils/dir");
9
+ var _env = require("../../../utils/env");
10
+ var _glob = require("../../../utils/glob");
11
+ var _prerequisite = require("../Prerequisite");
12
+ var _ensureDependenciesAsync = require("../dependencies/ensureDependenciesAsync");
13
+ var _updateTSConfig = require("./updateTSConfig");
14
+ function _interopRequireDefault(obj) {
15
+ return obj && obj.__esModule ? obj : {
16
+ default: obj
17
+ };
18
+ }
19
+ function _interopRequireWildcard(obj) {
20
+ if (obj && obj.__esModule) {
21
+ return obj;
22
+ } else {
23
+ var newObj = {};
24
+ if (obj != null) {
25
+ for(var key in obj){
26
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
27
+ var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
28
+ if (desc.get || desc.set) {
29
+ Object.defineProperty(newObj, key, desc);
30
+ } else {
31
+ newObj[key] = obj[key];
32
+ }
33
+ }
34
+ }
35
+ }
36
+ newObj.default = obj;
37
+ return newObj;
38
+ }
39
+ }
40
+ class TypeScriptProjectPrerequisite extends _prerequisite.ProjectPrerequisite {
41
+ /** Ensure a project that hasn't explicitly disabled web support has all the required packages for running in the browser. */ async assertImplementation() {
42
+ if (_env.env.EXPO_NO_TYPESCRIPT_SETUP) {
43
+ Log.warn("Skipping TypeScript setup: EXPO_NO_TYPESCRIPT_SETUP is enabled.");
44
+ return;
45
+ }
46
+ Log.debug("Ensuring TypeScript support is setup");
47
+ const tsConfigPath = _path.default.join(this.projectRoot, "tsconfig.json");
48
+ // Ensure the project is TypeScript before continuing.
49
+ const intent = await this._getSetupRequirements();
50
+ if (!intent) {
51
+ return;
52
+ }
53
+ // Ensure TypeScript packages are installed
54
+ await this._ensureDependenciesInstalledAsync();
55
+ // Update the config
56
+ await (0, _updateTSConfig).updateTSConfigAsync({
57
+ tsConfigPath,
58
+ isBootstrapping: intent.isBootstrapping
59
+ });
60
+ }
61
+ /** Exposed for testing. */ async _getSetupRequirements() {
62
+ const tsConfigPath = await this._hasTSConfig();
63
+ // Enable TS setup if the project has a `tsconfig.json`
64
+ if (tsConfigPath) {
65
+ const content = await _promises.default.readFile(tsConfigPath, {
66
+ encoding: "utf8"
67
+ }).then((txt)=>txt.trim()
68
+ , // null when the file doesn't exist.
69
+ ()=>null
70
+ );
71
+ const isBlankConfig = content === "" || content === "{}";
72
+ return {
73
+ isBootstrapping: isBlankConfig
74
+ };
75
+ }
76
+ // This is a somewhat heavy check in larger projects.
77
+ // Test that this is reasonably paced by running expo start in `expo/apps/native-component-list`
78
+ const typescriptFile = await this._queryFirstTypeScriptFileAsync();
79
+ if (typescriptFile) {
80
+ return {
81
+ isBootstrapping: true
82
+ };
83
+ }
84
+ return null;
85
+ }
86
+ /** Exposed for testing. */ async _ensureDependenciesInstalledAsync({ exp } = {}) {
87
+ try {
88
+ return await (0, _ensureDependenciesAsync).ensureDependenciesAsync(this.projectRoot, {
89
+ exp,
90
+ installMessage: `It looks like you're trying to use TypeScript but don't have the required dependencies installed.`,
91
+ warningMessage: "If you're not using TypeScript, please remove the TypeScript files from your project",
92
+ requiredPackages: [
93
+ // use typescript/package.json to skip node module cache issues when the user installs
94
+ // the package and attempts to resolve the module in the same process.
95
+ {
96
+ file: "typescript/package.json",
97
+ pkg: "typescript"
98
+ },
99
+ {
100
+ file: "@types/react/index.d.ts",
101
+ pkg: "@types/react"
102
+ },
103
+ {
104
+ file: "@types/react-native/index.d.ts",
105
+ pkg: "@types/react-native"
106
+ },
107
+ ]
108
+ });
109
+ } catch (error) {
110
+ // Reset the cached check so we can re-run the check if the user re-runs the command by pressing 'w' in the Terminal UI.
111
+ this.resetAssertion();
112
+ throw error;
113
+ }
114
+ }
115
+ /** Return the first TypeScript file in the project. */ async _queryFirstTypeScriptFileAsync() {
116
+ const results = await (0, _glob).wrapGlobWithTimeout(()=>// TODO(Bacon): Use `everyMatch` since a bug causes `anyMatch` to return inaccurate results when used multiple times.
117
+ (0, _glob).everyMatchAsync("**/*.@(ts|tsx)", {
118
+ cwd: this.projectRoot,
119
+ ignore: [
120
+ "**/@(Carthage|Pods|node_modules)/**",
121
+ "**/*.d.ts",
122
+ "@(ios|android|web|web-build|dist)/**",
123
+ ]
124
+ })
125
+ , 5000);
126
+ if (results === false) {
127
+ return null;
128
+ }
129
+ var ref;
130
+ return (ref = results[0]) != null ? ref : null;
131
+ }
132
+ async _hasTSConfig() {
133
+ const tsConfigPath = _path.default.join(this.projectRoot, "tsconfig.json");
134
+ if (await (0, _dir).fileExistsAsync(tsConfigPath)) {
135
+ return tsConfigPath;
136
+ }
137
+ return null;
138
+ }
139
+ }
140
+ exports.TypeScriptProjectPrerequisite = TypeScriptProjectPrerequisite;
141
+
142
+ //# sourceMappingURL=TypeScriptProjectPrerequisite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/start/doctor/typescript/TypeScriptProjectPrerequisite.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport fs from 'fs/promises';\nimport path from 'path';\n\nimport * as Log from '../../../log';\nimport { fileExistsAsync } from '../../../utils/dir';\nimport { env } from '../../../utils/env';\nimport { everyMatchAsync, wrapGlobWithTimeout } from '../../../utils/glob';\nimport { ProjectPrerequisite } from '../Prerequisite';\nimport { ensureDependenciesAsync } from '../dependencies/ensureDependenciesAsync';\nimport { updateTSConfigAsync } from './updateTSConfig';\n\n/** Ensure the project has the required TypeScript support settings. */\nexport class TypeScriptProjectPrerequisite extends ProjectPrerequisite {\n /** Ensure a project that hasn't explicitly disabled web support has all the required packages for running in the browser. */\n async assertImplementation(): Promise<void> {\n if (env.EXPO_NO_TYPESCRIPT_SETUP) {\n Log.warn('Skipping TypeScript setup: EXPO_NO_TYPESCRIPT_SETUP is enabled.');\n return;\n }\n Log.debug('Ensuring TypeScript support is setup');\n\n const tsConfigPath = path.join(this.projectRoot, 'tsconfig.json');\n\n // Ensure the project is TypeScript before continuing.\n const intent = await this._getSetupRequirements();\n if (!intent) {\n return;\n }\n\n // Ensure TypeScript packages are installed\n await this._ensureDependenciesInstalledAsync();\n\n // Update the config\n await updateTSConfigAsync({ tsConfigPath, isBootstrapping: intent.isBootstrapping });\n }\n\n /** Exposed for testing. */\n async _getSetupRequirements(): Promise<{\n /** Indicates that TypeScript support is being bootstrapped. */\n isBootstrapping: boolean;\n } | null> {\n const tsConfigPath = await this._hasTSConfig();\n\n // Enable TS setup if the project has a `tsconfig.json`\n if (tsConfigPath) {\n const content = await fs.readFile(tsConfigPath, { encoding: 'utf8' }).then(\n (txt) => txt.trim(),\n // null when the file doesn't exist.\n () => null\n );\n const isBlankConfig = content === '' || content === '{}';\n return { isBootstrapping: isBlankConfig };\n }\n // This is a somewhat heavy check in larger projects.\n // Test that this is reasonably paced by running expo start in `expo/apps/native-component-list`\n const typescriptFile = await this._queryFirstTypeScriptFileAsync();\n if (typescriptFile) {\n return { isBootstrapping: true };\n }\n\n return null;\n }\n\n /** Exposed for testing. */\n async _ensureDependenciesInstalledAsync({ exp }: { exp?: ExpoConfig } = {}): Promise<boolean> {\n try {\n return await ensureDependenciesAsync(this.projectRoot, {\n exp,\n installMessage: `It looks like you're trying to use TypeScript but don't have the required dependencies installed.`,\n warningMessage:\n \"If you're not using TypeScript, please remove the TypeScript files from your project\",\n requiredPackages: [\n // use typescript/package.json to skip node module cache issues when the user installs\n // the package and attempts to resolve the module in the same process.\n { file: 'typescript/package.json', pkg: 'typescript' },\n { file: '@types/react/index.d.ts', pkg: '@types/react' },\n { file: '@types/react-native/index.d.ts', pkg: '@types/react-native' },\n ],\n });\n } catch (error) {\n // Reset the cached check so we can re-run the check if the user re-runs the command by pressing 'w' in the Terminal UI.\n this.resetAssertion();\n throw error;\n }\n }\n\n /** Return the first TypeScript file in the project. */\n async _queryFirstTypeScriptFileAsync(): Promise<null | string> {\n const results = await wrapGlobWithTimeout(\n () =>\n // TODO(Bacon): Use `everyMatch` since a bug causes `anyMatch` to return inaccurate results when used multiple times.\n everyMatchAsync('**/*.@(ts|tsx)', {\n cwd: this.projectRoot,\n ignore: [\n '**/@(Carthage|Pods|node_modules)/**',\n '**/*.d.ts',\n '@(ios|android|web|web-build|dist)/**',\n ],\n }),\n 5000\n );\n\n if (results === false) {\n return null;\n }\n return results[0] ?? null;\n }\n\n async _hasTSConfig(): Promise<string | null> {\n const tsConfigPath = path.join(this.projectRoot, 'tsconfig.json');\n if (await fileExistsAsync(tsConfigPath)) {\n return tsConfigPath;\n }\n return null;\n }\n}\n"],"names":["Log","TypeScriptProjectPrerequisite","ProjectPrerequisite","assertImplementation","env","EXPO_NO_TYPESCRIPT_SETUP","warn","debug","tsConfigPath","path","join","projectRoot","intent","_getSetupRequirements","_ensureDependenciesInstalledAsync","updateTSConfigAsync","isBootstrapping","_hasTSConfig","content","fs","readFile","encoding","then","txt","trim","isBlankConfig","typescriptFile","_queryFirstTypeScriptFileAsync","exp","ensureDependenciesAsync","installMessage","warningMessage","requiredPackages","file","pkg","error","resetAssertion","results","wrapGlobWithTimeout","everyMatchAsync","cwd","ignore","fileExistsAsync"],"mappings":"AAAA;;;;AACe,IAAA,SAAa,kCAAb,aAAa,EAAA;AACX,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEXA,IAAAA,GAAG,mCAAM,cAAc,EAApB;AACiB,IAAA,IAAoB,WAApB,oBAAoB,CAAA;AAChC,IAAA,IAAoB,WAApB,oBAAoB,CAAA;AACa,IAAA,KAAqB,WAArB,qBAAqB,CAAA;AACtC,IAAA,aAAiB,WAAjB,iBAAiB,CAAA;AACb,IAAA,wBAAyC,WAAzC,yCAAyC,CAAA;AAC7C,IAAA,eAAkB,WAAlB,kBAAkB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG/C,MAAMC,6BAA6B,SAASC,aAAmB,oBAAA;IACpE,6HAA6H,CAC7H,MAAMC,oBAAoB,GAAkB;QAC1C,IAAIC,IAAG,IAAA,CAACC,wBAAwB,EAAE;YAChCL,GAAG,CAACM,IAAI,CAAC,iEAAiE,CAAC,CAAC;YAC5E,OAAO;SACR;QACDN,GAAG,CAACO,KAAK,CAAC,sCAAsC,CAAC,CAAC;QAElD,MAAMC,YAAY,GAAGC,KAAI,QAAA,CAACC,IAAI,CAAC,IAAI,CAACC,WAAW,EAAE,eAAe,CAAC,AAAC;QAElE,sDAAsD;QACtD,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACC,qBAAqB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;KACb;CACF;QAvGYP,6BAA6B,GAA7BA,6BAA6B"}
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ exports.updateTSConfigAsync = updateTSConfigAsync;
6
+ exports.baseTSConfigName = void 0;
7
+ var _jsonFile = _interopRequireDefault(require("@expo/json-file"));
8
+ var _chalk = _interopRequireDefault(require("chalk"));
9
+ var Log = _interopRequireWildcard(require("../../../log"));
10
+ function _interopRequireDefault(obj) {
11
+ return obj && obj.__esModule ? obj : {
12
+ default: obj
13
+ };
14
+ }
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
+ }
36
+ const baseTSConfigName = "expo/tsconfig.base";
37
+ exports.baseTSConfigName = baseTSConfigName;
38
+ async function updateTSConfigAsync({ tsConfigPath , isBootstrapping }) {
39
+ if (isBootstrapping) {
40
+ await _jsonFile.default.writeAsync(tsConfigPath, {});
41
+ }
42
+ const projectTSConfig = _jsonFile.default.read(tsConfigPath, {
43
+ // Some tsconfig.json files have a generated comment in the file.
44
+ json5: true
45
+ });
46
+ if (projectTSConfig.compilerOptions == null) {
47
+ projectTSConfig.compilerOptions = {};
48
+ isBootstrapping = true;
49
+ }
50
+ const modifications = [];
51
+ // If the extends field isn't defined, set it to the expo default
52
+ if (!projectTSConfig.extends) {
53
+ // if (projectTSConfig.extends !== baseTSConfigName) {
54
+ projectTSConfig.extends = baseTSConfigName;
55
+ modifications.push([
56
+ "extends",
57
+ baseTSConfigName
58
+ ]);
59
+ }
60
+ // If no changes, then quietly bail out
61
+ if (!modifications.length) {
62
+ return;
63
+ }
64
+ // Write changes and log out a summary of what changed
65
+ await _jsonFile.default.writeAsync(tsConfigPath, projectTSConfig);
66
+ Log.log();
67
+ if (isBootstrapping) {
68
+ Log.log(_chalk.default`{bold TypeScript}: A {cyan tsconfig.json} has been auto-generated`);
69
+ } else {
70
+ Log.log(_chalk.default`{bold TypeScript}: The {cyan tsconfig.json} has been updated {dim (Use EXPO_NO_TYPESCRIPT_SETUP to skip)}`);
71
+ logModifications(modifications);
72
+ }
73
+ Log.log();
74
+ }
75
+ function logModifications(modifications) {
76
+ Log.log();
77
+ Log.log(`\u203A {bold Required} modifications made to the {cyan tsconfig.json}:`);
78
+ Log.log();
79
+ // Sort the items based on key name length
80
+ printTable(modifications.sort((a, b)=>a[0].length - b[0].length
81
+ ));
82
+ Log.log();
83
+ }
84
+ function printTable(items) {
85
+ const tableFormat = (name, msg)=>` ${_chalk.default.bold`${name}`} is now ${_chalk.default.cyan(msg)}`
86
+ ;
87
+ for (const [key, value] of items){
88
+ Log.log(tableFormat(key, value));
89
+ }
90
+ }
91
+
92
+ //# sourceMappingURL=updateTSConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/start/doctor/typescript/updateTSConfig.ts"],"sourcesContent":["import JsonFile from '@expo/json-file';\nimport chalk from 'chalk';\n\nimport * as Log from '../../../log';\n\nexport const baseTSConfigName = 'expo/tsconfig.base';\n\nexport async function updateTSConfigAsync({\n tsConfigPath,\n isBootstrapping,\n}: {\n tsConfigPath: string;\n isBootstrapping: boolean;\n}): Promise<void> {\n if (isBootstrapping) {\n await JsonFile.writeAsync(tsConfigPath, {});\n }\n\n const projectTSConfig = JsonFile.read(tsConfigPath, {\n // Some tsconfig.json files have a generated comment in the file.\n json5: true,\n });\n if (projectTSConfig.compilerOptions == null) {\n projectTSConfig.compilerOptions = {};\n isBootstrapping = true;\n }\n\n const modifications: [string, string][] = [];\n\n // If the extends field isn't defined, set it to the expo default\n if (!projectTSConfig.extends) {\n // if (projectTSConfig.extends !== baseTSConfigName) {\n projectTSConfig.extends = baseTSConfigName;\n modifications.push(['extends', baseTSConfigName]);\n }\n\n // If no changes, then quietly bail out\n if (!modifications.length) {\n return;\n }\n\n // Write changes and log out a summary of what changed\n await JsonFile.writeAsync(tsConfigPath, projectTSConfig);\n\n Log.log();\n\n if (isBootstrapping) {\n Log.log(chalk`{bold TypeScript}: A {cyan tsconfig.json} has been auto-generated`);\n } else {\n Log.log(\n chalk`{bold TypeScript}: The {cyan tsconfig.json} has been updated {dim (Use EXPO_NO_TYPESCRIPT_SETUP to skip)}`\n );\n logModifications(modifications);\n }\n Log.log();\n}\n\nfunction logModifications(modifications: string[][]) {\n Log.log();\n\n Log.log(`\\u203A {bold Required} modifications made to the {cyan tsconfig.json}:`);\n\n Log.log();\n\n // Sort the items based on key name length\n printTable(modifications.sort((a, b) => a[0].length - b[0].length));\n\n Log.log();\n}\n\nfunction printTable(items: string[][]) {\n const tableFormat = (name: string, msg: string) =>\n ` ${chalk.bold`${name}`} is now ${chalk.cyan(msg)}`;\n for (const [key, value] of items) {\n Log.log(tableFormat(key, value));\n }\n}\n"],"names":["updateTSConfigAsync","Log","baseTSConfigName","tsConfigPath","isBootstrapping","JsonFile","writeAsync","projectTSConfig","read","json5","compilerOptions","modifications","extends","push","length","log","chalk","logModifications","printTable","sort","a","b","items","tableFormat","name","msg","bold","cyan","key","value"],"mappings":"AAAA;;;;QAOsBA,mBAAmB,GAAnBA,mBAAmB;;AAPpB,IAAA,SAAiB,kCAAjB,iBAAiB,EAAA;AACpB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEbC,IAAAA,GAAG,mCAAM,cAAc,EAApB;;;;;;;;;;;;;;;;;;;;;;;;;;;AAER,MAAMC,gBAAgB,GAAG,oBAAoB,AAAC;QAAxCA,gBAAgB,GAAhBA,gBAAgB;AAEtB,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Vd,GAAG,CAACc,GAAG,CAAC,CAAC,sEAAsE,CAAC,CAAC,CAAC;IAElFd,GAAG,CAACc,GAAG,EAAE,CAAC;IAEV,0CAA0C;IAC1CG,UAAU,CAACP,aAAa,CAACQ,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,GAAKD,CAAC,CAAC,CAAC,CAAC,CAACN,MAAM,GAAGO,CAAC,CAAC,CAAC,CAAC,CAACP,MAAM;IAAA,CAAC,CAAC,CAAC;IAEpEb,GAAG,CAACc,GAAG,EAAE,CAAC;CACX;AAED,SAASG,UAAU,CAACI,KAAiB,EAAE;IACrC,MAAMC,WAAW,GAAG,CAACC,IAAY,EAAEC,GAAW,GAC5C,CAAC,EAAE,EAAET,MAAK,QAAA,CAACU,IAAI,CAAC,EAAEF,IAAI,CAAC,CAAC,CAAC,QAAQ,EAAER,MAAK,QAAA,CAACW,IAAI,CAACF,GAAG,CAAC,CAAC,CAAC;IAAC;IACvD,KAAK,MAAM,CAACG,GAAG,EAAEC,KAAK,CAAC,IAAIP,KAAK,CAAE;QAChCrB,GAAG,CAACc,GAAG,CAACQ,WAAW,CAACK,GAAG,EAAEC,KAAK,CAAC,CAAC,CAAC;KAClC;CACF"}
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ exports.isWebPlatformExcluded = isWebPlatformExcluded;
6
+ var _config = require("@expo/config");
7
+ var _chalk = _interopRequireDefault(require("chalk"));
8
+ var Log = _interopRequireWildcard(require("../../../log"));
9
+ var _env = require("../../../utils/env");
10
+ var _prerequisite = require("../Prerequisite");
11
+ var _ensureDependenciesAsync = require("../dependencies/ensureDependenciesAsync");
12
+ function _interopRequireDefault(obj) {
13
+ return obj && obj.__esModule ? obj : {
14
+ default: obj
15
+ };
16
+ }
17
+ function _interopRequireWildcard(obj) {
18
+ if (obj && obj.__esModule) {
19
+ return obj;
20
+ } else {
21
+ var newObj = {};
22
+ if (obj != null) {
23
+ for(var key in obj){
24
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
25
+ var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
26
+ if (desc.get || desc.set) {
27
+ Object.defineProperty(newObj, key, desc);
28
+ } else {
29
+ newObj[key] = obj[key];
30
+ }
31
+ }
32
+ }
33
+ }
34
+ newObj.default = obj;
35
+ return newObj;
36
+ }
37
+ }
38
+ class WebSupportProjectPrerequisite extends _prerequisite.ProjectPrerequisite {
39
+ /** Ensure a project that hasn't explicitly disabled web support has all the required packages for running in the browser. */ async assertImplementation() {
40
+ if (_env.env.EXPO_NO_WEB_SETUP) {
41
+ Log.warn("Skipping web setup: EXPO_NO_WEB_SETUP is enabled.");
42
+ return;
43
+ }
44
+ Log.debug("Ensuring web support is setup");
45
+ const result = await this._shouldSetupWebSupportAsync();
46
+ // Ensure web packages are installed
47
+ await this._ensureWebDependenciesInstalledAsync({
48
+ exp: result.exp
49
+ });
50
+ }
51
+ /** Exposed for testing. */ async _shouldSetupWebSupportAsync() {
52
+ const config = (0, _config).getConfig(this.projectRoot);
53
+ // Detect if the 'web' string is purposefully missing from the platforms array.
54
+ if (isWebPlatformExcluded(config.rootConfig)) {
55
+ // Get exact config description with paths.
56
+ const configName = (0, _config).getProjectConfigDescriptionWithPaths(this.projectRoot, config);
57
+ throw new _prerequisite.PrerequisiteCommandError("WEB_SUPPORT", _chalk.default`Skipping web setup: {bold "web"} is not included in the project ${configName} {bold "platforms"} array.`);
58
+ }
59
+ return config;
60
+ }
61
+ /** Exposed for testing. */ async _ensureWebDependenciesInstalledAsync({ exp }) {
62
+ try {
63
+ return await (0, _ensureDependenciesAsync).ensureDependenciesAsync(this.projectRoot, {
64
+ exp,
65
+ installMessage: `It looks like you're trying to use web support but don't have the required dependencies installed.`,
66
+ warningMessage: _chalk.default`If you're not using web, please remove the {bold "web"} string from the platforms array in the project Expo config.`,
67
+ requiredPackages: [
68
+ // use react-native-web/package.json to skip node module cache issues when the user installs
69
+ // the package and attempts to resolve the module in the same process.
70
+ {
71
+ file: "react-native-web/package.json",
72
+ pkg: "react-native-web",
73
+ version: "~0.17.1"
74
+ },
75
+ {
76
+ file: "react-dom/package.json",
77
+ pkg: "react-dom",
78
+ version: "^17.0.1"
79
+ },
80
+ // `webpack` and `webpack-dev-server` should be installed in the `@expo/webpack-config`
81
+ // package, but just in case we'll do the check now.
82
+ {
83
+ file: "webpack-dev-server/package.json",
84
+ // https://github.com/expo/expo-cli/pull/4282
85
+ pkg: "webpack-dev-server",
86
+ version: "~3.11.0",
87
+ dev: true
88
+ },
89
+ {
90
+ file: "@expo/webpack-config/package.json",
91
+ pkg: "@expo/webpack-config",
92
+ version: "~0.16.2",
93
+ dev: true
94
+ },
95
+ ]
96
+ });
97
+ } catch (error) {
98
+ // Reset the cached check so we can re-run the check if the user re-runs the command by pressing 'w' in the Terminal UI.
99
+ this.resetAssertion();
100
+ throw error;
101
+ }
102
+ }
103
+ }
104
+ exports.WebSupportProjectPrerequisite = WebSupportProjectPrerequisite;
105
+ function isWebPlatformExcluded(rootConfig) {
106
+ var ref, ref1, ref2;
107
+ // Detect if the 'web' string is purposefully missing from the platforms array.
108
+ const isWebExcluded = Array.isArray((ref = rootConfig.expo) == null ? void 0 : ref.platforms) && !!((ref1 = rootConfig.expo) == null ? void 0 : ref1.platforms.length) && !((ref2 = rootConfig.expo) == null ? void 0 : ref2.platforms.includes("web"));
109
+ return isWebExcluded;
110
+ }
111
+
112
+ //# sourceMappingURL=WebSupportProjectPrerequisite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/start/doctor/web/WebSupportProjectPrerequisite.ts"],"sourcesContent":["import {\n AppJSONConfig,\n ExpoConfig,\n getConfig,\n getProjectConfigDescriptionWithPaths,\n ProjectConfig,\n} from '@expo/config';\nimport chalk from 'chalk';\n\nimport * as Log from '../../../log';\nimport { env } from '../../../utils/env';\nimport { PrerequisiteCommandError, ProjectPrerequisite } from '../Prerequisite';\nimport { ensureDependenciesAsync } from '../dependencies/ensureDependenciesAsync';\n\n/** Ensure the project has the required web support settings. */\nexport class WebSupportProjectPrerequisite extends ProjectPrerequisite {\n /** Ensure a project that hasn't explicitly disabled web support has all the required packages for running in the browser. */\n async assertImplementation(): Promise<void> {\n if (env.EXPO_NO_WEB_SETUP) {\n Log.warn('Skipping web setup: EXPO_NO_WEB_SETUP is enabled.');\n return;\n }\n Log.debug('Ensuring web support is setup');\n\n const result = await this._shouldSetupWebSupportAsync();\n\n // Ensure web packages are installed\n await this._ensureWebDependenciesInstalledAsync({ exp: result.exp });\n }\n\n /** Exposed for testing. */\n async _shouldSetupWebSupportAsync(): Promise<ProjectConfig> {\n const config = getConfig(this.projectRoot);\n\n // Detect if the 'web' string is purposefully missing from the platforms array.\n if (isWebPlatformExcluded(config.rootConfig)) {\n // Get exact config description with paths.\n const configName = getProjectConfigDescriptionWithPaths(this.projectRoot, config);\n throw new PrerequisiteCommandError(\n 'WEB_SUPPORT',\n chalk`Skipping web setup: {bold \"web\"} is not included in the project ${configName} {bold \"platforms\"} array.`\n );\n }\n\n return config;\n }\n\n /** Exposed for testing. */\n async _ensureWebDependenciesInstalledAsync({ exp }: { exp: ExpoConfig }): Promise<boolean> {\n try {\n return await ensureDependenciesAsync(this.projectRoot, {\n exp,\n installMessage: `It looks like you're trying to use web support but don't have the required dependencies installed.`,\n warningMessage: chalk`If you're not using web, please remove the {bold \"web\"} string from the platforms array in the project Expo config.`,\n requiredPackages: [\n // use react-native-web/package.json to skip node module cache issues when the user installs\n // the package and attempts to resolve the module in the same process.\n { file: 'react-native-web/package.json', pkg: 'react-native-web', version: '~0.17.1' },\n { file: 'react-dom/package.json', pkg: 'react-dom', version: '^17.0.1' },\n // `webpack` and `webpack-dev-server` should be installed in the `@expo/webpack-config`\n // package, but just in case we'll do the check now.\n {\n file: 'webpack-dev-server/package.json',\n // https://github.com/expo/expo-cli/pull/4282\n pkg: 'webpack-dev-server',\n version: '~3.11.0',\n dev: true,\n },\n {\n file: '@expo/webpack-config/package.json',\n pkg: '@expo/webpack-config',\n version: '~0.16.2',\n dev: true,\n },\n ],\n });\n } catch (error) {\n // Reset the cached check so we can re-run the check if the user re-runs the command by pressing 'w' in the Terminal UI.\n this.resetAssertion();\n throw error;\n }\n }\n}\n\n/** Return `true` if the `web` platform is purposefully excluded from the project Expo config. */\nexport function isWebPlatformExcluded(rootConfig: AppJSONConfig): boolean {\n // Detect if the 'web' string is purposefully missing from the platforms array.\n const isWebExcluded =\n Array.isArray(rootConfig.expo?.platforms) &&\n !!rootConfig.expo?.platforms.length &&\n !rootConfig.expo?.platforms.includes('web');\n return isWebExcluded;\n}\n"],"names":["isWebPlatformExcluded","Log","WebSupportProjectPrerequisite","ProjectPrerequisite","assertImplementation","env","EXPO_NO_WEB_SETUP","warn","debug","result","_shouldSetupWebSupportAsync","_ensureWebDependenciesInstalledAsync","exp","config","getConfig","projectRoot","rootConfig","configName","getProjectConfigDescriptionWithPaths","PrerequisiteCommandError","chalk","ensureDependenciesAsync","installMessage","warningMessage","requiredPackages","file","pkg","version","dev","error","resetAssertion","isWebExcluded","Array","isArray","expo","platforms","length","includes"],"mappings":"AAAA;;;;QAqFgBA,qBAAqB,GAArBA,qBAAqB;AA/E9B,IAAA,OAAc,WAAd,cAAc,CAAA;AACH,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEbC,IAAAA,GAAG,mCAAM,cAAc,EAApB;AACK,IAAA,IAAoB,WAApB,oBAAoB,CAAA;AACsB,IAAA,aAAiB,WAAjB,iBAAiB,CAAA;AACvC,IAAA,wBAAyC,WAAzC,yCAAyC,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG1E,MAAMC,6BAA6B,SAASC,aAAmB,oBAAA;IACpE,6HAA6H,CAC7H,MAAMC,oBAAoB,GAAkB;QAC1C,IAAIC,IAAG,IAAA,CAACC,iBAAiB,EAAE;YACzBL,GAAG,CAACM,IAAI,CAAC,mDAAmD,CAAC,CAAC;YAC9D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+ exports.expoStart = void 0;
7
+ var _chalk = _interopRequireDefault(require("chalk"));
8
+ var Log = _interopRequireWildcard(require("../log"));
9
+ var _args = require("../utils/args");
10
+ var _errors = require("../utils/errors");
11
+ function _interopRequireDefault(obj) {
12
+ return obj && obj.__esModule ? obj : {
13
+ default: obj
14
+ };
15
+ }
16
+ function _interopRequireWildcard(obj) {
17
+ if (obj && obj.__esModule) {
18
+ return obj;
19
+ } else {
20
+ var newObj = {};
21
+ if (obj != null) {
22
+ for(var key in obj){
23
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
24
+ var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
25
+ if (desc.get || desc.set) {
26
+ Object.defineProperty(newObj, key, desc);
27
+ } else {
28
+ newObj[key] = obj[key];
29
+ }
30
+ }
31
+ }
32
+ }
33
+ newObj.default = obj;
34
+ return newObj;
35
+ }
36
+ }
37
+ const expoStart = async (argv)=>{
38
+ const args = (0, _args).assertArgs({
39
+ // Types
40
+ "--help": Boolean,
41
+ "--clear": Boolean,
42
+ "--max-workers": Number,
43
+ "--no-dev": Boolean,
44
+ "--minify": Boolean,
45
+ "--https": Boolean,
46
+ "--force-manifest-type": String,
47
+ "--private-key-path": String,
48
+ "--port": Number,
49
+ "--dev-client": Boolean,
50
+ "--scheme": String,
51
+ "--android": Boolean,
52
+ "--ios": Boolean,
53
+ "--web": Boolean,
54
+ "--host": String,
55
+ "--tunnel": Boolean,
56
+ "--lan": Boolean,
57
+ "--localhost": Boolean,
58
+ "--offline": Boolean,
59
+ // Aliases
60
+ "-h": "--help",
61
+ "-c": "--clear",
62
+ "-p": "--port",
63
+ "-a": "--android",
64
+ "-i": "--ios",
65
+ "-w": "--web",
66
+ "-m": "--host"
67
+ }, argv);
68
+ if (args["--help"]) {
69
+ Log.exit(_chalk.default`
70
+ {bold Description}
71
+ Start a local dev server for the app
72
+
73
+ {bold Usage}
74
+ $ npx expo start <dir>
75
+
76
+ <dir> is the directory of the Expo project.
77
+ Defaults to the current working directory.
78
+
79
+ {bold Options}
80
+ -a, --android Opens your app in Expo Go on a connected Android device
81
+ -i, --ios Opens your app in Expo Go in a currently running iOS simulator on your computer
82
+ -w, --web Opens your app in a web browser
83
+
84
+ -c, --clear Clear the bundler cache
85
+ --max-workers <num> Maximum number of tasks to allow Metro to spawn
86
+ --no-dev Bundle in production mode
87
+ --minify Minify JavaScript
88
+
89
+ -m, --host <mode> lan, tunnel, localhost. Dev server hosting type. Default: lan.
90
+ - lan: Use the local network
91
+ - tunnel: Use any network by tunnel through ngrok
92
+ - localhost: Connect to the dev server over localhost
93
+ --tunnel Same as --host tunnel
94
+ --lan Same as --host lan
95
+ --localhost Same as --host localhost
96
+
97
+ --offline Skip network requests and use anonymous manifest signatures
98
+ --https Start the dev server with https protocol
99
+ --scheme <scheme> Custom URI protocol to use when launching an app
100
+ -p, --port <port> Port to start the dev server on (does not apply to web or tunnel). Default: 19000
101
+
102
+ --dev-client Experimental: Starts the bundler for use with the expo-development-client
103
+ --force-manifest-type <manifest-type> Override auto detection of manifest type
104
+ --private-key-path <path> Path to private key for code signing. Default: "private-key.pem" in the same directory as the certificate specified by the expo-updates configuration in app.json.
105
+ -h, --help output usage information
106
+ `, 0);
107
+ }
108
+ const projectRoot = (0, _args).getProjectRoot(args);
109
+ const { resolveOptionsAsync } = await Promise.resolve().then(function() {
110
+ return _interopRequireWildcard(require("./resolveOptions"));
111
+ });
112
+ const options = await resolveOptionsAsync(projectRoot, args).catch(_errors.logCmdError);
113
+ const { APISettings } = await Promise.resolve().then(function() {
114
+ return _interopRequireWildcard(require("../api/settings"));
115
+ });
116
+ APISettings.isOffline = options.offline;
117
+ const { startAsync } = await Promise.resolve().then(function() {
118
+ return _interopRequireWildcard(require("./startAsync"));
119
+ });
120
+ return startAsync(projectRoot, options, {
121
+ webOnly: false
122
+ }).catch(_errors.logCmdError);
123
+ };
124
+ exports.expoStart = expoStart;
125
+
126
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/start/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk';\n\nimport { Command } from '../../bin/cli';\nimport * as Log from '../log';\nimport { assertArgs, getProjectRoot } from '../utils/args';\nimport { logCmdError } from '../utils/errors';\n\nexport const expoStart: Command = async (argv) => {\n const args = assertArgs(\n {\n // Types\n '--help': Boolean,\n '--clear': Boolean,\n '--max-workers': Number,\n '--no-dev': Boolean,\n '--minify': Boolean,\n '--https': Boolean,\n '--force-manifest-type': String,\n '--private-key-path': String,\n '--port': Number,\n '--dev-client': Boolean,\n '--scheme': String,\n '--android': Boolean,\n '--ios': Boolean,\n '--web': Boolean,\n '--host': String,\n '--tunnel': Boolean,\n '--lan': Boolean,\n '--localhost': Boolean,\n '--offline': Boolean,\n // Aliases\n '-h': '--help',\n '-c': '--clear',\n '-p': '--port',\n '-a': '--android',\n '-i': '--ios',\n '-w': '--web',\n '-m': '--host',\n },\n argv\n );\n\n if (args['--help']) {\n Log.exit(\n chalk`\n {bold Description}\n Start a local dev server for the app\n\n {bold Usage}\n $ npx expo start <dir>\n\n <dir> is the directory of the Expo project.\n Defaults to the current working directory.\n\n {bold Options}\n -a, --android Opens your app in Expo Go on a connected Android device\n -i, --ios Opens your app in Expo Go in a currently running iOS simulator on your computer\n -w, --web Opens your app in a web browser\n\n -c, --clear Clear the bundler cache\n --max-workers <num> Maximum number of tasks to allow Metro to spawn\n --no-dev Bundle in production mode\n --minify Minify JavaScript\n\n -m, --host <mode> lan, tunnel, localhost. Dev server hosting type. Default: lan.\n - lan: Use the local network\n - tunnel: Use any network by tunnel through ngrok\n - localhost: Connect to the dev server over localhost\n --tunnel Same as --host tunnel\n --lan Same as --host lan\n --localhost Same as --host localhost\n\n --offline Skip network requests and use anonymous manifest signatures\n --https Start the dev server with https protocol\n --scheme <scheme> Custom URI protocol to use when launching an app\n -p, --port <port> Port to start the dev server on (does not apply to web or tunnel). Default: 19000\n\n --dev-client Experimental: Starts the bundler for use with the expo-development-client\n --force-manifest-type <manifest-type> Override auto detection of manifest type\n --private-key-path <path> Path to private key for code signing. Default: \"private-key.pem\" in the same directory as the certificate specified by the expo-updates configuration in app.json.\n -h, --help output usage information\n`,\n 0\n );\n }\n\n const projectRoot = getProjectRoot(args);\n const { resolveOptionsAsync } = await import('./resolveOptions');\n const options = await resolveOptionsAsync(projectRoot, args).catch(logCmdError);\n\n const { APISettings } = await import('../api/settings');\n APISettings.isOffline = options.offline;\n\n const { startAsync } = await import('./startAsync');\n return startAsync(projectRoot, options, { webOnly: false }).catch(logCmdError);\n};\n"],"names":["Log","expoStart","argv","args","assertArgs","Boolean","Number","String","exit","chalk","projectRoot","getProjectRoot","resolveOptionsAsync","options","catch","logCmdError","APISettings","isOffline","offline","startAsync","webOnly"],"mappings":"AAAA;;;;;;AACkB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAGbA,IAAAA,GAAG,mCAAM,QAAQ,EAAd;AAC4B,IAAA,KAAe,WAAf,eAAe,CAAA;AAC9B,IAAA,OAAiB,WAAjB,iBAAiB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtC,MAAMC,SAAS,GAAY,OAAOC,IAAI,GAAK;IAChD,MAAMC,IAAI,GAAGC,CAAAA,GAAAA,KAAU,AAgCtB,CAAA,WAhCsB,CACrB;QACE,QAAQ;QACR,QAAQ,EAAEC,OAAO;QACjB,SAAS,EAAEA,OAAO;QAClB,eAAe,EAAEC,MAAM;QACvB,UAAU,EAAED,OAAO;QACnB,UAAU,EAAEA,OAAO;QACnB,SAAS,EAAEA,OAAO;QAClB,uBAAuB,EAAEE,MAAM;QAC/B,oBAAoB,EAAEA,MAAM;QAC5B,QAAQ,EAAED,MAAM;QAChB,cAAc,EAAED,OAAO;QACvB,UAAU,EAAEE,MAAM;QAClB,WAAW,EAAEF,OAAO;QACpB,OAAO,EAAEA,OAAO;QAChB,OAAO,EAAEA,OAAO;QAChB,QAAQ,EAAEE,MAAM;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= _interopRequireWildcard(require("../../log"));
6
+ var _errors = require("../../utils/errors");
7
+ function _interopRequireWildcard(obj) {
8
+ if (obj && obj.__esModule) {
9
+ return obj;
10
+ } else {
11
+ var newObj = {};
12
+ if (obj != null) {
13
+ for(var key in obj){
14
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
15
+ var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
16
+ if (desc.get || desc.set) {
17
+ Object.defineProperty(newObj, key, desc);
18
+ } else {
19
+ newObj[key] = obj[key];
20
+ }
21
+ }
22
+ }
23
+ }
24
+ newObj.default = obj;
25
+ return newObj;
26
+ }
27
+ }
28
+ const CTRL_C = "\x03";
29
+ class KeyPressHandler {
30
+ constructor(onPress){
31
+ this.onPress = onPress;
32
+ this.isInterceptingKeyStrokes = false;
33
+ this.isHandlingKeyPress = false;
34
+ this.handleKeypress = async (key)=>{
35
+ // Prevent sending another event until the previous event has finished.
36
+ if (this.isHandlingKeyPress && key !== CTRL_C) {
37
+ return;
38
+ }
39
+ this.isHandlingKeyPress = true;
40
+ try {
41
+ await this.onPress(key);
42
+ } catch (error) {
43
+ await (0, _errors).logCmdError(error);
44
+ } finally{
45
+ this.isHandlingKeyPress = false;
46
+ }
47
+ };
48
+ }
49
+ /** Start observing interaction pause listeners. */ createInteractionListener() {
50
+ // Support observing prompts.
51
+ let wasIntercepting = false;
52
+ const listener = ({ pause })=>{
53
+ if (pause) {
54
+ // Track if we were already intercepting key strokes before pausing, so we can
55
+ // resume after pausing.
56
+ wasIntercepting = this.isInterceptingKeyStrokes;
57
+ this.stopInterceptingKeyStrokes();
58
+ } else if (wasIntercepting) {
59
+ // Only start if we were previously intercepting.
60
+ this.startInterceptingKeyStrokes();
61
+ }
62
+ };
63
+ return listener;
64
+ }
65
+ /** Start intercepting all key strokes and passing them to the input `onPress` method. */ startInterceptingKeyStrokes() {
66
+ if (this.isInterceptingKeyStrokes) {
67
+ return;
68
+ }
69
+ this.isInterceptingKeyStrokes = true;
70
+ const { stdin } = process;
71
+ // TODO: This might be here because of an old Node version.
72
+ if (!stdin.setRawMode) {
73
+ Log.warn("Using a non-interactive terminal, keyboard commands are disabled.");
74
+ return;
75
+ }
76
+ stdin.setRawMode(true);
77
+ stdin.resume();
78
+ stdin.setEncoding("utf8");
79
+ stdin.on("data", this.handleKeypress);
80
+ }
81
+ /** Stop intercepting all key strokes. */ stopInterceptingKeyStrokes() {
82
+ if (!this.isInterceptingKeyStrokes) {
83
+ return;
84
+ }
85
+ this.isInterceptingKeyStrokes = false;
86
+ const { stdin } = process;
87
+ stdin.removeListener("data", this.handleKeypress);
88
+ // TODO: This might be here because of an old Node version.
89
+ if (!stdin.setRawMode) {
90
+ Log.warn("Using a non-interactive terminal, keyboard commands are disabled.");
91
+ return;
92
+ }
93
+ stdin.setRawMode(false);
94
+ stdin.resume();
95
+ }
96
+ }
97
+ exports.KeyPressHandler = KeyPressHandler;
98
+
99
+ //# sourceMappingURL=KeyPressHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/start/interface/KeyPressHandler.ts"],"sourcesContent":["import * as Log from '../../log';\nimport { logCmdError } from '../../utils/errors';\n\nconst CTRL_C = '\\u0003';\n\n/** An abstract key stroke interceptor. */\nexport class KeyPressHandler {\n private isInterceptingKeyStrokes = false;\n private isHandlingKeyPress = false;\n\n constructor(public onPress: (key: string) => Promise<any>) {}\n\n /** Start observing interaction pause listeners. */\n createInteractionListener() {\n // Support observing prompts.\n let wasIntercepting = false;\n\n const listener = ({ pause }: { pause: boolean }) => {\n if (pause) {\n // Track if we were already intercepting key strokes before pausing, so we can\n // resume after pausing.\n wasIntercepting = this.isInterceptingKeyStrokes;\n this.stopInterceptingKeyStrokes();\n } else if (wasIntercepting) {\n // Only start if we were previously intercepting.\n this.startInterceptingKeyStrokes();\n }\n };\n\n return listener;\n }\n\n private handleKeypress = async (key: string) => {\n // Prevent sending another event until the previous event has finished.\n if (this.isHandlingKeyPress && key !== CTRL_C) {\n return;\n }\n this.isHandlingKeyPress = true;\n try {\n await this.onPress(key);\n } catch (error: any) {\n await logCmdError(error);\n } finally {\n this.isHandlingKeyPress = false;\n }\n };\n\n /** Start intercepting all key strokes and passing them to the input `onPress` method. */\n startInterceptingKeyStrokes() {\n if (this.isInterceptingKeyStrokes) {\n return;\n }\n this.isInterceptingKeyStrokes = true;\n const { stdin } = process;\n // TODO: This might be here because of an old Node version.\n if (!stdin.setRawMode) {\n Log.warn('Using a non-interactive terminal, keyboard commands are disabled.');\n return;\n }\n stdin.setRawMode(true);\n stdin.resume();\n stdin.setEncoding('utf8');\n stdin.on('data', this.handleKeypress);\n }\n\n /** Stop intercepting all key strokes. */\n stopInterceptingKeyStrokes() {\n if (!this.isInterceptingKeyStrokes) {\n return;\n }\n this.isInterceptingKeyStrokes = false;\n const { stdin } = process;\n stdin.removeListener('data', this.handleKeypress);\n // TODO: This might be here because of an old Node version.\n if (!stdin.setRawMode) {\n Log.warn('Using a non-interactive terminal, keyboard commands are disabled.');\n return;\n }\n stdin.setRawMode(false);\n stdin.resume();\n }\n}\n"],"names":["Log","CTRL_C","KeyPressHandler","constructor","onPress","isInterceptingKeyStrokes","isHandlingKeyPress","handleKeypress","key","error","logCmdError","createInteractionListener","wasIntercepting","listener","pause","stopInterceptingKeyStrokes","startInterceptingKeyStrokes","stdin","process","setRawMode","warn","resume","setEncoding","on","removeListener"],"mappings":"AAAA;;;;AAAYA,IAAAA,GAAG,mCAAM,WAAW,EAAjB;AACa,IAAA,OAAoB,WAApB,oBAAoB,CAAA;;;;;;;;;;;;;;;;;;;;;;AAEhD,MAAMC,MAAM,GAAG,MAAQ,AAAC;AAGjB,MAAMC,eAAe;IAI1BC,YAAmBC,OAAsC,CAAE;aAAxCA,OAAsC,GAAtCA,OAAsC;aAHjDC,wBAAwB,GAAG,KAAK;aAChCC,kBAAkB,GAAG,KAAK;aAwB1BC,cAAc,GAAG,OAAOC,GAAW,GAAK;YAC9C,uEAAu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