concurrently 9.2.0 → 10.0.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 (149) hide show
  1. package/README.md +25 -15
  2. package/dist/bin/{concurrently.js → index.js} +23 -52
  3. package/dist/bin/index.spec.d.ts +1 -0
  4. package/dist/bin/index.spec.js +368 -0
  5. package/dist/bin/normalize-cli-command.d.ts +1 -0
  6. package/dist/bin/normalize-cli-command.js +15 -0
  7. package/dist/bin/normalize-cli-command.spec.d.ts +1 -0
  8. package/dist/bin/normalize-cli-command.spec.js +36 -0
  9. package/dist/bin/read-package-json.d.ts +4 -0
  10. package/dist/bin/read-package-json.js +17 -0
  11. package/dist/lib/__fixtures__/create-mock-instance.d.ts +2 -0
  12. package/dist/lib/__fixtures__/create-mock-instance.js +5 -0
  13. package/dist/lib/__fixtures__/fake-command.d.ts +6 -0
  14. package/dist/lib/__fixtures__/fake-command.js +37 -0
  15. package/dist/lib/assert.d.ts +10 -0
  16. package/dist/lib/assert.js +24 -0
  17. package/dist/lib/assert.spec.d.ts +1 -0
  18. package/dist/lib/assert.spec.js +41 -0
  19. package/dist/{src → lib}/command-parser/expand-arguments.d.ts +7 -7
  20. package/dist/lib/command-parser/expand-arguments.js +36 -0
  21. package/dist/lib/command-parser/expand-arguments.spec.d.ts +1 -0
  22. package/dist/lib/command-parser/expand-arguments.spec.js +57 -0
  23. package/dist/{src → lib}/command-parser/expand-shortcut.d.ts +2 -2
  24. package/dist/{src → lib}/command-parser/expand-shortcut.js +1 -5
  25. package/dist/lib/command-parser/expand-shortcut.spec.d.ts +1 -0
  26. package/dist/lib/command-parser/expand-shortcut.spec.js +36 -0
  27. package/dist/{src → lib}/command-parser/expand-wildcard.d.ts +2 -2
  28. package/dist/{src → lib}/command-parser/expand-wildcard.js +25 -31
  29. package/dist/lib/command-parser/expand-wildcard.spec.d.ts +1 -0
  30. package/dist/lib/command-parser/expand-wildcard.spec.js +288 -0
  31. package/dist/{src → lib}/command.d.ts +7 -10
  32. package/dist/{src → lib}/command.js +13 -32
  33. package/dist/lib/command.spec.d.ts +1 -0
  34. package/dist/lib/command.spec.js +369 -0
  35. package/dist/{src → lib}/completion-listener.d.ts +2 -3
  36. package/dist/{src → lib}/completion-listener.js +9 -36
  37. package/dist/lib/completion-listener.spec.d.ts +1 -0
  38. package/dist/lib/completion-listener.spec.js +229 -0
  39. package/dist/{src → lib}/concurrently.d.ts +10 -12
  40. package/dist/{src → lib}/concurrently.js +34 -47
  41. package/dist/lib/concurrently.spec.d.ts +1 -0
  42. package/dist/lib/concurrently.spec.js +320 -0
  43. package/dist/{src → lib}/date-format.d.ts +2 -2
  44. package/dist/{src → lib}/date-format.js +101 -77
  45. package/dist/lib/date-format.spec.d.ts +1 -0
  46. package/dist/lib/date-format.spec.js +480 -0
  47. package/dist/{src → lib}/defaults.d.ts +2 -6
  48. package/dist/{src → lib}/defaults.js +16 -23
  49. package/dist/{src → lib}/flow-control/input-handler.d.ts +4 -5
  50. package/dist/{src → lib}/flow-control/input-handler.js +8 -34
  51. package/dist/lib/flow-control/input-handler.spec.d.ts +1 -0
  52. package/dist/lib/flow-control/input-handler.spec.js +116 -0
  53. package/dist/{src → lib}/flow-control/kill-on-signal.d.ts +3 -5
  54. package/dist/{src → lib}/flow-control/kill-on-signal.js +3 -7
  55. package/dist/lib/flow-control/kill-on-signal.spec.d.ts +1 -0
  56. package/dist/lib/flow-control/kill-on-signal.spec.js +63 -0
  57. package/dist/{src → lib}/flow-control/kill-others.d.ts +3 -4
  58. package/dist/{src → lib}/flow-control/kill-others.js +8 -15
  59. package/dist/lib/flow-control/kill-others.spec.d.ts +1 -0
  60. package/dist/lib/flow-control/kill-others.spec.js +98 -0
  61. package/dist/{src → lib}/flow-control/log-error.d.ts +3 -3
  62. package/dist/{src → lib}/flow-control/log-error.js +1 -5
  63. package/dist/lib/flow-control/log-error.spec.d.ts +1 -0
  64. package/dist/lib/flow-control/log-error.spec.js +33 -0
  65. package/dist/{src → lib}/flow-control/log-exit.d.ts +3 -3
  66. package/dist/{src → lib}/flow-control/log-exit.js +1 -5
  67. package/dist/lib/flow-control/log-exit.spec.d.ts +1 -0
  68. package/dist/lib/flow-control/log-exit.spec.js +24 -0
  69. package/dist/{src → lib}/flow-control/log-output.d.ts +3 -3
  70. package/dist/{src → lib}/flow-control/log-output.js +1 -5
  71. package/dist/lib/flow-control/log-output.spec.d.ts +1 -0
  72. package/dist/lib/flow-control/log-output.spec.js +33 -0
  73. package/dist/{src → lib}/flow-control/log-timings.d.ts +3 -3
  74. package/dist/{src → lib}/flow-control/log-timings.js +11 -44
  75. package/dist/lib/flow-control/log-timings.spec.d.ts +1 -0
  76. package/dist/lib/flow-control/log-timings.spec.js +89 -0
  77. package/dist/{src → lib}/flow-control/logger-padding.d.ts +3 -3
  78. package/dist/{src → lib}/flow-control/logger-padding.js +7 -7
  79. package/dist/lib/flow-control/logger-padding.spec.d.ts +1 -0
  80. package/dist/lib/flow-control/logger-padding.spec.js +60 -0
  81. package/dist/{src → lib}/flow-control/output-error-handler.d.ts +4 -6
  82. package/dist/{src → lib}/flow-control/output-error-handler.js +3 -7
  83. package/dist/lib/flow-control/output-error-handler.spec.d.ts +1 -0
  84. package/dist/lib/flow-control/output-error-handler.spec.js +41 -0
  85. package/dist/{src → lib}/flow-control/restart-process.d.ts +4 -4
  86. package/dist/{src → lib}/flow-control/restart-process.js +10 -37
  87. package/dist/lib/flow-control/restart-process.spec.d.ts +1 -0
  88. package/dist/lib/flow-control/restart-process.spec.js +127 -0
  89. package/dist/{src → lib}/flow-control/teardown.d.ts +4 -5
  90. package/dist/{src → lib}/flow-control/teardown.js +6 -33
  91. package/dist/lib/flow-control/teardown.spec.d.ts +1 -0
  92. package/dist/lib/flow-control/teardown.spec.js +93 -0
  93. package/dist/{src → lib}/index.d.ts +21 -20
  94. package/dist/lib/index.js +98 -0
  95. package/dist/lib/jsonc.d.ts +8 -0
  96. package/dist/{src → lib}/jsonc.js +3 -8
  97. package/dist/lib/jsonc.spec.d.ts +1 -0
  98. package/dist/lib/jsonc.spec.js +73 -0
  99. package/dist/{src → lib}/logger.d.ts +3 -2
  100. package/dist/{src → lib}/logger.js +112 -53
  101. package/dist/lib/logger.spec.d.ts +1 -0
  102. package/dist/lib/logger.spec.js +507 -0
  103. package/dist/{src → lib}/observables.d.ts +1 -2
  104. package/dist/{src → lib}/observables.js +3 -7
  105. package/dist/lib/observables.spec.d.ts +1 -0
  106. package/dist/lib/observables.spec.js +29 -0
  107. package/dist/{src → lib}/output-writer.d.ts +3 -4
  108. package/dist/{src → lib}/output-writer.js +4 -31
  109. package/dist/lib/output-writer.spec.d.ts +1 -0
  110. package/dist/lib/output-writer.spec.js +96 -0
  111. package/dist/lib/prefix-color-selector.d.ts +21 -0
  112. package/dist/{src → lib}/prefix-color-selector.js +14 -31
  113. package/dist/lib/prefix-color-selector.spec.d.ts +1 -0
  114. package/dist/lib/prefix-color-selector.spec.js +159 -0
  115. package/dist/{src → lib}/spawn.d.ts +19 -16
  116. package/dist/lib/spawn.js +105 -0
  117. package/dist/lib/spawn.spec.d.ts +1 -0
  118. package/dist/lib/spawn.spec.js +100 -0
  119. package/dist/lib/utils.d.ts +25 -0
  120. package/dist/lib/utils.js +52 -0
  121. package/dist/lib/utils.spec.d.ts +1 -0
  122. package/dist/lib/utils.spec.js +58 -0
  123. package/dist/tsconfig.tsbuildinfo +1 -0
  124. package/docs/README.md +6 -0
  125. package/docs/cli/passthrough-arguments.md +8 -8
  126. package/docs/cli/prefixing.md +44 -4
  127. package/docs/cli/shortcuts.md +2 -2
  128. package/docs/shell-resolution.md +48 -0
  129. package/package.json +64 -85
  130. package/dist/bin/read-package.d.ts +0 -6
  131. package/dist/bin/read-package.js +0 -47
  132. package/dist/src/assert.d.ts +0 -5
  133. package/dist/src/assert.js +0 -16
  134. package/dist/src/command-parser/command-parser.d.ts +0 -19
  135. package/dist/src/command-parser/command-parser.js +0 -2
  136. package/dist/src/command-parser/expand-arguments.js +0 -39
  137. package/dist/src/command-parser/strip-quotes.d.ts +0 -16
  138. package/dist/src/command-parser/strip-quotes.js +0 -17
  139. package/dist/src/flow-control/flow-controller.d.ts +0 -13
  140. package/dist/src/flow-control/flow-controller.js +0 -2
  141. package/dist/src/index.js +0 -99
  142. package/dist/src/jsonc.d.ts +0 -8
  143. package/dist/src/prefix-color-selector.d.ts +0 -11
  144. package/dist/src/spawn.js +0 -49
  145. package/index.d.mts +0 -7
  146. package/index.d.ts +0 -11
  147. package/index.js +0 -14
  148. package/index.mjs +0 -10
  149. /package/dist/bin/{concurrently.d.ts → index.d.ts} +0 -0
