@shopify/cli-kit 3.16.3 → 3.18.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 (220) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +1 -1
  3. package/assets/success.html +1 -1
  4. package/dist/analytics.d.ts +5 -5
  5. package/dist/analytics.js +5 -5
  6. package/dist/analytics.js.map +1 -1
  7. package/dist/api/common.d.ts +2 -2
  8. package/dist/api/common.js +2 -2
  9. package/dist/api/common.js.map +1 -1
  10. package/dist/api/graphql/index.d.ts +0 -2
  11. package/dist/api/graphql/index.js +0 -2
  12. package/dist/api/graphql/index.js.map +1 -1
  13. package/dist/api/oxygen.d.ts +5 -0
  14. package/dist/api/oxygen.js +30 -0
  15. package/dist/api/oxygen.js.map +1 -0
  16. package/dist/api/partners.d.ts +7 -7
  17. package/dist/api/partners.js +7 -7
  18. package/dist/api/partners.js.map +1 -1
  19. package/dist/api.d.ts +2 -2
  20. package/dist/api.js +2 -2
  21. package/dist/api.js.map +1 -1
  22. package/dist/common/object.d.ts +3 -3
  23. package/dist/common/object.js +3 -3
  24. package/dist/common/object.js.map +1 -1
  25. package/dist/content-tokens.js.map +1 -1
  26. package/dist/environment/fqdn.d.ts +3 -3
  27. package/dist/environment/fqdn.js +3 -3
  28. package/dist/environment/fqdn.js.map +1 -1
  29. package/dist/environment/local.d.ts +13 -13
  30. package/dist/environment/local.js +16 -16
  31. package/dist/environment/local.js.map +1 -1
  32. package/dist/environment/service.d.ts +1 -0
  33. package/dist/environment/service.js +3 -0
  34. package/dist/environment/service.js.map +1 -1
  35. package/dist/environment/spin.d.ts +12 -12
  36. package/dist/environment/spin.js +12 -12
  37. package/dist/environment/spin.js.map +1 -1
  38. package/dist/environment/utilities.d.ts +0 -2
  39. package/dist/environment/utilities.js +0 -2
  40. package/dist/environment/utilities.js.map +1 -1
  41. package/dist/environment.d.ts +3 -1
  42. package/dist/environment.js +3 -1
  43. package/dist/environment.js.map +1 -1
  44. package/dist/error.d.ts +1 -1
  45. package/dist/error.js +4 -3
  46. package/dist/error.js.map +1 -1
  47. package/dist/file.d.ts +17 -18
  48. package/dist/file.js +17 -18
  49. package/dist/file.js.map +1 -1
  50. package/dist/git.d.ts +1 -1
  51. package/dist/git.js +5 -2
  52. package/dist/git.js.map +1 -1
  53. package/dist/http/fetch.d.ts +2 -2
  54. package/dist/http/fetch.js +2 -2
  55. package/dist/http/fetch.js.map +1 -1
  56. package/dist/http.d.ts +1 -1
  57. package/dist/http.js +1 -1
  58. package/dist/http.js.map +1 -1
  59. package/dist/id.d.ts +1 -1
  60. package/dist/id.js +1 -1
  61. package/dist/id.js.map +1 -1
  62. package/dist/network/service.d.ts +0 -2
  63. package/dist/network/service.js +0 -1
  64. package/dist/network/service.js.map +1 -1
  65. package/dist/node/archiver.d.ts +2 -2
  66. package/dist/node/archiver.js +2 -2
  67. package/dist/node/archiver.js.map +1 -1
  68. package/dist/node/checksum.d.ts +2 -2
  69. package/dist/node/checksum.js +2 -2
  70. package/dist/node/checksum.js.map +1 -1
  71. package/dist/node/cli.d.ts +1 -2
  72. package/dist/node/cli.js +2 -8
  73. package/dist/node/cli.js.map +1 -1
  74. package/dist/node/colors.d.ts +2 -1
  75. package/dist/node/colors.js +2 -7
  76. package/dist/node/colors.js.map +1 -1
  77. package/dist/node/dot-env.d.ts +7 -7
  78. package/dist/node/dot-env.js +7 -7
  79. package/dist/node/dot-env.js.map +1 -1
  80. package/dist/node/framework.d.ts +2 -2
  81. package/dist/node/framework.js +2 -2
  82. package/dist/node/framework.js.map +1 -1
  83. package/dist/node/hooks/prerun.js +6 -6
  84. package/dist/node/hooks/prerun.js.map +1 -1
  85. package/dist/node/node-package-manager.d.ts +32 -28
  86. package/dist/node/node-package-manager.js +29 -29
  87. package/dist/node/node-package-manager.js.map +1 -1
  88. package/dist/node/ruby.d.ts +4 -4
  89. package/dist/node/ruby.js +5 -5
  90. package/dist/node/ruby.js.map +1 -1
  91. package/dist/os.d.ts +1 -1
  92. package/dist/os.js +1 -1
  93. package/dist/os.js.map +1 -1
  94. package/dist/output.d.ts +26 -34
  95. package/dist/output.js +23 -143
  96. package/dist/output.js.map +1 -1
  97. package/dist/path.d.ts +4 -4
  98. package/dist/path.js +4 -4
  99. package/dist/path.js.map +1 -1
  100. package/dist/plugins.d.ts +4 -4
  101. package/dist/plugins.js +4 -4
  102. package/dist/plugins.js.map +1 -1
  103. package/dist/port.d.ts +1 -1
  104. package/dist/port.js +1 -1
  105. package/dist/port.js.map +1 -1
  106. package/dist/private/node/ui/alert.d.ts +2 -0
  107. package/dist/private/node/ui/alert.js +18 -0
  108. package/dist/private/node/ui/alert.js.map +1 -0
  109. package/dist/private/node/ui/components/Alert.d.ts +17 -0
  110. package/dist/private/node/ui/components/Alert.js +21 -0
  111. package/dist/private/node/ui/components/Alert.js.map +1 -0
  112. package/dist/private/node/ui/components/Banner.d.ts +7 -0
  113. package/dist/private/node/ui/components/Banner.js +35 -0
  114. package/dist/private/node/ui/components/Banner.js.map +1 -0
  115. package/dist/private/node/ui/components/Command.d.ts +9 -0
  116. package/dist/private/node/ui/components/Command.js +10 -0
  117. package/dist/private/node/ui/components/Command.js.map +1 -0
  118. package/dist/private/node/ui/components/ConcurrentOutput.d.ts +48 -0
  119. package/dist/private/node/ui/components/ConcurrentOutput.js +98 -0
  120. package/dist/private/node/ui/components/ConcurrentOutput.js.map +1 -0
  121. package/dist/private/node/ui/components/Error.d.ts +8 -0
  122. package/dist/private/node/ui/components/Error.js +13 -0
  123. package/dist/private/node/ui/components/Error.js.map +1 -0
  124. package/dist/private/node/ui/components/FatalError.d.ts +7 -0
  125. package/dist/private/node/ui/components/FatalError.js +42 -0
  126. package/dist/private/node/ui/components/FatalError.js.map +1 -0
  127. package/dist/private/node/ui/components/FullScreen.d.ts +8 -0
  128. package/dist/private/node/ui/components/FullScreen.js +32 -0
  129. package/dist/private/node/ui/components/FullScreen.js.map +1 -0
  130. package/dist/private/node/ui/components/Link.d.ts +10 -0
  131. package/dist/private/node/ui/components/Link.js +14 -0
  132. package/dist/private/node/ui/components/Link.js.map +1 -0
  133. package/dist/private/node/ui/components/List.d.ts +13 -0
  134. package/dist/private/node/ui/components/List.js +19 -0
  135. package/dist/private/node/ui/components/List.js.map +1 -0
  136. package/dist/private/node/ui/components/TextAnimation.d.ts +11 -0
  137. package/dist/private/node/ui/components/TextAnimation.js +46 -0
  138. package/dist/private/node/ui/components/TextAnimation.js.map +1 -0
  139. package/dist/private/node/ui/components/TokenizedText.d.ts +21 -0
  140. package/dist/private/node/ui/components/TokenizedText.js +26 -0
  141. package/dist/private/node/ui/components/TokenizedText.js.map +1 -0
  142. package/dist/private/node/ui/error.d.ts +4 -0
  143. package/dist/private/node/ui/error.js +12 -0
  144. package/dist/private/node/ui/error.js.map +1 -0
  145. package/dist/private/node/ui.d.ts +10 -0
  146. package/dist/private/node/ui.js +47 -0
  147. package/dist/private/node/ui.js.map +1 -0
  148. package/dist/public/common/array.d.ts +4 -4
  149. package/dist/public/common/array.js +4 -4
  150. package/dist/public/common/array.js.map +1 -1
  151. package/dist/public/node/ui.d.ts +155 -0
  152. package/dist/public/node/ui.js +163 -0
  153. package/dist/public/node/ui.js.map +1 -0
  154. package/dist/secure-store.d.ts +4 -4
  155. package/dist/secure-store.js +4 -4
  156. package/dist/secure-store.js.map +1 -1
  157. package/dist/session/device-authorization.d.ts +5 -5
  158. package/dist/session/device-authorization.js +5 -5
  159. package/dist/session/device-authorization.js.map +1 -1
  160. package/dist/session/exchange.d.ts +10 -16
  161. package/dist/session/exchange.js +10 -16
  162. package/dist/session/exchange.js.map +1 -1
  163. package/dist/session/post-auth.js +2 -2
  164. package/dist/session/post-auth.js.map +1 -1
  165. package/dist/session/redirect-listener.js +1 -1
  166. package/dist/session/redirect-listener.js.map +1 -1
  167. package/dist/session/schema.d.ts +3 -2
  168. package/dist/session/schema.js +3 -2
  169. package/dist/session/schema.js.map +1 -1
  170. package/dist/session/scopes.d.ts +3 -3
  171. package/dist/session/scopes.js +3 -3
  172. package/dist/session/scopes.js.map +1 -1
  173. package/dist/session/store.d.ts +2 -2
  174. package/dist/session/store.js +2 -2
  175. package/dist/session/store.js.map +1 -1
  176. package/dist/session/token.d.ts +1 -1
  177. package/dist/session/token.js +1 -1
  178. package/dist/session/token.js.map +1 -1
  179. package/dist/session/validate.d.ts +4 -4
  180. package/dist/session/validate.js +4 -7
  181. package/dist/session/validate.js.map +1 -1
  182. package/dist/session.d.ts +10 -10
  183. package/dist/session.js +12 -12
  184. package/dist/session.js.map +1 -1
  185. package/dist/string.d.ts +2 -2
  186. package/dist/string.js +2 -2
  187. package/dist/string.js.map +1 -1
  188. package/dist/system.d.ts +6 -9
  189. package/dist/system.js +23 -23
  190. package/dist/system.js.map +1 -1
  191. package/dist/template.d.ts +3 -3
  192. package/dist/template.js +3 -3
  193. package/dist/template.js.map +1 -1
  194. package/dist/testing/fixtures/render-concurrent.d.ts +1 -0
  195. package/dist/testing/fixtures/render-concurrent.js +28 -0
  196. package/dist/testing/fixtures/render-concurrent.js.map +1 -0
  197. package/dist/testing/output.d.ts +1 -0
  198. package/dist/testing/output.js +1 -0
  199. package/dist/testing/output.js.map +1 -1
  200. package/dist/testing/store.d.ts +2 -2
  201. package/dist/testing/store.js +2 -2
  202. package/dist/testing/store.js.map +1 -1
  203. package/dist/testing/ui.d.ts +8 -0
  204. package/dist/testing/ui.js +17 -0
  205. package/dist/testing/ui.js.map +1 -0
  206. package/dist/tsconfig.tsbuildinfo +1 -1
  207. package/dist/ui/inquirer/input.d.ts +1 -1
  208. package/dist/ui.d.ts +1 -1
  209. package/dist/ui.js +17 -8
  210. package/dist/ui.js.map +1 -1
  211. package/dist/version.d.ts +3 -3
  212. package/dist/version.js +3 -3
  213. package/dist/version.js.map +1 -1
  214. package/package.json +9 -2
  215. package/dist/api/graphql/functions/compile_module.d.ts +0 -15
  216. package/dist/api/graphql/functions/compile_module.js +0 -13
  217. package/dist/api/graphql/functions/compile_module.js.map +0 -1
  218. package/dist/api/graphql/functions/module_compilation_status.d.ts +0 -15
  219. package/dist/api/graphql/functions/module_compilation_status.js +0 -13
  220. package/dist/api/graphql/functions/module_compilation_status.js.map +0 -1
