@shopify/cli-kit 3.35.0 → 3.36.1

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 (184) hide show
  1. package/dist/content-tokens.js +1 -1
  2. package/dist/content-tokens.js.map +1 -1
  3. package/dist/error.js +2 -2
  4. package/dist/error.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/metadata.d.ts +1 -1
  9. package/dist/metadata.js.map +1 -1
  10. package/dist/monorail.d.ts +1 -1
  11. package/dist/monorail.js +1 -1
  12. package/dist/monorail.js.map +1 -1
  13. package/dist/output.js +0 -4
  14. package/dist/output.js.map +1 -1
  15. package/dist/plugins.d.ts +1 -1
  16. package/dist/plugins.js.map +1 -1
  17. package/dist/{typing → private/common/ts}/deep-required.d.ts +3 -3
  18. package/dist/{typing → private/common/ts}/deep-required.js +0 -0
  19. package/dist/private/common/ts/deep-required.js.map +1 -0
  20. package/dist/{typing → private/common/ts}/overloaded-parameters.d.ts +0 -0
  21. package/dist/{typing → private/common/ts}/overloaded-parameters.js +0 -0
  22. package/dist/private/common/ts/overloaded-parameters.js.map +1 -0
  23. package/dist/private/node/api/graphql.js +1 -2
  24. package/dist/private/node/api/graphql.js.map +1 -1
  25. package/dist/private/node/api/headers.d.ts +9 -0
  26. package/dist/private/node/api/headers.js +26 -0
  27. package/dist/private/node/api/headers.js.map +1 -1
  28. package/dist/private/node/constants.js +3 -3
  29. package/dist/private/node/constants.js.map +1 -1
  30. package/dist/private/node/session/device-authorization.js +1 -1
  31. package/dist/private/node/session/device-authorization.js.map +1 -1
  32. package/dist/private/node/session/exchange.js +1 -1
  33. package/dist/private/node/session/exchange.js.map +1 -1
  34. package/dist/private/node/session/identity-token-validation.js +1 -1
  35. package/dist/private/node/session/identity-token-validation.js.map +1 -1
  36. package/dist/private/node/session/post-auth.js +3 -3
  37. package/dist/private/node/session/post-auth.js.map +1 -1
  38. package/dist/{typing → private/node}/simple-definitions.d.ts +0 -0
  39. package/dist/{typing → private/node}/simple-definitions.js +0 -0
  40. package/dist/private/node/simple-definitions.js.map +1 -0
  41. package/dist/private/node/ui/alert.d.ts +1 -1
  42. package/dist/private/node/ui/alert.js +2 -2
  43. package/dist/private/node/ui/alert.js.map +1 -1
  44. package/dist/private/node/ui/components/Alert.d.ts +5 -0
  45. package/dist/private/node/ui/components/Alert.js +9 -6
  46. package/dist/private/node/ui/components/Alert.js.map +1 -1
  47. package/dist/private/node/ui/components/Alert.test.js +30 -4
  48. package/dist/private/node/ui/components/Alert.test.js.map +1 -1
  49. package/dist/private/node/ui/components/AutocompletePrompt.d.ts +12 -0
  50. package/dist/private/node/ui/components/AutocompletePrompt.js +111 -0
  51. package/dist/private/node/ui/components/AutocompletePrompt.js.map +1 -0
  52. package/dist/private/node/ui/components/AutocompletePrompt.test.d.ts +1 -0
  53. package/dist/private/node/ui/components/AutocompletePrompt.test.js +473 -0
  54. package/dist/private/node/ui/components/AutocompletePrompt.test.js.map +1 -0
  55. package/dist/private/node/ui/components/Banner.d.ts +0 -1
  56. package/dist/private/node/ui/components/Banner.js +4 -4
  57. package/dist/private/node/ui/components/Banner.js.map +1 -1
  58. package/dist/private/node/ui/components/Banner.test.js +10 -5
  59. package/dist/private/node/ui/components/Banner.test.js.map +1 -1
  60. package/dist/private/node/ui/components/FatalError.js +1 -1
  61. package/dist/private/node/ui/components/FatalError.js.map +1 -1
  62. package/dist/private/node/ui/components/FatalError.test.js +4 -8
  63. package/dist/private/node/ui/components/FatalError.test.js.map +1 -1
  64. package/dist/private/node/ui/components/{Table.d.ts → Prompts/InfoTable.d.ts} +2 -2
  65. package/dist/private/node/ui/components/{Table.js → Prompts/InfoTable.js} +6 -6
  66. package/dist/private/node/ui/components/Prompts/InfoTable.js.map +1 -0
  67. package/dist/private/node/ui/components/SelectInput.d.ts +9 -2
  68. package/dist/private/node/ui/components/SelectInput.js +96 -52
  69. package/dist/private/node/ui/components/SelectInput.js.map +1 -1
  70. package/dist/private/node/ui/components/SelectInput.test.js +140 -54
  71. package/dist/private/node/ui/components/SelectInput.test.js.map +1 -1
  72. package/dist/private/node/ui/components/SelectPrompt.d.ts +4 -3
  73. package/dist/private/node/ui/components/SelectPrompt.js +17 -11
  74. package/dist/private/node/ui/components/SelectPrompt.js.map +1 -1
  75. package/dist/private/node/ui/components/SelectPrompt.test.js +113 -23
  76. package/dist/private/node/ui/components/SelectPrompt.test.js.map +1 -1
  77. package/dist/private/node/ui/components/Tasks.d.ts +6 -5
  78. package/dist/private/node/ui/components/Tasks.js +32 -11
  79. package/dist/private/node/ui/components/Tasks.js.map +1 -1
  80. package/dist/private/node/ui/components/Tasks.test.js +55 -9
  81. package/dist/private/node/ui/components/Tasks.test.js.map +1 -1
  82. package/dist/private/node/ui/components/TextInput.d.ts +4 -1
  83. package/dist/private/node/ui/components/TextInput.js +22 -13
  84. package/dist/private/node/ui/components/TextInput.js.map +1 -1
  85. package/dist/private/node/ui/components/TextInput.test.js +47 -40
  86. package/dist/private/node/ui/components/TextInput.test.js.map +1 -1
  87. package/dist/private/node/ui/components/TextPrompt.d.ts +3 -1
  88. package/dist/private/node/ui/components/TextPrompt.js +28 -15
  89. package/dist/private/node/ui/components/TextPrompt.js.map +1 -1
  90. package/dist/private/node/ui/components/TextPrompt.test.js +71 -15
  91. package/dist/private/node/ui/components/TextPrompt.test.js.map +1 -1
  92. package/dist/private/node/ui/components/TokenizedText.d.ts +3 -0
  93. package/dist/private/node/ui/components/TokenizedText.js +33 -1
  94. package/dist/private/node/ui/components/TokenizedText.js.map +1 -1
  95. package/dist/private/node/ui/utilities.d.ts +2 -0
  96. package/dist/private/node/ui/utilities.js +6 -0
  97. package/dist/private/node/ui/utilities.js.map +1 -0
  98. package/dist/{typing → public/common/ts}/pick-by-prefix.d.ts +4 -3
  99. package/dist/{typing → public/common/ts}/pick-by-prefix.js +0 -0
  100. package/dist/public/common/ts/pick-by-prefix.js.map +1 -0
  101. package/dist/public/common/version.d.ts +1 -1
  102. package/dist/public/common/version.js +1 -1
  103. package/dist/public/common/version.js.map +1 -1
  104. package/dist/public/node/api/admin.js +1 -1
  105. package/dist/public/node/api/admin.js.map +1 -1
  106. package/dist/public/node/api/http.d.ts +0 -0
  107. package/dist/public/node/api/http.js +2 -0
  108. package/dist/public/node/api/http.js.map +1 -0
  109. package/dist/public/node/api/oxygen.js +1 -1
  110. package/dist/public/node/api/oxygen.js.map +1 -1
  111. package/dist/public/node/archiver.js +2 -1
  112. package/dist/public/node/archiver.js.map +1 -1
  113. package/dist/public/node/cli.js +2 -2
  114. package/dist/public/node/cli.js.map +1 -1
  115. package/dist/public/node/environment/spin.js +2 -2
  116. package/dist/public/node/environment/spin.js.map +1 -1
  117. package/dist/public/node/error-handler.js +7 -5
  118. package/dist/public/node/error-handler.js.map +1 -1
  119. package/dist/public/node/framework.js +2 -2
  120. package/dist/public/node/framework.js.map +1 -1
  121. package/dist/public/node/fs.d.ts +22 -4
  122. package/dist/public/node/fs.js +34 -6
  123. package/dist/public/node/fs.js.map +1 -1
  124. package/dist/public/node/github.js +1 -1
  125. package/dist/public/node/github.js.map +1 -1
  126. package/dist/{http/fetch.d.ts → public/node/http.d.ts} +18 -7
  127. package/dist/{http/fetch.js → public/node/http.js} +22 -8
  128. package/dist/public/node/http.js.map +1 -0
  129. package/dist/public/node/liquid.js +4 -4
  130. package/dist/public/node/liquid.js.map +1 -1
  131. package/dist/public/node/node-package-manager.d.ts +22 -1
  132. package/dist/public/node/node-package-manager.js +22 -11
  133. package/dist/public/node/node-package-manager.js.map +1 -1
  134. package/dist/public/node/path.d.ts +22 -0
  135. package/dist/{path.js → public/node/path.js} +8 -20
  136. package/dist/public/node/path.js.map +1 -0
  137. package/dist/public/node/presets.js +4 -4
  138. package/dist/public/node/presets.js.map +1 -1
  139. package/dist/public/node/ruby.js +23 -27
  140. package/dist/public/node/ruby.js.map +1 -1
  141. package/dist/public/node/ui.d.ts +50 -9
  142. package/dist/public/node/ui.js +69 -8
  143. package/dist/public/node/ui.js.map +1 -1
  144. package/dist/public/node/vscode.js +4 -4
  145. package/dist/public/node/vscode.js.map +1 -1
  146. package/dist/testing/ui.d.ts +4 -1
  147. package/dist/testing/ui.js +24 -1
  148. package/dist/testing/ui.js.map +1 -1
  149. package/dist/tsconfig.tsbuildinfo +1 -1
  150. package/dist/ui/executor.d.ts +2 -14
  151. package/dist/ui/executor.js +38 -72
  152. package/dist/ui/executor.js.map +1 -1
  153. package/dist/ui.js +6 -23
  154. package/dist/ui.js.map +1 -1
  155. package/package.json +3 -5
  156. package/dist/http/fetch.js.map +0 -1
  157. package/dist/http/formdata.d.ts +0 -3
  158. package/dist/http/formdata.js +0 -6
  159. package/dist/http/formdata.js.map +0 -1
  160. package/dist/http.d.ts +0 -26
  161. package/dist/http.js +0 -31
  162. package/dist/http.js.map +0 -1
  163. package/dist/npm.d.ts +0 -27
  164. package/dist/npm.js +0 -20
  165. package/dist/npm.js.map +0 -1
  166. package/dist/path.d.ts +0 -25
  167. package/dist/path.js.map +0 -1
  168. package/dist/private/node/ui/components/Table.js.map +0 -1
  169. package/dist/typing/deep-required.js.map +0 -1
  170. package/dist/typing/overloaded-parameters.js.map +0 -1
  171. package/dist/typing/pick-by-prefix.js.map +0 -1
  172. package/dist/typing/simple-definitions.js.map +0 -1
  173. package/dist/ui/inquirer/autocomplete.d.ts +0 -11
  174. package/dist/ui/inquirer/autocomplete.js +0 -110
  175. package/dist/ui/inquirer/autocomplete.js.map +0 -1
  176. package/dist/ui/inquirer/input.d.ts +0 -16
  177. package/dist/ui/inquirer/input.js +0 -45
  178. package/dist/ui/inquirer/input.js.map +0 -1
  179. package/dist/ui/inquirer/password.d.ts +0 -7
  180. package/dist/ui/inquirer/password.js +0 -8
  181. package/dist/ui/inquirer/password.js.map +0 -1
  182. package/dist/ui/inquirer/select.d.ts +0 -14
  183. package/dist/ui/inquirer/select.js +0 -26
  184. package/dist/ui/inquirer/select.js.map +0 -1
