@shopify/create-app 4.8.4 → 4.9.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 (68) hide show
  1. package/dist/analytics-D5P7IMRA.js +48 -0
  2. package/dist/analytics-TXXYVQN7.js +40 -0
  3. package/dist/{chunk-ODCXYGJ2.js → chunk-23UTCSPZ.js} +14 -4
  4. package/dist/{chunk-QMQX3MT5.js → chunk-2UPX6QLJ.js} +6 -6
  5. package/dist/{chunk-FSEXIENC.js → chunk-3IJICKWH.js} +2 -2
  6. package/dist/chunk-5OAATCQX.js +218 -0
  7. package/dist/{chunk-BEUNBVME.js → chunk-A33KVF5C.js} +1 -1
  8. package/dist/{chunk-RJ3A4X2R.js → chunk-AJLJXEKT.js} +3093 -23
  9. package/dist/chunk-BBGOL4JF.js +86 -0
  10. package/dist/chunk-CK3T27VW.js +119 -0
  11. package/dist/{chunk-E43EDJOG.js → chunk-EJEHENXO.js} +3 -2
  12. package/dist/chunk-FKZ3NFHZ.js +7 -0
  13. package/dist/{chunk-2VQBQQJH.js → chunk-KZZE6H5Q.js} +51 -26
  14. package/dist/chunk-MHLFPQ3W.js +50 -0
  15. package/dist/{chunk-XZQD6FEL.js → chunk-MOB6XVGL.js} +2 -2
  16. package/dist/{chunk-YSB2L5XO.js → chunk-NB6X7ZFE.js} +3 -3
  17. package/dist/{chunk-ZOH5TKZV.js → chunk-NHN6SUTT.js} +202 -55
  18. package/dist/chunk-NLC4T4YS.js +1092 -0
  19. package/dist/{chunk-CJUIIULM.js → chunk-NW3CCDI2.js} +318 -3211
  20. package/dist/{chunk-U7XCB7LM.js → chunk-OG3KDO3M.js} +16 -16
  21. package/dist/{chunk-THSPSZ2U.js → chunk-PSP4NDSB.js} +16 -14
  22. package/dist/{chunk-HGTLZ6ZW.js → chunk-QNTXEHZO.js} +5 -5
  23. package/dist/{chunk-XPTHNPI4.js → chunk-RYTPHY47.js} +10 -10
  24. package/dist/{chunk-NFOBMXOQ.js → chunk-SFVOZJMO.js} +32 -10
  25. package/dist/chunk-SHCNJ47P.js +89 -0
  26. package/dist/{chunk-4ATBZZ7Q.js → chunk-SYVHC634.js} +2 -2
  27. package/dist/{chunk-C3J4HVUN.js → chunk-VDUAROBQ.js} +3 -2
  28. package/dist/command-json-schema-S3W3UW3A.js +65 -0
  29. package/dist/{conf-store-ZMAEEJET.js → conf-store-GW5MF5EC.js} +11 -11
  30. package/dist/custom-oclif-loader-MYKFWED2.js +85 -0
  31. package/dist/{deprecations-2ZE7F57V.js → deprecations-TJKLSMEC.js} +18 -15
  32. package/dist/environment-OJNKZ7ML.js +25 -0
  33. package/dist/environments-FLXCXEQY.js +32 -0
  34. package/dist/error-handler-KSSGLWAL.js +44 -0
  35. package/dist/{fs-ZEAP6SYM.js → fs-54TFRUFV.js} +10 -5
  36. package/dist/hooks/postrun.js +11 -6
  37. package/dist/hooks/prerun.js +6 -6
  38. package/dist/{http-proxy-node16-5LMQ6YXS.js → http-proxy-node16-FD2WN6JB.js} +2 -3
  39. package/dist/index.js +6750 -3654
  40. package/dist/{is-global-FYEORJBG.js → is-global-ABT2AQMZ.js} +10 -5
  41. package/dist/json-error-N7MI3KIX.js +104 -0
  42. package/dist/{lib-XCYUJYSO.js → lib-NYDMHWZM.js} +3 -4
  43. package/dist/{local-A2UFPWGA.js → local-BAVJFTPY.js} +11 -3
  44. package/dist/{metadata-WWELAOUA.js → metadata-JDWMZLO3.js} +10 -4
  45. package/dist/{node-package-manager-WU3OX73T.js → node-package-manager-LZQDH5RV.js} +20 -17
  46. package/dist/notifications-system-C4VANR5T.js +47 -0
  47. package/dist/os-UYRG46VD.js +24 -0
  48. package/dist/{output-BOE7D3BZ.js → output-WTBNQLZY.js} +12 -5
  49. package/dist/{path-2WA5R6GG.js → path-2KZ7FSGN.js} +2 -2
  50. package/dist/{prettier-SS3RRDXK.js → prettier-BNZDRHR4.js} +2 -2
  51. package/dist/{system-F5JGMAQ2.js → system-VYWFQ656.js} +18 -15
  52. package/dist/tsconfig.tsbuildinfo +1 -1
  53. package/dist/{ui-WM75TA2X.js → ui-EW2MACA7.js} +18 -15
  54. package/dist/{upgrade-437BKOQU.js → upgrade-TCM7RY33.js} +47 -29
  55. package/dist/{version-EHF3PAN2.js → version-6BXGHP54.js} +2 -2
  56. package/dist/version-ANERG2ID.js +36 -0
  57. package/oclif.manifest.json +15 -1
  58. package/package.json +3 -3
  59. package/dist/analytics-IYBTJU64.js +0 -44
  60. package/dist/analytics-N7RZNZ7E.js +0 -36
  61. package/dist/chunk-7OHJH7BF.js +0 -21
  62. package/dist/chunk-UPP43IHQ.js +0 -301
  63. package/dist/custom-oclif-loader-HTLL62HO.js +0 -54
  64. package/dist/environments-4UKGWAAJ.js +0 -29
  65. package/dist/error-handler-OPWDDXJP.js +0 -40
  66. package/dist/notifications-system-SQQO6LJW.js +0 -43
  67. package/dist/os-WN6IUS7J.js +0 -19
  68. package/dist/version-Q3TUYBAR.js +0 -33