@@ -0,0 +1,480 @@
1
+ import { afterAll, beforeAll, describe, expect, it } from 'vitest';
2
+ import { DateFormatter } from './date-format.js';
3
+ const withTime = (time) => `2000-01-01T${time}`;
4
+ const withDate = (date) => `${date}T00:00:00`;
5
+ /**
6
+ * Generates a suite of tests for token `token`.
7
+ *
8
+ * Each entry in `patternTests` makes the token longer, e.g.
9
+ * ```
10
+ * makeTests('year', 'y', [
11
+ * [{ expected: '2', input: withDate('0002-01-01') }], // y
12
+ * [{ expected: '02', input: withDate('0002-01-01') }], // yy
13
+ * // ...
14
+ * ]);
15
+ * ```
16
+ */
17
+ const makeTests = (name, token, patternTests, options) => describe(`${name}`, () => {
18
+ patternTests.forEach((tests, i) => {
19
+ const pattern = token.repeat(i + 1);
20
+ if (!tests) {
21
+ return it(`is not implemented for ${pattern}`, () => {
22
+ expect(() => new DateFormatter(pattern)).toThrow(RangeError);
23
+ });
24
+ }
25
+ else if (!tests.length) {
26
+ return;
27
+ }
28
+ it.each(tests)(`for pattern ${pattern} and input "$input" returns "$expected"`, ({ expected, input }) => {
29
+ const formatter = new DateFormatter(pattern, {
30
+ locale: 'en',
31
+ calendar: 'gregory',
32
+ ...options,
33
+ });
34
+ expect(formatter.format(new Date(input))).toBe(expected);
35
+ });
36
+ });
37
+ });
38
+ describe('combined', () => {
39
+ it('works with tokens and punctuation', () => {
40
+ const formatter = new DateFormatter('yyyy-MM-dd HH:mm:ss', { locale: 'en' });
41
+ const date = new Date(2024, 8, 1, 15, 30, 50);
42
+ expect(formatter.format(date)).toBe('2024-09-01 15:30:50');
43
+ });
44
+ it('works with tokens and literals', () => {
45
+ const formatter = new DateFormatter("HH 'o''clock'", { locale: 'en' });
46
+ const date = new Date();
47
+ date.setHours(10);
48
+ expect(formatter.format(date)).toBe("10 o'clock");
49
+ });
50
+ });
51
+ describe('literals', () => {
52
+ it.each([
53
+ ["'", "''"],
54
+ ['foo bar', "'foo bar'"],
55
+ ["foo ' bar", "'foo '' bar'"],
56
+ ["foo bar'?", "'foo bar'''?"],
57
+ ])('returns "%s" for pattern "%s"', (expected, pattern) => {
58
+ const formatter = new DateFormatter(pattern);
59
+ expect(formatter.format(new Date())).toBe(expected);
60
+ });
61
+ });
62
+ describe('tokens', () => {
63
+ it('throws if a token does not exist', () => {
64
+ expect(() => new DateFormatter('t')).toThrow(SyntaxError);
65
+ });
66
+ makeTests('era', 'G', [
67
+ [
68
+ { input: withDate('-000001-01-01'), expected: 'BC' },
69
+ { input: withDate('0001-01-01'), expected: 'AD' },
70
+ ],
71
+ [
72
+ { input: withDate('-000001-01-01'), expected: 'BC' },
73
+ { input: withDate('0001-01-01'), expected: 'AD' },
74
+ ],
75
+ [
76
+ { input: withDate('-000001-01-01'), expected: 'BC' },
77
+ { input: withDate('0001-01-01'), expected: 'AD' },
78
+ ],
79
+ [
80
+ { input: withDate('-000001-01-01'), expected: 'Before Christ' },
81
+ { input: withDate('0001-01-01'), expected: 'Anno Domini' },
82
+ ],
83
+ [
84
+ { input: withDate('-000001-01-01'), expected: 'B' },
85
+ { input: withDate('0001-01-01'), expected: 'A' },
86
+ ],
87
+ ]);
88
+ makeTests('year', 'y', [
89
+ [
90
+ { expected: '2', input: withDate('0002-01-01') },
91
+ { expected: '20', input: withDate('0020-01-01') },
92
+ { expected: '200', input: withDate('0200-01-01') },
93
+ { expected: '2000', input: withDate('2000-01-01') },
94
+ ],
95
+ [
96
+ { expected: '02', input: withDate('0002-01-01') },
97
+ { expected: '20', input: withDate('0020-01-01') },
98
+ { expected: '00', input: withDate('0200-01-01') },
99
+ { expected: '05', input: withDate('0205-01-01') },
100
+ { expected: '00', input: withDate('2000-01-01') },
101
+ { expected: '05', input: withDate('2005-01-01') },
102
+ ],
103
+ [
104
+ { expected: '002', input: withDate('0002-01-01') },
105
+ { expected: '020', input: withDate('0020-01-01') },
106
+ { expected: '200', input: withDate('0200-01-01') },
107
+ { expected: '2000', input: withDate('2000-01-01') },
108
+ ],
109
+ [
110
+ { expected: '0002', input: withDate('0002-01-01') },
111
+ { expected: '0020', input: withDate('0020-01-01') },
112
+ { expected: '0200', input: withDate('0200-01-01') },
113
+ { expected: '2000', input: withDate('2000-01-01') },
114
+ ],
115
+ [
116
+ { expected: '00002', input: withDate('0002-01-01') },
117
+ { expected: '00020', input: withDate('0020-01-01') },
118
+ { expected: '00200', input: withDate('0200-01-01') },
119
+ { expected: '02000', input: withDate('2000-01-01') },
120
+ ],
121
+ ]);
122
+ describe('year name', () => {
123
+ makeTests('with en locale', 'U', [[{ expected: '2024', input: withDate('2024-01-01') }]], {
124
+ locale: 'en',
125
+ });
126
+ makeTests('with zh-CN locale + chinese calendar', 'U', [[{ expected: '癸卯', input: withDate('2024-01-01') }]], { locale: 'zh-CN', calendar: 'chinese' });
127
+ });
128
+ describe('related year', () => {
129
+ makeTests('with en locale', 'r', [[{ expected: '2024', input: withDate('2024-01-01') }]], {
130
+ locale: 'en',
131
+ });
132
+ makeTests('with zh-CN locale + chinese calendar', 'r', [
133
+ [
134
+ { expected: '2023', input: withDate('2024-01-01') },
135
+ { expected: '2024', input: withDate('2024-03-01') },
136
+ ],
137
+ ], { locale: 'zh-CN', calendar: 'chinese' });
138
+ });
139
+ describe('week year', () => {
140
+ makeTests('with en locale', 'Y', [
141
+ [
142
+ { expected: '2023', input: withDate('2023-01-01') },
143
+ { expected: '2024', input: withDate('2023-12-31') },
144
+ { expected: '2024', input: withDate('2024-01-01') },
145
+ { expected: '2025', input: withDate('2024-12-31') },
146
+ ],
147
+ [
148
+ { expected: '23', input: withDate('2023-01-01') },
149
+ { expected: '24', input: withDate('2023-12-31') },
150
+ { expected: '24', input: withDate('2024-01-01') },
151
+ { expected: '25', input: withDate('2024-12-31') },
152
+ ],
153
+ ], { locale: 'en' });
154
+ makeTests('with de-DE locale', 'Y', [
155
+ [
156
+ { expected: '2022', input: withDate('2023-01-01') },
157
+ { expected: '2023', input: withDate('2023-12-31') },
158
+ { expected: '2024', input: withDate('2024-01-01') },
159
+ { expected: '2025', input: withDate('2024-12-31') },
160
+ ],
161
+ [
162
+ { expected: '22', input: withDate('2023-01-01') },
163
+ { expected: '23', input: withDate('2023-12-31') },
164
+ { expected: '24', input: withDate('2024-01-01') },
165
+ { expected: '25', input: withDate('2024-12-31') },
166
+ ],
167
+ ], { locale: 'de-DE' });
168
+ describe(`when minimalDays is missing`, () => {
169
+ beforeAll(() => {
170
+ if (typeof Intl.Locale.prototype.getWeekInfo === 'function') {
171
+ Intl.Locale.prototype.getWeekInfoOrig = Intl.Locale.prototype.getWeekInfo;
172
+ }
173
+ Intl.Locale.prototype.getWeekInfo = function () {
174
+ const data = typeof Intl.Locale.prototype.getWeekInfoOrig === 'function'
175
+ ? this.getWeekInfoOrig()
176
+ : this.weekInfo;
177
+ delete data.minimalDays;
178
+ return data;
179
+ };
180
+ });
181
+ afterAll(() => {
182
+ if (Intl.Locale.prototype.getWeekInfoOrig) {
183
+ Intl.Locale.prototype.getWeekInfo = Intl.Locale.prototype.getWeekInfoOrig;
184
+ delete Intl.Locale.prototype.getWeekInfoOrig;
185
+ }
186
+ });
187
+ makeTests(
188
+ // Needs to be a different locale than in tests above to not use cached weekInfo
189
+ 'with de-CH locale', 'Y', [
190
+ [
191
+ { expected: '2022', input: withDate('2023-01-01') },
192
+ { expected: '2023', input: withDate('2023-12-31') },
193
+ { expected: '2024', input: withDate('2024-01-01') },
194
+ { expected: '2025', input: withDate('2024-12-31') },
195
+ ],
196
+ [
197
+ { expected: '22', input: withDate('2023-01-01') },
198
+ { expected: '23', input: withDate('2023-12-31') },
199
+ { expected: '24', input: withDate('2024-01-01') },
200
+ { expected: '25', input: withDate('2024-12-31') },
201
+ ],
202
+ ], { locale: 'de-CH' });
203
+ });
204
+ });
205
+ makeTests('quarter', 'Q', [
206
+ [
207
+ { expected: '1', input: withDate('2000-01-01') },
208
+ { expected: '2', input: withDate('2000-04-01') },
209
+ { expected: '3', input: withDate('2000-07-01') },
210
+ { expected: '4', input: withDate('2000-10-01') },
211
+ ],
212
+ [
213
+ { expected: '01', input: withDate('2000-01-01') },
214
+ { expected: '02', input: withDate('2000-04-01') },
215
+ { expected: '03', input: withDate('2000-07-01') },
216
+ { expected: '04', input: withDate('2000-10-01') },
217
+ ],
218
+ undefined,
219
+ undefined,
220
+ [
221
+ { expected: '1', input: withDate('2000-01-01') },
222
+ { expected: '2', input: withDate('2000-04-01') },
223
+ { expected: '3', input: withDate('2000-07-01') },
224
+ { expected: '4', input: withDate('2000-10-01') },
225
+ ],
226
+ ]);
227
+ makeTests('quarter - stand-alone', 'q', [
228
+ [
229
+ { expected: '1', input: withDate('2000-01-01') },
230
+ { expected: '2', input: withDate('2000-04-01') },
231
+ { expected: '3', input: withDate('2000-07-01') },
232
+ { expected: '4', input: withDate('2000-10-01') },
233
+ ],
234
+ [
235
+ { expected: '01', input: withDate('2000-01-01') },
236
+ { expected: '02', input: withDate('2000-04-01') },
237
+ { expected: '03', input: withDate('2000-07-01') },
238
+ { expected: '04', input: withDate('2000-10-01') },
239
+ ],
240
+ undefined,
241
+ undefined,
242
+ [
243
+ { expected: '1', input: withDate('2000-01-01') },
244
+ { expected: '2', input: withDate('2000-04-01') },
245
+ { expected: '3', input: withDate('2000-07-01') },
246
+ { expected: '4', input: withDate('2000-10-01') },
247
+ ],
248
+ ]);
249
+ describe('month', () => {
250
+ makeTests('with en locale', 'M', [
251
+ [{ expected: '1', input: withDate('2000-01-01') }],
252
+ [{ expected: '01', input: withDate('2000-01-01') }],
253
+ [{ expected: 'Jan', input: withDate('2000-01-01') }],
254
+ [{ expected: 'January', input: withDate('2000-01-01') }],
255
+ [{ expected: 'J', input: withDate('2000-01-01') }],
256
+ ], { locale: 'en' });
257
+ makeTests('with pl locale', 'M', [
258
+ [{ expected: '1', input: withDate('2000-01-01') }],
259
+ [{ expected: '01', input: withDate('2000-01-01') }],
260
+ [{ expected: 'sty', input: withDate('2000-01-01') }],
261
+ [{ expected: 'stycznia', input: withDate('2000-01-01') }],
262
+ [{ expected: 's', input: withDate('2000-01-01') }],
263
+ ], { locale: 'pl' });
264
+ });
265
+ describe('month - stand-alone', () => {
266
+ makeTests('with en locale', 'L', [
267
+ [{ expected: '1', input: withDate('2000-01-01') }],
268
+ [{ expected: '01', input: withDate('2000-01-01') }],
269
+ [{ expected: 'Jan', input: withDate('2000-01-01') }],
270
+ [{ expected: 'January', input: withDate('2000-01-01') }],
271
+ [{ expected: 'J', input: withDate('2000-01-01') }],
272
+ ], { locale: 'en' });
273
+ makeTests('with pl locale', 'L', [
274
+ [{ expected: '1', input: withDate('2000-01-01') }],
275
+ [{ expected: '01', input: withDate('2000-01-01') }],
276
+ [{ expected: 'sty', input: withDate('2000-01-01') }],
277
+ [{ expected: 'styczeń', input: withDate('2000-01-01') }],
278
+ [{ expected: 'S', input: withDate('2000-01-01') }],
279
+ ], { locale: 'pl' });
280
+ });
281
+ describe('week of year', () => {
282
+ makeTests('with en locale', 'w', [
283
+ [
284
+ { expected: '1', input: withDate('2023-01-01') },
285
+ { expected: '1', input: withDate('2023-12-31') },
286
+ { expected: '1', input: withDate('2024-01-01') },
287
+ { expected: '1', input: withDate('2024-12-31') },
288
+ ],
289
+ [
290
+ { expected: '01', input: withDate('2023-01-01') },
291
+ { expected: '01', input: withDate('2023-12-31') },
292
+ { expected: '01', input: withDate('2024-01-01') },
293
+ { expected: '01', input: withDate('2024-12-31') },
294
+ ],
295
+ ], { locale: 'en' });
296
+ makeTests('with de-DE locale', 'w', [
297
+ [
298
+ { expected: '52', input: withDate('2023-01-01') },
299
+ { expected: '52', input: withDate('2023-12-31') },
300
+ { expected: '1', input: withDate('2024-01-01') },
301
+ { expected: '1', input: withDate('2024-12-31') },
302
+ ],
303
+ [
304
+ { expected: '52', input: withDate('2023-01-01') },
305
+ { expected: '52', input: withDate('2023-12-31') },
306
+ { expected: '01', input: withDate('2024-01-01') },
307
+ { expected: '01', input: withDate('2024-12-31') },
308
+ ],
309
+ ], { locale: 'de-DE' });
310
+ });
311
+ describe('week of month', () => {
312
+ makeTests('with en locale', 'W', [
313
+ [
314
+ { expected: '6', input: withDate('2021-01-31') },
315
+ { expected: '5', input: withDate('2021-02-28') },
316
+ ],
317
+ ], { locale: 'en' });
318
+ makeTests('with de-DE locale', 'W', [
319
+ [
320
+ { expected: '5', input: withDate('2021-01-31') },
321
+ { expected: '4', input: withDate('2021-02-28') },
322
+ ],
323
+ ], { locale: 'de-DE' });
324
+ });
325
+ makeTests('day', 'd', [
326
+ [
327
+ { expected: '1', input: withDate('2000-01-01') },
328
+ { expected: '10', input: withDate('2000-01-10') },
329
+ ],
330
+ [
331
+ { expected: '01', input: withDate('2000-01-01') },
332
+ { expected: '10', input: withDate('2000-01-10') },
333
+ ],
334
+ ]);
335
+ makeTests('day of week in month', 'F', [
336
+ [
337
+ { expected: '1', input: withDate('2024-09-01') },
338
+ { expected: '2', input: withDate('2024-09-08') },
339
+ ],
340
+ ]);
341
+ makeTests('day of year', 'D', [
342
+ [
343
+ { expected: '1', input: withDate('2024-01-01') },
344
+ { expected: '32', input: withDate('2024-02-01') },
345
+ { expected: '366', input: withDate('2024-12-31') },
346
+ ],
347
+ [
348
+ { expected: '01', input: withDate('2024-01-01') },
349
+ { expected: '32', input: withDate('2024-02-01') },
350
+ { expected: '366', input: withDate('2024-12-31') },
351
+ ],
352
+ [
353
+ { expected: '001', input: withDate('2024-01-01') },
354
+ { expected: '032', input: withDate('2024-02-01') },
355
+ { expected: '366', input: withDate('2024-12-31') },
356
+ ],
357
+ ]);
358
+ makeTests('week day', 'E', [
359
+ [{ expected: 'Sat', input: withDate('2024-09-07') }],
360
+ [{ expected: 'Sat', input: withDate('2024-09-07') }],
361
+ [{ expected: 'Sat', input: withDate('2024-09-07') }],
362
+ [{ expected: 'Saturday', input: withDate('2024-09-07') }],
363
+ ]);
364
+ makeTests('local week day', 'e', [
365
+ undefined,
366
+ undefined,
367
+ [{ expected: 'Sat', input: withDate('2024-09-07') }],
368
+ [{ expected: 'Saturday', input: withDate('2024-09-07') }],
369
+ ]);
370
+ makeTests('period', 'a', [
371
+ [
372
+ { expected: 'AM', input: withTime('10:00:00') },
373
+ { expected: 'PM', input: withTime('12:00:00') },
374
+ ],
375
+ [
376
+ { expected: 'AM', input: withTime('10:00:00') },
377
+ { expected: 'PM', input: withTime('12:00:00') },
378
+ ],
379
+ [
380
+ { expected: 'AM', input: withTime('10:00:00') },
381
+ { expected: 'PM', input: withTime('12:00:00') },
382
+ ],
383
+ ]);
384
+ makeTests('flexible day period', 'B', [
385
+ [
386
+ { expected: 'in the morning', input: withTime('06:00:00') },
387
+ { expected: 'noon', input: withTime('12:00:00') },
388
+ { expected: 'in the afternoon', input: withTime('16:00:00') },
389
+ { expected: 'at night', input: withTime('23:00:00') },
390
+ ],
391
+ [],
392
+ [],
393
+ [
394
+ { expected: 'in the morning', input: withTime('06:00:00') },
395
+ { expected: 'noon', input: withTime('12:00:00') },
396
+ { expected: 'in the afternoon', input: withTime('16:00:00') },
397
+ { expected: 'at night', input: withTime('23:00:00') },
398
+ ],
399
+ ]);
400
+ describe('hour', () => {
401
+ makeTests('1-12 format (1 PM)', 'h', [
402
+ [{ expected: '1', input: withTime('13:00:00') }],
403
+ [{ expected: '01', input: withTime('13:00:00') }],
404
+ ]);
405
+ makeTests('1-12 format (12 PM)', 'h', [
406
+ [{ expected: '12', input: withTime('00:00:00') }],
407
+ [{ expected: '12', input: withTime('00:00:00') }],
408
+ ]);
409
+ makeTests('0-23 format', 'H', [
410
+ [
411
+ { expected: '0', input: withTime('00:00:00') },
412
+ { expected: '13', input: withTime('13:00:00') },
413
+ ],
414
+ [
415
+ { expected: '00', input: withTime('00:00:00') },
416
+ { expected: '13', input: withTime('13:00:00') },
417
+ ],
418
+ ]);
419
+ makeTests('0-11 format', 'K', [
420
+ [
421
+ { expected: '0', input: withTime('00:00:00') },
422
+ { expected: '1', input: withTime('13:00:00') },
423
+ ],
424
+ [
425
+ { expected: '00', input: withTime('00:00:00') },
426
+ { expected: '01', input: withTime('13:00:00') },
427
+ ],
428
+ ]);
429
+ makeTests('1-24 format', 'k', [
430
+ [
431
+ { expected: '13', input: withTime('13:00:00') },
432
+ { expected: '24', input: withTime('00:00:00') },
433
+ ],
434
+ [
435
+ { expected: '13', input: withTime('13:00:00') },
436
+ { expected: '24', input: withTime('00:00:00') },
437
+ ],
438
+ ]);
439
+ });
440
+ makeTests('minute', 'm', [
441
+ [
442
+ { expected: '0', input: withTime('00:00:00') },
443
+ { expected: '59', input: withTime('00:59:00') },
444
+ ],
445
+ [
446
+ { expected: '00', input: withTime('00:00:00') },
447
+ { expected: '59', input: withTime('00:59:00') },
448
+ ],
449
+ ]);
450
+ makeTests('seconds', 's', [
451
+ [
452
+ { expected: '0', input: withTime('00:00:00') },
453
+ { expected: '59', input: withTime('00:00:59') },
454
+ ],
455
+ [
456
+ { expected: '00', input: withTime('00:00:00') },
457
+ { expected: '59', input: withTime('00:00:59') },
458
+ ],
459
+ ]);
460
+ makeTests('fractional seconds', 'S', [
461
+ [
462
+ { expected: '0', input: withTime('00:00:00.000') },
463
+ { expected: '0', input: withTime('00:00:00.001') },
464
+ { expected: '0', input: withTime('00:00:00.010') },
465
+ { expected: '1', input: withTime('00:00:00.100') },
466
+ ],
467
+ [
468
+ { expected: '00', input: withTime('00:00:00.000') },
469
+ { expected: '00', input: withTime('00:00:00.001') },
470
+ { expected: '01', input: withTime('00:00:00.010') },
471
+ { expected: '10', input: withTime('00:00:00.100') },
472
+ ],
473
+ [
474
+ { expected: '000', input: withTime('00:00:00.000') },
475
+ { expected: '001', input: withTime('00:00:00.001') },
476
+ { expected: '010', input: withTime('00:00:00.010') },
477
+ { expected: '100', input: withTime('00:00:00.100') },
478
+ ],
479
+ ]);
480
+ });
@@ -1,4 +1,4 @@
1
- import { SuccessCondition } from './completion-listener';
1
+ import { SuccessCondition } from './completion-listener.js';
2
2
  export declare const defaultInputTarget = 0;