package/dist/output.js CHANGED
@@ -1,13 +1,9 @@
1
1
  /* eslint-disable no-console */
2
- import { Bug, cleanSingleStackTracePath } from './error.js';
3
2
  import { isUnitTest, isVerbose } from './environment/local.js';
4
3
  import { colors } from './node/colors.js';
5
4
  import { ColorContentToken, CommandContentToken, ErrorContentToken, HeadingContentToken, ItalicContentToken, JsonContentToken, LinesDiffContentToken, LinkContentToken, PathContentToken, RawContentToken, SubHeadingContentToken, } from './content-tokens.js';
6
5
  import { logToFile } from './log.js';
7
- import StackTracey from 'stacktracey';
8
- import { AbortController } from 'abort-controller';
9
6
  import stripAnsi from 'strip-ansi';
10
- import { Writable } from 'node:stream';
11
7
  export { default as logUpdate } from 'log-update';
12
8
  export class TokenizedString {
13
9
  constructor(value) {
@@ -112,7 +108,7 @@ export function content(strings, ...keys) {
112
108
  }
113
109
  /**
114
110
  * It maps a level to a numeric value.
115
- * @param level {LogLevel} The level for which we'll return its numeric value.
111
+ * @param level - The level for which we'll return its numeric value.
116
112
  * @returns The numeric value of the level.
117
113
  */
118
114
  const logLevelValue = (level) => {
@@ -135,7 +131,7 @@ const logLevelValue = (level) => {
135
131
  };
136
132
  /**
137
133
  *
138
- * @returns {LogLevel} It returns the log level set by the user.
134
+ * @returns It returns the log level set by the user.
139
135
  */
140
136
  export const currentLogLevel = () => {
141
137
  if (isVerbose()) {
@@ -159,10 +155,10 @@ export let collectedLogs = {};
159
155
  * This is only used during UnitTesting.
160
156
  * If we are in a testing context, instead of printing the logs to the console,
161
157
  * we will store them in a variable that can be accessed from the tests.
162
- * @param key {string} The key of the log.
163
- * @param content {string} The content of the log.
158
+ * @param key - The key of the log.
159
+ * @param content - The content of the log.
164
160
  */
165
- const collectLog = (key, content) => {
161
+ export const collectLog = (key, content) => {
166
162
  const output = collectedLogs.output ?? [];
167
163
  const data = collectedLogs[key] ?? [];
168
164
  data.push(stripAnsi(stringifyMessage(content) ?? ''));
@@ -177,8 +173,8 @@ export const clearCollectedLogs = () => {
177
173
  * Ouputs information to the user.
178
174
  * Info messages don't get additional formatting.
179
175
  * Note: Info messages are sent through the standard output.
180
- * @param content {string} The content to be output to the user.
181
- * @param logger {Function} The logging function to use to output to the user.
176
+ * @param content - The content to be output to the user.
177
+ * @param logger - The logging function to use to output to the user.
182
178
  */
183
179
  export const info = (content, logger = consoleLog) => {
184
180
  const message = stringifyMessage(content);
@@ -190,8 +186,8 @@ export const info = (content, logger = consoleLog) => {
190
186
  * Outputs a success message to the user.
191
187
  * Success messages receive a special formatting to make them stand out in the console.
192
188
  * Note: Success messages are sent through the standard output.
193
- * @param content {string} The content to be output to the user.
194
- * @param logger {Function} The logging function to use to output to the user.
189
+ * @param content - The content to be output to the user.
190
+ * @param logger - The logging function to use to output to the user.
195
191
  */
196
192
  export const success = (content, logger = consoleLog) => {
197
193
  const message = colors.bold(`✅ Success! ${stringifyMessage(content)}.`);
@@ -203,8 +199,8 @@ export const success = (content, logger = consoleLog) => {
203
199
  * Outputs a completed message to the user.
204
200
  * Completed message receive a special formatting to make them stand out in the console.
205
201
  * Note: Completed messages are sent through the standard output.
206
- * @param content {string} The content to be output to the user.
207
- * @param logger {Function} The logging function to use to output to the user.
202
+ * @param content - The content to be output to the user.
203
+ * @param logger - The logging function to use to output to the user.
208
204
  */
209
205
  export const completed = (content, logger = consoleLog) => {
210
206
  const message = `${colors.green('✔')} ${stringifyMessage(content)}`;
@@ -216,8 +212,8 @@ export const completed = (content, logger = consoleLog) => {
216
212
  * Ouputs debug information to the user. By default these output is hidden unless the user calls the CLI with --verbose.
217
213
  * Debug messages don't get additional formatting.
218
214
  * Note: Debug messages are sent through the standard output.
219
- * @param content {string} The content to be output to the user.
220
- * @param logger {Function} The logging function to use to output to the user.
215
+ * @param content - The content to be output to the user.
216
+ * @param logger - The logging function to use to output to the user.
221
217
  */
222
218
  export const debug = (content, logger = consoleLog) => {
223
219
  if (isUnitTest())
@@ -229,8 +225,8 @@ export const debug = (content, logger = consoleLog) => {
229
225
  * Outputs a warning message to the user.
230
226
  * Warning messages receive a special formatting to make them stand out in the console.
231
227
  * Note: Warning messages are sent through the standard output.
232
- * @param content {string} The content to be output to the user.
233
- * @param logger {Function} The logging function to use to output to the user.
228
+ * @param content - The content to be output to the user.
229
+ * @param logger - The logging function to use to output to the user.
234
230
  */
235
231
  export const warn = (content, logger = consoleWarn) => {
236
232
  if (isUnitTest())
@@ -244,62 +240,6 @@ export const warn = (content, logger = consoleWarn) => {
244
240
  export const newline = () => {
245
241
  console.log();
246
242
  };
247
- /**
248
- * Formats and outputs a fatal error.
249
- * Note: This API is not intended to be used internally. If you want to
250
- * abort the execution due to an error, raise a fatal error and let the
251
- * error handler handle and format it.
252
- * @param content {Fatal} The fatal error to be output.
253
- */
254
- export const error = async (content) => {
255
- if (!content.message) {
256
- return;
257
- }
258
- let outputString = '';
259
- const message = content.message;
260
- const padding = ' ';
261
- const header = colors.redBright(`\n━━━━━━ Error ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n`);
262
- const footer = colors.redBright('\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n');
263
- outputString += header;
264
- const lines = message.split('\n');
265
- for (const line of lines) {
266
- outputString += `${padding}${line}\n`;
267
- }
268
- if (content.tryMessage) {
269
- outputString += `\n${padding}${colors.bold('What to try:')}\n`;
270
- const lines = content.tryMessage.split('\n');
271
- for (const line of lines) {
272
- outputString += `${padding}${line}\n`;
273
- }
274
- }
275
- let stack = new StackTracey(content);
276
- stack.items.forEach((item) => {
277
- item.file = cleanSingleStackTracePath(item.file);
278
- });
279
- stack = await stack.withSourcesAsync();
280
- stack = stack
281
- .filter((entry) => {
282
- return !entry.file.includes('@oclif/core');
283
- })
284
- .map((item) => {
285
- item.calleeShort = colors.yellow(item.calleeShort);
286
- /** We make the paths relative to the packages/ directory */
287
- const fileShortComponents = item.fileShort.split('packages/');
288
- item.fileShort = fileShortComponents.length === 2 ? fileShortComponents[1] : fileShortComponents[0];
289
- return item;
290
- });
291
- if (content instanceof Bug) {
292
- if (stack.items.length !== 0) {
293
- outputString += `\n${padding}${colors.bold('Stack trace:')}\n`;
294
- const stackLines = stack.asTable({}).split('\n');
295
- for (const stackLine of stackLines) {
296
- outputString += `${padding}${stackLine}\n`;
297
- }
298
- }
299
- }
300
- outputString += footer;
301
- outputWhereAppropriate('error', consoleError, outputString);
302
- };
303
243
  export function stringifyMessage(message) {
304
244
  if (message instanceof TokenizedString) {
305
245
  return message.value;
@@ -312,53 +252,6 @@ const message = (content, level = 'info') => {
312
252
  const stringifiedMessage = stringifyMessage(content);
313
253
  outputWhereAppropriate(level, consoleLog, stringifiedMessage);
314
254
  };
315
- /**
316
- * Use this function when you have multiple concurrent processes that send data events
317
- * and we need to output them ensuring that they can visually differenciated by the user.
318
- *
319
- * @param processes {OutputProcess[]} A list of processes to run concurrently.
320
- */
321
- export async function concurrent(processes, callback = undefined) {
322
- const abortController = new AbortController();
323
- // eslint-disable-next-line node/callback-return
324
- if (callback)
325
- callback(abortController.signal);
326
- const concurrentColors = [token.yellow, token.cyan, token.magenta, token.green];
327
- const prefixColumnSize = Math.max(...processes.map((process) => process.prefix.length));
328
- function linePrefix(prefix, index) {
329
- const colorIndex = index < concurrentColors.length ? index : index % concurrentColors.length;
330
- const color = concurrentColors[colorIndex];
331
- return color(`${prefix}${' '.repeat(prefixColumnSize - prefix.length)} ${colors.bold('|')} `);
332
- }
333
- try {
334
- await Promise.all(processes.map(async (process, index) => {
335
- const stdout = new Writable({
336
- write(chunk, _encoding, next) {
337
- const lines = stripAnsiEraseCursorEscapeCharacters(chunk.toString('ascii')).split(/\n/);
338
- for (const line of lines) {
339
- info(content `${linePrefix(process.prefix, index)}${line}`);
340
- }
341
- next();
342
- },
343
- });
344
- const stderr = new Writable({
345
- write(chunk, _encoding, next) {
346
- const lines = stripAnsiEraseCursorEscapeCharacters(chunk.toString('ascii')).split(/\n/);
347
- for (const line of lines) {
348
- message(content `${linePrefix(process.prefix, index)}${colors.bold(line)}`, 'error');
349
- }
350
- next();
351
- },
352
- });
353
- await process.action(stdout, stderr, abortController.signal);
354
- }));
355
- }
356
- catch (_error) {
357
- // We abort any running process
358
- abortController.abort();
359
- throw _error;
360
- }
361
- }
362
255
  /**
363
256
  * This regex can be used to find the erase cursor Ansii characters
364
257
  * to strip them from the string.
@@ -372,27 +265,16 @@ const eraseCursorAnsiRegex = [
372
265
  ]
373
266
  .map((element) => `[\\u001B\\u009B][[\\]()#;?]*${element}`)
374
267
  .join('|');
375
- /**
376
- * The data sent through the standard pipelines of the sub-processes that we execute
377
- * might contain ansii escape characters to move the cursor. That causes any additional
378
- * formatting to break. This function takes a string and strips escape characters that
379
- * manage the cursor in the terminal.
380
- * @param value {string} String whose erase cursor escape characters will be stripped.
381
- * @returns {string} Stripped string.
382
- */
383
- function stripAnsiEraseCursorEscapeCharacters(value) {
384
- return value.replace(/(\n)$/, '').replace(new RegExp(eraseCursorAnsiRegex, 'g'), '');
385
- }
386
268
  export function consoleLog(message) {
387
269
  console.log(withOrWithoutStyle(message));
388
270
  }
389
271
  export function consoleError(message) {
390
272
  console.error(withOrWithoutStyle(message));
391
273
  }
392
- function consoleWarn(message) {
274
+ export function consoleWarn(message) {
393
275
  console.warn(withOrWithoutStyle(message));
394
276
  }
395
- function outputWhereAppropriate(logLevel, logger, message) {
277
+ export function outputWhereAppropriate(logLevel, logger, message) {
396
278
  if (shouldOutput(logLevel)) {
397
279
  logger(message);
398
280
  }
@@ -407,16 +289,14 @@ function withOrWithoutStyle(message) {
407
289
  }
408
290
  }
409
291
  export function unstyled(message) {
410
- return colors.unstyle(message);
292
+ return stripAnsi(message);
411
293
  }
412
294
  export function shouldDisplayColors() {
413
295
  return Boolean(process.stdout.isTTY || process.env.FORCE_COLOR);
414
296
  }
415
297
  /**
416
- *
417
- * @param packageManager {PackageManager} The package manager that is being used.
418
- * @param version {string} The version to update to
419
- * @returns {te}
298
+ * @param packageManager - The package manager that is being used.
299
+ * @param version - The version to update to
420
300
  */
421
301
  export function getOutputUpdateCLIReminder(packageManager, version) {
422
302
  const versionMessage = `💡 Version ${version} available!`;
@@ -427,9 +307,9 @@ export function getOutputUpdateCLIReminder(packageManager, version) {
427
307
  }
428
308
  /**
429
309
  * Parse title and body to be a single formatted string
430
- * @param title {string} The title of the message. Will be formatted as a heading.
431
- * @param body {string} The body of the message. Will respect the original formatting.
432
- * @returns {string} The formatted message.
310
+ * @param title - The title of the message. Will be formatted as a heading.
311
+ * @param body - The body of the message. Will respect the original formatting.
312
+ * @returns The formatted message.
433
313
  */
434
314
  export function section(title, body) {
435
315
  const formattedTitle = `${title.toUpperCase()}${' '.repeat(35 - title.length)}`;
@@ -1 +1 @@
1
- {"version":3,"file":"output.js","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,OAAO,EAAQ,GAAG,EAAE,yBAAyB,EAAC,MAAM,YAAY,CAAA;AAChE,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,wBAAwB,CAAA;AAE5D,OAAO,EAAC,MAAM,EAAC,MAAM,kBAAkB,CAAA;AACvC,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EAEnB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,sBAAsB,GACvB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAC,SAAS,EAAC,MAAM,UAAU,CAAA;AAClC,OAAO,WAAW,MAAM,aAAa,CAAA;AACrC,OAAO,EAAC,eAAe,EAAc,MAAM,kBAAkB,CAAA;AAC7D,OAAO,SAAS,MAAM,YAAY,CAAA;AAClC,OAAO,EAAC,QAAQ,EAAC,MAAM,aA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AAM,cAAc,GAAG,GAAG,KAAK,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,CAAA;IAC/E,OAAO,OAAO,CAAA,GAAG,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,IAAI,EAAE,CAAC,KAAK,CAAA;AACjE,CAAC;AAED,8BAA8B","sourcesContent":["/* eslint-disable no-console */\nimport {Fatal, Bug, cleanSingleStackTracePath} from './error.js'\nimport {isUnitTest, isVerbose} from './environment/local.js'\nimport {PackageManager} from './node/node-package-manager.js'\nimport {colors} from './node/colors.js'\nimport {\n ColorContentToken,\n CommandContentToken,\n ContentToken,\n ErrorContentToken,\n HeadingContentToken,\n ItalicContentToken,\n JsonContentToken,\n LinesDiffContentToken,\n LinkContentToken,\n PathContentToken,\n RawContentToken,\n SubHeadingContentToken,\n} from './content-tokens.js'\nimport {logToFile} from './log.js'\nimport StackTracey from 'stacktracey'\nimport {AbortController, AbortSignal} from 'abort-controller'\nimport stripAnsi from 'strip-ansi'\nimport {Writable} from 'node:stream'\nimport type {Change} from 'diff'\n\nexport {default as logUpdate} from 'log-update'\n\nexport type Logger = (message: string) => void\n\nexport class TokenizedString {\n value: string\n constructor(value: string) {\n this.value = value\n }\n}\n\nexport type Message = string | TokenizedString\n\nexport const token = {\n raw: (value: string) => {\n return new RawContentToken(value)\n },\n genericShellCommand: (value: Message) => {\n return new CommandContentToken(value)\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n json: (value: any) => {\n return new JsonContentToken(value)\n },\n path: (value: Message) => {\n return new PathContentToken(value)\n },\n link: (value: Message, link: string) => {\n return new LinkContentToken(value, link)\n },\n heading: (value: Message) => {\n return new HeadingContentToken(value)\n },\n subheading: (value: Message) => {\n return new SubHeadingContentToken(value)\n },\n italic: (value: Message) => {\n return new ItalicContentToken(value)\n },\n errorText: (value: Message) => {\n return new ErrorContentToken(value)\n },\n cyan: (value: Message) => {\n return new ColorContentToken(value, colors.cyan)\n },\n yellow: (value: Message) => {\n return new ColorContentToken(value, colors.yellow)\n },\n magenta: (value: Message) => {\n return new ColorContentToken(value, colors.magenta)\n },\n green: (value: Message) => {\n return new ColorContentToken(value, colors.green)\n },\n packagejsonScript: (packageManager: PackageManager, scriptName: string, ...scriptArgs: string[]) => {\n return new CommandContentToken(formatPackageManagerCommand(packageManager, scriptName, scriptArgs))\n },\n successIcon: () => {\n return new ColorContentToken('✔', colors.green)\n },\n failIcon: () => {\n return new ErrorContentToken('✖')\n },\n linesDiff: (value: Change[]) => {\n return new LinesDiffContentToken(value)\n },\n}\n\nfunction formatPackageManagerCommand(packageManager: PackageManager, scriptName: string, scriptArgs: string[]): string {\n switch (packageManager) {\n case 'yarn': {\n const pieces = ['yarn', scriptName, ...scriptArgs]\n return pieces.join(' ')\n }\n case 'pnpm':\n case 'npm': {\n const pieces = [packageManager, 'run', scriptName]\n if (scriptArgs.length > 0) {\n pieces.push('--')\n pieces.push(...scriptArgs)\n }\n return pieces.join(' ')\n }\n }\n}\n\nexport function content(strings: TemplateStringsArray, ...keys: (ContentToken<unknown> | string)[]): TokenizedString {\n let output = ``\n strings.forEach((string, i) => {\n output += string\n if (i >= keys.length) {\n return\n }\n const token = keys[i]!\n\n if (typeof token === 'string') {\n output += token\n } else {\n const enumTokenOutput = token.output()\n\n if (Array.isArray(enumTokenOutput)) {\n enumTokenOutput.forEach((line: string) => {\n output += line\n })\n } else {\n output += enumTokenOutput\n }\n }\n })\n return new TokenizedString(output)\n}\n\n/** Log levels */\nexport type LogLevel = 'fatal' | 'error' | 'warn' | 'info' | 'debug' | 'trace' | 'silent'\n\n/**\n * It maps a level to a numeric value.\n * @param level {LogLevel} The level for which we'll return its numeric value.\n * @returns The numeric value of the level.\n */\nconst logLevelValue = (level: LogLevel): number => {\n switch (level) {\n case 'trace':\n return 10\n case 'debug':\n return 20\n case 'info':\n return 30\n case 'warn':\n return 40\n case 'error':\n return 50\n case 'fatal':\n return 60\n default:\n return 30\n }\n}\n\n/**\n *\n * @returns {LogLevel} It returns the log level set by the user.\n */\nexport const currentLogLevel = (): LogLevel => {\n if (isVerbose()) {\n return 'debug'\n } else {\n return 'info'\n }\n}\n\nexport const shouldOutput = (logLevel: LogLevel): boolean => {\n if (isUnitTest()) {\n return false\n }\n const currentLogLevelValue = logLevelValue(currentLogLevel())\n const messageLogLevelValue = logLevelValue(logLevel)\n return messageLogLevelValue >= currentLogLevelValue\n}\n\n// eslint-disable-next-line import/no-mutable-exports\nexport let collectedLogs: {[key: string]: string[]} = {}\n\n/**\n * This is only used during UnitTesting.\n * If we are in a testing context, instead of printing the logs to the console,\n * we will store them in a variable that can be accessed from the tests.\n * @param key {string} The key of the log.\n * @param content {string} The content of the log.\n */\nconst collectLog = (key: string, content: Message) => {\n const output = collectedLogs.output ?? []\n const data = collectedLogs[key] ?? []\n data.push(stripAnsi(stringifyMessage(content) ?? ''))\n output.push(stripAnsi(stringifyMessage(content) ?? ''))\n collectedLogs[key] = data\n collectedLogs.output = output\n}\n\nexport const clearCollectedLogs = () => {\n collectedLogs = {}\n}\n\n/**\n * Ouputs information to the user.\n * Info messages don't get additional formatting.\n * Note: Info messages are sent through the standard output.\n * @param content {string} The content to be output to the user.\n * @param logger {Function} The logging function to use to output to the user.\n */\nexport const info = (content: Message, logger: Logger = consoleLog) => {\n const message = stringifyMessage(content)\n if (isUnitTest()) collectLog('info', content)\n outputWhereAppropriate('info', logger, message)\n}\n\n/**\n * Outputs a success message to the user.\n * Success messages receive a special formatting to make them stand out in the console.\n * Note: Success messages are sent through the standard output.\n * @param content {string} The content to be output to the user.\n * @param logger {Function} The logging function to use to output to the user.\n */\nexport const success = (content: Message, logger: Logger = consoleLog) => {\n const message = colors.bold(`✅ Success! ${stringifyMessage(content)}.`)\n if (isUnitTest()) collectLog('success', content)\n outputWhereAppropriate('info', logger, message)\n}\n\n/**\n * Outputs a completed message to the user.\n * Completed message receive a special formatting to make them stand out in the console.\n * Note: Completed messages are sent through the standard output.\n * @param content {string} The content to be output to the user.\n * @param logger {Function} The logging function to use to output to the user.\n */\nexport const completed = (content: Message, logger: Logger = consoleLog) => {\n const message = `${colors.green('✔')} ${stringifyMessage(content)}`\n if (isUnitTest()) collectLog('completed', content)\n outputWhereAppropriate('info', logger, message)\n}\n\n/**\n * Ouputs debug information to the user. By default these output is hidden unless the user calls the CLI with --verbose.\n * Debug messages don't get additional formatting.\n * Note: Debug messages are sent through the standard output.\n * @param content {string} The content to be output to the user.\n * @param logger {Function} The logging function to use to output to the user.\n */\nexport const debug = (content: Message, logger: Logger = consoleLog) => {\n if (isUnitTest()) collectLog('debug', content)\n const message = colors.gray(stringifyMessage(content))\n outputWhereAppropriate('debug', logger, message)\n}\n\n/**\n * Outputs a warning message to the user.\n * Warning messages receive a special formatting to make them stand out in the console.\n * Note: Warning messages are sent through the standard output.\n * @param content {string} The content to be output to the user.\n * @param logger {Function} The logging function to use to output to the user.\n */\nexport const warn = (content: Message, logger: Logger = consoleWarn) => {\n if (isUnitTest()) collectLog('warn', content)\n const message = colors.yellow(stringifyMessage(content))\n outputWhereAppropriate('warn', logger, message)\n}\n\n/**\n * Prints a new line in the terminal.\n */\nexport const newline = () => {\n console.log()\n}\n\n/**\n * Formats and outputs a fatal error.\n * Note: This API is not intended to be used internally. If you want to\n * abort the execution due to an error, raise a fatal error and let the\n * error handler handle and format it.\n * @param content {Fatal} The fatal error to be output.\n */\nexport const error = async (content: Fatal) => {\n if (!content.message) {\n return\n }\n let outputString = ''\n const message = content.message\n const padding = ' '\n const header = colors.redBright(`\\n━━━━━━ Error ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\\n`)\n const footer = colors.redBright('\\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\\n')\n outputString += header\n const lines = message.split('\\n')\n for (const line of lines) {\n outputString += `${padding}${line}\\n`\n }\n if (content.tryMessage) {\n outputString += `\\n${padding}${colors.bold('What to try:')}\\n`\n const lines = content.tryMessage.split('\\n')\n for (const line of lines) {\n outputString += `${padding}${line}\\n`\n }\n }\n\n let stack = new StackTracey(content)\n stack.items.forEach((item) => {\n item.file = cleanSingleStackTracePath(item.file)\n })\n\n stack = await stack.withSourcesAsync()\n stack = stack\n .filter((entry) => {\n return !entry.file.includes('@oclif/core')\n })\n .map((item) => {\n item.calleeShort = colors.yellow(item.calleeShort)\n /** We make the paths relative to the packages/ directory */\n const fileShortComponents = item.fileShort.split('packages/')\n item.fileShort = fileShortComponents.length === 2 ? fileShortComponents[1]! : fileShortComponents[0]!\n return item\n })\n if (content instanceof Bug) {\n if (stack.items.length !== 0) {\n outputString += `\\n${padding}${colors.bold('Stack trace:')}\\n`\n const stackLines = stack.asTable({}).split('\\n')\n for (const stackLine of stackLines) {\n outputString += `${padding}${stackLine}\\n`\n }\n }\n }\n outputString += footer\n outputWhereAppropriate('error', consoleError, outputString)\n}\n\nexport function stringifyMessage(message: Message): string {\n if (message instanceof TokenizedString) {\n return message.value\n } else {\n return message\n }\n}\n\nconst message = (content: Message, level: LogLevel = 'info') => {\n const stringifiedMessage = stringifyMessage(content)\n outputWhereAppropriate(level, consoleLog, stringifiedMessage)\n}\n\nexport interface OutputProcess {\n /** The prefix to include in the logs\n * [vite] Output coming from Vite\n */\n prefix: string\n /**\n * A callback to invoke the process. stdout and stderr should be used\n * to send standard output and error data that gets formatted with the\n * right prefix.\n */\n action: (stdout: Writable, stderr: Writable, signal: AbortSignal) => Promise<void>\n}\n\n/**\n * Use this function when you have multiple concurrent processes that send data events\n * and we need to output them ensuring that they can visually differenciated by the user.\n *\n * @param processes {OutputProcess[]} A list of processes to run concurrently.\n */\nexport async function concurrent(\n processes: OutputProcess[],\n callback: ((signal: AbortSignal) => void) | undefined = undefined,\n) {\n const abortController = new AbortController()\n\n // eslint-disable-next-line node/callback-return\n if (callback) callback(abortController.signal)\n\n const concurrentColors = [token.yellow, token.cyan, token.magenta, token.green]\n const prefixColumnSize = Math.max(...processes.map((process) => process.prefix.length))\n\n function linePrefix(prefix: string, index: number) {\n const colorIndex = index < concurrentColors.length ? index : index % concurrentColors.length\n const color = concurrentColors[colorIndex]!\n return color(`${prefix}${' '.repeat(prefixColumnSize - prefix.length)} ${colors.bold('|')} `)\n }\n\n try {\n await Promise.all(\n processes.map(async (process, index) => {\n const stdout = new Writable({\n write(chunk, _encoding, next) {\n const lines = stripAnsiEraseCursorEscapeCharacters(chunk.toString('ascii')).split(/\\n/)\n for (const line of lines) {\n info(content`${linePrefix(process.prefix, index)}${line}`)\n }\n next()\n },\n })\n const stderr = new Writable({\n write(chunk, _encoding, next) {\n const lines = stripAnsiEraseCursorEscapeCharacters(chunk.toString('ascii')).split(/\\n/)\n for (const line of lines) {\n message(content`${linePrefix(process.prefix, index)}${colors.bold(line)}`, 'error')\n }\n next()\n },\n })\n await process.action(stdout, stderr, abortController.signal)\n }),\n )\n } catch (_error) {\n // We abort any running process\n abortController.abort()\n throw _error\n }\n}\n\n/**\n * This regex can be used to find the erase cursor Ansii characters\n * to strip them from the string.\n * https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797#erase-functions\n */\nconst eraseCursorAnsiRegex = [\n // Erase the entire line\n '2K',\n // Clear vertical tab stop at current line\n '1G',\n]\n .map((element) => `[\\\\u001B\\\\u009B][[\\\\]()#;?]*${element}`)\n .join('|')\n\n/**\n * The data sent through the standard pipelines of the sub-processes that we execute\n * might contain ansii escape characters to move the cursor. That causes any additional\n * formatting to break. This function takes a string and strips escape characters that\n * manage the cursor in the terminal.\n * @param value {string} String whose erase cursor escape characters will be stripped.\n * @returns {string} Stripped string.\n */\nfunction stripAnsiEraseCursorEscapeCharacters(value: string): string {\n return value.replace(/(\\n)$/, '').replace(new RegExp(eraseCursorAnsiRegex, 'g'), '')\n}\n\nexport function consoleLog(message: string): void {\n console.log(withOrWithoutStyle(message))\n}\n\nexport function consoleError(message: string): void {\n console.error(withOrWithoutStyle(message))\n}\n\nfunction consoleWarn(message: string): void {\n console.warn(withOrWithoutStyle(message))\n}\n\nfunction outputWhereAppropriate(logLevel: LogLevel, logger: Logger, message: string): void {\n if (shouldOutput(logLevel)) {\n logger(message)\n }\n logToFile(message, logLevel.toUpperCase())\n}\n\nfunction withOrWithoutStyle(message: string): string {\n if (shouldDisplayColors()) {\n return message\n } else {\n return unstyled(message)\n }\n}\n\nexport function unstyled(message: string): string {\n return colors.unstyle(message)\n}\n\nexport function shouldDisplayColors(): boolean {\n return Boolean(process.stdout.isTTY || process.env.FORCE_COLOR)\n}\n\n/**\n *\n * @param packageManager {PackageManager} The package manager that is being used.\n * @param version {string} The version to update to\n * @returns {te}\n */\nexport function getOutputUpdateCLIReminder(\n packageManager: PackageManager | 'unknown' | undefined,\n version: string,\n): string {\n const versionMessage = `💡 Version ${version} available!`\n if (!packageManager || packageManager === 'unknown') return versionMessage\n\n const updateCommand = token.packagejsonScript(packageManager, 'shopify', 'upgrade')\n return content`${versionMessage} Run ${updateCommand}`.value\n}\n\n/**\n * Parse title and body to be a single formatted string\n * @param title {string} The title of the message. Will be formatted as a heading.\n * @param body {string} The body of the message. Will respect the original formatting.\n * @returns {string} The formatted message.\n */\nexport function section(title: string, body: string): string {\n const formattedTitle = `${title.toUpperCase()}${' '.repeat(35 - title.length)}`\n return content`${token.heading(formattedTitle)}\\n${body}`.value\n}\n\n/* eslint-enable no-console */\n"]}
1
+ {"version":3,"file":"output.js","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,wBAAwB,CAAA;AAE5D,OAAO,EAAC,MAAM,EAAC,MAAM,kBAAkB,CAAA;AACvC,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EAEnB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,sBAAsB,G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,MAAM,cAAc,GAAG,cAAc,OAAO,aAAa,CAAA;IACzD,IAAI,CAAC,cAAc,IAAI,cAAc,KAAK,SAAS;QAAE,OAAO,cAAc,CAAA;IAE1E,MAAM,aAAa,GAAG,KAAK,CAAC,iBAAiB,CAAC,cAAc,EAAE,SAAS,EAAE,SAAS,CAAC,CAAA;IACnF,OAAO,OAAO,CAAA,GAAG,cAAc,QAAQ,aAAa,EAAE,CAAC,KAAK,CAAA;AAC9D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,KAAa,EAAE,IAAY;IACjD,MAAM,cAAc,GAAG,GAAG,KAAK,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,CAAA;IAC/E,OAAO,OAAO,CAAA,GAAG,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,IAAI,EAAE,CAAC,KAAK,CAAA;AACjE,CAAC;AAED,8BAA8B","sourcesContent":["/* eslint-disable no-console */\nimport {isUnitTest, isVerbose} from './environment/local.js'\nimport {PackageManager} from './node/node-package-manager.js'\nimport {colors} from './node/colors.js'\nimport {\n ColorContentToken,\n CommandContentToken,\n ContentToken,\n ErrorContentToken,\n HeadingContentToken,\n ItalicContentToken,\n JsonContentToken,\n LinesDiffContentToken,\n LinkContentToken,\n PathContentToken,\n RawContentToken,\n SubHeadingContentToken,\n} from './content-tokens.js'\nimport {logToFile} from './log.js'\nimport {AbortSignal} from 'abort-controller'\nimport stripAnsi from 'strip-ansi'\nimport {Writable} from 'node:stream'\nimport type {Change} from 'diff'\n\nexport {default as logUpdate} from 'log-update'\n\nexport type Logger = (message: string) => void\n\nexport class TokenizedString {\n value: string\n constructor(value: string) {\n this.value = value\n }\n}\n\nexport type Message = string | TokenizedString\n\nexport const token = {\n raw: (value: string) => {\n return new RawContentToken(value)\n },\n genericShellCommand: (value: Message) => {\n return new CommandContentToken(value)\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n json: (value: any) => {\n return new JsonContentToken(value)\n },\n path: (value: Message) => {\n return new PathContentToken(value)\n },\n link: (value: Message, link: string) => {\n return new LinkContentToken(value, link)\n },\n heading: (value: Message) => {\n return new HeadingContentToken(value)\n },\n subheading: (value: Message) => {\n return new SubHeadingContentToken(value)\n },\n italic: (value: Message) => {\n return new ItalicContentToken(value)\n },\n errorText: (value: Message) => {\n return new ErrorContentToken(value)\n },\n cyan: (value: Message) => {\n return new ColorContentToken(value, colors.cyan)\n },\n yellow: (value: Message) => {\n return new ColorContentToken(value, colors.yellow)\n },\n magenta: (value: Message) => {\n return new ColorContentToken(value, colors.magenta)\n },\n green: (value: Message) => {\n return new ColorContentToken(value, colors.green)\n },\n packagejsonScript: (packageManager: PackageManager, scriptName: string, ...scriptArgs: string[]) => {\n return new CommandContentToken(formatPackageManagerCommand(packageManager, scriptName, scriptArgs))\n },\n successIcon: () => {\n return new ColorContentToken('✔', colors.green)\n },\n failIcon: () => {\n return new ErrorContentToken('✖')\n },\n linesDiff: (value: Change[]) => {\n return new LinesDiffContentToken(value)\n },\n}\n\nfunction formatPackageManagerCommand(packageManager: PackageManager, scriptName: string, scriptArgs: string[]): string {\n switch (packageManager) {\n case 'yarn': {\n const pieces = ['yarn', scriptName, ...scriptArgs]\n return pieces.join(' ')\n }\n case 'pnpm':\n case 'npm': {\n const pieces = [packageManager, 'run', scriptName]\n if (scriptArgs.length > 0) {\n pieces.push('--')\n pieces.push(...scriptArgs)\n }\n return pieces.join(' ')\n }\n }\n}\n\nexport function content(strings: TemplateStringsArray, ...keys: (ContentToken<unknown> | string)[]): TokenizedString {\n let output = ``\n strings.forEach((string, i) => {\n output += string\n if (i >= keys.length) {\n return\n }\n const token = keys[i]!\n\n if (typeof token === 'string') {\n output += token\n } else {\n const enumTokenOutput = token.output()\n\n if (Array.isArray(enumTokenOutput)) {\n enumTokenOutput.forEach((line: string) => {\n output += line\n })\n } else {\n output += enumTokenOutput\n }\n }\n })\n return new TokenizedString(output)\n}\n\n/** Log levels */\nexport type LogLevel = 'fatal' | 'error' | 'warn' | 'info' | 'debug' | 'trace' | 'silent'\n\n/**\n * It maps a level to a numeric value.\n * @param level - The level for which we'll return its numeric value.\n * @returns The numeric value of the level.\n */\nconst logLevelValue = (level: LogLevel): number => {\n switch (level) {\n case 'trace':\n return 10\n case 'debug':\n return 20\n case 'info':\n return 30\n case 'warn':\n return 40\n case 'error':\n return 50\n case 'fatal':\n return 60\n default:\n return 30\n }\n}\n\n/**\n *\n * @returns It returns the log level set by the user.\n */\nexport const currentLogLevel = (): LogLevel => {\n if (isVerbose()) {\n return 'debug'\n } else {\n return 'info'\n }\n}\n\nexport const shouldOutput = (logLevel: LogLevel): boolean => {\n if (isUnitTest()) {\n return false\n }\n const currentLogLevelValue = logLevelValue(currentLogLevel())\n const messageLogLevelValue = logLevelValue(logLevel)\n return messageLogLevelValue >= currentLogLevelValue\n}\n\n// eslint-disable-next-line import/no-mutable-exports\nexport let collectedLogs: {[key: string]: string[]} = {}\n\n/**\n * This is only used during UnitTesting.\n * If we are in a testing context, instead of printing the logs to the console,\n * we will store them in a variable that can be accessed from the tests.\n * @param key - The key of the log.\n * @param content - The content of the log.\n */\nexport const collectLog = (key: string, content: Message) => {\n const output = collectedLogs.output ?? []\n const data = collectedLogs[key] ?? []\n data.push(stripAnsi(stringifyMessage(content) ?? ''))\n output.push(stripAnsi(stringifyMessage(content) ?? ''))\n collectedLogs[key] = data\n collectedLogs.output = output\n}\n\nexport const clearCollectedLogs = () => {\n collectedLogs = {}\n}\n\n/**\n * Ouputs information to the user.\n * Info messages don't get additional formatting.\n * Note: Info messages are sent through the standard output.\n * @param content - The content to be output to the user.\n * @param logger - The logging function to use to output to the user.\n */\nexport const info = (content: Message, logger: Logger = consoleLog) => {\n const message = stringifyMessage(content)\n if (isUnitTest()) collectLog('info', content)\n outputWhereAppropriate('info', logger, message)\n}\n\n/**\n * Outputs a success message to the user.\n * Success messages receive a special formatting to make them stand out in the console.\n * Note: Success messages are sent through the standard output.\n * @param content - The content to be output to the user.\n * @param logger - The logging function to use to output to the user.\n */\nexport const success = (content: Message, logger: Logger = consoleLog) => {\n const message = colors.bold(`✅ Success! ${stringifyMessage(content)}.`)\n if (isUnitTest()) collectLog('success', content)\n outputWhereAppropriate('info', logger, message)\n}\n\n/**\n * Outputs a completed message to the user.\n * Completed message receive a special formatting to make them stand out in the console.\n * Note: Completed messages are sent through the standard output.\n * @param content - The content to be output to the user.\n * @param logger - The logging function to use to output to the user.\n */\nexport const completed = (content: Message, logger: Logger = consoleLog) => {\n const message = `${colors.green('✔')} ${stringifyMessage(content)}`\n if (isUnitTest()) collectLog('completed', content)\n outputWhereAppropriate('info', logger, message)\n}\n\n/**\n * Ouputs debug information to the user. By default these output is hidden unless the user calls the CLI with --verbose.\n * Debug messages don't get additional formatting.\n * Note: Debug messages are sent through the standard output.\n * @param content - The content to be output to the user.\n * @param logger - The logging function to use to output to the user.\n */\nexport const debug = (content: Message, logger: Logger = consoleLog) => {\n if (isUnitTest()) collectLog('debug', content)\n const message = colors.gray(stringifyMessage(content))\n outputWhereAppropriate('debug', logger, message)\n}\n\n/**\n * Outputs a warning message to the user.\n * Warning messages receive a special formatting to make them stand out in the console.\n * Note: Warning messages are sent through the standard output.\n * @param content - The content to be output to the user.\n * @param logger - The logging function to use to output to the user.\n */\nexport const warn = (content: Message, logger: Logger = consoleWarn) => {\n if (isUnitTest()) collectLog('warn', content)\n const message = colors.yellow(stringifyMessage(content))\n outputWhereAppropriate('warn', logger, message)\n}\n\n/**\n * Prints a new line in the terminal.\n */\nexport const newline = () => {\n console.log()\n}\n\nexport function stringifyMessage(message: Message): string {\n if (message instanceof TokenizedString) {\n return message.value\n } else {\n return message\n }\n}\n\nconst message = (content: Message, level: LogLevel = 'info') => {\n const stringifiedMessage = stringifyMessage(content)\n outputWhereAppropriate(level, consoleLog, stringifiedMessage)\n}\n\nexport interface OutputProcess {\n /** The prefix to include in the logs\n * [vite] Output coming from Vite\n */\n prefix: string\n /**\n * A callback to invoke the process. stdout and stderr should be used\n * to send standard output and error data that gets formatted with the\n * right prefix.\n */\n action: (stdout: Writable, stderr: Writable, signal: AbortSignal) => Promise<void>\n}\n\n/**\n * This regex can be used to find the erase cursor Ansii characters\n * to strip them from the string.\n * https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797#erase-functions\n */\nconst eraseCursorAnsiRegex = [\n // Erase the entire line\n '2K',\n // Clear vertical tab stop at current line\n '1G',\n]\n .map((element) => `[\\\\u001B\\\\u009B][[\\\\]()#;?]*${element}`)\n .join('|')\n\nexport function consoleLog(message: string): void {\n console.log(withOrWithoutStyle(message))\n}\n\nexport function consoleError(message: string): void {\n console.error(withOrWithoutStyle(message))\n}\n\nexport function consoleWarn(message: string): void {\n console.warn(withOrWithoutStyle(message))\n}\n\nexport function outputWhereAppropriate(logLevel: LogLevel, logger: Logger, message: string): void {\n if (shouldOutput(logLevel)) {\n logger(message)\n }\n logToFile(message, logLevel.toUpperCase())\n}\n\nfunction withOrWithoutStyle(message: string): string {\n if (shouldDisplayColors()) {\n return message\n } else {\n return unstyled(message)\n }\n}\n\nexport function unstyled(message: string): string {\n return stripAnsi(message)\n}\n\nexport function shouldDisplayColors(): boolean {\n return Boolean(process.stdout.isTTY || process.env.FORCE_COLOR)\n}\n\n/**\n * @param packageManager - The package manager that is being used.\n * @param version - The version to update to\n */\nexport function getOutputUpdateCLIReminder(\n packageManager: PackageManager | 'unknown' | undefined,\n version: string,\n): string {\n const versionMessage = `💡 Version ${version} available!`\n if (!packageManager || packageManager === 'unknown') return versionMessage\n\n const updateCommand = token.packagejsonScript(packageManager, 'shopify', 'upgrade')\n return content`${versionMessage} Run ${updateCommand}`.value\n}\n\n/**\n * Parse title and body to be a single formatted string\n * @param title - The title of the message. Will be formatted as a heading.\n * @param body - The body of the message. Will respect the original formatting.\n * @returns The formatted message.\n */\nexport function section(title: string, body: string): string {\n const formattedTitle = `${title.toUpperCase()}${' '.repeat(35 - title.length)}`\n return content`${token.heading(formattedTitle)}\\n${body}`.value\n}\n\n/* eslint-enable no-console */\n"]}
package/dist/path.d.ts CHANGED
@@ -11,13 +11,13 @@ export declare function findUp(matcher: OverloadParameters<typeof internalFindUp
11
11
  * the current working directory. This is useful when logging paths
12
12
  * to allow the users to click on the file and let the OS open it
13
13
  * in the editor of choice.
14
- * @param path {string} Path to relativize
15
- * @returns {string} Relativized path.
14
+ * @param path - Path to relativize
15
+ * @returns Relativized path.
16
16
  */
17
17
  export declare function relativize(path: string): string;
18
18
  /**
19
19
  * Given a module's import.meta.url it returns the directory containing the module.
20
- * @param moduleURL {string} The value of import.meta.url in the context of the caller module.
21
- * @returns {string} The path to the directory containing the caller module.
20
+ * @param moduleURL - The value of import.meta.url in the context of the caller module.
21
+ * @returns The path to the directory containing the caller module.
22
22
  */
23
23
  export declare function moduleDirectory(moduleURL: string | URL): string;
package/dist/path.js CHANGED
@@ -16,8 +16,8 @@ export async function findUp(matcher, options) {
16
16
  * the current working directory. This is useful when logging paths
17
17
  * to allow the users to click on the file and let the OS open it
18
18
  * in the editor of choice.
19
- * @param path {string} Path to relativize
20
- * @returns {string} Relativized path.
19
+ * @param path - Path to relativize
20
+ * @returns Relativized path.
21
21
  */
22
22
  export function relativize(path) {
23
23
  const result = commondir([path, process.cwd()]);
@@ -32,8 +32,8 @@ export function relativize(path) {
32
32
  }
33
33
  /**
34
34
  * Given a module's import.meta.url it returns the directory containing the module.
35
- * @param moduleURL {string} The value of import.meta.url in the context of the caller module.
36
- * @returns {string} The path to the directory containing the caller module.
35
+ * @param moduleURL - The value of import.meta.url in the context of the caller module.
36
+ * @returns The path to the directory containing the caller module.
37
37
  */
38
38
  export function moduleDirectory(moduleURL) {
39
39
  return dirname(fileURLToPath(moduleURL));
package/dist/path.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"path.js","sourceRoot":"","sources":["../src/path.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,WAAW,CAAA;AACjC,O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EAAE;QACnE,OAAO,IAAI,CAAA;KACZ;SAAM;QACL,OAAO,YAAY,CAAA;KACpB;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,SAAuB;IACrD,OAAO,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAA;AAC1C,CAAC","sourcesContent":["import {OverloadParameters} from './typing/overloaded-parameters.js'\nimport commondir from 'commondir'\nimport {relative, dirname, join, normalize, resolve, basename, extname, isAbsolute, parse} from 'pathe'\nimport {findUp as internalFindUp, Match as FindUpMatch} from 'find-up'\nimport {fileURLToPath} from 'url'\n\nexport {join, relative, dirname, normalize, resolve, basename, extname, isAbsolute, parse}\n\nexport {default as glob} from 'fast-glob'\nexport {pathToFileURL} from 'node:url'\n\ntype FindUpMatcher = (directory: string) => FindUpMatch | Promise<FindUpMatch>\n\nexport async function findUp(\n matcher: OverloadParameters<typeof internalFindUp>[0],\n options: OverloadParameters<typeof internalFindUp>[1],\n): ReturnType<typeof internalFindUp> {\n // findUp has odd typing\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const got = await internalFindUp(matcher as any, options)\n return got ? normalize(got) : undefined\n}\n\n/**\n * Given an absolute filesystem path, it makes it relative to\n * the current working directory. This is useful when logging paths\n * to allow the users to click on the file and let the OS open it\n * in the editor of choice.\n * @param path {string} Path to relativize\n * @returns {string} Relativized path.\n */\nexport function relativize(path: string): string {\n const result = commondir([path, process.cwd()])\n const relativePath = relative(process.cwd(), path)\n const relativeComponents = relativePath.split('/').filter((component) => component === '..').length\n if (result === '/' || relativePath === '' || relativeComponents > 2) {\n return path\n } else {\n return relativePath\n }\n}\n\n/**\n * Given a module's import.meta.url it returns the directory containing the module.\n * @param moduleURL {string} The value of import.meta.url in the context of the caller module.\n * @returns {string} The path to the directory containing the caller module.\n */\nexport function moduleDirectory(moduleURL: string | URL): string {\n return dirname(fileURLToPath(moduleURL))\n}\n"]}
1
+ {"version":3,"file":"path.js","sourceRoot":"","sources":["../src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,KAAK,GAAG,IAAI,YAAY,KAAK,EAAE,IAAI,kBAAkB,GAAG,CAAC,EAAE;QACnE,OAAO,IAAI,CAAA;KACZ;SAAM;QACL,OAAO,YAAY,CAAA;KACpB;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,SAAuB;IACrD,OAAO,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAA;AAC1C,CAAC","sourcesContent":["import {OverloadParameters} from './typing/overloaded-parameters.js'\nimport commondir from 'commondir'\nimport {relative, dirname, join, normalize, resolve, basename, extname, isAbsolute, parse} from 'pathe'\nimport {findUp as internalFindUp, Match as FindUpMatch} from 'find-up'\nimport {fileURLToPath} from 'url'\n\nexport {join, relative, dirname, normalize, resolve, basename, extname, isAbsolute, parse}\n\nexport {default as glob} from 'fast-glob'\nexport {pathToFileURL} from 'node:url'\n\ntype FindUpMatcher = (directory: string) => FindUpMatch | Promise<FindUpMatch>\n\nexport async function findUp(\n matcher: OverloadParameters<typeof internalFindUp>[0],\n options: OverloadParameters<typeof internalFindUp>[1],\n): ReturnType<typeof internalFindUp> {\n // findUp has odd typing\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const got = await internalFindUp(matcher as any, options)\n return got ? normalize(got) : undefined\n}\n\n/**\n * Given an absolute filesystem path, it makes it relative to\n * the current working directory. This is useful when logging paths\n * to allow the users to click on the file and let the OS open it\n * in the editor of choice.\n * @param path - Path to relativize\n * @returns Relativized path.\n */\nexport function relativize(path: string): string {\n const result = commondir([path, process.cwd()])\n const relativePath = relative(process.cwd(), path)\n const relativeComponents = relativePath.split('/').filter((component) => component === '..').length\n if (result === '/' || relativePath === '' || relativeComponents > 2) {\n return path\n } else {\n return relativePath\n }\n}\n\n/**\n * Given a module's import.meta.url it returns the directory containing the module.\n * @param moduleURL - The value of import.meta.url in the context of the caller module.\n * @returns The path to the directory containing the caller module.\n */\nexport function moduleDirectory(moduleURL: string | URL): string {\n return dirname(fileURLToPath(moduleURL))\n}\n"]}
package/dist/plugins.d.ts CHANGED
@@ -47,7 +47,7 @@ export declare type FanoutHookFunction<TEvent extends keyof TPluginMap = string,
47
47
  * Execute the 'tunnel_provider' hook, and return the list of available tunnel providers.
48
48
  * Fail if there are multiple plugins for the same provider
49
49
  *
50
- * @param config oclif config used to execute hooks
50
+ * @param config - oclif config used to execute hooks
51
51
  * @returns list of available tunnel plugins
52
52
  */
53
53
  export declare function getListOfTunnelPlugins(config: Config): Promise<{
@@ -58,9 +58,9 @@ export declare function getListOfTunnelPlugins(config: Config): Promise<{
58
58
  * Execute the 'tunnel_start' hook for the given provider.
59
59
  * Fails if there aren't plugins for that provider or if there are more than one.
60
60
  *
61
- * @param config oclif config used to execute hooks
62
- * @param port port where the tunnel will be started
63
- * @param provider selected provider, must be unique
61
+ * @param config - oclif config used to execute hooks
62
+ * @param port - port where the tunnel will be started
63
+ * @param provider - selected provider, must be unique
64
64
  * @returns tunnel URL from the selected provider
65
65
  */
66
66
  export declare function runTunnelPlugin(config: Config, port: number, provider: string): Promise<{
package/dist/plugins.js CHANGED
@@ -13,7 +13,7 @@ export async function fanoutHooks(config, event, options, timeout) {
13
13
  * Execute the 'tunnel_provider' hook, and return the list of available tunnel providers.
14
14
  * Fail if there are multiple plugins for the same provider
15
15
  *
16
- * @param config oclif config used to execute hooks
16
+ * @param config - oclif config used to execute hooks
17
17
  * @returns list of available tunnel plugins
18
18
  */
19
19
  export async function getListOfTunnelPlugins(config) {
@@ -27,9 +27,9 @@ export async function getListOfTunnelPlugins(config) {
27
27
  * Execute the 'tunnel_start' hook for the given provider.
28
28
  * Fails if there aren't plugins for that provider or if there are more than one.
29
29
  *
30
- * @param config oclif config used to execute hooks
31
- * @param port port where the tunnel will be started
32
- * @param provider selected provider, must be unique
30
+ * @param config - oclif config used to execute hooks
31
+ * @param port - port where the tunnel will be started
32
+ * @param provider - selected provider, must be unique
33
33
  * @returns tunnel URL from the selected provider
34
34
  */
35
35
  export async function runTunnelPlugin(config, port, provider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QAAQ,EAAC,CAAC,CAAA;IACzE,MAAM,IAAI,GAAG,0BAA0B,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAA;IACpF,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,EAAC,KAAK,EAAE,eAAe,EAAC,CAAA;IACpD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAC,KAAK,EAAE,SAAS,EAAC,CAAA;IAChD,OAAO,EAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,EAAC,CAAA;AACvB,CAAC","sourcesContent":["import {JsonMap} from './json.js'\nimport {PickByPrefix} from './typing/pick-by-prefix.js'\nimport {MonorailEventPublic, MonorailEventSensitive} from './monorail.js'\nimport {HookReturnPerTunnelPlugin} from './plugins/tunnel.js'\nimport {getArrayContainsDuplicates, getArrayRejectingUndefined} from './public/common/array.js'\nimport {Config, Interfaces} from '@oclif/core'\n\n/**\n * Convenience function to trigger a hook, and gather any successful responses. Failures are ignored.\n *\n * Responses are organised into a dictionary, keyed by plug-in name. Only plug-ins that have hooks registered for the given event, and the hooks were run successfully, are included.\n */\nexport async function fanoutHooks<TPluginMap extends HookReturnsPerPlugin, TEvent extends string & keyof TPluginMap>(\n config: Interfaces.Config,\n event: TEvent,\n options: TPluginMap[typeof event]['options'],\n timeout?: number,\n): Promise<Partial<TPluginMap[typeof event]['pluginReturns']>> {\n const res = await config.runHook(event, options, timeout)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return Object.fromEntries(res.successes.map(({result, plugin}) => [plugin.name, result])) as any\n}\n\ntype AppSpecificMonorailFields = PickByPrefix<MonorailEventPublic, 'app_', 'project_type' | 'api_key' | 'partner_id'> &\n PickByPrefix<MonorailEventPublic, 'cmd_extensions_'> &\n PickByPrefix<MonorailEventPublic, 'cmd_scaffold_'>\n\ntype AppSpecificSensitiveMonorailFields = PickByPrefix<MonorailEventSensitive, 'app_'>\n\ninterface HookReturnsPerPlugin extends HookReturnPerTunnelPlugin {\n public_command_metadata: {\n options: {[key: string]: never}\n pluginReturns: {\n '@shopify/app': Partial<AppSpecificMonorailFields>\n [pluginName: string]: JsonMap\n }\n }\n sensitive_command_metadata: {\n options: {[key: string]: never}\n pluginReturns: {\n '@shopify/app': Partial<AppSpecificSensitiveMonorailFields>\n [pluginName: string]: JsonMap\n }\n }\n [hookName: string]: {\n options: {[key: string]: unknown}\n pluginReturns: {[key: string]: JsonMap}\n }\n}\n\nexport type PluginReturnsForHook<\n TEvent extends keyof TPluginMap,\n TPluginName extends keyof TPluginMap[TEvent]['pluginReturns'],\n TPluginMap extends HookReturnsPerPlugin = HookReturnsPerPlugin,\n> = TPluginMap[TEvent]['pluginReturns'][TPluginName]\n\nexport type FanoutHookFunction<\n TEvent extends keyof TPluginMap = string,\n TPluginName extends keyof TPluginMap[TEvent]['pluginReturns'] = string,\n TPluginMap extends HookReturnsPerPlugin = HookReturnsPerPlugin,\n> = (\n this: Interfaces.Hook.Context,\n options: TPluginMap[TEvent]['options'] & {config: Interfaces.Config},\n) => Promise<PluginReturnsForHook<TEvent, TPluginName, TPluginMap>>\n\n/**\n * Execute the 'tunnel_provider' hook, and return the list of available tunnel providers.\n * Fail if there are multiple plugins for the same provider\n *\n * @param config oclif config used to execute hooks\n * @returns list of available tunnel plugins\n */\nexport async function getListOfTunnelPlugins(config: Config): Promise<{plugins: string[]; error?: string}> {\n const hooks = await fanoutHooks(config, 'tunnel_provider', {})\n const names = getArrayRejectingUndefined(Object.values(hooks).map((key) => key?.name))\n if (getArrayContainsDuplicates(names)) return {plugins: names, error: 'multiple-plugins-for-provider'}\n return {plugins: names}\n}\n\n/**\n * Execute the 'tunnel_start' hook for the given provider.\n * Fails if there aren't plugins for that provider or if there are more than one.\n *\n * @param config oclif config used to execute hooks\n * @param port port where the tunnel will be started\n * @param provider selected provider, must be unique\n * @returns tunnel URL from the selected provider\n */\nexport async function runTunnelPlugin(\n config: Config,\n port: number,\n provider: string,\n): Promise<{url?: string; error?: string}> {\n const hooks = await fanoutHooks(config, 'tunnel_start', {port, provider})\n const urls = getArrayRejectingUndefined(Object.values(hooks).map((key) => key?.url))\n if (urls.length > 1) return {error: 'multiple-urls'}\n if (urls.length === 0) return {error: 'no-urls'}\n return {url: urls[0]}\n}\n"]}
1
+ {"version":3,"file":"plugins.js","sourceRoot":"","sources":["../src/plugins.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,0BAA0B,EAAE,0BAA0B,EAAC,MAAM,0BAA0B,CAAA;AAG/F;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,MAAyB,EACzB,KAAa,EACb,OAA4C,EAC5C,OAAgB;IAEhB,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;IACzD,8DAA8D;IAC9D,OAAO,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAAC,MAAM,EAAE,MAAM,EAAC,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAQ,CAAA;AAClG,CAAC;AA4CD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,MAAc;IACzD,MAAM,KAAK,GAAG,MAAM,WAAW,CAAC,MAAM,EAAE,iBAAiB,EAAE,EAAE,CAAC,CAAA;IAC9D,MAAM,KAAK,GAAG,0BAA0B,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAA;IACtF,IAAI,0BAA0B,CAAC,KAAK,CAAC;QAAE,OAAO,EAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,+BAA+B,EAAC,CAAA;IACtG,OAAO,EAAC,OAAO,EAAE,KAAK,EAAC,CAAA;AACzB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,MAAc,EACd,IAAY,EACZ,QAAgB;IAEhB,MAAM,KAAK,GAAG,MAAM,WAAW,CAAC,MAAM,EAAE,cAAc,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC,CAAC,CAAA;IACzE,MAAM,IAAI,GAAG,0BAA0B,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAA;IACpF,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,EAAC,KAAK,EAAE,eAAe,EAAC,CAAA;IACpD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAC,KAAK,EAAE,SAAS,EAAC,CAAA;IAChD,OAAO,EAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,EAAC,CAAA;AACvB,CAAC","sourcesContent":["import {JsonMap} from './json.js'\nimport {PickByPrefix} from './typing/pick-by-prefix.js'\nimport {MonorailEventPublic, MonorailEventSensitive} from './monorail.js'\nimport {HookReturnPerTunnelPlugin} from './plugins/tunnel.js'\nimport {getArrayContainsDuplicates, getArrayRejectingUndefined} from './public/common/array.js'\nimport {Config, Interfaces} from '@oclif/core'\n\n/**\n * Convenience function to trigger a hook, and gather any successful responses. Failures are ignored.\n *\n * Responses are organised into a dictionary, keyed by plug-in name. Only plug-ins that have hooks registered for the given event, and the hooks were run successfully, are included.\n */\nexport async function fanoutHooks<TPluginMap extends HookReturnsPerPlugin, TEvent extends string & keyof TPluginMap>(\n config: Interfaces.Config,\n event: TEvent,\n options: TPluginMap[typeof event]['options'],\n timeout?: number,\n): Promise<Partial<TPluginMap[typeof event]['pluginReturns']>> {\n const res = await config.runHook(event, options, timeout)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return Object.fromEntries(res.successes.map(({result, plugin}) => [plugin.name, result])) as any\n}\n\ntype AppSpecificMonorailFields = PickByPrefix<MonorailEventPublic, 'app_', 'project_type' | 'api_key' | 'partner_id'> &\n PickByPrefix<MonorailEventPublic, 'cmd_extensions_'> &\n PickByPrefix<MonorailEventPublic, 'cmd_scaffold_'>\n\ntype AppSpecificSensitiveMonorailFields = PickByPrefix<MonorailEventSensitive, 'app_'>\n\ninterface HookReturnsPerPlugin extends HookReturnPerTunnelPlugin {\n public_command_metadata: {\n options: {[key: string]: never}\n pluginReturns: {\n '@shopify/app': Partial<AppSpecificMonorailFields>\n [pluginName: string]: JsonMap\n }\n }\n sensitive_command_metadata: {\n options: {[key: string]: never}\n pluginReturns: {\n '@shopify/app': Partial<AppSpecificSensitiveMonorailFields>\n [pluginName: string]: JsonMap\n }\n }\n [hookName: string]: {\n options: {[key: string]: unknown}\n pluginReturns: {[key: string]: JsonMap}\n }\n}\n\nexport type PluginReturnsForHook<\n TEvent extends keyof TPluginMap,\n TPluginName extends keyof TPluginMap[TEvent]['pluginReturns'],\n TPluginMap extends HookReturnsPerPlugin = HookReturnsPerPlugin,\n> = TPluginMap[TEvent]['pluginReturns'][TPluginName]\n\nexport type FanoutHookFunction<\n TEvent extends keyof TPluginMap = string,\n TPluginName extends keyof TPluginMap[TEvent]['pluginReturns'] = string,\n TPluginMap extends HookReturnsPerPlugin = HookReturnsPerPlugin,\n> = (\n this: Interfaces.Hook.Context,\n options: TPluginMap[TEvent]['options'] & {config: Interfaces.Config},\n) => Promise<PluginReturnsForHook<TEvent, TPluginName, TPluginMap>>\n\n/**\n * Execute the 'tunnel_provider' hook, and return the list of available tunnel providers.\n * Fail if there are multiple plugins for the same provider\n *\n * @param config - oclif config used to execute hooks\n * @returns list of available tunnel plugins\n */\nexport async function getListOfTunnelPlugins(config: Config): Promise<{plugins: string[]; error?: string}> {\n const hooks = await fanoutHooks(config, 'tunnel_provider', {})\n const names = getArrayRejectingUndefined(Object.values(hooks).map((key) => key?.name))\n if (getArrayContainsDuplicates(names)) return {plugins: names, error: 'multiple-plugins-for-provider'}\n return {plugins: names}\n}\n\n/**\n * Execute the 'tunnel_start' hook for the given provider.\n * Fails if there aren't plugins for that provider or if there are more than one.\n *\n * @param config - oclif config used to execute hooks\n * @param port - port where the tunnel will be started\n * @param provider - selected provider, must be unique\n * @returns tunnel URL from the selected provider\n */\nexport async function runTunnelPlugin(\n config: Config,\n port: number,\n provider: string,\n): Promise<{url?: string; error?: string}> {\n const hooks = await fanoutHooks(config, 'tunnel_start', {port, provider})\n const urls = getArrayRejectingUndefined(Object.values(hooks).map((key) => key?.url))\n if (urls.length > 1) return {error: 'multiple-urls'}\n if (urls.length === 0) return {error: 'no-urls'}\n return {url: urls[0]}\n}\n"]}
package/dist/port.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * Returns an available port in the current environment.
3
- * @returns {Promise<number>} A promise that resolves with an availabe port.
3
+ * @returns A promise that resolves with an availabe port.
4
4
  */
5
5
  export declare function getRandomPort(): Promise<number>;
package/dist/port.js CHANGED
@@ -4,7 +4,7 @@ import { sleep } from './system.js';
4
4
  import * as port from 'get-port-please';
5
5
  /**
6
6
  * Returns an available port in the current environment.
7
- * @returns {Promise<number>} A promise that resolves with an availabe port.
7
+ * @returns A promise that resolves with an availabe port.
8
8
  */
9
9
  export async function getRandomPort() {
10
10
  debug(content `Getting a random port...`);
package/dist/port.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"port.js","sourceRoot":"","sources":["../src/port.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AACjD,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAA;AAChC,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAA;AACjC,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAA;AAEvC;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,KAAK,CAAC,OAAO,CAAA,0BAA0B,CAAC,CAAA;IACxC,MAAM,UAAU,GAAG,MAAM,YAAY,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAA;IACjE,KAAK,CAAC,OAAO,CAAA,yBAAyB,KAAK,CAAC,GAAG,CAAC,GAAG,UAAU,EAAE,CAAC,EAAE,CAAC,CAAA;IACnE,OAAO,UAAU,CAAA;AACnB,CAAC;AAED,KAAK,UAAU,YAAY,CAAI,OAAgB,EAAE,QAAQ,GAAG,CAAC,EAAE,iBAAiB,GAAG,CAAC;IAClF,IAAI,UAAU,GAAG,CAAC,CAAA;IAClB,OAAO,IAAI,EAAE;QACX,IAAI;YACF,4CAA4C;YAC5C,OAAO,MAAM,OAAO,EAAE,CAAA;YACtB,8DAA8D;SAC/D;QAAC,OAAO,KAAU,EAAE;YACnB,IAAI,UAAU,EAAE,GAAG,QAAQ,EAAE;gBAC3B,KAAK,CAAC,OAAO,CAAA,0CAA0C,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;gBACvE,4CAA4C;gBAC5C,MAAM,KAAK,CAAC,iBAAiB,CAAC,CAAA;aAC/B;iBAAM;gBACL,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;aAC/B;SACF;KACF;AACH,CAAC","sourcesContent":["import {debug, content, token} from './output.js'\nimport {Abort} from './error.js'\nimport {sleep} from './system.js'\nimport * as port from 'get-port-please'\n\n/**\n * Returns an available port in the current environment.\n * @returns {Promise<number>} A promise that resolves with an availabe port.\n */\nexport async function getRandomPort(): Promise<number> {\n debug(content`Getting a random port...`)\n const randomPort = await retryOnError(() => port.getRandomPort())\n debug(content`Random port obtained: ${token.raw(`${randomPort}`)}`)\n return randomPort\n}\n\nasync function retryOnError<T>(execute: () => T, maxTries = 5, waitTimeInSeconds = 1) {\n let retryCount = 1\n while (true) {\n try {\n // eslint-disable-next-line no-await-in-loop\n return await execute()\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n if (retryCount++ < maxTries) {\n debug(content`Unknown problem getting a random port: ${error.message}`)\n // eslint-disable-next-line no-await-in-loop\n await sleep(waitTimeInSeconds)\n } else {\n throw new Abort(error.message)\n }\n }\n }\n}\n"]}
1
+ {"version":3,"file":"port.js","sourceRoot":"","sources":["../src/port.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AACjD,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAA;AAChC,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAA;AACjC,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAA;AAEvC;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,KAAK,CAAC,OAAO,CAAA,0BAA0B,CAAC,CAAA;IACxC,MAAM,UAAU,GAAG,MAAM,YAAY,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAA;IACjE,KAAK,CAAC,OAAO,CAAA,yBAAyB,KAAK,CAAC,GAAG,CAAC,GAAG,UAAU,EAAE,CAAC,EAAE,CAAC,CAAA;IACnE,OAAO,UAAU,CAAA;AACnB,CAAC;AAED,KAAK,UAAU,YAAY,CAAI,OAAgB,EAAE,QAAQ,GAAG,CAAC,EAAE,iBAAiB,GAAG,CAAC;IAClF,IAAI,UAAU,GAAG,CAAC,CAAA;IAClB,OAAO,IAAI,EAAE;QACX,IAAI;YACF,4CAA4C;YAC5C,OAAO,MAAM,OAAO,EAAE,CAAA;YACtB,8DAA8D;SAC/D;QAAC,OAAO,KAAU,EAAE;YACnB,IAAI,UAAU,EAAE,GAAG,QAAQ,EAAE;gBAC3B,KAAK,CAAC,OAAO,CAAA,0CAA0C,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;gBACvE,4CAA4C;gBAC5C,MAAM,KAAK,CAAC,iBAAiB,CAAC,CAAA;aAC/B;iBAAM;gBACL,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;aAC/B;SACF;KACF;AACH,CAAC","sourcesContent":["import {debug, content, token} from './output.js'\nimport {Abort} from './error.js'\nimport {sleep} from './system.js'\nimport * as port from 'get-port-please'\n\n/**\n * Returns an available port in the current environment.\n * @returns A promise that resolves with an availabe port.\n */\nexport async function getRandomPort(): Promise<number> {\n debug(content`Getting a random port...`)\n const randomPort = await retryOnError(() => port.getRandomPort())\n debug(content`Random port obtained: ${token.raw(`${randomPort}`)}`)\n return randomPort\n}\n\nasync function retryOnError<T>(execute: () => T, maxTries = 5, waitTimeInSeconds = 1) {\n let retryCount = 1\n while (true) {\n try {\n // eslint-disable-next-line no-await-in-loop\n return await execute()\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n if (retryCount++ < maxTries) {\n debug(content`Unknown problem getting a random port: ${error.message}`)\n // eslint-disable-next-line no-await-in-loop\n await sleep(waitTimeInSeconds)\n } else {\n throw new Abort(error.message)\n }\n }\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import { AlertProps } from './components/Alert.js';
2
+ export declare function alert({ type, headline, body, nextSteps, reference, link, orderedNextSteps }: AlertProps): void;
@@ -0,0 +1,18 @@
1
+ import { Alert } from './components/Alert.js';
2
+ import { renderOnce } from '../ui.js';
3
+ import { consoleLog, consoleWarn } from '../../../output.js';
4
+ import React from 'react';
5
+ const typeToLogLevel = {
6
+ info: 'info',
7
+ warning: 'warn',
8
+ success: 'info',
9
+ };
10
+ const typeToLogger = {
11
+ info: consoleLog,
12
+ warning: consoleWarn,
13
+ success: consoleLog,
14
+ };
15
+ export function alert({ type, headline, body, nextSteps, reference, link, orderedNextSteps = false }) {
16
+ renderOnce(React.createElement(Alert, { type: type, headline: headline, body: body, nextSteps: nextSteps, reference: reference, link: link, orderedNextSteps: orderedNextSteps }), typeToLogLevel[type], typeToLogger[type]);
17
+ }
18
+ //# sourceMappingURL=alert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert.js","sourceRoot":"","sources":["../../../../src/private/node/ui/alert.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAa,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAA;AACnC,OAAO,EAAC,UAAU,EAAE,WAAW,EAAmB,MAAM,oBAAoB,CAAA;AAC5E,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,MAAM,cAAc,GAA4C;IAC9D,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,MAAM;CAChB,CAAA;AAED,MAAM,YAAY,GAA0C;IAC1D,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,WAAW;IACpB,OAAO,EAAE,UAAU;CACpB,CAAA;AAED,MAAM,UAAU,KAAK,CAAC,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,gBAAgB,GAAG,KAAK,EAAa;IAC5G,UAAU,CACR,oBAAC,KAAK,IACJ,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,IAAI,EACV,gBAAgB,EAAE,gBAAgB,GAClC,EACF,cAAc,CAAC,IAAI,CAAC,EACpB,YAAY,CAAC,IAAI,CAAC,CACnB,CAAA;AACH,CAAC","sourcesContent":["import {Alert, AlertProps} from './components/Alert.js'\nimport {renderOnce} from '../ui.js'\nimport {consoleLog, consoleWarn, Logger, LogLevel} from '../../../output.js'\nimport React from 'react'\n\nconst typeToLogLevel: {[key in AlertProps['type']]: LogLevel} = {\n info: 'info',\n warning: 'warn',\n success: 'info',\n}\n\nconst typeToLogger: {[key in AlertProps['type']]: Logger} = {\n info: consoleLog,\n warning: consoleWarn,\n success: consoleLog,\n}\n\nexport function alert({type, headline, body, nextSteps, reference, link, orderedNextSteps = false}: AlertProps) {\n renderOnce(\n <Alert\n type={type}\n headline={headline}\n body={body}\n nextSteps={nextSteps}\n reference={reference}\n link={link}\n orderedNextSteps={orderedNextSteps}\n />,\n typeToLogLevel[type],\n typeToLogger[type],\n )\n}\n"]}
@@ -0,0 +1,17 @@
1
+ import { BannerType } from './Banner.js';
2
+ import { TextTokenItem } from './TokenizedText.js';
3
+ import React from 'react';
4
+ export interface AlertProps {
5
+ type: Exclude<BannerType, 'error'>;
6
+ headline: string;
7
+ body?: TextTokenItem;
8
+ nextSteps?: TextTokenItem[];
9
+ reference?: TextTokenItem[];
10
+ link?: {
11
+ label: string;
12
+ url: string;
13
+ };
14
+ orderedNextSteps?: boolean;
15
+ }
16
+ declare const Alert: React.FC<AlertProps>;
17
+ export { Alert };