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
@@ -1,76 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DateFormatter = void 0;
4
- /**
5
- * Unicode-compliant date/time formatter.
6
- *
7
- * @see https://unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns
8
- */
9
- class DateFormatter {
10
- options;
11
- static tokenRegex = /[A-Z]/i;
12
- parts = [];
13
- constructor(pattern, options = {}) {
14
- this.options = options;
15
- let i = 0;
16
- while (i < pattern.length) {
17
- const char = pattern[i];
18
- const { fn, length } = char === "'"
19
- ? this.compileLiteral(pattern, i)
20
- : DateFormatter.tokenRegex.test(char)
21
- ? this.compileToken(pattern, i)
22
- : this.compileOther(pattern, i);
23
- this.parts.push(fn);
24
- i += length;
25
- }
26
- }
27
- compileLiteral(pattern, offset) {
28
- let length = 1;
29
- let value = '';
30
- for (; length < pattern.length; length++) {
31
- const i = offset + length;
32
- const char = pattern[i];
33
- if (char === "'") {
34
- const nextChar = pattern[i + 1];
35
- length++;
36
- // if the next character is another single quote, it's been escaped.
37
- // if not, then the literal has been closed
38
- if (nextChar !== "'") {
39
- break;
40
- }
41
- }
42
- value += char;
43
- }
44
- return { fn: () => value || "'", length };
45
- }
46
- compileOther(pattern, offset) {
47
- let value = '';
48
- while (!DateFormatter.tokenRegex.test(pattern[offset]) && pattern[offset] !== "'") {
49
- value += pattern[offset++];
50
- }
51
- return { fn: () => value, length: value.length };
52
- }
53
- compileToken(pattern, offset) {
54
- const type = pattern[offset];
55
- const token = tokens.get(type);
56
- if (!token) {
57
- throw new SyntaxError(`Formatting token "${type}" is invalid`);
58
- }
59
- let length = 0;
60
- while (pattern[offset + length] === type) {
61
- length++;
62
- }
63
- const tokenFn = token[length - 1];
64
- if (!tokenFn) {
65
- throw new RangeError(`Formatting token "${type.repeat(length)}" is unsupported`);
66
- }
67
- return { fn: tokenFn, length };
68
- }
69
- format(date) {
70
- return this.parts.reduce((output, part) => output + String(part(date, this.options)), '');
71
- }
72
- }
73
- exports.DateFormatter = DateFormatter;
74
1
  /**
75
2
  * A map of token to its implementations by length.
76
3
  * If an index is undefined, then that token length is unsupported.
@@ -235,10 +162,105 @@ const tokens = new Map()
235
162
  let locale;
236
163
  function getLocale(options) {
237
164
  if (!locale || locale.baseName !== options.locale) {
238
- locale = new Intl.Locale(options.locale || new Intl.DateTimeFormat().resolvedOptions().locale);
165
+ locale = new Intl.Locale(
166
+ /* v8 ignore next - fallback value only for safety */
167
+ options.locale || new Intl.DateTimeFormat().resolvedOptions().locale);
239
168
  }
240
169
  return locale;
241
170
  }
