@shopify/cli-kit 3.34.0 → 3.35.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 (110) hide show
  1. package/dist/git.js +2 -2
  2. package/dist/git.js.map +1 -1
  3. package/dist/http/fetch.js +1 -1
  4. package/dist/http/fetch.js.map +1 -1
  5. package/dist/index.d.ts +0 -3
  6. package/dist/index.js +0 -3
  7. package/dist/index.js.map +1 -1
  8. package/dist/npm.js +3 -3
  9. package/dist/npm.js.map +1 -1
  10. package/dist/output.js +3 -3
  11. package/dist/output.js.map +1 -1
  12. package/dist/private/node/api/graphql.js +1 -1
  13. package/dist/private/node/api/graphql.js.map +1 -1
  14. package/dist/private/node/api/headers.d.ts +2 -2
  15. package/dist/private/node/api/headers.js +3 -3
  16. package/dist/private/node/api/headers.js.map +1 -1
  17. package/dist/private/node/api/rest.d.ts +5 -3
  18. package/dist/private/node/api/rest.js +8 -7
  19. package/dist/private/node/api/rest.js.map +1 -1
  20. package/dist/private/node/constants.d.ts +42 -0
  21. package/dist/private/node/constants.js +58 -0
  22. package/dist/private/node/constants.js.map +1 -0
  23. package/dist/private/node/environment/service.js +2 -2
  24. package/dist/private/node/environment/service.js.map +1 -1
  25. package/dist/private/node/session/post-auth.js +8 -8
  26. package/dist/private/node/session/post-auth.js.map +1 -1
  27. package/dist/private/node/session/store.js +6 -6
  28. package/dist/private/node/session/store.js.map +1 -1
  29. package/dist/private/node/session/validate.js +2 -2
  30. package/dist/private/node/session/validate.js.map +1 -1
  31. package/dist/private/node/session.js +2 -2
  32. package/dist/private/node/session.js.map +1 -1
  33. package/dist/private/node/ui/components/SelectPrompt.d.ts +2 -1
  34. package/dist/private/node/ui/components/SelectPrompt.js +2 -1
  35. package/dist/private/node/ui/components/SelectPrompt.js.map +1 -1
  36. package/dist/private/node/ui/components/Table/Column.d.ts +5 -0
  37. package/dist/private/node/ui/components/Table/Column.js +2 -0
  38. package/dist/private/node/ui/components/Table/Column.js.map +1 -0
  39. package/dist/private/node/ui/components/Table/Row.d.ts +12 -0
  40. package/dist/private/node/ui/components/Table/Row.js +24 -0
  41. package/dist/private/node/ui/components/Table/Row.js.map +1 -0
  42. package/dist/private/node/ui/components/Table/ScalarDict.d.ts +5 -0
  43. package/dist/private/node/ui/components/Table/ScalarDict.js +2 -0
  44. package/dist/private/node/ui/components/Table/ScalarDict.js.map +1 -0
  45. package/dist/private/node/ui/components/Table/Table.d.ts +12 -0
  46. package/dist/private/node/ui/components/Table/Table.js +30 -0
  47. package/dist/private/node/ui/components/Table/Table.js.map +1 -0
  48. package/dist/private/node/ui/components/Table/Table.test.d.ts +1 -0
  49. package/dist/private/node/ui/components/Table/Table.test.js +41 -0
  50. package/dist/private/node/ui/components/Table/Table.test.js.map +1 -0
  51. package/dist/public/common/string.d.ts +11 -0
  52. package/dist/public/common/string.js +21 -0
  53. package/dist/public/common/string.js.map +1 -1
  54. package/dist/public/common/version.d.ts +1 -0
  55. package/dist/public/common/version.js +2 -0
  56. package/dist/public/common/version.js.map +1 -0
  57. package/dist/public/node/analytics.js +2 -2
  58. package/dist/public/node/analytics.js.map +1 -1
  59. package/dist/public/node/api/admin.d.ts +4 -1
  60. package/dist/public/node/api/admin.js +4 -3
  61. package/dist/public/node/api/admin.js.map +1 -1
  62. package/dist/public/node/cli.js +4 -4
  63. package/dist/public/node/cli.js.map +1 -1
  64. package/dist/public/node/dot-env.js +2 -2
  65. package/dist/public/node/dot-env.js.map +1 -1
  66. package/dist/public/node/environment/local.js +17 -17
  67. package/dist/public/node/environment/local.js.map +1 -1
  68. package/dist/public/node/environment/spin.js +5 -5
  69. package/dist/public/node/environment/spin.js.map +1 -1
  70. package/dist/public/node/error-handler.js +6 -5
  71. package/dist/public/node/error-handler.js.map +1 -1
  72. package/dist/public/node/fs.d.ts +222 -3
  73. package/dist/public/node/fs.js +338 -2
  74. package/dist/public/node/fs.js.map +1 -1
  75. package/dist/public/node/git.d.ts +90 -0
  76. package/dist/public/node/git.js +174 -0
  77. package/dist/public/node/git.js.map +1 -0
  78. package/dist/public/node/liquid.js +6 -6
  79. package/dist/public/node/liquid.js.map +1 -1
  80. package/dist/public/node/node-package-manager.d.ts +0 -10
  81. package/dist/public/node/node-package-manager.js +2 -19
  82. package/dist/public/node/node-package-manager.js.map +1 -1
  83. package/dist/public/node/presets.js +2 -2
  84. package/dist/public/node/presets.js.map +1 -1
  85. package/dist/public/node/ruby.js +8 -8
  86. package/dist/public/node/ruby.js.map +1 -1
  87. package/dist/public/node/session.js +2 -2
  88. package/dist/public/node/session.js.map +1 -1
  89. package/dist/public/node/ui.d.ts +13 -0
  90. package/dist/public/node/ui.js +14 -0
  91. package/dist/public/node/ui.js.map +1 -1
  92. package/dist/public/node/vscode.js +5 -5
  93. package/dist/public/node/vscode.js.map +1 -1
  94. package/dist/secure-store.js +4 -4
  95. package/dist/secure-store.js.map +1 -1
  96. package/dist/store.d.ts +10 -10
  97. package/dist/store.js +21 -22
  98. package/dist/store.js.map +1 -1
  99. package/dist/testing/store.js +3 -3
  100. package/dist/testing/store.js.map +1 -1
  101. package/dist/tsconfig.tsbuildinfo +1 -1
  102. package/dist/ui.js +3 -3
  103. package/dist/ui.js.map +1 -1
  104. package/package.json +2 -2
  105. package/dist/constants.d.ts +0 -48
  106. package/dist/constants.js +0 -67
  107. package/dist/constants.js.map +0 -1
  108. package/dist/file.d.ts +0 -98
  109. package/dist/file.js +0 -216
  110. package/dist/file.js.map +0 -1
package/dist/ui.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { CancelExecution, Abort, AbortSilent } from './error.js';
2
- import { remove, exists } from './file.js';
2
+ import { removeFile, fileExists } from './public/node/fs.js';
3
3
  import { info, completed, content, token, logUpdate, stringifyMessage, debug } from './output.js';
