@shopify/cli-kit 3.3.2 → 3.5.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 (91) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/api/admin.js +20 -34
  3. package/dist/api/admin.js.map +1 -1
  4. package/dist/api/common.d.ts +11 -1
  5. package/dist/api/common.js +50 -4
  6. package/dist/api/common.js.map +1 -1
  7. package/dist/api/identity.js +3 -3
  8. package/dist/api/identity.js.map +1 -1
  9. package/dist/api/partners.d.ts +0 -5
  10. package/dist/api/partners.js +22 -42
  11. package/dist/api/partners.js.map +1 -1
  12. package/dist/constants.d.ts +1 -0
  13. package/dist/constants.js +1 -2
  14. package/dist/constants.js.map +1 -1
  15. package/dist/environment/local.d.ts +1 -0
  16. package/dist/environment/local.js +3 -0
  17. package/dist/environment/local.js.map +1 -1
  18. package/dist/environment/service.d.ts +2 -1
  19. package/dist/environment/service.js +16 -0
  20. package/dist/environment/service.js.map +1 -1
  21. package/dist/error.d.ts +5 -0
  22. package/dist/error.js +10 -4
  23. package/dist/error.js.map +1 -1
  24. package/dist/file.d.ts +2 -0
  25. package/dist/file.js +13 -1
  26. package/dist/file.js.map +1 -1
  27. package/dist/git.js +12 -4
  28. package/dist/git.js.map +1 -1
  29. package/dist/http/fetch.d.ts +9 -2
  30. package/dist/http/fetch.js +11 -2
  31. package/dist/http/fetch.js.map +1 -1
  32. package/dist/http/graphql.d.ts +15 -0
  33. package/dist/http/graphql.js +12 -0
  34. package/dist/http/graphql.js.map +1 -0
  35. package/dist/http.d.ts +24 -0
  36. package/dist/http.js +27 -0
  37. package/dist/http.js.map +1 -1
  38. package/dist/network/service.d.ts +1 -1
  39. package/dist/network/service.js.map +1 -1
  40. package/dist/node/archiver.d.ts +4 -1
  41. package/dist/node/archiver.js +22 -13
  42. package/dist/node/archiver.js.map +1 -1
  43. package/dist/node/base-command.d.ts +1 -0
  44. package/dist/node/base-command.js +10 -1
  45. package/dist/node/base-command.js.map +1 -1
  46. package/dist/node/cli.d.ts +0 -2
  47. package/dist/node/cli.js +0 -4
  48. package/dist/node/cli.js.map +1 -1
  49. package/dist/node/error-handler.d.ts +20 -0
  50. package/dist/node/error-handler.js +40 -3
  51. package/dist/node/error-handler.js.map +1 -1
  52. package/dist/node/hooks/init.d.ts +2 -0
  53. package/dist/node/hooks/init.js +7 -0
  54. package/dist/node/hooks/init.js.map +1 -0
  55. package/dist/node/hooks/postrun.js +4 -1
  56. package/dist/node/hooks/postrun.js.map +1 -1
  57. package/dist/node/hooks/prerun.js +2 -0
  58. package/dist/node/hooks/prerun.js.map +1 -1
  59. package/dist/node/ruby.d.ts +7 -2
  60. package/dist/node/ruby.js +24 -12
  61. package/dist/node/ruby.js.map +1 -1
  62. package/dist/output.d.ts +18 -11
  63. package/dist/output.js +96 -28
  64. package/dist/output.js.map +1 -1
  65. package/dist/path.d.ts +3 -3
  66. package/dist/path.js +2 -4
  67. package/dist/path.js.map +1 -1
  68. package/dist/session/exchange.js +2 -2
  69. package/dist/session/exchange.js.map +1 -1
  70. package/dist/session/validate.js +3 -0
  71. package/dist/session/validate.js.map +1 -1
  72. package/dist/session.js +7 -1
  73. package/dist/session.js.map +1 -1
  74. package/dist/store.js +0 -2
  75. package/dist/store.js.map +1 -1
  76. package/dist/string.js +3 -1
  77. package/dist/string.js.map +1 -1
  78. package/dist/system.d.ts +4 -3
  79. package/dist/system.js +5 -2
  80. package/dist/system.js.map +1 -1
  81. package/dist/tsconfig.tsbuildinfo +1 -1
  82. package/dist/typing/overloaded-parameters.d.ts +6 -0
  83. package/dist/typing/overloaded-parameters.js +2 -0
  84. package/dist/typing/overloaded-parameters.js.map +1 -0
  85. package/dist/typing/simple-definitions.d.ts +4 -0
  86. package/dist/typing/simple-definitions.js +2 -0
  87. package/dist/typing/simple-definitions.js.map +1 -0
  88. package/dist/ui.d.ts +11 -0
  89. package/dist/ui.js +35 -5
  90. package/dist/ui.js.map +1 -1
  91. package/package.json +25 -20
