@shopify/cli-kit 3.31.1 → 3.32.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 (170) hide show
  1. package/README.md +1 -1
  2. package/dist/constants.d.ts +1 -0
  3. package/dist/constants.js +1 -0
  4. package/dist/constants.js.map +1 -1
  5. package/dist/environment/local.d.ts +1 -0
  6. package/dist/environment/local.js +4 -1
  7. package/dist/environment/local.js.map +1 -1
  8. package/dist/file.d.ts +10 -3
  9. package/dist/file.js +34 -34
  10. package/dist/file.js.map +1 -1
  11. package/dist/index.d.ts +0 -3
  12. package/dist/index.js +0 -3
  13. package/dist/index.js.map +1 -1
  14. package/dist/metadata.d.ts +1 -1
  15. package/dist/metadata.js.map +1 -1
  16. package/dist/monorail.d.ts +1 -1
  17. package/dist/monorail.js.map +1 -1
  18. package/dist/os.d.ts +4 -3
  19. package/dist/os.js +3 -4
  20. package/dist/os.js.map +1 -1
  21. package/dist/output.d.ts +2 -2
  22. package/dist/output.js +1 -1
  23. package/dist/output.js.map +1 -1
  24. package/dist/path.d.ts +3 -1
  25. package/dist/path.js +2 -2
  26. package/dist/path.js.map +1 -1
  27. package/dist/plugins.d.ts +1 -1
  28. package/dist/plugins.js.map +1 -1
  29. package/dist/{json.d.ts → private/common/json.d.ts} +0 -0
  30. package/dist/{json.js → private/common/json.js} +0 -0
  31. package/dist/private/common/json.js.map +1 -0
  32. package/dist/private/node/analytics.d.ts +27 -0
  33. package/dist/private/node/analytics.js +57 -0
  34. package/dist/private/node/analytics.js.map +1 -0
  35. package/dist/private/node/ui/components/Alert.test.js +5 -5
  36. package/dist/private/node/ui/components/Alert.test.js.map +1 -1
  37. package/dist/private/node/ui/components/Banner.js +5 -5
  38. package/dist/private/node/ui/components/Banner.js.map +1 -1
  39. package/dist/private/node/ui/components/Banner.test.js +11 -11
  40. package/dist/private/node/ui/components/Banner.test.js.map +1 -1
  41. package/dist/private/node/ui/components/Command.test.js +3 -3
  42. package/dist/private/node/ui/components/Command.test.js.map +1 -1
  43. package/dist/private/node/ui/components/ConcurrentOutput.d.ts +2 -2
  44. package/dist/private/node/ui/components/ConcurrentOutput.js +1 -1
  45. package/dist/private/node/ui/components/ConcurrentOutput.js.map +1 -1
  46. package/dist/private/node/ui/components/ConcurrentOutput.test.js +3 -3
  47. package/dist/private/node/ui/components/ConcurrentOutput.test.js.map +1 -1
  48. package/dist/private/node/ui/components/FatalError.test.js +9 -9
  49. package/dist/private/node/ui/components/FatalError.test.js.map +1 -1
  50. package/dist/private/node/ui/components/FilePath.test.js +3 -3
  51. package/dist/private/node/ui/components/FilePath.test.js.map +1 -1
  52. package/dist/private/node/ui/components/Link.test.js +5 -5
  53. package/dist/private/node/ui/components/Link.test.js.map +1 -1
  54. package/dist/private/node/ui/components/List.test.js +5 -5
  55. package/dist/private/node/ui/components/List.test.js.map +1 -1
  56. package/dist/private/node/ui/components/SelectInput.d.ts +2 -2
  57. package/dist/private/node/ui/components/SelectInput.js +16 -24
  58. package/dist/private/node/ui/components/SelectInput.js.map +1 -1
  59. package/dist/private/node/ui/components/SelectInput.test.js +62 -32
  60. package/dist/private/node/ui/components/SelectInput.test.js.map +1 -1
  61. package/dist/private/node/ui/components/{Prompt.d.ts → SelectPrompt.d.ts} +4 -3
  62. package/dist/private/node/ui/components/SelectPrompt.js +34 -0
  63. package/dist/private/node/ui/components/SelectPrompt.js.map +1 -0
  64. package/dist/private/node/ui/components/{Prompt.test.d.ts → SelectPrompt.test.d.ts} +0 -0
  65. package/dist/private/node/ui/components/{Prompt.test.js → SelectPrompt.test.js} +7 -6
  66. package/dist/private/node/ui/components/SelectPrompt.test.js.map +1 -0
  67. package/dist/private/node/ui/components/Table.js +1 -1
  68. package/dist/private/node/ui/components/Table.js.map +1 -1
  69. package/dist/private/node/ui/components/Tasks.d.ts +1 -1
  70. package/dist/private/node/ui/components/Tasks.js +3 -3
  71. package/dist/private/node/ui/components/Tasks.js.map +1 -1
  72. package/dist/private/node/ui/components/Tasks.test.js +4 -4
  73. package/dist/private/node/ui/components/Tasks.test.js.map +1 -1
  74. package/dist/private/node/ui/components/TextAnimation.js.map +1 -1
  75. package/dist/private/node/ui/components/TextInput.d.ts +9 -0
  76. package/dist/private/node/ui/components/TextInput.js +74 -0
  77. package/dist/private/node/ui/components/TextInput.js.map +1 -0
  78. package/dist/private/node/ui/components/TextInput.test.d.ts +1 -0
  79. package/dist/private/node/ui/components/TextInput.test.js +139 -0
  80. package/dist/private/node/ui/components/TextInput.test.js.map +1 -0
  81. package/dist/private/node/ui/components/TextPrompt.d.ts +8 -0
  82. package/dist/private/node/ui/components/TextPrompt.js +52 -0
  83. package/dist/private/node/ui/components/TextPrompt.js.map +1 -0
  84. package/dist/private/node/ui/components/TextPrompt.test.d.ts +1 -0
  85. package/dist/private/node/ui/components/TextPrompt.test.js +68 -0
  86. package/dist/private/node/ui/components/TextPrompt.test.js.map +1 -0
  87. package/dist/private/node/ui/components/TokenizedText.test.js +3 -3
  88. package/dist/private/node/ui/components/TokenizedText.test.js.map +1 -1
  89. package/dist/private/node/ui/components/UserInput.test.js +3 -3
  90. package/dist/private/node/ui/components/UserInput.test.js.map +1 -1
  91. package/dist/private/node/ui/hooks/use-layout.d.ts +6 -3
  92. package/dist/private/node/ui/hooks/use-layout.js +17 -8
  93. package/dist/private/node/ui/hooks/use-layout.js.map +1 -1
  94. package/dist/private/node/ui.d.ts +2 -3
  95. package/dist/private/node/ui.js +7 -16
  96. package/dist/private/node/ui.js.map +1 -1
  97. package/dist/public/common/array.js +1 -1
  98. package/dist/public/common/array.js.map +1 -1
  99. package/dist/public/common/collection.js +1 -1
  100. package/dist/public/common/collection.js.map +1 -1
  101. package/dist/public/common/function.js +1 -1
  102. package/dist/public/common/function.js.map +1 -1
  103. package/dist/public/common/lang.js +1 -1
  104. package/dist/public/common/lang.js.map +1 -1
  105. package/dist/public/common/object.js +1 -1
  106. package/dist/public/common/object.js.map +1 -1
  107. package/dist/public/common/url.d.ts +7 -0
  108. package/dist/public/common/url.js +17 -0
  109. package/dist/public/common/url.js.map +1 -0
  110. package/dist/public/node/abort.d.ts +16 -0
  111. package/dist/public/node/abort.js +17 -0
  112. package/dist/public/node/abort.js.map +1 -0
  113. package/dist/public/node/analytics.d.ts +13 -0
  114. package/dist/public/node/analytics.js +82 -0
  115. package/dist/public/node/analytics.js.map +1 -0
  116. package/dist/public/node/archiver.js +1 -1
  117. package/dist/public/node/archiver.js.map +1 -1
  118. package/dist/public/node/base-command.js.map +1 -1
  119. package/dist/public/node/error-handler.js +3 -2
  120. package/dist/public/node/error-handler.js.map +1 -1
  121. package/dist/public/node/framework.js +1 -1
  122. package/dist/public/node/framework.js.map +1 -1
  123. package/dist/public/node/hooks/postrun.js +2 -2
  124. package/dist/public/node/hooks/postrun.js.map +1 -1
  125. package/dist/public/node/hooks/prerun.js +2 -2
  126. package/dist/public/node/hooks/prerun.js.map +1 -1
  127. package/dist/public/node/node-package-manager.d.ts +3 -3
  128. package/dist/public/node/node-package-manager.js +1 -1
  129. package/dist/public/node/node-package-manager.js.map +1 -1
  130. package/dist/public/node/presets.d.ts +1 -1
  131. package/dist/public/node/presets.js.map +1 -1
  132. package/dist/public/node/ruby.d.ts +2 -2
  133. package/dist/public/node/ruby.js +2 -2
  134. package/dist/public/node/ruby.js.map +1 -1
  135. package/dist/public/node/ui.d.ts +12 -17
  136. package/dist/public/node/ui.js +25 -29
  137. package/dist/public/node/ui.js.map +1 -1
  138. package/dist/session/authorize.js +1 -1
  139. package/dist/session/authorize.js.map +1 -1
  140. package/dist/session/redirect-listener.js +6 -3
  141. package/dist/session/redirect-listener.js.map +1 -1
  142. package/dist/system.d.ts +2 -2
  143. package/dist/system.js.map +1 -1
  144. package/dist/testing/ui.d.ts +1 -1
  145. package/dist/testing/ui.js +1 -1
  146. package/dist/testing/ui.js.map +1 -1
  147. package/dist/tsconfig.tsbuildinfo +1 -1
  148. package/dist/ui/inquirer/autocomplete.d.ts +2 -2
  149. package/dist/ui/inquirer/autocomplete.js.map +1 -1
  150. package/dist/ui/inquirer/input.d.ts +2 -2
  151. package/dist/ui/inquirer/input.js.map +1 -1
  152. package/dist/ui/inquirer/password.d.ts +2 -2
  153. package/dist/ui/inquirer/password.js.map +1 -1
  154. package/dist/ui/inquirer/select.d.ts +2 -2
  155. package/dist/ui/inquirer/select.js +2 -2
  156. package/dist/ui/inquirer/select.js.map +1 -1
  157. package/package.json +29 -27
  158. package/dist/abort.d.ts +0 -1
  159. package/dist/abort.js +0 -2
  160. package/dist/abort.js.map +0 -1
  161. package/dist/analytics.d.ts +0 -44
  162. package/dist/analytics.js +0 -154
  163. package/dist/analytics.js.map +0 -1
  164. package/dist/id.d.ts +0 -6
  165. package/dist/id.js +0 -18
  166. package/dist/id.js.map +0 -1
  167. package/dist/json.js.map +0 -1
  168. package/dist/private/node/ui/components/Prompt.js +0 -23
  169. package/dist/private/node/ui/components/Prompt.js.map +0 -1
  170. package/dist/private/node/ui/components/Prompt.test.js.map +0 -1