3
3
  /**
4
4
  * Whether process.stdin should be forwarded to child processes.
@@ -12,10 +12,6 @@ export declare const maxProcesses = 0;
12
12
  * Indices and names of commands whose output are not to be logged.
13
13
  */
14
14
  export declare const hide = "";
15
- /**
16
- * The character to split <names> on.
17
- */
18
- export declare const nameSeparator = ",";
19
15
  /**
20
16
  * Which prefix style to use when logging processes output.
21
17
  */
@@ -24,7 +20,7 @@ export declare const prefix = "";
24
20
  * Default prefix color.
25
21
  * @see https://www.npmjs.com/package/chalk
26
22
  */
27
- export declare const prefixColors = "reset";
23
+ export declare const prefixColors = "auto";
28
24
  /**
29
25
  * How many bytes we'll show on the command prefix.
30
26
  */
@@ -1,73 +1,66 @@
1
- "use strict";
2
1
  // This file is meant to be a shared place for default configs.
3
2
  // It's read by the flow controllers, the executable, etc.
4
3
  // Refer to tests for the meaning of the different possible values.
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.killSignal = exports.passthroughArguments = exports.timings = exports.cwd = exports.timestampFormat = exports.success = exports.restartDelay = exports.restartTries = exports.raw = exports.prefixLength = exports.prefixColors = exports.prefix = exports.nameSeparator = exports.hide = exports.maxProcesses = exports.handleInput = exports.defaultInputTarget = void 0;
7
- exports.defaultInputTarget = 0;
4
+ export const defaultInputTarget = 0;
8
5
  /**
9
6
  * Whether process.stdin should be forwarded to child processes.
10
7
  */