@@ -2,31 +2,35 @@ import {
2
2
  execa,
3
3
  platformAndArch,
4
4
  require_signal_exit
5
- } from "./chunk-HGTLZ6ZW.js";
5
+ } from "./chunk-QNTXEHZO.js";
6
6
  import {
7
7
  runWithTimer
8
- } from "./chunk-YSB2L5XO.js";
8
+ } from "./chunk-NB6X7ZFE.js";
9
+ import {
10
+ randomUUID
11
+ } from "./chunk-SHCNJ47P.js";
9
12
  import {
10
13
  AbortError,
11
14
  AbortSilentError,
12
15
  BugError,
13
16
  ExternalError,
14
17
  cleanSingleStackTracePath
15
- } from "./chunk-NFOBMXOQ.js";
16
- import {
17
- require_ansi_styles
18
- } from "./chunk-E43EDJOG.js";
18
+ } from "./chunk-SFVOZJMO.js";
19
19
  import {
20
20
  treeKill
21
- } from "./chunk-4ATBZZ7Q.js";
21
+ } from "./chunk-SYVHC634.js";
22
22
  import {
23
23
  ansi_escapes_default,
24
24
  appendToTokenItem,
25
25
  capitalize,
26
+ commandEventOutputMode,
27
+ emitCommandEvent,
26
28
  output,
27
29
  outputContent,
28
30
  outputDebug,
31
+ outputInfo,
29
32
  outputToken,
33
+ outputWarn,
30
34
  require_arrayMap,
31
35
  require_baseFlatten,
32
36
  require_baseGet,
@@ -48,24 +52,29 @@ import {
48
52
  shouldDisplayColors,
49
53
  source_default,
50
54
  stripAnsi,
55
+ tokenItemToJsonString,
51
56
  tokenItemToString,
52
57
  unstyled
53
- } from "./chunk-RJ3A4X2R.js";
58
+ } from "./chunk-AJLJXEKT.js";
54
59
  import {
55
60
  isCloudEnvironment,
61
+ isInputDisabled,
56
62
  isUnitTest
57
- } from "./chunk-UPP43IHQ.js";
63
+ } from "./chunk-5OAATCQX.js";
58
64
  import {
59
65
  isTruthy
60
66
  } from "./chunk-HNIAZN6U.js";
61
67
  import {
62
- cwd,
63
- delimiter,
64
- dirname
65
- } from "./chunk-C3J4HVUN.js";
68
+ require_ansi_styles
69
+ } from "./chunk-EJEHENXO.js";
66
70
  import {
67
71
  require_source_map
68
72
  } from "./chunk-D6NYWNY2.js";
