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,288 @@
1
+ import fs from 'node:fs';
2
+ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
3
+ import { ExpandWildcard } from './expand-wildcard.js';
4
+ let parser;
5
+ let readPackage;
6
+ let readDeno;
7
+ const createCommandInfo = (command) => ({
8
+ command,
9
+ name: '',
10
+ });
11
+ beforeEach(() => {
12
+ readDeno = vi.fn();
13
+ readPackage = vi.fn();
14
+ parser = new ExpandWildcard(readDeno, readPackage);
15
+ });
16
+ afterEach(() => {
17
+ vi.restoreAllMocks();
18
+ });
19
+ describe('#readDeno()', () => {
20
+ it('can read deno.json', () => {
21
+ const expectedDeno = {
22
+ name: 'deno',
23
+ version: '1.14.0',
24
+ };
25
+ vi.spyOn(fs, 'existsSync').mockImplementation((path) => {
26
+ return path === 'deno.json';
27
+ });
28
+ vi.spyOn(fs, 'readFileSync').mockImplementation((path) => {
29
+ if (path === 'deno.json') {
30
+ return JSON.stringify(expectedDeno);
31
+ }
32
+ return '';
33
+ });
34
+ const actualReadDeno = ExpandWildcard.readDeno();
35
+ expect(actualReadDeno).toEqual(expectedDeno);
36
+ });
37
+ it('can read deno.jsonc', () => {
38
+ const expectedDeno = {
39
+ name: 'deno',
40
+ version: '1.14.0',
41
+ };
42
+ vi.spyOn(fs, 'existsSync').mockImplementation((path) => {
43
+ return path === 'deno.jsonc';
44
+ });
45
+ vi.spyOn(fs, 'readFileSync').mockImplementation((path) => {
46
+ if (path === 'deno.jsonc') {
47
+ return `/* comment */\n${JSON.stringify(expectedDeno)}`;
48
+ }
49
+ return '';
50
+ });
51
+ const actualReadDeno = ExpandWildcard.readDeno();
52
+ expect(actualReadDeno).toEqual(expectedDeno);
53
+ });
54
+ it('prefers deno.json over deno.jsonc', () => {
55
+ const expectedDeno = {
56
+ name: 'deno',
57
+ version: '1.14.0',
58
+ };
59
+ vi.spyOn(fs, 'existsSync').mockImplementation((path) => {
60
+ return path === 'deno.json' || path === 'deno.jsonc';
61
+ });
62
+ vi.spyOn(fs, 'readFileSync').mockImplementation((path) => {
63
+ if (path === 'deno.json') {
64
+ return JSON.stringify(expectedDeno);
65
+ }
66
+ return '';
67
+ });
68
+ const actualReadDeno = ExpandWildcard.readDeno();
69
+ expect(actualReadDeno).toEqual(expectedDeno);
70
+ });
71
+ it('can handle errors reading deno', () => {
72
+ vi.spyOn(fs, 'existsSync').mockReturnValue(true);
73
+ vi.spyOn(fs, 'readFileSync').mockImplementation(() => {
74
+ throw new Error('Error reading deno');
75
+ });
76
+ expect(() => ExpandWildcard.readDeno()).not.toThrow();
77
+ expect(ExpandWildcard.readDeno()).toEqual({});
78
+ });
79
+ });
80
+ describe('#readPackage()', () => {
81
+ it('can read package', () => {
82
+ const expectedPackage = {
83
+ name: 'concurrently',
84
+ version: '6.4.0',
85
+ };
86
+ vi.spyOn(fs, 'readFileSync').mockImplementation((path) => {
87
+ if (path === 'package.json') {
88
+ return JSON.stringify(expectedPackage);
89
+ }
90
+ return '';
91
+ });
92
+ const actualReadPackage = ExpandWildcard.readPackage();
93
+ expect(actualReadPackage).toEqual(expectedPackage);
94
+ });
95
+ it('can handle errors reading package', () => {
96
+ vi.spyOn(fs, 'readFileSync').mockImplementation(() => {
97
+ throw new Error('Error reading package');
98
+ });
99
+ expect(() => ExpandWildcard.readPackage()).not.toThrow();
100
+ expect(ExpandWildcard.readPackage()).toEqual({});
101
+ });
102
+ });
103
+ it('returns same command if not an npm run command', () => {
104
+ const commandInfo = createCommandInfo('npm test');
105
+ expect(readDeno).not.toHaveBeenCalled();
106
+ expect(readPackage).not.toHaveBeenCalled();
107
+ expect(parser.parse(commandInfo)).toBe(commandInfo);
108
+ });
109
+ it('returns same command if not a deno task command', () => {
110
+ const commandInfo = createCommandInfo('deno run');
111
+ expect(readDeno).not.toHaveBeenCalled();
112
+ expect(readPackage).not.toHaveBeenCalled();
113
+ expect(parser.parse(commandInfo)).toBe(commandInfo);
114
+ });
115
+ it('returns same command if no wildcard present', () => {
116
+ const commandInfo = createCommandInfo('npm run foo bar');
117
+ expect(readPackage).not.toHaveBeenCalled();
118
+ expect(parser.parse(commandInfo)).toBe(commandInfo);
119
+ });
120
+ it('expands to nothing if no scripts exist in package.json', () => {
121
+ readPackage.mockReturnValue({});
122
+ expect(parser.parse(createCommandInfo('npm run foo-*-baz qux'))).toEqual([]);
123
+ });
124
+ it('expands to nothing if no tasks exist in Deno config and no scripts exist in NodeJS config', () => {
125
+ readDeno.mockReturnValue({});
126
+ readPackage.mockReturnValue({});
127
+ expect(parser.parse(createCommandInfo('deno task foo-*-baz qux'))).toEqual([]);
128
+ });
129
+ describe.each(['npm run', 'yarn run', 'pnpm run', 'bun run', 'node --run'])(`with a '%s' prefix`, (command) => {
130
+ it('expands to all scripts matching pattern', () => {
131
+ readPackage.mockReturnValue({
132
+ scripts: {
133
+ 'foo-bar-baz': '',
134
+ 'foo--baz': '',
135
+ },
136
+ });
137
+ expect(parser.parse(createCommandInfo(`${command} foo-*-baz qux`))).toEqual([
138
+ { name: 'bar', command: `${command} foo-bar-baz qux` },
139
+ { name: '', command: `${command} foo--baz qux` },
140
+ ]);
141
+ });
142
+ it('uses wildcard match of script as command name', () => {
143
+ readPackage.mockReturnValue({
144
+ scripts: {
145
+ 'watch-js': '',
146
+ 'watch-css': '',
147
+ },
148
+ });
149
+ expect(parser.parse({
150
+ name: 'watch-*',
151
+ command: `${command} watch-*`,
152
+ })).toEqual([
153
+ { name: 'js', command: `${command} watch-js` },
154
+ { name: 'css', command: `${command} watch-css` },
155
+ ]);
156
+ });
157
+ it('uses existing command name as prefix to the wildcard match', () => {
158
+ readPackage.mockReturnValue({
159
+ scripts: {
160
+ 'watch-js': '',
161
+ 'watch-css': '',
162
+ },
163
+ });
164
+ expect(parser.parse({
165
+ name: 'w:',
166
+ command: `${command} watch-*`,
167
+ })).toEqual([
168
+ { name: 'w:js', command: `${command} watch-js` },
169
+ { name: 'w:css', command: `${command} watch-css` },
170
+ ]);
171
+ });
172
+ it('allows negation', () => {
173
+ readPackage.mockReturnValue({
174
+ scripts: {
175
+ 'lint:js': '',
176
+ 'lint:ts': '',
177
+ 'lint:fix:js': '',
178
+ 'lint:fix:ts': '',
179
+ },
180
+ });
181
+ expect(parser.parse(createCommandInfo(`${command} lint:*(!fix)`))).toEqual([
182
+ { name: 'js', command: `${command} lint:js` },
183
+ { name: 'ts', command: `${command} lint:ts` },
184
+ ]);
185
+ });
186
+ it('caches scripts upon calls', () => {
187
+ readPackage.mockReturnValue({});
188
+ parser.parse(createCommandInfo(`${command} foo-*-baz qux`));
189
+ parser.parse(createCommandInfo(`${command} foo-*-baz qux`));
190
+ expect(readPackage).toHaveBeenCalledTimes(1);
191
+ });
192
+ it("doesn't read Deno config", () => {
193
+ readPackage.mockReturnValue({});
194
+ parser.parse(createCommandInfo(`${command} foo-*-baz qux`));
195
+ expect(readDeno).not.toHaveBeenCalled();
196
+ });
197
+ });
198
+ describe(`with a 'deno task' prefix`, () => {
199
+ it('expands to all scripts matching pattern', () => {
200
+ readDeno.mockReturnValue({
201
+ tasks: {
202
+ 'foo-bar-baz': '',
203
+ 'foo--baz': '',
204
+ },
205
+ });
206
+ readPackage.mockReturnValue({
207
+ scripts: {
208
+ 'foo-foo-baz': '',
209
+ },
210
+ });
211
+ expect(parser.parse(createCommandInfo(`deno task foo-*-baz qux`))).toEqual([
212
+ { name: 'bar', command: `deno task foo-bar-baz qux` },
213
+ { name: '', command: `deno task foo--baz qux` },
214
+ { name: 'foo', command: `deno task foo-foo-baz qux` },
215
+ ]);
216
+ });
217
+ it('uses wildcard match of script as command name', () => {
218
+ readDeno.mockReturnValue({
219
+ tasks: {
220
+ 'watch-sass': '',
221
+ },
222
+ });
223
+ readPackage.mockReturnValue({
224
+ scripts: {
225
+ 'watch-js': '',
226
+ 'watch-css': '',
227
+ },
228
+ });
229
+ expect(parser.parse({
230
+ name: '',
231
+ command: `deno task watch-*`,
232
+ })).toEqual([
233
+ { name: 'sass', command: `deno task watch-sass` },
234
+ { name: 'js', command: `deno task watch-js` },
235
+ { name: 'css', command: `deno task watch-css` },
236
+ ]);
237
+ });
238
+ it('uses existing command name as prefix to the wildcard match', () => {
239
+ readDeno.mockReturnValue({
240
+ tasks: {
241
+ 'watch-sass': '',
242
+ },
243
+ });
244
+ readPackage.mockReturnValue({
245
+ scripts: {
246
+ 'watch-js': '',
247
+ 'watch-css': '',
248
+ },
249
+ });
250
+ expect(parser.parse({
251
+ name: 'w:',
252
+ command: `deno task watch-*`,
253
+ })).toEqual([
254
+ { name: 'w:sass', command: `deno task watch-sass` },
255
+ { name: 'w:js', command: `deno task watch-js` },
256
+ { name: 'w:css', command: `deno task watch-css` },
257
+ ]);
258
+ });
259
+ it('allows negation', () => {
260
+ readDeno.mockReturnValue({
261
+ tasks: {
262
+ 'lint:sass': '',
263
+ 'lint:fix:sass': '',
264
+ },
265
+ });
266
+ readPackage.mockReturnValue({
267
+ scripts: {
268
+ 'lint:js': '',
269
+ 'lint:ts': '',
270
+ 'lint:fix:js': '',
271
+ 'lint:fix:ts': '',
272
+ },
273
+ });
274
+ expect(parser.parse(createCommandInfo(`deno task lint:*(!fix)`))).toEqual([
275
+ { name: 'sass', command: `deno task lint:sass` },
276
+ { name: 'js', command: `deno task lint:js` },
277
+ { name: 'ts', command: `deno task lint:ts` },
278
+ ]);
279
+ });
280
+ it('caches scripts upon calls', () => {
281
+ readDeno.mockReturnValue({});
282
+ readPackage.mockReturnValue({});
283
+ parser.parse(createCommandInfo(`deno task foo-*-baz qux`));
284
+ parser.parse(createCommandInfo(`deno task foo-*-baz qux`));
285
+ expect(readDeno).toHaveBeenCalledTimes(1);
286
+ expect(readPackage).toHaveBeenCalledTimes(1);
287
+ });
288
+ });
@@ -1,10 +1,7 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- /// <reference types="node" />
4
- /// <reference types="node" />
5
- import { ChildProcess as BaseChildProcess, MessageOptions, SendHandle, SpawnOptions } from 'child_process';
6
- import * as Rx from 'rxjs';
7
- 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';
8
5
  /**
9
6
  * Identifier for a command; if string, it's the command's name, if number, it's the index.
10
7
  */
