@shopify/cli-kit 3.38.0 → 3.39.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 (95) hide show
  1. package/dist/private/common/json.d.ts +2 -2
  2. package/dist/private/common/lodash.d.ts +4 -4
  3. package/dist/private/common/ts/overloaded-parameters.d.ts +5 -5
  4. package/dist/private/node/api/headers.d.ts +1 -1
  5. package/dist/private/node/api.d.ts +1 -1
  6. package/dist/private/node/constants.d.ts +2 -2
  7. package/dist/private/node/environment/service.d.ts +1 -1
  8. package/dist/private/node/error-handler.d.ts +2 -0
  9. package/dist/private/node/error-handler.js +5 -0
  10. package/dist/private/node/error-handler.js.map +1 -0
  11. package/dist/private/node/session/exchange.d.ts +1 -1
  12. package/dist/private/node/session/redirect-listener.d.ts +1 -1
  13. package/dist/private/node/session/redirect-listener.js +5 -5
  14. package/dist/private/node/session/redirect-listener.js.map +1 -1
  15. package/dist/private/node/session/schema.d.ts +3 -3
  16. package/dist/private/node/session/validate.d.ts +1 -1
  17. package/dist/private/node/session.d.ts +4 -4
  18. package/dist/private/node/ui/components/AutocompletePrompt.d.ts +9 -2
  19. package/dist/private/node/ui/components/AutocompletePrompt.js +8 -4
  20. package/dist/private/node/ui/components/AutocompletePrompt.js.map +1 -1
  21. package/dist/private/node/ui/components/AutocompletePrompt.test.js +62 -8
  22. package/dist/private/node/ui/components/AutocompletePrompt.test.js.map +1 -1
  23. package/dist/private/node/ui/components/Banner.d.ts +1 -1
  24. package/dist/private/node/ui/components/ConcurrentOutput.d.ts +2 -2
  25. package/dist/private/node/ui/components/SelectInput.d.ts +3 -1
  26. package/dist/private/node/ui/components/SelectInput.js +8 -2
  27. package/dist/private/node/ui/components/SelectInput.js.map +1 -1
  28. package/dist/private/node/ui/components/SelectInput.test.js +26 -0
  29. package/dist/private/node/ui/components/SelectInput.test.js.map +1 -1
  30. package/dist/private/node/ui/components/Table/Row.d.ts +1 -1
  31. package/dist/private/node/ui/components/Table/ScalarDict.d.ts +1 -1
  32. package/dist/private/node/ui/components/Table/Table.d.ts +1 -1
  33. package/dist/private/node/ui/components/Tasks.d.ts +5 -1
  34. package/dist/private/node/ui/components/Tasks.js +31 -6
  35. package/dist/private/node/ui/components/Tasks.js.map +1 -1
  36. package/dist/private/node/ui/components/Tasks.test.js +259 -19
  37. package/dist/private/node/ui/components/Tasks.test.js.map +1 -1
  38. package/dist/private/node/ui/components/TokenizedText.d.ts +2 -2
  39. package/dist/private/node/ui.d.ts +1 -1
  40. package/dist/public/common/string.d.ts +1 -1
  41. package/dist/{private → public}/common/ts/deep-required.d.ts +2 -1
  42. package/dist/{private → public}/common/ts/deep-required.js +0 -0
  43. package/dist/public/common/ts/deep-required.js.map +1 -0
  44. package/dist/public/common/ts/pick-by-prefix.d.ts +2 -1
  45. package/dist/public/common/ts/pick-by-prefix.js.map +1 -1
  46. package/dist/public/common/version.d.ts +1 -1
  47. package/dist/public/common/version.js +1 -1
  48. package/dist/public/common/version.js.map +1 -1
  49. package/dist/public/node/api/http.d.ts +1 -0
  50. package/dist/public/node/api/http.js +1 -1
  51. package/dist/public/node/archiver.d.ts +20 -6
  52. package/dist/public/node/archiver.js +14 -13
  53. package/dist/public/node/archiver.js.map +1 -1
  54. package/dist/public/node/crypto.d.ts +1 -1
  55. package/dist/public/node/dot-env.js +2 -0
  56. package/dist/public/node/dot-env.js.map +1 -1
  57. package/dist/public/node/environment/local.d.ts +1 -1
  58. package/dist/public/node/environment/spin.d.ts +1 -1
  59. package/dist/public/node/error-handler.d.ts +1 -2
  60. package/dist/public/node/error-handler.js +12 -2
  61. package/dist/public/node/error-handler.js.map +1 -1
  62. package/dist/public/node/fs.d.ts +24 -4
  63. package/dist/public/node/fs.js +31 -2
  64. package/dist/public/node/fs.js.map +1 -1
  65. package/dist/public/node/git.d.ts +9 -1
  66. package/dist/public/node/git.js +31 -1
  67. package/dist/public/node/git.js.map +1 -1
  68. package/dist/public/node/http.d.ts +9 -1
  69. package/dist/public/node/http.js +34 -0
  70. package/dist/public/node/http.js.map +1 -1
  71. package/dist/public/node/metadata.d.ts +7 -7
  72. package/dist/public/node/monorail.d.ts +6 -6
  73. package/dist/public/node/monorail.js.map +1 -1
  74. package/dist/public/node/node-package-manager.d.ts +5 -5
  75. package/dist/public/node/os.d.ts +2 -2
  76. package/dist/public/node/output.d.ts +4 -4
  77. package/dist/public/node/path.d.ts +1 -1
  78. package/dist/public/node/plugins/tunnel.d.ts +5 -5
  79. package/dist/public/node/plugins.d.ts +4 -4
  80. package/dist/public/node/result.d.ts +1 -1
  81. package/dist/public/node/ruby.d.ts +1 -1
  82. package/dist/public/node/session.d.ts +1 -1
  83. package/dist/public/node/system.d.ts +1 -1
  84. package/dist/public/node/ui.d.ts +10 -5
  85. package/dist/public/node/ui.js +4 -3
  86. package/dist/public/node/ui.js.map +1 -1
  87. package/dist/tsconfig.tsbuildinfo +1 -1
  88. package/dist/ui.d.ts +6 -20
  89. package/dist/ui.js +1 -21
  90. package/dist/ui.js.map +1 -1
  91. package/package.json +6 -7
  92. package/dist/private/common/ts/deep-required.js.map +0 -1
  93. package/dist/private/node/simple-definitions.d.ts +0 -4
  94. package/dist/private/node/simple-definitions.js +0 -2
  95. package/dist/private/node/simple-definitions.js.map +0 -1