4
4
  import colors from './public/node/colors.js';
5
5
  import { relative } from './path.js';
@@ -69,7 +69,7 @@ ${token.json(questions)}
69
69
  return value;
70
70
  };
71
71
  export async function nonEmptyDirectoryPrompt(directory) {
72
- if (await exists(directory)) {
72
+ if (await fileExists(directory)) {
73
73
  const options = [
74
74
  { name: 'No, don’t delete the files', value: 'abort' },
75
75
  { name: 'Yes, delete the files', value: 'overwrite' },
@@ -85,7 +85,7 @@ export async function nonEmptyDirectoryPrompt(directory) {
85
85
  if (choice.value === 'abort') {
86
86
  throw new CancelExecution();
87
87
  }
88
- await remove(directory);
88
+ await removeFile(directory);
89
89
  }
90
90
  }
91
91
  export async function terminateBlockingPortProcessPrompt(port, stepDescription) {
package/dist/ui.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ui.js","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAE,KAAK,EAAE,WAAW,EAAC,MAAM,YAAY,CAAA;AAC9D,OAAO,EAAC,MAAM,EAAE,MAAM,EAAC,MAAM,WAAW,CAAA;AACxC,OAAO,EAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAmB,gBAAgB,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AAChH,OAAO,MAAM,MAAM,yBAAyB,CAAA;AAC5C,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAA;AAClC,OAAO,EAAC,qBAAqB,EAAC,MAAM,oCAAoC,CAAA;AACxE,OAAO,EAAC,MAAM,IAAI,QAAQ,EAAE,GAAG,IAAI,UAAU,EAAC,MAAM,kBAAkB,CAAA;AACtE,OAAO,EAAC,KAAK,IAAI,aAAa,EAAa,cAAc,EAAwB,MAAM,QAAQ,CAAA;AAC/F,OAAO,WAAW,MAAM,cAAc,CAAA;AAEtC,MAAM,UAAU,QAAQ,CAAC,KAAkB,EAAE,OAAwC;IACnF,MAAM,KAAK,GAAG,IAAI,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IAC/C,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAC3B,MAAM,mBAAmB,GAAa,EAAE,CAAA;QACxC,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AAM,CAAC;QAC1B;YACE,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,GAAG,sBAAsB,oBAAoB,IAAI,2DAA2D,oBAAoB,4BAA4B;YACrK,OAAO,EAAE,OAAO;SACjB;KACF,CAAC,CAAA;IACF,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,CAAA;AAClC,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,IAAI,EAAE;IACjC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,OAAO,GAAG,CAAC,MAAc,EAAE,EAAE;YACjC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;YAC/B,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;YAErB,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;YAEhC,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE;gBAClC,KAAK,CAAC,wCAAwC,CAAC,CAAA;gBAC/C,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC,CAAA;aAC1B;YACD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;QAC3B,CAAC,CAAA;QAED,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,CAAA;QACtB,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;QAC9B,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACrC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import {CancelExecution, Abort, AbortSilent} from './error.js'\nimport {remove, exists} from './file.js'\nimport {info, completed, content, token, logUpdate, Message, Logger, stringifyMessage, debug} from './output.js'\nimport colors from './public/node/colors.js'\nimport {relative} from './path.js'\nimport {isTerminalInteractive} from './public/node/environment/local.js'\nimport {mapper as mapperUI, run as executorUI} from './ui/executor.js'\nimport {Listr as OriginalListr, ListrTask, ListrTaskState, ListrBaseClassOptions} from 'listr2'\nimport findProcess from 'find-process'\n\nexport function newListr(tasks: ListrTask[], options?: object | ListrBaseClassOptions) {\n const listr = new OriginalListr(tasks, options)\n listr.tasks.forEach((task) => {\n const loggedSubtaskTitles: string[] = []\n task.renderHook$.subscribe(() => {\n if (task.hasSubtasks()) {\n const activeSubtasks = task.subtasks.filter((subtask) => {\n return [ListrTaskState.PENDING, ListrTaskState.COMPLETED].includes(subtask.state as ListrTaskState)\n })\n activeSubtasks.forEach((subtask) => {\n if (subtask.title && !loggedSubtaskTitles.includes(subtask.title)) {\n loggedSubtaskTitles.push(subtask.title)\n }\n })\n }\n })\n })\n return listr\n}\n\nexport type ListrTasks = ConstructorParameters<typeof OriginalListr>[0]\nexport type {ListrTaskWrapper, ListrDefaultRenderer, ListrTask} from 'listr2'\n\nexport interface PromptAnswer {\n name: string\n value: string\n}\nexport type FilterFunction = (answers: PromptAnswer[], input: string) => Promise<PromptAnswer[]>\n\ninterface BaseQuestion<TName extends string> {\n name: TName\n message: string\n preface?: string\n validate?: (value: string) => string | true\n default?: string\n result?: (value: string) => string | boolean\n choices?: QuestionChoiceType[]\n source?: (filter: FilterFunction) => FilterFunction\n}\n\ntype TextQuestion<TName extends string> = BaseQuestion<TName> & {\n type: 'input'\n // a default is required, otherwise we'd show a prompt like 'undefined'\n default: string\n}\n\ntype PasswordQuestion<TName extends string> = BaseQuestion<TName> & {\n type: 'password'\n}\n\ntype SelectableQuestion<TName extends string> = BaseQuestion<TName> & {\n type: 'select' | 'autocomplete'\n choices: QuestionChoiceType[]\n}\n\nexport type Question<TName extends string = string> =\n | TextQuestion<TName>\n | SelectableQuestion<TName>\n | PasswordQuestion<TName>\n\nexport interface QuestionChoiceType {\n name: string\n value: string\n group?: {name: string; order: number}\n}\n\nconst started = (content: Message, logger: Logger) => {\n const message = `${colors.yellow('❯')} ${stringifyMessage(content)}`\n info(message, logger)\n}\n\nconst failed = (content: Message, logger: Logger) => {\n const message = `${colors.red('✖')} ${stringifyMessage(content)}`\n info(message, logger)\n}\n\n/**\n * Performs a task with the title kept up to date and stdout available to the\n * task while it runs (there is no re-writing stdout while the task runs).\n */\nexport interface TaskOptions {\n title: string\n task: () => Promise<void | {successMessage: string}>\n}\nexport const task = async ({title, task}: TaskOptions) => {\n let success\n started(title, logUpdate)\n try {\n const result = await task()\n success = result?.successMessage || title\n } catch (err) {\n failed(title, logUpdate)\n logUpdate.done()\n throw err\n }\n completed(success, logUpdate)\n logUpdate.done()\n}\nexport const prompt = async <\n TName extends string & keyof TAnswers,\n TAnswers extends {[key in TName]: string} = {[key in TName]: string},\n>(\n questions: ReadonlyArray<Question<TName>>,\n): Promise<TAnswers> => {\n if (!isTerminalInteractive() && questions.length !== 0) {\n throw new Abort(content`\nThe CLI prompted in a non-interactive terminal with the following questions:\n${token.json(questions)}\n `)\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const mappedQuestions: any[] = questions.map(mapperUI)\n const value = {} as TAnswers\n for (const question of mappedQuestions) {\n if (question.preface) {\n info(question.preface)\n }\n\n // eslint-disable-next-line no-await-in-loop\n value[question.name as TName] = await executorUI(question)\n }\n return value\n}\n\nexport async function nonEmptyDirectoryPrompt(directory: string) {\n if (await exists(directory)) {\n const options = [\n {name: 'No, don’t delete the files', value: 'abort'},\n {name: 'Yes, delete the files', value: 'overwrite'},\n ]\n\n const relativeDirectory = relative(process.cwd(), directory)\n\n const questions: Question<'value'> = {\n type: 'select',\n name: 'value',\n message: `${relativeDirectory} is not an empty directory. Do you want to delete the existing files and continue?`,\n choices: options,\n }\n\n const choice = await prompt([questions])\n\n if (choice.value === 'abort') {\n throw new CancelExecution()\n }\n\n await remove(directory)\n }\n}\n\nexport async function terminateBlockingPortProcessPrompt(port: number, stepDescription?: string): Promise<boolean> {\n const stepDescriptionContent = stepDescription ?? 'current step'\n\n const processInfo = await findProcess('port', port)\n const formattedProcessName =\n processInfo && processInfo.length > 0 && processInfo[0]?.name\n ? ` ${content`${token.italic(`(${processInfo[0].name})`)}`.value}`\n : ''\n\n const options = [\n {name: 'Yes, terminate process in order to log in now', value: 'finish'},\n {name: `No, cancel command and try later`, value: 'cancel'},\n ]\n\n const choice = await prompt([\n {\n type: 'select',\n name: 'value',\n message: `${stepDescriptionContent} requires a port ${port} that's unavailable because it's running another process${formattedProcessName}. Terminate that process? `,\n choices: options,\n },\n ])\n return choice.value === 'finish'\n}\n\nexport const keypress = async () => {\n return new Promise((resolve, reject) => {\n const handler = (buffer: Buffer) => {\n process.stdin.setRawMode(false)\n process.stdin.pause()\n\n const bytes = Array.from(buffer)\n\n if (bytes.length && bytes[0] === 3) {\n debug('Canceled keypress, User pressed CTRL+C')\n reject(new AbortSilent())\n }\n process.nextTick(resolve)\n }\n\n process.stdin.resume()\n process.stdin.setRawMode(true)\n process.stdin.once('data', handler)\n })\n}\n"]}
1
+ {"version":3,"file":"ui.js","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAE,KAAK,EAAE,WAAW,EAAC,MAAM,YAAY,CAAA;AAC9D,OAAO,EAAC,UAAU,EAAE,UAAU,EAAC,MAAM,qBAAqB,CAAA;AAC1D,OAAO,EAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAmB,gBAAgB,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AAChH,OAAO,MAAM,MAAM,yBAAyB,CAAA;AAC5C,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAA;AAClC,OAAO,EAAC,qBAAqB,EAAC,MAAM,oCAAoC,CAAA;AACxE,OAAO,EAAC,MAAM,IAAI,QAAQ,EAAE,GAAG,IAAI,UAAU,EAAC,MAAM,kBAAkB,CAAA;AACtE,OAAO,EAAC,KAAK,IAAI,aAAa,EAAa,cAAc,EAAwB,MAAM,QAAQ,CAA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AAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACrC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import {CancelExecution, Abort, AbortSilent} from './error.js'\nimport {removeFile, fileExists} from './public/node/fs.js'\nimport {info, completed, content, token, logUpdate, Message, Logger, stringifyMessage, debug} from './output.js'\nimport colors from './public/node/colors.js'\nimport {relative} from './path.js'\nimport {isTerminalInteractive} from './public/node/environment/local.js'\nimport {mapper as mapperUI, run as executorUI} from './ui/executor.js'\nimport {Listr as OriginalListr, ListrTask, ListrTaskState, ListrBaseClassOptions} from 'listr2'\nimport findProcess from 'find-process'\n\nexport function newListr(tasks: ListrTask[], options?: object | ListrBaseClassOptions) {\n const listr = new OriginalListr(tasks, options)\n listr.tasks.forEach((task) => {\n const loggedSubtaskTitles: string[] = []\n task.renderHook$.subscribe(() => {\n if (task.hasSubtasks()) {\n const activeSubtasks = task.subtasks.filter((subtask) => {\n return [ListrTaskState.PENDING, ListrTaskState.COMPLETED].includes(subtask.state as ListrTaskState)\n })\n activeSubtasks.forEach((subtask) => {\n if (subtask.title && !loggedSubtaskTitles.includes(subtask.title)) {\n loggedSubtaskTitles.push(subtask.title)\n }\n })\n }\n })\n })\n return listr\n}\n\nexport type ListrTasks = ConstructorParameters<typeof OriginalListr>[0]\nexport type {ListrTaskWrapper, ListrDefaultRenderer, ListrTask} from 'listr2'\n\nexport interface PromptAnswer {\n name: string\n value: string\n}\nexport type FilterFunction = (answers: PromptAnswer[], input: string) => Promise<PromptAnswer[]>\n\ninterface BaseQuestion<TName extends string> {\n name: TName\n message: string\n preface?: string\n validate?: (value: string) => string | true\n default?: string\n result?: (value: string) => string | boolean\n choices?: QuestionChoiceType[]\n source?: (filter: FilterFunction) => FilterFunction\n}\n\ntype TextQuestion<TName extends string> = BaseQuestion<TName> & {\n type: 'input'\n // a default is required, otherwise we'd show a prompt like 'undefined'\n default: string\n}\n\ntype PasswordQuestion<TName extends string> = BaseQuestion<TName> & {\n type: 'password'\n}\n\ntype SelectableQuestion<TName extends string> = BaseQuestion<TName> & {\n type: 'select' | 'autocomplete'\n choices: QuestionChoiceType[]\n}\n\nexport type Question<TName extends string = string> =\n | TextQuestion<TName>\n | SelectableQuestion<TName>\n | PasswordQuestion<TName>\n\nexport interface QuestionChoiceType {\n name: string\n value: string\n group?: {name: string; order: number}\n}\n\nconst started = (content: Message, logger: Logger) => {\n const message = `${colors.yellow('❯')} ${stringifyMessage(content)}`\n info(message, logger)\n}\n\nconst failed = (content: Message, logger: Logger) => {\n const message = `${colors.red('✖')} ${stringifyMessage(content)}`\n info(message, logger)\n}\n\n/**\n * Performs a task with the title kept up to date and stdout available to the\n * task while it runs (there is no re-writing stdout while the task runs).\n */\nexport interface TaskOptions {\n title: string\n task: () => Promise<void | {successMessage: string}>\n}\nexport const task = async ({title, task}: TaskOptions) => {\n let success\n started(title, logUpdate)\n try {\n const result = await task()\n success = result?.successMessage || title\n } catch (err) {\n failed(title, logUpdate)\n logUpdate.done()\n throw err\n }\n completed(success, logUpdate)\n logUpdate.done()\n}\nexport const prompt = async <\n TName extends string & keyof TAnswers,\n TAnswers extends {[key in TName]: string} = {[key in TName]: string},\n>(\n questions: ReadonlyArray<Question<TName>>,\n): Promise<TAnswers> => {\n if (!isTerminalInteractive() && questions.length !== 0) {\n throw new Abort(content`\nThe CLI prompted in a non-interactive terminal with the following questions:\n${token.json(questions)}\n `)\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const mappedQuestions: any[] = questions.map(mapperUI)\n const value = {} as TAnswers\n for (const question of mappedQuestions) {\n if (question.preface) {\n info(question.preface)\n }\n\n // eslint-disable-next-line no-await-in-loop\n value[question.name as TName] = await executorUI(question)\n }\n return value\n}\n\nexport async function nonEmptyDirectoryPrompt(directory: string) {\n if (await fileExists(directory)) {\n const options = [\n {name: 'No, don’t delete the files', value: 'abort'},\n {name: 'Yes, delete the files', value: 'overwrite'},\n ]\n\n const relativeDirectory = relative(process.cwd(), directory)\n\n const questions: Question<'value'> = {\n type: 'select',\n name: 'value',\n message: `${relativeDirectory} is not an empty directory. Do you want to delete the existing files and continue?`,\n choices: options,\n }\n\n const choice = await prompt([questions])\n\n if (choice.value === 'abort') {\n throw new CancelExecution()\n }\n\n await removeFile(directory)\n }\n}\n\nexport async function terminateBlockingPortProcessPrompt(port: number, stepDescription?: string): Promise<boolean> {\n const stepDescriptionContent = stepDescription ?? 'current step'\n\n const processInfo = await findProcess('port', port)\n const formattedProcessName =\n processInfo && processInfo.length > 0 && processInfo[0]?.name\n ? ` ${content`${token.italic(`(${processInfo[0].name})`)}`.value}`\n : ''\n\n const options = [\n {name: 'Yes, terminate process in order to log in now', value: 'finish'},\n {name: `No, cancel command and try later`, value: 'cancel'},\n ]\n\n const choice = await prompt([\n {\n type: 'select',\n name: 'value',\n message: `${stepDescriptionContent} requires a port ${port} that's unavailable because it's running another process${formattedProcessName}. Terminate that process? `,\n choices: options,\n },\n ])\n return choice.value === 'finish'\n}\n\nexport const keypress = async () => {\n return new Promise((resolve, reject) => {\n const handler = (buffer: Buffer) => {\n process.stdin.setRawMode(false)\n process.stdin.pause()\n\n const bytes = Array.from(buffer)\n\n if (bytes.length && bytes[0] === 3) {\n debug('Canceled keypress, User pressed CTRL+C')\n reject(new AbortSilent())\n }\n process.nextTick(resolve)\n }\n\n process.stdin.resume()\n process.stdin.setRawMode(true)\n process.stdin.once('data', handler)\n })\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopify/cli-kit",
3
- "version": "3.34.0",
3
+ "version": "3.35.0",
4
4
  "private": false,
5
5
  "description": "A set of utilities, interfaces, and models that are common across all the platform features",
6
6
  "keywords": [
@@ -61,7 +61,7 @@
61
61
  "./environment/local.js",
62
62
  "@oclif/core",
63
63
  "../../private/node/environment/utilities.js",
64
- "../../constants.js",
64
+ "../../private/node/constants.js",
65
65
  "../../path.js",
66
66
  "./system.js"
67
67
  ],
@@ -1,48 +0,0 @@
1
- declare const constants: {
2
- environmentVariables: {
3
- alwaysLogAnalytics: string;
4
- deviceAuth: string;
5
- enableCliRedirect: string;
6
- env: string;
7
- firstPartyDev: string;
8
- noAnalytics: string;
9
- partnersToken: string;
10
- runAsUser: string;
11
- serviceEnv: string;
12
- skipCliRedirect: string;
13
- spinInstance: string;
14
- themeToken: string;
15
- unitTest: string;
16
- verbose: string;
17
- themeBundling: string;
18
- codespaceName: string;
19
- codespaces: string;
20
- gitpod: string;
21
- spin: string;
22
- };
23
- paths: {
24
- executables: {
25
- dev: string;
26
- };
27
- directories: {
28
- cache: {
29
- path: () => string;
30
- vendor: {
31
- path: () => any;
32
- binaries: () => any;
33
- };
34
- };
35
- };
36
- };
37
- versions: {
38
- cliKit: () => Promise<string>;
39
- };
40
- keychain: {
41
- service: string;
42
- };
43
- session: {
44
- expirationTimeMarginInMinutes: number;
45
- };
46
- };
47
- export declare const bugsnagApiKey = "9e1e6889176fd0c795d5c659225e0fae";
48
- export default constants;
package/dist/constants.js DELETED
@@ -1,67 +0,0 @@
1
- import { join as pathJoin } from './path.js';
2
- import { findPackageVersionUp } from './public/node/node-package-manager.js';
3
- import envPaths from 'env-paths';
4
- const identifier = 'shopify-cli';
5
- const cacheFolder = () => {
6
- if (process.env.XDG_CACHE_HOME)
7
- return process.env.XDG_CACHE_HOME;
8
- return envPaths(identifier).cache;
9
- };
10
- const constants = {
11
- environmentVariables: {
12
- alwaysLogAnalytics: 'SHOPIFY_CLI_ALWAYS_LOG_ANALYTICS',
13
- deviceAuth: 'SHOPIFY_CLI_DEVICE_AUTH',
14
- enableCliRedirect: 'SHOPIFY_CLI_ENABLE_CLI_REDIRECT',
15
- env: 'SHOPIFY_CLI_ENV',
16
- firstPartyDev: 'SHOPIFY_CLI_1P_DEV',
17
- noAnalytics: 'SHOPIFY_CLI_NO_ANALYTICS',
18
- partnersToken: 'SHOPIFY_CLI_PARTNERS_TOKEN',
19
- runAsUser: 'SHOPIFY_RUN_AS_USER',
20
- serviceEnv: 'SHOPIFY_SERVICE_ENV',
21
- skipCliRedirect: 'SHOPIFY_CLI_SKIP_CLI_REDIRECT',
22
- spinInstance: 'SPIN_INSTANCE',
23
- themeToken: 'SHOPIFY_CLI_THEME_TOKEN',
24
- unitTest: 'SHOPIFY_UNIT_TEST',
25
- verbose: 'SHOPIFY_FLAG_VERBOSE',
26
- themeBundling: 'SHOPIFY_THEME_BUNDLING',
27
- // Variables to detect if the CLI is running in a cloud environment
28
- codespaceName: 'CODESPACE_NAME',
29
- codespaces: 'CODESPACES',
30
- gitpod: 'GITPOD_WORKSPACE_URL',
31
- spin: 'SPIN',
32
- },
33
- paths: {
34
- executables: {
35
- dev: '/opt/dev/bin/dev',
36
- },
37
- directories: {
38
- cache: {
39
- path: () => {
40
- return cacheFolder();
41
- },
42
- vendor: {
43
- path: () => {
44
- return pathJoin(cacheFolder(), 'vendor');
45
- },
46
- binaries: () => {
47
- return pathJoin(cacheFolder(), 'vendor', 'binaries');
48
- },
49
- },
50
- },
51
- },
52
- },
53
- versions: {
54
- cliKit: async () => {
55
- return findPackageVersionUp({ fromModuleURL: import.meta.url });
56
- },
57
- },
58
- keychain: {
59
- service: 'shopify-cli',
60
- },
61
- session: {
62
- expirationTimeMarginInMinutes: 4,
63
- },
64
- };
65
- export const bugsnagApiKey = '9e1e6889176fd0c795d5c659225e0fae';
66
- export default constants;
67
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,IAAI,QAAQ,EAAC,MAAM,WAAW,CAAA;AAC1C,OAAO,EAAC,oBAAoB,EAAC,MAAM,uCAAuC,CAAA;AAC1E,OAAO,QAAQ,MAAM,WAAW,CAAA;AAEhC,MAAM,UAAU,GAAG,aAAa,CAAA;AAEhC,MAAM,WAAW,GAAG,GAAG,EAAE;IACvB,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc;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,CAAC,IAAI,CAAC,GAAG,EAAC,CAAC,CAAA;QAC/D,CAAC;KACF;IACD,QAAQ,EAAE;QACR,OAAO,EAAE,aAAa;KACvB;IACD,OAAO,EAAE;QACP,6BAA6B,EAAE,CAAC;KACjC;CACF,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,kCAAkC,CAAA;AAE/D,eAAe,SAAS,CAAA","sourcesContent":["import {join as pathJoin} from './path.js'\nimport {findPackageVersionUp} from './public/node/node-package-manager.js'\nimport envPaths from 'env-paths'\n\nconst identifier = 'shopify-cli'\n\nconst cacheFolder = () => {\n if (process.env.XDG_CACHE_HOME) return process.env.XDG_CACHE_HOME\n return envPaths(identifier).cache\n}\n\nconst constants = {\n environmentVariables: {\n alwaysLogAnalytics: 'SHOPIFY_CLI_ALWAYS_LOG_ANALYTICS',\n deviceAuth: 'SHOPIFY_CLI_DEVICE_AUTH',\n enableCliRedirect: 'SHOPIFY_CLI_ENABLE_CLI_REDIRECT',\n env: 'SHOPIFY_CLI_ENV',\n firstPartyDev: 'SHOPIFY_CLI_1P_DEV',\n noAnalytics: 'SHOPIFY_CLI_NO_ANALYTICS',\n partnersToken: 'SHOPIFY_CLI_PARTNERS_TOKEN',\n runAsUser: 'SHOPIFY_RUN_AS_USER',\n serviceEnv: 'SHOPIFY_SERVICE_ENV',\n skipCliRedirect: 'SHOPIFY_CLI_SKIP_CLI_REDIRECT',\n spinInstance: 'SPIN_INSTANCE',\n themeToken: 'SHOPIFY_CLI_THEME_TOKEN',\n unitTest: 'SHOPIFY_UNIT_TEST',\n verbose: 'SHOPIFY_FLAG_VERBOSE',\n themeBundling: 'SHOPIFY_THEME_BUNDLING',\n // Variables to detect if the CLI is running in a cloud environment\n codespaceName: 'CODESPACE_NAME',\n codespaces: 'CODESPACES',\n gitpod: 'GITPOD_WORKSPACE_URL',\n spin: 'SPIN',\n },\n paths: {\n executables: {\n dev: '/opt/dev/bin/dev',\n },\n directories: {\n cache: {\n path: () => {\n return cacheFolder()\n },\n vendor: {\n path: () => {\n return pathJoin(cacheFolder(), 'vendor')\n },\n binaries: () => {\n return pathJoin(cacheFolder(), 'vendor', 'binaries')\n },\n },\n },\n },\n },\n versions: {\n cliKit: async () => {\n return findPackageVersionUp({fromModuleURL: import.meta.url})\n },\n },\n keychain: {\n service: 'shopify-cli',\n },\n session: {\n expirationTimeMarginInMinutes: 4,\n },\n}\n\nexport const bugsnagApiKey = '9e1e6889176fd0c795d5c659225e0fae'\n\nexport default constants\n"]}
package/dist/file.d.ts DELETED
@@ -1,98 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- export declare function stripUp(path: string, strip: number): any;
4
- /**
5
- * Creates a temporary directory and ties its lifecycle to the lifecycle of the callback.
6
- * @param callback - The callback that receives the temporary directory.
7
- */
8
- export declare function inTemporaryDirectory<T>(callback: (tmpDir: string) => T | Promise<T>): Promise<T>;
9
- /**
10
- * It reads a file and returns its content as a string using the
11
- * utf-8 encoding
12
- * @param path - Path to the file to read.
13
- * @returns A promise that resolves with the content of the file.
14
- */
15
- export declare type ReadOptions = undefined | {
16
- flag?: string | undefined;
17
- } | {
18
- encoding: BufferEncoding | string;
19
- flag?: string | undefined;
20
- };
21
- export declare function read(path: string, options?: ReadOptions): Promise<string>;
22
- export declare function read(path: string, options?: ReadOptions): Promise<Buffer>;
23
- /**
24
- * Given a path, it determines the actual path. This is useful when working
25
- * with paths that represent symlinks.
26
- * @param path - Path whose real path will be returned.
27
- */
28
- export declare function realpath(path: string): Promise<string>;
29
- export declare function readSync(path: string, options?: object): string;
30
- /**
31
- * Copies a file
32
- * @param from - Path to the directory or file to be copied.
33
- * @param to - Destination path.
34
- */
35
- export declare function copy(from: string, to: string): Promise<void>;
36
- export declare function touch(path: string): Promise<void>;
37
- export declare function appendFile(path: string, content: string): Promise<void>;
38
- export declare function touchSync(path: string): void;
39
- export declare function write(path: string, data: string): Promise<void>;
40
- export declare function writeSync(path: string, data: string): void;
41
- export declare function append(path: string, data: string): Promise<void>;
42
- export declare function appendSync(path: string, data: string): void;
43
- export declare function mkdir(path: string): Promise<void>;
44
- export declare function mkdirSync(path: string): void;
45
- export declare function remove(path: string): Promise<void>;
46
- export declare function removeSync(path: string): void;
47
- export declare function rmdir(path: string, { force }?: {
48
- force?: boolean;
49
- }): Promise<void>;
50
- export declare function mkTmpDir(): Promise<string>;
51
- export declare function isDirectory(path: string): Promise<boolean>;
52
- export declare function size(path: string): Promise<number>;
53
- export declare function sizeSync(path: string): number;
54
- export declare function createReadStream(path: string): import("fs").ReadStream;
55
- /**
56
- * Returns the Date object for the last modification of a file.
57
- * @param path - Path to the directory or file.
58
- * @returns A unix timestamp.
59
- */
60
- export declare function lastUpdated(path: string): Promise<Date>;
61
- /**
62
- * Returns the unix timestamp of the last modification of a file.
63
- * @param path - Path to the directory or file.
64
- * @returns A unix timestamp.
65
- */
66
- export declare function lastUpdatedTimestamp(path: string): Promise<number | undefined>;
67
- /**
68
- * Moves a file.
69
- * @param src - File to be moved.
70
- * @param dest - Path to be moved to.
71
- * @param options - Moving options.
72
- */
73
- export declare function move(src: string, dest: string, options?: {
74
- overwrite?: boolean;
75
- }): Promise<void>;
76
- /**
77
- * Changes the permissions of a directory or file.
78
- * @param path - Path to the file or directory whose permissions will be modified.
79
- * @param mode - Permissions to set to the file or directory.
80
- */
81
- export declare function chmod(path: string, mode: number | string): Promise<void>;
82
- /**
83
- * Checks if a file has executable permissions.
84
- * @param path - Path to the file whose permissions will be checked.
85
- */
86
- export declare function hasExecutablePermissions(path: string): Promise<boolean>;
87
- /**
88
- * Returns true if a file or directory exists
89
- * @param path - Path to the directory or file.
90
- * @returns True if it exists.
91
- */
92
- export declare function exists(path: string): Promise<boolean>;
93
- /**
94
- * Format a string using prettier. Return the formatted content.
95
- */
96
- export declare function format(content: string, options: {
97
- path: string;
98
- }): Promise<string>;
package/dist/file.js DELETED
@@ -1,216 +0,0 @@
1
- import { content as outputContent, token, debug } from './output.js';
2
- import { copy as fsCopy, ensureFile as fsEnsureFile, ensureFileSync as fsEnsureFileSync, remove as fsRemove, removeSync as fsRemoveSync, move as fsMove,
3
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4
- // @ts-ignore
5
- } from 'fs-extra/esm';
6
- import { temporaryDirectoryTask } from 'tempy';
7
- import { sep, join, extname } from 'pathe';
8
- import { mkdirSync as fsMkdirSync, readFileSync as fsReadFileSync, writeFileSync as fsWriteFileSync, appendFileSync as fsAppendFileSync, statSync as fsStatSync, createReadStream as fsCreateReadStream, constants as fsConstants, } from 'fs';
9
- import { mkdir as fsMkdir, writeFile as fsWriteFile, readFile as fsReadFile, realpath as fsRealPath, appendFile as fsAppendFile, mkdtemp as fsMkdtemp, stat as fsStat, lstat as fsLstat, chmod as fsChmod, access as fsAccess, } from 'fs/promises';
10
- const DEFAULT_PRETTIER_CONFIG = {
11
- arrowParens: 'always',
12
- singleQuote: true,
13
- bracketSpacing: false,
14
- trailingComma: 'all',
15
- };
16
- export function stripUp(path, strip) {
17
- const parts = path.split(sep);
18
- return join(...parts.slice(strip));
19
- }
20
- /**
21
- * Creates a temporary directory and ties its lifecycle to the lifecycle of the callback.
22
- * @param callback - The callback that receives the temporary directory.
23
- */
24
- export async function inTemporaryDirectory(callback) {
25
- return temporaryDirectoryTask(callback);
26
- }
27
- export async function read(path, options = { encoding: 'utf8' }) {
28
- debug(outputContent `Reading the content of file at ${token.path(path)}...`);
29
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
30
- // @ts-ignore
31
- return fsReadFile(path, options);
32
- }
33
- /**
34
- * Given a path, it determines the actual path. This is useful when working
35
- * with paths that represent symlinks.
36
- * @param path - Path whose real path will be returned.
37
- */
38
- export async function realpath(path) {
39
- return fsRealPath(path);
40
- }
41
- export function readSync(path, options = { encoding: 'utf-8' }) {
42
- debug(outputContent `Sync-reading the content of file at ${token.path(path)}...`);
43
- const content = fsReadFileSync(path, options);
44
- return content.toString();
45
- }
46
- /**
47
- * Copies a file
48
- * @param from - Path to the directory or file to be copied.
49
- * @param to - Destination path.
50
- */
51
- export async function copy(from, to) {
52
- debug(outputContent `Copying file from ${token.path(from)} to ${token.path(to)}...`);
53
- await fsCopy(from, to);
54
- }
55
- export async function touch(path) {
56
- debug(outputContent `Creating an empty file at ${token.path(path)}...`);
57
- await fsEnsureFile(path);
58
- }
59
- export async function appendFile(path, content) {
60
- debug(outputContent `Appending the following content to ${token.path(path)}:
61
- ${content
62
- .split('\n')
63
- .map((line) => ` ${line}`)
64
- .join('\n')}
65
- `);
66
- await fsAppendFile(path, content);
67
- }
68
- export function touchSync(path) {
69
- debug(outputContent `Creating an empty file at ${token.path(path)}...`);
70
- fsEnsureFileSync(path);
71
- }
72
- export async function write(path, data) {
73
- debug(outputContent `Writing some content to file at ${token.path(path)}...`);
74
- await fsWriteFile(path, data, { encoding: 'utf8' });
75
- }
76
- export function writeSync(path, data) {
77
- debug(outputContent `File-writing some content to file at ${token.path(path)}...`);
78
- fsWriteFileSync(path, data);
79
- }
80
- export async function append(path, data) {
81
- await fsAppendFile(path, data);
82
- }
83
- export function appendSync(path, data) {
84
- fsAppendFileSync(path, data);
85
- }
86
- export async function mkdir(path) {
87
- debug(outputContent `Creating directory at ${token.path(path)}...`);
88
- await fsMkdir(path, { recursive: true });
89
- }
90
- export function mkdirSync(path) {
91
- debug(outputContent `Sync-creating directory at ${token.path(path)}...`);
92
- fsMkdirSync(path, { recursive: true });
93
- }
94
- export async function remove(path) {
95
- debug(outputContent `Removing file at ${token.path(path)}...`);
96
- await fsRemove(path);
97
- }
98
- export function removeSync(path) {
99
- debug(outputContent `Sync-removing file at ${token.path(path)}...`);
100
- fsRemoveSync(path);
101
- }
102
- export async function rmdir(path, { force } = {}) {
103
- const { default: del } = await import('del');
104
- debug(outputContent `Removing directory at ${token.path(path)}...`);
105
- await del(path, { force });
106
- }
107
- export async function mkTmpDir() {
108
- debug(outputContent `Creating a temporary directory...`);
109
- const directory = await fsMkdtemp('tmp-');
110
- return directory;
111
- }
112
- export async function isDirectory(path) {
113
- debug(outputContent `Checking if ${token.path(path)} is a directory...`);
114
- return (await fsLstat(path)).isDirectory();
115
- }
116
- export async function size(path) {
117
- debug(outputContent `Getting the size of file file at ${token.path(path)}...`);
118
- return (await fsStat(path)).size;
119
- }
120
- export function sizeSync(path) {
121
- debug(outputContent `Sync-getting the size of file file at ${token.path(path)}...`);
122
- return fsStatSync(path).size;
123
- }
124
- export function createReadStream(path) {
125
- return fsCreateReadStream(path);
126
- }
127
- /**
128
- * Returns the Date object for the last modification of a file.
129
- * @param path - Path to the directory or file.
130
- * @returns A unix timestamp.
131
- */
132
- export async function lastUpdated(path) {
133
- debug(outputContent `Getting last updated timestamp for file at ${token.path(path)}...`);
134
- return (await fsStat(path)).ctime;
135
- }
136
- /**
137
- * Returns the unix timestamp of the last modification of a file.
138
- * @param path - Path to the directory or file.
139
- * @returns A unix timestamp.
140
- */
141
- export async function lastUpdatedTimestamp(path) {
142
- try {
143
- const lastUpdatedDateTime = await lastUpdated(path);
144
- return lastUpdatedDateTime.getTime();
145
- // eslint-disable-next-line no-catch-all/no-catch-all
146
- }
147
- catch {
148
- return undefined;
149
- }
150
- }
151
- /**
152
- * Moves a file.
153
- * @param src - File to be moved.
154
- * @param dest - Path to be moved to.
155
- * @param options - Moving options.
156
- */
157
- export async function move(src, dest, options = {}) {
158
- await fsMove(src, dest, options);
159
- }
160
- /**
161
- * Changes the permissions of a directory or file.
162
- * @param path - Path to the file or directory whose permissions will be modified.
163
- * @param mode - Permissions to set to the file or directory.
164
- */
165
- export async function chmod(path, mode) {
166
- await fsChmod(path, mode);
167
- }
168
- /**
169
- * Checks if a file has executable permissions.
170
- * @param path - Path to the file whose permissions will be checked.
171
- */
172
- export async function hasExecutablePermissions(path) {
173
- try {
174
- await fsAccess(path, fsConstants.X_OK);
175
- return true;
176
- // eslint-disable-next-line no-catch-all/no-catch-all
177
- }
178
- catch {
179
- return false;
180
- }
181
- }
182
- /**
183
- * Returns true if a file or directory exists
184
- * @param path - Path to the directory or file.
185
- * @returns True if it exists.
186
- */
187
- export async function exists(path) {
188
- try {
189
- await fsAccess(path);
190
- return true;
191
- // eslint-disable-next-line no-catch-all/no-catch-all
192
- }
193
- catch {
194
- return false;
195
- }
196
- }
197
- /**
198
- * Format a string using prettier. Return the formatted content.
199
- */
200
- export async function format(content, options) {
201
- const { default: prettier } = await import('prettier');
202
- const ext = extname(options.path);
203
- const prettierConfig = {
204
- ...DEFAULT_PRETTIER_CONFIG,
205
- parser: 'babel',
206
- };
207
- switch (ext) {
208
- case '.html':
209
- case '.css':
210
- prettierConfig.parser = ext.slice(1);
211
- break;
212
- }
213
- const formattedContent = await prettier.format(content, prettierConfig);
214
- return formattedContent;
215
- }
216
- //# sourceMappingURL=file.js.map
package/dist/file.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"file.js","sourceRoot":"","sources":["../src/file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,aAAa,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AAClE,OAAO,EACL,IAAI,IAAI,MAAM,EACd,UAAU,IAAI,YAAY,EAC1B,cAAc,IAAI,gBAAgB,EAClC,MAAM,IAAI,QAAQ,EAClB,UAAU,IAAI,YAAY,EAC1B,IAAI,IAAI,MAAM;AACd,6DAA6D;AAC7D,aAAa;EACd,MAAM,cAAc,CAAA;AAErB,OAAO,EAAC,sBAAsB,EAAC,MAAM,OAAO,CAAA;AAC5C,OAAO,EAAC,GAAG,EAAE,IAAI,EAAE,OAAO,EAAC,MAAM,OAAO,CAAA;AACxC,OAAO,EACL,SAAS,IAAI,WAAW,EACxB,YAAY,IAAI,cAAc,EAC9B,aAAa,IAAI,eAAe,EAChC,cAAc,IAAI,gBAAgB,EAClC,QAAQ,IAAI,UAAU,EACtB,gBAAgB,IAAI,kBAAkB,EACtC,SAAS,IAAI,WAAW,GACzB,MAAM,IAAI,CAAA;AACX,OAAO,EACL,KAAK,IAAI,OAAO,EAChB,SAAS,IAAI,W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AC,MAAM;QACN,OAAO,KAAK,CAAA;KACb;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,IAAY;IACvC,IAAI;QACF,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAA;QACpB,OAAO,IAAI,CAAA;QACX,qDAAqD;KACtD;IAAC,MAAM;QACN,OAAO,KAAK,CAAA;KACb;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,OAAe,EAAE,OAAuB;IACnE,MAAM,EAAC,OAAO,EAAE,QAAQ,EAAC,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,CAAA;IAEpD,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACjC,MAAM,cAAc,GAAY;QAC9B,GAAG,uBAAuB;QAC1B,MAAM,EAAE,OAAO;KAChB,CAAA;IAED,QAAQ,GAAG,EAAE;QACX,KAAK,OAAO,CAAC;QACb,KAAK,MAAM;YACT,cAAc,CAAC,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;YACpC,MAAK;KACR;IAED,MAAM,gBAAgB,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,cAAc,CAAC,CAAA;IAEvE,OAAO,gBAAgB,CAAA;AACzB,CAAC","sourcesContent":["import {content as outputContent, token, debug} from './output.js'\nimport {\n copy as fsCopy,\n ensureFile as fsEnsureFile,\n ensureFileSync as fsEnsureFileSync,\n remove as fsRemove,\n removeSync as fsRemoveSync,\n move as fsMove,\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n} from 'fs-extra/esm'\n\nimport {temporaryDirectoryTask} from 'tempy'\nimport {sep, join, extname} from 'pathe'\nimport {\n mkdirSync as fsMkdirSync,\n readFileSync as fsReadFileSync,\n writeFileSync as fsWriteFileSync,\n appendFileSync as fsAppendFileSync,\n statSync as fsStatSync,\n createReadStream as fsCreateReadStream,\n constants as fsConstants,\n} from 'fs'\nimport {\n mkdir as fsMkdir,\n writeFile as fsWriteFile,\n readFile as fsReadFile,\n realpath as fsRealPath,\n appendFile as fsAppendFile,\n mkdtemp as fsMkdtemp,\n stat as fsStat,\n lstat as fsLstat,\n chmod as fsChmod,\n access as fsAccess,\n} from 'fs/promises'\nimport type {Options} from 'prettier'\n\nconst DEFAULT_PRETTIER_CONFIG: Options = {\n arrowParens: 'always',\n singleQuote: true,\n bracketSpacing: false,\n trailingComma: 'all',\n}\n\nexport function stripUp(path: string, strip: number) {\n const parts = path.split(sep)\n return join(...parts.slice(strip))\n}\n\n/**\n * Creates a temporary directory and ties its lifecycle to the lifecycle of the callback.\n * @param callback - The callback that receives the temporary directory.\n */\nexport async function inTemporaryDirectory<T>(callback: (tmpDir: string) => T | Promise<T>): Promise<T> {\n return temporaryDirectoryTask(callback)\n}\n\n/**\n * It reads a file and returns its content as a string using the\n * utf-8 encoding\n * @param path - Path to the file to read.\n * @returns A promise that resolves with the content of the file.\n */\n\nexport type ReadOptions =\n | undefined\n | {flag?: string | undefined}\n | {\n encoding: BufferEncoding | string\n flag?: string | undefined\n }\nexport async function read(path: string, options?: ReadOptions): Promise<string>\nexport async function read(path: string, options?: ReadOptions): Promise<Buffer>\n\nexport async function read(path: string, options: ReadOptions = {encoding: 'utf8'}): Promise<string | Buffer> {\n debug(outputContent`Reading the content of file at ${token.path(path)}...`)\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return fsReadFile(path, options)\n}\n\n/**\n * Given a path, it determines the actual path. This is useful when working\n * with paths that represent symlinks.\n * @param path - Path whose real path will be returned.\n */\nexport async function realpath(path: string): Promise<string> {\n return fsRealPath(path)\n}\n\nexport function readSync(path: string, options: object = {encoding: 'utf-8'}): string {\n debug(outputContent`Sync-reading the content of file at ${token.path(path)}...`)\n const content = fsReadFileSync(path, options)\n return content.toString()\n}\n\n/**\n * Copies a file\n * @param from - Path to the directory or file to be copied.\n * @param to - Destination path.\n */\nexport async function copy(from: string, to: string): Promise<void> {\n debug(outputContent`Copying file from ${token.path(from)} to ${token.path(to)}...`)\n await fsCopy(from, to)\n}\n\nexport async function touch(path: string): Promise<void> {\n debug(outputContent`Creating an empty file at ${token.path(path)}...`)\n await fsEnsureFile(path)\n}\n\nexport async function appendFile(path: string, content: string): Promise<void> {\n debug(outputContent`Appending the following content to ${token.path(path)}:\n ${content\n .split('\\n')\n .map((line) => ` ${line}`)\n .join('\\n')}\n `)\n await fsAppendFile(path, content)\n}\n\nexport function touchSync(path: string) {\n debug(outputContent`Creating an empty file at ${token.path(path)}...`)\n fsEnsureFileSync(path)\n}\n\nexport async function write(path: string, data: string): Promise<void> {\n debug(outputContent`Writing some content to file at ${token.path(path)}...`)\n await fsWriteFile(path, data, {encoding: 'utf8'})\n}\n\nexport function writeSync(path: string, data: string): void {\n debug(outputContent`File-writing some content to file at ${token.path(path)}...`)\n fsWriteFileSync(path, data)\n}\n\nexport async function append(path: string, data: string): Promise<void> {\n await fsAppendFile(path, data)\n}\n\nexport function appendSync(path: string, data: string): void {\n fsAppendFileSync(path, data)\n}\n\nexport async function mkdir(path: string): Promise<void> {\n debug(outputContent`Creating directory at ${token.path(path)}...`)\n await fsMkdir(path, {recursive: true})\n}\n\nexport function mkdirSync(path: string): void {\n debug(outputContent`Sync-creating directory at ${token.path(path)}...`)\n fsMkdirSync(path, {recursive: true})\n}\n\nexport async function remove(path: string): Promise<void> {\n debug(outputContent`Removing file at ${token.path(path)}...`)\n await fsRemove(path)\n}\n\nexport function removeSync(path: string) {\n debug(outputContent`Sync-removing file at ${token.path(path)}...`)\n fsRemoveSync(path)\n}\n\nexport async function rmdir(path: string, {force}: {force?: boolean} = {}): Promise<void> {\n const {default: del} = await import('del')\n debug(outputContent`Removing directory at ${token.path(path)}...`)\n await del(path, {force})\n}\n\nexport async function mkTmpDir(): Promise<string> {\n debug(outputContent`Creating a temporary directory...`)\n const directory = await fsMkdtemp('tmp-')\n return directory\n}\n\nexport async function isDirectory(path: string): Promise<boolean> {\n debug(outputContent`Checking if ${token.path(path)} is a directory...`)\n return (await fsLstat(path)).isDirectory()\n}\n\nexport async function size(path: string): Promise<number> {\n debug(outputContent`Getting the size of file file at ${token.path(path)}...`)\n return (await fsStat(path)).size\n}\n\nexport function sizeSync(path: string): number {\n debug(outputContent`Sync-getting the size of file file at ${token.path(path)}...`)\n return fsStatSync(path).size\n}\n\nexport function createReadStream(path: string) {\n return fsCreateReadStream(path)\n}\n\n/**\n * Returns the Date object for the last modification of a file.\n * @param path - Path to the directory or file.\n * @returns A unix timestamp.\n */\nexport async function lastUpdated(path: string): Promise<Date> {\n debug(outputContent`Getting last updated timestamp for file at ${token.path(path)}...`)\n return (await fsStat(path)).ctime\n}\n\n/**\n * Returns the unix timestamp of the last modification of a file.\n * @param path - Path to the directory or file.\n * @returns A unix timestamp.\n */\nexport async function lastUpdatedTimestamp(path: string): Promise<number | undefined> {\n try {\n const lastUpdatedDateTime = await lastUpdated(path)\n return lastUpdatedDateTime.getTime()\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return undefined\n }\n}\n\n/**\n * Moves a file.\n * @param src - File to be moved.\n * @param dest - Path to be moved to.\n * @param options - Moving options.\n */\nexport async function move(src: string, dest: string, options: {overwrite?: boolean} = {}): Promise<void> {\n await fsMove(src, dest, options)\n}\n\n/**\n * Changes the permissions of a directory or file.\n * @param path - Path to the file or directory whose permissions will be modified.\n * @param mode - Permissions to set to the file or directory.\n */\nexport async function chmod(path: string, mode: number | string): Promise<void> {\n await fsChmod(path, mode)\n}\n\n/**\n * Checks if a file has executable permissions.\n * @param path - Path to the file whose permissions will be checked.\n */\nexport async function hasExecutablePermissions(path: string): Promise<boolean> {\n try {\n await fsAccess(path, fsConstants.X_OK)\n return true\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return false\n }\n}\n\n/**\n * Returns true if a file or directory exists\n * @param path - Path to the directory or file.\n * @returns True if it exists.\n */\nexport async function exists(path: string): Promise<boolean> {\n try {\n await fsAccess(path)\n return true\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return false\n }\n}\n\n/**\n * Format a string using prettier. Return the formatted content.\n */\nexport async function format(content: string, options: {path: string}) {\n const {default: prettier} = await import('prettier')\n\n const ext = extname(options.path)\n const prettierConfig: Options = {\n ...DEFAULT_PRETTIER_CONFIG,\n parser: 'babel',\n }\n\n switch (ext) {\n case '.html':\n case '.css':\n prettierConfig.parser = ext.slice(1)\n break\n }\n\n const formattedContent = await prettier.format(content, prettierConfig)\n\n return formattedContent\n}\n"]}