@shopify/cli-kit 0.0.0-nightly-20230110194301

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 (488) hide show
  1. package/LICENSE +8 -0
  2. package/README.md +63 -0
  3. package/assets/auth-error.html +23 -0
  4. package/assets/empty-url.html +23 -0
  5. package/assets/favicon.svg +26 -0
  6. package/assets/missing-code.html +23 -0
  7. package/assets/missing-state.html +23 -0
  8. package/assets/style.css +58 -0
  9. package/assets/success.html +20 -0
  10. package/dist/api/admin.d.ts +3 -0
  11. package/dist/api/admin.js +56 -0
  12. package/dist/api/admin.js.map +1 -0
  13. package/dist/api/common.d.ts +21 -0
  14. package/dist/api/common.js +87 -0
  15. package/dist/api/common.js.map +1 -0
  16. package/dist/api/graphql/all_app_extension_registrations.d.ts +20 -0
  17. package/dist/api/graphql/all_app_extension_registrations.js +20 -0
  18. package/dist/api/graphql/all_app_extension_registrations.js.map +1 -0
  19. package/dist/api/graphql/all_dev_stores_by_org.d.ts +18 -0
  20. package/dist/api/graphql/all_dev_stores_by_org.js +21 -0
  21. package/dist/api/graphql/all_dev_stores_by_org.js.map +1 -0
  22. package/dist/api/graphql/all_orgs.d.ts +12 -0
  23. package/dist/api/graphql/all_orgs.js +14 -0
  24. package/dist/api/graphql/all_orgs.js.map +1 -0
  25. package/dist/api/graphql/convert_dev_to_test_store.d.ts +16 -0
  26. package/dist/api/graphql/convert_dev_to_test_store.js +13 -0
  27. package/dist/api/graphql/convert_dev_to_test_store.js.map +1 -0
  28. package/dist/api/graphql/create_app.d.ts +29 -0
  29. package/dist/api/graphql/create_app.js +33 -0
  30. package/dist/api/graphql/create_app.js.map +1 -0
  31. package/dist/api/graphql/create_deployment.d.ts +33 -0
  32. package/dist/api/graphql/create_deployment.js +25 -0
  33. package/dist/api/graphql/create_deployment.js.map +1 -0
  34. package/dist/api/graphql/extension_create.d.ts +30 -0
  35. package/dist/api/graphql/extension_create.js +26 -0
  36. package/dist/api/graphql/extension_create.js.map +1 -0
  37. package/dist/api/graphql/extension_specifications.d.ts +27 -0
  38. package/dist/api/graphql/extension_specifications.js +22 -0
  39. package/dist/api/graphql/extension_specifications.js.map +1 -0
  40. package/dist/api/graphql/find_app.d.ts +14 -0
  41. package/dist/api/graphql/find_app.js +17 -0
  42. package/dist/api/graphql/find_app.js.map +1 -0
  43. package/dist/api/graphql/find_org.d.ts +18 -0
  44. package/dist/api/graphql/find_org.js +21 -0
  45. package/dist/api/graphql/find_org.js.map +1 -0
  46. package/dist/api/graphql/find_org_basic.d.ts +11 -0
  47. package/dist/api/graphql/find_org_basic.js +14 -0
  48. package/dist/api/graphql/find_org_basic.js.map +1 -0
  49. package/dist/api/graphql/find_store_by_domain.d.ts +21 -0
  50. package/dist/api/graphql/find_store_by_domain.js +24 -0
  51. package/dist/api/graphql/find_store_by_domain.js.map +1 -0
  52. package/dist/api/graphql/functions/api_schema_definition.d.ts +9 -0
  53. package/dist/api/graphql/functions/api_schema_definition.js +7 -0
  54. package/dist/api/graphql/functions/api_schema_definition.js.map +1 -0
  55. package/dist/api/graphql/functions/app_function_set.d.ts +30 -0
  56. package/dist/api/graphql/functions/app_function_set.js +38 -0
  57. package/dist/api/graphql/functions/app_function_set.js.map +1 -0
  58. package/dist/api/graphql/functions/function_service_proxy.d.ts +4 -0
  59. package/dist/api/graphql/functions/function_service_proxy.js +7 -0
  60. package/dist/api/graphql/functions/function_service_proxy.js.map +1 -0
  61. package/dist/api/graphql/functions/upload_url_generate.d.ts +12 -0
  62. package/dist/api/graphql/functions/upload_url_generate.js +11 -0
  63. package/dist/api/graphql/functions/upload_url_generate.js.map +1 -0
  64. package/dist/api/graphql/generate_signed_upload_url.d.ts +15 -0
  65. package/dist/api/graphql/generate_signed_upload_url.js +15 -0
  66. package/dist/api/graphql/generate_signed_upload_url.js.map +1 -0
  67. package/dist/api/graphql/get_urls.d.ts +10 -0
  68. package/dist/api/graphql/get_urls.js +10 -0
  69. package/dist/api/graphql/get_urls.js.map +1 -0
  70. package/dist/api/graphql/get_variant_id.d.ts +17 -0
  71. package/dist/api/graphql/get_variant_id.js +20 -0
  72. package/dist/api/graphql/get_variant_id.js.map +1 -0
  73. package/dist/api/graphql/index.d.ts +21 -0
  74. package/dist/api/graphql/index.js +22 -0
  75. package/dist/api/graphql/index.js.map +1 -0
  76. package/dist/api/graphql/update_draft.d.ts +33 -0
  77. package/dist/api/graphql/update_draft.js +24 -0
  78. package/dist/api/graphql/update_draft.js.map +1 -0
  79. package/dist/api/graphql/update_urls.d.ts +14 -0
  80. package/dist/api/graphql/update_urls.js +12 -0
  81. package/dist/api/graphql/update_urls.js.map +1 -0
  82. package/dist/api/identity.d.ts +1 -0
  83. package/dist/api/identity.js +41 -0
  84. package/dist/api/identity.js.map +1 -0
  85. package/dist/api/oxygen.d.ts +5 -0
  86. package/dist/api/oxygen.js +30 -0
  87. package/dist/api/oxygen.js.map +1 -0
  88. package/dist/api/partners.d.ts +14 -0
  89. package/dist/api/partners.js +44 -0
  90. package/dist/api/partners.js.map +1 -0
  91. package/dist/api.d.ts +6 -0
  92. package/dist/api.js +7 -0
  93. package/dist/api.js.map +1 -0
  94. package/dist/cli.d.ts +8 -0
  95. package/dist/cli.js +18 -0
  96. package/dist/cli.js.map +1 -0
  97. package/dist/constants.d.ts +52 -0
  98. package/dist/constants.js +71 -0
  99. package/dist/constants.js.map +1 -0
  100. package/dist/content-tokens.d.ts +44 -0
  101. package/dist/content-tokens.js +105 -0
  102. package/dist/content-tokens.js.map +1 -0
  103. package/dist/environment/fqdn.d.ts +29 -0
  104. package/dist/environment/fqdn.js +72 -0
  105. package/dist/environment/fqdn.js.map +1 -0
  106. package/dist/environment/local.d.ts +92 -0
  107. package/dist/environment/local.js +169 -0
  108. package/dist/environment/local.js.map +1 -0
  109. package/dist/environment/service.d.ts +4 -0
  110. package/dist/environment/service.js +19 -0
  111. package/dist/environment/service.js.map +1 -0
  112. package/dist/environment/spin-cache.d.ts +2 -0
  113. package/dist/environment/spin-cache.js +8 -0
  114. package/dist/environment/spin-cache.js.map +1 -0
  115. package/dist/environment/spin.d.ts +50 -0
  116. package/dist/environment/spin.js +99 -0
  117. package/dist/environment/spin.js.map +1 -0
  118. package/dist/environment/utilities.d.ts +8 -0
  119. package/dist/environment/utilities.js +19 -0
  120. package/dist/environment/utilities.js.map +1 -0
  121. package/dist/environment.d.ts +7 -0
  122. package/dist/environment.js +8 -0
  123. package/dist/environment.js.map +1 -0
  124. package/dist/error.d.ts +68 -0
  125. package/dist/error.js +143 -0
  126. package/dist/error.js.map +1 -0
  127. package/dist/file.d.ts +98 -0
  128. package/dist/file.js +216 -0
  129. package/dist/file.js.map +1 -0
  130. package/dist/git.d.ts +36 -0
  131. package/dist/git.js +133 -0
  132. package/dist/git.js.map +1 -0
  133. package/dist/http/fetch.d.ts +22 -0
  134. package/dist/http/fetch.js +44 -0
  135. package/dist/http/fetch.js.map +1 -0
  136. package/dist/http/formdata.d.ts +3 -0
  137. package/dist/http/formdata.js +6 -0
  138. package/dist/http/formdata.js.map +1 -0
  139. package/dist/http/graphql.d.ts +13 -0
  140. package/dist/http/graphql.js +12 -0
  141. package/dist/http/graphql.js.map +1 -0
  142. package/dist/http.d.ts +27 -0
  143. package/dist/http.js +32 -0
  144. package/dist/http.js.map +1 -0
  145. package/dist/index.d.ts +24 -0
  146. package/dist/index.js +25 -0
  147. package/dist/index.js.map +1 -0
  148. package/dist/metadata.d.ts +53 -0
  149. package/dist/metadata.js +62 -0
  150. package/dist/metadata.js.map +1 -0
  151. package/dist/monorail.d.ts +100 -0
  152. package/dist/monorail.js +39 -0
  153. package/dist/monorail.js.map +1 -0
  154. package/dist/network/api.d.ts +2 -0
  155. package/dist/network/api.js +2 -0
  156. package/dist/network/api.js.map +1 -0
  157. package/dist/network/service.d.ts +14 -0
  158. package/dist/network/service.js +11 -0
  159. package/dist/network/service.js.map +1 -0
  160. package/dist/npm.d.ts +27 -0
  161. package/dist/npm.js +20 -0
  162. package/dist/npm.js.map +1 -0
  163. package/dist/output.d.ts +129 -0
  164. package/dist/output.js +310 -0
  165. package/dist/output.js.map +1 -0
  166. package/dist/path.d.ts +25 -0
  167. package/dist/path.js +48 -0
  168. package/dist/path.js.map +1 -0
  169. package/dist/plugins.d.ts +73 -0
  170. package/dist/plugins.js +49 -0
  171. package/dist/plugins.js.map +1 -0
  172. package/dist/private/common/json.d.ts +6 -0
  173. package/dist/private/common/json.js +2 -0
  174. package/dist/private/common/json.js.map +1 -0
  175. package/dist/private/common/lodash.d.ts +47 -0
  176. package/dist/private/common/lodash.js +2 -0
  177. package/dist/private/common/lodash.js.map +1 -0
  178. package/dist/private/node/analytics.d.ts +27 -0
  179. package/dist/private/node/analytics.js +57 -0
  180. package/dist/private/node/analytics.js.map +1 -0
  181. package/dist/private/node/ui/alert.d.ts +2 -0
  182. package/dist/private/node/ui/alert.js +18 -0
  183. package/dist/private/node/ui/alert.js.map +1 -0
  184. package/dist/private/node/ui/components/Alert.d.ts +17 -0
  185. package/dist/private/node/ui/components/Alert.js +21 -0
  186. package/dist/private/node/ui/components/Alert.js.map +1 -0
  187. package/dist/private/node/ui/components/Alert.test.d.ts +1 -0
  188. package/dist/private/node/ui/components/Alert.test.js +95 -0
  189. package/dist/private/node/ui/components/Alert.test.js.map +1 -0
  190. package/dist/private/node/ui/components/Banner.d.ts +8 -0
  191. package/dist/private/node/ui/components/Banner.js +41 -0
  192. package/dist/private/node/ui/components/Banner.js.map +1 -0
  193. package/dist/private/node/ui/components/Banner.test.d.ts +1 -0
  194. package/dist/private/node/ui/components/Banner.test.js +52 -0
  195. package/dist/private/node/ui/components/Banner.test.js.map +1 -0
  196. package/dist/private/node/ui/components/Command.d.ts +9 -0
  197. package/dist/private/node/ui/components/Command.js +13 -0
  198. package/dist/private/node/ui/components/Command.js.map +1 -0
  199. package/dist/private/node/ui/components/Command.test.d.ts +1 -0
  200. package/dist/private/node/ui/components/Command.test.js +11 -0
  201. package/dist/private/node/ui/components/Command.test.js.map +1 -0
  202. package/dist/private/node/ui/components/ConcurrentOutput.d.ts +47 -0
  203. package/dist/private/node/ui/components/ConcurrentOutput.js +86 -0
  204. package/dist/private/node/ui/components/ConcurrentOutput.js.map +1 -0
  205. package/dist/private/node/ui/components/ConcurrentOutput.test.d.ts +1 -0
  206. package/dist/private/node/ui/components/ConcurrentOutput.test.js +54 -0
  207. package/dist/private/node/ui/components/ConcurrentOutput.test.js.map +1 -0
  208. package/dist/private/node/ui/components/FatalError.d.ts +7 -0
  209. package/dist/private/node/ui/components/FatalError.js +54 -0
  210. package/dist/private/node/ui/components/FatalError.js.map +1 -0
  211. package/dist/private/node/ui/components/FatalError.test.d.ts +1 -0
  212. package/dist/private/node/ui/components/FatalError.test.js +119 -0
  213. package/dist/private/node/ui/components/FatalError.test.js.map +1 -0
  214. package/dist/private/node/ui/components/FilePath.d.ts +9 -0
  215. package/dist/private/node/ui/components/FilePath.js +13 -0
  216. package/dist/private/node/ui/components/FilePath.js.map +1 -0
  217. package/dist/private/node/ui/components/FilePath.test.d.ts +1 -0
  218. package/dist/private/node/ui/components/FilePath.test.js +11 -0
  219. package/dist/private/node/ui/components/FilePath.test.js.map +1 -0
  220. package/dist/private/node/ui/components/FullScreen.d.ts +8 -0
  221. package/dist/private/node/ui/components/FullScreen.js +32 -0
  222. package/dist/private/node/ui/components/FullScreen.js.map +1 -0
  223. package/dist/private/node/ui/components/Link.d.ts +10 -0
  224. package/dist/private/node/ui/components/Link.js +15 -0
  225. package/dist/private/node/ui/components/Link.js.map +1 -0
  226. package/dist/private/node/ui/components/Link.test.d.ts +1 -0
  227. package/dist/private/node/ui/components/Link.test.js +22 -0
  228. package/dist/private/node/ui/components/Link.test.js.map +1 -0
  229. package/dist/private/node/ui/components/List.d.ts +13 -0
  230. package/dist/private/node/ui/components/List.js +19 -0
  231. package/dist/private/node/ui/components/List.js.map +1 -0
  232. package/dist/private/node/ui/components/List.test.d.ts +1 -0
  233. package/dist/private/node/ui/components/List.test.js +34 -0
  234. package/dist/private/node/ui/components/List.test.js.map +1 -0
  235. package/dist/private/node/ui/components/SelectInput.d.ts +12 -0
  236. package/dist/private/node/ui/components/SelectInput.js +87 -0
  237. package/dist/private/node/ui/components/SelectInput.js.map +1 -0
  238. package/dist/private/node/ui/components/SelectInput.test.d.ts +1 -0
  239. package/dist/private/node/ui/components/SelectInput.test.js +230 -0
  240. package/dist/private/node/ui/components/SelectInput.test.js.map +1 -0
  241. package/dist/private/node/ui/components/SelectPrompt.d.ts +11 -0
  242. package/dist/private/node/ui/components/SelectPrompt.js +34 -0
  243. package/dist/private/node/ui/components/SelectPrompt.js.map +1 -0
  244. package/dist/private/node/ui/components/SelectPrompt.test.d.ts +1 -0
  245. package/dist/private/node/ui/components/SelectPrompt.test.js +74 -0
  246. package/dist/private/node/ui/components/SelectPrompt.test.js.map +1 -0
  247. package/dist/private/node/ui/components/Table.d.ts +8 -0
  248. package/dist/private/node/ui/components/Table.js +17 -0
  249. package/dist/private/node/ui/components/Table.js.map +1 -0
  250. package/dist/private/node/ui/components/Tasks.d.ts +10 -0
  251. package/dist/private/node/ui/components/Tasks.js +27 -0
  252. package/dist/private/node/ui/components/Tasks.js.map +1 -0
  253. package/dist/private/node/ui/components/Tasks.test.d.ts +1 -0
  254. package/dist/private/node/ui/components/Tasks.test.js +50 -0
  255. package/dist/private/node/ui/components/Tasks.test.js.map +1 -0
  256. package/dist/private/node/ui/components/TextAnimation.d.ts +9 -0
  257. package/dist/private/node/ui/components/TextAnimation.js +35 -0
  258. package/dist/private/node/ui/components/TextAnimation.js.map +1 -0
  259. package/dist/private/node/ui/components/TextInput.d.ts +9 -0
  260. package/dist/private/node/ui/components/TextInput.js +74 -0
  261. package/dist/private/node/ui/components/TextInput.js.map +1 -0
  262. package/dist/private/node/ui/components/TextInput.test.d.ts +1 -0
  263. package/dist/private/node/ui/components/TextInput.test.js +139 -0
  264. package/dist/private/node/ui/components/TextInput.test.js.map +1 -0
  265. package/dist/private/node/ui/components/TextPrompt.d.ts +8 -0
  266. package/dist/private/node/ui/components/TextPrompt.js +52 -0
  267. package/dist/private/node/ui/components/TextPrompt.js.map +1 -0
  268. package/dist/private/node/ui/components/TextPrompt.test.d.ts +1 -0
  269. package/dist/private/node/ui/components/TextPrompt.test.js +68 -0
  270. package/dist/private/node/ui/components/TextPrompt.test.js.map +1 -0
  271. package/dist/private/node/ui/components/TokenizedText.d.ts +36 -0
  272. package/dist/private/node/ui/components/TokenizedText.js +70 -0
  273. package/dist/private/node/ui/components/TokenizedText.js.map +1 -0
  274. package/dist/private/node/ui/components/TokenizedText.test.d.ts +1 -0
  275. package/dist/private/node/ui/components/TokenizedText.test.js +44 -0
  276. package/dist/private/node/ui/components/TokenizedText.test.js.map +1 -0
  277. package/dist/private/node/ui/components/UserInput.d.ts +10 -0
  278. package/dist/private/node/ui/components/UserInput.js +11 -0
  279. package/dist/private/node/ui/components/UserInput.js.map +1 -0
  280. package/dist/private/node/ui/components/UserInput.test.d.ts +1 -0
  281. package/dist/private/node/ui/components/UserInput.test.js +11 -0
  282. package/dist/private/node/ui/components/UserInput.test.js.map +1 -0
  283. package/dist/private/node/ui/hooks/use-async-and-unmount.d.ts +6 -0
  284. package/dist/private/node/ui/hooks/use-async-and-unmount.js +17 -0
  285. package/dist/private/node/ui/hooks/use-async-and-unmount.js.map +1 -0
  286. package/dist/private/node/ui/hooks/use-layout.d.ts +6 -0
  287. package/dist/private/node/ui/hooks/use-layout.js +30 -0
  288. package/dist/private/node/ui/hooks/use-layout.js.map +1 -0
  289. package/dist/private/node/ui.d.ts +23 -0
  290. package/dist/private/node/ui.js +53 -0
  291. package/dist/private/node/ui.js.map +1 -0
  292. package/dist/public/common/array.d.ts +37 -0
  293. package/dist/public/common/array.js +51 -0
  294. package/dist/public/common/array.js.map +1 -0
  295. package/dist/public/common/collection.d.ts +23 -0
  296. package/dist/public/common/collection.js +29 -0
  297. package/dist/public/common/collection.js.map +1 -0
  298. package/dist/public/common/function.d.ts +30 -0
  299. package/dist/public/common/function.js +40 -0
  300. package/dist/public/common/function.js.map +1 -0
  301. package/dist/public/common/lang.d.ts +16 -0
  302. package/dist/public/common/lang.js +22 -0
  303. package/dist/public/common/lang.js.map +1 -0
  304. package/dist/public/common/object.d.ts +32 -0
  305. package/dist/public/common/object.js +45 -0
  306. package/dist/public/common/object.js.map +1 -0
  307. package/dist/public/common/string.d.ts +6 -0
  308. package/dist/public/common/string.js +109 -0
  309. package/dist/public/common/string.js.map +1 -0
  310. package/dist/public/common/url.d.ts +7 -0
  311. package/dist/public/common/url.js +17 -0
  312. package/dist/public/common/url.js.map +1 -0
  313. package/dist/public/node/abort.d.ts +16 -0
  314. package/dist/public/node/abort.js +17 -0
  315. package/dist/public/node/abort.js.map +1 -0
  316. package/dist/public/node/analytics.d.ts +13 -0
  317. package/dist/public/node/analytics.js +82 -0
  318. package/dist/public/node/analytics.js.map +1 -0
  319. package/dist/public/node/archiver.d.ts +9 -0
  320. package/dist/public/node/archiver.js +34 -0
  321. package/dist/public/node/archiver.js.map +1 -0
  322. package/dist/public/node/base-command.d.ts +26 -0
  323. package/dist/public/node/base-command.js +172 -0
  324. package/dist/public/node/base-command.js.map +1 -0
  325. package/dist/public/node/checksum.d.ts +20 -0
  326. package/dist/public/node/checksum.js +32 -0
  327. package/dist/public/node/checksum.js.map +1 -0
  328. package/dist/public/node/cli.d.ts +29 -0
  329. package/dist/public/node/cli.js +106 -0
  330. package/dist/public/node/cli.js.map +1 -0
  331. package/dist/public/node/colors.d.ts +2 -0
  332. package/dist/public/node/colors.js +3 -0
  333. package/dist/public/node/colors.js.map +1 -0
  334. package/dist/public/node/dot-env.d.ts +42 -0
  335. package/dist/public/node/dot-env.js +67 -0
  336. package/dist/public/node/dot-env.js.map +1 -0
  337. package/dist/public/node/error-handler.d.ts +41 -0
  338. package/dist/public/node/error-handler.js +198 -0
  339. package/dist/public/node/error-handler.js.map +1 -0
  340. package/dist/public/node/error.d.ts +4 -0
  341. package/dist/public/node/error.js +5 -0
  342. package/dist/public/node/error.js.map +1 -0
  343. package/dist/public/node/framework.d.ts +8 -0
  344. package/dist/public/node/framework.js +135 -0
  345. package/dist/public/node/framework.js.map +1 -0
  346. package/dist/public/node/fs.d.ts +17 -0
  347. package/dist/public/node/fs.js +21 -0
  348. package/dist/public/node/fs.js.map +1 -0
  349. package/dist/public/node/github.d.ts +50 -0
  350. package/dist/public/node/github.js +71 -0
  351. package/dist/public/node/github.js.map +1 -0
  352. package/dist/public/node/hooks/postrun.d.ts +2 -0
  353. package/dist/public/node/hooks/postrun.js +9 -0
  354. package/dist/public/node/hooks/postrun.js.map +1 -0
  355. package/dist/public/node/hooks/prerun.d.ts +12 -0
  356. package/dist/public/node/hooks/prerun.js +66 -0
  357. package/dist/public/node/hooks/prerun.js.map +1 -0
  358. package/dist/public/node/node-package-manager.d.ts +243 -0
  359. package/dist/public/node/node-package-manager.js +369 -0
  360. package/dist/public/node/node-package-manager.js.map +1 -0
  361. package/dist/public/node/os.d.ts +16 -0
  362. package/dist/public/node/os.js +77 -0
  363. package/dist/public/node/os.js.map +1 -0
  364. package/dist/public/node/plugins/tunnel.d.ts +47 -0
  365. package/dist/public/node/plugins/tunnel.js +19 -0
  366. package/dist/public/node/plugins/tunnel.js.map +1 -0
  367. package/dist/public/node/presets.d.ts +8 -0
  368. package/dist/public/node/presets.js +26 -0
  369. package/dist/public/node/presets.js.map +1 -0
  370. package/dist/public/node/result.d.ts +94 -0
  371. package/dist/public/node/result.js +134 -0
  372. package/dist/public/node/result.js.map +1 -0
  373. package/dist/public/node/ruby.d.ts +38 -0
  374. package/dist/public/node/ruby.js +234 -0
  375. package/dist/public/node/ruby.js.map +1 -0
  376. package/dist/public/node/semver.d.ts +3 -0
  377. package/dist/public/node/semver.js +6 -0
  378. package/dist/public/node/semver.js.map +1 -0
  379. package/dist/public/node/tcp.d.ts +5 -0
  380. package/dist/public/node/tcp.js +35 -0
  381. package/dist/public/node/tcp.js.map +1 -0
  382. package/dist/public/node/ui.d.ts +184 -0
  383. package/dist/public/node/ui.js +203 -0
  384. package/dist/public/node/ui.js.map +1 -0
  385. package/dist/schema.d.ts +1 -0
  386. package/dist/schema.js +2 -0
  387. package/dist/schema.js.map +1 -0
  388. package/dist/secure-store.d.ts +19 -0
  389. package/dist/secure-store.js +63 -0
  390. package/dist/secure-store.js.map +1 -0
  391. package/dist/session/authorize.d.ts +7 -0
  392. package/dist/session/authorize.js +52 -0
  393. package/dist/session/authorize.js.map +1 -0
  394. package/dist/session/device-authorization.d.ts +32 -0
  395. package/dist/session/device-authorization.js +92 -0
  396. package/dist/session/device-authorization.js.map +1 -0
  397. package/dist/session/exchange.d.ts +48 -0
  398. package/dist/session/exchange.js +159 -0
  399. package/dist/session/exchange.js.map +1 -0
  400. package/dist/session/identity.d.ts +3 -0
  401. package/dist/session/identity.js +58 -0
  402. package/dist/session/identity.js.map +1 -0
  403. package/dist/session/post-auth.d.ts +13 -0
  404. package/dist/session/post-auth.js +62 -0
  405. package/dist/session/post-auth.js.map +1 -0
  406. package/dist/session/redirect-listener.d.ts +34 -0
  407. package/dist/session/redirect-listener.js +106 -0
  408. package/dist/session/redirect-listener.js.map +1 -0
  409. package/dist/session/schema.d.ts +175 -0
  410. package/dist/session/schema.js +60 -0
  411. package/dist/session/schema.js.map +1 -0
  412. package/dist/session/scopes.d.ts +16 -0
  413. package/dist/session/scopes.js +53 -0
  414. package/dist/session/scopes.js.map +1 -0
  415. package/dist/session/store.d.ts +24 -0
  416. package/dist/session/store.js +89 -0
  417. package/dist/session/store.js.map +1 -0
  418. package/dist/session/token.d.ts +40 -0
  419. package/dist/session/token.js +22 -0
  420. package/dist/session/token.js.map +1 -0
  421. package/dist/session/validate.d.ts +17 -0
  422. package/dist/session/validate.js +65 -0
  423. package/dist/session/validate.js.map +1 -0
  424. package/dist/session.d.ts +96 -0
  425. package/dist/session.js +293 -0
  426. package/dist/session.js.map +1 -0
  427. package/dist/store/schema.d.ts +3 -0
  428. package/dist/store/schema.js +27 -0
  429. package/dist/store/schema.js.map +1 -0
  430. package/dist/store.d.ts +53 -0
  431. package/dist/store.js +134 -0
  432. package/dist/store.js.map +1 -0
  433. package/dist/string.d.ts +28 -0
  434. package/dist/string.js +77 -0
  435. package/dist/string.js.map +1 -0
  436. package/dist/system.d.ts +51 -0
  437. package/dist/system.js +128 -0
  438. package/dist/system.js.map +1 -0
  439. package/dist/template.d.ts +11 -0
  440. package/dist/template.js +50 -0
  441. package/dist/template.js.map +1 -0
  442. package/dist/testing/output.d.ts +10 -0
  443. package/dist/testing/output.js +16 -0
  444. package/dist/testing/output.js.map +1 -0
  445. package/dist/testing/store.d.ts +7 -0
  446. package/dist/testing/store.js +26 -0
  447. package/dist/testing/store.js.map +1 -0
  448. package/dist/testing/ui.d.ts +5 -0
  449. package/dist/testing/ui.js +23 -0
  450. package/dist/testing/ui.js.map +1 -0
  451. package/dist/toml.d.ts +3 -0
  452. package/dist/toml.js +8 -0
  453. package/dist/toml.js.map +1 -0
  454. package/dist/tsconfig.tsbuildinfo +1 -0
  455. package/dist/typing/deep-required.d.ts +12 -0
  456. package/dist/typing/deep-required.js +2 -0
  457. package/dist/typing/deep-required.js.map +1 -0
  458. package/dist/typing/overloaded-parameters.d.ts +6 -0
  459. package/dist/typing/overloaded-parameters.js +2 -0
  460. package/dist/typing/overloaded-parameters.js.map +1 -0
  461. package/dist/typing/pick-by-prefix.d.ts +12 -0
  462. package/dist/typing/pick-by-prefix.js +2 -0
  463. package/dist/typing/pick-by-prefix.js.map +1 -0
  464. package/dist/typing/simple-definitions.d.ts +4 -0
  465. package/dist/typing/simple-definitions.js +2 -0
  466. package/dist/typing/simple-definitions.js.map +1 -0
  467. package/dist/ui/executor.d.ts +14 -0
  468. package/dist/ui/executor.js +90 -0
  469. package/dist/ui/executor.js.map +1 -0
  470. package/dist/ui/inquirer/autocomplete.d.ts +11 -0
  471. package/dist/ui/inquirer/autocomplete.js +110 -0
  472. package/dist/ui/inquirer/autocomplete.js.map +1 -0
  473. package/dist/ui/inquirer/input.d.ts +16 -0
  474. package/dist/ui/inquirer/input.js +45 -0
  475. package/dist/ui/inquirer/input.js.map +1 -0
  476. package/dist/ui/inquirer/password.d.ts +7 -0
  477. package/dist/ui/inquirer/password.js +8 -0
  478. package/dist/ui/inquirer/password.js.map +1 -0
  479. package/dist/ui/inquirer/select.d.ts +14 -0
  480. package/dist/ui/inquirer/select.js +26 -0
  481. package/dist/ui/inquirer/select.js.map +1 -0
  482. package/dist/ui.d.ts +54 -0
  483. package/dist/ui.js +128 -0
  484. package/dist/ui.js.map +1 -0
  485. package/dist/vscode.d.ts +8 -0
  486. package/dist/vscode.js +36 -0
  487. package/dist/vscode.js.map +1 -0
  488. package/package.json +177 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.js","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AACjD,OAAO,SAAS,MAAM,gBAAgB,CAAA;AACtC,OAAO,IAAc,MAAM,MAAM,CAAA;AAEjC,MAAM,UAAU,GAAG,EAAE,CAAA;AAkBrB,MAAM,MAAM,GAAG;IACb,OAAO,EAAE;QACP,IAAI,EAAE,OAAO;QACb,KAAK,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;iBACf;gBACD,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;iBACf;gBACD,SAAS,EAAE;oBACT,IAAI,EAAE,QAAQ;iBACf;aACF;SACF;KACF;CAC+B,CAAA;AAElC,IAAI,SAAkC,CAAA;AAEtC,MAAM,CAAC,KAAK,UAAU,WAAW;IAC/B,IAAI,CAAC,SAAS,EAAE;QACd,kDAAkD;QAClD,SAAS,GAAG,IAAI,WAAW,CAAC;YAC1B,MAAM;YACN,UAAU;YACV,WAAW,EAAE,iBAAiB;YAC9B,cAAc,EAAE,MAAM,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE;SAClD,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AAC,CAAA;IACpC,CAAC;IAED,UAAU;QACR,KAAK,CAAC,OAAO,CAAA,0BAA0B,CAAC,CAAA;QACxC,OAAO,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;IACjC,CAAC;IAED,UAAU,CAAC,OAAe;QACxB,KAAK,CAAC,OAAO,CAAA,0BAA0B,CAAC,CAAA;QACxC,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,CAAA;IACnC,CAAC;IAED,aAAa;QACX,KAAK,CAAC,OAAO,CAAA,2BAA2B,CAAC,CAAA;QACzC,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,EAAE,CAAC,CAAA;IAC9B,CAAC;CACF","sourcesContent":["import {content, token, debug} from './output.js'\nimport constants from './constants.js'\nimport Conf, {Schema} from 'conf'\n\nconst migrations = {}\n\nexport interface CachedAppInfo {\n directory: string\n appId?: string\n title?: string\n orgId?: string\n storeFqdn?: string\n updateURLs?: boolean\n tunnelPlugin?: string\n}\n\ninterface ConfSchema {\n appInfo: CachedAppInfo[]\n themeStore: string\n session: string\n}\n\nconst schema = {\n appInfo: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n appId: {\n type: 'string',\n },\n orgId: {\n type: 'string',\n },\n storeFqdn: {\n type: 'string',\n },\n },\n },\n },\n} as unknown as Schema<ConfSchema>\n\nlet _instance: CLIKitStore | undefined\n\nexport async function cliKitStore() {\n if (!_instance) {\n // eslint-disable-next-line require-atomic-updates\n _instance = new CLIKitStore({\n schema,\n migrations,\n projectName: 'shopify-cli-kit',\n projectVersion: await constants.versions.cliKit(),\n })\n }\n return _instance\n}\n\nexport async function getAppInfo(directory: string): Promise<CachedAppInfo | undefined> {\n const store = await cliKitStore()\n return store.getAppInfo(directory)\n}\n\nexport async function setAppInfo(options: {\n directory: string\n appId?: string\n title?: string\n storeFqdn?: string\n orgId?: string\n updateURLs?: boolean\n tunnelPlugin?: string\n}): Promise<void> {\n const store = await cliKitStore()\n store.setAppInfo(options)\n}\n\nexport async function clearAppInfo(directory: string): Promise<void> {\n const store = await cliKitStore()\n store.clearAppInfo(directory)\n}\n\nexport async function getThemeStore(): Promise<string | undefined> {\n const store = await cliKitStore()\n return store.getThemeStore()\n}\n\nexport async function setThemeStore(themeStore: string): Promise<void> {\n const store = await cliKitStore()\n store.setThemeStore(themeStore)\n}\n\nexport async function getSession(): Promise<string | undefined> {\n const store = await cliKitStore()\n return store.getSession()\n}\n\nexport async function setSession(session: string): Promise<void> {\n const store = await cliKitStore()\n store.setSession(session)\n}\n\nexport async function removeSession(): Promise<void> {\n const store = await cliKitStore()\n store.removeSession()\n}\n\nexport async function clearAllAppInfo(): Promise<void> {\n const store = await cliKitStore()\n store.clearAllAppInfo()\n}\n\nexport class CLIKitStore extends Conf<ConfSchema> {\n getAppInfo(directory: string): CachedAppInfo | undefined {\n debug(content`Reading cached app information for directory ${token.path(directory)}...`)\n const apps = this.get('appInfo') ?? []\n return apps.find((app: CachedAppInfo) => app.directory === directory)\n }\n\n setAppInfo(options: {\n directory: string\n appId?: string\n title?: string\n storeFqdn?: string\n orgId?: string\n updateURLs?: boolean\n tunnelPlugin?: string\n }): void {\n debug(content`Storing app information for directory ${token.path(options.directory)}:${token.json(options)}`)\n const apps = this.get('appInfo') ?? []\n const index = apps.findIndex((saved: CachedAppInfo) => saved.directory === options.directory)\n if (index === -1) {\n apps.push(options)\n } else {\n const app: CachedAppInfo = apps[index]!\n apps[index] = {\n directory: options.directory,\n appId: options.appId ?? app.appId,\n title: options.title ?? app.title,\n storeFqdn: options.storeFqdn ?? app.storeFqdn,\n orgId: options.orgId ?? app.orgId,\n updateURLs: options.updateURLs ?? app.updateURLs,\n tunnelPlugin: options.tunnelPlugin ?? app.tunnelPlugin,\n }\n }\n this.set('appInfo', apps)\n }\n\n clearAppInfo(directory: string): void {\n debug(content`Clearing app information for directory ${token.path(directory)}...`)\n const apps = this.get('appInfo') ?? []\n const index = apps.findIndex((saved: CachedAppInfo) => saved.directory === directory)\n if (index !== -1) {\n apps.splice(index, 1)\n }\n this.set('appInfo', apps)\n }\n\n clearAllAppInfo(): void {\n debug(content`Clearing all app information...`)\n this.set('appInfo', [])\n }\n\n getThemeStore(): string | undefined {\n debug(content`Getting theme store...`)\n return this.get('themeStore')\n }\n\n setThemeStore(themeStore: string): void {\n debug(content`Setting theme store...`)\n this.set('themeStore', themeStore)\n }\n\n getSession(): string | undefined {\n debug(content`Getting session store...`)\n return this.get('sessionStore')\n }\n\n setSession(session: string): void {\n debug(content`Setting session store...`)\n this.set('sessionStore', session)\n }\n\n removeSession(): void {\n debug(content`Removing session store...`)\n this.set('sessionStore', '')\n }\n}\n"]}
@@ -0,0 +1,28 @@
1
+ export { camelCase as camelize } from 'change-case';
2
+ export { paramCase as hyphenize } from 'change-case';
3
+ export { snakeCase as underscore } from 'change-case';
4
+ export { constantCase as constantize } from 'change-case';
5
+ /** Returns a random string */
6
+ export declare function randomHex(size: number): string;
7
+ export declare function generateRandomChallengePair(): {
8
+ codeVerifier: string;
9
+ codeChallenge: string;
10
+ };
11
+ export declare function hashString(str: string): string;
12
+ /**
13
+ * Given a string, it returns it with the first letter capitalized.
14
+ * @param string - String whose first letter will be caplitalized.
15
+ * @returns The given string with its first letter capitalized.
16
+ */
17
+ export declare function capitalize(string: string): string;
18
+ /**
19
+ * Try to convert a string to an int, falling back to undefined if unable to
20
+ */
21
+ export declare function tryParseInt(maybeInt: string | undefined): number | undefined;
22
+ /**
23
+ * Given a series of rows inside an array, where each row is an array of strings (representing columns)
24
+ * Parse it into a single string with the columns aligned
25
+ */
26
+ export declare function linesToColumns(lines: string[][]): string;
27
+ export declare const slugify: (str: string) => string;
28
+ export declare const escapeRegExp: (str: string) => string;
package/dist/string.js ADDED
@@ -0,0 +1,77 @@
1
+ import { unstyled } from './output.js';
2
+ import crypto from 'crypto';
3
+ export { camelCase as camelize } from 'change-case';
4
+ export { paramCase as hyphenize } from 'change-case';
5
+ export { snakeCase as underscore } from 'change-case';
6
+ export { constantCase as constantize } from 'change-case';
7
+ /** Returns a random string */
8
+ export function randomHex(size) {
9
+ return crypto.randomBytes(size).toString('hex');
10
+ }
11
+ export function generateRandomChallengePair() {
12
+ const codeVerifier = base64URLEncode(crypto.randomBytes(32));
13
+ const codeChallenge = base64URLEncode(sha256(codeVerifier));
14
+ return { codeVerifier, codeChallenge };
15
+ }
16
+ function base64URLEncode(str) {
17
+ return str.toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/[=]/g, '');
18
+ }
19
+ function sha256(str) {
20
+ return crypto.createHash('sha256').update(str).digest();
21
+ }
22
+ export function hashString(str) {
23
+ return crypto.createHash('sha1').update(str).digest('hex');
24
+ }
25
+ /**
26
+ * Given a string, it returns it with the first letter capitalized.
27
+ * @param string - String whose first letter will be caplitalized.
28
+ * @returns The given string with its first letter capitalized.
29
+ */
30
+ export function capitalize(string) {
31
+ return string.substring(0, 1).toUpperCase() + string.substring(1);
32
+ }
33
+ /**
34
+ * Try to convert a string to an int, falling back to undefined if unable to
35
+ */
36
+ export function tryParseInt(maybeInt) {
37
+ let asInt;
38
+ if (maybeInt !== undefined) {
39
+ asInt = parseInt(maybeInt, 10);
40
+ if (isNaN(asInt)) {
41
+ asInt = undefined;
42
+ }
43
+ }
44
+ return asInt;
45
+ }
46
+ /**
47
+ * Given a series of rows inside an array, where each row is an array of strings (representing columns)
48
+ * Parse it into a single string with the columns aligned
49
+ */
50
+ export function linesToColumns(lines) {
51
+ const widths = [];
52
+ for (let i = 0; lines[0] && i < lines[0].length; i++) {
53
+ const columnRows = lines.map((line) => line[i]);
54
+ widths.push(Math.max(...columnRows.map((row) => unstyled(row).length)));
55
+ }
56
+ const paddedLines = lines
57
+ .map((line) => {
58
+ return line
59
+ .map((col, index) => {
60
+ return `${col}${' '.repeat(widths[index] - unstyled(col).length)}`;
61
+ })
62
+ .join(' ')
63
+ .trimEnd();
64
+ })
65
+ .join('\n');
66
+ return paddedLines;
67
+ }
68
+ export const slugify = (str) => str
69
+ .toLowerCase()
70
+ .trim()
71
+ .replace(/[^\w\s-]/g, '')
72
+ .replace(/[\s_-]+/g, '-')
73
+ .replace(/^-+|-+$/g, '');
74
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping
75
+ // $& means the whole matched string
76
+ export const escapeRegExp = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
77
+ //# sourceMappingURL=string.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string.js","sourceRoot":"","sources":["../src/string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAA;AACpC,OAAO,MAAM,MAAM,QAAQ,CAAA;AAE3B,OAAO,EAAC,SAAS,IAAI,QAAQ,EAAC,MAAM,aAAa,CAAA;AACjD,OAAO,EAAC,SAAS,IAAI,SAAS,EAAC,MAAM,aAAa,CAAA;AAClD,OAAO,EAAC,SAAS,IAAI,UAAU,EAAC,MAAM,aAAa,CAAA;AACnD,OAAO,EAAC,YAAY,IAAI,WAAW,EAAC,MAAM,aAAa,CAAA;AAEvD,8BAA8B;AAC9B,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;AACjD,CAAC;AAED,MAAM,UAAU,2BAA2B;IACzC,MAAM,YAAY,GAAG,eAAe,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAA;IAC5D,MAAM,aAAa,GAAG,eAAe,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAA;IAC3D,OAAO,EAAC,YAAY,EAAE,aAAa,EAAC,CAAA;AACtC,CAAC;AAED,SAAS,eAAe,CAAC,GAAW;IAClC,OAAO,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CA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AC,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;KACxE;IACD,MAAM,WAAW,GAAG,KAAK;SACtB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACZ,OAAO,IAAI;aACR,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;YAClB,OAAO,GAAG,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAA;QACrE,CAAC,CAAC;aACD,IAAI,CAAC,KAAK,CAAC;aACX,OAAO,EAAE,CAAA;IACd,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAA;IACb,OAAO,WAAW,CAAA;AACpB,CAAC;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,GAAW,EAAE,EAAE,CACrC,GAAG;KACA,WAAW,EAAE;KACb,IAAI,EAAE;KACN,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;KACxB,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC;KACxB,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAA;AAE5B,6FAA6F;AAC7F,oCAAoC;AACpC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAA","sourcesContent":["import {unstyled} from './output.js'\nimport crypto from 'crypto'\n\nexport {camelCase as camelize} from 'change-case'\nexport {paramCase as hyphenize} from 'change-case'\nexport {snakeCase as underscore} from 'change-case'\nexport {constantCase as constantize} from 'change-case'\n\n/** Returns a random string */\nexport function randomHex(size: number): string {\n return crypto.randomBytes(size).toString('hex')\n}\n\nexport function generateRandomChallengePair() {\n const codeVerifier = base64URLEncode(crypto.randomBytes(32))\n const codeChallenge = base64URLEncode(sha256(codeVerifier))\n return {codeVerifier, codeChallenge}\n}\n\nfunction base64URLEncode(str: Buffer) {\n return str.toString('base64').replace(/\\+/g, '-').replace(/\\//g, '_').replace(/[=]/g, '')\n}\n\nfunction sha256(str: string) {\n return crypto.createHash('sha256').update(str).digest()\n}\n\nexport function hashString(str: string): string {\n return crypto.createHash('sha1').update(str).digest('hex')\n}\n\n/**\n * Given a string, it returns it with the first letter capitalized.\n * @param string - String whose first letter will be caplitalized.\n * @returns The given string with its first letter capitalized.\n */\nexport function capitalize(string: string) {\n return string.substring(0, 1).toUpperCase() + string.substring(1)\n}\n\n/**\n * Try to convert a string to an int, falling back to undefined if unable to\n */\nexport function tryParseInt(maybeInt: string | undefined) {\n let asInt: number | undefined\n if (maybeInt !== undefined) {\n asInt = parseInt(maybeInt, 10)\n if (isNaN(asInt)) {\n asInt = undefined\n }\n }\n return asInt\n}\n\n/**\n * Given a series of rows inside an array, where each row is an array of strings (representing columns)\n * Parse it into a single string with the columns aligned\n */\nexport function linesToColumns(lines: string[][]): string {\n const widths: number[] = []\n for (let i = 0; lines[0] && i < lines[0].length; i++) {\n const columnRows = lines.map((line) => line[i]!)\n widths.push(Math.max(...columnRows.map((row) => unstyled(row).length)))\n }\n const paddedLines = lines\n .map((line) => {\n return line\n .map((col, index) => {\n return `${col}${' '.repeat(widths[index]! - unstyled(col).length)}`\n })\n .join(' ')\n .trimEnd()\n })\n .join('\\n')\n return paddedLines\n}\n\nexport const slugify = (str: string) =>\n str\n .toLowerCase()\n .trim()\n .replace(/[^\\w\\s-]/g, '')\n .replace(/[\\s_-]+/g, '-')\n .replace(/^-+|-+$/g, '')\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping\n// $& means the whole matched string\nexport const escapeRegExp = (str: string) => str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n"]}
@@ -0,0 +1,51 @@
1
+ /// <reference types="node" />
2
+ import { AbortSignal } from './public/node/abort.js';
3
+ import type { Writable, Readable } from 'stream';
4
+ export interface ExecOptions {
5
+ cwd?: string;
6
+ env?: {
7
+ [key: string]: string | undefined;
8
+ };
9
+ stdin?: Readable | 'inherit';
10
+ stdout?: Writable | 'inherit';
11
+ stderr?: Writable | 'inherit';
12
+ stdio?: 'inherit';
13
+ input?: string;
14
+ signal?: AbortSignal;
15
+ }
16
+ export declare type WritableExecOptions = Omit<ExecOptions, 'stdout'> & {
17
+ stdout?: Writable;
18
+ };
19
+ export declare const open: (url: string) => Promise<void>;
20
+ /**
21
+ * Runs a command asynchronously, aggregates the stdout data, and returns it.
22
+ * @param command - Command to be executed.
23
+ * @param args - Arguments to pass to the command.
24
+ * @returns A promise that resolves with the aggregatted stdout of the command.
25
+ */
26
+ export declare const captureOutput: (command: string, args: string[], options?: ExecOptions) => Promise<string>;
27
+ export declare const exec: (command: string, args: string[], options?: ExecOptions) => Promise<void>;
28
+ interface ConcurrentExecCommand {
29
+ prefix: string;
30
+ executable: string;
31
+ args: string[];
32
+ cwd: string;
33
+ }
34
+ /**
35
+ * Runs commands concurrently and combines the standard output and error data
36
+ * into a single stream. See {@link renderConcurrent} for more information about
37
+ * the output format.
38
+ *
39
+ * If one of the processes fails, it aborts the running ones and exits with that error.
40
+ * @param commands - Commands to execute.
41
+ */
42
+ export declare const concurrentExec: (commands: ConcurrentExecCommand[]) => Promise<void>;
43
+ /**
44
+ * Displays a large file using the terminal pager set by the user, or a
45
+ * reasonable default for the user's OS:
46
+ *
47
+ * @param filename - The path to the file to be displayed.
48
+ */
49
+ export declare function page(filename: string): Promise<void>;
50
+ export declare function sleep(seconds: number): Promise<unknown>;
51
+ export {};
package/dist/system.js ADDED
@@ -0,0 +1,128 @@
1
+ import { shouldDisplayColors, debug } from './output.js';
2
+ import { platformAndArch } from './public/node/os.js';
3
+ import { Abort, ExternalError } from './error.js';
4
+ import { renderConcurrent } from './public/node/ui.js';
5
+ import { execa } from 'execa';
6
+ import treeKill from 'tree-kill';
7
+ export const open = async (url) => {
8
+ const externalOpen = await import('open');
9
+ await externalOpen.default(url);
10
+ };
11
+ /**
12
+ * Runs a command asynchronously, aggregates the stdout data, and returns it.
13
+ * @param command - Command to be executed.
14
+ * @param args - Arguments to pass to the command.
15
+ * @returns A promise that resolves with the aggregatted stdout of the command.
16
+ */
17
+ export const captureOutput = async (command, args, options) => {
18
+ const result = await buildExec(command, args, options);
19
+ return result.stdout;
20
+ };
21
+ export const exec = async (command, args, options) => {
22
+ const commandProcess = buildExec(command, args, options);
23
+ if (options?.stderr && options.stderr !== 'inherit') {
24
+ commandProcess.stderr?.pipe(options.stderr);
25
+ }
26
+ if (options?.stdout && options.stdout !== 'inherit') {
27
+ commandProcess.stdout?.pipe(options.stdout);
28
+ }
29
+ let aborted = false;
30
+ options?.signal?.addEventListener('abort', () => {
31
+ const pid = commandProcess.pid;
32
+ if (pid) {
33
+ aborted = true;
34
+ treeKill(pid, (err) => {
35
+ if (err)
36
+ throw new Abort(`Failed to kill process ${pid}: ${err}`);
37
+ });
38
+ }
39
+ });
40
+ try {
41
+ await commandProcess;
42
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
43
+ }
44
+ catch (processError) {
45
+ // Windows will throw an error whenever the process is killed, no matter the reason.
46
+ // The aborted flag tell use that we killed it, so we can ignore the error.
47
+ if (aborted)
48
+ return;
49
+ const abortError = new ExternalError(processError.message, command, args);
50
+ abortError.stack = processError.stack;
51
+ throw abortError;
52
+ }
53
+ };
54
+ const buildExec = (command, args, options) => {
55
+ const env = options?.env ?? process.env;
56
+ if (shouldDisplayColors()) {
57
+ env.FORCE_COLOR = '1';
58
+ }
59
+ const commandProcess = execa(command, args, {
60
+ env,
61
+ cwd: options?.cwd,
62
+ input: options?.input,
63
+ stdio: options?.stdio,
64
+ stdin: options?.stdin,
65
+ stdout: options?.stdout === 'inherit' ? 'inherit' : undefined,
66
+ stderr: options?.stderr === 'inherit' ? 'inherit' : undefined,
67
+ // Setting this to false makes it possible to kill the main process
68
+ // and all its sub-processes with Ctrl+C on Windows
69
+ windowsHide: false,
70
+ });
71
+ debug(`
72
+ Running system process:
73
+ · Command: ${command} ${args.join(' ')}
74
+ · Working directory: ${options?.cwd ?? process.cwd()}
75
+ `);
76
+ return commandProcess;
77
+ };
78
+ /**
79
+ * Runs commands concurrently and combines the standard output and error data
80
+ * into a single stream. See {@link renderConcurrent} for more information about
81
+ * the output format.
82
+ *
83
+ * If one of the processes fails, it aborts the running ones and exits with that error.
84
+ * @param commands - Commands to execute.
85
+ */
86
+ export const concurrentExec = async (commands) => {
87
+ await renderConcurrent({
88
+ processes: commands.map((command) => {
89
+ return {
90
+ prefix: command.prefix,
91
+ action: async (stdout, stderr, signal) => {
92
+ await exec(command.executable, command.args, {
93
+ stdout,
94
+ stderr,
95
+ cwd: command.cwd,
96
+ signal,
97
+ });
98
+ },
99
+ };
100
+ }),
101
+ });
102
+ };
103
+ /**
104
+ * Displays a large file using the terminal pager set by the user, or a
105
+ * reasonable default for the user's OS:
106
+ *
107
+ * @param filename - The path to the file to be displayed.
108
+ */
109
+ export async function page(filename) {
110
+ let executable;
111
+ if (process.env.PAGER) {
112
+ executable = process.env.PAGER;
113
+ }
114
+ else if ((await platformAndArch()).platform === 'windows') {
115
+ executable = 'more';
116
+ }
117
+ else {
118
+ executable = 'less -NR';
119
+ }
120
+ const [command, ...args] = [...executable.split(' '), filename];
121
+ await exec(command, args, { stdout: 'inherit', stdin: 'inherit' });
122
+ }
123
+ export async function sleep(seconds) {
124
+ return new Promise((resolve) => {
125
+ setTimeout(resolve, 1000 * seconds);
126
+ });
127
+ }
128
+ //# sourceMappingURL=system.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system.js","sourceRoot":"","sources":["../src/system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AACtD,OAAO,EAAC,eAAe,EAAC,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAC,KAAK,E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U,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,CAAA;IAC/D,MAAM,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,EAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAC,CAAC,CAAA;AAClE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,OAAe;IACzC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,UAAU,CAAC,OAAO,EAAE,IAAI,GAAG,OAAO,CAAC,CAAA;IACrC,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {shouldDisplayColors, debug} from './output.js'\nimport {platformAndArch} from './public/node/os.js'\nimport {Abort, ExternalError} from './error.js'\nimport {renderConcurrent} from './public/node/ui.js'\nimport {AbortSignal} from './public/node/abort.js'\nimport {execa, ExecaChildProcess} from 'execa'\nimport treeKill from 'tree-kill'\nimport type {Writable, Readable} from 'stream'\n\nexport interface ExecOptions {\n cwd?: string\n env?: {[key: string]: string | undefined}\n stdin?: Readable | 'inherit'\n stdout?: Writable | 'inherit'\n stderr?: Writable | 'inherit'\n stdio?: 'inherit'\n input?: string\n signal?: AbortSignal\n}\nexport type WritableExecOptions = Omit<ExecOptions, 'stdout'> & {stdout?: Writable}\n\nexport const open = async (url: string) => {\n const externalOpen = await import('open')\n await externalOpen.default(url)\n}\n\n/**\n * Runs a command asynchronously, aggregates the stdout data, and returns it.\n * @param command - Command to be executed.\n * @param args - Arguments to pass to the command.\n * @returns A promise that resolves with the aggregatted stdout of the command.\n */\nexport const captureOutput = async (command: string, args: string[], options?: ExecOptions): Promise<string> => {\n const result = await buildExec(command, args, options)\n return result.stdout\n}\n\nexport const exec = async (command: string, args: string[], options?: ExecOptions) => {\n const commandProcess = buildExec(command, args, options)\n if (options?.stderr && options.stderr !== 'inherit') {\n commandProcess.stderr?.pipe(options.stderr)\n }\n if (options?.stdout && options.stdout !== 'inherit') {\n commandProcess.stdout?.pipe(options.stdout)\n }\n let aborted = false\n options?.signal?.addEventListener('abort', () => {\n const pid = commandProcess.pid\n if (pid) {\n aborted = true\n treeKill(pid, (err) => {\n if (err) throw new Abort(`Failed to kill process ${pid}: ${err}`)\n })\n }\n })\n try {\n await commandProcess\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (processError: any) {\n // Windows will throw an error whenever the process is killed, no matter the reason.\n // The aborted flag tell use that we killed it, so we can ignore the error.\n if (aborted) return\n const abortError = new ExternalError(processError.message, command, args)\n abortError.stack = processError.stack\n throw abortError\n }\n}\n\nconst buildExec = (command: string, args: string[], options?: ExecOptions): ExecaChildProcess<string> => {\n const env = options?.env ?? process.env\n if (shouldDisplayColors()) {\n env.FORCE_COLOR = '1'\n }\n const commandProcess = execa(command, args, {\n env,\n cwd: options?.cwd,\n input: options?.input,\n stdio: options?.stdio,\n stdin: options?.stdin,\n stdout: options?.stdout === 'inherit' ? 'inherit' : undefined,\n stderr: options?.stderr === 'inherit' ? 'inherit' : undefined,\n // Setting this to false makes it possible to kill the main process\n // and all its sub-processes with Ctrl+C on Windows\n windowsHide: false,\n })\n debug(`\nRunning system process:\n · Command: ${command} ${args.join(' ')}\n · Working directory: ${options?.cwd ?? process.cwd()}\n`)\n return commandProcess\n}\n\ninterface ConcurrentExecCommand {\n prefix: string\n executable: string\n args: string[]\n cwd: string\n}\n\n/**\n * Runs commands concurrently and combines the standard output and error data\n * into a single stream. See {@link renderConcurrent} for more information about\n * the output format.\n *\n * If one of the processes fails, it aborts the running ones and exits with that error.\n * @param commands - Commands to execute.\n */\nexport const concurrentExec = async (commands: ConcurrentExecCommand[]): Promise<void> => {\n await renderConcurrent({\n processes: commands.map((command) => {\n return {\n prefix: command.prefix,\n action: async (stdout, stderr, signal) => {\n await exec(command.executable, command.args, {\n stdout,\n stderr,\n cwd: command.cwd,\n signal,\n })\n },\n }\n }),\n })\n}\n\n/**\n * Displays a large file using the terminal pager set by the user, or a\n * reasonable default for the user's OS:\n *\n * @param filename - The path to the file to be displayed.\n */\nexport async function page(filename: string) {\n let executable: string\n if (process.env.PAGER) {\n executable = process.env.PAGER\n } else if ((await platformAndArch()).platform === 'windows') {\n executable = 'more'\n } else {\n executable = 'less -NR'\n }\n const [command, ...args] = [...executable.split(' '), filename]\n await exec(command, args, {stdout: 'inherit', stdin: 'inherit'})\n}\n\nexport async function sleep(seconds: number) {\n return new Promise((resolve) => {\n setTimeout(resolve, 1000 * seconds)\n })\n}\n"]}
@@ -0,0 +1,11 @@
1
+ export declare function create(templateContent: string): (data: object) => Promise<string>;
2
+ /**
3
+ * Given a directory, it traverses the files and directories recursively
4
+ * and replaces variables in directory and file names, and files' content
5
+ * using the Liquid template engine.
6
+ * Files indicate that they are liquid template by using the .liquid extension.
7
+ * @param from - Directory that contains the template.
8
+ * @param to - Output directory.
9
+ * @param data - Data to feed the template engine.
10
+ */
11
+ export declare function recursiveDirectoryCopy(from: string, to: string, data: object): Promise<void>;
@@ -0,0 +1,50 @@
1
+ import { glob, join, dirname, relative } from './path.js';
2
+ import { mkdir, read, copy, chmod, isDirectory, write, hasExecutablePermissions } from './file.js';
3
+ import { content, token, debug } from './output.js';
4
+ import { Liquid } from 'liquidjs';
5
+ // This line is necessary to register additional helpers.
6
+ export function create(templateContent) {
7
+ return (data) => {
8
+ const engine = new Liquid();
9
+ return engine.render(engine.parse(templateContent), data);
10
+ };
11
+ }
12
+ /**
13
+ * Given a directory, it traverses the files and directories recursively
14
+ * and replaces variables in directory and file names, and files' content
15
+ * using the Liquid template engine.
16
+ * Files indicate that they are liquid template by using the .liquid extension.
17
+ * @param from - Directory that contains the template.
18
+ * @param to - Output directory.
19
+ * @param data - Data to feed the template engine.
20
+ */
21
+ export async function recursiveDirectoryCopy(from, to, data) {
22
+ debug(content `Copying template from directory ${token.path(from)} to ${token.path(to)}`);
23
+ const templateFiles = await glob(join(from, '**/*'), { dot: true });
24
+ const sortedTemplateFiles = templateFiles
25
+ .map((path) => path.split('/'))
26
+ .sort((lhs, rhs) => (lhs.length < rhs.length ? 1 : -1))
27
+ .map((components) => components.join('/'));
28
+ await Promise.all(sortedTemplateFiles.map(async (templateItemPath) => {
29
+ const outputPath = await create(join(to, relative(from, templateItemPath)))(data);
30
+ if (await isDirectory(templateItemPath)) {
31
+ await mkdir(outputPath);
32
+ }
33
+ else if (templateItemPath.endsWith('.liquid')) {
34
+ await mkdir(dirname(outputPath));
35
+ const content = await read(templateItemPath);
36
+ const contentOutput = await create(content)(data);
37
+ const isExecutable = await hasExecutablePermissions(templateItemPath);
38
+ const outputPathWithoutLiquid = outputPath.replace('.liquid', '');
39
+ await copy(templateItemPath, outputPathWithoutLiquid);
40
+ await write(outputPathWithoutLiquid, contentOutput);
41
+ if (isExecutable) {
42
+ await chmod(outputPathWithoutLiquid, 0o755);
43
+ }
44
+ }
45
+ else {
46
+ await copy(templateItemPath, outputPath);
47
+ }
48
+ }));
49
+ }
50
+ //# sourceMappingURL=template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.js","sourceRoot":"","sources":["../src/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAA;AACvD,OAAO,EAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,wBAAwB,EAAC,MAAM,WAAW,CAAA;AAChG,OAAO,EAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AACjD,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAA;AAE/B,yDAAyD;AACzD,MAAM,UAAU,MAAM,CAAC,eAAuB;IAC5C,OAAO,CAAC,IAAY,EAAmB,EAAE;QACvC,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAA;QAC3B,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE,IAAI,CAAC,CAAA;IA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YAChC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,CAAA;YAC5C,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAA;YACjD,MAAM,YAAY,GAAG,MAAM,wBAAwB,CAAC,gBAAgB,CAAC,CAAA;YACrE,MAAM,uBAAuB,GAAG,UAAU,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAA;YACjE,MAAM,IAAI,CAAC,gBAAgB,EAAE,uBAAuB,CAAC,CAAA;YACrD,MAAM,KAAK,CAAC,uBAAuB,EAAE,aAAa,CAAC,CAAA;YACnD,IAAI,YAAY,EAAE;gBAChB,MAAM,KAAK,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAA;aAC5C;SACF;aAAM;YACL,MAAM,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAA;SACzC;IACH,CAAC,CAAC,CACH,CAAA;AACH,CAAC","sourcesContent":["import {glob, join, dirname, relative} from './path.js'\nimport {mkdir, read, copy, chmod, isDirectory, write, hasExecutablePermissions} from './file.js'\nimport {content, token, debug} from './output.js'\nimport {Liquid} from 'liquidjs'\n\n// This line is necessary to register additional helpers.\nexport function create(templateContent: string) {\n return (data: object): Promise<string> => {\n const engine = new Liquid()\n return engine.render(engine.parse(templateContent), data)\n }\n}\n\n/**\n * Given a directory, it traverses the files and directories recursively\n * and replaces variables in directory and file names, and files' content\n * using the Liquid template engine.\n * Files indicate that they are liquid template by using the .liquid extension.\n * @param from - Directory that contains the template.\n * @param to - Output directory.\n * @param data - Data to feed the template engine.\n */\nexport async function recursiveDirectoryCopy(from: string, to: string, data: object) {\n debug(content`Copying template from directory ${token.path(from)} to ${token.path(to)}`)\n const templateFiles: string[] = await glob(join(from, '**/*'), {dot: true})\n\n const sortedTemplateFiles = templateFiles\n .map((path) => path.split('/'))\n .sort((lhs, rhs) => (lhs.length < rhs.length ? 1 : -1))\n .map((components) => components.join('/'))\n await Promise.all(\n sortedTemplateFiles.map(async (templateItemPath) => {\n const outputPath = await create(join(to, relative(from, templateItemPath)))(data)\n if (await isDirectory(templateItemPath)) {\n await mkdir(outputPath)\n } else if (templateItemPath.endsWith('.liquid')) {\n await mkdir(dirname(outputPath))\n const content = await read(templateItemPath)\n const contentOutput = await create(content)(data)\n const isExecutable = await hasExecutablePermissions(templateItemPath)\n const outputPathWithoutLiquid = outputPath.replace('.liquid', '')\n await copy(templateItemPath, outputPathWithoutLiquid)\n await write(outputPathWithoutLiquid, contentOutput)\n if (isExecutable) {\n await chmod(outputPathWithoutLiquid, 0o755)\n }\n } else {\n await copy(templateItemPath, outputPath)\n }\n }),\n )\n}\n"]}
@@ -0,0 +1,10 @@
1
+ export declare function mockAndCaptureOutput(): {
2
+ output: () => string;
3
+ info: () => string;
4
+ debug: () => string;
5
+ success: () => string;
6
+ completed: () => string;
7
+ warn: () => string;
8
+ error: () => string;
9
+ clear: () => void;
10
+ };
@@ -0,0 +1,16 @@
1
+ import * as output from '../output.js';
2
+ export function mockAndCaptureOutput() {
3
+ return {
4
+ output: () => (output.collectedLogs.output ?? []).join('\n'),
5
+ info: () => (output.collectedLogs.info ?? []).join('\n'),
6
+ debug: () => (output.collectedLogs.debug ?? []).join('\n'),
7
+ success: () => (output.collectedLogs.success ?? []).join('\n'),
8
+ completed: () => (output.collectedLogs.completed ?? []).join('\n'),
9
+ warn: () => (output.collectedLogs.warn ?? []).join('\n'),
10
+ error: () => (output.collectedLogs.error ?? []).join('\n'),
11
+ clear: () => {
12
+ output.clearCollectedLogs();
13
+ },
14
+ };
15
+ }
16
+ //# sourceMappingURL=output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/testing/output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AAEtC,MAAM,UAAU,oBAAoB;IAClC,OAAO;QACL,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAC5D,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QACxD,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAC1D,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAC9D,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAClE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QACxD,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAC1D,KAAK,EAAE,GAAG,EAAE;YACV,MAAM,CAAC,kBAAkB,EAAE,CAAA;QAC7B,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["import * as output from '../output.js'\n\nexport function mockAndCaptureOutput() {\n return {\n output: () => (output.collectedLogs.output ?? []).join('\\n'),\n info: () => (output.collectedLogs.info ?? []).join('\\n'),\n debug: () => (output.collectedLogs.debug ?? []).join('\\n'),\n success: () => (output.collectedLogs.success ?? []).join('\\n'),\n completed: () => (output.collectedLogs.completed ?? []).join('\\n'),\n warn: () => (output.collectedLogs.warn ?? []).join('\\n'),\n error: () => (output.collectedLogs.error ?? []).join('\\n'),\n clear: () => {\n output.clearCollectedLogs()\n },\n }\n}\n"]}
@@ -0,0 +1,7 @@
1
+ import { CLIKitStore } from '../store.js';
2
+ /**
3
+ * Creates a temporary configuration store and ties its lifecycle to the callback.
4
+ * @param callback - Callback to execute. When the callback exits, the local config is destroyed.
5
+ * @returns Promise that resolves with the value returned by the callback.
6
+ */
7
+ export declare function temporaryTestStore<T>(callback: (store: CLIKitStore) => Promise<T>): Promise<T>;
@@ -0,0 +1,26 @@
1
+ import { CLIKitStore } from '../store.js';
2
+ import { remove } from '../file.js';
3
+ import uniqueString from 'unique-string';
4
+ /**
5
+ * Creates a temporary configuration store and ties its lifecycle to the callback.
6
+ * @param callback - Callback to execute. When the callback exits, the local config is destroyed.
7
+ * @returns Promise that resolves with the value returned by the callback.
8
+ */
9
+ export async function temporaryTestStore(callback) {
10
+ let localConf;
11
+ try {
12
+ const name = `shopify-cli-test-${uniqueString()}`;
13
+ localConf = new CLIKitStore({ projectName: name });
14
+ // eslint-disable-next-line node/callback-return
15
+ const result = callback(localConf);
16
+ return result;
17
+ }
18
+ finally {
19
+ if (localConf) {
20
+ await remove(localConf.path);
21
+ const configFolder = localConf.path.replace(/\/config.json$/, '');
22
+ await remove(configFolder);
23
+ }
24
+ }
25
+ }
26
+ //# sourceMappingURL=store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/testing/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAA;AACvC,OAAO,EAAC,MAAM,EAAC,MAAM,YAAY,CAAA;AACjC,OAAO,YAAY,MAAM,eAAe,CAAA;AAExC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAI,QAA4C;IACtF,IAAI,SAAkC,CAAA;IACtC,IAAI;QACF,MAAM,IAAI,GAAG,oBAAoB,YAAY,EAAE,EAAE,CAAA;QACjD,SAAS,GAAG,IAAI,WAAW,CAAC,EAAC,WAAW,EAAE,IAAI,EAAC,CAAC,CAAA;QAChD,gDAAgD;QAChD,MAAM,MAAM,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAA;QAClC,OAAO,MAAM,CAAA;KACd;YAAS;QACR,IAAI,SAAS,EAAE;YACb,MAAM,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;YAC5B,MAAM,YAAY,GAAG,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAA;YACjE,MAAM,MAAM,CAAC,YAAY,CAAC,CAAA;SAC3B;KACF;AACH,CAAC","sourcesContent":["import {CLIKitStore} from '../store.js'\nimport {remove} from '../file.js'\nimport uniqueString from 'unique-string'\n\n/**\n * Creates a temporary configuration store and ties its lifecycle to the callback.\n * @param callback - Callback to execute. When the callback exits, the local config is destroyed.\n * @returns Promise that resolves with the value returned by the callback.\n */\nexport async function temporaryTestStore<T>(callback: (store: CLIKitStore) => Promise<T>): Promise<T> {\n let localConf: CLIKitStore | undefined\n try {\n const name = `shopify-cli-test-${uniqueString()}`\n localConf = new CLIKitStore({projectName: name})\n // eslint-disable-next-line node/callback-return\n const result = callback(localConf)\n return result\n } finally {\n if (localConf) {\n await remove(localConf.path)\n const configFolder = localConf.path.replace(/\\/config.json$/, '')\n await remove(configFolder)\n }\n }\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import { render } from 'ink-testing-library';
2
+ export declare function waitForInputsToBeReady(): Promise<unknown>;
3
+ export declare function waitForChange(func: () => void, getChangingValue: () => string | number | undefined): Promise<void>;
4
+ export declare function sendInput(renderInstance: ReturnType<typeof render>, ...inputs: string[]): Promise<void>;
5
+ export declare function getLastFrameAfterUnmount(renderInstance: ReturnType<typeof render>): string | undefined;
@@ -0,0 +1,23 @@
1
+ import { isTruthy } from '../environment/utilities.js';
2
+ export function waitForInputsToBeReady() {
3
+ return new Promise((resolve) => setTimeout(resolve, 100));
4
+ }
5
+ export function waitForChange(func, getChangingValue) {
6
+ return new Promise((resolve) => {
7
+ const initialValue = getChangingValue();
8
+ func();
9
+ const interval = setInterval(() => {
10
+ if (getChangingValue() !== initialValue) {
11
+ clearInterval(interval);
12
+ resolve();
13
+ }
14
+ }, 10);
15
+ });
16
+ }
17
+ export async function sendInput(renderInstance, ...inputs) {
18
+ await waitForChange(() => inputs.forEach((input) => renderInstance.stdin.write(input)), renderInstance.lastFrame);
19
+ }
20
+ export function getLastFrameAfterUnmount(renderInstance) {
21
+ return isTruthy(process.env.CI) ? renderInstance.frames[renderInstance.frames.length - 2] : renderInstance.lastFrame();
22
+ }
23
+ //# sourceMappingURL=ui.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui.js","sourceRoot":"","sources":["../../src/testing/ui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAA;AAGpD,MAAM,UAAU,sBAAsB;IACpC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAA;AAC3D,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,IAAgB,EAAE,gBAAmD;IACjG,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;QACnC,MAAM,YAAY,GAAG,gBAAgB,EAAE,CAAA;QAEvC,IAAI,EAAE,CAAA;QAEN,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE;YAChC,IAAI,gBAAgB,EAAE,KAAK,YAAY,EAAE;gBACvC,aAAa,CAAC,QAAQ,CAAC,CAAA;gBACvB,OAAO,EAAE,CAAA;aACV;QACH,CAAC,EAAE,EAAE,CAAC,CAAA;IACR,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,cAAyC,EAAE,GAAG,MAAgB;IAC5F,MAAM,aAAa,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,CAAA;AACnH,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,cAAyC;IAChF,OAAO,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,SAAS,EAAE,CAAA;AACxH,CAAC","sourcesContent":["import {isTruthy} from '../environment/utilities.js'\nimport {render} from 'ink-testing-library'\n\nexport function waitForInputsToBeReady() {\n return new Promise((resolve) => setTimeout(resolve, 100))\n}\n\nexport function waitForChange(func: () => void, getChangingValue: () => string | number | undefined) {\n return new Promise<void>((resolve) => {\n const initialValue = getChangingValue()\n\n func()\n\n const interval = setInterval(() => {\n if (getChangingValue() !== initialValue) {\n clearInterval(interval)\n resolve()\n }\n }, 10)\n })\n}\n\nexport async function sendInput(renderInstance: ReturnType<typeof render>, ...inputs: string[]) {\n await waitForChange(() => inputs.forEach((input) => renderInstance.stdin.write(input)), renderInstance.lastFrame)\n}\n\nexport function getLastFrameAfterUnmount(renderInstance: ReturnType<typeof render>) {\n return isTruthy(process.env.CI) ? renderInstance.frames[renderInstance.frames.length - 2] : renderInstance.lastFrame()\n}\n"]}
package/dist/toml.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import * as toml from '@iarna/toml';
2
+ export declare function decode(input: string): object;
3
+ export declare function encode(content: toml.JsonMap): string;
package/dist/toml.js ADDED
@@ -0,0 +1,8 @@
1
+ import * as toml from '@iarna/toml';
2
+ export function decode(input) {
3
+ return toml.parse(input);
4
+ }
5
+ export function encode(content) {
6
+ return toml.stringify(content);
7
+ }
8
+ //# sourceMappingURL=toml.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toml.js","sourceRoot":"","sources":["../src/toml.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,aAAa,CAAA;AAEnC,MAAM,UAAU,MAAM,CAAC,KAAa;IAClC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;AAC1B,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,OAAqB;IAC1C,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;AAChC,CAAC","sourcesContent":["import * as toml from '@iarna/toml'\n\nexport function decode(input: string): object {\n return toml.parse(input)\n}\n\nexport function encode(content: toml.JsonMap): string {\n return toml.stringify(content)\n}\n"]}