@@ -2,46 +2,51 @@ import { Tasks } from './Tasks.js';
2
2
  import { getLastFrameAfterUnmount } from '../../testing/ui.js';
3
3
  import { unstyled } from '../../../../public/node/output.js';
4
4
  import React from 'react';
5
- import { describe, expect, test } from 'vitest';
5
+ import { describe, expect, test, vi } from 'vitest';
6
6
  import { render } from 'ink-testing-library';
7
7
  describe('Tasks', () => {
8
8
  test('shows a loading state at the start', async () => {
9
9
  // Given
10
+ const firstTaskFunction = vi.fn(async () => {
11
+ await new Promise((resolve) => setTimeout(resolve, 2000));
12
+ });
10
13
  const firstTask = {
11
14
  title: 'task 1',
12
- task: async () => {
13
- await new Promise((resolve) => setTimeout(resolve, 2000));
14
- },
15
+ task: firstTaskFunction,
15
16
  };
16
17
  // When
17
- const renderInstance = render(React.createElement(Tasks, { tasks: [firstTask] }));
18
+ const renderInstance = render(React.createElement(Tasks, { tasks: [firstTask], silent: false }));
18
19
  // wait for next tick
19
- await new Promise((resolve) => setTimeout(resolve, 0));
20
+ await new Promise((resolve) => setTimeout(resolve, 100));
20
21
  // Then
21
- expect(unstyled(getLastFrameAfterUnmount(renderInstance))).toMatchInlineSnapshot(`
22
+ expect(unstyled(renderInstance.lastFrame())).toMatchInlineSnapshot(`
22
23
  "▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
23
24
  task 1 ..."
24
25
  `);
26
+ expect(firstTaskFunction).toHaveBeenCalled();
25
27
  });
26
28
  test('shows nothing at the end in case of success', async () => {
27
29
  // Given
30
+ const firstTaskFunction = vi.fn(async () => { });
31
+ const secondTaskFunction = vi.fn(async () => { });
28
32
  const firstTask = {
29
33
  title: 'task 1',
30
- task: async () => { },
34
+ task: firstTaskFunction,
31
35
  };
32
36
  const secondTask = {
33
37
  title: 'task 2',
34
- task: async () => { },
38
+ task: secondTaskFunction,
35
39
  };
36
40
  // When
37
- const renderInstance = render(React.createElement(Tasks, { tasks: [firstTask, secondTask] }));
41
+ const renderInstance = render(React.createElement(Tasks, { tasks: [firstTask, secondTask], silent: false }));
38
42
  // wait for next tick
39
43
  await new Promise((resolve) => setTimeout(resolve, 0));
40
44
  // Then
41
45
  expect(getLastFrameAfterUnmount(renderInstance)).toMatchInlineSnapshot('""');
42
46
  });
43
- test('shows nothing at the end in case of failure', async () => {
47
+ test('shows nothing at the end in case of success', async () => {
44
48
  // Given
49
+ const secondTaskFunction = vi.fn(async () => { });
45
50
  const firstTask = {
46
51
  title: 'task 1',
47
52
  task: async () => {
@@ -50,26 +55,28 @@ describe('Tasks', () => {
50
55
  };
51
56
  const secondTask = {
52
57
  title: 'task 2',
53
- task: async () => { },
58
+ task: secondTaskFunction,
54
59
  };
55
60
  // When
56
- const renderInstance = render(React.createElement(Tasks, { tasks: [firstTask, secondTask] }));
61
+ const renderInstance = render(React.createElement(Tasks, { tasks: [firstTask, secondTask], silent: false }));
57
62
  // wait for next tick
58
63
  await new Promise((resolve) => setTimeout(resolve, 0));
59
64
  // Then
60
65
  expect(getLastFrameAfterUnmount(renderInstance)).toMatchInlineSnapshot('""');
66
+ expect(secondTaskFunction).toHaveBeenCalledTimes(0);
61
67
  });
62
68
  test('it supports subtasks', async () => {
63
69
  // Given
70
+ const firstSubtaskFunction = vi.fn(async () => {
71
+ await new Promise((resolve) => setTimeout(resolve, 2000));
72
+ });
64
73
  const firstTask = {
65
74
  title: 'task 1',
66
75
  task: async () => {
67
76
  return [
68
77
  {
69
78
  title: 'subtask 1',
70
- task: async () => {
71
- await new Promise((resolve) => setTimeout(resolve, 2000));
72
- },
79
+ task: firstSubtaskFunction,
73
80
  },
74
81
  {
75
82
  title: 'subtask 2',
@@ -83,14 +90,247 @@ describe('Tasks', () => {
83
90
  task: async () => { },
84
91
  };
85
92
  // When
86
- const renderInstance = render(React.createElement(Tasks, { tasks: [firstTask, secondTask] }));
93
+ const renderInstance = render(React.createElement(Tasks, { tasks: [firstTask, secondTask], silent: false }));
87
94
  // wait for next tick
88
- await new Promise((resolve) => setTimeout(resolve, 100));
95
+ await new Promise((resolve) => setTimeout(resolve, 0));
89
96
  // Then
90
- expect(unstyled(getLastFrameAfterUnmount(renderInstance))).toMatchInlineSnapshot(`
97
+ expect(unstyled(renderInstance.lastFrame())).toMatchInlineSnapshot(`
91
98
  "▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
92
99
  subtask 1 ..."
93
100
  `);
101
+ expect(firstSubtaskFunction).toHaveBeenCalled();
102
+ });
103
+ test('supports skipping', async () => {
104
+ // Given
105
+ const firstTaskFunction = vi.fn(async () => {
106
+ await new Promise((resolve) => setTimeout(resolve, 2000));
107
+ });
108
+ const firstTask = {
109
+ title: 'task 1',
110
+ task: firstTaskFunction,
111
+ skip: () => true,
112
+ };
113
+ const secondTask = {
114
+ title: 'task 2',
115
+ task: async () => {
116
+ await new Promise((resolve) => setTimeout(resolve, 2000));
117
+ },
118
+ };
119
+ // When
120
+ const renderInstance = render(React.createElement(Tasks, { tasks: [firstTask, secondTask], silent: false }));
121
+ // wait for next tick
122
+ await new Promise((resolve) => setTimeout(resolve, 0));
123
+ // Then
124
+ expect(unstyled(renderInstance.lastFrame())).toMatchInlineSnapshot(`
125
+ "▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
126
+ task 2 ..."
127
+ `);
128
+ expect(firstTaskFunction).toHaveBeenCalledTimes(0);
129
+ });
130
+ test('supports skipping a subtask', async () => {
131
+ // Given
132
+ const firstSubTaskFunction = vi.fn(async () => {
133
+ await new Promise((resolve) => setTimeout(resolve, 2000));
134
+ });
135
+ const secondSubTaskFunction = vi.fn(async () => {
136
+ await new Promise((resolve) => setTimeout(resolve, 2000));
137
+ });
138
+ const firstTask = {
139
+ title: 'task 1',
140
+ task: async () => {
141
+ return [
142
+ {
143
+ title: 'subtask 1',
144
+ task: firstSubTaskFunction,
145
+ skip: () => true,
146
+ },
147
+ {
148
+ title: 'subtask 2',
149
+ task: secondSubTaskFunction,
150
+ },
151
+ ];
152
+ },
153
+ };
154
+ // When
155
+ const renderInstance = render(React.createElement(Tasks, { tasks: [firstTask], silent: false }));
156
+ // wait for next tick
157
+ await new Promise((resolve) => setTimeout(resolve, 0));
158
+ // Then
159
+ expect(unstyled(renderInstance.lastFrame())).toMatchInlineSnapshot(`
160
+ "▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
161
+ subtask 2 ..."
162
+ `);
163
+ expect(firstSubTaskFunction).toHaveBeenCalledTimes(0);
164
+ expect(secondSubTaskFunction).toHaveBeenCalled();
165
+ });
166
+ test('supports retrying', async () => {
167
+ // Given
168
+ const firstTaskFunction = vi.fn(async (_ctx, task) => {
169
+ if (task.retryCount < task.retry) {
170
+ throw new Error(`something went wrong${task.retryCount}`);
171
+ }
172
+ await new Promise((resolve) => setTimeout(resolve, 2000));
173
+ });
174
+ const firstTask = {
175
+ title: 'task 1',
176
+ task: firstTaskFunction,
177
+ retry: 3,
178
+ };
179
+ // When
180
+ const renderInstance = render(React.createElement(Tasks, { tasks: [firstTask], silent: false }));
181
+ // wait for next tick
182
+ await new Promise((resolve) => setTimeout(resolve, 0));
183
+ // Then
184
+ expect(unstyled(renderInstance.lastFrame())).toMatchInlineSnapshot(`
185
+ "▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
186
+ task 1 ..."
187
+ `);
188
+ expect(firstTask.retryCount).toBe(3);
189
+ expect(firstTask.errors).toEqual([
190
+ Error('something went wrong0'),
191
+ Error('something went wrong1'),
192
+ Error('something went wrong2'),
193
+ ]);
194
+ });
195
+ test('supports retrying up to a limit', async () => {
196
+ // Given
197
+ const firstTaskFunction = vi.fn(async (_ctx, task) => {
198
+ if (task.retryCount <= task.retry) {
199
+ throw new Error(`something went wrong${task.retryCount}`);
200
+ }
201
+ await new Promise((resolve) => setTimeout(resolve, 2000));
202
+ });
203
+ const secondTaskFunction = vi.fn(async () => { });
204
+ const firstTask = {
205
+ title: 'task 1',
206
+ task: firstTaskFunction,
207
+ retry: 3,
208
+ };
209
+ const secondTask = {
210
+ title: 'task 2',
211
+ task: secondTaskFunction,
212
+ };
213
+ // When
214
+ const renderInstance = render(React.createElement(Tasks, { tasks: [firstTask, secondTask], silent: false }));
215
+ // wait for next tick
216
+ await new Promise((resolve) => setTimeout(resolve, 0));
217
+ // Then
218
+ expect(unstyled(getLastFrameAfterUnmount(renderInstance))).toMatchInlineSnapshot('""');
219
+ expect(firstTask.retryCount).toBe(3);
220
+ expect(firstTask.errors).toEqual([
221
+ Error('something went wrong0'),
222
+ Error('something went wrong1'),
223
+ Error('something went wrong2'),
224
+ ]);
225
+ expect(secondTaskFunction).toHaveBeenCalledTimes(0);
226
+ });
227
+ test('supports retrying a subtask', async () => {
228
+ // Given
229
+ const firstSubTaskFunction = vi.fn(async (_ctx, task) => {
230
+ if (task.retryCount < task.retry) {
231
+ throw new Error(`something went wrong${task.retryCount}`);
232
+ }
233
+ await new Promise((resolve) => setTimeout(resolve, 2000));
234
+ });
235
+ const firstSubTask = {
236
+ title: 'subtask 1',
237
+ task: firstSubTaskFunction,
238
+ retry: 3,
239
+ };
240
+ const firstTask = {
241
+ title: 'task 1',
242
+ task: async () => {
243
+ return [firstSubTask];
244
+ },
245
+ };
246
+ // When
247
+ const renderInstance = render(React.createElement(Tasks, { tasks: [firstTask], silent: false }));
248
+ // wait for next tick
249
+ await new Promise((resolve) => setTimeout(resolve, 0));
250
+ // Then
251
+ expect(unstyled(renderInstance.lastFrame())).toMatchInlineSnapshot(`
252
+ "▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
253
+ subtask 1 ..."
254
+ `);
255
+ expect(firstSubTask.retryCount).toBe(3);
256
+ expect(firstSubTask.errors).toEqual([
257
+ Error('something went wrong0'),
258
+ Error('something went wrong1'),
259
+ Error('something went wrong2'),
260
+ ]);
261
+ });
262
+ test('supports retrying a subtask up to a limit', async () => {
263
+ // Given
264
+ const firstSubTaskFunction = vi.fn(async (_ctx, task) => {
265
+ if (task.retryCount <= task.retry) {
266
+ throw new Error(`something went wrong${task.retryCount}`);
267
+ }
268
+ await new Promise((resolve) => setTimeout(resolve, 2000));
269
+ });
270
+ const secondSubTaskFunction = vi.fn(async () => { });
271
+ const firstSubTask = {
272
+ title: 'subtask 1',
273
+ task: firstSubTaskFunction,
274
+ retry: 3,
275
+ };
276
+ const secondSubTask = {
277
+ title: 'subtask 2',
278
+ task: secondSubTaskFunction,
279
+ };
280
+ const firstTask = {
281
+ title: 'task 1',
282
+ task: async () => {
283
+ return [firstSubTask, secondSubTask];
284
+ },
285
+ };
286
+ // When
287
+ const renderInstance = render(React.createElement(Tasks, { tasks: [firstTask], silent: false }));
288
+ // wait for next tick
289
+ await new Promise((resolve) => setTimeout(resolve, 0));
290
+ // Then
291
+ expect(unstyled(getLastFrameAfterUnmount(renderInstance))).toMatchInlineSnapshot('""');
292
+ expect(firstSubTask.retryCount).toBe(3);
293
+ expect(firstSubTask.errors).toEqual([
294
+ Error('something went wrong0'),
295
+ Error('something went wrong1'),
296
+ Error('something went wrong2'),
297
+ ]);
298
+ expect(secondSubTaskFunction).toHaveBeenCalledTimes(0);
299
+ });
300
+ test('has a context', async () => {
301
+ // Given
302
+ const firstTaskFunction = vi.fn(async (ctx) => {
303
+ ctx.foo = 'bar';
304
+ });
305
+ const firstTask = {
306
+ title: 'task 1',
307
+ task: firstTaskFunction,
308
+ };
309
+ const secondTask = {
310
+ title: 'task 2',
311
+ task: async (ctx) => {
312
+ if (ctx.foo !== 'bar') {
313
+ throw new Error('context is not shared');
314
+ }
315
+ },
316
+ };
317
+ const thirdTaskFunction = vi.fn(async () => {
318
+ await new Promise((resolve) => setTimeout(resolve, 2000));
319
+ });
320
+ const thirdTask = {
321
+ title: 'task 3',
322
+ task: thirdTaskFunction,
323
+ };
324
+ // When
325
+ const renderInstance = render(React.createElement(Tasks, { tasks: [firstTask, secondTask, thirdTask], silent: false }));
326
+ // wait for next tick
327
+ await new Promise((resolve) => setTimeout(resolve, 0));
328
+ // Then
329
+ expect(unstyled(renderInstance.lastFrame())).toMatchInlineSnapshot(`
330
+ "▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
331
+ task 3 ..."
332
+ `);
333
+ expect(thirdTaskFunction).toHaveBeenCalled();
94
334
  });
95
335
  });
96
336
  //# sourceMappingURL=Tasks.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tasks.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/Tasks.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAA;AAChC,OAAO,EAAC,wBAAwB,EAAC,MAAM,qBAAqB,CAAA;AAC5D,OAAO,EAAC,QAAQ,EAAC,MAAM,mCAAmC,CAAA;AAC1D,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAC,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAA;AAE1C,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IACrB,IAAI,CAAC,oCAAoC,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CAAA;QAED,MAAM,UAAU,GAAG;YACjB,KAAK,EAAE,QAAQ;YACf,IAAI,EAAE,KAAK,IAAI,EAAE,GAAE,CAAC;SACrB,CAAA;QAED,OAAO;QACP,MAAM,cAAc,GAAG,MAAM,CAAC,oBAAC,KAAK,IAAC,KAAK,EAAE,CAAC,SAAS,EAAE,UAAU,CAAC,GAAI,CAAC,CAAA;QAExE,qBAAqB;QACrB,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAA;QAExD,OAAO;QACP,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC,cAAc,CAAE,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;KAGjF,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import {Tasks} from './Tasks.js'\nimport {getLastFrameAfterUnmount} from '../../testing/ui.js'\nimport {unstyled} from '../../../../public/node/output.js'\nimport React from 'react'\nimport {describe, expect, test} from 'vitest'\nimport {render} from 'ink-testing-library'\n\ndescribe('Tasks', () => {\n test('shows a loading state at the start', async () => {\n // Given\n const firstTask = {\n title: 'task 1',\n task: async () => {\n await new Promise((resolve) => setTimeout(resolve, 2000))\n },\n }\n\n // When\n const renderInstance = render(<Tasks tasks={[firstTask]} />)\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(unstyled(getLastFrameAfterUnmount(renderInstance)!)).toMatchInlineSnapshot(`\n \"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n task 1 ...\"\n `)\n })\n\n test('shows nothing at the end in case of success', async () => {\n // Given\n const firstTask = {\n title: 'task 1',\n task: async () => {},\n }\n\n const secondTask = {\n title: 'task 2',\n task: async () => {},\n }\n // When\n\n const renderInstance = render(<Tasks tasks={[firstTask, secondTask]} />)\n\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(getLastFrameAfterUnmount(renderInstance)).toMatchInlineSnapshot('\"\"')\n })\n\n test('shows nothing at the end in case of failure', async () => {\n // Given\n const firstTask = {\n title: 'task 1',\n task: async () => {\n throw new Error('something went wrong')\n },\n }\n\n const secondTask = {\n title: 'task 2',\n task: async () => {},\n }\n\n // When\n const renderInstance = render(<Tasks tasks={[firstTask, secondTask]} />)\n\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(getLastFrameAfterUnmount(renderInstance)).toMatchInlineSnapshot('\"\"')\n })\n\n test('it supports subtasks', async () => {\n // Given\n const firstTask = {\n title: 'task 1',\n task: async () => {\n return [\n {\n title: 'subtask 1',\n task: async () => {\n await new Promise((resolve) => setTimeout(resolve, 2000))\n },\n },\n {\n title: 'subtask 2',\n task: async () => {},\n },\n ]\n },\n }\n\n const secondTask = {\n title: 'task 2',\n task: async () => {},\n }\n\n // When\n const renderInstance = render(<Tasks tasks={[firstTask, secondTask]} />)\n\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 100))\n\n // Then\n expect(unstyled(getLastFrameAfterUnmount(renderInstance)!)).toMatchInlineSnapshot(`\n \"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n subtask 1 ...\"\n `)\n })\n})\n"]}
1
+ {"version":3,"file":"Tasks.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/Tasks.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,EAAC,MAAM,YAA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AM,UAAU,GAAwB;YACtC,KAAK,EAAE,QAAQ;YACf,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;gBAClB,IAAI,GAAG,CAAC,GAAG,KAAK,KAAK,EAAE;oBACrB,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAA;iBACzC;YACH,CAAC;SACF,CAAA;QAED,MAAM,iBAAiB,GAAG,EAAE,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE;YACzC,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAA;QAC3D,CAAC,CAAC,CAAA;QAEF,MAAM,SAAS,GAAwB;YACrC,KAAK,EAAE,QAAQ;YACf,IAAI,EAAE,iBAAiB;SACxB,CAAA;QAED,OAAO;QACP,MAAM,cAAc,GAAG,MAAM,CAAC,oBAAC,KAAK,IAAC,KAAK,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,KAAK,GAAI,CAAC,CAAA;QAElG,qBAAqB;QACrB,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAA;QAEtD,OAAO;QACP,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,SAAS,EAAG,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;KAGnE,CAAC,CAAA;QACF,MAAM,CAAC,iBAAiB,CAAC,CAAC,gBAAgB,EAAE,CAAA;IAC9C,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import {Task, Tasks} from './Tasks.js'\nimport {getLastFrameAfterUnmount} from '../../testing/ui.js'\nimport {unstyled} from '../../../../public/node/output.js'\nimport React from 'react'\nimport {describe, expect, test, vi} from 'vitest'\nimport {render} from 'ink-testing-library'\n\ndescribe('Tasks', () => {\n test('shows a loading state at the start', async () => {\n // Given\n const firstTaskFunction = vi.fn(async () => {\n await new Promise((resolve) => setTimeout(resolve, 2000))\n })\n\n const firstTask = {\n title: 'task 1',\n task: firstTaskFunction,\n }\n\n // When\n const renderInstance = render(<Tasks tasks={[firstTask]} silent={false} />)\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 100))\n\n // Then\n expect(unstyled(renderInstance.lastFrame()!)).toMatchInlineSnapshot(`\n \"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n task 1 ...\"\n `)\n expect(firstTaskFunction).toHaveBeenCalled()\n })\n\n test('shows nothing at the end in case of success', async () => {\n // Given\n const firstTaskFunction = vi.fn(async () => {})\n const secondTaskFunction = vi.fn(async () => {})\n\n const firstTask = {\n title: 'task 1',\n task: firstTaskFunction,\n }\n\n const secondTask = {\n title: 'task 2',\n task: secondTaskFunction,\n }\n // When\n\n const renderInstance = render(<Tasks tasks={[firstTask, secondTask]} silent={false} />)\n\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(getLastFrameAfterUnmount(renderInstance)).toMatchInlineSnapshot('\"\"')\n })\n\n test('shows nothing at the end in case of success', async () => {\n // Given\n const secondTaskFunction = vi.fn(async () => {})\n\n const firstTask: Task = {\n title: 'task 1',\n task: async () => {\n throw new Error('something went wrong')\n },\n }\n\n const secondTask = {\n title: 'task 2',\n task: secondTaskFunction,\n }\n\n // When\n const renderInstance = render(<Tasks tasks={[firstTask, secondTask]} silent={false} />)\n\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(getLastFrameAfterUnmount(renderInstance)).toMatchInlineSnapshot('\"\"')\n expect(secondTaskFunction).toHaveBeenCalledTimes(0)\n })\n\n test('it supports subtasks', async () => {\n // Given\n const firstSubtaskFunction = vi.fn(async () => {\n await new Promise((resolve) => setTimeout(resolve, 2000))\n })\n\n const firstTask = {\n title: 'task 1',\n task: async () => {\n return [\n {\n title: 'subtask 1',\n task: firstSubtaskFunction,\n },\n {\n title: 'subtask 2',\n task: async () => {},\n },\n ]\n },\n }\n\n const secondTask = {\n title: 'task 2',\n task: async () => {},\n }\n\n // When\n const renderInstance = render(<Tasks tasks={[firstTask, secondTask]} silent={false} />)\n\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(unstyled(renderInstance.lastFrame()!)).toMatchInlineSnapshot(`\n \"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n subtask 1 ...\"\n `)\n\n expect(firstSubtaskFunction).toHaveBeenCalled()\n })\n\n test('supports skipping', async () => {\n // Given\n const firstTaskFunction = vi.fn(async () => {\n await new Promise((resolve) => setTimeout(resolve, 2000))\n })\n\n const firstTask = {\n title: 'task 1',\n task: firstTaskFunction,\n skip: () => true,\n }\n\n const secondTask = {\n title: 'task 2',\n task: async () => {\n await new Promise((resolve) => setTimeout(resolve, 2000))\n },\n }\n\n // When\n const renderInstance = render(<Tasks tasks={[firstTask, secondTask]} silent={false} />)\n\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(unstyled(renderInstance.lastFrame()!)).toMatchInlineSnapshot(`\n \"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n task 2 ...\"\n `)\n expect(firstTaskFunction).toHaveBeenCalledTimes(0)\n })\n\n test('supports skipping a subtask', async () => {\n // Given\n const firstSubTaskFunction = vi.fn(async () => {\n await new Promise((resolve) => setTimeout(resolve, 2000))\n })\n\n const secondSubTaskFunction = vi.fn(async () => {\n await new Promise((resolve) => setTimeout(resolve, 2000))\n })\n\n const firstTask = {\n title: 'task 1',\n task: async () => {\n return [\n {\n title: 'subtask 1',\n task: firstSubTaskFunction,\n skip: () => true,\n },\n {\n title: 'subtask 2',\n task: secondSubTaskFunction,\n },\n ]\n },\n }\n\n // When\n const renderInstance = render(<Tasks tasks={[firstTask]} silent={false} />)\n\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(unstyled(renderInstance.lastFrame()!)).toMatchInlineSnapshot(`\n \"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n subtask 2 ...\"\n `)\n\n expect(firstSubTaskFunction).toHaveBeenCalledTimes(0)\n expect(secondSubTaskFunction).toHaveBeenCalled()\n })\n\n test('supports retrying', async () => {\n // Given\n const firstTaskFunction = vi.fn(async (_ctx, task) => {\n if (task.retryCount < task.retry) {\n throw new Error(`something went wrong${task.retryCount}`)\n }\n\n await new Promise((resolve) => setTimeout(resolve, 2000))\n })\n\n const firstTask: Task = {\n title: 'task 1',\n task: firstTaskFunction,\n retry: 3,\n }\n\n // When\n const renderInstance = render(<Tasks tasks={[firstTask]} silent={false} />)\n\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(unstyled(renderInstance.lastFrame()!)).toMatchInlineSnapshot(`\n \"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n task 1 ...\"\n `)\n expect(firstTask.retryCount).toBe(3)\n expect(firstTask.errors).toEqual([\n Error('something went wrong0'),\n Error('something went wrong1'),\n Error('something went wrong2'),\n ])\n })\n\n test('supports retrying up to a limit', async () => {\n // Given\n const firstTaskFunction = vi.fn(async (_ctx, task) => {\n if (task.retryCount <= task.retry) {\n throw new Error(`something went wrong${task.retryCount}`)\n }\n\n await new Promise((resolve) => setTimeout(resolve, 2000))\n })\n\n const secondTaskFunction = vi.fn(async () => {})\n\n const firstTask: Task = {\n title: 'task 1',\n task: firstTaskFunction,\n retry: 3,\n }\n\n const secondTask: Task = {\n title: 'task 2',\n task: secondTaskFunction,\n }\n\n // When\n const renderInstance = render(<Tasks tasks={[firstTask, secondTask]} silent={false} />)\n\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(unstyled(getLastFrameAfterUnmount(renderInstance)!)).toMatchInlineSnapshot('\"\"')\n expect(firstTask.retryCount).toBe(3)\n expect(firstTask.errors).toEqual([\n Error('something went wrong0'),\n Error('something went wrong1'),\n Error('something went wrong2'),\n ])\n expect(secondTaskFunction).toHaveBeenCalledTimes(0)\n })\n\n test('supports retrying a subtask', async () => {\n // Given\n const firstSubTaskFunction = vi.fn(async (_ctx, task) => {\n if (task.retryCount < task.retry) {\n throw new Error(`something went wrong${task.retryCount}`)\n }\n\n await new Promise((resolve) => setTimeout(resolve, 2000))\n })\n\n const firstSubTask: Task = {\n title: 'subtask 1',\n task: firstSubTaskFunction,\n retry: 3,\n }\n\n const firstTask: Task = {\n title: 'task 1',\n task: async () => {\n return [firstSubTask]\n },\n }\n\n // When\n const renderInstance = render(<Tasks tasks={[firstTask]} silent={false} />)\n\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(unstyled(renderInstance.lastFrame()!)).toMatchInlineSnapshot(`\n \"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n subtask 1 ...\"\n `)\n expect(firstSubTask.retryCount).toBe(3)\n expect(firstSubTask.errors).toEqual([\n Error('something went wrong0'),\n Error('something went wrong1'),\n Error('something went wrong2'),\n ])\n })\n\n test('supports retrying a subtask up to a limit', async () => {\n // Given\n const firstSubTaskFunction = vi.fn(async (_ctx, task) => {\n if (task.retryCount <= task.retry) {\n throw new Error(`something went wrong${task.retryCount}`)\n }\n\n await new Promise((resolve) => setTimeout(resolve, 2000))\n })\n\n const secondSubTaskFunction = vi.fn(async () => {})\n\n const firstSubTask: Task = {\n title: 'subtask 1',\n task: firstSubTaskFunction,\n retry: 3,\n }\n\n const secondSubTask: Task = {\n title: 'subtask 2',\n task: secondSubTaskFunction,\n }\n\n const firstTask: Task = {\n title: 'task 1',\n task: async () => {\n return [firstSubTask, secondSubTask]\n },\n }\n\n // When\n const renderInstance = render(<Tasks tasks={[firstTask]} silent={false} />)\n\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(unstyled(getLastFrameAfterUnmount(renderInstance)!)).toMatchInlineSnapshot('\"\"')\n expect(firstSubTask.retryCount).toBe(3)\n expect(firstSubTask.errors).toEqual([\n Error('something went wrong0'),\n Error('something went wrong1'),\n Error('something went wrong2'),\n ])\n expect(secondSubTaskFunction).toHaveBeenCalledTimes(0)\n })\n\n test('has a context', async () => {\n // Given\n const firstTaskFunction = vi.fn(async (ctx) => {\n ctx.foo = 'bar'\n })\n\n const firstTask: Task<{foo: string}> = {\n title: 'task 1',\n task: firstTaskFunction,\n }\n\n const secondTask: Task<{foo: string}> = {\n title: 'task 2',\n task: async (ctx) => {\n if (ctx.foo !== 'bar') {\n throw new Error('context is not shared')\n }\n },\n }\n\n const thirdTaskFunction = vi.fn(async () => {\n await new Promise((resolve) => setTimeout(resolve, 2000))\n })\n\n const thirdTask: Task<{foo: string}> = {\n title: 'task 3',\n task: thirdTaskFunction,\n }\n\n // When\n const renderInstance = render(<Tasks tasks={[firstTask, secondTask, thirdTask]} silent={false} />)\n\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(unstyled(renderInstance.lastFrame()!)).toMatchInlineSnapshot(`\n \"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n task 3 ...\"\n `)\n expect(thirdTaskFunction).toHaveBeenCalled()\n })\n})\n"]}
@@ -27,8 +27,8 @@ interface ListToken {
27
27
  ordered?: boolean;
28
28
  };