11
- exports.handleInput = false;
8
+ export const handleInput = false;
12
9
  /**
13
10
  * How many processes to run at once.
14
11
  */
15
- exports.maxProcesses = 0;
12
+ export const maxProcesses = 0;
16
13
  /**
17
14
  * Indices and names of commands whose output are not to be logged.
18
15
  */
19
- exports.hide = '';
20
- /**
21
- * The character to split <names> on.
22
- */
23
- exports.nameSeparator = ',';
16
+ export const hide = '';
24
17
  /**
25
18
  * Which prefix style to use when logging processes output.
26
19
  */
27
- exports.prefix = '';
20
+ export const prefix = '';
28
21
  /**
29
22
  * Default prefix color.
30
23
  * @see https://www.npmjs.com/package/chalk
31
24
  */
32
- exports.prefixColors = 'reset';
25
+ export const prefixColors = 'auto';
33
26
  /**
34
27
  * How many bytes we'll show on the command prefix.
35
28
  */
36
- exports.prefixLength = 10;
37
- exports.raw = false;
29
+ export const prefixLength = 10;
30
+ export const raw = false;
38
31
  /**
39
32
  * Number of attempts of restarting a process, if it exits with non-0 code.
40
33
  */
41
- exports.restartTries = 0;
34
+ export const restartTries = 0;
42
35
  /**
43
36
  * How many milliseconds concurrently should wait before restarting a process.
44
37
  */
