@shopify/cli-kit 3.0.25 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (289) hide show
  1. package/CHANGELOG.md +34 -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 +13 -0
  12. package/dist/analytics.js +111 -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/find_store_by_domain.d.ts +21 -0
  54. package/dist/api/graphql/find_store_by_domain.js +24 -0
  55. package/dist/api/graphql/find_store_by_domain.js.map +1 -0
  56. package/dist/api/graphql/functions/app_function_set.d.ts +43 -0
  57. package/dist/api/graphql/functions/app_function_set.js +52 -0
  58. package/dist/api/graphql/functions/app_function_set.js.map +1 -0
  59. package/dist/api/graphql/functions/compile_module.d.ts +15 -0
  60. package/dist/api/graphql/functions/compile_module.js +13 -0
  61. package/dist/api/graphql/functions/compile_module.js.map +1 -0
  62. package/dist/api/graphql/functions/function_service_proxy.d.ts +4 -0
  63. package/dist/api/graphql/functions/function_service_proxy.js +7 -0
  64. package/dist/api/graphql/functions/function_service_proxy.js.map +1 -0
  65. package/dist/api/graphql/functions/get_app_functions.d.ts +1 -0
  66. package/dist/api/graphql/functions/get_app_functions.js +10 -0
  67. package/dist/api/graphql/functions/get_app_functions.js.map +1 -0
  68. package/dist/api/graphql/functions/module_compilation_status.d.ts +15 -0
  69. package/dist/api/graphql/functions/module_compilation_status.js +13 -0
  70. package/dist/api/graphql/functions/module_compilation_status.js.map +1 -0
  71. package/dist/api/graphql/functions/module_upload_url_generate.d.ts +18 -0
  72. package/dist/api/graphql/functions/module_upload_url_generate.js +17 -0
  73. package/dist/api/graphql/functions/module_upload_url_generate.js.map +1 -0
  74. package/dist/api/graphql/generate_signed_upload_url.d.ts +15 -0
  75. package/dist/api/graphql/generate_signed_upload_url.js +15 -0
  76. package/dist/api/graphql/generate_signed_upload_url.js.map +1 -0
  77. package/dist/api/graphql/get_variant_id.d.ts +17 -0
  78. package/dist/api/graphql/get_variant_id.js +20 -0
  79. package/dist/api/graphql/get_variant_id.js.map +1 -0
  80. package/dist/api/graphql/index.d.ts +22 -0
  81. package/dist/api/graphql/index.js +23 -0
  82. package/dist/api/graphql/index.js.map +1 -0
  83. package/dist/api/graphql/update_draft.d.ts +33 -0
  84. package/dist/api/graphql/update_draft.js +24 -0
  85. package/dist/api/graphql/update_draft.js.map +1 -0
  86. package/dist/api/graphql/update_urls.d.ts +14 -0
  87. package/dist/api/graphql/update_urls.js +12 -0
  88. package/dist/api/graphql/update_urls.js.map +1 -0
  89. package/dist/api/identity.d.ts +1 -0
  90. package/dist/api/identity.js +32 -0
  91. package/dist/api/identity.js.map +1 -0
  92. package/dist/api/partners.d.ts +25 -0
  93. package/dist/api/partners.js +100 -0
  94. package/dist/api/partners.js.map +1 -0
  95. package/dist/api.d.ts +5 -0
  96. package/dist/api.js +6 -0
  97. package/dist/api.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/constants.d.ts +43 -0
  102. package/dist/constants.js +63 -0
  103. package/dist/constants.js.map +1 -0
  104. package/dist/environment/fqdn.d.ts +23 -0
  105. package/dist/environment/fqdn.js +61 -0
  106. package/dist/environment/fqdn.js.map +1 -0
  107. package/dist/environment/local.d.ts +48 -0
  108. package/dist/environment/local.js +82 -0
  109. package/dist/environment/local.js.map +1 -0
  110. package/dist/environment/service.d.ts +17 -0
  111. package/dist/environment/service.js +41 -0
  112. package/dist/environment/service.js.map +1 -0
  113. package/dist/environment/spin.d.ts +47 -0
  114. package/dist/environment/spin.js +83 -0
  115. package/dist/environment/spin.js.map +1 -0
  116. package/dist/environment/utilities.d.ts +6 -0
  117. package/dist/environment/utilities.js +12 -0
  118. package/dist/environment/utilities.js.map +1 -0
  119. package/dist/environment.d.ts +5 -0
  120. package/dist/environment.js +6 -0
  121. package/dist/environment.js.map +1 -0
  122. package/dist/error.d.ts +44 -0
  123. package/dist/error.js +91 -0
  124. package/dist/error.js.map +1 -0
  125. package/dist/file.d.ts +67 -0
  126. package/dist/file.js +165 -0
  127. package/dist/file.js.map +1 -0
  128. package/dist/git.d.ts +15 -0
  129. package/dist/git.js +48 -0
  130. package/dist/git.js.map +1 -0
  131. package/dist/github.d.ts +33 -0
  132. package/dist/github.js +56 -0
  133. package/dist/github.js.map +1 -0
  134. package/dist/haiku.d.ts +1 -0
  135. package/dist/haiku.js +8 -0
  136. package/dist/haiku.js.map +1 -0
  137. package/dist/http/fetch.d.ts +16 -0
  138. package/dist/http/fetch.js +18 -0
  139. package/dist/http/fetch.js.map +1 -0
  140. package/dist/http/formdata.d.ts +3 -0
  141. package/dist/http/formdata.js +6 -0
  142. package/dist/http/formdata.js.map +1 -0
  143. package/dist/http.d.ts +2 -0
  144. package/dist/http.js +3 -0
  145. package/dist/http.js.map +1 -0
  146. package/dist/id.d.ts +6 -0
  147. package/dist/id.js +18 -0
  148. package/dist/id.js.map +1 -0
  149. package/dist/index.d.ts +33 -2179
  150. package/dist/index.js +34 -3264
  151. package/dist/index.js.map +1 -1
  152. package/dist/network/api.d.ts +2 -0
  153. package/dist/network/api.js +2 -0
  154. package/dist/network/api.js.map +1 -0
  155. package/dist/network/service.d.ts +16 -0
  156. package/dist/network/service.js +12 -0
  157. package/dist/network/service.js.map +1 -0
  158. package/dist/{archiver.d.ts → node/archiver.d.ts} +1 -4
  159. package/dist/node/archiver.js +22 -42
  160. package/dist/node/archiver.js.map +1 -1
  161. package/dist/node/checksum.d.ts +20 -0
  162. package/dist/node/checksum.js +32 -0
  163. package/dist/node/checksum.js.map +1 -0
  164. package/dist/node/cli.d.ts +18 -0
  165. package/dist/node/cli.js +96 -0
  166. package/dist/node/cli.js.map +1 -0
  167. package/dist/node/colors.d.ts +1 -0
  168. package/dist/node/colors.js +8 -0
  169. package/dist/node/colors.js.map +1 -0
  170. package/dist/node/dot-env.d.ts +33 -0
  171. package/dist/node/dot-env.js +36 -0
  172. package/dist/node/dot-env.js.map +1 -0
  173. package/dist/node/node-package-manager.d.ts +197 -0
  174. package/dist/node/node-package-manager.js +309 -0
  175. package/dist/node/node-package-manager.js.map +1 -0
  176. package/dist/node/ruby.d.ts +30 -0
  177. package/dist/node/ruby.js +197 -0
  178. package/dist/node/ruby.js.map +1 -0
  179. package/dist/npm.d.ts +27 -0
  180. package/dist/npm.js +20 -0
  181. package/dist/npm.js.map +1 -0
  182. package/dist/os.d.ts +10 -0
  183. package/dist/os.js +70 -0
  184. package/dist/os.js.map +1 -0
  185. package/dist/output.d.ts +149 -0
  186. package/dist/output.js +515 -0
  187. package/dist/output.js.map +1 -0
  188. package/dist/path.d.ts +22 -0
  189. package/dist/path.js +43 -0
  190. package/dist/path.js.map +1 -0
  191. package/dist/plugins.d.ts +9 -0
  192. package/dist/plugins.js +12 -0
  193. package/dist/plugins.js.map +1 -0
  194. package/dist/port.d.ts +5 -0
  195. package/dist/port.js +35 -0
  196. package/dist/port.js.map +1 -0
  197. package/dist/schema.d.ts +1 -0
  198. package/dist/schema.js +2 -0
  199. package/dist/schema.js.map +1 -0
  200. package/dist/secure-store.d.ts +19 -0
  201. package/dist/secure-store.js +63 -0
  202. package/dist/secure-store.js.map +1 -0
  203. package/dist/semver.d.ts +3 -0
  204. package/dist/semver.js +6 -0
  205. package/dist/semver.js.map +1 -0
  206. package/dist/session/authorize.d.ts +7 -0
  207. package/dist/session/authorize.js +40 -0
  208. package/dist/session/authorize.js.map +1 -0
  209. package/dist/session/exchange.d.ts +42 -0
  210. package/dist/session/exchange.js +144 -0
  211. package/dist/session/exchange.js.map +1 -0
  212. package/dist/session/identity.d.ts +3 -0
  213. package/dist/session/identity.js +58 -0
  214. package/dist/session/identity.js.map +1 -0
  215. package/dist/session/post-auth.d.ts +13 -0
  216. package/dist/session/post-auth.js +56 -0
  217. package/dist/session/post-auth.js.map +1 -0
  218. package/dist/session/redirect-listener.d.ts +34 -0
  219. package/dist/session/redirect-listener.js +97 -0
  220. package/dist/session/redirect-listener.js.map +1 -0
  221. package/dist/session/schema.d.ts +174 -0
  222. package/dist/session/schema.js +59 -0
  223. package/dist/session/schema.js.map +1 -0
  224. package/dist/session/scopes.d.ts +16 -0
  225. package/dist/session/scopes.js +53 -0
  226. package/dist/session/scopes.js.map +1 -0
  227. package/dist/session/store.d.ts +24 -0
  228. package/dist/session/store.js +88 -0
  229. package/dist/session/store.js.map +1 -0
  230. package/dist/session/token.d.ts +40 -0
  231. package/dist/session/token.js +22 -0
  232. package/dist/session/token.js.map +1 -0
  233. package/dist/session/validate.d.ts +17 -0
  234. package/dist/session/validate.js +75 -0
  235. package/dist/session/validate.js.map +1 -0
  236. package/dist/session.d.ts +88 -0
  237. package/dist/session.js +251 -0
  238. package/dist/session.js.map +1 -0
  239. package/dist/store/schema.d.ts +3 -0
  240. package/dist/store/schema.js +27 -0
  241. package/dist/store/schema.js.map +1 -0
  242. package/dist/store.d.ts +32 -0
  243. package/dist/store.js +102 -0
  244. package/dist/store.js.map +1 -0
  245. package/dist/string.d.ts +22 -0
  246. package/dist/string.js +38 -0
  247. package/dist/string.js.map +1 -0
  248. package/dist/system.d.ts +53 -0
  249. package/dist/system.js +109 -0
  250. package/dist/system.js.map +1 -0
  251. package/dist/template.d.ts +11 -0
  252. package/dist/template.js +50 -0
  253. package/dist/template.js.map +1 -0
  254. package/dist/testing/output.d.ts +9 -0
  255. package/dist/testing/output.js +15 -0
  256. package/dist/testing/output.js.map +1 -0
  257. package/dist/testing/store.d.ts +7 -0
  258. package/dist/testing/store.js +26 -0
  259. package/dist/testing/store.js.map +1 -0
  260. package/dist/toml.d.ts +3 -0
  261. package/dist/toml.js +8 -0
  262. package/dist/toml.js.map +1 -0
  263. package/dist/tsconfig.tsbuildinfo +1 -0
  264. package/dist/ui/autocomplete.d.ts +7 -0
  265. package/dist/ui/autocomplete.js +43 -0
  266. package/dist/ui/autocomplete.js.map +1 -0
  267. package/dist/ui/input.d.ts +7 -0
  268. package/dist/ui/input.js +48 -0
  269. package/dist/ui/input.js.map +1 -0
  270. package/dist/ui/select.d.ts +6 -0
  271. package/dist/ui/select.js +30 -0
  272. package/dist/ui/select.js.map +1 -0
  273. package/dist/ui.d.ts +36 -0
  274. package/dist/ui.js +124 -0
  275. package/dist/ui.js.map +1 -0
  276. package/dist/version.d.ts +19 -0
  277. package/dist/version.js +34 -0
  278. package/dist/version.js.map +1 -0
  279. package/dist/vscode.d.ts +8 -0
  280. package/dist/vscode.js +36 -0
  281. package/dist/vscode.js.map +1 -0
  282. package/dist/yaml.d.ts +2 -0
  283. package/dist/yaml.js +8 -0
  284. package/dist/yaml.js.map +1 -0
  285. package/package.json +19 -8
  286. package/dist/archiver.d.ts.map +0 -1
  287. package/dist/index.d.ts.map +0 -1
  288. package/dist/local-d0094ffe.js +0 -1344
  289. package/dist/local-d0094ffe.js.map +0 -1