package/dist/system.js CHANGED
@@ -18,7 +18,7 @@ export const captureOutput = async (command, args, options) => {
18
18
  };
19
19
  export const exec = async (command, args, options) => {
20
20
  const commandProcess = buildExec(command, args, options);
21
- if (options?.stderr) {
21
+ if (options?.stderr && options.stderr !== 'inherit') {
22
22
  commandProcess.stderr?.pipe(options.stderr);
23
23
  }
24
24
  if (options?.stdout && options.stdout !== 'inherit') {
@@ -45,8 +45,11 @@ const buildExec = (command, args, options) => {
45
45
  const commandProcess = execa(command, args, {
46
46
  env,
47
47
  cwd: options?.cwd,
48
- input: options?.stdin,
48
+ input: options?.input,
49
+ stdio: options?.stdio,
50
+ stdin: options?.stdin,
49
51
  stdout: options?.stdout === 'inherit' ? 'inherit' : undefined,
52
+ stderr: options?.stderr === 'inherit' ? 'inherit' : undefined,
50
53
  });
51
54
  debug(`
52
55
  Running system process:
@@ -1 +1 @@
1
- {"version":3,"file":"system.js","sourceRoot":"","sources":["../src/system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,IAAI,gBAAgB,EAAE,mBAAmB,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AACtF,OAAO,EAAC,eAAe,EAAC,MAAM,SAAS,CAAA;AACvC,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAA;AAChC,OAAO,EAAC,KAAK,EAAoB,MAAM,OAAO,CAAA;AAe9C,MAAM,CAAC,MAAM,IAAI,GAAG,KAAK,EAAE,GAAW,EAAE,EAAE;IACxC,MAAM,YAAY,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,CAAA;IACzC,MAAM,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;AACjC,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAAE,OAAe,EAAE,IAAc,EAAE,OAAqB,EAAmB,EAAE;IAC7G,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC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KACxB;IACD,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,CAAA;IAC/D,MAAM,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,EAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAC,CAAC,CAAA;AAClE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,OAAe;IACzC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,UAAU,CAAC,OAAO,EAAE,IAAI,GAAG,OAAO,CAAC,CAAA;IACrC,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {concurrent as concurrentOutput, shouldDisplayColors, debug} from './output.js'\nimport {platformAndArch} from './os.js'\nimport {Abort} from './error.js'\nimport {execa, ExecaChildProcess} from 'execa'\nimport {AbortSignal} from 'abort-controller'\nimport type {Writable, Readable} from 'node:stream'\n\nexport interface ExecOptions {\n cwd?: string\n env?: {[key: string]: string | undefined}\n stdout?: Writable | 'inherit'\n stderr?: Writable\n stdio?: Readable | 'inherit'\n stdin?: string\n signal?: AbortSignal\n}\nexport type WritableExecOptions = Omit<ExecOptions, 'stdout'> & {stdout?: Writable}\n\nexport const open = async (url: string) => {\n const externalOpen = await import('open')\n await externalOpen.default(url)\n}\n\n/**\n * Runs a command asynchronously, aggregates the stdout data, and returns it.\n * @param command {string} Command to be executed.\n * @param args {string[]} Arguments to pass to the command.\n * @returns A promise that resolves with the aggregatted stdout of the command.\n */\nexport const captureOutput = async (command: string, args: string[], options?: ExecOptions): Promise<string> => {\n const result = await buildExec(command, args, options)\n return result.stdout\n}\n\nexport const exec = async (command: string, args: string[], options?: ExecOptions) => {\n const commandProcess = buildExec(command, args, options)\n if (options?.stderr) {\n commandProcess.stderr?.pipe(options.stderr)\n }\n if (options?.stdout && options.stdout !== 'inherit') {\n commandProcess.stdout?.pipe(options.stdout)\n }\n options?.signal?.addEventListener('abort', () => {\n commandProcess.kill('SIGTERM', {forceKillAfterTimeout: 1000})\n })\n try {\n await commandProcess\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (processError: any) {\n const abortError = new Abort(processError.message)\n abortError.stack = processError.stack\n throw abortError\n }\n}\n\nconst buildExec = (command: string, args: string[], options?: ExecOptions): ExecaChildProcess<string> => {\n const env = options?.env ?? process.env\n if (shouldDisplayColors()) {\n env.FORCE_COLOR = '1'\n }\n const commandProcess = execa(command, args, {\n env,\n cwd: options?.cwd,\n input: options?.stdin,\n stdout: options?.stdout === 'inherit' ? 'inherit' : undefined,\n })\n debug(`\nRunning system process:\n · Command: ${command} ${args.join(' ')}\n · Working directory: ${options?.cwd ?? process.cwd()}\n`)\n return commandProcess\n}\n\ninterface ConcurrentExecCommand {\n prefix: string\n executable: string\n args: string[]\n cwd: string\n}\n\n/**\n * Runs commands concurrently and combines the standard output and error data\n * into a single stream that differenciates the sources using a colored prefix:\n *\n * Example:\n * [my-extension] Log coming from my-extension\n * [my-script] Log coming from my script\n *\n * If one of the processes fails, it aborts the running ones and exits with that error.\n * @param commands {ConcurrentExecCommand[]} Commands to execute.\n */\nexport const concurrentExec = async (commands: ConcurrentExecCommand[]): Promise<void> => {\n await concurrentOutput(\n commands.map((command) => {\n return {\n prefix: command.prefix,\n action: async (stdout, stderr, signal) => {\n await exec(command.executable, command.args, {\n stdout,\n stderr,\n cwd: command.cwd,\n signal,\n })\n },\n }\n }),\n )\n}\n\n/**\n * Displays a large file using the terminal pager set by the user, or a\n * reasonable default for the user's OS:\n *\n * @param filename string The path to the file to be displayed.\n */\nexport async function page(filename: string) {\n let executable: string\n if (process.env.PAGER) {\n executable = process.env.PAGER\n } else if ((await platformAndArch()).platform === 'windows') {\n executable = 'more'\n } else {\n executable = 'less -NR'\n }\n const [command, ...args] = [...executable.split(' '), filename]\n await exec(command, args, {stdout: 'inherit', stdin: 'inherit'})\n}\n\nexport async function sleep(seconds: number) {\n return new Promise((resolve) => {\n setTimeout(resolve, 1000 * seconds)\n })\n}\n"]}
1
+ {"version":3,"file":"system.js","sourceRoot":"","sources":["../src/system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,IAAI,gBAAgB,EAAE,mBAAmB,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AACtF,OAAO,EAAC,eAAe,EAAC,MAAM,SAAS,CAAA;AACvC,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAA;AAChC,OAAO,EAAC,KAAK,EAAoB,MAAM,OAAO,CAAA;AAgB9C,MAAM,CAAC,MAAM,IAAI,GAAG,KAAK,EAAE,GAAW,EAAE,EAAE;IACxC,MAAM,YAAY,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,CAAA;IACzC,MAAM,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;AACjC,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAAE,OAAe,EAAE,IAAc,EAAE,OAAqB,EAAmB,EAAE;IAC7G,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;IACtD,OAAO,MAAM,CAAC,MAAM,CAAA;AACtB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,KAAK,EAAE,OAAe,EAAE,IAAc,EAAE,OAAqB,EAAE,EAAE;IACnF,MAAM,cAAc,GAAG,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;IACxD,IAAI,OAAO,EAAE,MAAM,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,EAAE;QACnD,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;KAC5C;IACD,IAAI,OAAO,EAAE,MAAM,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,EAAE;QACnD,cAAc,CAAC,MAAM,EAAE,IA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AK,UAAU,KAAK,CAAC,OAAe;IACzC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,UAAU,CAAC,OAAO,EAAE,IAAI,GAAG,OAAO,CAAC,CAAA;IACrC,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {concurrent as concurrentOutput, shouldDisplayColors, debug} from './output.js'\nimport {platformAndArch} from './os.js'\nimport {Abort} from './error.js'\nimport {execa, ExecaChildProcess} from 'execa'\nimport {AbortSignal} from 'abort-controller'\nimport type {Writable, Readable} from 'node:stream'\n\nexport interface ExecOptions {\n cwd?: string\n env?: {[key: string]: string | undefined}\n stdin?: Readable | 'inherit'\n stdout?: Writable | 'inherit'\n stderr?: Writable | 'inherit'\n stdio?: 'inherit'\n input?: string\n signal?: AbortSignal\n}\nexport type WritableExecOptions = Omit<ExecOptions, 'stdout'> & {stdout?: Writable}\n\nexport const open = async (url: string) => {\n const externalOpen = await import('open')\n await externalOpen.default(url)\n}\n\n/**\n * Runs a command asynchronously, aggregates the stdout data, and returns it.\n * @param command {string} Command to be executed.\n * @param args {string[]} Arguments to pass to the command.\n * @returns A promise that resolves with the aggregatted stdout of the command.\n */\nexport const captureOutput = async (command: string, args: string[], options?: ExecOptions): Promise<string> => {\n const result = await buildExec(command, args, options)\n return result.stdout\n}\n\nexport const exec = async (command: string, args: string[], options?: ExecOptions) => {\n const commandProcess = buildExec(command, args, options)\n if (options?.stderr && options.stderr !== 'inherit') {\n commandProcess.stderr?.pipe(options.stderr)\n }\n if (options?.stdout && options.stdout !== 'inherit') {\n commandProcess.stdout?.pipe(options.stdout)\n }\n options?.signal?.addEventListener('abort', () => {\n commandProcess.kill('SIGTERM', {forceKillAfterTimeout: 1000})\n })\n try {\n await commandProcess\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (processError: any) {\n const abortError = new Abort(processError.message)\n abortError.stack = processError.stack\n throw abortError\n }\n}\n\nconst buildExec = (command: string, args: string[], options?: ExecOptions): ExecaChildProcess<string> => {\n const env = options?.env ?? process.env\n if (shouldDisplayColors()) {\n env.FORCE_COLOR = '1'\n }\n const commandProcess = execa(command, args, {\n env,\n cwd: options?.cwd,\n input: options?.input,\n stdio: options?.stdio,\n stdin: options?.stdin,\n stdout: options?.stdout === 'inherit' ? 'inherit' : undefined,\n stderr: options?.stderr === 'inherit' ? 'inherit' : undefined,\n })\n debug(`\nRunning system process:\n · Command: ${command} ${args.join(' ')}\n · Working directory: ${options?.cwd ?? process.cwd()}\n`)\n return commandProcess\n}\n\ninterface ConcurrentExecCommand {\n prefix: string\n executable: string\n args: string[]\n cwd: string\n}\n\n/**\n * Runs commands concurrently and combines the standard output and error data\n * into a single stream that differenciates the sources using a colored prefix:\n *\n * Example:\n * [my-extension] Log coming from my-extension\n * [my-script] Log coming from my script\n *\n * If one of the processes fails, it aborts the running ones and exits with that error.\n * @param commands {ConcurrentExecCommand[]} Commands to execute.\n */\nexport const concurrentExec = async (commands: ConcurrentExecCommand[]): Promise<void> => {\n await concurrentOutput(\n commands.map((command) => {\n return {\n prefix: command.prefix,\n action: async (stdout, stderr, signal) => {\n await exec(command.executable, command.args, {\n stdout,\n stderr,\n cwd: command.cwd,\n signal,\n })\n },\n }\n }),\n )\n}\n\n/**\n * Displays a large file using the terminal pager set by the user, or a\n * reasonable default for the user's OS:\n *\n * @param filename string The path to the file to be displayed.\n */\nexport async function page(filename: string) {\n let executable: string\n if (process.env.PAGER) {\n executable = process.env.PAGER\n } else if ((await platformAndArch()).platform === 'windows') {\n executable = 'more'\n } else {\n executable = 'less -NR'\n }\n const [command, ...args] = [...executable.split(' '), filename]\n await exec(command, args, {stdout: 'inherit', stdin: 'inherit'})\n}\n\nexport async function sleep(seconds: number) {\n return new Promise((resolve) => {\n setTimeout(resolve, 1000 * seconds)\n })\n}\n"]}