@shopify/cli-kit 3.0.23 → 3.0.26

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 (287) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/assets/auth-error.html +2 -4
  3. package/assets/empty-url.html +2 -4
  4. package/assets/missing-code.html +2 -4
  5. package/assets/missing-state.html +2 -4
  6. package/assets/style.css +5 -8
  7. package/assets/success.html +1 -1
  8. package/dist/abort.d.ts +1 -0
  9. package/dist/abort.js +2 -0
  10. package/dist/abort.js.map +1 -0
  11. package/dist/analytics.d.ts +11 -0
  12. package/dist/analytics.js +96 -0
  13. package/dist/analytics.js.map +1 -0
  14. package/dist/api/admin.d.ts +3 -0
  15. package/dist/api/admin.js +80 -0
  16. package/dist/api/admin.js.map +1 -0
  17. package/dist/api/common.d.ts +11 -0
  18. package/dist/api/common.js +40 -0
  19. package/dist/api/common.js.map +1 -0
  20. package/dist/api/graphql/all_app_extension_registrations.d.ts +14 -0
  21. package/dist/api/graphql/all_app_extension_registrations.js +14 -0
  22. package/dist/api/graphql/all_app_extension_registrations.js.map +1 -0
  23. package/dist/api/graphql/all_orgs.d.ts +12 -0
  24. package/dist/api/graphql/all_orgs.js +14 -0
  25. package/dist/api/graphql/all_orgs.js.map +1 -0
  26. package/dist/api/graphql/all_stores_by_org.d.ts +18 -0
  27. package/dist/api/graphql/all_stores_by_org.js +21 -0
  28. package/dist/api/graphql/all_stores_by_org.js.map +1 -0
  29. package/dist/api/graphql/convert_dev_to_test_store.d.ts +16 -0
  30. package/dist/api/graphql/convert_dev_to_test_store.js +13 -0
  31. package/dist/api/graphql/convert_dev_to_test_store.js.map +1 -0
  32. package/dist/api/graphql/create_app.d.ts +28 -0
  33. package/dist/api/graphql/create_app.js +32 -0
  34. package/dist/api/graphql/create_app.js.map +1 -0
  35. package/dist/api/graphql/create_deployment.d.ts +33 -0
  36. package/dist/api/graphql/create_deployment.js +25 -0
  37. package/dist/api/graphql/create_deployment.js.map +1 -0
  38. package/dist/api/graphql/extension_create.d.ts +30 -0
  39. package/dist/api/graphql/extension_create.js +26 -0
  40. package/dist/api/graphql/extension_create.js.map +1 -0
  41. package/dist/api/graphql/extension_specifications.d.ts +18 -0
  42. package/dist/api/graphql/extension_specifications.js +18 -0
  43. package/dist/api/graphql/extension_specifications.js.map +1 -0
  44. package/dist/api/graphql/find_app.d.ts +13 -0
  45. package/dist/api/graphql/find_app.js +16 -0
  46. package/dist/api/graphql/find_app.js.map +1 -0
  47. package/dist/api/graphql/find_org.d.ts +23 -0
  48. package/dist/api/graphql/find_org.js +26 -0
  49. package/dist/api/graphql/find_org.js.map +1 -0
  50. package/dist/api/graphql/find_org_basic.d.ts +11 -0
  51. package/dist/api/graphql/find_org_basic.js +14 -0
  52. package/dist/api/graphql/find_org_basic.js.map +1 -0
  53. package/dist/api/graphql/functions/app_function_set.d.ts +43 -0
  54. package/dist/api/graphql/functions/app_function_set.js +52 -0
  55. package/dist/api/graphql/functions/app_function_set.js.map +1 -0
  56. package/dist/api/graphql/functions/compile_module.d.ts +15 -0
  57. package/dist/api/graphql/functions/compile_module.js +13 -0
  58. package/dist/api/graphql/functions/compile_module.js.map +1 -0
  59. package/dist/api/graphql/functions/function_service_proxy.d.ts +4 -0
  60. package/dist/api/graphql/functions/function_service_proxy.js +7 -0
  61. package/dist/api/graphql/functions/function_service_proxy.js.map +1 -0
  62. package/dist/api/graphql/functions/get_app_functions.d.ts +1 -0
  63. package/dist/api/graphql/functions/get_app_functions.js +10 -0
  64. package/dist/api/graphql/functions/get_app_functions.js.map +1 -0
  65. package/dist/api/graphql/functions/module_compilation_status.d.ts +15 -0
  66. package/dist/api/graphql/functions/module_compilation_status.js +13 -0
  67. package/dist/api/graphql/functions/module_compilation_status.js.map +1 -0
  68. package/dist/api/graphql/functions/module_upload_url_generate.d.ts +18 -0
  69. package/dist/api/graphql/functions/module_upload_url_generate.js +17 -0
  70. package/dist/api/graphql/functions/module_upload_url_generate.js.map +1 -0
  71. package/dist/api/graphql/generate_signed_upload_url.d.ts +15 -0
  72. package/dist/api/graphql/generate_signed_upload_url.js +15 -0
  73. package/dist/api/graphql/generate_signed_upload_url.js.map +1 -0
  74. package/dist/api/graphql/get_variant_id.d.ts +17 -0
  75. package/dist/api/graphql/get_variant_id.js +20 -0
  76. package/dist/api/graphql/get_variant_id.js.map +1 -0
  77. package/dist/api/graphql/index.d.ts +21 -0
  78. package/dist/api/graphql/index.js +22 -0
  79. package/dist/api/graphql/index.js.map +1 -0
  80. package/dist/api/graphql/update_draft.d.ts +33 -0
  81. package/dist/api/graphql/update_draft.js +24 -0
  82. package/dist/api/graphql/update_draft.js.map +1 -0
  83. package/dist/api/graphql/update_urls.d.ts +14 -0
  84. package/dist/api/graphql/update_urls.js +12 -0
  85. package/dist/api/graphql/update_urls.js.map +1 -0
  86. package/dist/api/identity.d.ts +1 -0
  87. package/dist/api/identity.js +29 -0
  88. package/dist/api/identity.js.map +1 -0
  89. package/dist/api/partners.d.ts +25 -0
  90. package/dist/api/partners.js +100 -0
  91. package/dist/api/partners.js.map +1 -0
  92. package/dist/api.d.ts +5 -0
  93. package/dist/api.js +6 -0
  94. package/dist/api.js.map +1 -0
  95. package/dist/checksum.d.ts +15 -0
  96. package/dist/checksum.js +27 -0
  97. package/dist/checksum.js.map +1 -0
  98. package/dist/cli.d.ts +7 -0
  99. package/dist/cli.js +13 -0
  100. package/dist/cli.js.map +1 -0
  101. package/dist/colors.d.ts +1 -0
  102. package/dist/colors.js +8 -0
  103. package/dist/colors.js.map +1 -0
  104. package/dist/constants.d.ts +43 -0
  105. package/dist/constants.js +63 -0
  106. package/dist/constants.js.map +1 -0
  107. package/dist/dependency.d.ts +128 -0
  108. package/dist/dependency.js +302 -0
  109. package/dist/dependency.js.map +1 -0
  110. package/dist/dot-env.d.ts +28 -0
  111. package/dist/dot-env.js +31 -0
  112. package/dist/dot-env.js.map +1 -0
  113. package/dist/environment/fqdn.d.ts +23 -0
  114. package/dist/environment/fqdn.js +61 -0
  115. package/dist/environment/fqdn.js.map +1 -0
  116. package/dist/environment/local.d.ts +48 -0
  117. package/dist/environment/local.js +82 -0
  118. package/dist/environment/local.js.map +1 -0
  119. package/dist/environment/service.d.ts +17 -0
  120. package/dist/environment/service.js +41 -0
  121. package/dist/environment/service.js.map +1 -0
  122. package/dist/environment/spin.d.ts +47 -0
  123. package/dist/environment/spin.js +83 -0
  124. package/dist/environment/spin.js.map +1 -0
  125. package/dist/environment/utilities.d.ts +6 -0
  126. package/dist/environment/utilities.js +12 -0
  127. package/dist/environment/utilities.js.map +1 -0
  128. package/dist/environment.d.ts +5 -0
  129. package/dist/environment.js +6 -0
  130. package/dist/environment.js.map +1 -0
  131. package/dist/error.d.ts +44 -0
  132. package/dist/error.js +91 -0
  133. package/dist/error.js.map +1 -0
  134. package/dist/file.d.ts +67 -0
  135. package/dist/file.js +165 -0
  136. package/dist/file.js.map +1 -0
  137. package/dist/git.d.ts +15 -0
  138. package/dist/git.js +48 -0
  139. package/dist/git.js.map +1 -0
  140. package/dist/github.d.ts +33 -0
  141. package/dist/github.js +56 -0
  142. package/dist/github.js.map +1 -0
  143. package/dist/haiku.d.ts +1 -0
  144. package/dist/haiku.js +8 -0
  145. package/dist/haiku.js.map +1 -0
  146. package/dist/http/fetch.d.ts +16 -0
  147. package/dist/http/fetch.js +18 -0
  148. package/dist/http/fetch.js.map +1 -0
  149. package/dist/http/formdata.d.ts +3 -0
  150. package/dist/http/formdata.js +6 -0
  151. package/dist/http/formdata.js.map +1 -0
  152. package/dist/http.d.ts +2 -0
  153. package/dist/http.js +3 -0
  154. package/dist/http.js.map +1 -0
  155. package/dist/id.d.ts +6 -0
  156. package/dist/id.js +18 -0
  157. package/dist/id.js.map +1 -0
  158. package/dist/index.d.ts +37 -2115
  159. package/dist/index.js +38 -46
  160. package/dist/index.js.map +1 -1
  161. package/dist/network/api.d.ts +2 -0
  162. package/dist/network/api.js +2 -0
  163. package/dist/network/api.js.map +1 -0
  164. package/dist/network/service.d.ts +16 -0
  165. package/dist/network/service.js +12 -0
  166. package/dist/network/service.js.map +1 -0
  167. package/dist/node/archiver.d.ts +6 -0
  168. package/dist/node/archiver.js +24 -0
  169. package/dist/node/archiver.js.map +1 -0
  170. package/dist/node/cli.d.ts +18 -0
  171. package/dist/node/cli.js +91 -0
  172. package/dist/node/cli.js.map +1 -0
  173. package/dist/npm.d.ts +27 -0
  174. package/dist/npm.js +20 -0
  175. package/dist/npm.js.map +1 -0
  176. package/dist/os.d.ts +10 -0
  177. package/dist/os.js +70 -0
  178. package/dist/os.js.map +1 -0
  179. package/dist/output.d.ts +142 -0
  180. package/dist/output.js +505 -0
  181. package/dist/output.js.map +1 -0
  182. package/dist/path.d.ts +22 -0
  183. package/dist/path.js +43 -0
  184. package/dist/path.js.map +1 -0
  185. package/dist/plugins.d.ts +9 -0
  186. package/dist/plugins.js +12 -0
  187. package/dist/plugins.js.map +1 -0
  188. package/dist/port.d.ts +5 -0
  189. package/dist/port.js +13 -0
  190. package/dist/port.js.map +1 -0
  191. package/dist/ruby.d.ts +21 -0
  192. package/dist/ruby.js +192 -0
  193. package/dist/ruby.js.map +1 -0
  194. package/dist/schema.d.ts +1 -0
  195. package/dist/schema.js +2 -0
  196. package/dist/schema.js.map +1 -0
  197. package/dist/secure-store.d.ts +19 -0
  198. package/dist/secure-store.js +63 -0
  199. package/dist/secure-store.js.map +1 -0
  200. package/dist/semver.d.ts +3 -0
  201. package/dist/semver.js +6 -0
  202. package/dist/semver.js.map +1 -0
  203. package/dist/session/authorize.d.ts +7 -0
  204. package/dist/session/authorize.js +40 -0
  205. package/dist/session/authorize.js.map +1 -0
  206. package/dist/session/exchange.d.ts +42 -0
  207. package/dist/session/exchange.js +144 -0
  208. package/dist/session/exchange.js.map +1 -0
  209. package/dist/session/identity.d.ts +3 -0
  210. package/dist/session/identity.js +58 -0
  211. package/dist/session/identity.js.map +1 -0
  212. package/dist/session/post-auth.d.ts +13 -0
  213. package/dist/session/post-auth.js +56 -0
  214. package/dist/session/post-auth.js.map +1 -0
  215. package/dist/session/redirect-listener.d.ts +34 -0
  216. package/dist/session/redirect-listener.js +97 -0
  217. package/dist/session/redirect-listener.js.map +1 -0
  218. package/dist/session/schema.d.ts +174 -0
  219. package/dist/session/schema.js +59 -0
  220. package/dist/session/schema.js.map +1 -0
  221. package/dist/session/scopes.d.ts +16 -0
  222. package/dist/session/scopes.js +53 -0
  223. package/dist/session/scopes.js.map +1 -0
  224. package/dist/session/store.d.ts +24 -0
  225. package/dist/session/store.js +88 -0
  226. package/dist/session/store.js.map +1 -0
  227. package/dist/session/token.d.ts +40 -0
  228. package/dist/session/token.js +22 -0
  229. package/dist/session/token.js.map +1 -0
  230. package/dist/session/validate.d.ts +17 -0
  231. package/dist/session/validate.js +75 -0
  232. package/dist/session/validate.js.map +1 -0
  233. package/dist/session.d.ts +88 -0
  234. package/dist/session.js +251 -0
  235. package/dist/session.js.map +1 -0
  236. package/dist/store/schema.d.ts +3 -0
  237. package/dist/store/schema.js +27 -0
  238. package/dist/store/schema.js.map +1 -0
  239. package/dist/store.d.ts +32 -0
  240. package/dist/store.js +102 -0
  241. package/dist/store.js.map +1 -0
  242. package/dist/string.d.ts +22 -0
  243. package/dist/string.js +38 -0
  244. package/dist/string.js.map +1 -0
  245. package/dist/system.d.ts +53 -0
  246. package/dist/system.js +109 -0
  247. package/dist/system.js.map +1 -0
  248. package/dist/template.d.ts +11 -0
  249. package/dist/template.js +50 -0
  250. package/dist/template.js.map +1 -0
  251. package/dist/testing/output.d.ts +9 -0
  252. package/dist/testing/output.js +15 -0
  253. package/dist/testing/output.js.map +1 -0
  254. package/dist/testing/store.d.ts +7 -0
  255. package/dist/testing/store.js +26 -0
  256. package/dist/testing/store.js.map +1 -0
  257. package/dist/toml.d.ts +3 -0
  258. package/dist/toml.js +8 -0
  259. package/dist/toml.js.map +1 -0
  260. package/dist/tsconfig.tsbuildinfo +1 -0
  261. package/dist/ui/autocomplete.d.ts +7 -0
  262. package/dist/ui/autocomplete.js +43 -0
  263. package/dist/ui/autocomplete.js.map +1 -0
  264. package/dist/ui/input.d.ts +7 -0
  265. package/dist/ui/input.js +48 -0
  266. package/dist/ui/input.js.map +1 -0
  267. package/dist/ui/select.d.ts +6 -0
  268. package/dist/ui/select.js +30 -0
  269. package/dist/ui/select.js.map +1 -0
  270. package/dist/ui.d.ts +36 -0
  271. package/dist/ui.js +124 -0
  272. package/dist/ui.js.map +1 -0
  273. package/dist/version.d.ts +19 -0
  274. package/dist/version.js +34 -0
  275. package/dist/version.js.map +1 -0
  276. package/dist/vscode.d.ts +8 -0
  277. package/dist/vscode.js +36 -0
  278. package/dist/vscode.js.map +1 -0
  279. package/dist/yaml.d.ts +2 -0
  280. package/dist/yaml.js +8 -0
  281. package/dist/yaml.js.map +1 -0
  282. package/package.json +32 -21
  283. package/dist/index-160b2bd2.js +0 -175294
  284. package/dist/index-160b2bd2.js.map +0 -1
  285. package/dist/index.d.ts.map +0 -1
  286. package/dist/multipart-parser-7ce1f707.js +0 -477
  287. package/dist/multipart-parser-7ce1f707.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,46 +1,38 @@