29
29
  }
30
- declare type Token = string | CommandToken | LinkToken | CharToken | UserInputToken | SubduedToken | FilePathToken | ListToken;
31
- export declare type TokenItem = Token | Token[];
30
+ type Token = string | CommandToken | LinkToken | CharToken | UserInputToken | SubduedToken | FilePathToken | ListToken;
31
+ export type TokenItem = Token | Token[];
32
32
  export declare function tokenItemToString(token: TokenItem): string;
33
33
  export declare function appendToTokenItem(token: TokenItem, suffix: string): TokenItem;
34
34
  interface Props {
@@ -1,4 +1,4 @@
1
- /// <reference types="node" />
1
+ /// <reference types="node" resolution-mode="require"/>
2
2
  import { Logger, LogLevel } from '../../public/node/output.js';
3
3
  import { ReactElement } from 'react';
4
4
  import { Key, RenderOptions } from 'ink';
@@ -1,5 +1,5 @@
1
1
  import { TokenItem } from '../../private/node/ui/components/TokenizedText.js';
2
- export declare type RandomNameFamily = 'business' | 'creative';
2
+ export type RandomNameFamily = 'business' | 'creative';
3
3
  /**
4
4
  * Generates a random name by combining an adjective and noun.
5
5
  *
@@ -1,3 +1,4 @@
1
+ export {};
1
2
  /**
2
3
  * Converts a mapping type to be non-optional.
3
4
  *
@@ -7,6 +8,6 @@
7
8
  * ```
8
9
  *.
9
10
  */
10
- export declare type DeepRequired<T> = {
11
+ export type DeepRequired<T> = {
11
12
  [TKey in keyof Required<T>]: NonNullable<Required<T>[TKey]>;
12
13
  };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deep-required.js","sourceRoot":"","sources":["../../../../src/public/common/ts/deep-required.ts"],"names":[],"mappings":"","sourcesContent":["export {}\n\n/**\n * Converts a mapping type to be non-optional.\n *\n * ```ts\n * type T = DeepRequired<{optionalKey?: string, nullableValue: string | null, undefinableValue: string | undefined}>\n * T = {optionalKey: string, nullableValue: string, undefinableValue: string}\n * ```\n *.\n */\nexport type DeepRequired<T> = {\n [TKey in keyof Required<T>]: NonNullable<Required<T>[TKey]>\n}\n"]}
@@ -1,3 +1,4 @@
1
+ export {};
1
2
  /**
2
3
  * Produces a subset of a mapping type, where the keys either match some prefix string, or are in a list of exact matches.
3
4
  *
@@ -8,6 +9,6 @@
8
9
  * ```
9
10
  * .
10
11
  */
11
- export declare type PickByPrefix<TMapping, TPrefix extends string, TKeys extends keyof TMapping = never> = {
12
+ export type PickByPrefix<TMapping, TPrefix extends string, TKeys extends keyof TMapping = never> = {
12
13
  [TKey in keyof TMapping as TKey extends `${TPrefix}${infer _TSuffix}` | TKeys ? TKey : never]: TMapping[TKey];
13
14
  };
@@ -1 +1 @@
1
- {"version":3,"file":"pick-by-prefix.js","sourceRoot":"","sources":["../../../../src/public/common/ts/pick-by-prefix.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Produces a subset of a mapping type, where the keys either match some prefix string, or are in a list of exact matches.\n *\n * ```ts\n * type T = PickByPrefix<{foo_1: number, foo_2: number, nope: string, included: string, also: number}, 'foo_', 'included' | 'also'>.\n *\n * T = {foo_1: number, foo_2: number, included: string, also: number}\n * ```\n * .\n */\nexport type PickByPrefix<TMapping, TPrefix extends string, TKeys extends keyof TMapping = never> = {\n [TKey in keyof TMapping as TKey extends `${TPrefix}${infer _TSuffix}` | TKeys ? TKey : never]: TMapping[TKey]\n}\n"]}
1
+ {"version":3,"file":"pick-by-prefix.js","sourceRoot":"","sources":["../../../../src/public/common/ts/pick-by-prefix.ts"],"names":[],"mappings":"","sourcesContent":["export {}\n\n/**\n * Produces a subset of a mapping type, where the keys either match some prefix string, or are in a list of exact matches.\n *\n * ```ts\n * type T = PickByPrefix<{foo_1: number, foo_2: number, nope: string, included: string, also: number}, 'foo_', 'included' | 'also'>.\n *\n * T = {foo_1: number, foo_2: number, included: string, also: number}\n * ```\n * .\n */\nexport type PickByPrefix<TMapping, TPrefix extends string, TKeys extends keyof TMapping = never> = {\n [TKey in keyof TMapping as TKey extends `${TPrefix}${infer _TSuffix}` | TKeys ? TKey : never]: TMapping[TKey]\n}\n"]}
@@ -1 +1 @@
1
- export declare const CLI_KIT_VERSION = "3.38.0";
1
+ export declare const CLI_KIT_VERSION = "3.39.0";
@@ -1,2 +1,2 @@
1
- export const CLI_KIT_VERSION = '3.38.0';
1
+ export const CLI_KIT_VERSION = '3.39.0';
2
2
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/public/common/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAA","sourcesContent":["export const CLI_KIT_VERSION = '3.38.0'\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/public/common/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAA","sourcesContent":["export const CLI_KIT_VERSION = '3.39.0'\n"]}
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1,2 @@
1
- "use strict";
1
+ export {};
2
2
  //# sourceMappingURL=http.js.map
@@ -1,9 +1,23 @@
1
+ interface ZipOptions {
2
+ /**
3
+ * The absolute path to the directory to be zipped.
4
+ */
5
+ inputDirectory: string;
6
+ /**
7
+ * The absolute path to the output zip file.
8
+ */
9
+ outputZipPath: string;
10
+ /**
11
+ * Pattern to match when adding files to zip, uses glob expressions.
12
+ */
13
+ matchFilePattern?: string;
14
+ }
1
15
  /**
2
- * It zips a directory normalizing the paths to be forward-slash. Note that unzipping
3
- * the zip generated by this function from a Windows environment won't work because paths
4
- * need to be made backward-slash.
16
+ * It zips a directory and by default normalizes the paths to be forward-slash.
17
+ * Even with forward-slash paths, zip files should still be able to be opened on
18
+ * Windows.
5
19
  *
6
- * @param inputDirectory - The absolute path to the directory to be zipped.
7
- * @param outputZipPath - The absolute path to the output zip file.
20
+ * @param options - ZipOptions.
8
21
  */
9
- export declare function zip(inputDirectory: string, outputZipPath: string): Promise<void>;
22
+ export declare function zip(options: ZipOptions): Promise<void>;
23
+ export {};
@@ -4,25 +4,26 @@ import { outputDebug, outputContent, outputToken } from '../../public/node/outpu
4
4
  import archiver from 'archiver';
5
5
  import { createWriteStream } from 'fs';
6
6
  /**
7
- * It zips a directory normalizing the paths to be forward-slash. Note that unzipping
8
- * the zip generated by this function from a Windows environment won't work because paths
9
- * need to be made backward-slash.
7
+ * It zips a directory and by default normalizes the paths to be forward-slash.
8
+ * Even with forward-slash paths, zip files should still be able to be opened on
9
+ * Windows.
10
10
  *
11
- * @param inputDirectory - The absolute path to the directory to be zipped.
12
- * @param outputZipPath - The absolute path to the output zip file.
11
+ * @param options - ZipOptions.
13
12
  */
14
- export async function zip(inputDirectory, outputZipPath) {
13
+ export async function zip(options) {
14
+ const { inputDirectory, outputZipPath, matchFilePattern = '**/*' } = options;
15
15
  outputDebug(outputContent `Zipping ${outputToken.path(inputDirectory)} into ${outputToken.path(outputZipPath)}`);
16
- const pathsToZip = await glob('**/*', { cwd: inputDirectory, absolute: true, dot: true, followSymbolicLinks: false });
16
+ const pathsToZip = await glob(matchFilePattern, {
17
+ cwd: inputDirectory,
18
+ absolute: true,
19
+ dot: true,
20
+ followSymbolicLinks: false,
21
+ });
17
22
  return new Promise((resolve, reject) => {
18
23
  const archive = archiver('zip');
19
24
  const output = createWriteStream(outputZipPath);
20
- output.on('close', function () {
21
- resolve();
22
- });
23
- archive.on('error', function (error) {
24
- reject(error);
25
- });
25
+ output.on('close', () => resolve());
26
+ archive.on('error', (error) => reject(error));
26
27
  archive.pipe(output);
27
28
  for (const filePath of pathsToZip) {
28
29
  const fileRelativePath = relativePath(inputDirectory, filePath);
@@ -1 +1 @@
1
- {"version":3,"file":"archiver.js","sourceRoot":"","sources":["../../../src/public/node/archiver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,WAAW,CAAA;AACtC,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAC,WAAW,EAAE,aAAa,EAAE,WAAW,EAAC,MAAM,6BAA6B,CAAA;AACnF,OAAO,QAAQ,MAAM,UAAU,CAAA;AAC/B,OAAO,EAAC,iBAAiB,EAAC,MAAM,IAAI,CAAA;AACpC;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,cAAsB,EAAE,aAAqB;IACrE,WAAW,CAAC,aAAa,CAAA,WAAW,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,SAAS,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,CAAA;IAC/G,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,MAAM,EAAE,EAAC,GAAG,EAAE,cAAc,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,mBAAmB,EAAE,KAAK,EAAC,CAAC,CAAA;IACnH,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;QAC/B,MAAM,MAAM,GAAG,iBAAiB,CAAC,aAAa,CAAC,CAAA;QAE/C,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE;YACjB,OAAO,EAAE,CAAA;QACX,CAAC,CAAC,CAAA;QACF,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,KAAK;YACjC,MAAM,CAAC,KAAK,CAAC,CAAA;QACf,CAAC,CAAC,CAAA;QACF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAEpB,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE;YACjC,MAAM,gBAAgB,GAAG,YAAY,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAA;YAC/D,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAC,IAAI,EAAE,gBAAgB,EAAC,CAAC,CAAA;SACjD;QAED,mEAAmE;QACnE,OAAO,CAAC,QAAQ,EAAE,CAAA;IACpB,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {relativePath} from './path.js'\nimport {glob} from './fs.js'\nimport {outputDebug, outputContent, outputToken} from '../../public/node/output.js'\nimport archiver from 'archiver'\nimport {createWriteStream} from 'fs'\n/**\n * It zips a directory normalizing the paths to be forward-slash. Note that unzipping\n * the zip generated by this function from a Windows environment won't work because paths\n * need to be made backward-slash.\n *\n * @param inputDirectory - The absolute path to the directory to be zipped.\n * @param outputZipPath - The absolute path to the output zip file.\n */\nexport async function zip(inputDirectory: string, outputZipPath: string): Promise<void> {\n outputDebug(outputContent`Zipping ${outputToken.path(inputDirectory)} into ${outputToken.path(outputZipPath)}`)\n const pathsToZip = await glob('**/*', {cwd: inputDirectory, absolute: true, dot: true, followSymbolicLinks: false})\n return new Promise((resolve, reject) => {\n const archive = archiver('zip')\n const output = createWriteStream(outputZipPath)\n\n output.on('close', function () {\n resolve()\n })\n archive.on('error', function (error) {\n reject(error)\n })\n archive.pipe(output)\n\n for (const filePath of pathsToZip) {\n const fileRelativePath = relativePath(inputDirectory, filePath)\n archive.file(filePath, {name: fileRelativePath})\n }\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n archive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AAC,CAAA;QAEpB,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE;YACjC,MAAM,gBAAgB,GAAG,YAAY,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAA;YAC/D,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAC,IAAI,EAAE,gBAAgB,EAAC,CAAC,CAAA;SACjD;QAED,mEAAmE;QACnE,OAAO,CAAC,QAAQ,EAAE,CAAA;IACpB,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {relativePath} from './path.js'\nimport {glob} from './fs.js'\nimport {outputDebug, outputContent, outputToken} from '../../public/node/output.js'\nimport archiver from 'archiver'\nimport {createWriteStream} from 'fs'\n\ninterface ZipOptions {\n /**\n * The absolute path to the directory to be zipped.\n */\n inputDirectory: string\n\n /**\n * The absolute path to the output zip file.\n */\n outputZipPath: string\n\n /**\n * Pattern to match when adding files to zip, uses glob expressions.\n */\n matchFilePattern?: string\n}\n\n/**\n * It zips a directory and by default normalizes the paths to be forward-slash.\n * Even with forward-slash paths, zip files should still be able to be opened on\n * Windows.\n *\n * @param options - ZipOptions.\n */\nexport async function zip(options: ZipOptions): Promise<void> {\n const {inputDirectory, outputZipPath, matchFilePattern = '**/*'} = options\n outputDebug(outputContent`Zipping ${outputToken.path(inputDirectory)} into ${outputToken.path(outputZipPath)}`)\n const pathsToZip = await glob(matchFilePattern, {\n cwd: inputDirectory,\n absolute: true,\n dot: true,\n followSymbolicLinks: false,\n })\n\n return new Promise((resolve, reject) => {\n const archive = archiver('zip')\n\n const output = createWriteStream(outputZipPath)\n output.on('close', () => resolve())\n archive.on('error', (error) => reject(error))\n archive.pipe(output)\n\n for (const filePath of pathsToZip) {\n const fileRelativePath = relativePath(inputDirectory, filePath)\n archive.file(filePath, {name: fileRelativePath})\n }\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n archive.finalize()\n })\n}\n"]}
@@ -1,4 +1,4 @@
1
- /// <reference types="node" />
1
+ /// <reference types="node" resolution-mode="require"/>
2
2
  /**
3
3
  * Generate a random string in Hex format of the provided size.
4
4
  *
@@ -1,6 +1,8 @@
1
1
  import { AbortError } from './error.js';
2
2
  import { fileExists, readFile, writeFile } from './fs.js';
3
3
  import { outputDebug, outputContent, outputToken } from '../../public/node/output.js';
4
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
5
+ // @ts-ignore
4
6
  import { parse, stringify } from 'envfile';
5
7
  /**
6
8
  * Error that's thrown when the .env is not found.