73
+ import {
74
+ cwd,
75
+ delimiter,
76
+ dirname
77
+ } from "./chunk-VDUAROBQ.js";
69
78
  import {
70
79
  __commonJS,
71
80
  __export,
@@ -22770,6 +22779,8 @@ import { release } from "os";
22770
22779
  import { setTimeout as setTimeout2 } from "timers/promises";
22771
22780
  var MAX_STDIN_SIZE = 10 * 1024 * 1024;
22772
22781
  async function openURL(url) {
22782
+ if (isInputDisabled())
22783
+ throw new AbortError("Opening a browser is unavailable when user input is disabled.", "Remove `--no-input` and run the command in an interactive terminal.");
22773
22784
  if (isCloudEnvironment())
22774
22785
  return !1;
22775
22786
  let externalOpen = await import("./open-JSCXNUDN.js");
@@ -22873,7 +22884,7 @@ function terminalSupportsHyperlinks() {
22873
22884
  return import_supports_hyperlinks.default.stdout;
22874
22885
  }
22875
22886
  function terminalSupportsPrompting() {
22876
- return isTruthy(process.env.CI) ? !1 : !!(process.stdin.isTTY && process.stdout.isTTY);
22887
+ return isInputDisabled() || isTruthy(process.env.CI) ? !1 : !!(process.stdin.isTTY && process.stderr.isTTY);
22877
22888
  }
22878
22889
  function isCI() {
22879
22890
  return isTruthy(process.env.CI);
@@ -28574,6 +28585,7 @@ var { platform: platform2 } = process14, common = {
28574
28585
  // ../cli-kit/dist/private/node/ui/components/ConcurrentOutput.js
28575
28586
  import { Writable } from "stream";
28576
28587
  import { AsyncLocalStorage } from "node:async_hooks";
28588
+ import { StringDecoder } from "node:string_decoder";
28577
28589
  function addLeadingZero(number) {
28578
28590
  return number < 10 ? `0${number}` : number.toString();
28579
28591
  }
@@ -28585,6 +28597,41 @@ var outputContextStore = new AsyncLocalStorage();
28585
28597
  function useConcurrentOutputContext(context, callback) {
28586
28598
  return outputContextStore.run(context, callback);
28587
28599
  }
28600
+ async function runConcurrentProcessesForJson({ processes, abortSignal }) {
28601
+ await Promise.all(processes.map(async (process15) => {
28602
+ let createStream = () => {
28603
+ let decoder = new StringDecoder("utf8"), pending = "", hasPendingLine = !1, prefix = process15.prefix, emitLine = (line) => {
28604
+ let message = stripAnsi(line);
28605
+ message.trim().length > 0 && outputInfo(`${prefix}: ${message}`);
28606
+ };
28607
+ return {
28608
+ stream: new Writable({
28609
+ write(chunk, _encoding, next) {
28610
+ if (chunk.length === 0) {
28611
+ next();
28612
+ return;
28613
+ }
28614
+ let currentPrefix = outputContextStore.getStore()?.outputPrefix ?? process15.prefix;
28615
+ hasPendingLine || (prefix = currentPrefix);
28616
+ let lines = (pending + decoder.write(chunk)).split(/\r?\n/);
28617
+ pending = lines.pop() ?? "";
28618
+ for (let line of lines)
28619
+ emitLine(line), prefix = currentPrefix;
28620
+ hasPendingLine = chunk[chunk.length - 1] !== 10, next();
28621
+ }
28622
+ }),
28623
+ flush: () => {
28624
+ emitLine((pending + decoder.end()).replace(/\r$/, "")), pending = "", hasPendingLine = !1;
28625
+ }
28626
+ };
28627
+ }, stdout = createStream(), stderr = createStream();
28628
+ try {
28629
+ await process15.action(stdout.stream, stderr.stream, abortSignal);
28630
+ } finally {
28631
+ stdout.flush(), stderr.flush();
28632
+ }
28633
+ }));
28634
+ }
28588
28635
  var ConcurrentOutput = ({ processes, prefixColumnSize, abortSignal, showTimestamps = !0, keepRunningAfterProcessesResolve = !1, useAlternativeColorPalette = !1 }) => {
28589
28636
  let [processOutput, setProcessOutput] = (0, import_react30.useState)([]), [completionResult, setCompletionResult] = (0, import_react30.useState)(null), complete = useComplete(), concurrentColors = (0, import_react30.useMemo)(() => useAlternativeColorPalette ? ["#b994c3", "#e69e19", "#d17a73", "cyan", "magenta", "blue"] : ["yellow", "cyan", "magenta", "green", "blue"], [useAlternativeColorPalette]), calculatedPrefixColumnSize = (0, import_react30.useMemo)(() => {
28590
28637
  let columnSize = prefixColumnSize ?? processes.reduce((maxPrefixLength, process15) => Math.max(maxPrefixLength, process15.prefix.length), 0);
@@ -28964,10 +29011,35 @@ var import_react43 = __toESM(require_react(), 1), typeToLogLevel = {
28964
29011
  success: "info",
28965
29012
  error: "error"
28966
29013
  };
28967
- function alert({ type, headline, body, nextSteps, reference, link: link3, customSections, orderedNextSteps = !1, renderOptions }) {
28968
- let { type: alertType, ..._eventProps } = arguments[0];
29014
+ function alert(options) {
29015
+ let { type, headline, body, nextSteps, reference, link: link3, customSections, orderedNextSteps = !1, renderOptions } = options;
29016
+ if ((type === "info" || type === "warning") && commandEventOutputMode() === "json") {
29017
+ let message = alertMessage(options);
29018
+ return type === "warning" ? outputWarn(message) : outputInfo(message), message;
29019
+ }
28969
29020
  return renderOnce(import_react43.default.createElement(Alert, { type, headline, body, nextSteps, reference, link: link3, orderedNextSteps, customSections }), { logLevel: typeToLogLevel[type], renderOptions });
28970
29021
  }
29022
+ function alertMessage({ headline, body, nextSteps, reference, link: link3, customSections }) {
29023
+ return [
29024
+ headline ? tokenItemToJsonString(headline) : void 0,
29025
+ body ? tokenItemToJsonString(body) : void 0,
29026
+ nextSteps?.length ? `Next steps:
29027
+ ${nextSteps.map(tokenItemToJsonString).join(`
29028
+ `)}` : void 0,
29029
+ reference?.length ? `Reference:
29030
+ ${reference.map(tokenItemToJsonString).join(`
29031
+ `)}` : void 0,
29032
+ link3 ? tokenItemToJsonString({ link: link3 }) : void 0,
29033
+ ...(customSections ?? []).map((section) => {
29034
+ let content = typeof section.body == "object" && "tabularData" in section.body ? section.body.tabularData.map((row) => row.map(tokenItemToJsonString).join(" ")).join(`
29035
+ `) : tokenItemToJsonString(section.body);
29036
+ return section.title ? `${section.title}:
29037
+ ${content}` : content;
29038
+ })
29039
+ ].filter((section) => section !== void 0).join(`
29040
+
29041
+ `);
29042
+ }
28971
29043
 
28972
29044
  // ../cli-kit/dist/private/node/ui/components/FatalError.js
28973
29045
  init_cjs_shims();
@@ -29186,7 +29258,7 @@ var import_react51 = __toESM(require_react(), 1);
29186
29258
  var DangerousConfirmationPrompt = ({ message, confirmation, infoTable, warningItem, onSubmit, abortSignal }) => {
29187
29259
  let validateAnswer = (0, import_react51.useCallback)((value) => value === confirmation ? void 0 : ["Value must be exactly", { userInput: confirmation }], [confirmation]), { oneThird, twoThirds } = useLayout(), { promptState, setPromptState, answer, setAnswer } = usePrompt({
29188
29260
  initialAnswer: ""
29189
- }), complete = useComplete(), [error, setError] = (0, import_react51.useState)(void 0), color = promptState === PromptState.Error ? "red" : "cyan", underline = new Array(oneThird - 3).fill("\u2594"), { isAborted } = useAbortSignal(abortSignal);
29261
+ }), complete = useComplete(), [error, setError] = (0, import_react51.useState)(void 0), color = promptState === PromptState.Error ? "red" : "cyan", { isAborted } = useAbortSignal(abortSignal);
29190
29262
  use_input_default((input, key) => {
29191
29263
  if (handleCtrlC(input, key), key.escape && (setPromptState(PromptState.Cancelled), setError(void 0)), key.return) {
29192
29264
  let error2 = validateAnswer(answer);
@@ -29256,10 +29328,10 @@ var DangerousConfirmationPrompt = ({ message, confirmation, infoTable, warningIt
29256
29328
  }, defaultValue: "", color })
29257
29329
  )
29258
29330
  ),
29259
- import_react51.default.createElement(
29331
+ platformAndArch().platform === "windows" ? import_react51.default.createElement(Box_default, { marginLeft: 3, borderStyle: "single", borderColor: color, borderBottom: !1, borderLeft: !1, borderRight: !1 }) : import_react51.default.createElement(
29260
29332
  Box_default,
29261
29333
  { marginLeft: 3 },
29262
- import_react51.default.createElement(Text, { color }, underline)
29334
+ import_react51.default.createElement(Text, { color }, "\u2594".repeat(oneThird - 3))
29263
29335
  ),
29264
29336
  promptState === PromptState.Error && error ? import_react51.default.createElement(
29265
29337
  Box_default,
@@ -29607,8 +29679,8 @@ var import_react55 = __toESM(require_react(), 1), InfoMessage = ({ message: { ti
29607
29679
 
29608
29680
  // ../cli-kit/dist/private/node/ui/components/Prompts/PromptLayout.js
29609
29681
  var import_react56 = __toESM(require_react(), 1);
29610
- var PromptLayout = ({ message, infoTable, abortSignal, infoMessage, header, state, input, submittedAnswerLabel }) => {
29611
- let { stdout } = use_stdout_default(), [wrapperHeight, setWrapperHeight] = (0, import_react56.useState)(0), [promptAreaHeight, setPromptAreaHeight] = (0, import_react56.useState)(0), [inputFixedAreaHeight, setInputFixedAreaHeight] = (0, import_react56.useState)(0), currentAvailableLines = stdout.rows - promptAreaHeight - inputFixedAreaHeight, [availableLines, setAvailableLines] = (0, import_react56.useState)(currentAvailableLines), wrapperRef = (0, import_react56.useCallback)((node) => {
29682
+ var DEFAULT_TERMINAL_ROWS = 24, PromptLayout = ({ message, infoTable, abortSignal, infoMessage, header, state, input, submittedAnswerLabel }) => {
29683
+ let { stdout } = use_stdout_default(), [wrapperHeight, setWrapperHeight] = (0, import_react56.useState)(0), [promptAreaHeight, setPromptAreaHeight] = (0, import_react56.useState)(0), [inputFixedAreaHeight, setInputFixedAreaHeight] = (0, import_react56.useState)(0), currentAvailableLines = (stdout.rows ?? DEFAULT_TERMINAL_ROWS) - promptAreaHeight - inputFixedAreaHeight, [availableLines, setAvailableLines] = (0, import_react56.useState)(currentAvailableLines), wrapperRef = (0, import_react56.useCallback)((node) => {
29612
29684
  if (node !== null) {
29613
29685
  let { height } = measure_element_default(node);
29614
29686
  wrapperHeight !== height && setWrapperHeight(height);
@@ -29626,7 +29698,7 @@ var PromptLayout = ({ message, infoTable, abortSignal, infoMessage, header, stat
29626
29698
  }, []), inputComponent = (0, import_react56.cloneElement)(input, { availableLines, inputFixedAreaRef });
29627
29699
  (0, import_react56.useLayoutEffect)(() => {
29628
29700
  function onResize() {
29629
- let newAvailableLines = stdout.rows - promptAreaHeight - inputFixedAreaHeight;
29701
+ let newAvailableLines = (stdout.rows ?? DEFAULT_TERMINAL_ROWS) - promptAreaHeight - inputFixedAreaHeight;
29630
29702
  newAvailableLines !== availableLines && setAvailableLines(newAvailableLines);
29631
29703
  }
29632
29704
  return onResize(), stdout.on("resize", onResize), () => {
@@ -29753,8 +29825,8 @@ function useAsyncAndUnmount(asyncFunction, { onFulfilled = () => {
29753
29825
  } } = {}) {
29754
29826
  let complete = useComplete(), [result, setResult] = (0, import_react60.useState)(null);
29755
29827
  (0, import_react60.useEffect)(() => {
29756
- asyncFunction().then(() => {
29757
- onFulfilled(), setResult({});
29828
+ asyncFunction().then((result2) => {
29829
+ onFulfilled(result2), setResult({});
29758
29830
  }).catch((error) => {
29759
29831
  onRejected(error), setResult({ error });
29760
29832
  });
@@ -29773,38 +29845,60 @@ function useExitOnCtrlC() {
29773
29845
  }, { isActive: !!isRawModeSupported });
29774
29846
  }
29775
29847
 
29776
- // ../cli-kit/dist/private/node/ui/components/Tasks.js
29777
- var import_react61 = __toESM(require_react(), 1), TasksState;
29778
- (function(TasksState2) {
29779
- TasksState2.Loading = "loading", TasksState2.Success = "success", TasksState2.Failure = "failure";
29780
- })(TasksState || (TasksState = {}));
29781
- async function runTask(task, ctx) {
29848
+ // ../cli-kit/dist/private/node/ui/tasks.js
29849
+ init_cjs_shims();
29850
+ async function runTasks(tasks, onTask = () => {
29851
+ }) {
29852
+ let context = {}, operation = randomUUID(), currentTask, execute = async (task) => {
29853
+ try {
29854
+ return onTask(task), await runTask(task, context, (status) => {
29855
+ emitCommandEvent({
29856
+ type: "progress",
29857
+ operation,
29858
+ status: status === "started" && currentTask ? "updated" : status,
29859
+ message: taskMessage(task)
29860
+ }, { alreadyRendered: !0 }), currentTask = task;
29861
+ });
29862
+ } catch (error) {
29863
+ throw emitCommandEvent({ type: "progress", operation, status: "failed", message: taskMessage(task) }, { alreadyRendered: !0 }), error;
29864
+ }
29865
+ };
29866
+ for (let task of tasks) {
29867
+ let subTasks = await execute(task);
29868
+ if (Array.isArray(subTasks) && subTasks.length > 0 && subTasks.every((task2) => "task" in task2))
29869
+ for (let subTask of subTasks)
29870
+ await execute(subTask);
29871
+ }
29872
+ return currentTask && emitCommandEvent({ type: "progress", operation, status: "completed", message: taskMessage(currentTask), current: 1, total: 1 }, { alreadyRendered: !0 }), context;
29873
+ }
29874
+ async function runTask(task, context, onProgress) {
29782
29875
  task.retryCount = 0, task.errors = [];
29783
- let retry = task.retry && task.retry > 0 ? task.retry + 1 : 1;
29784
- for (let retries = 1; retries <= retry; retries++)
29876
+ let maxAttempts = task.retry && task.retry > 0 ? task.retry + 1 : 1, started = !1;
29877
+ for (let attempt = 1; attempt <= maxAttempts; attempt++)
29785
29878
  try {
29786
- return task.skip?.(ctx) ? void 0 : await task.task(ctx, task);
29879
+ return task.skip?.(context) ? void 0 : (onProgress(started ? "retrying" : "started"), started = !0, await task.task(context, task));
29787
29880
  } catch (error) {
29788
- if (retries === retry)
29881
+ if (attempt === maxAttempts)
29789
29882
  throw error;
29790
- task.errors.push(error), task.retryCount = retries;
29883
+ task.errors.push(error), task.retryCount = attempt;
29791
29884
  }
29792
29885
  }
29886
+ function taskMessage(task) {
29887
+ return unstyled(typeof task.title == "string" ? task.title : task.title.value);
29888
+ }
29889
+
29890
+ // ../cli-kit/dist/private/node/ui/components/Tasks.js
29891
+ var import_react61 = __toESM(require_react(), 1), TasksState;
29892
+ (function(TasksState2) {
29893
+ TasksState2.Loading = "loading", TasksState2.Success = "success", TasksState2.Failure = "failure";
29894
+ })(TasksState || (TasksState = {}));
29793
29895
  var noop3 = () => {
29794
29896
  };
29795
29897
  function Tasks({ tasks, silent = isUnitTest(), onComplete = noop3, abortSignal, noColor, noProgressBar = !1 }) {
29796
- let [currentTask, setCurrentTask] = (0, import_react61.useState)(tasks[0]), [state, setState] = (0, import_react61.useState)(TasksState.Loading), ctx = (0, import_react61.useRef)({});
29797
- useAsyncAndUnmount(async () => {
29798
- for (let task of tasks) {
29799
- setCurrentTask(task);
29800
- let subTasks = await runTask(task, ctx.current);
29801
- if (Array.isArray(subTasks) && subTasks.length > 0 && subTasks.every((task2) => "task" in task2))
29802
- for (let subTask of subTasks)
29803
- setCurrentTask(subTask), await runTask(subTask, ctx.current);
29804
- }
29805
- }, {
29806
- onFulfilled: () => {
29807
- setState(TasksState.Success), onComplete(ctx.current);
29898
+ let [currentTask, setCurrentTask] = (0, import_react61.useState)(tasks[0]), [state, setState] = (0, import_react61.useState)(TasksState.Loading);
29899
+ useAsyncAndUnmount(() => runTasks(tasks, setCurrentTask), {
29900
+ onFulfilled: (context) => {
29901
+ setState(TasksState.Success), onComplete(context);
29808
29902
  },
29809
29903
  onRejected: () => {
29810
29904
  setState(TasksState.Failure);
@@ -29830,7 +29924,7 @@ var TextPrompt = ({ message, onSubmit, validate: validate2, defaultValue = "", p
29830
29924
  return "Type an answer to the prompt.";
29831
29925
  }, [allowEmpty, validate2]), { oneThird } = useLayout(), { promptState, setPromptState, answer, setAnswer } = usePrompt({
29832
29926
  initialAnswer
29833
- }), answerOrDefault = answer.length > 0 ? answer : defaultValue, displayEmptyValue = answerOrDefault === "", displayedAnswer = displayEmptyValue ? emptyDisplayedValue : answerOrDefault, complete = useComplete(), [error, setError] = (0, import_react62.useState)(void 0), color = promptState === PromptState.Error ? "red" : "cyan", underline = new Array(oneThird - 3).fill("\u2594"), { isAborted } = useAbortSignal(abortSignal);
29927
+ }), answerOrDefault = answer.length > 0 ? answer : defaultValue, displayEmptyValue = answerOrDefault === "", displayedAnswer = displayEmptyValue ? emptyDisplayedValue : answerOrDefault, complete = useComplete(), [error, setError] = (0, import_react62.useState)(void 0), color = promptState === PromptState.Error ? "red" : "cyan", { isAborted } = useAbortSignal(abortSignal);
29834
29928
  return use_input_default((input, key) => {
29835
29929
  if (handleCtrlC(input, key), key.return) {
29836
29930
  let error2 = validateAnswer(answerOrDefault);
@@ -29883,10 +29977,10 @@ var TextPrompt = ({ message, onSubmit, validate: validate2, defaultValue = "", p
29883
29977
  }, defaultValue, color, password })
29884
29978
  )
29885
29979
  ),
29886
- import_react62.default.createElement(
29980
+ platformAndArch().platform === "windows" ? import_react62.default.createElement(Box_default, { marginLeft: 3, borderStyle: "single", borderColor: color, borderBottom: !1, borderLeft: !1, borderRight: !1 }) : import_react62.default.createElement(
29887
29981
  Box_default,
29888
29982
  { marginLeft: 3 },
29889
- import_react62.default.createElement(Text, { color }, underline)
29983
+ import_react62.default.createElement(Text, { color }, "\u2594".repeat(oneThird - 3))
29890
29984
  ),
29891
29985
  promptState === PromptState.Error ? import_react62.default.createElement(
29892
29986
  Box_default,
@@ -29977,7 +30071,10 @@ var import_react65 = __toESM(require_react(), 1), defaultUIDebugOptions = {
29977
30071
  };
29978
30072
  async function renderConcurrent({ renderOptions, ...props }) {
29979
30073
  let abortSignal = props.abortSignal ?? new AbortController2().signal;
29980
- return render2(import_react65.default.createElement(ConcurrentOutput, { ...props, abortSignal }), renderOptions);
30074
+ return commandEventOutputMode() === "json" && !props.keepRunningAfterProcessesResolve ? props.processes.length === 0 ? void 0 : renderSingleTask({
30075
+ title: outputContent`Running concurrent processes`,
30076
+ task: async () => runConcurrentProcessesForJson({ ...props, abortSignal })
30077
+ }) : render2(import_react65.default.createElement(ConcurrentOutput, { ...props, abortSignal }), renderOptions);
29981
30078
  }
29982
30079
  function renderInfo(options) {
29983
30080
  return alert({ ...options, type: "info" });
@@ -30000,6 +30097,7 @@ async function renderSelectPrompt({ renderOptions, isConfirmationPrompt, ...prop
30000
30097
  return await render2(import_react65.default.createElement(SelectPrompt, { ...props, onSubmit: (value) => {
30001
30098
  selectedValue = value;
30002
30099
  } }), {
30100
+ stdout: process.stderr,
30003
30101
  ...renderOptions,
30004
30102
  exitOnCtrlC: !1
30005
30103
  }), selectedValue;
@@ -30045,6 +30143,7 @@ async function renderAutocompletePrompt({ renderOptions, ...props }, uiDebugOpti
30045
30143
  if (await render2(import_react65.default.createElement(AutocompletePrompt, { ...newProps, onSubmit: (value) => {
30046
30144
  selectedValue = value;
30047
30145
  } }), {
30146
+ stdout: process.stderr,
30048
30147
  ...renderOptions,
30049
30148
  exitOnCtrlC: !1
30050
30149
  }), selectedValue === void 0)
@@ -30056,6 +30155,8 @@ function renderTable({ renderOptions, ...props }) {
30056
30155
  return renderOnce(import_react65.default.createElement(Table, { ...props }), { renderOptions });
30057
30156
  }
30058
30157
  async function renderTasks(tasks, { renderOptions, noProgressBar } = {}) {
30158
+ if (commandEventOutputMode() === "json")
30159
+ return runTasks(tasks);
30059
30160
  let taskResult;
30060
30161
  return await render2(import_react65.default.createElement(Tasks, { tasks, onComplete: (ctx) => {
30061
30162
  taskResult = ctx;
@@ -30065,11 +30166,55 @@ async function renderTasks(tasks, { renderOptions, noProgressBar } = {}) {
30065
30166
  exitOnCtrlC: !1
30066
30167
  }), taskResult;
30067
30168
  }
30068
- async function renderSingleTask({ title, task, onAbort, renderOptions }) {
30169
+ async function renderSingleTask({ title, task, retry = 0, onAbort, renderOptions }) {
30170
+ let operation = randomUUID(), currentStatus = title, aborted = !1, abort = onAbort ? () => {
30171
+ aborted = !0, onAbort();
30172
+ } : void 0, taskWithProgressEvents = async (updateStatus) => {
30173
+ emitCommandEvent({ type: "progress", operation, status: "started", message: unstyled(currentStatus.value) }, { alreadyRendered: !0 });
30174
+ let updateTaskStatus = (status) => {
30175
+ currentStatus = status, emitCommandEvent({ type: "progress", operation, status: "updated", message: unstyled(status.value) }, { alreadyRendered: !0 }), updateStatus(status);
30176
+ };
30177
+ for (let attempt = 0; ; attempt++) {
30178
+ let result;
30179
+ try {
30180
+ result = await task(updateTaskStatus);
30181
+ } catch (error) {
30182
+ if (aborted)
30183
+ throw error;
30184
+ let shouldRetry = attempt < retry;
30185
+ if (emitCommandEvent({
30186
+ type: "progress",
30187
+ operation,
30188
+ status: shouldRetry ? "retrying" : "failed",
30189
+ message: unstyled(currentStatus.value)
30190
+ }, { alreadyRendered: !0 }), !shouldRetry)
30191
+ throw error;
30192
+ continue;
30193
+ }
30194
+ return aborted || emitCommandEvent({
30195
+ type: "progress",
30196
+ operation,
30197
+ status: "completed",
30198
+ message: unstyled(currentStatus.value),
30199
+ current: 1,
30200
+ total: 1
30201
+ }, { alreadyRendered: !0 }), result;
30202
+ }
30203
+ };
30204
+ if (commandEventOutputMode() === "json") {
30205
+ let onSigint = () => abort?.();
30206
+ onAbort && process.once("SIGINT", onSigint);
30207
+ try {
30208
+ return await taskWithProgressEvents(() => {
30209
+ });
30210
+ } finally {
30211
+ onAbort && process.removeListener("SIGINT", onSigint);
30212
+ }
30213
+ }
30069
30214
  let taskResult;
30070
- return await render2(import_react65.default.createElement(SingleTask, { title, task, onComplete: (result) => {
30215
+ return await render2(import_react65.default.createElement(SingleTask, { title, task: taskWithProgressEvents, onComplete: (result) => {
30071
30216
  taskResult = result;
30072
- }, onAbort }), {
30217
+ }, onAbort: abort }), {
30073
30218
  stdout: process.stderr,
30074
30219
  ...renderOptions,
30075
30220
  exitOnCtrlC: !1
@@ -30081,6 +30226,7 @@ async function renderTextPrompt({ renderOptions, ...props }, uiDebugOptions = de
30081
30226
  return await render2(import_react65.default.createElement(TextPrompt, { ...props, onSubmit: (value) => {
30082
30227
  enteredText = value;
30083
30228
  } }), {
30229
+ stdout: process.stderr,
30084
30230
  ...renderOptions,
30085
30231
  exitOnCtrlC: !1
30086
30232
  }), enteredText;
@@ -30092,6 +30238,7 @@ async function renderDangerousConfirmationPrompt({ renderOptions, ...props }, ui
30092
30238
  return await render2(import_react65.default.createElement(DangerousConfirmationPrompt, { ...props, onSubmit: (value) => {
30093
30239
  confirmed = value;
30094
30240
  } }), {
30241
+ stdout: process.stderr,
30095
30242
  ...renderOptions,
30096
30243
  exitOnCtrlC: !1
30097
30244
  }), confirmed;
@@ -30264,4 +30411,4 @@ react-reconciler/cjs/react-reconciler.development.js:
30264
30411
  * LICENSE file in the root directory of this source tree.
30265
30412
  *)
30266
30413
  */
30267
- //# sourceMappingURL=chunk-ZOH5TKZV.js.map
30414
+ //# sourceMappingURL=chunk-NHN6SUTT.js.map