1
- export { b as abort, d as analytics, e as api, f as archiver, g as checksum, h as cli, c as constants, i as dependency, j as dotenv, k as environment, l as error, m as file, n as git, o as github, p as haiku, q as http, r as id, s as npm, t as os, u as output, v as path, w as plugins, x as port, y as ruby, z as schema, A as semver, B as session, C as store, D as string, E as system, G as template, H as temporary, I as toml, J as ui, K as version, L as vscode, M as yaml } from './index-160b2bd2.js';
2
- import * as Fastify from 'fastify';
3
- export { Fastify as fastify };
4
- import 'path';
5
- import 'url';
6
- import 'node:path';
7
- import 'node:url';
8
- import 'node:process';
9
- import 'node:fs';
10
- import 'os';
11
- import 'util';
12
- import 'stream';
13
- import 'fs';
14
- import 'events';
15
- import 'node:os';
16
- import '@oclif/core';
17
- import 'source-map-support';
18
- import 'constants';
19
- import 'assert';
20
- import 'node:stream';
21
- import 'node:util';
22
- import 'crypto';
23
- import 'prettier';
24
- import 'tty';
25
- import 'stacktracey';
26
- import 'node:buffer';
27
- import 'node:child_process';
28
- import 'child_process';
29
- import 'buffer';
30
- import 'node:http';
31
- import 'node:https';
32
- import 'node:zlib';
33
- import 'node:net';
34
- import 'http';
35
- import 'https';
36
- import 'readline';
37
- import 'inquirer';
38
- import 'dns';
39
- import 'zlib';
40
- import 'http2';
41
- import 'tls';
42
- import 'net';
43
- import 'punycode';
44
- import 'envfile';
45
- import 'module';
46
- //# sourceMappingURL=index.js.map
1
+ export { default as constants } from './constants.js';
2
+ export * as abort from './abort.js';
3
+ export * as analytics from './analytics.js';
4
+ export * as api from './api.js';
5
+ export * as checksum from './checksum.js';
6
+ export * as cli from './cli.js';
7
+ export * as dependency from './dependency.js';
8
+ export * as dotenv from './dot-env.js';
9
+ export * as environment from './environment.js';
10
+ export * as error from './error.js';
11
+ export * as fastify from 'fastify';
12
+ export * as file from './file.js';
13
+ export * as git from './git.js';
14
+ export * as github from './github.js';
15
+ export * as haiku from './haiku.js';
16
+ export * as http from './http.js';
17
+ export * as id from './id.js';
18
+ export * as npm from './npm.js';
19
+ export * as os from './os.js';
20
+ export * as output from './output.js';
21
+ export * as path from './path.js';
22
+ export * as plugins from './plugins.js';
23
+ export * as port from './port.js';
24
+ export * as ruby from './ruby.js';
25
+ export * as schema from './schema.js';
26
+ export * as semver from './semver.js';
27
+ export * as session from './session.js';
28
+ export * as store from './store.js';
29
+ export * as string from './string.js';
30
+ export * as system from './system.js';
31
+ export * as template from './template.js';
32
+ export * as toml from './toml.js';
33
+ export * as ui from './ui.js';
34
+ export * as version from './version.js';
35
+ export * as vscode from './vscode.js';
36
+ export * as yaml from './yaml.js';
37
+ export * as outputMocker from './testing/output.js';
38
+ //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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Ac,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,YAAY,MAAM,qBAAqB,CAAA","sourcesContent":["export {default as constants} from './constants.js'\nexport * as abort from './abort.js'\nexport * as analytics from './analytics.js'\nexport * as api from './api.js'\nexport * as checksum from './checksum.js'\nexport * as cli from './cli.js'\nexport * as dependency from './dependency.js'\nexport * as dotenv from './dot-env.js'\nexport * as environment from './environment.js'\nexport * as error from './error.js'\nexport * as fastify from 'fastify'\nexport * as file from './file.js'\nexport * as git from './git.js'\nexport * as github from './github.js'\nexport * as haiku from './haiku.js'\nexport * as http from './http.js'\nexport * as id from './id.js'\nexport * as npm from './npm.js'\nexport * as os from './os.js'\nexport * as output from './output.js'\nexport * as path from './path.js'\nexport * as plugins from './plugins.js'\nexport * as port from './port.js'\nexport * as ruby from './ruby.js'\nexport * as schema from './schema.js'\nexport * as semver from './semver.js'\nexport * as session from './session.js'\nexport * as store from './store.js'\nexport * as string from './string.js'\nexport * as system from './system.js'\nexport * as template from './template.js'\nexport * as toml from './toml.js'\nexport * as ui from './ui.js'\nexport * as version from './version.js'\nexport * as vscode from './vscode.js'\nexport * as yaml from './yaml.js'\nexport * as outputMocker from './testing/output.js'\n"]}
@@ -0,0 +1,2 @@
1
+ export declare type API = 'admin' | 'storefront-renderer' | 'partners';
2
+ export declare const allAPIs: API[];
@@ -0,0 +1,2 @@
1
+ export const allAPIs = ['admin', 'storefront-renderer', 'partners'];
2
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/network/api.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,OAAO,GAAU,CAAC,OAAO,EAAE,qBAAqB,EAAE,UAAU,CAAC,CAAA","sourcesContent":["export type API = 'admin' | 'storefront-renderer' | 'partners'\n\nexport const allAPIs: API[] = ['admin', 'storefront-renderer', 'partners']\n"]}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Enum for the differnet APIs the CLI can interact with.
3
+ * @readonly
4
+ * @enum {number}
5
+ */
6
+ export declare type Service = 'shopify' | 'admin' | 'identity';
7
+ /**
8
+ * Enum that represents the environment to use for a given service.
9
+ * @readonly
10
+ * @enum {number}
11
+ */
12
+ export declare enum Environment {
13
+ Local = "local",
14
+ Production = "production",
15
+ Spin = "spin"
16
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Enum that represents the environment to use for a given service.
3
+ * @readonly
4
+ * @enum {number}
5
+ */
6
+ export var Environment;
7
+ (function (Environment) {
8
+ Environment["Local"] = "local";
9
+ Environment["Production"] = "production";
10
+ Environment["Spin"] = "spin";
11
+ })(Environment || (Environment = {}));
12
+ //# sourceMappingURL=service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/network/service.ts"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,8BAAe,CAAA;IACf,wCAAyB,CAAA;IACzB,4BAAa,CAAA;AACf,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB","sourcesContent":["/**\n * Enum for the differnet APIs the CLI can interact with.\n * @readonly\n * @enum {number}\n */\nexport type Service = 'shopify' | 'admin' | 'identity'\n\n/**\n * Enum that represents the environment to use for a given service.\n * @readonly\n * @enum {number}\n */\nexport enum Environment {\n Local = 'local',\n Production = 'production',\n Spin = 'spin',\n}\n"]}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * It zips a directory.
3
+ * @param inputDirectory {string} The absolute path to the directory to be zipped.
4
+ * @param outputZipPath {string} The absolute path to the output zip file.
5
+ */
6
+ export declare function zip(inputDirectory: string, outputZipPath: string): Promise<void>;
@@ -0,0 +1,24 @@
1
+ import { debug, content, token } from '../output.js';
2
+ import { zip as crossZip } from 'cross-zip';
3
+ /**
4
+ * It zips a directory.
5
+ * @param inputDirectory {string} The absolute path to the directory to be zipped.
6
+ * @param outputZipPath {string} The absolute path to the output zip file.
7
+ */
8
+ export async function zip(inputDirectory, outputZipPath) {
9
+ debug(content `Zipping ${token.path(inputDirectory)} into ${token.path(outputZipPath)}`);
10
+ const cwd = process.cwd();
11
+ process.chdir(inputDirectory);
12
+ await new Promise((resolve, reject) => {
13
+ crossZip('./', outputZipPath, (error) => {
14
+ process.chdir(cwd);
15
+ if (error) {
16
+ reject(error);
17
+ }
18
+ else {
19
+ resolve();
20
+ }
21
+ });
22
+ });
23
+ }
24
+ //# sourceMappingURL=archiver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"archiver.js","sourceRoot":"","sources":["../../src/node/archiver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAC,MAAM,cAAc,CAAA;AAClD,OAAO,EAAC,GAAG,IAAI,QAAQ,EAAC,MAAM,WAAW,CAAA;AAEzC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,cAAsB,EAAE,aAAqB;IACrE,KAAK,CAAC,OAAO,CAAA,WAAW,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,SAAS,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,CAAA;IACvF,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAA;IACzB,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;IAE7B,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC1C,QAAQ,CAAC,IAAI,EAAE,aAAa,EAAE,CAAC,KAAK,EAAE,EAAE;YACtC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAClB,IAAI,KAAK,EAAE;gBACT,MAAM,CAAC,KAAK,CAAC,CAAA;aACd;iBAAM;gBACL,OAAO,EAAE,CAAA;aACV;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {debug, content, token} from '../output.js'\nimport {zip as crossZip} from 'cross-zip'\n\n/**\n * It zips a directory.\n * @param inputDirectory {string} The absolute path to the directory to be zipped.\n * @param outputZipPath {string} The absolute path to the output zip file.\n */\nexport async function zip(inputDirectory: string, outputZipPath: string): Promise<void> {\n debug(content`Zipping ${token.path(inputDirectory)} into ${token.path(outputZipPath)}`)\n const cwd = process.cwd()\n process.chdir(inputDirectory)\n\n await new Promise<void>((resolve, reject) => {\n crossZip('./', outputZipPath, (error) => {\n process.chdir(cwd)\n if (error) {\n reject(error)\n } else {\n resolve()\n }\n })\n })\n}\n"]}
@@ -0,0 +1,18 @@
1
+ interface RunCLIOptions {
2
+ /** The value of import.meta.url of the CLI executable module */
3
+ moduleURL: string;
4
+ /** The logs file name */
5
+ logFilename: string;
6
+ }
7
+ /**
8
+ * A function that abstracts away setting up the environment and running
9
+ * a CLI
10
+ * @param module {RunCLIOptions} Options.
11
+ */
12
+ export declare function runCLI(options: RunCLIOptions): Promise<void>;
13
+ /**
14
+ * A function for create-x CLIs that automatically runs the "init" command.
15
+ * @param options
16
+ */
17
+ export declare function runCreateCLI(options: RunCLIOptions): Promise<void>;
18
+ export default runCLI;
@@ -0,0 +1,91 @@
1
+ // CLI
2
+ import { initializeCliKitStore } from '../store.js';
3
+ import { initiateLogging } from '../output.js';
4
+ import { isDebug } from '../environment/local.js';
5
+ import constants, { bugsnagApiKey } from '../constants.js';
6
+ import { reportEvent } from '../analytics.js';
7
+ import { mapper as errorMapper, handler as errorHandler, AbortSilent, shouldReport as shouldReportError, } from '../error.js';
8
+ import { findUpAndReadPackageJson } from '../dependency.js';
9
+ import { moduleDirectory } from '../path.js';
10
+ import { run, settings, flush } from '@oclif/core';
11
+ import Bugsnag from '@bugsnag/js';
12
+ /**
13
+ * A function that abstracts away setting up the environment and running
14
+ * a CLI
15
+ * @param module {RunCLIOptions} Options.
16
+ */
17
+ export async function runCLI(options) {
18
+ await initializeCliKitStore();
19
+ initiateLogging({ filename: options.logFilename });
20
+ if (isDebug()) {
21
+ settings.debug = true;
22
+ }
23
+ else {
24
+ Bugsnag.start({
25
+ apiKey: bugsnagApiKey,
26
+ logger: null,
27
+ appVersion: await constants.versions.cliKit(),
28
+ autoTrackSessions: false,
29
+ });
30
+ }
31
+ run(undefined, options.moduleURL)
32
+ .then(flush)
33
+ .catch((error) => {
34
+ if (error instanceof AbortSilent) {
35
+ process.exit(1);
36
+ }
37
+ // eslint-disable-next-line promise/no-nesting
38
+ return errorMapper(error)
39
+ .then(reportError)
40
+ .then((error) => {
41
+ return errorHandler(error);
42
+ })
43
+ .then(() => {
44
+ process.exit(1);
45
+ });
46
+ });
47
+ }
48
+ /**
49
+ * A function for create-x CLIs that automatically runs the "init" command.
50
+ * @param options
51
+ */
52
+ export async function runCreateCLI(options) {
53
+ const packageJson = await findUpAndReadPackageJson(moduleDirectory(options.moduleURL));
54
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
55
+ const packageName = packageJson.content.name;
56
+ const name = packageName.replace('@shopify/create-', '');
57
+ const initIndex = process.argv.findIndex((arg) => arg.includes('init'));
58
+ if (initIndex === -1) {
59
+ const initIndex = process.argv.findIndex((arg) => arg.match(new RegExp(`bin(\\/|\\\\)+(create-${name}|dev|run)`))) + 1;
60
+ process.argv.splice(initIndex, 0, 'init');
61
+ }
62
+ await runCLI(options);
63
+ }
64
+ const reportError = async (errorToReport) => {
65
+ await reportEvent({ errorMessage: errorToReport.message });
66
+ if (settings.debug || !shouldReportError(errorToReport))
67
+ return errorToReport;
68
+ let mappedError;
69
+ // eslint-disable-next-line no-prototype-builtins
70
+ if (Error.prototype.isPrototypeOf(errorToReport)) {
71
+ mappedError = new Error(errorToReport.message);
72
+ if (errorToReport.stack) {
73
+ // For mac/linux, remove `file:///` from stacktrace
74
+ // For windows, remove `file:///C:/` from stacktrace
75
+ const regex = '\\((.*node_modules.)(@shopify.)?';
76
+ mappedError.stack = errorToReport.stack.replace(new RegExp(regex, 'g'), '(');
77
+ }
78
+ }
79
+ else if (typeof errorToReport === 'string') {
80
+ mappedError = new Error(errorToReport);
81
+ }
82
+ else {
83
+ mappedError = new Error('Unknown error');
84
+ }
85
+ await new Promise((resolve, reject) => {
86
+ Bugsnag.notify(mappedError, undefined, resolve);
87
+ });
88
+ return mappedError;
89
+ };
90
+ export default runCLI;
91
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/node/cli.ts"],"names":[],"mappings":"AAAA,MAAM;AACN,OAAO,EAAC,qBAAqB,EAAC,MAAM,aAAa,CAAA;AACjD,OAAO,EAAC,eAAe,EAAC,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAC,OAAO,EAAC,MAAM,yBAAyB,CAAA;AAC/C,OAAO,SAAS,EAAE,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAA;AACxD,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EACL,MAAM,IAAI,WAAW,EACrB,OAAO,IAAI,YAAY,EACvB,WAAW,EACX,YAAY,IAAI,iBAAiB,GAClC,MAAM,aAAa,CAAA;AACpB,OAAO,EAAC,wBAAwB,EAAC,MAAM,kBAAkB,CAAA;AACzD,OAAO,EAAC,eAAe,EAAC,MAAM,YAAY,CAAA;AAC1C,OAAO,EAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AAChD,OAAO,OAAO,MAAM,aAAa,CA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,IAAI,OAAO,aAAa,KAAK,QAAQ,EAAE;QAC5C,WAAW,GAAG,IAAI,KAAK,CAAC,aAAa,CAAC,CAAA;KACvC;SAAM;QACL,WAAW,GAAG,IAAI,KAAK,CAAC,eAAe,CAAC,CAAA;KACzC;IAED,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACpC,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;IACjD,CAAC,CAAC,CAAA;IACF,OAAO,WAAW,CAAA;AACpB,CAAC,CAAA;AAED,eAAe,MAAM,CAAA","sourcesContent":["// CLI\nimport {initializeCliKitStore} from '../store.js'\nimport {initiateLogging} from '../output.js'\nimport {isDebug} from '../environment/local.js'\nimport constants, {bugsnagApiKey} from '../constants.js'\nimport {reportEvent} from '../analytics.js'\nimport {\n mapper as errorMapper,\n handler as errorHandler,\n AbortSilent,\n shouldReport as shouldReportError,\n} from '../error.js'\nimport {findUpAndReadPackageJson} from '../dependency.js'\nimport {moduleDirectory} from '../path.js'\nimport {run, settings, flush} from '@oclif/core'\nimport Bugsnag from '@bugsnag/js'\n\ninterface RunCLIOptions {\n /** The value of import.meta.url of the CLI executable module */\n moduleURL: string\n /** The logs file name */\n logFilename: string\n}\n\n/**\n * A function that abstracts away setting up the environment and running\n * a CLI\n * @param module {RunCLIOptions} Options.\n */\nexport async function runCLI(options: RunCLIOptions) {\n await initializeCliKitStore()\n initiateLogging({filename: options.logFilename})\n if (isDebug()) {\n settings.debug = true\n } else {\n Bugsnag.start({\n apiKey: bugsnagApiKey,\n logger: null,\n appVersion: await constants.versions.cliKit(),\n autoTrackSessions: false,\n })\n }\n\n run(undefined, options.moduleURL)\n .then(flush)\n .catch((error: Error): Promise<void | Error> => {\n if (error instanceof AbortSilent) {\n process.exit(1)\n }\n // eslint-disable-next-line promise/no-nesting\n return errorMapper(error)\n .then(reportError)\n .then((error: Error) => {\n return errorHandler(error)\n })\n .then(() => {\n process.exit(1)\n })\n })\n}\n\n/**\n * A function for create-x CLIs that automatically runs the \"init\" command.\n * @param options\n */\nexport async function runCreateCLI(options: RunCLIOptions) {\n const packageJson = await findUpAndReadPackageJson(moduleDirectory(options.moduleURL))\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const packageName = (packageJson.content as any).name as string\n const name = packageName.replace('@shopify/create-', '')\n const initIndex = process.argv.findIndex((arg) => arg.includes('init'))\n if (initIndex === -1) {\n const initIndex =\n process.argv.findIndex((arg) => arg.match(new RegExp(`bin(\\\\/|\\\\\\\\)+(create-${name}|dev|run)`))) + 1\n process.argv.splice(initIndex, 0, 'init')\n }\n await runCLI(options)\n}\n\nconst reportError = async (errorToReport: Error): Promise<Error> => {\n await reportEvent({errorMessage: errorToReport.message})\n if (settings.debug || !shouldReportError(errorToReport)) return errorToReport\n\n let mappedError: Error\n\n // eslint-disable-next-line no-prototype-builtins\n if (Error.prototype.isPrototypeOf(errorToReport)) {\n mappedError = new Error(errorToReport.message)\n if (errorToReport.stack) {\n // For mac/linux, remove `file:///` from stacktrace\n // For windows, remove `file:///C:/` from stacktrace\n const regex = '\\\\((.*node_modules.)(@shopify.)?'\n mappedError.stack = errorToReport.stack.replace(new RegExp(regex, 'g'), '(')\n }\n } else if (typeof errorToReport === 'string') {\n mappedError = new Error(errorToReport)\n } else {\n mappedError = new Error('Unknown error')\n }\n\n await new Promise((resolve, reject) => {\n Bugsnag.notify(mappedError, undefined, resolve)\n })\n return mappedError\n}\n\nexport default runCLI\n"]}
package/dist/npm.d.ts ADDED
@@ -0,0 +1,27 @@
1
+ interface JSON {
2
+ [key: string]: JSONValue;
3
+ }
4
+ declare type JSONValue = string | number | boolean | JSON | JSONValue[];
5
+ export interface PackageJSON extends JSON {
6
+ name: string;
7
+ author: string;
8
+ dependencies: {
9
+ [key: string]: string;
10
+ };
11
+ devDependencies: {
12
+ [key: string]: string;
13
+ };
14
+ resolutions: {
15
+ [key: string]: string;
16
+ };
17
+ overrides: {
18
+ [key: string]: string;
19
+ };
20
+ scripts: {
21
+ [key: string]: string;
22
+ };
23
+ }
24
+ export declare function readPackageJSON(directory: string): Promise<PackageJSON>;
25
+ export declare function writePackageJSON(directory: string, packageJSON: JSON): Promise<void>;
26
+ export declare function updateAppData(packageJSON: JSON, name: string): Promise<void>;
27
+ export {};
package/dist/npm.js ADDED
@@ -0,0 +1,20 @@
1
+ import { join } from './path.js';
2
+ import * as file from './file.js';
3
+ import * as os from './os.js';
4
+ import { debug, token, content } from './output.js';
5
+ export async function readPackageJSON(directory) {
6
+ debug(content `Reading and decoding the content from package.json at ${token.path(directory)}...`);
7
+ const packagePath = join(directory, 'package.json');
8
+ const packageJSON = JSON.parse(await file.read(packagePath));
9
+ return packageJSON;
10
+ }
11
+ export async function writePackageJSON(directory, packageJSON) {
12
+ debug(content `JSON-encoding and writing content to package.json at ${token.path(directory)}...`);
13
+ const packagePath = join(directory, 'package.json');
14
+ await file.write(packagePath, JSON.stringify(packageJSON, null, 2));
15
+ }
16
+ export async function updateAppData(packageJSON, name) {
17
+ packageJSON.name = name;
18
+ packageJSON.author = (await os.username()) ?? '';
19
+ }
20
+ //# sourceMappingURL=npm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"npm.js","sourceRoot":"","sources":["../src/npm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAC,MAAM,aAAa,CAAA;AAkBjD,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,SAAiB;IACrD,KAAK,CAAC,OAAO,CAAA,yDAAyD,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;IACjG,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAA;IACnD,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAA;IAE5D,OAAO,WAAW,CAAA;AACpB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,SAAiB,EAAE,WAAiB;IACzE,KAAK,CAAC,OAAO,CAAA,wDAAwD,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;IAChG,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAA;IACnD,MAAM,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;AACrE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,WAAiB,EAAE,IAAY;IACjE,WAAW,CAAC,IAAI,GAAG,IAAI,CAAA;IACvB,WAAW,CAAC,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAA;AAClD,CAAC","sourcesContent":["import {join} from './path.js'\nimport * as file from './file.js'\nimport * as os from './os.js'\nimport {debug, token, content} from './output.js'\n\ninterface JSON {\n [key: string]: JSONValue\n}\n\ntype JSONValue = string | number | boolean | JSON | JSONValue[]\n\nexport interface PackageJSON extends JSON {\n name: string\n author: string\n dependencies: {[key: string]: string}\n devDependencies: {[key: string]: string}\n resolutions: {[key: string]: string}\n overrides: {[key: string]: string}\n scripts: {[key: string]: string}\n}\n\nexport async function readPackageJSON(directory: string): Promise<PackageJSON> {\n debug(content`Reading and decoding the content from package.json at ${token.path(directory)}...`)\n const packagePath = join(directory, 'package.json')\n const packageJSON = JSON.parse(await file.read(packagePath))\n\n return packageJSON\n}\n\nexport async function writePackageJSON(directory: string, packageJSON: JSON): Promise<void> {\n debug(content`JSON-encoding and writing content to package.json at ${token.path(directory)}...`)\n const packagePath = join(directory, 'package.json')\n await file.write(packagePath, JSON.stringify(packageJSON, null, 2))\n}\n\nexport async function updateAppData(packageJSON: JSON, name: string): Promise<void> {\n packageJSON.name = name\n packageJSON.author = (await os.username()) ?? ''\n}\n"]}
package/dist/os.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ import { platform as processPlatform } from 'node:process';
2
+ export declare const username: (platform?: typeof processPlatform) => Promise<string | null>;
3
+ /**
4
+ * Returns the platform and architecture.
5
+ * @returns {{platform: string, arch: string}} Returns the current platform and architecture.
6
+ */
7
+ export declare const platformAndArch: (platform?: typeof processPlatform) => {
8
+ platform: string;
9
+ arch: string;
10
+ };
package/dist/os.js ADDED
@@ -0,0 +1,70 @@
1
+ import { debug, content } from './output.js';
2
+ import { execa } from 'execa';
3
+ import { platform as processPlatform } from 'node:process';
4
+ import { userInfo as osUserInfo, arch as osArch } from 'node:os';
5
+ const getEnvironmentVariable = () => {
6
+ const { env } = process;
7
+ return env.SUDO_USER || env.C9_USER || env.LOGNAME || env.USER || env.LNAME || env.USERNAME;
8
+ };
9
+ const getUsernameFromOsUserInfo = () => {
10
+ try {
11
+ return osUserInfo().username;
12
+ // eslint-disable-next-line no-catch-all/no-catch-all
13
+ }
14
+ catch {
15
+ return null;
16
+ }
17
+ };
18
+ const cleanWindowsCommand = (value) => value.replace(/^.*\\/, '');
19
+ const makeUsernameFromId = (userId) => `no-username-${userId}`;
20
+ // This code has been vendored from https://github.com/sindresorhus/username
21
+ // because adding it as a transtive dependency causes conflicts with other
22
+ // packages that haven't been yet migrated to the latest version.
23
+ export const username = async (platform = processPlatform) => {
24
+ debug(content `Obtaining user name...`);
25
+ const environmentVariable = getEnvironmentVariable();
26
+ if (environmentVariable) {
27
+ return environmentVariable;
28
+ }
29
+ const userInfoUsername = getUsernameFromOsUserInfo();
30
+ if (userInfoUsername) {
31
+ return userInfoUsername;
32
+ }
33
+ /**
34
+ First we try to get the ID of the user and then the actual username. We do this because in `docker run --user <uid>:<gid>` context, we don't have "username" available. Therefore, we have a fallback to `makeUsernameFromId` for such scenario. Applies also to the `sync()` method below.
35
+ */
36
+ try {
37
+ if (platform === 'win32') {
38
+ const { stdout } = await execa('whoami');
39
+ return cleanWindowsCommand(stdout);
40
+ }
41
+ const { stdout: userId } = await execa('id', ['-u']);
42
+ try {
43
+ const { stdout } = await execa('id', ['-un', userId]);
44
+ return stdout;
45
+ // eslint-disable-next-line no-catch-all/no-catch-all,no-empty
46
+ }
47
+ catch { }
48
+ return makeUsernameFromId(userId);
49
+ // eslint-disable-next-line no-catch-all/no-catch-all
50
+ }
51
+ catch {
52
+ return null;
53
+ }
54
+ };
55
+ /**
56
+ * Returns the platform and architecture.
57
+ * @returns {{platform: string, arch: string}} Returns the current platform and architecture.
58
+ */
59
+ export const platformAndArch = (platform = processPlatform) => {
60
+ let arch = osArch();
61
+ if (arch === 'x64') {
62
+ arch = 'amd64';
63
+ }
64
+ let platformString = platform;
65
+ if (platform.match(/^win.+/)) {
66
+ platformString = 'windows';
67
+ }
68
+ return { platform: platformString, arch };
69
+ };
70
+ //# sourceMappingURL=os.js.map
package/dist/os.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"os.js","sourceRoot":"","sources":["../src/os.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,OAAO,EAAC,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAC,KAAK,EAAC,MAAM,OAAO,CAAA;AAC3B,OAAO,EAAC,QAAQ,IAAI,eAAe,EAAC,MAAM,cAAc,CAAA;AACxD,OAAO,EAAC,QAAQ,IAAI,UAAU,EAAE,IAAI,IAAI,MAAM,EAAC,MAAM,SAAS,CAAA;AAE9D,MAAM,sBAAsB,GAAG,GAAG,EAAE;IAClC,MAAM,EAAC,GAAG,EAAC,GAAG,OAAO,CAAA;IAErB,OAAO,GAAG,CAAC,SAAS,IAAI,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,KA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AAA;YAEb,8DAA8D;SAC/D;QAAC,MAAM,GAAE;QACV,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAA;QACjC,qDAAqD;KACtD;IAAC,MAAM;QACN,OAAO,IAAI,CAAA;KACZ;AACH,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,WAAmC,eAAe,EAChB,EAAE;IACpC,IAAI,IAAI,GAAG,MAAM,EAAE,CAAA;IACnB,IAAI,IAAI,KAAK,KAAK,EAAE;QAClB,IAAI,GAAG,OAAO,CAAA;KACf;IACD,IAAI,cAAc,GAAG,QAAkB,CAAA;IACvC,IAAI,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE;QAC5B,cAAc,GAAG,SAAS,CAAA;KAC3B;IACD,OAAO,EAAC,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAC,CAAA;AACzC,CAAC,CAAA","sourcesContent":["import {debug, content} from './output.js'\nimport {execa} from 'execa'\nimport {platform as processPlatform} from 'node:process'\nimport {userInfo as osUserInfo, arch as osArch} from 'node:os'\n\nconst getEnvironmentVariable = () => {\n const {env} = process\n\n return env.SUDO_USER || env.C9_USER || env.LOGNAME || env.USER || env.LNAME || env.USERNAME\n}\n\nconst getUsernameFromOsUserInfo = (): string | null => {\n try {\n return osUserInfo().username\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return null\n }\n}\n\nconst cleanWindowsCommand = (value: string) => value.replace(/^.*\\\\/, '')\n\nconst makeUsernameFromId = (userId: string) => `no-username-${userId}`\n\n// This code has been vendored from https://github.com/sindresorhus/username\n// because adding it as a transtive dependency causes conflicts with other\n// packages that haven't been yet migrated to the latest version.\nexport const username = async (platform: typeof processPlatform = processPlatform): Promise<string | null> => {\n debug(content`Obtaining user name...`)\n const environmentVariable = getEnvironmentVariable()\n if (environmentVariable) {\n return environmentVariable\n }\n\n const userInfoUsername = getUsernameFromOsUserInfo()\n if (userInfoUsername) {\n return userInfoUsername\n }\n\n /**\n\tFirst we try to get the ID of the user and then the actual username. We do this because in `docker run --user <uid>:<gid>` context, we don't have \"username\" available. Therefore, we have a fallback to `makeUsernameFromId` for such scenario. Applies also to the `sync()` method below.\n\t*/\n try {\n if (platform === 'win32') {\n const {stdout} = await execa('whoami')\n return cleanWindowsCommand(stdout)\n }\n\n const {stdout: userId} = await execa('id', ['-u'])\n try {\n const {stdout} = await execa('id', ['-un', userId])\n return stdout\n\n // eslint-disable-next-line no-catch-all/no-catch-all,no-empty\n } catch {}\n return makeUsernameFromId(userId)\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return null\n }\n}\n\n/**\n * Returns the platform and architecture.\n * @returns {{platform: string, arch: string}} Returns the current platform and architecture.\n */\nexport const platformAndArch = (\n platform: typeof processPlatform = processPlatform,\n): {platform: string; arch: string} => {\n let arch = osArch()\n if (arch === 'x64') {\n arch = 'amd64'\n }\n let platformString = platform as string\n if (platform.match(/^win.+/)) {\n platformString = 'windows'\n }\n return {platform: platformString, arch}\n}\n"]}
@@ -0,0 +1,142 @@
1
+ /// <reference types="node" />
2
+ import { Fatal } from './error.js';
3
+ import { DependencyManager } from './dependency.js';
4
+ import { AbortSignal } from 'abort-controller';
5
+ import { Writable } from 'node:stream';
6
+ export declare function initiateLogging({ logDir, filename, }: {
7
+ logDir?: string;
8
+ filename?: string;
9
+ }): void;
10
+ declare enum ContentTokenType {
11
+ Raw = 0,
12
+ Command = 1,
13
+ Json = 2,
14
+ Path = 3,
15
+ Link = 4,
16
+ Heading = 5,
17
+ SubHeading = 6,
18
+ Italic = 7,
19
+ ErrorText = 8,
20
+ Yellow = 9,
21
+ Cyan = 10,
22
+ Magenta = 11,
23
+ Green = 12
24
+ }
25
+ interface ContentMetadata {
26
+ link?: string;
27
+ }
28
+ declare class ContentToken {
29
+ type: ContentTokenType;
30
+ value: Message;
31
+ metadata: ContentMetadata;
32
+ constructor(value: Message, metadata: ContentMetadata | undefined, type: ContentTokenType);
33
+ }
34
+ export declare const token: {
35
+ raw: (value: Message) => ContentToken;
36
+ genericShellCommand: (value: Message) => ContentToken;
37
+ json: (value: any) => ContentToken;
38
+ path: (value: Message) => ContentToken;
39
+ link: (value: Message, link: string) => ContentToken;
40
+ heading: (value: Message) => ContentToken;
41
+ subheading: (value: Message) => ContentToken;
42
+ italic: (value: Message) => ContentToken;
43
+ errorText: (value: Message) => ContentToken;
44
+ cyan: (value: Message) => ContentToken;
45
+ yellow: (value: Message) => ContentToken;
46
+ magenta: (value: Message) => ContentToken;
47
+ green: (value: Message) => ContentToken;
48
+ packagejsonScript: (dependencyManager: DependencyManager, scriptName: string, ...scriptArgs: string[]) => ContentToken;
49
+ successIcon: () => ContentToken;
50
+ failIcon: () => ContentToken;
51
+ };
52
+ export declare class TokenizedString {
53
+ value: string;
54
+ constructor(value: string);
55
+ }
56
+ export declare type Message = string | TokenizedString;
57
+ export declare function content(strings: TemplateStringsArray, ...keys: (ContentToken | string)[]): TokenizedString;
58
+ /** Log levels */
59
+ export declare type LogLevel = 'fatal' | 'error' | 'warn' | 'info' | 'debug' | 'trace' | 'silent';
60
+ /**
61
+ *
62
+ * @returns {LogLevel} It returns the log level set by the user.
63
+ */
64
+ export declare const currentLogLevel: () => LogLevel;
65
+ export declare const shouldOutput: (logLevel: LogLevel) => boolean;
66
+ export declare let collectedLogs: {
67
+ [key: string]: string[];
68
+ };
69
+ export declare const clearCollectedLogs: () => void;
70
+ /**
71
+ * Ouputs information to the user. This is akin to "console.log"
72
+ * Info messages don't get additional formatting.
73
+ * Note: Info messages are sent through the standard output.
74
+ * @param content {string} The content to be output to the user.
75
+ */
76
+ export declare const info: (content: Message) => void;
77
+ /**
78
+ * Outputs a success message to the user.
79
+ * Success message receive a special formatting to make them stand out in the console.
80
+ * Note: Success messages are sent through the standard output.
81
+ * @param content {string} The content to be output to the user.
82
+ */
83
+ export declare const success: (content: Message) => void;
84
+ /**
85
+ * Outputs a completed message to the user.
86
+ * Completed message receive a special formatting to make them stand out in the console.
87
+ * Note: Completed messages are sent through the standard output.
88
+ * @param content {string} The content to be output to the user.
89
+ */
90
+ export declare const completed: (content: Message) => void;
91
+ /**
92
+ * Ouputs debug information to the user. By default these output is hidden unless the user calls the CLI with --verbose.
93
+ * Debug messages don't get additional formatting.
94
+ * Note: Debug messages are sent through the standard output.
95
+ * @param content {string} The content to be output to the user.
96
+ */
97
+ export declare const debug: (content: Message) => void;
98
+ /**
99
+ * Outputs a warning message to the user.
100
+ * Warning messages receive a special formatting to make them stand out in the console.
101
+ * Note: Warning messages are sent through the standard output.
102
+ * @param content {string} The content to be output to the user.
103
+ */
104
+ export declare const warn: (content: Message) => void;
105
+ /**
106
+ * Prints a new line in the terminal.
107
+ */
108
+ export declare const newline: () => void;
109
+ /**
110
+ * Formats and outputs a fatal error.
111
+ * Note: This API is not intended to be used internally. If you want to
112
+ * abort the execution due to an error, raise a fatal error and let the
113
+ * error handler handle and format it.
114
+ * @param content {Fatal} The fatal error to be output.
115
+ */
116
+ export declare const error: (content: Fatal) => Promise<void>;
117
+ export declare function stringifyMessage(message: Message): string;
118
+ export interface OutputProcess {
119
+ /** The prefix to include in the logs
120
+ * [vite] Output coming from Vite
121
+ */
122
+ prefix: string;
123
+ /**
124
+ * A callback to invoke the process. stdout and stderr should be used
125
+ * to send standard output and error data that gets formatted with the
126
+ * right prefix.
127
+ */
128
+ action: (stdout: Writable, stderr: Writable, signal: AbortSignal) => Promise<void>;
129
+ }
130
+ /**
131
+ * Use this function when you have multiple concurrent processes that send data events
132
+ * and we need to output them ensuring that they can visually differenciated by the user.
133
+ *
134
+ * @param processes {OutputProcess[]} A list of processes to run concurrently.
135
+ */
136
+ export declare function concurrent(processes: OutputProcess[], callback?: ((signal: AbortSignal) => void) | undefined): Promise<void>;
137
+ export declare function logFileExists(): boolean;
138
+ export declare function logToFile(message: string, logLevel: string): void;
139
+ export declare function unstyled(message: string): string;
140
+ export declare function shouldDisplayColors(): boolean;
141
+ export declare function pageLogs(): Promise<void>;
142
+ export {};