@@ -1,14 +1,2 @@
1
- import { Question, QuestionChoiceType } from '../ui.js';
2
- export declare function run<TName extends string & keyof TAnswers, TAnswers extends {
3
- [key in TName]: string;
4
- } = {
5
- [key in TName]: string;
6
- }>(question: unknown): Promise<TAnswers>;
7
- export declare function mapper(question: Question): unknown;
8
- export declare function groupAndMapChoices(choices: QuestionChoiceType[]): ({
9
- type: string;
10
- line: string;
11
- } | {
12
- name: string;
13
- value: string;
14
- })[];
1
+ import { Question } from '../ui.js';
2
+ export declare function run(question: Question): Promise<string>;
@@ -1,90 +1,56 @@
1
- import { CustomInput } from './inquirer/input.js';
2
- import { CustomAutocomplete } from './inquirer/autocomplete.js';
3
- import { CustomSelect } from './inquirer/select.js';
4
- import { CustomPassword } from './inquirer/password.js';
5
- import inquirer from 'inquirer';
6
- import fuzzy from 'fuzzy';
1
+ import { renderAutocompletePrompt, renderSelectPrompt, renderTextPrompt } from '@shopify/cli-kit/node/ui';
7
2
  export async function run(question) {
8
- const questionName = question.name;
9
- return (await inquirer.prompt(question, { ...question.choices }))[questionName];
10
- }
11
- export function mapper(question) {
3
+ let mappedQuestion;
12
4
  switch (question.type) {
13
5
  case 'input':
14
- inquirer.registerPrompt('custom-input', CustomInput);
15
- return {
6
+ mappedQuestion = {
16
7
  ...question,
17
- type: 'custom-input',
8
+ defaultValue: question.default,
9
+ validate: question.validate
10
+ ? (value) => {
11
+ const error = question.validate(value);
12
+ return typeof error === 'string' ? error : undefined;
13
+ }
14
+ : undefined,
18
15
  };
16
+ return renderTextPrompt(mappedQuestion);
19
17
  case 'password':
20
- inquirer.registerPrompt('custom-password', CustomPassword);
21
- return {
18
+ mappedQuestion = {
22
19
  ...question,
23
- type: 'custom-password',
20
+ password: true,
21
+ validate: question.validate
22
+ ? (value) => {
23
+ const error = question.validate(value);
24
+ return typeof error === 'string' ? error : undefined;
25
+ }
26
+ : undefined,
24
27
  };
28
+ return renderTextPrompt(mappedQuestion);
25
29
  case 'select':
26
- inquirer.registerPrompt('custom-select', CustomSelect);
27
- return {
30
+ mappedQuestion = {
28
31
  ...question,
29
- type: 'custom-select',
30
- source: getAutocompleteFilterType(),
31
- choices: question.choices ? groupAndMapChoices(question.choices) : undefined,
32
+ defaultValue: question.default,
33
+ choices: question.choices.map((choice) => {
34
+ return {
35
+ label: choice.name,
36
+ value: choice.value,
37
+ group: choice.group?.name,
38
+ };
39
+ }),
32
40
  };
41
+ return renderSelectPrompt(mappedQuestion);
33
42
  case 'autocomplete': {
34
- inquirer.registerPrompt('autocomplete', CustomAutocomplete);
35
- const filterType = getAutocompleteFilterType();
36
- return {
43
+ mappedQuestion = {
37
44
  ...question,
38
- type: 'autocomplete',
39
- source: question.source ? question.source(filterType) : filterType,
45
+ choices: question.choices.map((choice) => {
46
+ return {
47
+ label: choice.name,
48
+ value: choice.value,
49
+ };
50
+ }),
40
51
  };
52
+ return renderAutocompletePrompt(mappedQuestion);
41
53
  }
42
54
  }
43
55
  }
44
- function fuzzyFilter(answers, input = '') {
45
- return new Promise((resolve) => {
46
- resolve(fuzzy
47
- .filter(input, Object.values(answers), {
48
- extract(el) {
49
- return el.name;
50
- },
51
- })
52
- .map((el) => el.original));
53
- });
54
- }
55
- function containsFilter(answers, input = '') {
56
- return new Promise((resolve) => {
57
- resolve(Object.values(answers).filter((answer) => !answer.name || answer.name.toLowerCase().includes(input.toLowerCase())));
58
- });
59
- }
60
- function getAutocompleteFilterType() {
61
- return process.env.SHOPIFY_USE_AUTOCOMPLETE_FILTER === 'fuzzy' ? fuzzyFilter : containsFilter;
62
- }
63
- export function groupAndMapChoices(choices) {
64
- const initialGroups = [];
65
- // Switched from choices with group information to groups with a list of choices
66
- const groups = choices.reduce((finalChoices, choice) => {
67
- const currentGroup = choice.group ?? { name: 'Other', order: Number.MAX_SAFE_INTEGER };
68
- const existingGroup = finalChoices.find((group) => group.name === currentGroup.name);
69
- if (existingGroup) {
70
- existingGroup.choices.push(choice);
71
- }
72
- else {
73
- finalChoices.push({ ...currentGroup, choices: [choice] });
74
- }
75
- return finalChoices;
76
- }, initialGroups);
77
- const sortedGroups = groups.sort((g1, g2) => g1.order - g2.order);
78
- const grouped = sortedGroups.length > 1 || sortedGroups[0].order !== Number.MAX_SAFE_INTEGER;
79
- // Mapped the group with a list of extensions to a list of inquirer choices including group separators
80
- return sortedGroups.flatMap((group) => {
81
- const finalChoices = [];
82
- if (grouped && group.name) {
83
- finalChoices.push({ type: 'separator', line: '' });
84
- finalChoices.push({ type: 'separator', line: group.name });
85
- }
86
- finalChoices.push(...group.choices);
87
- return finalChoices;
88
- });
89
- }
90
56
  //# sourceMappingURL=executor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../src/ui/executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAC,kBAAkB,EAAC,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAA;AACjD,OAAO,EAAC,cAAc,EAAC,MAAM,wBAAwB,CAAA;AAErD,OAAO,QAAuC,MAAM,UAAU,CAAA;AAC9D,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,MAAM,CAAC,KAAK,UAAU,GAAG,CAGvB,QAAiB;IACjB,MAAM,YAAY,GAAI,QAAqB,CAAC,IAAI,CAAA;IAChD,OAAO,CAAC,MAAM,QAAQ,CAAC,MAAM,CAAC,QAAuC,EAAE,EAAC,GAAI,QAAqB,CAAC,OAAO,EAAC,CAAC,CAAC,CAC1G,YAAY,CACb,CAAA;AACH,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,QAAkB;IACvC,QAAQ,QAAQ,CAAC,IAAI,EAAE;QACrB,KAAK,OAAO;YACV,QAAQ,CAAC,cAAc,CAAC,cAAc,EAAE,WAAW,CAAC,CAAA;YACpD,OAAO;gBACL,GAAG,QAAQ;gBACX,IAAI,EAAE,cAAc;aACrB,CAAA;QACH,KAAK,UAAU;YACb,QAAQ,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AE,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC,CAAA;IACjE,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,GAAG,CAAC,IAAI,YAAY,CAAC,CAAC,CAAE,CAAC,KAAK,KAAK,MAAM,CAAC,gBAAgB,CAAA;IAE7F,sGAAsG;IACtG,OAAO,YAAY,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QACpC,MAAM,YAAY,GAAqE,EAAE,CAAA;QACzF,IAAI,OAAO,IAAI,KAAK,CAAC,IAAI,EAAE;YACzB,YAAY,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,EAAC,CAAC,CAAA;YAChD,YAAY,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAC,CAAC,CAAA;SACzD;QACD,YAAY,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,CAAA;QACnC,OAAO,YAAY,CAAA;IACrB,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {CustomInput} from './inquirer/input.js'\nimport {CustomAutocomplete} from './inquirer/autocomplete.js'\nimport {CustomSelect} from './inquirer/select.js'\nimport {CustomPassword} from './inquirer/password.js'\nimport {PromptAnswer, Question, QuestionChoiceType} from '../ui.js'\nimport inquirer, {Answers, QuestionCollection} from 'inquirer'\nimport fuzzy from 'fuzzy'\n\nexport async function run<\n TName extends string & keyof TAnswers,\n TAnswers extends {[key in TName]: string} = {[key in TName]: string},\n>(question: unknown): Promise<TAnswers> {\n const questionName = (question as Question).name\n return (await inquirer.prompt(question as QuestionCollection<Answers>, {...(question as Question).choices}))[\n questionName\n ]\n}\n\nexport function mapper(question: Question): unknown {\n switch (question.type) {\n case 'input':\n inquirer.registerPrompt('custom-input', CustomInput)\n return {\n ...question,\n type: 'custom-input',\n }\n case 'password':\n inquirer.registerPrompt('custom-password', CustomPassword)\n return {\n ...question,\n type: 'custom-password',\n }\n case 'select':\n inquirer.registerPrompt('custom-select', CustomSelect)\n return {\n ...question,\n type: 'custom-select',\n source: getAutocompleteFilterType(),\n choices: question.choices ? groupAndMapChoices(question.choices) : undefined,\n }\n case 'autocomplete': {\n inquirer.registerPrompt('autocomplete', CustomAutocomplete)\n const filterType = getAutocompleteFilterType()\n return {\n ...question,\n type: 'autocomplete',\n source: question.source ? question.source(filterType) : filterType,\n }\n }\n }\n}\n\nfunction fuzzyFilter(answers: {name: string; value: string}[], input = ''): Promise<PromptAnswer[]> {\n return new Promise((resolve) => {\n resolve(\n fuzzy\n .filter(input, Object.values(answers), {\n extract(el: {name: string; value: string}) {\n return el.name\n },\n })\n .map((el) => el.original),\n )\n })\n}\n\nfunction containsFilter(answers: {name: string; value: string}[], input = ''): Promise<PromptAnswer[]> {\n return new Promise((resolve) => {\n resolve(\n Object.values(answers).filter(\n (answer) => !answer.name || answer.name.toLowerCase().includes(input.toLowerCase()),\n ),\n )\n })\n}\n\nfunction getAutocompleteFilterType() {\n return process.env.SHOPIFY_USE_AUTOCOMPLETE_FILTER === 'fuzzy' ? fuzzyFilter : containsFilter\n}\n\nexport function groupAndMapChoices(choices: QuestionChoiceType[]) {\n const initialGroups: {name?: string; order: number; choices: {name: string; value: string; order?: number}[]}[] = []\n\n // Switched from choices with group information to groups with a list of choices\n const groups = choices.reduce((finalChoices, choice) => {\n const currentGroup = choice.group ?? {name: 'Other', order: Number.MAX_SAFE_INTEGER}\n const existingGroup = finalChoices.find((group) => group.name === currentGroup.name)\n if (existingGroup) {\n existingGroup.choices.push(choice)\n } else {\n finalChoices.push({...currentGroup, choices: [choice]})\n }\n return finalChoices\n }, initialGroups)\n\n const sortedGroups = groups.sort((g1, g2) => g1.order - g2.order)\n const grouped = sortedGroups.length > 1 || sortedGroups[0]!.order !== Number.MAX_SAFE_INTEGER\n\n // Mapped the group with a list of extensions to a list of inquirer choices including group separators\n return sortedGroups.flatMap((group) => {\n const finalChoices: ({type: string; line: string} | {name: string; value: string})[] = []\n if (grouped && group.name) {\n finalChoices.push({type: 'separator', line: ''})\n finalChoices.push({type: 'separator', line: group.name})\n }\n finalChoices.push(...group.choices)\n return finalChoices\n })\n}\n"]}
1
+ {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../src/ui/executor.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,wBAAwB,EAAE,kBAAkB,EAAE,gBAAgB,EAAC,MAAM,0BAA0B,CAAA;AAEvG,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,QAAkB;IAC1C,IAAI,cAAc,CAAA;IAElB,QAAQ,QAAQ,CAAC,IAAI,EAAE;QACrB,KAAK,OAAO;YACV,cAAc,GAAG;gBACf,GAAG,QAAQ;gBACX,YAAY,EAAE,QAAQ,CAAC,OAAO;gBAC9B,QAAQ,EAAE,QAAQ,CAAC,QAAQ;oBACzB,CAAC,CAAC,CAAC,KAAa,EAAE,EAAE;wBAChB,MAAM,KAAK,GAAG,QAAQ,CAAC,QAAS,CAAC,KAAK,CAAC,CAAA;wBACvC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAA;oBACtD,CAAC;oBACH,CAAC,CAAC,SAAS;aACd,CAAA;YAED,OAAO,gBAAgB,CAAC,cAAc,CAAC,CAAA;QACzC,KAAK,UAAU;YACb,cAAc,GAAG;gBACf,GAAG,QAAQ;gBACX,QAAQ,EAAE,IAAI;gBACd,QAAQ,EAAE,QAAQ,CAAC,QAAQ;oBACzB,CAAC,CAAC,CAAC,KAAa,EAAE,EAAE;wBAChB,MAAM,KAAK,GAAG,QAAQ,CAAC,QAAS,CAAC,KAAK,CAAC,CAAA;wBACvC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAA;oBACtD,CAAC;oBACH,CAAC,CAAC,SAAS;aACd,CAAA;YAED,OAAO,gBAAgB,CAAC,cAAc,CAAC,CAAA;QACzC,KAAK,QAAQ;YACX,cAAc,GAAG;gBACf,GAAG,QAAQ;gBACX,YAAY,EAAE,QAAQ,CAAC,OAAO;gBAC9B,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;oBACvC,OAAO;wBACL,KAAK,EAAE,MAAM,CAAC,IAAI;wBAClB,KAAK,EAAE,MAAM,CAAC,KAAK;wBACnB,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,IAAI;qBAC1B,CAAA;gBACH,CAAC,CAAC;aACH,CAAA;YAED,OAAO,kBAAkB,CAAC,cAAc,CAAC,CAAA;QAC3C,KAAK,cAAc,CAAC,CAAC;YACnB,cAAc,GAAG;gBACf,GAAG,QAAQ;gBACX,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;oBACvC,OAAO;wBACL,KAAK,EAAE,MAAM,CAAC,IAAI;wBAClB,KAAK,EAAE,MAAM,CAAC,KAAK;qBACpB,CAAA;gBACH,CAAC,CAAC;aACH,CAAA;YAED,OAAO,wBAAwB,CAAC,cAAc,CAAC,CAAA;SAChD;KACF;AACH,CAAC","sourcesContent":["import {Question} from '../ui.js'\nimport {renderAutocompletePrompt, renderSelectPrompt, renderTextPrompt} from '@shopify/cli-kit/node/ui'\n\nexport async function run(question: Question): Promise<string> {\n let mappedQuestion\n\n switch (question.type) {\n case 'input':\n mappedQuestion = {\n ...question,\n defaultValue: question.default,\n validate: question.validate\n ? (value: string) => {\n const error = question.validate!(value)\n return typeof error === 'string' ? error : undefined\n }\n : undefined,\n }\n\n return renderTextPrompt(mappedQuestion)\n case 'password':\n mappedQuestion = {\n ...question,\n password: true,\n validate: question.validate\n ? (value: string) => {\n const error = question.validate!(value)\n return typeof error === 'string' ? error : undefined\n }\n : undefined,\n }\n\n return renderTextPrompt(mappedQuestion)\n case 'select':\n mappedQuestion = {\n ...question,\n defaultValue: question.default,\n choices: question.choices.map((choice) => {\n return {\n label: choice.name,\n value: choice.value,\n group: choice.group?.name,\n }\n }),\n }\n\n return renderSelectPrompt(mappedQuestion)\n case 'autocomplete': {\n mappedQuestion = {\n ...question,\n choices: question.choices.map((choice) => {\n return {\n label: choice.name,\n value: choice.value,\n }\n }),\n }\n\n return renderAutocompletePrompt(mappedQuestion)\n }\n }\n}\n"]}
package/dist/ui.js CHANGED
@@ -2,28 +2,13 @@ import { CancelExecution, Abort, AbortSilent } from './error.js';
2
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
- import { relative } from './path.js';
5
+ import { relativePath } from './public/node/path.js';
6
6
  import { isTerminalInteractive } from './public/node/environment/local.js';
7
- import { mapper as mapperUI, run as executorUI } from './ui/executor.js';
8
- import { Listr as OriginalListr, ListrTaskState } from 'listr2';
7
+ import { run as executorUI } from './ui/executor.js';
8
+ import { Listr as OriginalListr } from 'listr2';
9
9
  import findProcess from 'find-process';
10
10
  export function newListr(tasks, options) {
11
11
  const listr = new OriginalListr(tasks, options);
12
- listr.tasks.forEach((task) => {
13
- const loggedSubtaskTitles = [];
14
- task.renderHook$.subscribe(() => {
15
- if (task.hasSubtasks()) {
16
- const activeSubtasks = task.subtasks.filter((subtask) => {
17
- return [ListrTaskState.PENDING, ListrTaskState.COMPLETED].includes(subtask.state);
18
- });
19
- activeSubtasks.forEach((subtask) => {
20
- if (subtask.title && !loggedSubtaskTitles.includes(subtask.title)) {
21
- loggedSubtaskTitles.push(subtask.title);
22
- }
23
- });
24
- }
25
- });
26
- });
27
12
  return listr;
28
13
  }
29
14
  const started = (content, logger) => {
@@ -56,15 +41,13 @@ The CLI prompted in a non-interactive terminal with the following questions:
56
41
  ${token.json(questions)}
57
42
  `);
58
43
  }
59
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
60
- const mappedQuestions = questions.map(mapperUI);
61
44
  const value = {};
62
- for (const question of mappedQuestions) {
45
+ for (const question of questions) {
63
46
  if (question.preface) {
64
47
  info(question.preface);
65
48
  }
66
49
  // eslint-disable-next-line no-await-in-loop
67
- value[question.name] = await executorUI(question);
50
+ value[question.name] = (await executorUI(question));
68
51
  }
69
52
  return value;
70
53
  };
@@ -74,7 +57,7 @@ export async function nonEmptyDirectoryPrompt(directory) {
74
57
  { name: 'No, don’t delete the files', value: 'abort' },
75
58
  { name: 'Yes, delete the files', value: 'overwrite' },
76
59
  ];
77
- const relativeDirectory = relative(process.cwd(), directory);
60
+ const relativeDirectory = relativePath(process.cwd(), directory);
78
61
  const questions = {
79
62
  type: 'select',
80
63
  name: 'value',
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,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,CAAA;AAC/F,OAAO,WAAW,MAAM,cAAc,CAAA;AAEtC,MAAM,UAAU,QAAQ,CAAC,KAAkB,EAAE,OAAwC;IACnF,MAAM,KAAK,GAAG,IAAI,aAAa,CAA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ent} 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"]}
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,YAAY,EAAC,MAAM,uBAAuB,CAAA;AAClD,OAAO,EAAC,qBAAqB,EAAC,MAAM,oCAAoC,CA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AAE,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 {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 {relativePath} from './public/node/path.js'\nimport {isTerminalInteractive} from './public/node/environment/local.js'\nimport {run as executorUI} from './ui/executor.js'\nimport {Listr as OriginalListr, ListrTask, 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 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 const value = {} as TAnswers\n for (const question of questions) {\n if (question.preface) {\n info(question.preface)\n }\n\n // eslint-disable-next-line no-await-in-loop\n value[question.name] = (await executorUI(question)) as TAnswers[TName]\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 = relativePath(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.35.0",
3
+ "version": "3.36.1",
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": [
@@ -62,7 +62,7 @@
62
62
  "@oclif/core",
63
63
  "../../private/node/environment/utilities.js",
64
64
  "../../private/node/constants.js",
65
- "../../path.js",
65
+ "./path.js",
66
66
  "./system.js"
67
67
  ],
68
68
  "static": [
@@ -94,6 +94,7 @@
94
94
  "envfile": "6.18.0",
95
95
  "execa": "6.0.0",
96
96
  "fast-glob": "3.2.11",
97
+ "figures": "5.0.0",
97
98
  "find-process": "1.4.7",
98
99
  "find-up": "6.2.0",
99
100
  "find-versions": "5.0.0",
@@ -106,8 +107,6 @@
106
107
  "graphql-request": "4.3.0",
107
108
  "h3": "0.7.21",
108
109
  "ink": "3.2.0",
109
- "inquirer": "9.1.4",
110
- "inquirer-autocomplete-prompt": "3.0.0",
111
110
  "is-interactive": "2.0.0",
112
111
  "js-yaml": "4.1.0",
113
112
  "keytar": "7.9.0",
@@ -143,7 +142,6 @@
143
142
  "@types/diff": "^5.0.2",
144
143
  "@types/fs-extra": "9.0.13",
145
144
  "@types/gradient-string": "^1.1.2",
146
- "@types/inquirer": "^9.0.3",
147
145
  "@types/lodash": "4.14.191",
148
146
  "@types/node": "14.17.0",
149
147
  "@types/react": "17.0.2",
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../src/http/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAA;AACrC,OAAO,EAAC,OAAO,EAAE,KAAK,EAAC,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAC,YAAY,EAAE,sBAAsB,EAAC,MAAM,gCAAgC,CAAA;AACnF,OAAO,SAAS,MAAM,YAAY,CAAA;AAClC,OAAO,EAAC,WAAW,EAAC,MAAM,YAAY,CAAA;AAItC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,KAAK,CAAC,GAAgB,EAAE,IAAkB;IACtE,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IAC3C,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,GAAgB,EAAE,IAAkB;IACrE,MAAM,OAAO,GAAgB;QAC3B,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;QACf,OAAO,EAAE;YACP,GAAG,YAAY,EAAE;YACjB,GAAG,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE,CAAC;SACzB;KACF,CAAA;IAED,KAAK,CAAC,OAAO,CAAA;UACL,OAAO,CAAC,MAAM,IAAI,KAAK,mBAAmB,GAAG,CAAC,QAAQ,EAAE;EAChE,sBAAsB,CAAC,CAAC,OAAO,EAAE,OAAO,IAAI,EAAE,CAA+B,CAAC;CAC/E,CAAC,CAAA;IACA,MAAM,EAAE,GAAG,WAAW,CAAC,GAAG,EAAE,CAAA;IAC5B,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,GAAG,EAAE,EAAC,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,UAAU,EAAE,EAAC,CAAC,CAAA;IAC3E,MAAM,EAAE,GAAG,WAAW,CAAC,GAAG,EAAE,CAAA;IAC5B,KAAK,CAAC,cAAc,GAAG,CAAC,QAAQ,EAAE,0BAA0B,QAAQ,CAAC,MAAM,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,CAAA;IAC3G,OAAO,QAAQ,CAAA;AACjB,CAAC","sourcesContent":["import {httpsAgent} from '../http.js'\nimport {content, debug} from '../output.js'\nimport {buildHeaders, sanitizedHeadersOutput} from '../private/node/api/headers.js'\nimport nodeFetch from 'node-fetch'\nimport {performance} from 'perf_hooks'\nimport type {RequestInfo, RequestInit} from 'node-fetch'\n\ntype Response = ReturnType<typeof nodeFetch>\n/**\n * An interface that abstracts way node-fetch. When Node has built-in\n * support for \"fetch\" in the standard library, we can drop the node-fetch\n * dependency from here.\n * Note that we are exposing types from \"node-fetch\". The reason being is that\n * they are consistent with the Web API so if we drop node-fetch in the future\n * it won't require changes from the callers.\n * @param url - This defines the resource that you wish to fetch.\n * @param init - An object containing any custom settings that you want to apply to the request\n * @returns A promise that resolves with the response.\n */\nexport default async function fetch(url: RequestInfo, init?: RequestInit): Response {\n const response = await nodeFetch(url, init)\n return response\n}\n\n/**\n * A fetch function to use with Shopify services. The function ensures the right\n * TLS configuragion is used based on the environment in which the service is running\n * (e.g. spin)\n */\nexport async function shopifyFetch(url: RequestInfo, init?: RequestInit): Response {\n const options: RequestInit = {\n ...(init ?? {}),\n headers: {\n ...buildHeaders(),\n ...(init?.headers ?? {}),\n },\n }\n\n debug(content`\nSending ${options.method ?? 'GET'} request to URL ${url.toString()} and headers:\n${sanitizedHeadersOutput((options?.headers ?? {}) as {[header: string]: string})}\n`)\n const t0 = performance.now()\n const response = await nodeFetch(url, {...init, agent: await httpsAgent()})\n const t1 = performance.now()\n debug(`Request to ${url.toString()} completed with status ${response.status} in ${Math.round(t1 - t0)} ms`)\n return response\n}\n"]}
@@ -1,3 +0,0 @@
1
- import FormData from 'form-data';
2
- declare function formData(): FormData;
3
- export default formData;
@@ -1,6 +0,0 @@
1
- import FormData from 'form-data';
2
- function formData() {
3
- return new FormData();
4
- }
5
- export default formData;
6
- //# sourceMappingURL=formdata.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"formdata.js","sourceRoot":"","sources":["../../src/http/formdata.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,WAAW,CAAA;AAEhC,SAAS,QAAQ;IACf,OAAO,IAAI,QAAQ,EAAE,CAAA;AACvB,CAAC;AAED,eAAe,QAAQ,CAAA","sourcesContent":["import FormData from 'form-data'\n\nfunction formData() {\n return new FormData()\n}\n\nexport default formData\n"]}
package/dist/http.d.ts DELETED
@@ -1,26 +0,0 @@
1
- /// <reference types="node" />
2
- import https from 'https';
3
- export { default as fetch } from './http/fetch.js';
4
- export { shopifyFetch } from './http/fetch.js';
5
- export { default as formData } from './http/formdata.js';
6
- export { createApp, createRouter, IncomingMessage, ServerResponse, CompatibilityEvent, createError, send, sendError, sendRedirect, H3Error, } from 'h3';
7
- /**
8
- * This utility function returns the https.Agent to use for a given service. The agent
9
- * includes the right configuration based on the service's environment. For example,
10
- * if the service is running in a Spin environment, the attribute "rejectUnauthorized" is
11
- * set to false
12
- */
13
- export declare function httpsAgent(): Promise<https.Agent>;
14
- /**
15
- * Spin stores the CA certificate in the keychain and it should be used when sending HTTP
16
- * requests to Spin instances. However, Node doesn't read certificates from the Keychain
17
- * by default, which leads to Shopifolks running into issues that they workaround by setting the
18
- * NODE_TLS_REJECT_UNAUTHORIZED=0 environment variable, which applies to all the HTTP
19
- * requests sent from the CLI (context: https://github.com/nodejs/node/issues/39657)
20
- * This utility function allows controlling the behavior in a per-service level by returning
21
- * the value of for the "rejectUnauthorized" attribute that's used in the https agent.
22
- *
23
- * @returns A promise that resolves with a boolean indicating whether
24
- * unauthorized requests should be rejected or not.
25
- */
26
- export declare function shouldRejectUnauthorizedRequests(): Promise<boolean>;
package/dist/http.js DELETED
@@ -1,31 +0,0 @@
1
- import { Environment, serviceEnvironment } from './private/node/environment/service.js';
2
- import https from 'https';
3
- export { default as fetch } from './http/fetch.js';
4
- export { shopifyFetch } from './http/fetch.js';
5
- export { default as formData } from './http/formdata.js';
6
- export { createApp, createRouter, createError, send, sendError, sendRedirect, H3Error, } from 'h3';
7
- /**
8
- * This utility function returns the https.Agent to use for a given service. The agent
9
- * includes the right configuration based on the service's environment. For example,
10
- * if the service is running in a Spin environment, the attribute "rejectUnauthorized" is
11
- * set to false
12
- */
13
- export async function httpsAgent() {
14
- return new https.Agent({ rejectUnauthorized: await shouldRejectUnauthorizedRequests() });
15
- }
16
- /**
17
- * Spin stores the CA certificate in the keychain and it should be used when sending HTTP
18
- * requests to Spin instances. However, Node doesn't read certificates from the Keychain
19
- * by default, which leads to Shopifolks running into issues that they workaround by setting the
20
- * NODE_TLS_REJECT_UNAUTHORIZED=0 environment variable, which applies to all the HTTP
21
- * requests sent from the CLI (context: https://github.com/nodejs/node/issues/39657)
22
- * This utility function allows controlling the behavior in a per-service level by returning
23
- * the value of for the "rejectUnauthorized" attribute that's used in the https agent.
24
- *
25
- * @returns A promise that resolves with a boolean indicating whether
26
- * unauthorized requests should be rejected or not.
27
- */
28
- export async function shouldRejectUnauthorizedRequests() {
29
- return (await serviceEnvironment()) !== Environment.Spin;
30
- }
31
- //# sourceMappingURL=http.js.map
package/dist/http.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAE,kBAAkB,EAAC,MAAM,uCAAuC,CAAA;AACrF,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAC,OAAO,IAAI,KAAK,EAAC,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAC,OAAO,IAAI,QAAQ,EAAC,MAAM,oBAAoB,CAAA;AAEtD,OAAO,EACL,SAAS,EACT,YAAY,EAIZ,WAAW,EACX,IAAI,EACJ,SAAS,EACT,YAAY,EACZ,OAAO,GACR,MAAM,IAAI,CAAA;AAEX;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU;IAC9B,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,EAAC,kBAAkB,EAAE,MAAM,gCAAgC,EAAE,EAAC,CAAC,CAAA;AACxF,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,gCAAgC;IACpD,OAAO,CAAC,MAAM,kBAAkB,EAAE,CAAC,KAAK,WAAW,CAAC,IAAI,CAAA;AAC1D,CAAC","sourcesContent":["import {Environment, serviceEnvironment} from './private/node/environment/service.js'\nimport https from 'https'\n\nexport {default as fetch} from './http/fetch.js'\nexport {shopifyFetch} from './http/fetch.js'\nexport {default as formData} from './http/formdata.js'\n\nexport {\n createApp,\n createRouter,\n IncomingMessage,\n ServerResponse,\n CompatibilityEvent,\n createError,\n send,\n sendError,\n sendRedirect,\n H3Error,\n} from 'h3'\n\n/**\n * This utility function returns the https.Agent to use for a given service. The agent\n * includes the right configuration based on the service's environment. For example,\n * if the service is running in a Spin environment, the attribute \"rejectUnauthorized\" is\n * set to false\n */\nexport async function httpsAgent() {\n return new https.Agent({rejectUnauthorized: await shouldRejectUnauthorizedRequests()})\n}\n\n/**\n * Spin stores the CA certificate in the keychain and it should be used when sending HTTP\n * requests to Spin instances. However, Node doesn't read certificates from the Keychain\n * by default, which leads to Shopifolks running into issues that they workaround by setting the\n * NODE_TLS_REJECT_UNAUTHORIZED=0 environment variable, which applies to all the HTTP\n * requests sent from the CLI (context: https://github.com/nodejs/node/issues/39657)\n * This utility function allows controlling the behavior in a per-service level by returning\n * the value of for the \"rejectUnauthorized\" attribute that's used in the https agent.\n *\n * @returns A promise that resolves with a boolean indicating whether\n * unauthorized requests should be rejected or not.\n */\nexport async function shouldRejectUnauthorizedRequests(): Promise<boolean> {\n return (await serviceEnvironment()) !== Environment.Spin\n}\n"]}
package/dist/npm.d.ts DELETED
@@ -1,27 +0,0 @@
1
- interface JSON {
2
- [key: string]: JSONValue;
3
- }
4
- declare type JSONValue = string | number | boolean | JSON | JSONValue[];
5
- export interface PackageJSON extends JSON {
6
- name: string;
7
- author: string;
8
- dependencies: {
9
- [key: string]: string;
10
- };
11
- devDependencies: {
12
- [key: string]: string;
13
- };
14
- resolutions: {
15
- [key: string]: string;
16
- };
17
- overrides: {
18
- [key: string]: string;
19
- };
20
- scripts: {
21
- [key: string]: string;
22
- };
23
- }
24
- export declare function readPackageJSON(directory: string): Promise<PackageJSON>;
25
- export declare function writePackageJSON(directory: string, packageJSON: JSON): Promise<void>;
26
- export declare function updateAppData(packageJSON: JSON, name: string): Promise<void>;
27
- export {};
package/dist/npm.js DELETED
@@ -1,20 +0,0 @@
1
- import { join } from './path.js';
2
- import * as file from './public/node/fs.js';
3
- import * as os from './public/node/os.js';
4
- import { debug, token, content } from './output.js';
5
- export async function readPackageJSON(directory) {
6
- debug(content `Reading and decoding the content from package.json at ${token.path(directory)}...`);
7
- const packagePath = join(directory, 'package.json');
8
- const packageJSON = JSON.parse(await file.readFile(packagePath));
9
- return packageJSON;
10
- }
11
- export async function writePackageJSON(directory, packageJSON) {
12
- debug(content `JSON-encoding and writing content to package.json at ${token.path(directory)}...`);
13
- const packagePath = join(directory, 'package.json');
14
- await file.writeFile(packagePath, JSON.stringify(packageJSON, null, 2));
15
- }
16
- export async function updateAppData(packageJSON, name) {
17
- packageJSON.name = name;
18
- packageJSON.author = (await os.username()) ?? '';
19
- }
20
- //# sourceMappingURL=npm.js.map
package/dist/npm.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"npm.js","sourceRoot":"","sources":["../src/npm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,KAAK,IAAI,MAAM,qBAAqB,CAAA;AAC3C,OAAO,KAAK,EAAE,MAAM,qBAAqB,CAAA;AACzC,OAAO,EAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAC,MAAM,aAAa,CAAA;AAkBjD,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,SAAiB;IACrD,KAAK,CAAC,OAAO,CAAA,yDAAyD,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;IACjG,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAA;IACnD,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAA;IAEhE,OAAO,WAAW,CAAA;AACpB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,SAAiB,EAAE,WAAiB;IACzE,KAAK,CAAC,OAAO,CAAA,wDAAwD,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;IAChG,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAA;IACnD,MAAM,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;AACzE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,WAAiB,EAAE,IAAY;IACjE,WAAW,CAAC,IAAI,GAAG,IAAI,CAAA;IACvB,WAAW,CAAC,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAA;AAClD,CAAC","sourcesContent":["import {join} from './path.js'\nimport * as file from './public/node/fs.js'\nimport * as os from './public/node/os.js'\nimport {debug, token, content} from './output.js'\n\ninterface JSON {\n [key: string]: JSONValue\n}\n\ntype JSONValue = string | number | boolean | JSON | JSONValue[]\n\nexport interface PackageJSON extends JSON {\n name: string\n author: string\n dependencies: {[key: string]: string}\n devDependencies: {[key: string]: string}\n resolutions: {[key: string]: string}\n overrides: {[key: string]: string}\n scripts: {[key: string]: string}\n}\n\nexport async function readPackageJSON(directory: string): Promise<PackageJSON> {\n debug(content`Reading and decoding the content from package.json at ${token.path(directory)}...`)\n const packagePath = join(directory, 'package.json')\n const packageJSON = JSON.parse(await file.readFile(packagePath))\n\n return packageJSON\n}\n\nexport async function writePackageJSON(directory: string, packageJSON: JSON): Promise<void> {\n debug(content`JSON-encoding and writing content to package.json at ${token.path(directory)}...`)\n const packagePath = join(directory, 'package.json')\n await file.writeFile(packagePath, JSON.stringify(packageJSON, null, 2))\n}\n\nexport async function updateAppData(packageJSON: JSON, name: string): Promise<void> {\n packageJSON.name = name\n packageJSON.author = (await os.username()) ?? ''\n}\n"]}
package/dist/path.d.ts DELETED
@@ -1,25 +0,0 @@
1
- /// <reference types="node" />
2
- import { OverloadParameters } from './typing/overloaded-parameters.js';
3
- import { relative, dirname, join, normalize, resolve, basename, extname, isAbsolute, parse } from 'pathe';
4
- import { findUp as internalFindUp } from 'find-up';
5
- import type { URL } from 'url';
6
- import type { Pattern, Options } from 'fast-glob';
7
- export { join, relative, dirname, normalize, resolve, basename, extname, isAbsolute, parse };
8
- export declare function glob(pattern: Pattern | Pattern[], options?: Options): Promise<string[]>;
9
- export { pathToFileURL } from 'url';
10
- export declare function findUp(matcher: OverloadParameters<typeof internalFindUp>[0], options: OverloadParameters<typeof internalFindUp>[1]): ReturnType<typeof internalFindUp>;
11
- /**
12
- * Given an absolute filesystem path, it makes it relative to
13
- * the current working directory. This is useful when logging paths
14
- * to allow the users to click on the file and let the OS open it
15
- * in the editor of choice.
16
- * @param path - Path to relativize
17
- * @returns Relativized path.
18
- */
19
- export declare function relativize(path: string, cwd?: string): string;
20
- /**
21
- * Given a module's import.meta.url it returns the directory containing the module.
22
- * @param moduleURL - The value of import.meta.url in the context of the caller module.
23
- * @returns The path to the directory containing the caller module.
24
- */
25
- export declare function moduleDirectory(moduleURL: string | URL): string;
package/dist/path.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"path.js","sourceRoot":"","sources":["../src/path.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,WAAW,CAAA;AACjC,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAC,MAAM,OAAO,CAAA;AACvG,OAAO,EAAC,MAAM,IAAI,cAAc,EAAC,MAAM,SAAS,CAAA;AAChD,OAAO,EAAC,aAAa,EAAC,MAAM,KAAK,CAAA;AAKjC,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAC,CAAA;AAE1F,MAAM,CAAC,KAAK,UAAU,IAAI,C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AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,SAAuB;IACrD,OAAO,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAA;AAC1C,CAAC","sourcesContent":["import {OverloadParameters} from './typing/overloaded-parameters.js'\nimport commondir from 'commondir'\nimport {relative, dirname, join, normalize, resolve, basename, extname, isAbsolute, parse} from 'pathe'\nimport {findUp as internalFindUp} from 'find-up'\nimport {fileURLToPath} from 'url'\n// eslint-disable-next-line node/prefer-global/url\nimport type {URL} from 'url'\nimport type {Pattern, Options} from 'fast-glob'\n\nexport {join, relative, dirname, normalize, resolve, basename, extname, isAbsolute, parse}\n\nexport async function glob(pattern: Pattern | Pattern[], options?: Options): Promise<string[]> {\n const {default: fastGlob} = await import('fast-glob')\n let overridenOptions = options\n if (options?.dot == null) {\n overridenOptions = {...options, dot: true}\n }\n return fastGlob(pattern, overridenOptions)\n}\nexport {pathToFileURL} from 'url'\n\nexport async function findUp(\n matcher: OverloadParameters<typeof internalFindUp>[0],\n options: OverloadParameters<typeof internalFindUp>[1],\n): ReturnType<typeof internalFindUp> {\n // findUp has odd typing\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const got = await internalFindUp(matcher as any, options)\n return got ? normalize(got) : undefined\n}\n\n/**\n * Given an absolute filesystem path, it makes it relative to\n * the current working directory. This is useful when logging paths\n * to allow the users to click on the file and let the OS open it\n * in the editor of choice.\n * @param path - Path to relativize\n * @returns Relativized path.\n */\nexport function relativize(path: string, cwd: string = process.cwd()): string {\n const result = commondir([path, cwd])\n const relativePath = relative(cwd, path)\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const relativeComponents = relativePath.split('/').filter((component) => component === '..').length\n if (result === '/' || relativePath === '' || relativeComponents > 2) {\n return path\n } else {\n return relativePath\n }\n}\n\n/**\n * Given a module's import.meta.url it returns the directory containing the module.\n * @param moduleURL - The value of import.meta.url in the context of the caller module.\n * @returns The path to the directory containing the caller module.\n */\nexport function moduleDirectory(moduleURL: string | URL): string {\n return dirname(fileURLToPath(moduleURL))\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Table.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,EAAC,UAAU,EAAC,MAAM,qCAAqC,CAAA;AAC9D,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,MAAM,KAAK,CAAA;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAA;AAQzB,MAAM,KAAK,GAAoB,CAAC,EAAC,KAAK,EAAC,EAAE,EAAE;IACzC,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAClC,MAAM,iBAAiB,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA;IAE7E,OAAO,CACL,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,QAAQ,EAAE,CAAC,IACpC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAC9B,oBAAC,GAAG,IAAC,GAAG,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,KAAK,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACjE,oBAAC,GAAG,IAAC,KAAK,EAAE,iBAAiB,GAAG,CAAC;YAC/B,oBAAC,IAAI;gBAAE,UAAU,CAAC,MAAM,CAAC;oBAAS,CAC9B;QACN,oBAAC,GAAG,IAAC,QAAQ,EAAE,CAAC;YACd,oBAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAE,GAAI,CAC3B,CACF,CACP,CAAC,CACE,CACP,CAAA;AACH,CAAC,CAAA;AAED,eAAe,KAAK,CAAA","sourcesContent":["import {List} from './List.js'\nimport {capitalize} from '../../../../public/common/string.js'\nimport {Box, Text} from 'ink'\nimport React from 'react'\n\nexport interface Props {\n table: {\n [header: string]: string[]\n }\n}\n\nconst Table: React.FC<Props> = ({table}) => {\n const headers = Object.keys(table)\n const headerColumnWidth = Math.max(...headers.map((header) => header.length))\n\n return (\n <Box flexDirection=\"column\" paddingY={1}>\n {headers.map((header, index) => (\n <Box key={index} marginBottom={index === headers.length - 1 ? 0 : 1}>\n <Box width={headerColumnWidth + 1}>\n <Text>{capitalize(header)}:</Text>\n </Box>\n <Box flexGrow={1}>\n <List items={table[header]!} />\n </Box>\n </Box>\n ))}\n </Box>\n )\n}\n\nexport default Table\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"deep-required.js","sourceRoot":"","sources":["../../src/typing/deep-required.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Converts a mapping type to be non-optional\n *\n * ```\n * type T = DeepRequired<{optionalKey?: string, nullableValue: string | null, undefinableValue: string | undefined}>\n * T = {optionalKey: string, nullableValue: string, undefinableValue: string}\n * ```\n *\n */\nexport type DeepRequired<T> = {\n [TKey in keyof Required<T>]: NonNullable<Required<T>[TKey]>\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"overloaded-parameters.js","sourceRoot":"","sources":["../../src/typing/overloaded-parameters.ts"],"names":[],"mappings":"","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\ntype OverloadProps<TOverload> = Pick<TOverload, keyof TOverload>\n\n// Prevent infinite recursion by stopping recursion when TPartialOverload\n// has accumulated all of the TOverload signatures.\ntype OverloadUnionRecursive<TOverload, TPartialOverload = unknown> = TOverload extends (\n ...args: infer TArgs\n) => infer TReturn\n ? TPartialOverload extends TOverload\n ? never\n :\n | OverloadUnionRecursive<\n TPartialOverload & TOverload,\n TPartialOverload & ((...args: TArgs) => TReturn) & OverloadProps<TOverload>\n >\n | ((...args: TArgs) => TReturn)\n : never\n\n// The \"() => never\" signature must be hoisted to the \"front\" of the\n// intersection, for two reasons: a) because recursion stops when it is\n// encountered, and b) it seems to prevent the collapse of subsequent\n// \"compatible\" signatures (eg. \"() => void\" into \"(a?: 1) => void\"),\n// which gives a direct conversion to a union.\ntype OverloadUnion<TOverload extends (...args: any[]) => any> = Exclude<\n OverloadUnionRecursive<(() => never) & TOverload>,\n TOverload extends () => never ? never : () => never\n>\n\n// Inferring a union of parameter tuples or return types is now possible.\nexport type OverloadParameters<T extends (...args: any[]) => any> = Parameters<OverloadUnion<T>>\nexport type OverloadReturnType<T extends (...args: any[]) => any> = ReturnType<OverloadUnion<T>>\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"pick-by-prefix.js","sourceRoot":"","sources":["../../src/typing/pick-by-prefix.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Produces a subset of a mapping type, where the keys either match some prefix string, or are in a list of exact matches\n *\n * ```\n * type T = PickByPrefix<{foo_1: number, foo_2: number, nope: string, included: string, also: number}, 'foo_', 'included' | 'also'>\n *\n * T = {foo_1: number, foo_2: number, included: string, also: number}\n * ```\n */\nexport type PickByPrefix<TMapping, TPrefix extends string, TKeys extends keyof TMapping = never> = {\n [TKey in keyof TMapping as TKey extends `${TPrefix}${infer _TSuffix}` | TKeys ? TKey : never]: TMapping[TKey]\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"simple-definitions.js","sourceRoot":"","sources":["../../src/typing/simple-definitions.ts"],"names":[],"mappings":"","sourcesContent":["declare module 'color-json' {\n function colour(content: string | object): string\n export default colour\n}\n"]}
@@ -1,11 +0,0 @@
1
- /// <reference types="node" />
2
- import AutocompletePrompt from 'inquirer-autocomplete-prompt';
3
- import { Question, Answers } from 'inquirer';
4
- import { Interface } from 'readline';
5
- export declare class CustomAutocomplete extends AutocompletePrompt {
6
- protected isAutocomplete: boolean;
7
- constructor(questions: Question<Answers>, rl: Interface, answers: Answers);
8
- protected render(error?: string): void;
9
- protected getQuestion(): string;
10
- protected prefix(): string;
11
- }