@@ -1,10 +1,10 @@
1
1
  /// <reference types="node" />
2
2
  import AutocompletePrompt from 'inquirer-autocomplete-prompt';
3
- import inquirer from 'inquirer';
3
+ import { Question, Answers } from 'inquirer';
4
4
  import { Interface } from 'readline';
5
5
  export declare class CustomAutocomplete extends AutocompletePrompt {
6
6
  protected isAutocomplete: boolean;
7
- constructor(questions: inquirer.Question<inquirer.Answers>, rl: Interface, answers: inquirer.Answers);
7
+ constructor(questions: Question<Answers>, rl: Interface, answers: Answers);
8
8
  protected render(error?: string): void;
9
9
  protected getQuestion(): string;
10
10
  protected prefix(): string;
@@ -1 +1 @@
1
- {"version":3,"file":"autocomplete.js","sourceRoot":"","sources":["../../../src/ui/inquirer/autocomplete.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,6BAA6B,CAAA;AAChD,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAA;AAC5C,OAAO,kBAAkB,MAAM,8BAA8B,CAAA;AAI7D,OAAO,SAAS,MAAM,iCA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,CAAC,CAAC,CAAC,UAAU,GAAG,CAAA;YACpF,MAAM,IAAI,IAAI,CAAA;YACd,OAAM;SACP;QAED,MAAM,UAAU,GAAG,CAAC,GAAG,eAAe,KAAK,OAAO,CAAA;QAClD,IAAI,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAA;QAEnD,IAAI,UAAU,EAAE;YACd,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;SAC5B;QAED,IAAI,WAAW,EAAE;YACf,MAAM,UAAU,GAAG,YAAY,CAAC,WAAW,CAAC,CAAA;YAC5C,IAAI,GAAG,IAAI;iBACR,KAAK,CAAC,IAAI,MAAM,CAAC,IAAI,UAAU,GAAG,EAAE,IAAI,CAAC,CAAC;iBAC1C,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;gBACb,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,EAAE;oBAC7C,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;iBACjC;qBAAM;oBACL,OAAO,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;iBAClD;YACH,CAAC,CAAC;iBACD,IAAI,CAAC,EAAE,CAAC,CAAA;SACZ;aAAM,IAAI,UAAU,EAAE;YACrB,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;SAC5B;QAED,MAAM,IAAI,GAAG,IAAI,KAAK,CAAA;IACxB,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;AAClC,CAAC","sourcesContent":["import colors from '../../public/node/colors.js'\nimport {escapeRegExp} from '../../string.js'\nimport AutocompletePrompt from 'inquirer-autocomplete-prompt'\nimport DistinctChoice from 'inquirer/lib/objects/choices'\nimport inquirer from 'inquirer'\n\nimport Paginator from 'inquirer/lib/utils/paginator.js'\nimport {Interface} from 'readline'\n\nexport class CustomAutocomplete extends AutocompletePrompt {\n protected isAutocomplete: boolean\n\n constructor(questions: inquirer.Question<inquirer.Answers>, rl: Interface, answers: inquirer.Answers) {\n super(questions, rl, answers)\n this.isAutocomplete = true\n this.paginator = new Paginator(this.screen, {\n isInfinite: false,\n })\n }\n\n protected render(error?: string) {\n let content = this.getQuestion()\n let bottomContent = ''\n\n if (this.status !== 'answered') {\n content += colors.gray(this.isAutocomplete && this.firstRender ? 'Type to search… ' : '… ')\n }\n\n if (this.status === 'answered') {\n content += `${colors.dim('·')} ${colors.magenta(this.shortAnswer || this.answerName || this.answer)}`\n process.stdout.write('\\u001b[?25h')\n } else if (this.searching) {\n content += this.rl.line\n bottomContent += ` ${colors.magenta.dim('Searching...')}`\n } else if (this.nbChoices) {\n const choicesStr = listRender(this.currentChoices, this.selected, this.isAutocomplete ? this.rl.line : undefined)\n content += this.isAutocomplete ? this.rl.line : ''\n const indexPosition = this.selected\n let realIndexPosition = 0\n this.currentChoices.choices.every((choice, index: number) => {\n if (index > indexPosition) {\n return false\n }\n if (choice.type === 'separator') {\n return true\n }\n const name = choice.name\n realIndexPosition += name ? name.split('\\n').length : 0\n return true\n })\n bottomContent += this.paginator.paginate(choicesStr, realIndexPosition, this.isAutocomplete ? 10 : 500)\n } else {\n content += this.rl.line\n bottomContent += ` ${colors.magenta('No matching choices')}`\n }\n\n if (error) {\n bottomContent += `\\n${colors.magenta('>> ')}${error}`\n }\n\n this.firstRender = false\n\n this.screen.render(content, bottomContent)\n }\n\n protected getQuestion(): string {\n return `${this.prefix()} ${colors.bold(this.opt.message)}${this.opt.suffix}${colors.reset(' ')}`\n }\n\n protected prefix(): string {\n const color = colors.magenta.bold\n return this.status === 'answered' ? color('✔') : color('?')\n }\n}\n\nfunction listRender(choices: DistinctChoice, pointer: number, searchToken?: string): string {\n let output = ''\n let separatorOffset = 0\n\n choices.forEach((choice, i: number) => {\n if (choice.type === 'separator') {\n separatorOffset++\n if (choice.line.includes('──────────────')) {\n output += `\\n`\n } else {\n output += ` ${colors.dim.underline(choice)}\\n`\n }\n return\n }\n\n if (choice.disabled) {\n separatorOffset++\n output += ` - ${choice.name}`\n output += ` (${typeof choice.disabled === 'string' ? choice.disabled : 'Disabled'})`\n output += '\\n'\n return\n }\n\n const isSelected = i - separatorOffset === pointer\n let line = (isSelected ? '> ' : ' ') + choice.name\n\n if (isSelected) {\n line = colors.magenta(line)\n }\n\n if (searchToken) {\n const regexified = escapeRegExp(searchToken)\n line = line\n .split(new RegExp(`(${regexified})`, 'ig'))\n .map((token) => {\n if (token.match(new RegExp(regexified, 'ig'))) {\n return colors.magenta.dim(token)\n } else {\n return isSelected ? colors.magenta(token) : token\n }\n })\n .join('')\n } else if (isSelected) {\n line = colors.magenta(line)\n }\n\n output += `${line} \\n`\n })\n\n return output.replace(/\\n$/, '')\n}\n"]}
1
+ {"version":3,"file":"autocomplete.js","sourceRoot":"","sources":["../../../src/ui/inquirer/autocomplete.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,6BAA6B,CAAA;AAChD,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAA;AAC5C,OAAO,kBAAkB,MAAM,8BAA8B,CAAA;AAI7D,OAAO,SAAS,MAAM,iCAAiC,CAAA;AAGvD,MAAM,OAAO,kBAAmB,SAAQ,kBAAkB;IAGxD,YAAY,SAA4B,EAAE,EAAa,EAAE,OAAgB;QACvE,KAAK,CAAC,SAAS,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;QAC7B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAA;QAC1B,IAAI,CAAC,SAAS,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE;YAC1C,UAAU,EAAE,KAAK;SAClB,CAAC,CAAA;IACJ,CAAC;IAES,MAAM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AAA;SAC5B;QAED,IAAI,WAAW,EAAE;YACf,MAAM,UAAU,GAAG,YAAY,CAAC,WAAW,CAAC,CAAA;YAC5C,IAAI,GAAG,IAAI;iBACR,KAAK,CAAC,IAAI,MAAM,CAAC,IAAI,UAAU,GAAG,EAAE,IAAI,CAAC,CAAC;iBAC1C,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;gBACb,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,EAAE;oBAC7C,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;iBACjC;qBAAM;oBACL,OAAO,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;iBAClD;YACH,CAAC,CAAC;iBACD,IAAI,CAAC,EAAE,CAAC,CAAA;SACZ;aAAM,IAAI,UAAU,EAAE;YACrB,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;SAC5B;QAED,MAAM,IAAI,GAAG,IAAI,KAAK,CAAA;IACxB,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;AAClC,CAAC","sourcesContent":["import colors from '../../public/node/colors.js'\nimport {escapeRegExp} from '../../string.js'\nimport AutocompletePrompt from 'inquirer-autocomplete-prompt'\nimport DistinctChoice from 'inquirer/lib/objects/choices'\nimport {Question, Answers} from 'inquirer'\n\nimport Paginator from 'inquirer/lib/utils/paginator.js'\nimport {Interface} from 'readline'\n\nexport class CustomAutocomplete extends AutocompletePrompt {\n protected isAutocomplete: boolean\n\n constructor(questions: Question<Answers>, rl: Interface, answers: Answers) {\n super(questions, rl, answers)\n this.isAutocomplete = true\n this.paginator = new Paginator(this.screen, {\n isInfinite: false,\n })\n }\n\n protected render(error?: string) {\n let content = this.getQuestion()\n let bottomContent = ''\n\n if (this.status !== 'answered') {\n content += colors.gray(this.isAutocomplete && this.firstRender ? 'Type to search… ' : '… ')\n }\n\n if (this.status === 'answered') {\n content += `${colors.dim('·')} ${colors.magenta(this.shortAnswer || this.answerName || this.answer)}`\n process.stdout.write('\\u001b[?25h')\n } else if (this.searching) {\n content += this.rl.line\n bottomContent += ` ${colors.magenta.dim('Searching...')}`\n } else if (this.nbChoices) {\n const choicesStr = listRender(this.currentChoices, this.selected, this.isAutocomplete ? this.rl.line : undefined)\n content += this.isAutocomplete ? this.rl.line : ''\n const indexPosition = this.selected\n let realIndexPosition = 0\n this.currentChoices.choices.every((choice, index: number) => {\n if (index > indexPosition) {\n return false\n }\n if (choice.type === 'separator') {\n return true\n }\n const name = choice.name\n realIndexPosition += name ? name.split('\\n').length : 0\n return true\n })\n bottomContent += this.paginator.paginate(choicesStr, realIndexPosition, this.isAutocomplete ? 10 : 500)\n } else {\n content += this.rl.line\n bottomContent += ` ${colors.magenta('No matching choices')}`\n }\n\n if (error) {\n bottomContent += `\\n${colors.magenta('>> ')}${error}`\n }\n\n this.firstRender = false\n\n this.screen.render(content, bottomContent)\n }\n\n protected getQuestion(): string {\n return `${this.prefix()} ${colors.bold(this.opt.message)}${this.opt.suffix}${colors.reset(' ')}`\n }\n\n protected prefix(): string {\n const color = colors.magenta.bold\n return this.status === 'answered' ? color('✔') : color('?')\n }\n}\n\nfunction listRender(choices: DistinctChoice, pointer: number, searchToken?: string): string {\n let output = ''\n let separatorOffset = 0\n\n choices.forEach((choice, i: number) => {\n if (choice.type === 'separator') {\n separatorOffset++\n if (choice.line.includes('──────────────')) {\n output += `\\n`\n } else {\n output += ` ${colors.dim.underline(choice)}\\n`\n }\n return\n }\n\n if (choice.disabled) {\n separatorOffset++\n output += ` - ${choice.name}`\n output += ` (${typeof choice.disabled === 'string' ? choice.disabled : 'Disabled'})`\n output += '\\n'\n return\n }\n\n const isSelected = i - separatorOffset === pointer\n let line = (isSelected ? '> ' : ' ') + choice.name\n\n if (isSelected) {\n line = colors.magenta(line)\n }\n\n if (searchToken) {\n const regexified = escapeRegExp(searchToken)\n line = line\n .split(new RegExp(`(${regexified})`, 'ig'))\n .map((token) => {\n if (token.match(new RegExp(regexified, 'ig'))) {\n return colors.magenta.dim(token)\n } else {\n return isSelected ? colors.magenta(token) : token\n }\n })\n .join('')\n } else if (isSelected) {\n line = colors.magenta(line)\n }\n\n output += `${line} \\n`\n })\n\n return output.replace(/\\n$/, '')\n}\n"]}
@@ -1,10 +1,10 @@
1
1
  /// <reference types="node" />
2
2
  import Input from 'inquirer/lib/prompts/input.js';
3
- import inquirer from 'inquirer';
3
+ import { Question, Answers } from 'inquirer';
4
4
  import { Interface } from 'readline';
5
5
  export declare class CustomInput extends Input {
6
6
  protected isPassword: boolean;
7
- constructor(questions: inquirer.Question<inquirer.Answers>, rl: Interface, answers: inquirer.Answers);
7
+ constructor(questions: Question<Answers>, rl: Interface, answers: Answers);
8
8
  protected render(error?: string): void;
9
9
  protected getQuestion(): string;
10
10
  protected prefix(): string;
@@ -1 +1 @@
1
- {"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/ui/inquirer/input.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,6BAA6B,CAAA;AAChD,OAAO,KAAK,MAAM,+BAA+B,CAAA;AAEjD,OAAO,QAAqB,MAAM,UAAU,CAAA;AAE5C,MAAM,OAAO,WAAY,SAAQ,KAAK;IAGpC,YAAY,SAA8C,EAAE,EAAa,EAAE,OAAyB;QAClG,KAAK,CAAC,SAAS,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;QAC7B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAA;IACzB,CAAC;IAES,MAAM,CAAC,KAAc;QAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAA;QAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,KAAK,UAAU,CAAA;QAE1C,IAAI,MAAM,GAAG,IAAI,CAAC,WAAW,EAAE,CAAA;QAE/B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G,CAAC;IAES,MAAM;QACd,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAA;QACjC,OAAO,IAAI,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC7D,CAAC;IAES,OAAO,CAAC,IAAsC;QACtD,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAChE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC3B,CAAC;IAEO,aAAa,CAAC,OAAe;QACnC,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;IAC5E,CAAC;CACF","sourcesContent":["import colors from '../../public/node/colors.js'\nimport Input from 'inquirer/lib/prompts/input.js'\nimport inquirer from 'inquirer'\nimport readline, {Interface} from 'readline'\n\nexport class CustomInput extends Input {\n protected isPassword: boolean\n\n constructor(questions: inquirer.Question<inquirer.Answers>, rl: Interface, answers: inquirer.Answers) {\n super(questions, rl, answers)\n this.isPassword = false\n }\n\n protected render(error?: string): void {\n const color = colors.magenta\n const isFinal = this.status === 'answered'\n\n let prompt = this.getQuestion()\n\n let bottomContent = ''\n if (isFinal) {\n prompt += `${colors.dim('·')} ${color(this.formatContent(this.answer))}`\n } else {\n prompt += `\\n${color('>')} ${this.rl.line ? this.formatContent(this.rl.line) : color.dim(this.opt.default)}`\n bottomContent = '─'.repeat(Math.max(this.rl.line.length, 30))\n bottomContent = ` ${color(bottomContent)}`\n if (error) {\n bottomContent += `\\n\\n ${colors.red(`! ${error}`)}`\n }\n }\n this.screen.render(prompt, bottomContent)\n if (!isFinal && !this.rl.line) {\n readline.cursorTo(process.stdout, 2)\n }\n }\n\n protected getQuestion() {\n return `${this.prefix()} ${colors.bold(this.opt.message)}${this.opt.suffix}${colors.reset(' ')}`\n }\n\n protected prefix() {\n const color = colors.magenta.bold\n return this.status === 'answered' ? color('✔') : color('?')\n }\n\n protected onError(data: {isValid: string; value: string}) {\n this.rl.write(data.value === this.opt.default ? '' : data.value)\n this.render(data.isValid)\n }\n\n private formatContent(content: string): string {\n return this.isPassword ? colors.gray('*'.repeat(content.length)) : content\n }\n}\n"]}
1
+ {"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/ui/inquirer/input.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,6BAA6B,CAAA;AAChD,OAAO,KAAK,MAAM,+BAA+B,CAAA;AAEjD,OAAO,QAAqB,MAAM,UAAU,CAAA;AAE5C,MAAM,OAAO,WAAY,SAAQ,KAAK;IAGpC,YAAY,SAA4B,EAAE,EAAa,EAAE,OAAgB;QACvE,KAAK,CAAC,SAAS,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;QAC7B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAA;IACzB,CAAC;IAES,MAAM,CAAC,KAAc;QAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAA;QAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,KAAK,UAAU,CAAA;QAE1C,IAAI,MAAM,GAAG,IAAI,CAAC,WAAW,EAAE,CAAA;QAE/B,IAAI,aAAa,GAAG,EAAE,CAAA;QACtB,IAAI,OAAO,EAAE;YACX,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAA;SACzE;aAAM;YACL,MAAM,IAAI,KAAK,KAAK,CAAC,GAAG,CAAC,IAAI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AC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAChE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC3B,CAAC;IAEO,aAAa,CAAC,OAAe;QACnC,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;IAC5E,CAAC;CACF","sourcesContent":["import colors from '../../public/node/colors.js'\nimport Input from 'inquirer/lib/prompts/input.js'\nimport {Question, Answers} from 'inquirer'\nimport readline, {Interface} from 'readline'\n\nexport class CustomInput extends Input {\n protected isPassword: boolean\n\n constructor(questions: Question<Answers>, rl: Interface, answers: Answers) {\n super(questions, rl, answers)\n this.isPassword = false\n }\n\n protected render(error?: string): void {\n const color = colors.magenta\n const isFinal = this.status === 'answered'\n\n let prompt = this.getQuestion()\n\n let bottomContent = ''\n if (isFinal) {\n prompt += `${colors.dim('·')} ${color(this.formatContent(this.answer))}`\n } else {\n prompt += `\\n${color('>')} ${this.rl.line ? this.formatContent(this.rl.line) : color.dim(this.opt.default)}`\n bottomContent = '─'.repeat(Math.max(this.rl.line.length, 30))\n bottomContent = ` ${color(bottomContent)}`\n if (error) {\n bottomContent += `\\n\\n ${colors.red(`! ${error}`)}`\n }\n }\n this.screen.render(prompt, bottomContent)\n if (!isFinal && !this.rl.line) {\n readline.cursorTo(process.stdout, 2)\n }\n }\n\n protected getQuestion() {\n return `${this.prefix()} ${colors.bold(this.opt.message)}${this.opt.suffix}${colors.reset(' ')}`\n }\n\n protected prefix() {\n const color = colors.magenta.bold\n return this.status === 'answered' ? color('✔') : color('?')\n }\n\n protected onError(data: {isValid: string; value: string}) {\n this.rl.write(data.value === this.opt.default ? '' : data.value)\n this.render(data.isValid)\n }\n\n private formatContent(content: string): string {\n return this.isPassword ? colors.gray('*'.repeat(content.length)) : content\n }\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import { CustomInput } from './input.js';
3
- import inquirer from 'inquirer';
3
+ import { Question, Answers } from 'inquirer';
4
4
  import { Interface } from 'readline';
5
5
  export declare class CustomPassword extends CustomInput {
6
- constructor(questions: inquirer.Question<inquirer.Answers>, rl: Interface, answers: inquirer.Answers);
6
+ constructor(questions: Question<Answers>, rl: Interface, answers: Answers);
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"password.js","sourceRoot":"","sources":["../../../src/ui/inquirer/password.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,YAAY,CAAA;AAItC,MAAM,OAAO,cAAe,SAAQ,WAAW;IAC7C,YAAY,SAA8C,EAAE,EAAa,EAAE,OAAyB;QAClG,KAAK,CAAC,SAAS,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;QAC7B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAA;IACxB,CAAC;CACF","sourcesContent":["import {CustomInput} from './input.js'\nimport inquirer from 'inquirer'\nimport {Interface} from 'readline'\n\nexport class CustomPassword extends CustomInput {\n constructor(questions: inquirer.Question<inquirer.Answers>, rl: Interface, answers: inquirer.Answers) {\n super(questions, rl, answers)\n this.isPassword = true\n }\n}\n"]}
1
+ {"version":3,"file":"password.js","sourceRoot":"","sources":["../../../src/ui/inquirer/password.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,YAAY,CAAA;AAItC,MAAM,OAAO,cAAe,SAAQ,WAAW;IAC7C,YAAY,SAA4B,EAAE,EAAa,EAAE,OAAgB;QACvE,KAAK,CAAC,SAAS,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;QAC7B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAA;IACxB,CAAC;CACF","sourcesContent":["import {CustomInput} from './input.js'\nimport {Question, Answers} from 'inquirer'\nimport {Interface} from 'readline'\n\nexport class CustomPassword extends CustomInput {\n constructor(questions: Question<Answers>, rl: Interface, answers: Answers) {\n super(questions, rl, answers)\n this.isPassword = true\n }\n}\n"]}
@@ -1,9 +1,9 @@
1
1
  /// <reference types="node" />
2
2
  import { CustomAutocomplete } from './autocomplete.js';
3
- import inquirer from 'inquirer';
3
+ import { Question, Answers } from 'inquirer';
4
4
  import { Interface } from 'readline';
5
5
  export declare class CustomSelect extends CustomAutocomplete {
6
- constructor(questions: inquirer.Question<inquirer.Answers>, rl: Interface, answers: inquirer.Answers);
6
+ constructor(questions: Question<Answers>, rl: Interface, answers: Answers);
7
7
  onKeypress(event: {
8
8
  key: {
9
9
  name: string;
@@ -1,5 +1,5 @@
1
1
  import { CustomAutocomplete } from './autocomplete.js';
2
- import utils from 'inquirer/lib/utils/readline.js';
2
+ import { up } from 'inquirer/lib/utils/readline.js';
3
3
  export class CustomSelect extends CustomAutocomplete {
4
4
  constructor(questions, rl, answers) {
5
5
  super(questions, rl, answers);
@@ -13,7 +13,7 @@ export class CustomSelect extends CustomAutocomplete {
13
13
  this.selected = this.selected < len - 1 ? this.selected + 1 : 0;
14
14
  this.ensureSelectedInRange();
15
15
  super.render();
16
- utils.up(this.rl, 2);
16
+ up(this.rl, 2);
17
17
  }
18
18
  else if (keyName === 'up' || (keyName === 'p' && event.key.ctrl)) {
19
19
  len = this.nbChoices;
@@ -1 +1 @@
1
- {"version":3,"file":"select.js","sourceRoot":"","sources":["../../../src/ui/inquirer/select.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAEpD,OAAO,KAAK,MAAM,gCAAgC,CAAA;AAIlD,MAAM,OAAO,YAAa,SAAQ,kBAAkB;IAClD,YAAY,SAA8C,EAAE,EAAa,EAAE,OAAyB;QAClG,KAAK,CAAC,SAAS,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;QAC7B,IAAI,CAAC,cAAc,GAAG,KAAK,CAAA;IAC7B,CAAC;IAED,UAAU,CAAC,KAA0D;QACnE,IAAI,GAAG,CAAA;QACP,MAAM,OAAO,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,SAAS,CAAA;QAE1D,IAAI,OAAO,KAAK,MAAM,IAAI,CAAC,OAAO,KAAK,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAC7D,GAAG,GAAG,IAAI,CAAC,SAAS,CAAA;YACpB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;YAC/D,IAAI,CAAC,qBAAqB,EAAE,CAAA;YAC5B,KAAK,CAAC,MAAM,EAAE,CAAA;YACd,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;SACrB;aAAM,IAAI,OAAO,KAAK,IAAI,IAAI,CAAC,OAAO,KAAK,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAClE,GAAG,GAAG,IAAI,CAAC,SAAS,CAAA;YACpB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAA;YAC/D,IAAI,CAAC,qBAAqB,EAAE,CAAA;YAC5B,IAAI,CAAC,MAAM,EAAE,CAAA;SACd;IACH,CAAC;CACF","sourcesContent":["import {CustomAutocomplete} from './autocomplete.js'\n\nimport utils from 'inquirer/lib/utils/readline.js'\nimport inquirer from 'inquirer'\nimport {Interface} from 'readline'\n\nexport class CustomSelect extends CustomAutocomplete {\n constructor(questions: inquirer.Question<inquirer.Answers>, rl: Interface, answers: inquirer.Answers) {\n super(questions, rl, answers)\n this.isAutocomplete = false\n }\n\n onKeypress(event: {key: {name: string; ctrl: boolean}; value: string}) {\n let len\n const keyName = (event.key && event.key.name) || undefined\n\n if (keyName === 'down' || (keyName === 'n' && event.key.ctrl)) {\n len = this.nbChoices\n this.selected = this.selected < len - 1 ? this.selected + 1 : 0\n this.ensureSelectedInRange()\n super.render()\n utils.up(this.rl, 2)\n } else if (keyName === 'up' || (keyName === 'p' && event.key.ctrl)) {\n len = this.nbChoices\n this.selected = this.selected > 0 ? this.selected - 1 : len - 1\n this.ensureSelectedInRange()\n this.render()\n }\n }\n}\n"]}
1
+ {"version":3,"file":"select.js","sourceRoot":"","sources":["../../../src/ui/inquirer/select.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAEpD,OAAO,EAAC,EAAE,EAAC,MAAM,gCAAgC,CAAA;AAIjD,MAAM,OAAO,YAAa,SAAQ,kBAAkB;IAClD,YAAY,SAA4B,EAAE,EAAa,EAAE,OAAgB;QACvE,KAAK,CAAC,SAAS,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;QAC7B,IAAI,CAAC,cAAc,GAAG,KAAK,CAAA;IAC7B,CAAC;IAED,UAAU,CAAC,KAA0D;QACnE,IAAI,GAAG,CAAA;QACP,MAAM,OAAO,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,SAAS,CAAA;QAE1D,IAAI,OAAO,KAAK,MAAM,IAAI,CAAC,OAAO,KAAK,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAC7D,GAAG,GAAG,IAAI,CAAC,SAAS,CAAA;YACpB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;YAC/D,IAAI,CAAC,qBAAqB,EAAE,CAAA;YAC5B,KAAK,CAAC,MAAM,EAAE,CAAA;YACd,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;SACf;aAAM,IAAI,OAAO,KAAK,IAAI,IAAI,CAAC,OAAO,KAAK,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAClE,GAAG,GAAG,IAAI,CAAC,SAAS,CAAA;YACpB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAA;YAC/D,IAAI,CAAC,qBAAqB,EAAE,CAAA;YAC5B,IAAI,CAAC,MAAM,EAAE,CAAA;SACd;IACH,CAAC;CACF","sourcesContent":["import {CustomAutocomplete} from './autocomplete.js'\n\nimport {up} from 'inquirer/lib/utils/readline.js'\nimport {Question, Answers} from 'inquirer'\nimport {Interface} from 'readline'\n\nexport class CustomSelect extends CustomAutocomplete {\n constructor(questions: Question<Answers>, rl: Interface, answers: Answers) {\n super(questions, rl, answers)\n this.isAutocomplete = false\n }\n\n onKeypress(event: {key: {name: string; ctrl: boolean}; value: string}) {\n let len\n const keyName = (event.key && event.key.name) || undefined\n\n if (keyName === 'down' || (keyName === 'n' && event.key.ctrl)) {\n len = this.nbChoices\n this.selected = this.selected < len - 1 ? this.selected + 1 : 0\n this.ensureSelectedInRange()\n super.render()\n up(this.rl, 2)\n } else if (keyName === 'up' || (keyName === 'p' && event.key.ctrl)) {\n len = this.nbChoices\n this.selected = this.selected > 0 ? this.selected - 1 : len - 1\n this.ensureSelectedInRange()\n this.render()\n }\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopify/cli-kit",
3
- "version": "3.31.1",
3
+ "version": "3.32.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": [
@@ -8,10 +8,15 @@
8
8
  "shopify-cli",
9
9
  "shopify-partners"
10
10
  ],
11
+ "bugs": {
12
+ "url": "https://github.com/Shopify/cli/issues/new/choose"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/Shopify/cli/edit/main/packages/cli-kit"
17
+ },
11
18
  "license": "MIT",
12
19
  "type": "module",
13
- "module": "dist/index.js",
14
- "types": "dist/index.d.ts",
15
20
  "exports": {
16
21
  ".": {
17
22
  "import": "./dist/index.js",
@@ -30,14 +35,12 @@
30
35
  "types": "./dist/typing/*.d.ts"
31
36
  }
32
37
  },
38
+ "module": "dist/index.js",
39
+ "types": "dist/index.d.ts",
33
40
  "files": [
34
41
  "/dist",
35
42
  "/assets"
36
43
  ],
37
- "publishConfig": {
38
- "access": "public",
39
- "@shopify:registry": "https://registry.npmjs.org"
40
- },
41
44
  "eslintConfig": {
42
45
  "extends": [
43
46
  "../../.eslintrc.cjs"
@@ -68,15 +71,6 @@
68
71
  }
69
72
  ]
70
73
  },
71
- "engine-strict": true,
72
- "engines": {
73
- "node": ">=14.17.0"
74
- },
75
- "os": [
76
- "darwin",
77
- "linux",
78
- "win32"
79
- ],
80
74
  "dependencies": {
81
75
  "@bugsnag/js": "7.16.7",
82
76
  "@iarna/toml": "2.2.5",
@@ -108,19 +102,20 @@
108
102
  "graphql-request": "4.3.0",
109
103
  "h3": "0.7.21",
110
104
  "ink": "3.2.0",
111
- "inquirer": "8.2.4",
112
- "inquirer-autocomplete-prompt": "2.0.0",
105
+ "inquirer": "9.1.4",
106
+ "inquirer-autocomplete-prompt": "3.0.0",
113
107
  "is-interactive": "2.0.0",
114
108
  "js-yaml": "4.1.0",
115
109
  "keytar": "7.9.0",
116
110
  "kill-port-process": "3.1.0",
117
- "latest-version": "6.0.0",
111
+ "latest-version": "7.0.0",
118
112
  "liquidjs": "9.36.0",
119
113
  "listr2": "4.0.5",
120
114
  "lodash": "4.17.21",
121
115
  "log-update": "4.0.0",
122
116
  "macaddress": "0.5.3",
123
117
  "md5-file": "5.0.0",
118
+ "node-abort-controller": "3.0.1",
124
119
  "node-fetch": "3.2.4",
125
120
  "open": "8.4.0",
126
121
  "pathe": "0.2.0",
@@ -140,13 +135,14 @@
140
135
  "zod": "3.17.3"
141
136
  },
142
137
  "devDependencies": {
143
- "@types/lodash": "4.14.191",
144
138
  "@types/commondir": "^1.0.0",
145
139
  "@types/cross-zip": "^4.0.0",
146
140
  "@types/diff": "^5.0.2",
147
141
  "@types/fs-extra": "9.0.13",
148
142
  "@types/gradient-string": "^1.1.2",
149
- "@types/inquirer": "^8.2.1",
143
+ "@types/inquirer": "^9.0.3",
144
+ "@types/lodash": "4.14.191",
145
+ "@types/node": "14.17.0",
150
146
  "@types/react": "17.0.2",
151
147
  "@types/semver": "^7.3.9",
152
148
  "@vitest/coverage-istanbul": "^0.26.3",
@@ -155,21 +151,27 @@
155
151
  "vite": "^2.9.13",
156
152
  "vitest": "^0.26.3"
157
153
  },
158
- "repository": {
159
- "type": "git",
160
- "url": "https://github.com/Shopify/cli/edit/main/packages/cli-kit"
154
+ "engines": {
155
+ "node": ">=14.17.0"
161
156
  },
162
- "bugs": {
163
- "url": "https://github.com/Shopify/cli/issues/new/choose"
157
+ "os": [
158
+ "darwin",
159
+ "linux",
160
+ "win32"
161
+ ],
162
+ "publishConfig": {
163
+ "@shopify:registry": "https://registry.npmjs.org",
164
+ "access": "public"
164
165
  },
166
+ "engine-strict": true,
165
167
  "scripts": {
166
168
  "build": "nx build",
167
169
  "clean": "nx clean",
168
170
  "lint": "nx lint",
169
171
  "lint:fix": "nx lint:fix",
170
172
  "test": "nx run cli-kit:test",
171
- "test:watch": "nx test:watch",
172
173
  "test:coverage": "nx test:coverage",
174
+ "test:watch": "nx test:watch",
173
175
  "type-check": "nx type-check"
174
176
  }
175
177
  }
package/dist/abort.d.ts DELETED
@@ -1 +0,0 @@
1
- export { AbortController as Controller, AbortSignal as Signal } from 'abort-controller';
package/dist/abort.js DELETED
@@ -1,2 +0,0 @@
1
- export { AbortController as Controller, AbortSignal as Signal } from 'abort-controller';
2
- //# sourceMappingURL=abort.js.map
package/dist/abort.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"abort.js","sourceRoot":"","sources":["../src/abort.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,IAAI,UAAU,EAAE,WAAW,IAAI,MAAM,EAAC,MAAM,kBAAkB,CAAA","sourcesContent":["export {AbortController as Controller, AbortSignal as Signal} from 'abort-controller'\n"]}
@@ -1,44 +0,0 @@
1
- import BaseCommand from './public/node/base-command.js';
2
- import { CommandContent } from './public/node/hooks/prerun.js';
3
- import { Config, Interfaces } from '@oclif/core';
4
- interface StartOptions {
5
- commandContent: CommandContent;
6
- args: string[];
7
- currentTime?: number;
8
- commandClass?: Interfaces.Command.Class | typeof BaseCommand;
9
- }
10
- export declare const start: ({ commandContent, args, currentTime, commandClass }: StartOptions) => Promise<void>;
11
- interface ReportEventOptions {
12
- config: Interfaces.Config;
13
- errorMessage?: string;
14
- }
15
- /**
16
- * Report an analytics event, sending it off to Monorail -- Shopify's internal analytics service.
17
- *
18
- * The payload for an event includes both generic data, and data gathered from installed plug-ins.
19
- *
20
- */
21
- export declare function reportEvent(options: ReportEventOptions): Promise<void>;
22
- /**
23
- * Return the name of the tunnel provider used to send analytics. Returns 'localhost' or provider name if any of those
24
- * strings are included in the {@link tunnelUrl} param. Returns 'custom' otherwise
25
- *
26
- * @param options - Oclif configuration. Needed to call the hook for retrieving the list of tunner providers
27
- * @param tunnelUrl - Tunnel url. Used as pattern to match provider name
28
- * @returns 'localhost' or provider name if any of those strings are included in
29
- * the tunnelUrl or 'custom' otherwise
30
- */
31
- export declare function getAnalyticsTunnelType(options: Config, tunnelUrl: string): Promise<string | undefined>;
32
- export declare function getEnvironmentData(config: Interfaces.Config): Promise<{
33
- uname: string;
34
- env_ci: boolean;
35
- env_ci_platform: string | undefined;
36
- env_plugin_installed_any_custom: boolean;
37
- env_plugin_installed_shopify: string;
38
- env_shell: string;
39
- env_web_ide: "spin" | "codespaces" | "gitpod" | "localhost" | undefined;
40
- env_device_id: string;
41
- env_cloud: "spin" | "codespaces" | "gitpod" | "localhost";
42
- env_package_manager: "yarn" | "npm" | "pnpm";
43
- }>;
44
- export {};
package/dist/analytics.js DELETED
@@ -1,154 +0,0 @@
1
- import * as environment from './environment.js';
2
- import { platformAndArch } from './os.js';
3
- import { version as rubyVersion } from './public/node/ruby.js';
4
- import { content, debug, token } from './output.js';
5
- import constants from './constants.js';
6
- import * as metadata from './metadata.js';
7
- import { publishEvent, MONORAIL_COMMAND_TOPIC } from './monorail.js';
8
- import { fanoutHooks, getListOfTunnelPlugins } from './plugins.js';
9
- import { getPackageManager, packageManagerUsedForCreating } from './public/node/node-package-manager.js';
10
- import { hashString } from './string.js';
11
- import { macAddress } from './environment/local.js';
12
- export const start = async ({ commandContent, args, currentTime = new Date().getTime(), commandClass }) => {
13
- let startCommand = commandContent.command;
14
- if (commandClass && Object.prototype.hasOwnProperty.call(commandClass, 'analyticsNameOverride')) {
15
- startCommand = commandClass.analyticsNameOverride() ?? commandContent.command;
16
- }
17
- await metadata.addSensitive(() => ({
18
- commandStartOptions: {
19
- startTime: currentTime,
20
- startCommand,
21
- startArgs: args,
22
- },
23
- }));
24
- await metadata.addPublic(() => ({
25
- cmd_all_launcher: packageManagerUsedForCreating(),
26
- cmd_all_alias_used: commandContent.alias,
27
- cmd_all_topic: commandContent.topic,
28
- cmd_all_plugin: commandClass?.plugin?.name,
29
- }));
30
- };
31
- /**
32
- * Report an analytics event, sending it off to Monorail -- Shopify's internal analytics service.
33
- *
34
- * The payload for an event includes both generic data, and data gathered from installed plug-ins.
35
- *
36
- */
37
- export async function reportEvent(options) {
38
- try {
39
- const payload = await buildPayload(options);
40
- if (payload === undefined) {
41
- // Nothing to log
42
- return;
43
- }
44
- if (!environment.local.alwaysLogAnalytics() && environment.local.analyticsDisabled()) {
45
- debug(content `Skipping command analytics, payload: ${token.json(payload)}`);
46
- return;
47
- }
48
- const response = await publishEvent(MONORAIL_COMMAND_TOPIC, payload.public, payload.sensitive);
49
- if (response.type === 'error') {
50
- debug(response.message);
51
- }
52
- // eslint-disable-next-line no-catch-all/no-catch-all
53
- }
54
- catch (error) {
55
- let message = 'Failed to report usage analytics';
56
- if (error instanceof Error) {
57
- message = message.concat(`: ${error.message}`);
58
- }
59
- debug(message);
60
- }
61
- }
62
- /**
63
- * Return the name of the tunnel provider used to send analytics. Returns 'localhost' or provider name if any of those
64
- * strings are included in the {@link tunnelUrl} param. Returns 'custom' otherwise
65
- *
66
- * @param options - Oclif configuration. Needed to call the hook for retrieving the list of tunner providers
67
- * @param tunnelUrl - Tunnel url. Used as pattern to match provider name
68
- * @returns 'localhost' or provider name if any of those strings are included in
69
- * the tunnelUrl or 'custom' otherwise
70
- */
71
- export async function getAnalyticsTunnelType(options, tunnelUrl) {
72
- if (!tunnelUrl) {
73
- return;
74
- }
75
- if (tunnelUrl.includes('localhost')) {
76
- return 'localhost';
77
- }
78
- const provider = (await getListOfTunnelPlugins(options)).plugins.find((plugin) => tunnelUrl?.includes(plugin));
79
- return provider ?? 'custom';
80
- }
81
- const buildPayload = async ({ config, errorMessage }) => {
82
- const { commandStartOptions, ...sensitiveMetadata } = metadata.getAllSensitive();
83
- if (commandStartOptions === undefined) {
84
- debug('Unable to log analytics event - no information on executed command');
85
- return;
86
- }
87
- const { startCommand, startArgs, startTime } = commandStartOptions;
88
- const currentTime = new Date().getTime();
89
- const { '@shopify/app': appPublic, ...otherPluginsPublic } = await fanoutHooks(config, 'public_command_metadata', {});
90
- const { '@shopify/app': appSensitive, ...otherPluginsSensitive } = await fanoutHooks(config, 'sensitive_command_metadata', {});
91
- const environmentData = await getEnvironmentData(config);
92
- const sensitiveEnvironmentData = await getSensitiveEnvironmentData(config);
93
- return {
94
- public: {
95
- command: startCommand,
96
- time_start: startTime,
97
- time_end: currentTime,
98
- total_time: currentTime - startTime,
99
- success: errorMessage === undefined,
100
- cli_version: await constants.versions.cliKit(),
101
- ruby_version: (await rubyVersion()) || '',
102
- node_version: process.version.replace('v', ''),
103
- is_employee: await environment.local.isShopify(),
104
- ...environmentData,
105
- ...appPublic,
106
- ...metadata.getAllPublic(),
107
- },
108
- sensitive: {
109
- args: startArgs.join(' '),
110
- error_message: errorMessage,
111
- ...appSensitive,
112
- ...sensitiveEnvironmentData,
113
- metadata: JSON.stringify({
114
- ...sensitiveMetadata,
115
- extraPublic: {
116
- ...otherPluginsPublic,
117
- },
118
- extraSensitive: { ...otherPluginsSensitive },
119
- }),
120
- },
121
- };
122
- };
123
- export async function getEnvironmentData(config) {
124
- const ciPlatform = environment.local.ciPlatform();
125
- const pluginNames = getPluginNames(config);
126
- const shopifyPlugins = pluginNames.filter((plugin) => plugin.startsWith('@shopify/'));
127
- const { platform, arch } = platformAndArch();
128
- return {
129
- uname: `${platform} ${arch}`,
130
- env_ci: ciPlatform.isCI,
131
- env_ci_platform: ciPlatform.name,
132
- env_plugin_installed_any_custom: pluginNames.length !== shopifyPlugins.length,
133
- env_plugin_installed_shopify: JSON.stringify(shopifyPlugins),
134
- env_shell: config.shell,
135
- env_web_ide: environment.local.cloudEnvironment().editor
136
- ? environment.local.cloudEnvironment().platform
137
- : undefined,
138
- env_device_id: hashString(await macAddress()),
139
- env_cloud: environment.local.cloudEnvironment().platform,
140
- env_package_manager: await getPackageManager(process.cwd()),
141
- };
142
- }
143
- async function getSensitiveEnvironmentData(config) {
144
- return {
145
- env_plugin_installed_all: JSON.stringify(getPluginNames(config)),
146
- };
147
- }
148
- function getPluginNames(config) {
149
- return config.plugins
150
- .map((plugin) => plugin.name)
151
- .sort()
152
- .filter((plugin) => !plugin.startsWith('@oclif/'));
153
- }
154
- //# sourceMappingURL=analytics.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"analytics.js","sourceRoot":"","sources":["../src/analytics.ts"],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AAI;QAChC,+BAA+B,EAAE,WAAW,CAAC,MAAM,KAAK,cAAc,CAAC,MAAM;QAC7E,4BAA4B,EAAE,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC;QAC5D,SAAS,EAAE,MAAM,CAAC,KAAK;QACvB,WAAW,EAAE,WAAW,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC,MAAM;YACtD,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC,QAAQ;YAC/C,CAAC,CAAC,SAAS;QACb,aAAa,EAAE,UAAU,CAAC,MAAM,UAAU,EAAE,CAAC;QAC7C,SAAS,EAAE,WAAW,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC,QAAQ;QACxD,mBAAmB,EAAE,MAAM,iBAAiB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;KAC5D,CAAA;AACH,CAAC;AAED,KAAK,UAAU,2BAA2B,CAAC,MAAyB;IAClE,OAAO;QACL,wBAAwB,EAAE,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;KACjE,CAAA;AACH,CAAC;AAED,SAAS,cAAc,CAAC,MAAyB;IAC/C,OAAO,MAAM,CAAC,OAAO;SAClB,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC;SAC5B,IAAI,EAAE;SACN,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAA;AACtD,CAAC","sourcesContent":["import * as environment from './environment.js'\nimport {platformAndArch} from './os.js'\nimport {version as rubyVersion} from './public/node/ruby.js'\nimport {content, debug, token} from './output.js'\nimport constants from './constants.js'\nimport * as metadata from './metadata.js'\nimport {publishEvent, MONORAIL_COMMAND_TOPIC} from './monorail.js'\nimport {fanoutHooks, getListOfTunnelPlugins} from './plugins.js'\nimport {getPackageManager, packageManagerUsedForCreating} from './public/node/node-package-manager.js'\nimport BaseCommand from './public/node/base-command.js'\nimport {CommandContent} from './public/node/hooks/prerun.js'\nimport {hashString} from './string.js'\nimport {macAddress} from './environment/local.js'\nimport {Config, Interfaces} from '@oclif/core'\n\ninterface StartOptions {\n commandContent: CommandContent\n args: string[]\n currentTime?: number\n commandClass?: Interfaces.Command.Class | typeof BaseCommand\n}\n\nexport const start = async ({commandContent, args, currentTime = new Date().getTime(), commandClass}: StartOptions) => {\n let startCommand: string = commandContent.command\n if (commandClass && Object.prototype.hasOwnProperty.call(commandClass, 'analyticsNameOverride')) {\n startCommand = (commandClass as typeof BaseCommand).analyticsNameOverride() ?? commandContent.command\n }\n\n await metadata.addSensitive(() => ({\n commandStartOptions: {\n startTime: currentTime,\n startCommand,\n startArgs: args,\n },\n }))\n\n await metadata.addPublic(() => ({\n cmd_all_launcher: packageManagerUsedForCreating(),\n cmd_all_alias_used: commandContent.alias,\n cmd_all_topic: commandContent.topic,\n cmd_all_plugin: commandClass?.plugin?.name,\n }))\n}\n\ninterface ReportEventOptions {\n config: Interfaces.Config\n errorMessage?: string\n}\n\n/**\n * Report an analytics event, sending it off to Monorail -- Shopify's internal analytics service.\n *\n * The payload for an event includes both generic data, and data gathered from installed plug-ins.\n *\n */\nexport async function reportEvent(options: ReportEventOptions) {\n try {\n const payload = await buildPayload(options)\n if (payload === undefined) {\n // Nothing to log\n return\n }\n if (!environment.local.alwaysLogAnalytics() && environment.local.analyticsDisabled()) {\n debug(content`Skipping command analytics, payload: ${token.json(payload)}`)\n return\n }\n const response = await publishEvent(MONORAIL_COMMAND_TOPIC, payload.public, payload.sensitive)\n if (response.type === 'error') {\n debug(response.message)\n }\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch (error) {\n let message = 'Failed to report usage analytics'\n if (error instanceof Error) {\n message = message.concat(`: ${error.message}`)\n }\n debug(message)\n }\n}\n\n/**\n * Return the name of the tunnel provider used to send analytics. Returns 'localhost' or provider name if any of those\n * strings are included in the {@link tunnelUrl} param. Returns 'custom' otherwise\n *\n * @param options - Oclif configuration. Needed to call the hook for retrieving the list of tunner providers\n * @param tunnelUrl - Tunnel url. Used as pattern to match provider name\n * @returns 'localhost' or provider name if any of those strings are included in\n * the tunnelUrl or 'custom' otherwise\n */\nexport async function getAnalyticsTunnelType(options: Config, tunnelUrl: string): Promise<string | undefined> {\n if (!tunnelUrl) {\n return\n }\n\n if (tunnelUrl.includes('localhost')) {\n return 'localhost'\n }\n\n const provider = (await getListOfTunnelPlugins(options)).plugins.find((plugin) => tunnelUrl?.includes(plugin))\n return provider ?? 'custom'\n}\n\nconst buildPayload = async ({config, errorMessage}: ReportEventOptions) => {\n const {commandStartOptions, ...sensitiveMetadata} = metadata.getAllSensitive()\n if (commandStartOptions === undefined) {\n debug('Unable to log analytics event - no information on executed command')\n return\n }\n const {startCommand, startArgs, startTime} = commandStartOptions\n const currentTime = new Date().getTime()\n\n const {'@shopify/app': appPublic, ...otherPluginsPublic} = await fanoutHooks(config, 'public_command_metadata', {})\n const {'@shopify/app': appSensitive, ...otherPluginsSensitive} = await fanoutHooks(\n config,\n 'sensitive_command_metadata',\n {},\n )\n\n const environmentData = await getEnvironmentData(config)\n const sensitiveEnvironmentData = await getSensitiveEnvironmentData(config)\n\n return {\n public: {\n command: startCommand,\n time_start: startTime,\n time_end: currentTime,\n total_time: currentTime - startTime,\n success: errorMessage === undefined,\n cli_version: await constants.versions.cliKit(),\n ruby_version: (await rubyVersion()) || '',\n node_version: process.version.replace('v', ''),\n is_employee: await environment.local.isShopify(),\n ...environmentData,\n ...appPublic,\n ...metadata.getAllPublic(),\n },\n sensitive: {\n args: startArgs.join(' '),\n error_message: errorMessage,\n ...appSensitive,\n ...sensitiveEnvironmentData,\n metadata: JSON.stringify({\n ...sensitiveMetadata,\n extraPublic: {\n ...otherPluginsPublic,\n },\n extraSensitive: {...otherPluginsSensitive},\n }),\n },\n }\n}\n\nexport async function getEnvironmentData(config: Interfaces.Config) {\n const ciPlatform = environment.local.ciPlatform()\n\n const pluginNames = getPluginNames(config)\n const shopifyPlugins = pluginNames.filter((plugin) => plugin.startsWith('@shopify/'))\n\n const {platform, arch} = platformAndArch()\n\n return {\n uname: `${platform} ${arch}`,\n env_ci: ciPlatform.isCI,\n env_ci_platform: ciPlatform.name,\n env_plugin_installed_any_custom: pluginNames.length !== shopifyPlugins.length,\n env_plugin_installed_shopify: JSON.stringify(shopifyPlugins),\n env_shell: config.shell,\n env_web_ide: environment.local.cloudEnvironment().editor\n ? environment.local.cloudEnvironment().platform\n : undefined,\n env_device_id: hashString(await macAddress()),\n env_cloud: environment.local.cloudEnvironment().platform,\n env_package_manager: await getPackageManager(process.cwd()),\n }\n}\n\nasync function getSensitiveEnvironmentData(config: Interfaces.Config) {\n return {\n env_plugin_installed_all: JSON.stringify(getPluginNames(config)),\n }\n}\n\nfunction getPluginNames(config: Interfaces.Config) {\n return config.plugins\n .map((plugin) => plugin.name)\n .sort()\n .filter((plugin) => !plugin.startsWith('@oclif/'))\n}\n"]}
package/dist/id.d.ts DELETED
@@ -1,6 +0,0 @@
1
- /**
2
- * Generates and returns a random UUID.
3
- * @returns The random UUID generated.
4
- */
5
- export declare const generateRandomUUID: () => string;
6
- export declare const generateShortId: () => string;
package/dist/id.js DELETED
@@ -1,18 +0,0 @@
1
- import { randomUUID } from 'crypto';
2
- /**
3
- * Generates and returns a random UUID.
4
- * @returns The random UUID generated.
5
- */
6
- export const generateRandomUUID = () => {
7
- return randomUUID();
8
- };
9
- export const generateShortId = () => {
10
- let result = '';
11
- const characters = 'abcdefghijklmnopqrstuvwxyz0123456789';
12
- const charactersLength = characters.length;
13
- for (let i = 0; i < 7; i++) {
14
- result += characters.charAt(Math.floor(Math.random() * charactersLength));
15
- }
16
- return result;
17
- };
18
- //# sourceMappingURL=id.js.map
package/dist/id.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"id.js","sourceRoot":"","sources":["../src/id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,QAAQ,CAAA;AAEjC;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAW,EAAE;IAC7C,OAAO,UAAU,EAAE,CAAA;AACrB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,GAAW,EAAE;IAC1C,IAAI,MAAM,GAAG,EAAE,CAAA;IACf,MAAM,UAAU,GAAG,sCAAsC,CAAA;IACzD,MAAM,gBAAgB,GAAG,UAAU,CAAC,MAAM,CAAA;IAC1C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;QAC1B,MAAM,IAAI,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,gBAAgB,CAAC,CAAC,CAAA;KAC1E;IACD,OAAO,MAAM,CAAA;AACf,CAAC,CAAA","sourcesContent":["import {randomUUID} from 'crypto'\n\n/**\n * Generates and returns a random UUID.\n * @returns The random UUID generated.\n */\nexport const generateRandomUUID = (): string => {\n return randomUUID()\n}\n\nexport const generateShortId = (): string => {\n let result = ''\n const characters = 'abcdefghijklmnopqrstuvwxyz0123456789'\n const charactersLength = characters.length\n for (let i = 0; i < 7; i++) {\n result += characters.charAt(Math.floor(Math.random() * charactersLength))\n }\n return result\n}\n"]}
package/dist/json.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"json.js","sourceRoot":"","sources":["../src/json.ts"],"names":[],"mappings":"","sourcesContent":["export interface JsonMap {\n [key: string]: AnyJson\n}\ntype JsonArray = undefined[] | null[] | boolean[] | number[] | string[] | JsonMap[] | Date[]\nexport type AnyJson = undefined | null | boolean | number | string | JsonMap | Date | JsonArray | JsonArray[]\n"]}
@@ -1,23 +0,0 @@
1
- import SelectInput from './SelectInput.js';
2
- import Table from './Table.js';
3
- import React, { useState } from 'react';
4
- import { Box, Text } from 'ink';
5
- import { figures } from 'listr2';
6
- export default function Prompt({ message, choices, infoTable, onChoose, }) {
7
- const [answer, setAnswer] = useState(null);
8
- return (React.createElement(Box, { flexDirection: "column", marginBottom: 1 },
9
- React.createElement(Box, null,
10
- React.createElement(Box, { marginRight: 2 },
11
- React.createElement(Text, null, "?")),
12
- React.createElement(Text, null, message)),
13
- infoTable && !answer && (React.createElement(Box, { marginLeft: 7 },
14
- React.createElement(Table, { table: infoTable }))),
15
- answer ? (React.createElement(Box, null,
16
- React.createElement(Box, { marginRight: 2 },
17
- React.createElement(Text, { color: "cyan" }, figures.tick)),
18
- React.createElement(Text, { color: "cyan" }, answer.label))) : (React.createElement(SelectInput, { items: choices, onSelect: (value) => {
19
- setAnswer(choices.find((choice) => choice.value === value) ?? null);
20
- onChoose(value);
21
- } }))));
22
- }
23
- //# sourceMappingURL=Prompt.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Prompt.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/Prompt.tsx"],"names":[],"mappings":"AAAA,OAAO,WAAuD,MAAM,kBAAkB,CAAA;AACtF,OAAO,KAA4B,MAAM,YAAY,CAAA;AACrD,OAAO,KAAK,EAAE,EAAC,QAAQ,EAAC,MAAM,OAAO,CAAA;AACrC,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,MAAM,KAAK,CAAA;AAC7B,OAAO,EAAC,OAAO,EAAC,MAAM,QAAQ,CAAA;AAS9B,MAAM,CAAC,OAAO,UAAU,MAAM,CAAI,EAChC,OAAO,EACP,OAAO,EACP,SAAS,EACT,QAAQ,GAC0B;IAClC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAuB,IAAI,CAAC,CAAA;IAEhE,OAAO,CACL,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,YAAY,EAAE,CAAC;QACzC,oBAAC,GAAG;YACF,oBAAC,GAAG,IAAC,WAAW,EAAE,CAAC;gBACjB,oBAAC,IAAI,YAAS,CACV;YACN,oBAAC,IAAI,QAAE,OAAO,CAAQ,CAClB;QACL,SAAS,IAAI,CAAC,MAAM,IAAI,CACvB,oBAAC,GAAG,IAAC,UAAU,EAAE,CAAC;YAChB,oBAAC,KAAK,IAAC,KAAK,EAAE,SAAS,GAAI,CACvB,CACP;QACA,MAAM,CAAC,CAAC,CAAC,CACR,oBAAC,GAAG;YACF,oBAAC,GAAG,IAAC,WAAW,EAAE,CAAC;gBACjB,oBAAC,IAAI,IAAC,KAAK,EAAC,MAAM,IAAE,OAAO,CAAC,IAAI,CAAQ,CACpC;YAEN,oBAAC,IAAI,IAAC,KAAK,EAAC,MAAM,IAAE,MAAM,CAAC,KAAK,CAAQ,CACpC,CACP,CAAC,CAAC,CAAC,CACF,oBAAC,WAAW,IACV,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,CAAC,KAAQ,EAAE,EAAE;gBACrB,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,KAAK,KAAK,CAAC,IAAI,IAAI,CAAC,CAAA;gBACnE,QAAQ,CAAC,KAAK,CAAC,CAAA;YACjB,CAAC,GACD,CACH,CACG,CACP,CAAA;AACH,CAAC","sourcesContent":["import SelectInput, {Props as SelectProps, Item as SelectItem} from './SelectInput.js'\nimport Table, {Props as TableProps} from './Table.js'\nimport React, {useState} from 'react'\nimport {Box, Text} from 'ink'\nimport {figures} from 'listr2'\n\nexport interface Props<T> {\n message: string\n choices: SelectProps<T>['items']\n onChoose: SelectProps<T>['onSelect']\n infoTable?: TableProps['table']\n}\n\nexport default function Prompt<T>({\n message,\n choices,\n infoTable,\n onChoose,\n}: React.PropsWithChildren<Props<T>>): JSX.Element | null {\n const [answer, setAnswer] = useState<SelectItem<T> | null>(null)\n\n return (\n <Box flexDirection=\"column\" marginBottom={1}>\n <Box>\n <Box marginRight={2}>\n <Text>?</Text>\n </Box>\n <Text>{message}</Text>\n </Box>\n {infoTable && !answer && (\n <Box marginLeft={7}>\n <Table table={infoTable} />\n </Box>\n )}\n {answer ? (\n <Box>\n <Box marginRight={2}>\n <Text color=\"cyan\">{figures.tick}</Text>\n </Box>\n\n <Text color=\"cyan\">{answer.label}</Text>\n </Box>\n ) : (\n <SelectInput\n items={choices}\n onSelect={(value: T) => {\n setAnswer(choices.find((choice) => choice.value === value) ?? null)\n onChoose(value)\n }}\n />\n )}\n </Box>\n )\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Prompt.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/Prompt.test.tsx"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,EAAC,SAAS,EAAE,sBAAsB,EAAC,MAAM,2BAA2B,CAAA;AAC3E,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAC,MAAM,QAAQ,CAAA;AACjD,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAA;AAE1C,MAAM,UAAU,GAAG,UAAU,CAAA;AAC7B,MAAM,KAAK,GAAG,IAAI,CAAA;AAElB,QAAQ,CAAC,QAAQ,EAAE,KAAK,IAAI,EAAE;IAC5B,IAAI,CAAC,kBAAkB,EAAE,KAAK,IAAI,EAAE;QAClC,MAAM,OAAO,GAAG,EAAE,CAAC,EAAE,EAAE,CAAA;QAEvB,MAAM,KAAK,GAAG;YACZ,EAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAC;YAChC,EAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAC;YAClC,EAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAC;SACjC,CAAA;QAED,MAAM,SAAS,GAAG,EAAC,GAAG,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC,uBAAuB,EAAE,gBAAgB,CAAC,EAAC,CAAA;QAEzF,MAAM,cAAc,GAAG,MAAM,CAC3B,oBAAC,MAAM,IACL,OAAO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EAAC;YACzD,EAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAC;SACjC,CAAA;QAED,MAAM,SAAS,GAAG;YAChB,GAAG,EAAE,CAAC,SAAS,CAAC;YAChB,MAAM,EAAE,CAAC,uBAAuB,EAAE,gBAAgB,CAAC;SACpD,CAAA;QAED,MAAM,cAAc,GAAG,MAAM,CAC3B,oBAAC,MAAM,IACL,OAAO,EAAC,uDAAuD,EAC/D,OAAO,EAAE,KAAK,EACd,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC,GAClB,CACH,CAAA;QAED,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;KAwBxD,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import Prompt from './Prompt.js'\nimport {sendInput, waitForInputsToBeReady} from '../../../../testing/ui.js'\nimport {describe, expect, test, vi} from 'vitest'\nimport React from 'react'\nimport {render} from 'ink-testing-library'\n\nconst ARROW_DOWN = '\\u001B[B'\nconst ENTER = '\\r'\n\ndescribe('Prompt', async () => {\n test('choose an answer', async () => {\n const onEnter = vi.fn()\n\n const items = [\n {label: 'first', value: 'first'},\n {label: 'second', value: 'second'},\n {label: 'third', value: 'third'},\n ]\n\n const infoTable = {Add: ['new-ext'], Remove: ['integrated-demand-ext', 'order-discount']}\n\n const renderInstance = render(\n <Prompt\n message=\"Associate your project with the org Castile Ventures?\"\n choices={items}\n infoTable={infoTable}\n onChoose={onEnter}\n />,\n )\n\n await waitForInputsToBeReady()\n await sendInput(renderInstance, ARROW_DOWN)\n await sendInput(renderInstance, ENTER)\n\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures?\n \u001b[36m✔\u001b[39m \u001b[36msecond\u001b[39m\n \"\n `)\n expect(onEnter).toHaveBeenCalledWith(items[1]!.value)\n })\n\n test('supports an info table', async () => {\n const items = [\n {label: 'first', value: 'first', key: 'f'},\n {label: 'second', value: 'second', key: 's'},\n {label: 'third', value: 'third'},\n {label: 'fourth', value: 'fourth'},\n {label: 'fifth', value: 'fifth', group: 'Automations'},\n {label: 'sixth', value: 'sixth', group: 'Automations'},\n {label: 'seventh', value: 'seventh'},\n {label: 'eighth', value: 'eighth', group: 'Merchant Admin'},\n {label: 'ninth', value: 'ninth', group: 'Merchant Admin'},\n {label: 'tenth', value: 'tenth'},\n ]\n\n const infoTable = {\n Add: ['new-ext'],\n Remove: ['integrated-demand-ext', 'order-discount'],\n }\n\n const renderInstance = render(\n <Prompt\n message=\"Associate your project with the org Castile Ventures?\"\n choices={items}\n infoTable={infoTable}\n onChoose={() => {}}\n />,\n )\n\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures?\n\n Add: • new-ext\n Remove: • integrated-demand-ext\n • order-discount\n\n \u001b[36m>\u001b[39m \u001b[36m(f) first\u001b[39m\n (s) second\n (3) third\n (4) fourth\n (5) seventh\n (6) tenth\n\n \u001b[1mAutomations\u001b[22m\n (7) fifth\n (8) sixth\n\n \u001b[1mMerchant Admin\u001b[22m\n (9) eighth\n (10) ninth\n\n \u001b[2mnavigate with arrows, enter to select\u001b[22m\n \"\n `)\n })\n})\n"]}