171
+ /**
172
+ * Unicode-compliant date/time formatter.
173
+ *
174
+ * @see https://unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns
175
+ */
176
+ export class DateFormatter {
177
+ options;
178
+ static tokenRegex = /[A-Z]/i;
179
+ parts = [];
180
+ constructor(pattern, options = {}) {
181
+ this.options = options;
182
+ let i = 0;
183
+ while (i < pattern.length) {
184
+ const char = pattern[i];
185
+ const { fn, length } = char === "'"
186
+ ? this.compileLiteral(pattern, i)
187
+ : DateFormatter.tokenRegex.test(char)
188
+ ? this.compileToken(pattern, i)
189
+ : this.compileOther(pattern, i);
190
+ this.parts.push(fn);
191
+ i += length;
192
+ }
193
+ }
194
+ compileLiteral(pattern, offset) {
195
+ let length = 1;
196
+ let value = '';
197
+ for (; length < pattern.length; length++) {
198
+ const i = offset + length;
199
+ const char = pattern[i];
200
+ if (char === "'") {
201
+ const nextChar = pattern[i + 1];
202
+ length++;
203
+ // if the next character is another single quote, it's been escaped.
204
+ // if not, then the literal has been closed
205
+ if (nextChar !== "'") {
206
+ break;
207
+ }
208
+ }
209
+ value += char;
210
+ }
211
+ return { fn: () => value || "'", length };
212
+ }
213
+ compileOther(pattern, offset) {
214
+ let value = '';
215
+ while (!DateFormatter.tokenRegex.test(pattern[offset]) && pattern[offset] !== "'") {
216
+ value += pattern[offset++];
217
+ }
218
+ return { fn: () => value, length: value.length };
219
+ }
220
+ compileToken(pattern, offset) {
221
+ const type = pattern[offset];
222
+ const token = tokens.get(type);
223
+ if (!token) {
224
+ throw new SyntaxError(`Formatting token "${type}" is invalid`);
225
+ }
226
+ let length = 0;
227
+ while (pattern[offset + length] === type) {
228
+ length++;
229
+ }
230
+ const tokenFn = token[length - 1];
231
+ if (!tokenFn) {
232
+ throw new RangeError(`Formatting token "${type.repeat(length)}" is unsupported`);
233
+ }
234
+ return { fn: tokenFn, length };
235
+ }
236
+ format(date) {
237
+ return this.parts.reduce((output, part) => output + String(part(date, this.options)), '');
238
+ }
239
+ }
240
+ /**
241
+ * See https://github.com/moment/luxon/issues/1693
242
+ *
243
+ * @todo Replace once there's a suitable alternative implementation
244
+ */
245
+ const fallbackWeekInfo = {
246
+ minimalDays: 4,
247
+ };
248
+ const weekInfoCache = new Map();
249
+ function getWeekInfo(locale) {
250
+ let data = weekInfoCache.get(locale.baseName);
251
+ if (!data) {
252
+ // The specs now envisage a method for this,
253
+ // see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getWeekInfo
254
+ data = locale.getWeekInfo?.() ?? locale.weekInfo;
255
+ // The specs have dropped minimalDays,
256
+ // see https://github.com/tc39/proposal-intl-locale-info/issues/86
257
+ if (!data.minimalDays) {
258
+ data = { ...fallbackWeekInfo, ...data };
259
+ }
260
+ weekInfoCache.set(locale.baseName, data);
261
+ }
262
+ return data;
263
+ }
242
264
  /**
243
265
  * Creates a token formatting function that returns the value of the chosen part type,
244
266
  * using the current locale's settings.
@@ -261,12 +283,14 @@ function makeTokenFn(options, type, fallback) {
261
283
  }
262
284
  const parts = formatter.formatToParts(date);
263
285
  const part = parts.find((p) => p.type === type);
286
+ /* v8 ignore next - fallback value '' only for safety */
264
287
  return part?.value ?? (fallback ? fallback(date, formatterOptions) : '');
265
288
  };
266
289
  }
267
290
  function startOfWeek(date, options) {
268
291
  const locale = getLocale(options);
269
- const firstDay = locale.weekInfo.firstDay === 7 ? 0 : locale.weekInfo.firstDay;
292
+ const weekInfo = getWeekInfo(locale);
293
+ const firstDay = weekInfo.firstDay === 7 ? 0 : weekInfo.firstDay;
270
294
  const day = date.getDay();
271
295
  const diff = (day < firstDay ? 7 : 0) + day - firstDay;
272
296
  date.setDate(date.getDate() - diff);
@@ -275,7 +299,7 @@ function startOfWeek(date, options) {
275
299
  }
276
300
  function getWeekYear(date, options) {
277
301
  const locale = getLocale(options);
278
- const minimalDays = locale.weekInfo.minimalDays;
302
+ const minimalDays = getWeekInfo(locale).minimalDays;
279
303
  const year = date.getFullYear();
280
304
  const thisYear = startOfWeek(new Date(year, 0, minimalDays), options);
281
305
  const nextYear = startOfWeek(new Date(year + 1, 0, minimalDays), options);
@@ -293,7 +317,7 @@ function getWeek(date, options) {
293
317
  const locale = getLocale(options);
294
318
  const weekMs = 7 * 24 * 3600 * 1000;
295
319
  const temp = startOfWeek(new Date(date), options);
296
- const thisYear = new Date(getWeekYear(date, options), 0, locale.weekInfo.minimalDays);
320
+ const thisYear = new Date(getWeekYear(date, options), 0, getWeekInfo(locale).minimalDays);
297
321
  startOfWeek(thisYear, options);
298
322
  const diff = temp.getTime() - thisYear.getTime();
299
323
  return Math.round(diff / weekMs) + 1;
@@ -0,0 +1 @@
1
+ export {};