@shopify/cli-kit 3.44.1 → 3.45.0-pre.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 (93) hide show
  1. package/README.md +15 -7
  2. package/assets/cli-ruby/lib/project_types/extension/messages/messages.rb +0 -2
  3. package/assets/cli-ruby/lib/project_types/theme/commands/pull.rb +6 -0
  4. package/assets/cli-ruby/lib/project_types/theme/commands/push.rb +6 -0
  5. package/assets/cli-ruby/lib/shopify_cli/constants.rb +1 -0
  6. package/assets/cli-ruby/lib/shopify_cli/environment.rb +4 -0
  7. package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/proxy.rb +3 -0
  8. package/assets/cli-ruby/lib/shopify_cli/theme/extension/dev_server.rb +3 -3
  9. package/assets/cli-ruby/lib/shopify_cli/theme/extension/host_theme.rb +4 -4
  10. package/assets/cli-ruby/lib/shopify_cli/theme/extension/syncer/extension_serve_job.rb +4 -6
  11. package/assets/cli-ruby/lib/shopify_cli/theme/extension/ui/host_theme_raw_progress_bar.rb +40 -0
  12. package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/progress_plain.rb +50 -0
  13. package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui.rb +15 -14
  14. package/dist/private/node/api/graphql.js +12 -23
  15. package/dist/private/node/api/graphql.js.map +1 -1
  16. package/dist/private/node/api.d.ts +1 -1
  17. package/dist/private/node/api.js +28 -9
  18. package/dist/private/node/api.js.map +1 -1
  19. package/dist/private/node/constants.d.ts +0 -1
  20. package/dist/private/node/constants.js +0 -1
  21. package/dist/private/node/constants.js.map +1 -1
  22. package/dist/private/node/testing/ui.d.ts +11 -0
  23. package/dist/private/node/testing/ui.js +15 -1
  24. package/dist/private/node/testing/ui.js.map +1 -1
  25. package/dist/private/node/ui/alert.d.ts +5 -1
  26. package/dist/private/node/ui/alert.js +2 -2
  27. package/dist/private/node/ui/alert.js.map +1 -1
  28. package/dist/private/node/ui/components/AutocompletePrompt.js +38 -12
  29. package/dist/private/node/ui/components/AutocompletePrompt.js.map +1 -1
  30. package/dist/private/node/ui/components/AutocompletePrompt.test.js +56 -36
  31. package/dist/private/node/ui/components/AutocompletePrompt.test.js.map +1 -1
  32. package/dist/private/node/ui/components/ConcurrentOutput.d.ts +5 -1
  33. package/dist/private/node/ui/components/ConcurrentOutput.js +15 -13
  34. package/dist/private/node/ui/components/ConcurrentOutput.js.map +1 -1
  35. package/dist/private/node/ui/components/ConcurrentOutput.test.js +20 -11
  36. package/dist/private/node/ui/components/ConcurrentOutput.test.js.map +1 -1
  37. package/dist/private/node/ui/components/FullScreen.js +1 -1
  38. package/dist/private/node/ui/components/FullScreen.js.map +1 -1
  39. package/dist/private/node/ui/components/SelectInput.d.ts +7 -2
  40. package/dist/private/node/ui/components/SelectInput.js +73 -60
  41. package/dist/private/node/ui/components/SelectInput.js.map +1 -1
  42. package/dist/private/node/ui/components/SelectInput.test.js +72 -2
  43. package/dist/private/node/ui/components/SelectInput.test.js.map +1 -1
  44. package/dist/private/node/ui/components/SelectPrompt.js +38 -12
  45. package/dist/private/node/ui/components/SelectPrompt.js.map +1 -1
  46. package/dist/private/node/ui/components/SelectPrompt.test.js +52 -1
  47. package/dist/private/node/ui/components/SelectPrompt.test.js.map +1 -1
  48. package/dist/private/node/ui/components/Tasks.js +9 -1
  49. package/dist/private/node/ui/components/Tasks.js.map +1 -1
  50. package/dist/private/node/ui/components/TextAnimation.js +4 -4
  51. package/dist/private/node/ui/components/TextAnimation.js.map +1 -1
  52. package/dist/private/node/ui/components/TextPrompt.js +4 -4
  53. package/dist/private/node/ui/components/TextPrompt.js.map +1 -1
  54. package/dist/private/node/ui/hooks/use-layout.d.ts +6 -0
  55. package/dist/private/node/ui/hooks/use-layout.js +31 -12
  56. package/dist/private/node/ui/hooks/use-layout.js.map +1 -1
  57. package/dist/private/node/ui.d.ts +11 -3
  58. package/dist/private/node/ui.js +14 -10
  59. package/dist/private/node/ui.js.map +1 -1
  60. package/dist/public/common/object.d.ts +1 -1
  61. package/dist/public/common/object.js +1 -1
  62. package/dist/public/common/object.js.map +1 -1
  63. package/dist/public/common/version.d.ts +1 -1
  64. package/dist/public/common/version.js +1 -1
  65. package/dist/public/common/version.js.map +1 -1
  66. package/dist/public/node/base-command.d.ts +1 -4
  67. package/dist/public/node/base-command.js +17 -19
  68. package/dist/public/node/base-command.js.map +1 -1
  69. package/dist/public/node/context/local.d.ts +0 -7
  70. package/dist/public/node/context/local.js +0 -9
  71. package/dist/public/node/context/local.js.map +1 -1
  72. package/dist/public/node/environments.d.ts +7 -8
  73. package/dist/public/node/environments.js +23 -25
  74. package/dist/public/node/environments.js.map +1 -1
  75. package/dist/public/node/node-package-manager.d.ts +1 -1
  76. package/dist/public/node/node-package-manager.js.map +1 -1
  77. package/dist/public/node/output.d.ts +1 -1
  78. package/dist/public/node/output.js.map +1 -1
  79. package/dist/public/node/path.js +1 -1
  80. package/dist/public/node/path.js.map +1 -1
  81. package/dist/public/node/ruby.d.ts +1 -0
  82. package/dist/public/node/ruby.js +35 -15
  83. package/dist/public/node/ruby.js.map +1 -1
  84. package/dist/public/node/themes/theme-manager.d.ts +1 -1
  85. package/dist/public/node/themes/theme-manager.js.map +1 -1
  86. package/dist/public/node/ui.d.ts +182 -121
  87. package/dist/public/node/ui.js +172 -120
  88. package/dist/public/node/ui.js.map +1 -1
  89. package/dist/tsconfig.tsbuildinfo +1 -1
  90. package/package.json +20 -18
  91. package/dist/private/node/ui/components/TextWithBackground.d.ts +0 -12
  92. package/dist/private/node/ui/components/TextWithBackground.js +0 -39
  93. package/dist/private/node/ui/components/TextWithBackground.js.map +0 -1
