concurrently 9.2.1 → 10.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/README.md +25 -14
  2. package/dist/bin/bin-options.d.ts +1 -0
  3. package/dist/bin/bin-options.js +1 -0
  4. package/dist/bin/{concurrently.js → index.js} +23 -62
  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/read-package-json.d.ts +4 -0
  8. package/dist/bin/read-package-json.js +17 -0
  9. package/dist/lib/assert.d.ts +10 -0
  10. package/dist/lib/assert.js +24 -0
  11. package/dist/{src → lib}/command-parser/expand-arguments.d.ts +2 -2
  12. package/dist/{src → lib}/command-parser/expand-arguments.js +7 -12
  13. package/dist/{src → lib}/command-parser/expand-shortcut.d.ts +2 -2
  14. package/dist/{src → lib}/command-parser/expand-shortcut.js +1 -5
  15. package/dist/{src → lib}/command-parser/expand-wildcard.d.ts +2 -2
  16. package/dist/{src → lib}/command-parser/expand-wildcard.js +21 -28
  17. package/dist/{src → lib}/command.d.ts +5 -4
  18. package/dist/{src → lib}/command.js +3 -39
  19. package/dist/{src → lib}/completion-listener.d.ts +2 -2
  20. package/dist/{src → lib}/completion-listener.js +9 -46
  21. package/dist/{src → lib}/concurrently.d.ts +10 -10
  22. package/dist/{src → lib}/concurrently.js +29 -40
  23. package/dist/{src → lib}/date-format.d.ts +2 -2
  24. package/dist/{src → lib}/date-format.js +97 -76
  25. package/dist/{src → lib}/defaults.d.ts +2 -6
  26. package/dist/{src → lib}/defaults.js +16 -23
  27. package/dist/{src → lib}/flow-control/flow-controller.d.ts +1 -1
  28. package/dist/lib/flow-control/flow-controller.js +1 -0
  29. package/dist/{src → lib}/flow-control/input-handler.d.ts +4 -4
  30. package/dist/{src → lib}/flow-control/input-handler.js +8 -44
  31. package/dist/{src → lib}/flow-control/kill-on-signal.d.ts +3 -3
  32. package/dist/{src → lib}/flow-control/kill-on-signal.js +3 -7
  33. package/dist/{src → lib}/flow-control/kill-others.d.ts +3 -3
  34. package/dist/{src → lib}/flow-control/kill-others.js +8 -12
  35. package/dist/{src → lib}/flow-control/log-error.d.ts +3 -3
  36. package/dist/{src → lib}/flow-control/log-error.js +1 -5
  37. package/dist/{src → lib}/flow-control/log-exit.d.ts +3 -3
  38. package/dist/{src → lib}/flow-control/log-exit.js +1 -5
  39. package/dist/{src → lib}/flow-control/log-output.d.ts +3 -3
  40. package/dist/{src → lib}/flow-control/log-output.js +1 -5
  41. package/dist/{src → lib}/flow-control/log-timings.d.ts +3 -3
  42. package/dist/{src → lib}/flow-control/log-timings.js +8 -45
  43. package/dist/{src → lib}/flow-control/logger-padding.d.ts +3 -3
  44. package/dist/{src → lib}/flow-control/logger-padding.js +7 -7
  45. package/dist/{src → lib}/flow-control/output-error-handler.d.ts +4 -4
  46. package/dist/{src → lib}/flow-control/output-error-handler.js +3 -7
  47. package/dist/{src → lib}/flow-control/restart-process.d.ts +4 -4
  48. package/dist/lib/flow-control/restart-process.js +61 -0
  49. package/dist/{src → lib}/flow-control/teardown.d.ts +4 -5
  50. package/dist/lib/flow-control/teardown.js +45 -0
  51. package/dist/{src → lib}/index.d.ts +21 -19
  52. package/dist/lib/index.js +98 -0
  53. package/dist/{src → lib}/jsonc.js +3 -8
  54. package/dist/{src → lib}/logger.d.ts +3 -2
  55. package/dist/{src → lib}/logger.js +109 -65
  56. package/dist/{src → lib}/observables.d.ts +1 -1
  57. package/dist/{src → lib}/observables.js +3 -6
  58. package/dist/{src → lib}/output-writer.d.ts +3 -3
  59. package/dist/{src → lib}/output-writer.js +4 -41
  60. package/dist/lib/prefix-color-selector.d.ts +21 -0
  61. package/dist/{src → lib}/prefix-color-selector.js +14 -31
  62. package/dist/{src → lib}/spawn.d.ts +14 -5
  63. package/dist/lib/spawn.js +105 -0
  64. package/dist/lib/utils.d.ts +25 -0
  65. package/dist/lib/utils.js +52 -0
  66. package/dist/tsconfig.tsbuildinfo +1 -1
  67. package/docs/README.md +6 -0
  68. package/docs/cli/prefixing.md +44 -4
  69. package/docs/shell-resolution.md +48 -0
  70. package/package.json +48 -67
  71. package/dist/bin/read-package.d.ts +0 -6
  72. package/dist/bin/read-package.js +0 -56
  73. package/dist/src/assert.d.ts +0 -5
  74. package/dist/src/assert.js +0 -15
  75. package/dist/src/command-parser/command-parser.d.ts +0 -19
  76. package/dist/src/command-parser/command-parser.js +0 -2
  77. package/dist/src/command-parser/strip-quotes.d.ts +0 -16
  78. package/dist/src/command-parser/strip-quotes.js +0 -17
  79. package/dist/src/flow-control/flow-controller.js +0 -2
  80. package/dist/src/flow-control/restart-process.js +0 -98
  81. package/dist/src/flow-control/teardown.js +0 -82
  82. package/dist/src/index.js +0 -96
  83. package/dist/src/prefix-color-selector.d.ts +0 -11
  84. package/dist/src/spawn.js +0 -49
  85. package/dist/src/utils.d.ts +0 -10
  86. package/dist/src/utils.js +0 -16
  87. package/index.d.mts +0 -7
  88. package/index.d.ts +0 -11
  89. package/index.js +0 -14
  90. package/index.mjs +0 -9
  91. /package/dist/bin/{concurrently.d.ts → index.d.ts} +0 -0
  92. /package/dist/{src → lib}/jsonc.d.ts +0 -0
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![Latest Release](https://img.shields.io/github/v/release/open-cli-tools/concurrently?label=Release)](https://github.com/open-cli-tools/concurrently/releases)
4
4
  [![License](https://img.shields.io/github/license/open-cli-tools/concurrently?label=License)](https://github.com/open-cli-tools/concurrently/blob/main/LICENSE)
5
5
  [![Weekly Downloads on NPM](https://img.shields.io/npm/dw/concurrently?label=Downloads&logo=npm)](https://www.npmjs.com/package/concurrently)
6
- [![CI Status](https://img.shields.io/github/actions/workflow/status/open-cli-tools/concurrently/test.yml?label=CI&logo=github)](https://github.com/open-cli-tools/concurrently/actions/workflows/test.yml)
6
+ [![CI Status](https://img.shields.io/github/actions/workflow/status/open-cli-tools/concurrently/ci.yml?label=CI&logo=github)](https://github.com/open-cli-tools/concurrently/actions/workflows/ci.yml)
7
7
  [![Coverage Status](https://img.shields.io/coveralls/github/open-cli-tools/concurrently/main?label=Coverage&logo=coveralls)](https://coveralls.io/github/open-cli-tools/concurrently?branch=main)
8
8
 
9
9
  Run multiple commands concurrently.
@@ -67,11 +67,18 @@ concurrently 'command1 arg' 'command2 arg'
67
67
  Otherwise **concurrently** would try to run 4 separate commands:
68
68
  `command1`, `arg`, `command2`, `arg`.
69
69
 
70
- In package.json, escape quotes:
71
-
72
- ```bash
73
- "start": "concurrently 'command1 arg' 'command2 arg'"
74
- ```
70
+ > [!IMPORTANT]
71
+ > Windows only supports double quotes:
72
+ >
73
+ > ```bash
74
+ > concurrently "command1 arg" "command2 arg"
75
+ > ```
76
+ >
77
+ > Remember to escape the double quotes in your package.json when using Windows:
78
+ >
79
+ > ```json
80
+ > "start": "concurrently \"command1 arg\" \"command2 arg\""
81
+ > ```
75
82
 
76
83
  You can always check concurrently's flag list by running `concurrently --help`.
77
84
  For the version, run `concurrently --version`.
@@ -90,21 +97,25 @@ Check out documentation and other usage examples in the [`docs` directory](./doc
90
97
  - `options` (optional): an object containing any of the below:
91
98
  - `cwd`: the working directory to be used by all commands. Can be overridden per command.
92
99
  Default: `process.cwd()`.
100
+ - `shell`: shell executable used to run command strings. When unset, uses `npm_config_script_shell` if present (for example when run via `npm run`), otherwise `cmd.exe` on Windows or `/bin/sh` elsewhere. See [shell resolution](./docs/shell-resolution.md).
93
101
  - `defaultInputTarget`: the default input target when reading from `inputStream`.
94
102
  Default: `0`.
95
103
  - `handleInput`: when `true`, reads input from `process.stdin`.
96
- - `inputStream`: a [`Readable` stream](https://nodejs.org/dist/latest-v10.x/docs/api/stream.html#stream_readable_streams)
104
+ - `inputStream`: a [`Readable` stream](https://nodejs.org/docs/latest/api/stream.html#readable-streams)
97
105
  to read the input from. Should only be used in the rare instance you would like to stream anything other than `process.stdin`. Overrides `handleInput`.
98
106
  - `pauseInputStreamOnFinish`: by default, pauses the input stream (`process.stdin` when `handleInput` is enabled, or `inputStream` if provided) when all of the processes have finished. If you need to read from the input stream after `concurrently` has finished, set this to `false`. ([#252](https://github.com/kimmobrunfeldt/concurrently/issues/252)).
99
107
  - `killOthersOn`: once the first command exits with one of these statuses, kill other commands.
100
108
  Can be an array containing the strings `success` (status code zero) and/or `failure` (non-zero exit status).
101
109
  - `maxProcesses`: how many processes should run at once.
102
- - `outputStream`: a [`Writable` stream](https://nodejs.org/dist/latest-v10.x/docs/api/stream.html#stream_writable_streams)
110
+ - `outputStream`: a [`Writable` stream](https://nodejs.org/docs/latest/api/stream.html#writable-streams)
103
111
  to write logs to. Default: `process.stdout`.
104
112
  - `prefix`: the prefix type to use when logging processes output.
105
113
  Possible values: `index`, `pid`, `time`, `command`, `name`, `none`, or a template (eg `[{time} process: {pid}]`).
106
114
  Default: the name of the process, or its index if no name is set.
107
- - `prefixColors`: a list of colors or a string as supported by [chalk](https://www.npmjs.com/package/chalk) and additional style `auto` for an automatically picked color.
115
+ Templates can wrap any portion of the prefix with `{color}` and `{/color}` to restrict coloring to that region (eg `[{color}{name}{/color}]` colors only the name, leaving the brackets uncolored). If either marker is omitted the missing side is implicit, so a template with no markers is colored in full.
116
+ - `prefixColors`: a list of colors or a string as supported by [Chalk](https://www.npmjs.com/package/chalk) and additional style `auto` for an automatically picked color.
117
+ Supports all Chalk color functions: `#RRGGBB`, `bg#RRGGBB`, `hex()`, `bgHex()`, `rgb()`, `bgRgb()`, `ansi256()`, `bgAnsi256()`.
118
+ Functions and modifiers can be chained (e.g., `rgb(255,136,0).bold`, `black.bgHex(#00FF00).dim`).
108
119
  If concurrently would run more commands than there are colors, the last color is repeated, unless if the last color value is `auto` which means following colors are automatically picked to vary.
109
120
  Prefix colors specified per-command take precedence over this list.
110
121
  - `prefixLength`: how many characters to show when prefixing with `command`. Default: `10`
@@ -142,7 +153,7 @@ const { result } = concurrently(
142
153
  ],
143
154
  {
144
155
  prefix: 'name',
145
- killOthers: ['failure', 'success'],
156
+ killOthersOn: ['failure', 'success'],
146
157
  restartTries: 3,
147
158
  cwd: path.resolve(__dirname, 'scripts'),
148
159
  },
@@ -212,18 +223,18 @@ It contains the following properties:
212
223
 
213
224
  ## FAQ
214
225
 
215
- - Process exited with code _null_?
226
+ - Process exited with code `null`?
216
227
 
217
- From [Node child_process documentation](http://nodejs.org/api/child_process.html#child_process_event_exit), `exit` event:
228
+ From [Node child_process documentation](https://nodejs.org/docs/latest/api/child_process.html#event-exit), `exit` event:
218
229
 
219
230
  > This event is emitted after the child process ends. If the process
220
231
  > terminated normally, code is the final exit code of the process,
221
232
  > otherwise null. If the process terminated due to receipt of a signal,
222
233
  > signal is the string name of the signal, otherwise null.
223
234
 
224
- So _null_ means the process didn't terminate normally. This will make **concurrently**
235
+ So `null` means the process didn't terminate normally. This will make **concurrently**
225
236
  to return non-zero exit code too.
226
237
 
227
- - Does this work with the npm-replacements [yarn](https://github.com/yarnpkg/yarn), [pnpm](https://pnpm.js.org/), or [Bun](https://bun.sh/)?
238
+ - Does this work with the npm-replacements [yarn](https://yarnpkg.com/), [pnpm](https://pnpm.io/), or [Bun](https://bun.sh/)?
228
239
 
229
240
  Yes! In all examples above, you may replace "`npm`" with "`yarn`", "`pnpm`", or "`bun`".
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,53 +1,16 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
- if (k2 === undefined) k2 = k;
5
- var desc = Object.getOwnPropertyDescriptor(m, k);
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k]; } };
8
- }
9
- Object.defineProperty(o, k2, desc);
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- o[k2] = m[k];
13
- }));
14
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
- Object.defineProperty(o, "default", { enumerable: true, value: v });
16
- }) : function(o, v) {
17
- o["default"] = v;
18
- });
19
- var __importStar = (this && this.__importStar) || (function () {
20
- var ownKeys = function(o) {
21
- ownKeys = Object.getOwnPropertyNames || function (o) {
22
- var ar = [];
23
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
- return ar;
25
- };
26
- return ownKeys(o);
27
- };
28
- return function (mod) {
29
- if (mod && mod.__esModule) return mod;
30
- var result = {};
31
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
- __setModuleDefault(result, mod);
33
- return result;
34
- };
35
- })();
36
- var __importDefault = (this && this.__importDefault) || function (mod) {
37
- return (mod && mod.__esModule) ? mod : { "default": mod };
38
- };
39
- Object.defineProperty(exports, "__esModule", { value: true });
40
- const yargs_1 = __importDefault(require("yargs"));
41
- const helpers_1 = require("yargs/helpers");
42
- const assert_1 = require("../src/assert");
43
- const defaults = __importStar(require("../src/defaults"));
44
- const index_1 = require("../src/index");
45
- const utils_1 = require("../src/utils");
46
- const read_package_1 = require("./read-package");
47
- const version = String((0, read_package_1.readPackage)().version);
2
+ import process from 'node:process';
3
+ import yargs from 'yargs';
4
+ import { hideBin } from 'yargs/helpers';
5
+ import * as defaults from '../lib/defaults.js';
6
+ import { concurrently } from '../lib/index.js';
7
+ import { castArray, splitOutsideParens } from '../lib/utils.js';
8
+ import { normalizeCliCommand } from './normalize-cli-command.js';
9
+ import { readPackageJson } from './read-package-json.js';
10
+ const version = String(readPackageJson().version);
48
11
  const epilogue = `For documentation and more examples, visit:\nhttps://github.com/open-cli-tools/concurrently/tree/v${version}/docs`;
49
12
  // Clean-up arguments (yargs expects only the arguments after the program name)
50
- const program = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
13
+ const program = yargs(hideBin(process.argv))
51
14
  .parserConfiguration({
52
15
  // Avoids options that can be specified multiple times from requiring a `--` to pass commands
53
16
  'greedy-arrays': false,
@@ -77,11 +40,6 @@ const program = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
77
40
  'Example names: "main,browser,server"',
78
41
  type: 'string',
79
42
  },
80
- 'name-separator': {
81
- describe: 'The character to split <names> on. Example usage:\n' +
82
- '-n "styles|scripts|server" --name-separator "|"',
83
- default: defaults.nameSeparator,
84
- },
85
43
  success: {
86
44
  alias: 's',
87
45
  describe: 'Which command(s) must exit with code 0 in order for concurrently exit with ' +
@@ -102,7 +60,7 @@ const program = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
102
60
  type: 'boolean',
103
61
  },
104
62
  // This one is provided for free. Chalk reads this itself and removes colors.
105
- // https://www.npmjs.com/package/chalk#chalksupportscolor
63
+ // https://www.npmjs.com/package/chalk#supportscolor
106
64
  'no-color': {
107
65
  describe: 'Disables colors from logging',
108
66
  type: 'boolean',
@@ -123,6 +81,10 @@ const program = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
123
81
  type: 'boolean',
124
82
  default: defaults.timings,
125
83
  },
84
+ shell: {
85
+ describe: 'Shell to run commands with. Defaults to cmd.exe on Windows and /bin/sh elsewhere.',
86
+ type: 'string',
87
+ },
126
88
  'passthrough-arguments': {
127
89
  alias: 'P',
128
90
  describe: 'Passthrough additional arguments to commands (accessible via placeholders) ' +
@@ -167,7 +129,7 @@ const program = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
167
129
  },
168
130
  'prefix-colors': {
169
131
  alias: 'c',
170
- describe: 'Comma-separated list of chalk colors to use on prefixes. ' +
132
+ describe: 'Comma-separated list of Chalk colors to use on prefixes. ' +
171
133
  'If there are more commands than colors, the last color will be repeated.\n' +
172
134
  '- Available modifiers: reset, bold, dim, italic, underline, inverse, hidden, strikethrough\n' +
173
135
  '- Available colors: black, red, green, yellow, blue, magenta, cyan, white, gray, \n' +
@@ -221,24 +183,22 @@ const program = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
221
183
  'Can be either the index or the name of the process.',
222
184
  },
223
185
  })
224
- .group(['m', 'n', 'name-separator', 's', 'r', 'no-color', 'hide', 'g', 'timings', 'P', 'teardown'], 'General')
186
+ .group(['m', 'n', 's', 'r', 'no-color', 'hide', 'g', 'timings', 'shell', 'P', 'teardown'], 'General')
225
187
  .group(['p', 'c', 'l', 't', 'pad-prefix'], 'Prefix styling')
226
188
  .group(['i', 'default-input-target'], 'Input handling')
227
189
  .group(['k', 'kill-others-on-fail', 'kill-signal', 'kill-timeout'], 'Killing other processes')
228
190
  .group(['restart-tries', 'restart-after'], 'Restarting')
229
191
  .epilogue(epilogue);
230
192
  const args = program.parseSync();
231
- (0, assert_1.assertDeprecated)(args.nameSeparator === defaults.nameSeparator, 'name-separator', 'Use commas as name separators instead.');
232
- // Get names of commands by the specified separator
233
- const names = (args.names || '').split(args.nameSeparator);
234
- const additionalArguments = (0, utils_1.castArray)(args['--'] ?? []).map(String);
193
+ const names = (args.names || '').split(',');
194
+ const additionalArguments = castArray(args['--'] ?? []).map(String);
235
195
  const commands = args.passthroughArguments ? args._ : args._.concat(additionalArguments);
236
196
  if (!commands.length) {
237
197
  program.showHelp();
238
198
  process.exit();
239
199
  }
240
- (0, index_1.concurrently)(commands.map((command, index) => ({
241
- command: String(command),
200
+ concurrently(commands.map((command, index) => ({
201
+ command: normalizeCliCommand(String(command)),
242
202
  name: names[index],
243
203
  })), {
244
204
  handleInput: args.handleInput,
@@ -255,7 +215,7 @@ if (!commands.length) {
255
215
  hide: args.hide.split(','),
256
216
  group: args.group,
257
217
  prefix: args.prefix,
258
- prefixColors: args.prefixColors.split(','),
218
+ prefixColors: splitOutsideParens(args.prefixColors, ','),
259
219
  prefixLength: args.prefixLength,
260
220
  padPrefix: args.padPrefix,
261
221
  restartDelay: args.restartAfter === 'exponential' ? 'exponential' : Number(args.restartAfter),
@@ -263,6 +223,7 @@ if (!commands.length) {
263
223
  successCondition: args.success,
264
224
  timestampFormat: args.timestampFormat,
265
225
  timings: args.timings,
226
+ shell: args.shell,
266
227
  teardown: args.teardown,
267
228
  additionalArguments: args.passthroughArguments ? additionalArguments : undefined,
268
229
  }).result.then(() => process.exit(0), () => process.exit(1));
@@ -0,0 +1 @@
1
+ export declare function normalizeCliCommand(command: string): string;
@@ -0,0 +1,15 @@
1
+ export function normalizeCliCommand(command) {
2
+ if (command.length < 2) {
3
+ return command;
4
+ }
5
+ const quote = command[0];
6
+ const last = command.at(-1);
7
+ if ((quote !== '"' && quote !== "'") || last !== quote) {
8
+ return command;
9
+ }
10
+ const inner = command.slice(1, -1);
11
+ if (inner.includes(quote)) {
12
+ return command;
13
+ }
14
+ return inner;
15
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Read the package.json file of `concurrently`
3
+ */
4
+ export declare function readPackageJson(): Record<string, unknown>;
@@ -0,0 +1,17 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { createRequire } from 'node:module';
3
+ /**
4
+ * Read the package.json file of `concurrently`
5
+ */
6
+ export function readPackageJson() {
7
+ let resolver;
8
+ try {
9
+ resolver = require.resolve;
10
+ }
11
+ catch {
12
+ resolver = createRequire(import.meta.url).resolve;
13
+ }
14
+ const path = resolver('concurrently/package.json');
15
+ const content = readFileSync(path, 'utf8');
16
+ return JSON.parse(content);
17
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Asserts that some condition is true, and if not, prints a warning about it being deprecated.
3
+ * The message is printed only once.
4
+ */
5
+ export declare function assertDeprecated(check: boolean, name: string, message: string): void;
6
+ /**
7
+ * Asserts that some condition is true, and if not, prints a warning about the runtime not being well supported.
8
+ * The message is printed only once.
9
+ */
10
+ export declare function assertNotRuntime(check: boolean, name: string, message: string): void;
@@ -0,0 +1,24 @@
1
+ const deprecations = new Set();
2
+ /**
3
+ * Asserts that some condition is true, and if not, prints a warning about it being deprecated.
4
+ * The message is printed only once.
5
+ */
6
+ export function assertDeprecated(check, name, message) {
7
+ if (!check && !deprecations.has(name)) {
8
+ // eslint-disable-next-line no-console
9
+ console.warn(`[concurrently] ${name} is deprecated. ${message}`);
10
+ deprecations.add(name);
11
+ }
12
+ }
13
+ const runtimes = new Set();
14
+ /**
15
+ * Asserts that some condition is true, and if not, prints a warning about the runtime not being well supported.
16
+ * The message is printed only once.
17
+ */
18
+ export function assertNotRuntime(check, name, message) {
19
+ if (!check && !runtimes.has(name)) {
20
+ // eslint-disable-next-line no-console
21
+ console.warn(`[concurrently] Running via ${name} is not well supported. ${message}`);
22
+ runtimes.add(name);
23
+ }
24
+ }
@@ -1,5 +1,5 @@
1
- import { CommandInfo } from '../command';
2
- import { CommandParser } from './command-parser';
1
+ import { CommandInfo } from '../command.js';
2
+ import { CommandParser } from './command-parser.js';
3
3
  /**
4
4
  * Replace placeholders with additional arguments.
5
5
  */
@@ -1,34 +1,30 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ExpandArguments = void 0;
4
- const shell_quote_1 = require("shell-quote");
1
+ import { quote } from 'shell-quote';
5
2
  /**
6
3
  * Replace placeholders with additional arguments.
7
4
  */
8
- class ExpandArguments {
5
+ export class ExpandArguments {
9
6
  additionalArguments;
10
7
  constructor(additionalArguments) {
11
8
  this.additionalArguments = additionalArguments;
12
9
  }
13
10
  parse(commandInfo) {
14
- const command = commandInfo.command.replace(/\\?\{([@*]|[1-9][0-9]*)\}/g, (match, placeholderTarget) => {
11
+ const command = commandInfo.command.replace(/\\?\{([@*]|[1-9]\d*)\}/g, (match, placeholderTarget) => {
15
12
  // Don't replace the placeholder if it is escaped by a backslash.
16
13
  if (match.startsWith('\\')) {
17
14
  return match.slice(1);
18
15
  }
19
16
  if (this.additionalArguments.length > 0) {
20
17
  // Replace numeric placeholder if value exists in additional arguments.
21
- if (!isNaN(placeholderTarget) &&
22
- placeholderTarget <= this.additionalArguments.length) {
23
- return (0, shell_quote_1.quote)([this.additionalArguments[placeholderTarget - 1]]);
18
+ if (+placeholderTarget <= this.additionalArguments.length) {
19
+ return quote([this.additionalArguments[+placeholderTarget - 1]]);
24
20
  }
25
21
  // Replace all arguments placeholder.
26
22
  if (placeholderTarget === '@') {
27
- return (0, shell_quote_1.quote)(this.additionalArguments);
23
+ return quote(this.additionalArguments);
28
24
  }
29
25
  // Replace combined arguments placeholder.
30
26
  if (placeholderTarget === '*') {
31
- return (0, shell_quote_1.quote)([this.additionalArguments.join(' ')]);
27
+ return quote([this.additionalArguments.join(' ')]);
32
28
  }
33
29
  }
34
30
  // Replace placeholder with empty string
@@ -38,4 +34,3 @@ class ExpandArguments {
38
34
  return { ...commandInfo, command };
39
35
  }
40
36
  }
41
- exports.ExpandArguments = ExpandArguments;
@@ -1,5 +1,5 @@
1
- import { CommandInfo } from '../command';
2
- import { CommandParser } from './command-parser';
1
+ import { CommandInfo } from '../command.js';
2
+ import { CommandParser } from './command-parser.js';
3
3
  /**
4
4
  * Expands shortcuts according to the following table:
5
5
  *
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ExpandShortcut = void 0;
4
1
  /**
5
2
  * Expands shortcuts according to the following table:
6
3
  *
@@ -13,7 +10,7 @@ exports.ExpandShortcut = void 0;
13
10
  * | `node:<script>` | `node --run <script>` |
14
11
  * | `deno:<script>` | `deno task <script>` |
15
12
  */
16
- class ExpandShortcut {
13
+ export class ExpandShortcut {
17
14
  parse(commandInfo) {
18
15
  const [, prefix, script, args] = /^(npm|yarn|pnpm|bun|node|deno):(\S+)(.*)/.exec(commandInfo.command) || [];
19
16
  if (!script) {
@@ -36,4 +33,3 @@ class ExpandShortcut {
36
33
  };
37
34
  }
38
35
  }
39
- exports.ExpandShortcut = ExpandShortcut;
@@ -1,5 +1,5 @@
1
- import { CommandInfo } from '../command';
2
- import { CommandParser } from './command-parser';
1
+ import { CommandInfo } from '../command.js';
2
+ import { CommandParser } from './command-parser.js';
3
3
  /**
4
4
  * Finds wildcards in 'npm/yarn/pnpm/bun run', 'node --run' and 'deno task'
5
5
  * commands and replaces them with all matching scripts in the NodeJS and Deno
@@ -1,12 +1,6 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ExpandWildcard = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const jsonc_1 = __importDefault(require("../jsonc"));
9
- const utils_1 = require("../utils");
1
+ import fs from 'node:fs';
2
+ import JSONC from '../jsonc.js';
3
+ import { escapeRegExp } from '../utils.js';
10
4
  // Matches a negative filter surrounded by '(!' and ')'.
11
5
  const OMISSION = /\(!([^)]+)\)/;
12
6
  /**
@@ -14,19 +8,19 @@ const OMISSION = /\(!([^)]+)\)/;
14
8
  * commands and replaces them with all matching scripts in the NodeJS and Deno
15
9
  * configuration files of the current directory.
16
10
  */
17
- class ExpandWildcard {
11
+ export class ExpandWildcard {
18
12
  readDeno;
19
13
  readPackage;
20
14
  static readDeno() {
21
15
  try {
22
16
  let json = '{}';
23
- if (fs_1.default.existsSync('deno.json')) {
24
- json = fs_1.default.readFileSync('deno.json', { encoding: 'utf-8' });
17
+ if (fs.existsSync('deno.json')) {
18
+ json = fs.readFileSync('deno.json', { encoding: 'utf-8' });
25
19
  }
26
- else if (fs_1.default.existsSync('deno.jsonc')) {
27
- json = fs_1.default.readFileSync('deno.jsonc', { encoding: 'utf-8' });
20
+ else if (fs.existsSync('deno.jsonc')) {
21
+ json = fs.readFileSync('deno.jsonc', { encoding: 'utf-8' });
28
22
  }
29
- return jsonc_1.default.parse(json);
23
+ return JSONC.parse(json);
30
24
  }
31
25
  catch {
32
26
  return {};
@@ -34,7 +28,7 @@ class ExpandWildcard {
34
28
  }
35
29
  static readPackage() {
36
30
  try {
37
- const json = fs_1.default.readFileSync('package.json', { encoding: 'utf-8' });
31
+ const json = fs.readFileSync('package.json', { encoding: 'utf-8' });
38
32
  return JSON.parse(json);
39
33
  }
40
34
  catch {
@@ -70,7 +64,7 @@ class ExpandWildcard {
70
64
  // - <npm|yarn|pnpm|bun> run <script> [args]
71
65
  // - node --run <script> [args]
72
66
  // - deno task <script> [args]
73
- const [, command, scriptGlob, args] = /((?:npm|yarn|pnpm|bun) (?:run)|node --run|deno task) (\S+)([^&]*)/.exec(commandInfo.command) || [];
67
+ const [, command, scriptGlob, args] = /((?:npm|yarn|pnpm|bun) run|node --run|deno task) (\S+)([^&]*)/.exec(commandInfo.command) || [];
74
68
  const wildcardPosition = (scriptGlob || '').indexOf('*');
75
69
  // If the regex didn't match an npm script, or it has no wildcard,
76
70
  // then we have nothing to do here
@@ -79,30 +73,29 @@ class ExpandWildcard {
79
73
  }
80
74
  const [, omission] = OMISSION.exec(scriptGlob) || [];
81
75
  const scriptGlobSansOmission = scriptGlob.replace(OMISSION, '');
82
- const preWildcard = (0, utils_1.escapeRegExp)(scriptGlobSansOmission.slice(0, wildcardPosition));
83
- const postWildcard = (0, utils_1.escapeRegExp)(scriptGlobSansOmission.slice(wildcardPosition + 1));
76
+ const preWildcard = escapeRegExp(scriptGlobSansOmission.slice(0, wildcardPosition));
77
+ const postWildcard = escapeRegExp(scriptGlobSansOmission.slice(wildcardPosition + 1));
84
78
  const wildcardRegex = new RegExp(`^${preWildcard}(.*?)${postWildcard}$`);
85
79
  // If 'commandInfo.name' doesn't match 'scriptGlob', this means a custom name
86
80
  // has been specified and thus becomes the prefix (as described in the README).
87
81
  const prefix = commandInfo.name !== scriptGlob ? commandInfo.name : '';
88
- return this.relevantScripts(command)
89
- .map((script) => {
90
- if (omission && RegExp(omission).test(script)) {
91
- return;
82
+ const commands = [];
83
+ for (const script of this.relevantScripts(command)) {
84
+ if (omission && new RegExp(omission).test(script)) {
85
+ continue;
92
86
  }
93
87
  const result = wildcardRegex.exec(script);
94
88
  const match = result?.[1];
95
89
  if (match !== undefined) {
96
- return {
90
+ commands.push({
97
91
  ...commandInfo,
98
92
  command: `${command} ${script}${args}`,
99
93
  // Will use an empty command name if no prefix has been specified and
100
94
  // the wildcard match is empty, e.g. if `npm:watch-*` matches `npm run watch-`.
101
95
  name: prefix + match,
102
- };
96
+ });
103
97
  }
104
- })
105
- .filter((commandInfo) => !!commandInfo);
98
+ }
99
+ return commands;
106
100
  }
107
101
  }
108
- exports.ExpandWildcard = ExpandWildcard;
@@ -1,6 +1,7 @@
1
- import { ChildProcess as BaseChildProcess, MessageOptions, SendHandle, SpawnOptions } from 'child_process';
2
- import * as Rx from 'rxjs';
3
- import { EventEmitter, Writable } from 'stream';
1
+ import { Buffer } from 'node:buffer';
2
+ import { ChildProcess as BaseChildProcess, MessageOptions, SendHandle, SpawnOptions } from 'node:child_process';
3
+ import { EventEmitter, Writable } from 'node:stream';
4
+ import Rx from 'rxjs';
4
5
  /**
5
6
  * Identifier for a command; if string, it's the command's name, if number, it's the index.
6
7
  */
@@ -68,7 +69,7 @@ export interface MessageEvent {
68
69
  }
69
70
  interface OutgoingMessageEvent extends MessageEvent {
70
71
  options?: MessageOptions;
71
- onSent(error?: unknown): void;
72
+ onSent: (error?: unknown) => void;
72
73
  }
73
74
  /**
74
75
  * Subtype of NodeJS's child_process including only what's actually needed for a command to work.
@@ -1,41 +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 () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.Command = void 0;
37
- const Rx = __importStar(require("rxjs"));
38
- class Command {
1
+ import process from 'node:process';
2
+ import Rx from 'rxjs';
3
+ export class Command {
39
4
  killProcess;
40
5
  spawn;
41
6
  spawnOpts;
@@ -211,7 +176,6 @@ class Command {
211
176
  return !!command.pid && !!command.process;
212
177
  }
213
178
  }
214
- exports.Command = Command;
215
179
  /**
216
180
  * Pipes all events emitted by `stream` into `subject`.
217
181
  */
@@ -1,5 +1,5 @@
1
- import * as Rx from 'rxjs';
2
- import { CloseEvent, Command } from './command';
1
+ import Rx from 'rxjs';
2
+ import { CloseEvent, Command } from './command.js';
3
3
  /**
4
4
  * Defines which command(s) in a list must exit successfully (with an exit code of `0`):
5
5
  *