@@ -72,7 +69,7 @@ export interface MessageEvent {
72
69
  }
73
70
  interface OutgoingMessageEvent extends MessageEvent {
74
71
  options?: MessageOptions;
75
- onSent(error?: unknown): void;
72
+ onSent: (error?: unknown) => void;
76
73
  }
77
74
  /**
78
75
  * Subtype of NodeJS's child_process including only what's actually needed for a command to work.
@@ -114,8 +111,8 @@ export declare class Command implements CommandInfo {
114
111
  readonly ipc?: number;
115
112
  readonly close: Rx.Subject<CloseEvent>;
116
113
  readonly error: Rx.Subject<unknown>;
117
- readonly stdout: Rx.Subject<Buffer>;
118
- readonly stderr: Rx.Subject<Buffer>;
114
+ readonly stdout: Rx.Subject<Buffer<ArrayBufferLike>>;
115
+ readonly stderr: Rx.Subject<Buffer<ArrayBufferLike>>;
119
116
  readonly timer: Rx.Subject<TimerEvent>;
120
117
  /**
121
118
  * A stream of changes to the `#state` property.
@@ -1,31 +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.Command = void 0;
27
- const Rx = __importStar(require("rxjs"));
28
- class Command {
1
+ import process from 'node:process';
2
+ import Rx from 'rxjs';
3
+ export class Command {
29
4
  killProcess;
30
5
  spawn;
31
6
  spawnOpts;
@@ -120,10 +95,12 @@ class Command {
120
95
  },
121
96
  });
122
97
  });
123
- child.stdout &&
98
+ if (child.stdout) {
124
99
  pipeTo(Rx.fromEvent(child.stdout, 'data').pipe(Rx.map((event) => event)), this.stdout);
125
- child.stderr &&
100
+ }
101
+ if (child.stderr) {
126
102
  pipeTo(Rx.fromEvent(child.stderr, 'data').pipe(Rx.map((event) => event)), this.stderr);
103
+ }
127
104
  this.stdin = child.stdin || undefined;
128
105
  }
129
106
  changeState(state) {
@@ -166,7 +143,12 @@ class Command {
166
143
  handle,
167
144
  options,
168
145
  onSent(error) {
169
- error ? reject(error) : resolve();
146
+ if (error) {
147
+ reject(error);
148
+ }
149
+ else {
150
+ resolve();
151
+ }
170
152
  },
171
153
  });
172
154
  });
@@ -194,7 +176,6 @@ class Command {
194
176
  return !!command.pid && !!command.process;
195
177
  }
196
178
  }
197
- exports.Command = Command;
198
179
  /**
199
180
  * Pipes all events emitted by `stream` into `subject`.
200
181
  */
@@ -0,0 +1 @@
1
+ export {};