@@ -1,6 +1,8 @@
1
+ /* eslint-disable tsdoc/syntax */
1
2
  import { AbortSilentError } from './error.js';
2
3
  import { collectLog, consoleError, consoleLog, outputDebug, outputWhereAppropriate } from './output.js';
3
4
  import { isUnitTest } from './context/local.js';
5
+ import { AbortController } from './abort.js';
4
6
  import { ConcurrentOutput } from '../../private/node/ui/components/ConcurrentOutput.js';
5
7
  import { render, renderOnce } from '../../private/node/ui.js';
6
8
  import { alert } from '../../private/node/ui/alert.js';
@@ -11,11 +13,23 @@ import { Tasks } from '../../private/node/ui/components/Tasks.js';
11
13
  import { TextPrompt } from '../../private/node/ui/components/TextPrompt.js';
12
14
  import { AutocompletePrompt } from '../../private/node/ui/components/AutocompletePrompt.js';
13
15
  import React from 'react';
14
- import { AbortController } from '@shopify/cli-kit/node/abort';
15
16
  /**
16
17
  * Renders output from concurrent processes to the terminal with {@link ConcurrentOutput}.
18
+ * @example
19
+ * 0000-00-00 00:00:00 | backend | first backend message
20
+ * 0000-00-00 00:00:00 | backend | second backend message
21
+ * 0000-00-00 00:00:00 | backend | third backend message
22
+ * 0000-00-00 00:00:00 | frontend | first frontend message
23
+ * 0000-00-00 00:00:00 | frontend | second frontend message
24
+ * 0000-00-00 00:00:00 | frontend | third frontend message
25
+ *
26
+ * › Press p | open your browser
27
+ * › Press q | quit.
28
+ *
29
+ * Preview URL: https://shopify.com
30
+ *
17
31
  */