45
- exports.restartDelay = 0;
38
+ export const restartDelay = 0;
46
39
  /**
47
40
  * Condition of success for concurrently itself.
48
41
  */
49
- exports.success = 'all';
42
+ export const success = 'all';
50
43
  /**
51
44
  * Date format used when logging date/time.
52
45
  * @see https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
53
46
  */
54
- exports.timestampFormat = 'yyyy-MM-dd HH:mm:ss.SSS';
47
+ export const timestampFormat = 'yyyy-MM-dd HH:mm:ss.SSS';
55
48
  /**
56
49
  * Current working dir passed as option to spawn command.
57
50
  * Defaults to process.cwd()
58
51
  */
59
- exports.cwd = undefined;
52
+ export const cwd = undefined;
60
53
  /**
61
54
  * Whether to show timing information for processes in console output.
62
55
  */
63
- exports.timings = false;
56
+ export const timings = false;
64
57
  /**
65
58
  * Passthrough additional arguments to commands (accessible via placeholders) instead of treating them as commands.
66
59
  */
67
- exports.passthroughArguments = false;
60
+ export const passthroughArguments = false;
68
61
  /**
69
62
  * Signal to send to other processes if one exits or dies.
70
63
  *
71
64
  * Defaults to OS specific signal. (SIGTERM on Linux/MacOS)
72
65
  */