@@ -1,1344 +0,0 @@
1
- import commondir from 'commondir';
2
- import { relative, dirname, join, normalize, resolve, basename, extname, isAbsolute, sep } from 'pathe';
3
- import { fileURLToPath } from 'url';
4
- import { findUp } from 'find-up';
5
- import glob from 'fast-glob';
6
- import { pathToFileURL } from 'node:url';
7
- import envPaths from 'env-paths';
8
- import { Errors } from '@oclif/core';
9
- import sourceMapSupport from 'source-map-support';
10
- import { ExtendableError } from 'ts-error';
11
- import { AbortSignal, AbortController } from 'abort-controller';
12
- import fs from 'fs-extra';
13
- import del from 'del';
14
- import tempy from 'tempy';
15
- import prettier from 'prettier';
16
- import isInteractive from 'is-interactive';
17
- import { arch, userInfo, homedir } from 'node:os';
18
- import terminalLink from 'terminal-link';
19
- import StackTracey from 'stacktracey';
20
- import cjs from 'color-json';
21
- import { Writable } from 'node:stream';
22
- import { execa } from 'execa';
23
- import { platform } from 'node:process';
24
-
25
- function relativize(path) {
26
- const result = commondir([path, process.cwd()]);
27
- const relativePath = relative(process.cwd(), path);
28
- const relativeComponents = relativePath.split("/").filter((component) => component === "..").length;
29
- if (result === "/" || relativeComponents > 2) {
30
- return path;
31
- } else {
32
- return relativePath;
33
- }
34
- }
35
- function moduleDirectory(moduleURL) {
36
- return dirname(fileURLToPath(moduleURL));
37
- }
38
-
39
- var path = /*#__PURE__*/Object.freeze({
40
- __proto__: null,
41
- join: join,
42
- relative: relative,
43
- dirname: dirname,
44
- normalize: normalize,
45
- resolve: resolve,
46
- basename: basename,
47
- extname: extname,
48
- isAbsolute: isAbsolute,
49
- relativize: relativize,
50
- moduleDirectory: moduleDirectory,
51
- findUp: findUp,
52
- glob: glob,
53
- pathToFileURL: pathToFileURL
54
- });
55
-
56
- var name = "@shopify/cli-kit";
57
- var version = "3.0.25";
58
- var description = "A set of utilities, interfaces, and models that are common across all the platform features";
59
- var keywords = [
60
- "shopify",
61
- "shopify-cli",
62
- "shopify-partners"
63
- ];
64
- var license = "MIT";
65
- var type = "module";
66
- var module = "dist/index.js";
67
- var types = "dist/index.d.ts";
68
- var exports = {
69
- ".": {
70
- "import": "./dist/index.js",
71
- types: "./dist/index.d.ts"
72
- },
73
- "./node/*": {
74
- node: "./dist/node/*.js",
75
- types: "./dist/node/*.d.ts"
76
- }
77
- };
78
- var files = [
79
- "/dist",
80
- "/assets"
81
- ];
82
- var publishConfig = {
83
- access: "public",
84
- "@shopify:registry": "https://registry.npmjs.org"
85
- };
86
- var scripts = {
87
- clean: "shx rm -rf dist",
88
- build: "rimraf dist/ && rollup -c",
89
- prepack: "cross-env NODE_ENV=production yarn run build",
90
- lint: "prettier -c src/** && eslint \"src/**/*.ts\"",
91
- "lint:fix": "eslint 'src/**/*.ts' --fix",
92
- test: "vitest run",
93
- "test:watch": "vitest watch",
94
- tsc: "tsc --noEmit"
95
- };
96
- var eslintConfig = {
97
- "extends": [
98
- "../../.eslintrc.cjs"
99
- ]
100
- };
101
- var engines = {
102
- node: "^14.13.1 || ^16.0.0 || ^17.0.0 || ^18.0.0"
103
- };
104
- var os$1 = [
105
- "darwin",
106
- "linux",
107
- "win32"
108
- ];
109
- var dependencies = {
110
- "@oclif/core": "^1.0",
111
- envfile: "^6.17.0",
112
- fastify: "^4.0.0-rc.4",
113
- inquirer: "^8.2.4",
114
- keytar: "^7.9.0",
115
- open: "^8.4.0",
116
- prettier: "^2.6.2",
117
- "source-map-support": "^0.5.21",
118
- stacktracey: "^2.1.8",
119
- pathe: "0.2.0",
120
- "abort-controller": "^3.0.0",
121
- "ts-error": "^1.0.6",
122
- "find-up": "^6.2.0",
123
- execa: "^6.0.0",
124
- listr2: "^4.0.5",
125
- "@iarna/toml": "^2.2.5",
126
- "change-case": "^4.1.2",
127
- "color-json": "^2.0.1",
128
- commondir: "^1.0.1",
129
- conf: "^10.1.2",
130
- "cross-zip": "^4.0.0",
131
- del: "^6.0.0",
132
- enquirer: "^2.3.6",
133
- "env-paths": "^3.0.0",
134
- "fast-glob": "^3.2.11",
135
- "find-versions": "^5.0.0",
136
- "form-data": "^4.0.0",
137
- "fs-extra": "^10.0.0",
138
- "get-port-please": "^2.5.0",
139
- graphql: "^16.4.0",
140
- "graphql-request": "^4.3.0",
141
- haikunator: "^2.1.2",
142
- "is-interactive": "^2.0.0",
143
- "js-yaml": "^4.1.0",
144
- "latest-version": "^6.0.0",
145
- liquidjs: "^9.36.0",
146
- "md5-file": "^5.0.0",
147
- "node-fetch": "^3.2.4",
148
- "simple-git": "^3.5.0",
149
- tempy: "^2.0.0",
150
- "term-size": "^3.0.1",
151
- "terminal-link": "^3.0.0",
152
- zod: "^3.17.3"
153
- };
154
- var devDependencies = {
155
- "@types/cross-zip": "^4.0.0",
156
- "@types/inquirer": "^8.2.1",
157
- "@types/js-yaml": "^4.0.5",
158
- "@types/semver": "^7.3.9",
159
- vitest: "^0.15.1",
160
- semver: "^7.3.6",
161
- "ansi-colors": "^4.1.1"
162
- };
163
- var cliKitPackageJson = {
164
- name: name,
165
- version: version,
166
- "private": false,
167
- description: description,
168
- keywords: keywords,
169
- license: license,
170
- type: type,
171
- module: module,
172
- types: types,
173
- exports: exports,
174
- files: files,
175
- publishConfig: publishConfig,
176
- scripts: scripts,
177
- eslintConfig: eslintConfig,
178
- "engine-strict": true,
179
- engines: engines,
180
- os: os$1,
181
- dependencies: dependencies,
182
- devDependencies: devDependencies
183
- };
184
-
185
- const identifier = "shopify-cli";
186
- const cacheFolder = () => {
187
- if (process.env.XDG_CACHE_HOME)
188
- return process.env.XDG_CACHE_HOME;
189
- return envPaths(identifier).cache;
190
- };
191
- const constants = {
192
- environmentVariables: {
193
- unitTest: "SHOPIFY_UNIT_TEST",
194
- shopifyConfig: "SHOPIFY_CONFIG",
195
- runAsUser: "SHOPIFY_RUN_AS_USER",
196
- partnersEnv: "SHOPIFY_PARTNERS_ENV",
197
- shopifyEnv: "SHOPIFY_SHOPIFY_ENV",
198
- identityEnv: "SHOPIFY_IDENTITY_ENV",
199
- spin: "SPIN",
200
- spinInstance: "SPIN_INSTANCE",
201
- spinWorkspace: "SPIN_WORKSPACE",
202
- spinNamespace: "SPIN_NAMESPACE",
203
- spinHost: "SPIN_HOST",
204
- partnersToken: "SHOPIFY_CLI_PARTNERS_TOKEN",
205
- verbose: "SHOPIFY_FLAG_VERBOSE",
206
- noAnalytics: "SHOPIFY_CLI_NO_ANALYTICS"
207
- },
208
- paths: {
209
- executables: {
210
- dev: "/opt/dev/bin/dev"
211
- },
212
- directories: {
213
- cache: {
214
- path: () => {
215
- return cacheFolder();
216
- },
217
- vendor: {
218
- path: () => {
219
- return join(cacheFolder(), "vendor");
220
- },
221
- binaries: () => {
222
- return join(cacheFolder(), "vendor", "binaries");
223
- }
224
- }
225
- }
226
- }
227
- },
228
- versions: {
229
- cliKit: version
230
- },
231
- keychain: {
232
- service: "shopify-cli"
233
- },
234
- session: {
235
- expirationTimeMarginInMinutes: 4
236
- }
237
- };
238
-
239
- function isTruthy(variable) {
240
- if (!variable) {
241
- return false;
242
- }
243
- return ["1", "true", "TRUE", "yes", "YES"].includes(variable);
244
- }
245
-
246
- var utilities = /*#__PURE__*/Object.freeze({
247
- __proto__: null,
248
- isTruthy: isTruthy
249
- });
250
-
251
- sourceMapSupport.install();
252
- class CancelExecution extends Error {
253
- }
254
- class Fatal extends Error {
255
- constructor(message, type, tryMessage = null) {
256
- super(stringifyMessage(message));
257
- this.tryMessage = tryMessage ? stringifyMessage(tryMessage) : null;
258
- this.type = type;
259
- }
260
- }
261
- class Abort extends Fatal {
262
- constructor(message, tryMessage = null) {
263
- super(message, 0 /* Abort */, tryMessage);
264
- }
265
- }
266
- class AbortSilent extends Fatal {
267
- constructor() {
268
- super("", 1 /* AbortSilent */);
269
- }
270
- }
271
- class Bug extends Fatal {
272
- constructor(message, tryMessage = null) {
273
- super(message, 2 /* Bug */, tryMessage);
274
- }
275
- }
276
- async function handler(error$1) {
277
- let fatal;
278
- if (isFatal(error$1)) {
279
- fatal = error$1;
280
- } else {
281
- fatal = new Bug(error$1.message);
282
- }
283
- if (fatal.type === 2 /* Bug */) {
284
- fatal.stack = error$1.stack;
285
- }
286
- await error(fatal);
287
- return Promise.resolve(error$1);
288
- }
289
- function mapper(error) {
290
- if (error instanceof Errors.CLIError) {
291
- const mappedError = new Abort(error.message);
292
- mappedError.stack = error.stack;
293
- return Promise.resolve(mappedError);
294
- } else {
295
- return Promise.resolve(error);
296
- }
297
- }
298
- function isFatal(error) {
299
- return Object.prototype.hasOwnProperty.call(error, "type");
300
- }
301
- function shouldReport(error) {
302
- if (!isFatal(error)) {
303
- return true;
304
- }
305
- if (error.type === 2 /* Bug */) {
306
- return true;
307
- }
308
- return false;
309
- }
310
-
311
- var error$1 = /*#__PURE__*/Object.freeze({
312
- __proto__: null,
313
- CancelExecution: CancelExecution,
314
- Fatal: Fatal,
315
- Abort: Abort,
316
- AbortSilent: AbortSilent,
317
- Bug: Bug,
318
- handler: handler,
319
- mapper: mapper,
320
- isFatal: isFatal,
321
- shouldReport: shouldReport,
322
- ExtendableError: ExtendableError,
323
- AbortSignal: AbortSignal
324
- });
325
-
326
- const DEFAULT_PRETTIER_CONFIG = {
327
- arrowParens: "always",
328
- singleQuote: true,
329
- bracketSpacing: false,
330
- trailingComma: "all"
331
- };
332
- function stripUp(path, strip) {
333
- const parts = path.split(sep);
334
- return join(...parts.slice(strip));
335
- }
336
- async function inTemporaryDirectory(callback) {
337
- return tempy.directory.task(callback);
338
- }
339
- async function read(path, options = { encoding: "utf-8" }) {
340
- debug(content`Reading the content of file at ${token.path(path)}...`);
341
- const content$1 = await fs.readFile(path, options);
342
- return content$1;
343
- }
344
- function readSync(path, options = { encoding: "utf-8" }) {
345
- debug(content`Sync-reading the content of file at ${token.path(path)}...`);
346
- const content$1 = fs.readFileSync(path, options);
347
- return content$1.toString();
348
- }
349
- async function copy(from, to) {
350
- debug(content`Copying file from ${token.path(from)} to ${token.path(to)}...`);
351
- await fs.copy(from, to);
352
- }
353
- async function touch(path) {
354
- debug(content`Creating an empty file at ${token.path(path)}...`);
355
- await fs.ensureFile(path);
356
- }
357
- async function touchSync(path) {
358
- debug(content`Creating an empty file at ${token.path(path)}...`);
359
- await fs.ensureFileSync(path);
360
- }
361
- async function write(path, data) {
362
- debug(content`Writing some content to file at ${token.path(path)}...`);
363
- await fs.writeFile(path, data);
364
- }
365
- function writeSync(path, data) {
366
- debug(content`File-writing some content to file at ${token.path(path)}...`);
367
- fs.writeFileSync(path, data);
368
- }
369
- async function append(path, data) {
370
- await fs.appendFile(path, data);
371
- }
372
- async function mkdir(path) {
373
- debug(content`Creating directory at ${token.path(path)}...`);
374
- await fs.mkdirp(path);
375
- }
376
- function mkdirSync(path) {
377
- debug(content`Sync-reating directory at ${token.path(path)}...`);
378
- fs.mkdirpSync(path);
379
- }
380
- async function remove(path) {
381
- debug(content`Removing file at ${token.path(path)}...`);
382
- await fs.remove(path);
383
- }
384
- async function rmdir(path, { force } = {}) {
385
- debug(content`Removing directory at ${token.path(path)}...`);
386
- await del(path, { force });
387
- }
388
- async function mkTmpDir() {
389
- debug(content`Creating a temporary directory...`);
390
- const directory = await fs.mkdtemp("tmp-");
391
- return directory;
392
- }
393
- async function isDirectory(path) {
394
- debug(content`Checking if ${token.path(path)} is a directory...`);
395
- return (await fs.promises.lstat(path)).isDirectory();
396
- }
397
- async function size(path) {
398
- debug(content`Getting the size of file file at ${token.path(path)}...`);
399
- return (await fs.stat(path)).size;
400
- }
401
- function sizeSync(path) {
402
- debug(content`Sync-getting the size of file file at ${token.path(path)}...`);
403
- return fs.statSync(path).size;
404
- }
405
- async function move(src, dest, options = {}) {
406
- await fs.move(src, dest, options);
407
- }
408
- async function chmod(path, mode) {
409
- await fs.promises.chmod(path, mode);
410
- }
411
- async function hasExecutablePermissions(path) {
412
- try {
413
- await fs.promises.access(path, fs.constants.X_OK);
414
- return true;
415
- } catch {
416
- return false;
417
- }
418
- }
419
- async function exists(path) {
420
- try {
421
- await fs.promises.access(path);
422
- return true;
423
- } catch {
424
- return false;
425
- }
426
- }
427
- async function format(content, options) {
428
- const ext = extname(options.path);
429
- const prettierConfig = {
430
- ...DEFAULT_PRETTIER_CONFIG,
431
- parser: "babel"
432
- };
433
- switch (ext) {
434
- case ".html":
435
- case ".css":
436
- prettierConfig.parser = ext.slice(1);
437
- break;
438
- }
439
- const formattedContent = await prettier.format(content, prettierConfig);
440
- return formattedContent;
441
- }
442
-
443
- var file = /*#__PURE__*/Object.freeze({
444
- __proto__: null,
445
- stripUp: stripUp,
446
- inTemporaryDirectory: inTemporaryDirectory,
447
- read: read,
448
- readSync: readSync,
449
- copy: copy,
450
- touch: touch,
451
- touchSync: touchSync,
452
- write: write,
453
- writeSync: writeSync,
454
- append: append,
455
- mkdir: mkdir,
456
- mkdirSync: mkdirSync,
457
- remove: remove,
458
- rmdir: rmdir,
459
- mkTmpDir: mkTmpDir,
460
- isDirectory: isDirectory,
461
- size: size,
462
- sizeSync: sizeSync,
463
- move: move,
464
- chmod: chmod,
465
- hasExecutablePermissions: hasExecutablePermissions,
466
- exists: exists,
467
- format: format
468
- });
469
-
470
- var ansiColors = {exports: {}};
471
-
472
- var symbols = {exports: {}};
473
-
474
- var hasRequiredSymbols;
475
-
476
- function requireSymbols () {
477
- if (hasRequiredSymbols) return symbols.exports;
478
- hasRequiredSymbols = 1;
479
- (function (module) {
480
-
481
- const isHyper = typeof process !== 'undefined' && process.env.TERM_PROGRAM === 'Hyper';
482
- const isWindows = typeof process !== 'undefined' && process.platform === 'win32';
483
- const isLinux = typeof process !== 'undefined' && process.platform === 'linux';
484
-
485
- const common = {
486
- ballotDisabled: '☒',
487
- ballotOff: '☐',
488
- ballotOn: '☑',
489
- bullet: '•',
490
- bulletWhite: '◦',
491
- fullBlock: '█',
492
- heart: '❤',
493
- identicalTo: '≡',
494
- line: '─',
495
- mark: '※',
496
- middot: '·',
497
- minus: '-',
498
- multiplication: '×',
499
- obelus: '÷',
500
- pencilDownRight: '✎',
501
- pencilRight: '✏',
502
- pencilUpRight: '✐',
503
- percent: '%',
504
- pilcrow2: '❡',
505
- pilcrow: '¶',
506
- plusMinus: '±',
507
- question: '?',
508
- section: '§',
509
- starsOff: '☆',
510
- starsOn: '★',
511
- upDownArrow: '↕'
512
- };
513
-
514
- const windows = Object.assign({}, common, {
515
- check: '√',
516
- cross: '×',
517
- ellipsisLarge: '...',
518
- ellipsis: '...',
519
- info: 'i',
520
- questionSmall: '?',
521
- pointer: '>',
522
- pointerSmall: '»',
523
- radioOff: '( )',
524
- radioOn: '(*)',
525
- warning: '‼'
526
- });
527
-
528
- const other = Object.assign({}, common, {
529
- ballotCross: '✘',
530
- check: '✔',
531
- cross: '✖',
532
- ellipsisLarge: '⋯',
533
- ellipsis: '…',
534
- info: 'ℹ',
535
- questionFull: '?',
536
- questionSmall: '﹖',
537
- pointer: isLinux ? '▸' : '❯',
538
- pointerSmall: isLinux ? '‣' : '›',
539
- radioOff: '◯',
540
- radioOn: '◉',
541
- warning: '⚠'
542
- });
543
-
544
- module.exports = (isWindows && !isHyper) ? windows : other;
545
- Reflect.defineProperty(module.exports, 'common', { enumerable: false, value: common });
546
- Reflect.defineProperty(module.exports, 'windows', { enumerable: false, value: windows });
547
- Reflect.defineProperty(module.exports, 'other', { enumerable: false, value: other });
548
- } (symbols));
549
- return symbols.exports;
550
- }
551
-
552
- const isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
553
-
554
- /* eslint-disable no-control-regex */
555
- // this is a modified version of https://github.com/chalk/ansi-regex (MIT License)
556
- const ANSI_REGEX = /[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g;
557
-
558
- const hasColor = () => {
559
- if (typeof process !== 'undefined') {
560
- return process.env.FORCE_COLOR !== '0';
561
- }
562
- return false;
563
- };
564
-
565
- const create = () => {
566
- const colors = {
567
- enabled: hasColor(),
568
- visible: true,
569
- styles: {},
570
- keys: {}
571
- };
572
-
573
- const ansi = style => {
574
- let open = style.open = `\u001b[${style.codes[0]}m`;
575
- let close = style.close = `\u001b[${style.codes[1]}m`;
576
- let regex = style.regex = new RegExp(`\\u001b\\[${style.codes[1]}m`, 'g');
577
- style.wrap = (input, newline) => {
578
- if (input.includes(close)) input = input.replace(regex, close + open);
579
- let output = open + input + close;
580
- // see https://github.com/chalk/chalk/pull/92, thanks to the
581
- // chalk contributors for this fix. However, we've confirmed that
582
- // this issue is also present in Windows terminals
583
- return newline ? output.replace(/\r*\n/g, `${close}$&${open}`) : output;
584
- };
585
- return style;
586
- };
587
-
588
- const wrap = (style, input, newline) => {
589
- return typeof style === 'function' ? style(input) : style.wrap(input, newline);
590
- };
591
-
592
- const style = (input, stack) => {
593
- if (input === '' || input == null) return '';
594
- if (colors.enabled === false) return input;
595
- if (colors.visible === false) return '';
596
- let str = '' + input;
597
- let nl = str.includes('\n');
598
- let n = stack.length;
599
- if (n > 0 && stack.includes('unstyle')) {
600
- stack = [...new Set(['unstyle', ...stack])].reverse();
601
- }
602
- while (n-- > 0) str = wrap(colors.styles[stack[n]], str, nl);
603
- return str;
604
- };
605
-
606
- const define = (name, codes, type) => {
607
- colors.styles[name] = ansi({ name, codes });
608
- let keys = colors.keys[type] || (colors.keys[type] = []);
609
- keys.push(name);
610
-
611
- Reflect.defineProperty(colors, name, {
612
- configurable: true,
613
- enumerable: true,
614
- set(value) {
615
- colors.alias(name, value);
616
- },
617
- get() {
618
- let color = input => style(input, color.stack);
619
- Reflect.setPrototypeOf(color, colors);
620
- color.stack = this.stack ? this.stack.concat(name) : [name];
621
- return color;
622
- }
623
- });
624
- };
625
-
626
- define('reset', [0, 0], 'modifier');
627
- define('bold', [1, 22], 'modifier');
628
- define('dim', [2, 22], 'modifier');
629
- define('italic', [3, 23], 'modifier');
630
- define('underline', [4, 24], 'modifier');
631
- define('inverse', [7, 27], 'modifier');
632
- define('hidden', [8, 28], 'modifier');
633
- define('strikethrough', [9, 29], 'modifier');
634
-
635
- define('black', [30, 39], 'color');
636
- define('red', [31, 39], 'color');
637
- define('green', [32, 39], 'color');
638
- define('yellow', [33, 39], 'color');
639
- define('blue', [34, 39], 'color');
640
- define('magenta', [35, 39], 'color');
641
- define('cyan', [36, 39], 'color');
642
- define('white', [37, 39], 'color');
643
- define('gray', [90, 39], 'color');
644
- define('grey', [90, 39], 'color');
645
-
646
- define('bgBlack', [40, 49], 'bg');
647
- define('bgRed', [41, 49], 'bg');
648
- define('bgGreen', [42, 49], 'bg');
649
- define('bgYellow', [43, 49], 'bg');
650
- define('bgBlue', [44, 49], 'bg');
651
- define('bgMagenta', [45, 49], 'bg');
652
- define('bgCyan', [46, 49], 'bg');
653
- define('bgWhite', [47, 49], 'bg');
654
-
655
- define('blackBright', [90, 39], 'bright');
656
- define('redBright', [91, 39], 'bright');
657
- define('greenBright', [92, 39], 'bright');
658
- define('yellowBright', [93, 39], 'bright');
659
- define('blueBright', [94, 39], 'bright');
660
- define('magentaBright', [95, 39], 'bright');
661
- define('cyanBright', [96, 39], 'bright');
662
- define('whiteBright', [97, 39], 'bright');
663
-
664
- define('bgBlackBright', [100, 49], 'bgBright');
665
- define('bgRedBright', [101, 49], 'bgBright');
666
- define('bgGreenBright', [102, 49], 'bgBright');
667
- define('bgYellowBright', [103, 49], 'bgBright');
668
- define('bgBlueBright', [104, 49], 'bgBright');
669
- define('bgMagentaBright', [105, 49], 'bgBright');
670
- define('bgCyanBright', [106, 49], 'bgBright');
671
- define('bgWhiteBright', [107, 49], 'bgBright');
672
-
673
- colors.ansiRegex = ANSI_REGEX;
674
- colors.hasColor = colors.hasAnsi = str => {
675
- colors.ansiRegex.lastIndex = 0;
676
- return typeof str === 'string' && str !== '' && colors.ansiRegex.test(str);
677
- };
678
-
679
- colors.alias = (name, color) => {
680
- let fn = typeof color === 'string' ? colors[color] : color;
681
-
682
- if (typeof fn !== 'function') {
683
- throw new TypeError('Expected alias to be the name of an existing color (string) or a function');
684
- }
685
-
686
- if (!fn.stack) {
687
- Reflect.defineProperty(fn, 'name', { value: name });
688
- colors.styles[name] = fn;
689
- fn.stack = [name];
690
- }
691
-
692
- Reflect.defineProperty(colors, name, {
693
- configurable: true,
694
- enumerable: true,
695
- set(value) {
696
- colors.alias(name, value);
697
- },
698
- get() {
699
- let color = input => style(input, color.stack);
700
- Reflect.setPrototypeOf(color, colors);
701
- color.stack = this.stack ? this.stack.concat(fn.stack) : fn.stack;
702
- return color;
703
- }
704
- });
705
- };
706
-
707
- colors.theme = custom => {
708
- if (!isObject(custom)) throw new TypeError('Expected theme to be an object');
709
- for (let name of Object.keys(custom)) {
710
- colors.alias(name, custom[name]);
711
- }
712
- return colors;
713
- };
714
-
715
- colors.alias('unstyle', str => {
716
- if (typeof str === 'string' && str !== '') {
717
- colors.ansiRegex.lastIndex = 0;
718
- return str.replace(colors.ansiRegex, '');
719
- }
720
- return '';
721
- });
722
-
723
- colors.alias('noop', str => str);
724
- colors.none = colors.clear = colors.noop;
725
-
726
- colors.stripColor = colors.unstyle;
727
- colors.symbols = requireSymbols();
728
- colors.define = define;
729
- return colors;
730
- };
731
-
732
- ansiColors.exports = create();
733
- ansiColors.exports.create = create;
734
-
735
- let logFile;
736
- function initiateLogging({
737
- logDir = constants.paths.directories.cache.path(),
738
- filename = "shopify.log"
739
- }) {
740
- mkdirSync(logDir);
741
- logFile = join(logDir, filename);
742
- touchSync(logFile);
743
- truncateLogs();
744
- }
745
- function truncateLogs() {
746
- try {
747
- if (sizeSync(logFile) > 5 * 1024 * 1024) {
748
- const contents = readSync(logFile);
749
- const splitContents = contents.split("\n");
750
- const newContents = splitContents.slice(1e4, splitContents.length).join("\n");
751
- writeSync(logFile, newContents);
752
- }
753
- } catch {
754
- }
755
- }
756
- class ContentToken {
757
- constructor(value, metadata = {}, type) {
758
- this.type = type;
759
- this.value = value;
760
- this.metadata = metadata;
761
- }
762
- }
763
- const token = {
764
- raw: (value) => {
765
- return new ContentToken(value, {}, 0 /* Raw */);
766
- },
767
- genericShellCommand: (value) => {
768
- return new ContentToken(value, {}, 1 /* Command */);
769
- },
770
- json: (value) => {
771
- return new ContentToken(value, {}, 2 /* Json */);
772
- },
773
- path: (value) => {
774
- return new ContentToken(value, {}, 3 /* Path */);
775
- },
776
- link: (value, link) => {
777
- return new ContentToken(value, { link }, 4 /* Link */);
778
- },
779
- heading: (value) => {
780
- return new ContentToken(value, {}, 5 /* Heading */);
781
- },
782
- subheading: (value) => {
783
- return new ContentToken(value, {}, 6 /* SubHeading */);
784
- },
785
- italic: (value) => {
786
- return new ContentToken(value, {}, 7 /* Italic */);
787
- },
788
- errorText: (value) => {
789
- return new ContentToken(value, {}, 8 /* ErrorText */);
790
- },
791
- cyan: (value) => {
792
- return new ContentToken(value, {}, 10 /* Cyan */);
793
- },
794
- yellow: (value) => {
795
- return new ContentToken(value, {}, 9 /* Yellow */);
796
- },
797
- magenta: (value) => {
798
- return new ContentToken(value, {}, 11 /* Magenta */);
799
- },
800
- green: (value) => {
801
- return new ContentToken(value, {}, 12 /* Green */);
802
- },
803
- packagejsonScript: (dependencyManager, scriptName, ...scriptArgs) => {
804
- return new ContentToken(formatPackageManagerCommand(dependencyManager, scriptName, scriptArgs), {}, 1 /* Command */);
805
- },
806
- successIcon: () => {
807
- return new ContentToken("\u2714", {}, 12 /* Green */);
808
- },
809
- failIcon: () => {
810
- return new ContentToken("\u2716", {}, 8 /* ErrorText */);
811
- }
812
- };
813
- function formatPackageManagerCommand(dependencyManager, scriptName, scriptArgs) {
814
- switch (dependencyManager) {
815
- case "yarn": {
816
- const pieces = ["yarn", scriptName, ...scriptArgs];
817
- return pieces.join(" ");
818
- }
819
- case "pnpm":
820
- case "npm": {
821
- const pieces = [dependencyManager, "run", scriptName];
822
- if (scriptArgs.length > 0) {
823
- pieces.push("--");
824
- pieces.push(...scriptArgs);
825
- }
826
- return pieces.join(" ");
827
- }
828
- }
829
- }
830
- class TokenizedString {
831
- constructor(value) {
832
- this.value = value;
833
- }
834
- }
835
- function content(strings, ...keys) {
836
- let output = ``;
837
- strings.forEach((string, i) => {
838
- output += string;
839
- if (i >= keys.length) {
840
- return;
841
- }
842
- const token2 = keys[i];
843
- if (typeof token2 === "string") {
844
- output += token2;
845
- } else {
846
- const enumToken = token2;
847
- switch (enumToken.type) {
848
- case 0 /* Raw */:
849
- output += enumToken.value;
850
- break;
851
- case 1 /* Command */:
852
- output += ansiColors.exports.bold(ansiColors.exports.yellow(stringifyMessage(enumToken.value)));
853
- break;
854
- case 3 /* Path */:
855
- output += relativize(stringifyMessage(enumToken.value));
856
- break;
857
- case 2 /* Json */:
858
- try {
859
- output += cjs(stringifyMessage(enumToken.value) ?? {});
860
- } catch (_) {
861
- output += JSON.stringify(stringifyMessage(enumToken.value) ?? {}, null, 2);
862
- }
863
- break;
864
- case 4 /* Link */:
865
- output += terminalLink(ansiColors.exports.green(stringifyMessage(enumToken.value)), enumToken.metadata.link ?? "");
866
- break;
867
- case 5 /* Heading */:
868
- output += ansiColors.exports.bold.underline(stringifyMessage(enumToken.value));
869
- break;
870
- case 6 /* SubHeading */:
871
- output += ansiColors.exports.underline(stringifyMessage(enumToken.value));
872
- break;
873
- case 7 /* Italic */:
874
- output += ansiColors.exports.italic(stringifyMessage(enumToken.value));
875
- break;
876
- case 8 /* ErrorText */:
877
- output += ansiColors.exports.bold.redBright(stringifyMessage(enumToken.value));
878
- break;
879
- case 9 /* Yellow */:
880
- output += ansiColors.exports.yellow(stringifyMessage(enumToken.value));
881
- break;
882
- case 10 /* Cyan */:
883
- output += ansiColors.exports.cyan(stringifyMessage(enumToken.value));
884
- break;
885
- case 11 /* Magenta */:
886
- output += ansiColors.exports.magenta(stringifyMessage(enumToken.value));
887
- break;
888
- case 12 /* Green */:
889
- output += ansiColors.exports.green(stringifyMessage(enumToken.value));
890
- break;
891
- }
892
- }
893
- });
894
- return new TokenizedString(output);
895
- }
896
- const logLevelValue = (level) => {
897
- switch (level) {
898
- case "trace":
899
- return 10;
900
- case "debug":
901
- return 20;
902
- case "info":
903
- return 30;
904
- case "warn":
905
- return 40;
906
- case "error":
907
- return 50;
908
- case "fatal":
909
- return 60;
910
- default:
911
- return 30;
912
- }
913
- };
914
- const currentLogLevel = () => {
915
- if (isVerbose()) {
916
- return "debug";
917
- } else {
918
- return "info";
919
- }
920
- };
921
- const shouldOutput = (logLevel) => {
922
- if (isUnitTest()) {
923
- return false;
924
- }
925
- const currentLogLevelValue = logLevelValue(currentLogLevel());
926
- const messageLogLevelValue = logLevelValue(logLevel);
927
- return messageLogLevelValue >= currentLogLevelValue;
928
- };
929
- const info = (content2) => {
930
- message(content2, "info");
931
- };
932
- const success = (content2) => {
933
- const message2 = ansiColors.exports.bold(`\u2705 Success! ${stringifyMessage(content2)}.`);
934
- outputWhereAppropriate("info", consoleLog, message2);
935
- };
936
- const completed = (content2) => {
937
- const message2 = `${ansiColors.exports.green("\u2714")} ${stringifyMessage(content2)}`;
938
- outputWhereAppropriate("info", consoleLog, message2);
939
- };
940
- const debug = (content2) => {
941
- message(ansiColors.exports.gray(stringifyMessage(content2)), "debug");
942
- };
943
- const warn = (content2) => {
944
- consoleWarn(ansiColors.exports.yellow(stringifyMessage(content2)));
945
- };
946
- const newline = () => {
947
- console.log();
948
- };
949
- const error = async (content2) => {
950
- if (!content2.message) {
951
- return;
952
- }
953
- let outputString = "";
954
- const message2 = content2.message;
955
- const padding = " ";
956
- const header = ansiColors.exports.redBright(`
957
- \u2501\u2501\u2501\u2501\u2501\u2501 Error \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
958
- `);
959
- const footer = ansiColors.exports.redBright("\n\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\n");
960
- outputString += header;
961
- const lines = message2.split("\n");
962
- for (const line of lines) {
963
- outputString += `${padding}${line}
964
- `;
965
- }
966
- if (content2.tryMessage) {
967
- outputString += `
968
- ${padding}${ansiColors.exports.bold("What to try:")}
969
- `;
970
- const lines2 = content2.tryMessage.split("\n");
971
- for (const line of lines2) {
972
- outputString += `${padding}${line}
973
- `;
974
- }
975
- }
976
- let stack = await new StackTracey(content2).withSourcesAsync();
977
- stack = stack.filter((entry) => {
978
- return !entry.file.includes("@oclif/core");
979
- }).map((item) => {
980
- item.calleeShort = ansiColors.exports.yellow(item.calleeShort);
981
- const fileShortComponents = item.fileShort.split("packages/");
982
- item.fileShort = fileShortComponents.length === 2 ? fileShortComponents[1] : fileShortComponents[0];
983
- return item;
984
- });
985
- if (content2 instanceof Bug) {
986
- if (stack.items.length !== 0) {
987
- outputString += `
988
- ${padding}${ansiColors.exports.bold("Stack trace:")}`;
989
- const stackLines = stack.asTable({}).split("\n");
990
- for (const stackLine of stackLines) {
991
- outputString += `${padding}${stackLine}
992
- `;
993
- }
994
- }
995
- }
996
- outputString += footer;
997
- outputWhereAppropriate("error", consoleError, outputString);
998
- };
999
- function stringifyMessage(message2) {
1000
- if (message2 instanceof TokenizedString) {
1001
- return message2.value;
1002
- } else {
1003
- return message2;
1004
- }
1005
- }
1006
- const message = (content2, level = "info") => {
1007
- const stringifiedMessage = stringifyMessage(content2);
1008
- outputWhereAppropriate(level, consoleLog, stringifiedMessage);
1009
- };
1010
- async function concurrent(processes, callback = void 0) {
1011
- const abortController = new AbortController();
1012
- if (callback)
1013
- callback(abortController.signal);
1014
- const concurrentColors = [token.yellow, token.cyan, token.magenta, token.green];
1015
- const prefixColumnSize = Math.max(...processes.map((process2) => process2.prefix.length));
1016
- function linePrefix(prefix, index) {
1017
- const colorIndex = index < concurrentColors.length ? index : index % concurrentColors.length;
1018
- const color = concurrentColors[colorIndex];
1019
- return color(`${prefix}${" ".repeat(prefixColumnSize - prefix.length)} ${ansiColors.exports.bold("|")} `);
1020
- }
1021
- try {
1022
- await Promise.all(processes.map(async (process2, index) => {
1023
- const stdout = new Writable({
1024
- write(chunk, _encoding, next) {
1025
- const lines = stripAnsiEraseCursorEscapeCharacters(chunk.toString("ascii")).split(/\n/);
1026
- for (const line of lines) {
1027
- info(content`${linePrefix(process2.prefix, index)}${line}`);
1028
- }
1029
- next();
1030
- }
1031
- });
1032
- const stderr = new Writable({
1033
- write(chunk, _encoding, next) {
1034
- const lines = stripAnsiEraseCursorEscapeCharacters(chunk.toString("ascii")).split(/\n/);
1035
- for (const line of lines) {
1036
- message(content`${linePrefix(process2.prefix, index)}${ansiColors.exports.bold(line)}`, "error");
1037
- }
1038
- next();
1039
- }
1040
- });
1041
- await process2.action(stdout, stderr, abortController.signal);
1042
- }));
1043
- } catch (_error) {
1044
- abortController.abort();
1045
- throw _error;
1046
- }
1047
- }
1048
- const eraseCursorAnsiRegex = [
1049
- "2K",
1050
- "1G"
1051
- ].map((element) => `[\\u001B\\u009B][[\\]()#;?]*${element}`).join("|");
1052
- function stripAnsiEraseCursorEscapeCharacters(value) {
1053
- return value.replace(/(\n)$/, "").replace(new RegExp(eraseCursorAnsiRegex, "g"), "");
1054
- }
1055
- function consoleLog(message2) {
1056
- console.log(withOrWithoutStyle(message2));
1057
- }
1058
- function consoleError(message2) {
1059
- console.error(withOrWithoutStyle(message2));
1060
- }
1061
- function consoleWarn(message2) {
1062
- console.warn(withOrWithoutStyle(message2));
1063
- }
1064
- function outputWhereAppropriate(logLevel, logFunc, message2) {
1065
- if (shouldOutput(logLevel)) {
1066
- logFunc(message2);
1067
- }
1068
- logToFile(message2, logLevel.toUpperCase());
1069
- }
1070
- function logFileExists() {
1071
- return Boolean(logFile);
1072
- }
1073
- function logToFile(message2, logLevel) {
1074
- if (!logFileExists())
1075
- return;
1076
- const timestamp = new Date().toISOString();
1077
- append(logFile, `[${timestamp} ${logLevel}]: ${message2}
1078
- `);
1079
- }
1080
- function withOrWithoutStyle(message2) {
1081
- if (shouldDisplayColors()) {
1082
- return message2;
1083
- } else {
1084
- return unstyled(message2);
1085
- }
1086
- }
1087
- function unstyled(message2) {
1088
- return ansiColors.exports.unstyle(message2);
1089
- }
1090
- function shouldDisplayColors() {
1091
- return Boolean(process.stdout.isTTY || process.env.FORCE_COLOR);
1092
- }
1093
- async function pageLogs() {
1094
- await page(logFile);
1095
- }
1096
-
1097
- var output = /*#__PURE__*/Object.freeze({
1098
- __proto__: null,
1099
- initiateLogging: initiateLogging,
1100
- token: token,
1101
- TokenizedString: TokenizedString,
1102
- content: content,
1103
- currentLogLevel: currentLogLevel,
1104
- shouldOutput: shouldOutput,
1105
- info: info,
1106
- success: success,
1107
- completed: completed,
1108
- debug: debug,
1109
- warn: warn,
1110
- newline: newline,
1111
- error: error,
1112
- stringifyMessage: stringifyMessage,
1113
- concurrent: concurrent,
1114
- unstyled: unstyled,
1115
- shouldDisplayColors: shouldDisplayColors,
1116
- pageLogs: pageLogs
1117
- });
1118
-
1119
- const getEnvironmentVariable = () => {
1120
- const { env } = process;
1121
- return env.SUDO_USER || env.C9_USER || env.LOGNAME || env.USER || env.LNAME || env.USERNAME;
1122
- };
1123
- const getUsernameFromOsUserInfo = () => {
1124
- try {
1125
- return userInfo().username;
1126
- } catch {
1127
- return null;
1128
- }
1129
- };
1130
- const cleanWindowsCommand = (value) => value.replace(/^.*\\/, "");
1131
- const makeUsernameFromId = (userId) => `no-username-${userId}`;
1132
- const username = async (platform$1 = platform) => {
1133
- debug(content`Obtaining user name...`);
1134
- const environmentVariable = getEnvironmentVariable();
1135
- if (environmentVariable) {
1136
- return environmentVariable;
1137
- }
1138
- const userInfoUsername = getUsernameFromOsUserInfo();
1139
- if (userInfoUsername) {
1140
- return userInfoUsername;
1141
- }
1142
- try {
1143
- if (platform$1 === "win32") {
1144
- const { stdout } = await execa("whoami");
1145
- return cleanWindowsCommand(stdout);
1146
- }
1147
- const { stdout: userId } = await execa("id", ["-u"]);
1148
- try {
1149
- const { stdout } = await execa("id", ["-un", userId]);
1150
- return stdout;
1151
- } catch {
1152
- }
1153
- return makeUsernameFromId(userId);
1154
- } catch {
1155
- return null;
1156
- }
1157
- };
1158
- const platformAndArch = (platform$1 = platform) => {
1159
- let arch$1 = arch();
1160
- if (arch$1 === "x64") {
1161
- arch$1 = "amd64";
1162
- }
1163
- let platformString = platform$1;
1164
- if (platform$1.match(/^win.+/)) {
1165
- platformString = "windows";
1166
- }
1167
- return { platform: platformString, arch: arch$1 };
1168
- };
1169
-
1170
- var os = /*#__PURE__*/Object.freeze({
1171
- __proto__: null,
1172
- username: username,
1173
- platformAndArch: platformAndArch
1174
- });
1175
-
1176
- const open = async (url) => {
1177
- const externalOpen = await import('open');
1178
- await externalOpen.default(url);
1179
- };
1180
- const captureOutput = async (command, args, options) => {
1181
- const result = await buildExec(command, args, options);
1182
- return result.stdout;
1183
- };
1184
- const exec = async (command, args, options) => {
1185
- const commandProcess = buildExec(command, args, options);
1186
- if (options?.stderr) {
1187
- commandProcess.stderr?.pipe(options.stderr);
1188
- }
1189
- if (options?.stdout && options.stdout !== "inherit") {
1190
- commandProcess.stdout?.pipe(options.stdout);
1191
- }
1192
- options?.signal?.addEventListener("abort", () => {
1193
- commandProcess.kill("SIGTERM", { forceKillAfterTimeout: 1e3 });
1194
- });
1195
- try {
1196
- await commandProcess;
1197
- } catch (processError) {
1198
- const abortError = new Abort(processError.message);
1199
- abortError.stack = processError.stack;
1200
- throw abortError;
1201
- }
1202
- };
1203
- const buildExec = (command, args, options) => {
1204
- const env = options?.env ?? process.env;
1205
- if (shouldDisplayColors()) {
1206
- env.FORCE_COLOR = "1";
1207
- }
1208
- const commandProcess = execa(command, args, {
1209
- env,
1210
- cwd: options?.cwd,
1211
- input: options?.stdin,
1212
- stdout: options?.stdout === "inherit" ? "inherit" : void 0
1213
- });
1214
- debug(`
1215
- Running system process:
1216
- \xB7 Command: ${command} ${args.join(" ")}
1217
- \xB7 Working directory: ${options?.cwd ?? process.cwd()}
1218
- `);
1219
- return commandProcess;
1220
- };
1221
- const concurrentExec = async (commands) => {
1222
- await concurrent(commands.map((command) => {
1223
- return {
1224
- prefix: command.prefix,
1225
- action: async (stdout, stderr, signal) => {
1226
- await exec(command.executable, command.args, {
1227
- stdout,
1228
- stderr,
1229
- cwd: command.cwd,
1230
- signal
1231
- });
1232
- }
1233
- };
1234
- }));
1235
- };
1236
- async function page(filename) {
1237
- let executable;
1238
- if (process.env.PAGER) {
1239
- executable = process.env.PAGER;
1240
- } else if ((await platformAndArch()).platform === "windows") {
1241
- executable = "more";
1242
- } else {
1243
- executable = "less -NR";
1244
- }
1245
- const [command, ...args] = [...executable.split(" "), filename];
1246
- await exec(command, args, { stdout: "inherit", stdin: "inherit" });
1247
- }
1248
- async function sleep(seconds) {
1249
- return new Promise((resolve) => {
1250
- setTimeout(resolve, 1e3 * seconds);
1251
- });
1252
- }
1253
-
1254
- var system = /*#__PURE__*/Object.freeze({
1255
- __proto__: null,
1256
- open: open,
1257
- captureOutput: captureOutput,
1258
- exec: exec,
1259
- concurrentExec: concurrentExec,
1260
- page: page,
1261
- sleep: sleep
1262
- });
1263
-
1264
- const SpinInstanceNotFound = (spinInstance, error) => {
1265
- const errorMessage = content`${token.genericShellCommand(`spin`)} yielded the following error trying to obtain the fully qualified domain name of the Spin instance:
1266
- ${error}
1267
- `;
1268
- let nextSteps;
1269
- if (spinInstance) {
1270
- nextSteps = `Make sure ${spinInstance} is the instance name and not a fully qualified domain name`;
1271
- }
1272
- return new Abort(errorMessage, nextSteps);
1273
- };
1274
- async function fqdn(env = process.env) {
1275
- const spinInstance = await instance(env);
1276
- const showResponse = await show(spinInstance, env);
1277
- return showResponse.fqdn;
1278
- }
1279
- async function show(spinInstance, env = process.env) {
1280
- const latest = spinInstance === void 0;
1281
- const args = latest ? ["show", "--latest", "--json"] : ["show", "--json"];
1282
- const output = await captureOutput("spin", args, { env });
1283
- const json = JSON.parse(output);
1284
- if (json.error) {
1285
- throw SpinInstanceNotFound(spinInstance, json.error);
1286
- } else {
1287
- return json;
1288
- }
1289
- }
1290
- function isSpin(env = process.env) {
1291
- return isTruthy(env[constants.environmentVariables.spin]);
1292
- }
1293
- function instance(env = process.env) {
1294
- return env[constants.environmentVariables.spinInstance];
1295
- }
1296
-
1297
- function isTerminalInteractive() {
1298
- return isInteractive();
1299
- }
1300
- function homeDirectory() {
1301
- return homedir();
1302
- }
1303
- function isDebug(env = process.env) {
1304
- return env[constants.environmentVariables.shopifyConfig] === "debug";
1305
- }
1306
- function isVerbose(env = process.env) {
1307
- return isTruthy(env[constants.environmentVariables.verbose]) || process.argv.includes("--verbose");
1308
- }
1309
- async function isShopify(env = process.env) {
1310
- if (Object.prototype.hasOwnProperty.call(env, constants.environmentVariables.runAsUser)) {
1311
- return !isTruthy(env[constants.environmentVariables.runAsUser]);
1312
- }
1313
- const devInstalled = await exists(constants.paths.executables.dev);
1314
- return devInstalled || isSpin();
1315
- }
1316
- function isUnitTest(env = process.env) {
1317
- return isTruthy(env[constants.environmentVariables.unitTest]);
1318
- }
1319
- function analyticsDisabled(env = process.env) {
1320
- return isTruthy(env[constants.environmentVariables.noAnalytics]);
1321
- }
1322
- async function hasGit() {
1323
- try {
1324
- await exec("git", ["--version"]);
1325
- return true;
1326
- } catch {
1327
- return false;
1328
- }
1329
- }
1330
-
1331
- var local = /*#__PURE__*/Object.freeze({
1332
- __proto__: null,
1333
- isTerminalInteractive: isTerminalInteractive,
1334
- homeDirectory: homeDirectory,
1335
- isDebug: isDebug,
1336
- isVerbose: isVerbose,
1337
- isShopify: isShopify,
1338
- isUnitTest: isUnitTest,
1339
- analyticsDisabled: analyticsDisabled,
1340
- hasGit: hasGit
1341
- });
1342
-
1343
- export { Abort as A, Bug as B, hasGit as C, username as D, moduleDirectory as E, open as F, warn as G, completed as H, isDirectory as I, hasExecutablePermissions as J, copy as K, chmod as L, error$1 as M, file as N, os as O, output as P, path as Q, system as R, ansiColors as a, content as b, constants as c, isTruthy as d, info as e, fqdn as f, exists as g, AbortSilent as h, isTerminalInteractive as i, exec as j, captureOutput as k, local as l, mkdir as m, cliKitPackageJson as n, debug as o, read as p, isDebug as q, remove as r, analyticsDisabled as s, token as t, utilities as u, version as v, write as w, platformAndArch as x, isShopify as y, stringifyMessage as z };
1344
- //# sourceMappingURL=local-d0094ffe.js.map