18
- export async function renderConcurrent({ renderOptions = {}, ...props }) {
32
+ export async function renderConcurrent({ renderOptions, ...props }) {
19
33
  const newProps = {
20
34
  abortController: new AbortController(),
21
35
  ...props,
@@ -27,185 +41,188 @@ export async function renderConcurrent({ renderOptions = {}, ...props }) {
27
41
  }
28
42
  /**
29
43
  * Renders an information banner to the console.
30
- *
31
- * Basic:
32
- *
33
- * ```
44
+ * @example Basic
34
45
  * ╭─ info ───────────────────────────────────────────────────╮
35
46
  * │ │
36
- * │ Body
47
+ * │ CLI update available
48
+ * │ │
49
+ * │ Run `npm run shopify upgrade`. │
37
50
  * │ │
38
51
  * ╰──────────────────────────────────────────────────────────╯
39
- * ```
40
52
  *
41
- * Complete:
42
- * ```
53
+ * @example Complete
43
54
  * ╭─ info ───────────────────────────────────────────────────╮
44
55
  * │ │
45
- * │ Title
46
- * │ │
47
- * │ Body │
56
+ * │ my-app initialized and ready to build.
48
57
  * │ │
49
58
  * │ Next steps │
50
- * │ • Run `cd santorini-goods`
59
+ * │ • Run `cd verification-app`
51
60
  * │ • To preview your project, run `npm app dev` │
52
61
  * │ • To add extensions, run `npm generate extension` │
53
62
  * │ │
54
63
  * │ Reference │
55
64
  * │ • Run `npm shopify help` │
56
- * │ • Press 'return' to open the dev docs:
57
- * │ https://shopify.dev │
65
+ * │ • Dev docs ( https://shopify.dev )
58
66
  * │ │
59
- * │ Link: https://shopify.com
67
+ * │ Custom section
68
+ * │ • Item 1 │
69
+ * │ • Item 2 │
70
+ * │ • Item 3 │
60
71
  * │ │
61
72
  * ╰──────────────────────────────────────────────────────────╯
62
- * ```
73
+ *
63
74
  */
64
75
  export function renderInfo(options) {
65
76
  return alert({ ...options, type: 'info' });
66
77
  }
67
78
  /**
68
79
  * Renders a success banner to the console.
69
- *
70
- * Basic:
71
- *
72
- * ```
80
+ * @example Basic
73
81
  * ╭─ success ────────────────────────────────────────────────╮
74
82
  * │ │
75
- * │ Title
83
+ * │ CLI updated.
84
+ * │ │
85
+ * │ You are now running version 3.47. │
76
86
  * │ │
77
87
  * ╰──────────────────────────────────────────────────────────╯
78
- * ```
79
88
  *
80
- * Complete:
81
- * ```
89
+ * @example Complete
82
90
  * ╭─ success ────────────────────────────────────────────────╮
83
91
  * │ │
84
- * │ Title
92
+ * │ Deployment successful.
85
93
  * │ │
86
- * │ Body
94
+ * │ Your extensions have been uploaded to your Shopify
95
+ * │ Partners Dashboard. │
87
96
  * │ │
88
97
  * │ Next steps │
89
- * │ • Run `cd santorini-goods`
90
- * │ • To preview your project, run `npm app dev`
91
- * │ • To add extensions, run `npm generate extension`
92
- * │ │
93
- * │ Reference │
94
- * │ • Run `npm shopify help` │
95
- * │ • Press 'return' to open the dev docs: │
96
- * │ https://shopify.dev │
97
- * │ │
98
- * │ Link: https://shopify.com │
98
+ * │ • See your deployment and set it live ( https://part
99
+ * │ ners.shopify.com/1797046/apps/4523695/deployments
100
+ * │ )
99
101
  * │ │
100
102
  * ╰──────────────────────────────────────────────────────────╯
101
- * ```
103
+ *
102
104
  */
103
105
  export function renderSuccess(options) {
104
106
  return alert({ ...options, type: 'success' });
105
107
  }
106
108
  /**
107
109
  * Renders a warning banner to the console.
108
- *
109
- * Basic:
110
- *
111
- * ```
110
+ * @example Basic
112
111
  * ╭─ warning ────────────────────────────────────────────────╮
113
112
  * │ │
114
- * │ Title
113
+ * │ You have reached your limit of checkout extensions for
114
+ * │ this app. │
115
+ * │ │
116
+ * │ You can free up space for a new one by deleting an │
117
+ * │ existing one. │
115
118
  * │ │
116
119
  * ╰──────────────────────────────────────────────────────────╯
117
- * ```
118
120
  *
119
- * Complete:
120
- * ```
121
+ * @example Complete
121
122
  * ╭─ warning ────────────────────────────────────────────────╮
122
123
  * │ │
123
- * │ Title
124
- * │ │
125
- * │ Body │
124
+ * │ Required access scope update.
126
125
  * │ │
127
- * │ Next steps
128
- * │ Run `cd santorini-goods`
129
- * │ • To preview your project, run `npm app dev` │
130
- * │ • To add extensions, run `npm generate extension` │
126
+ * │ The deadline for re-selecting your app scopes is May
127
+ * │ 1, 2022.
131
128
  * │ │
132
129
  * │ Reference │
133
- * │ • Run `npm shopify help`
134
- * │ • Press 'return' to open the dev docs: │
135
- * │ https://shopify.dev │
136
- * │ │
137
- * │ Link: https://shopify.com │
130
+ * │ • Dev docs ( https://shopify.dev/app/scopes )
138
131
  * │ │
139
132
  * ╰──────────────────────────────────────────────────────────╯
140
- * ```
133
+ *
141
134
  */
142
135
  export function renderWarning(options) {
143
136
  return alert({ ...options, type: 'warning' });
144
137
  }
145
138
  /**
146
139
  * Renders a Fatal error to the console inside a banner.
140
+ * @example Basic
141
+ * ╭─ error ──────────────────────────────────────────────────╮
142
+ * │ │
143
+ * │ Something went wrong. │
144
+ * │ │
145
+ * │ To investigate the issue, examine this stack trace: │
146
+ * │ at _compile (internal/modules/cjs/loader.js:1137) │
147
+ * │ at js (internal/modules/cjs/loader.js:1157) │
148
+ * │ at load (internal/modules/cjs/loader.js:985) │
149
+ * │ at _load (internal/modules/cjs/loader.js:878) │
150
+ * │ │
151
+ * ╰──────────────────────────────────────────────────────────╯
147
152
  *
148
- * ```
153
+ * @example Complete
149
154
  * ╭─ error ──────────────────────────────────────────────────╮
150
155
  * │ │
151
- * │ Couldn't connect to the Shopify Partner Dashboard.
156
+ * │ No Organization found
152
157
  * │ │
153
- * │ Check your internet connection and try again.
158
+ * │ Next steps
159
+ * │ • Have you created a Shopify Partners organization ( │
160
+ * │ https://partners.shopify.com/signup )? │
161
+ * │ • Have you confirmed your accounts from the emails │
162
+ * │ you received? │
163
+ * │ • Need to connect to a different App or │
164
+ * │ organization? Run the command again with `--reset` │
154
165
  * │ │
155
166
  * ╰──────────────────────────────────────────────────────────╯
156
- * ```
167
+ *
157
168
  */
158
- export function renderFatalError(error) {
159
- return renderOnce(React.createElement(FatalError, { error: error }), 'error', consoleError);
169
+ // eslint-disable-next-line max-params
170
+ export function renderFatalError(error, { renderOptions } = {}) {
171
+ return renderOnce(React.createElement(FatalError, { error: error }), { logLevel: 'error', logger: consoleError, renderOptions });
160
172
  }
161
173
  /**
162
174
  * Renders a select prompt to the console.
163
- *
164
- * ```
175
+ * @example
165
176
  * ? Associate your project with the org Castile Ventures?
166
177
  *
167
- * Add: • new-ext
178
+ * Add: • new-ext
168
179
  *
169
- * Remove: • integrated-demand-ext
170
- * • order-discount
180
+ * Remove: • integrated-demand-ext
181
+ * • order-discount
171
182
  *
172
- * \> (f) first
173
- * (s) second
174
- * (3) third
175
- * (4) fourth
176
- * (5) seventh
177
- * (6) tenth
183
+ * Automations
184
+ * > (a) fifth
185
+ * (2) sixth
178
186
  *
179
- * Automations
180
- * (7) fifth
181
- * (8) sixth
187
+ * Merchant Admin
188
+ * (3) eighth
189
+ * (4) ninth
182
190
  *
183
- * Merchant Admin
184
- * (9) eighth
185
- * (10) ninth
191
+ * Other
192
+ * (f) first
193
+ * (s) second
194
+ * (7) third
195
+ * (8) fourth
196
+ * (9) seventh
197
+ * (10) tenth
198
+ *
199
+ * Press ↑↓ arrows to select, enter to confirm
186
200
  *
187
- * Press ↑↓ arrows to select, enter to confirm
188
- * ```
189
201
  */
190
- export function renderSelectPrompt(props) {
202
+ export function renderSelectPrompt({ renderOptions, ...props }) {
191
203
  // eslint-disable-next-line max-params
192
204
  return new Promise((resolve, reject) => {
193
205
  render(React.createElement(SelectPrompt, { ...props, onSubmit: (value) => resolve(value) }), {
206
+ ...renderOptions,
194
207
  exitOnCtrlC: false,
195
208
  }).catch(reject);
196
209
  });
197
210
  }
198
211
  /**
199
212
  * Renders a confirmation prompt to the console.
213
+ * @example
214
+ * ? Delete the following themes from the store?
215
+ *
216
+ * • first theme (#1)
217
+ * • second theme (#2)
200
218
  *
201
- * ? Do you want to continue?
219
+ * > (y) Yes, confirm changes
220
+ * (n) Cancel
202
221
  *
203
- * \> (y) Yes, confirm
204
- * (n) No, canccel
222
+ * Press ↑↓ arrows to select, enter or a shortcut to confirm
205
223
  *
206
- * Press ↑↓ arrows to select, enter to confirm
207
224
  */
208
- export function renderConfirmationPrompt({ message, infoTable, confirmationMessage = 'Yes, confirm', cancellationMessage = 'No, cancel', }) {
225
+ export function renderConfirmationPrompt({ message, infoTable, confirmationMessage = 'Yes, confirm', cancellationMessage = 'No, cancel', renderOptions, }) {
209
226
  const choices = [
210
227
  {
211
228
  label: confirmationMessage,
@@ -223,21 +240,44 @@ export function renderConfirmationPrompt({ message, infoTable, confirmationMessa
223
240
  message,
224
241
  infoTable,
225
242
  submitWithShortcuts: true,
243
+ renderOptions,
226
244
  });
227
245
  }
228
246
  /**
229
247
  * Renders an autocomplete prompt to the console.
230
- * ```
231
- * ? Select a template Type to search...
232
-
233
- * \> first
234
- * second
235
- * third
236
-
237
- * Press ↑↓ arrows to select, enter to confirm
238
- * ```
248
+ * @example
249
+ * ? Select a template: Type to search...
250
+ *
251
+ * > first
252
+ * second
253
+ * third
254
+ * fourth
255
+ * fifth
256
+ * sixth
257
+ * seventh
258
+ * eighth
259
+ * ninth
260
+ * tenth
261
+ * eleventh
262
+ * twelfth
263
+ * thirteenth
264
+ * fourteenth
265
+ * fifteenth
266
+ * sixteenth
267
+ * seventeenth
268
+ * eighteenth
269
+ * nineteenth
270
+ * twentieth
271
+ * twenty-first
272
+ * twenty-second
273
+ * twenty-third
274
+ * twenty-fourth
275
+ * twenty-fifth
276
+ *
277
+ * Press ↑↓ arrows to select, enter to confirm
278
+ *
239
279
  */
240
- export function renderAutocompletePrompt(props) {
280
+ export function renderAutocompletePrompt({ renderOptions, ...props }) {
241
281
  const newProps = {
242
282
  search(term) {
243
283
  return Promise.resolve({
@@ -249,48 +289,59 @@ export function renderAutocompletePrompt(props) {
249
289
  // eslint-disable-next-line max-params
250
290
  return new Promise((resolve, reject) => {
251
291
  render(React.createElement(AutocompletePrompt, { ...newProps, onSubmit: (value) => resolve(value) }), {
292
+ ...renderOptions,
252
293
  exitOnCtrlC: false,
253
294
  }).catch(reject);
254
295
  });
255
296
  }
256
297
  /**
257
298
  * Renders a table to the console.
258
- *
259
- * ```
260
- * name role Identifier
261
- * ──────────────────────── ───────────── ──────────
262
- * Dawn [live] #1361
263
- * Studio #1363
264
- * Debut [unpublished] #1374
265
- * Development (1a23b4-MBP) [development] #1368
266
- * ```
299
+ * @example
300
+ * ID Name email
301
+ * ── ────────── ─────────────
302
+ * 1 John Doe jon@doe.com
303
+ * 2 Jane Doe jane@doe.com
304
+ * 3 John Smith jon@smith.com
267
305
  */
268
- export function renderTable(props) {
269
- return renderOnce(React.createElement(Table, { ...props }));
306
+ export function renderTable({ renderOptions, ...props }) {
307
+ return renderOnce(React.createElement(Table, { ...props }), { renderOptions });
270
308
  }
271
309
  /**
272
310
  * Runs async tasks and displays their progress to the console.
311
+ * @example
312
+ * ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
313
+ * Installing dependencies ...
273
314
  */
274
- export async function renderTasks(tasks) {
275
- return render(React.createElement(Tasks, { tasks: tasks }));
315
+ // eslint-disable-next-line max-params
316
+ export async function renderTasks(tasks, { renderOptions } = {}) {
317
+ return render(React.createElement(Tasks, { tasks: tasks }), {
318
+ ...renderOptions,
319
+ exitOnCtrlC: false,
320
+ });
276
321
  }
277
322
  /**
278
323
  * Renders a text prompt to the console.
279
- * ```
280
- * ? What is your name?
281
- * \> John
282
- * ```
324
+ * @example
325
+ * ? App project name (can be changed later):
326
+ * > expansive commerce app
327
+ * ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
328
+ *
283
329
  */
284
- export function renderTextPrompt(props) {
330
+ export function renderTextPrompt({ renderOptions, ...props }) {
285
331
  // eslint-disable-next-line max-params
286
332
  return new Promise((resolve, reject) => {
287
333
  render(React.createElement(TextPrompt, { ...props, onSubmit: (value) => resolve(value) }), {
334
+ ...renderOptions,
288
335
  exitOnCtrlC: false,
289
336
  }).catch(reject);
290
337
  });
291
338
  }
292
339
  /** Renders a text string to the console.
293
- * Using this function makes sure that correct spacing is applied among the various components. */
340
+ * Using this function makes sure that correct spacing is applied among the various components.
341
+ * @example
342
+ * Hello world!
343
+ *
344
+ */
294
345
  export function renderText({ text, logLevel = 'info', logger = consoleLog }) {
295
346
  let textWithLineReturn = text;
296
347
  if (!text.endsWith('\n'))
@@ -298,6 +349,7 @@ export function renderText({ text, logLevel = 'info', logger = consoleLog }) {
298
349
  if (isUnitTest())
299
350
  collectLog(logLevel, textWithLineReturn);
300
351
  outputWhereAppropriate(logLevel, logger, textWithLineReturn);
352
+ return textWithLineReturn;
301
353
  }
302
354
  /** Waits for any key to be pressed except Ctrl+C which will terminate the process. */
303
355
  export const keypress = async () => {
@@ -1 +1 @@
1
- {"version":3,"file":"ui.js","sourceRoot":"","sources":["../../../src/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,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE;gBAClC,WAAW,CAAC,wCAAwC,CAAC,CAAA;gBACrD,MAAM,CAAC,IAAI,gBAAgB,EAAE,CAAC,CAAA;aAC/B;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 {AbortSilentError, FatalError as Fatal} from './error.js'\nimport {collectLog, consoleError, consoleLog, Logger, LogLevel, outputDebug, outputWhereAppropriate} from './output.js'\nimport {isUnitTest} from './context/local.js'\nimport {ConcurrentOutput, ConcurrentOutputProps} from '../../private/node/ui/components/ConcurrentOutput.js'\nimport {render, renderOnce} from '../../private/node/ui.js'\nimport {alert} from '../../private/node/ui/alert.js'\nimport {AlertProps, CustomSection} from '../../private/node/ui/components/Alert.js'\nimport {FatalError} from '../../private/node/ui/components/FatalError.js'\nimport ScalarDict from '../../private/node/ui/components/Table/ScalarDict.js'\nimport {Table, TableColumn, TableProps} from '../../private/node/ui/components/Table/Table.js'\nimport {SelectPrompt, SelectPromptProps} from '../../private/node/ui/components/SelectPrompt.js'\nimport {Tasks, Task} from '../../private/node/ui/components/Tasks.js'\nimport {TextPrompt, TextPromptProps} from '../../private/node/ui/components/TextPrompt.js'\nimport {AutocompletePromptProps, AutocompletePrompt} from '../../private/node/ui/components/AutocompletePrompt.js'\nimport {InlineToken, LinkToken, TokenItem} from '../../private/node/ui/components/TokenizedText.js'\nimport React from 'react'\nimport {Key as InkKey, RenderOptions} from 'ink'\nimport {AbortController} from '@shopify/cli-kit/node/abort'\n\ntype PartialBy<T, TKey extends keyof T> = Omit<T, TKey> & Partial<Pick<T, TKey>>\n\nexport interface RenderConcurrentOptions extends PartialBy<ConcurrentOutputProps, 'abortController'> {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders output from concurrent processes to the terminal with {@link ConcurrentOutput}.\n */\nexport async function renderConcurrent({renderOptions = {}, ...props}: RenderConcurrentOptions) {\n const newProps = {\n abortController: new AbortController(),\n ...props,\n }\n\n return render(<ConcurrentOutput {...newProps} />, {\n ...renderOptions,\n exitOnCtrlC: typeof props.onInput === 'undefined',\n })\n}\n\nexport type AlertCustomSection = CustomSection\nexport type RenderAlertOptions = Omit<AlertProps, 'type'>\n\n/**\n * Renders an information banner to the console.\n *\n * Basic:\n *\n * ```\n * ╭─ info ───────────────────────────────────────────────────╮\n * │ │\n * │ Body │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n *\n * Complete:\n * ```\n * ╭─ info ───────────────────────────────────────────────────╮\n * │ │\n * │ Title │\n * │ │\n * │ Body │\n * │ │\n * │ Next steps │\n * │ • Run `cd santorini-goods` │\n * │ • To preview your project, run `npm app dev` │\n * │ • To add extensions, run `npm generate extension` │\n * │ │\n * │ Reference │\n * │ • Run `npm shopify help` │\n * │ • Press 'return' to open the dev docs: │\n * │ https://shopify.dev │\n * │ │\n * │ Link: https://shopify.com │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n */\nexport function renderInfo(options: RenderAlertOptions) {\n return alert({...options, type: 'info'})\n}\n\n/**\n * Renders a success banner to the console.\n *\n * Basic:\n *\n * ```\n * ╭─ success ────────────────────────────────────────────────╮\n * │ │\n * │ Title │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n *\n * Complete:\n * ```\n * ╭─ success ────────────────────────────────────────────────╮\n * │ │\n * │ Title │\n * │ │\n * │ Body │\n * │ │\n * │ Next steps │\n * │ • Run `cd santorini-goods` │\n * │ • To preview your project, run `npm app dev` │\n * │ • To add extensions, run `npm generate extension` │\n * │ │\n * │ Reference │\n * │ • Run `npm shopify help` │\n * │ • Press 'return' to open the dev docs: │\n * │ https://shopify.dev │\n * │ │\n * │ Link: https://shopify.com │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n */\nexport function renderSuccess(options: RenderAlertOptions) {\n return alert({...options, type: 'success'})\n}\n\n/**\n * Renders a warning banner to the console.\n *\n * Basic:\n *\n * ```\n * ╭─ warning ────────────────────────────────────────────────╮\n * │ │\n * │ Title │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n *\n * Complete:\n * ```\n * ╭─ warning ────────────────────────────────────────────────╮\n * │ │\n * │ Title │\n * │ │\n * │ Body │\n * │ │\n * │ Next steps │\n * │ • Run `cd santorini-goods` │\n * │ • To preview your project, run `npm app dev` │\n * │ • To add extensions, run `npm generate extension` │\n * │ │\n * │ Reference │\n * │ • Run `npm shopify help` │\n * │ • Press 'return' to open the dev docs: │\n * │ https://shopify.dev │\n * │ │\n * │ Link: https://shopify.com │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n */\nexport function renderWarning(options: RenderAlertOptions) {\n return alert({...options, type: 'warning'})\n}\n\n/**\n * Renders a Fatal error to the console inside a banner.\n *\n * ```\n * ╭─ error ──────────────────────────────────────────────────╮\n * │ │\n * │ Couldn't connect to the Shopify Partner Dashboard. │\n * │ │\n * │ Check your internet connection and try again. │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n */\nexport function renderFatalError(error: Fatal) {\n return renderOnce(<FatalError error={error} />, 'error', consoleError)\n}\n\n/**\n * Renders a select prompt to the console.\n *\n * ```\n * ? Associate your project with the org Castile Ventures?\n *\n * Add: • new-ext\n *\n * Remove: • integrated-demand-ext\n * • order-discount\n *\n * \\> (f) first\n * (s) second\n * (3) third\n * (4) fourth\n * (5) seventh\n * (6) tenth\n *\n * Automations\n * (7) fifth\n * (8) sixth\n *\n * Merchant Admin\n * (9) eighth\n * (10) ninth\n *\n * Press ↑↓ arrows to select, enter to confirm\n * ```\n */\nexport function renderSelectPrompt<T>(props: Omit<SelectPromptProps<T>, 'onSubmit'>): Promise<T> {\n // eslint-disable-next-line max-params\n return new Promise((resolve, reject) => {\n render(<SelectPrompt {...props} onSubmit={(value: T) => resolve(value)} />, {\n exitOnCtrlC: false,\n }).catch(reject)\n })\n}\n\nexport interface RenderConfirmationPromptOptions extends Pick<SelectPromptProps<boolean>, 'message' | 'infoTable'> {\n confirmationMessage?: string\n cancellationMessage?: string\n}\n\n/**\n * Renders a confirmation prompt to the console.\n *\n * ? Do you want to continue?\n *\n * \\> (y) Yes, confirm\n * (n) No, canccel\n *\n * Press ↑↓ arrows to select, enter to confirm\n */\nexport function renderConfirmationPrompt({\n message,\n infoTable,\n confirmationMessage = 'Yes, confirm',\n cancellationMessage = 'No, cancel',\n}: RenderConfirmationPromptOptions): Promise<boolean> {\n const choices = [\n {\n label: confirmationMessage,\n value: true,\n key: 'y',\n },\n {\n label: cancellationMessage,\n value: false,\n key: 'n',\n },\n ]\n\n return renderSelectPrompt({\n choices,\n message,\n infoTable,\n submitWithShortcuts: true,\n })\n}\n\n/**\n * Renders an autocomplete prompt to the console.\n * ```\n * ? Select a template Type to search...\n\n * \\> first\n * second\n * third\n\n * Press ↑↓ arrows to select, enter to confirm\n * ```\n */\nexport function renderAutocompletePrompt<T>(\n props: PartialBy<Omit<AutocompletePromptProps<T>, 'onSubmit'>, 'search'>,\n): Promise<T> {\n const newProps = {\n search(term: string) {\n return Promise.resolve({\n data: props.choices.filter((item) => item.label.toLowerCase().includes(term.toLowerCase())),\n })\n },\n ...props,\n }\n\n // eslint-disable-next-line max-params\n return new Promise((resolve, reject) => {\n render(<AutocompletePrompt {...newProps} onSubmit={(value: T) => resolve(value)} />, {\n exitOnCtrlC: false,\n }).catch(reject)\n })\n}\n\n/**\n * Renders a table to the console.\n *\n * ```\n * name role Identifier\n * ──────────────────────── ───────────── ──────────\n * Dawn [live] #1361\n * Studio #1363\n * Debut [unpublished] #1374\n * Development (1a23b4-MBP) [development] #1368\n * ```\n */\nexport function renderTable<T extends ScalarDict>(props: TableProps<T>) {\n return renderOnce(<Table {...props} />)\n}\n\n/**\n * Runs async tasks and displays their progress to the console.\n */\nexport async function renderTasks<TContext>(tasks: Task<TContext>[]) {\n return render(<Tasks tasks={tasks} />)\n}\n\n/**\n * Renders a text prompt to the console.\n * ```\n * ? What is your name?\n * \\> John\n * ```\n */\nexport function renderTextPrompt(props: Omit<TextPromptProps, 'onSubmit'>): Promise<string> {\n // eslint-disable-next-line max-params\n return new Promise((resolve, reject) => {\n render(<TextPrompt {...props} onSubmit={(value: string) => resolve(value)} />, {\n exitOnCtrlC: false,\n }).catch(reject)\n })\n}\n\ninterface RenderTextOptions {\n text: string\n logLevel?: LogLevel\n logger?: Logger\n}\n\n/** Renders a text string to the console.\n * Using this function makes sure that correct spacing is applied among the various components. */\nexport function renderText({text, logLevel = 'info', logger = consoleLog}: RenderTextOptions) {\n let textWithLineReturn = text\n if (!text.endsWith('\\n')) textWithLineReturn += '\\n'\n\n if (isUnitTest()) collectLog(logLevel, textWithLineReturn)\n outputWhereAppropriate(logLevel, logger, textWithLineReturn)\n}\n\n/** Waits for any key to be pressed except Ctrl+C which will terminate the process. */\nexport const keypress = async () => {\n // eslint-disable-next-line max-params\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 outputDebug('Canceled keypress, User pressed CTRL+C')\n reject(new AbortSilentError())\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\nexport type Key = InkKey\nexport {Task, TokenItem, InlineToken, LinkToken, TableColumn}\n"]}
1
+ {"version":3,"file":"ui.js","sourceRoot":"","sources":["../../../src/public/node/ui.tsx"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,OAAO,EAAC,gBAAgB,EAAsB,MAAM,YAAY,CAAA;AACh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;AAED,sFAAsF;AACtF,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,IAAI,EAAE;IACjC,sCAAsC;IACtC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,OAAO,GAAG,CAAC,MAAc,EAAE,EAAE;YACjC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;YAC/B,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;YAErB,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;YAEhC,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE;gBAClC,WAAW,CAAC,wCAAwC,CAAC,CAAA;gBACrD,MAAM,CAAC,IAAI,gBAAgB,EAAE,CAAC,CAAA;aAC/B;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":["/* eslint-disable tsdoc/syntax */\nimport {AbortSilentError, FatalError as Fatal} from './error.js'\nimport {collectLog, consoleError, consoleLog, Logger, LogLevel, outputDebug, outputWhereAppropriate} from './output.js'\nimport {isUnitTest} from './context/local.js'\nimport {AbortController} from './abort.js'\nimport {ConcurrentOutput, ConcurrentOutputProps} from '../../private/node/ui/components/ConcurrentOutput.js'\nimport {render, renderOnce} from '../../private/node/ui.js'\nimport {alert, AlertOptions} from '../../private/node/ui/alert.js'\nimport {CustomSection} from '../../private/node/ui/components/Alert.js'\nimport {FatalError} from '../../private/node/ui/components/FatalError.js'\nimport ScalarDict from '../../private/node/ui/components/Table/ScalarDict.js'\nimport {Table, TableColumn, TableProps} from '../../private/node/ui/components/Table/Table.js'\nimport {SelectPrompt, SelectPromptProps} from '../../private/node/ui/components/SelectPrompt.js'\nimport {Tasks, Task} from '../../private/node/ui/components/Tasks.js'\nimport {TextPrompt, TextPromptProps} from '../../private/node/ui/components/TextPrompt.js'\nimport {AutocompletePromptProps, AutocompletePrompt} from '../../private/node/ui/components/AutocompletePrompt.js'\nimport {InlineToken, LinkToken, TokenItem} from '../../private/node/ui/components/TokenizedText.js'\nimport React from 'react'\nimport {Key as InkKey, RenderOptions} from 'ink'\n\ntype PartialBy<T, TKey extends keyof T> = Omit<T, TKey> & Partial<Pick<T, TKey>>\n\nexport interface RenderConcurrentOptions extends PartialBy<ConcurrentOutputProps, 'abortController'> {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders output from concurrent processes to the terminal with {@link ConcurrentOutput}.\n * @example\n * 0000-00-00 00:00:00 | backend | first backend message\n * 0000-00-00 00:00:00 | backend | second backend message\n * 0000-00-00 00:00:00 | backend | third backend message\n * 0000-00-00 00:00:00 | frontend | first frontend message\n * 0000-00-00 00:00:00 | frontend | second frontend message\n * 0000-00-00 00:00:00 | frontend | third frontend message\n *\n * › Press p | open your browser\n * › Press q | quit.\n *\n * Preview URL: https://shopify.com\n *\n */\nexport async function renderConcurrent({renderOptions, ...props}: RenderConcurrentOptions) {\n const newProps = {\n abortController: new AbortController(),\n ...props,\n }\n\n return render(<ConcurrentOutput {...newProps} />, {\n ...renderOptions,\n exitOnCtrlC: typeof props.onInput === 'undefined',\n })\n}\n\nexport type AlertCustomSection = CustomSection\nexport type RenderAlertOptions = Omit<AlertOptions, 'type'>\n\n/**\n * Renders an information banner to the console.\n * @example Basic\n * ╭─ info ───────────────────────────────────────────────────╮\n * │ │\n * │ CLI update available │\n * │ │\n * │ Run `npm run shopify upgrade`. │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n * @example Complete\n * ╭─ info ───────────────────────────────────────────────────╮\n * │ │\n * │ my-app initialized and ready to build. │\n * │ │\n * │ Next steps │\n * │ • Run `cd verification-app` │\n * │ • To preview your project, run `npm app dev` │\n * │ • To add extensions, run `npm generate extension` │\n * │ │\n * │ Reference │\n * │ • Run `npm shopify help` │\n * │ • Dev docs ( https://shopify.dev ) │\n * │ │\n * │ Custom section │\n * │ • Item 1 │\n * │ • Item 2 │\n * │ • Item 3 │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n */\nexport function renderInfo(options: RenderAlertOptions) {\n return alert({...options, type: 'info'})\n}\n\n/**\n * Renders a success banner to the console.\n * @example Basic\n * ╭─ success ────────────────────────────────────────────────╮\n * │ │\n * │ CLI updated. │\n * │ │\n * │ You are now running version 3.47. │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n * @example Complete\n * ╭─ success ────────────────────────────────────────────────╮\n * │ │\n * │ Deployment successful. │\n * │ │\n * │ Your extensions have been uploaded to your Shopify │\n * │ Partners Dashboard. │\n * │ │\n * │ Next steps │\n * │ • See your deployment and set it live ( https://part │\n * │ ners.shopify.com/1797046/apps/4523695/deployments │\n * │ ) │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n */\nexport function renderSuccess(options: RenderAlertOptions) {\n return alert({...options, type: 'success'})\n}\n\n/**\n * Renders a warning banner to the console.\n * @example Basic\n * ╭─ warning ────────────────────────────────────────────────╮\n * │ │\n * │ You have reached your limit of checkout extensions for │\n * │ this app. │\n * │ │\n * │ You can free up space for a new one by deleting an │\n * │ existing one. │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n * @example Complete\n * ╭─ warning ────────────────────────────────────────────────╮\n * │ │\n * │ Required access scope update. │\n * │ │\n * │ The deadline for re-selecting your app scopes is May │\n * │ 1, 2022. │\n * │ │\n * │ Reference │\n * │ • Dev docs ( https://shopify.dev/app/scopes ) │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n */\nexport function renderWarning(options: RenderAlertOptions) {\n return alert({...options, type: 'warning'})\n}\n\ninterface RenderFatalErrorOptions {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a Fatal error to the console inside a banner.\n * @example Basic\n * ╭─ error ──────────────────────────────────────────────────╮\n * │ │\n * │ Something went wrong. │\n * │ │\n * │ To investigate the issue, examine this stack trace: │\n * │ at _compile (internal/modules/cjs/loader.js:1137) │\n * │ at js (internal/modules/cjs/loader.js:1157) │\n * │ at load (internal/modules/cjs/loader.js:985) │\n * │ at _load (internal/modules/cjs/loader.js:878) │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n * @example Complete\n * ╭─ error ──────────────────────────────────────────────────╮\n * │ │\n * │ No Organization found │\n * │ │\n * │ Next steps │\n * │ • Have you created a Shopify Partners organization ( │\n * │ https://partners.shopify.com/signup )? │\n * │ • Have you confirmed your accounts from the emails │\n * │ you received? │\n * │ • Need to connect to a different App or │\n * │ organization? Run the command again with `--reset` │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n */\n// eslint-disable-next-line max-params\nexport function renderFatalError(error: Fatal, {renderOptions}: RenderFatalErrorOptions = {}) {\n return renderOnce(<FatalError error={error} />, {logLevel: 'error', logger: consoleError, renderOptions})\n}\n\nexport interface RenderSeletPromptOptions<T> extends Omit<SelectPromptProps<T>, 'onSubmit'> {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a select prompt to the console.\n * @example\n * ? Associate your project with the org Castile Ventures?\n *\n * Add: • new-ext\n *\n * Remove: • integrated-demand-ext\n * • order-discount\n *\n * Automations\n * > (a) fifth\n * (2) sixth\n *\n * Merchant Admin\n * (3) eighth\n * (4) ninth\n *\n * Other\n * (f) first\n * (s) second\n * (7) third\n * (8) fourth\n * (9) seventh\n * (10) tenth\n *\n * Press ↑↓ arrows to select, enter to confirm\n *\n */\nexport function renderSelectPrompt<T>({renderOptions, ...props}: RenderSeletPromptOptions<T>): Promise<T> {\n // eslint-disable-next-line max-params\n return new Promise((resolve, reject) => {\n render(<SelectPrompt {...props} onSubmit={(value: T) => resolve(value)} />, {\n ...renderOptions,\n exitOnCtrlC: false,\n }).catch(reject)\n })\n}\n\nexport interface RenderConfirmationPromptOptions extends Pick<SelectPromptProps<boolean>, 'message' | 'infoTable'> {\n confirmationMessage?: string\n cancellationMessage?: string\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a confirmation prompt to the console.\n * @example\n * ? Delete the following themes from the store?\n *\n * • first theme (#1)\n * • second theme (#2)\n *\n * > (y) Yes, confirm changes\n * (n) Cancel\n *\n * Press ↑↓ arrows to select, enter or a shortcut to confirm\n *\n */\nexport function renderConfirmationPrompt({\n message,\n infoTable,\n confirmationMessage = 'Yes, confirm',\n cancellationMessage = 'No, cancel',\n renderOptions,\n}: RenderConfirmationPromptOptions): Promise<boolean> {\n const choices = [\n {\n label: confirmationMessage,\n value: true,\n key: 'y',\n },\n {\n label: cancellationMessage,\n value: false,\n key: 'n',\n },\n ]\n\n return renderSelectPrompt({\n choices,\n message,\n infoTable,\n submitWithShortcuts: true,\n renderOptions,\n })\n}\n\nexport interface RenderAutocompleteOptions<T>\n extends PartialBy<Omit<AutocompletePromptProps<T>, 'onSubmit'>, 'search'> {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders an autocomplete prompt to the console.\n * @example\n * ? Select a template: Type to search...\n *\n * > first\n * second\n * third\n * fourth\n * fifth\n * sixth\n * seventh\n * eighth\n * ninth\n * tenth\n * eleventh\n * twelfth\n * thirteenth\n * fourteenth\n * fifteenth\n * sixteenth\n * seventeenth\n * eighteenth\n * nineteenth\n * twentieth\n * twenty-first\n * twenty-second\n * twenty-third\n * twenty-fourth\n * twenty-fifth\n *\n * Press ↑↓ arrows to select, enter to confirm\n *\n */\nexport function renderAutocompletePrompt<T>({renderOptions, ...props}: RenderAutocompleteOptions<T>): Promise<T> {\n const newProps = {\n search(term: string) {\n return Promise.resolve({\n data: props.choices.filter((item) => item.label.toLowerCase().includes(term.toLowerCase())),\n })\n },\n ...props,\n }\n\n // eslint-disable-next-line max-params\n return new Promise((resolve, reject) => {\n render(<AutocompletePrompt {...newProps} onSubmit={(value: T) => resolve(value)} />, {\n ...renderOptions,\n exitOnCtrlC: false,\n }).catch(reject)\n })\n}\n\ninterface RenderTableOptions<T extends ScalarDict> extends TableProps<T> {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a table to the console.\n * @example\n * ID Name email\n * ── ────────── ─────────────\n * 1 John Doe jon@doe.com\n * 2 Jane Doe jane@doe.com\n * 3 John Smith jon@smith.com\n */\nexport function renderTable<T extends ScalarDict>({renderOptions, ...props}: RenderTableOptions<T>) {\n return renderOnce(<Table {...props} />, {renderOptions})\n}\n\ninterface RenderTasksOptions {\n renderOptions?: RenderOptions\n}\n\n/**\n * Runs async tasks and displays their progress to the console.\n * @example\n * ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n * Installing dependencies ...\n */\n// eslint-disable-next-line max-params\nexport async function renderTasks<TContext>(tasks: Task<TContext>[], {renderOptions}: RenderTasksOptions = {}) {\n return render(<Tasks tasks={tasks} />, {\n ...renderOptions,\n exitOnCtrlC: false,\n })\n}\n\nexport interface RenderTextPromptOptions extends Omit<TextPromptProps, 'onSubmit'> {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a text prompt to the console.\n * @example\n * ? App project name (can be changed later):\n * > expansive commerce app\n * ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔\n *\n */\nexport function renderTextPrompt({renderOptions, ...props}: RenderTextPromptOptions): Promise<string> {\n // eslint-disable-next-line max-params\n return new Promise((resolve, reject) => {\n render(<TextPrompt {...props} onSubmit={(value: string) => resolve(value)} />, {\n ...renderOptions,\n exitOnCtrlC: false,\n }).catch(reject)\n })\n}\n\ninterface RenderTextOptions {\n text: string\n logLevel?: LogLevel\n logger?: Logger\n}\n\n/** Renders a text string to the console.\n * Using this function makes sure that correct spacing is applied among the various components.\n * @example\n * Hello world!\n *\n */\nexport function renderText({text, logLevel = 'info', logger = consoleLog}: RenderTextOptions) {\n let textWithLineReturn = text\n if (!text.endsWith('\\n')) textWithLineReturn += '\\n'\n\n if (isUnitTest()) collectLog(logLevel, textWithLineReturn)\n outputWhereAppropriate(logLevel, logger, textWithLineReturn)\n return textWithLineReturn\n}\n\n/** Waits for any key to be pressed except Ctrl+C which will terminate the process. */\nexport const keypress = async () => {\n // eslint-disable-next-line max-params\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 outputDebug('Canceled keypress, User pressed CTRL+C')\n reject(new AbortSilentError())\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\nexport type Key = InkKey\nexport {Task, TokenItem, InlineToken, LinkToken, TableColumn}\n"]}