73
- exports.killSignal = undefined;
66
+ export const killSignal = undefined;
@@ -1,8 +1,7 @@
1
- /// <reference types="node" />
2
- import { Readable } from 'stream';
3
- import { Command, CommandIdentifier } from '../command';
4
- import { Logger } from '../logger';
5
- import { FlowController } from './flow-controller';
1
+ import { Readable } from 'node:stream';
2
+ import { Command, CommandIdentifier } from '../command.js';
3
+ import { Logger } from '../logger.js';
4
+ import { FlowController } from './flow-controller.js';
6
5
  /**
7
6
  * Sends input from concurrently through to commands.
8
7
  *
@@ -1,32 +1,6 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.InputHandler = void 0;
27
- const Rx = __importStar(require("rxjs"));
28
- const operators_1 = require("rxjs/operators");
29
- const defaults = __importStar(require("../defaults"));
1
+ import Rx from 'rxjs';
2
+ import { map } from 'rxjs/operators';
3
+ import * as defaults from '../defaults.js';
30
4
  /**
31
5
  * Sends input from concurrently through to commands.
32
6
  *
@@ -36,7 +10,7 @@ const defaults = __importStar(require("../defaults"));
36
10
  *
37
11
  * If the input doesn't start with a command identifier, it is then always sent to the default target.
38
12
  */
39
- class InputHandler {
13
+ export class InputHandler {
40
14
  logger;
41
15
  defaultInputTarget;
42
16
  inputStream;
@@ -58,12 +32,13 @@ class InputHandler {
58
32
  commandsMap.set(command.name, command);
59
33
  }
60
34
  Rx.fromEvent(inputStream, 'data')
61
- .pipe((0, operators_1.map)((data) => String(data)))
35
+ .pipe(map((data) => String(data)))
62
36
  .subscribe((data) => {
63
- let command, input;
64
37
  const dataParts = data.split(/:(.+)/s);
65
38
  let target = dataParts[0];
66
- if (dataParts.length > 1 && (command = commandsMap.get(target))) {
39
+ let command = commandsMap.get(target);
40
+ let input;
41
+ if (dataParts.length > 1 && command) {
67
42
  input = dataParts[1];
68
43
  }
69
44
  else {
@@ -91,4 +66,3 @@ class InputHandler {
91
66
  };
92
67
  }
93
68
  }
94
- exports.InputHandler = InputHandler;
@@ -0,0 +1 @@
1
+ export {};