nx 21.0.0-beta.1 → 21.0.0-canary.20250206-8bd0bcd

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 (31) hide show
  1. package/package.json +11 -12
  2. package/src/command-line/graph/graph.js +0 -2
  3. package/src/commands-runner/get-command-projects.js +2 -17
  4. package/src/config/task-graph.d.ts +0 -5
  5. package/src/config/workspace-json-project-json.d.ts +0 -4
  6. package/src/executors/run-commands/run-commands.impl.d.ts +13 -16
  7. package/src/executors/run-commands/run-commands.impl.js +263 -24
  8. package/src/native/index.d.ts +0 -1
  9. package/src/native/nx.wasm32-wasi.wasm +0 -0
  10. package/src/tasks-runner/create-task-graph.d.ts +0 -3
  11. package/src/tasks-runner/create-task-graph.js +5 -36
  12. package/src/tasks-runner/forked-process-task-runner.d.ts +12 -6
  13. package/src/tasks-runner/forked-process-task-runner.js +263 -110
  14. package/src/tasks-runner/init-tasks-runner.js +0 -4
  15. package/src/tasks-runner/pseudo-terminal.d.ts +1 -7
  16. package/src/tasks-runner/pseudo-terminal.js +12 -26
  17. package/src/tasks-runner/task-orchestrator.d.ts +1 -7
  18. package/src/tasks-runner/task-orchestrator.js +82 -137
  19. package/src/tasks-runner/tasks-schedule.js +1 -5
  20. package/src/tasks-runner/utils.d.ts +8 -0
  21. package/src/tasks-runner/utils.js +4 -12
  22. package/src/executors/run-commands/running-tasks.d.ts +0 -38
  23. package/src/executors/run-commands/running-tasks.js +0 -349
  24. package/src/tasks-runner/running-tasks/batch-process.d.ts +0 -14
  25. package/src/tasks-runner/running-tasks/batch-process.js +0 -70
  26. package/src/tasks-runner/running-tasks/node-child-process.d.ts +0 -36
  27. package/src/tasks-runner/running-tasks/node-child-process.js +0 -184
  28. package/src/tasks-runner/running-tasks/noop-child-process.d.ts +0 -15
  29. package/src/tasks-runner/running-tasks/noop-child-process.js +0 -19
  30. package/src/tasks-runner/running-tasks/running-task.d.ts +0 -8
  31. package/src/tasks-runner/running-tasks/running-task.js +0 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "21.0.0-beta.1",
3
+ "version": "21.0.0-canary.20250206-8bd0bcd",
4
4
  "private": false,
5
5
  "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
6
6
  "repository": {
@@ -63,7 +63,6 @@
63
63
  "string-width": "^4.2.3",
64
64
  "tar-stream": "~2.2.0",
65
65
  "tmp": "~0.2.1",
66
- "tree-kill": "^1.2.2",
67
66
  "tsconfig-paths": "^4.1.2",
68
67
  "tslib": "^2.3.0",
69
68
  "yaml": "^2.6.0",
@@ -83,16 +82,16 @@
83
82
  }
84
83
  },
85
84
  "optionalDependencies": {
86
- "@nx/nx-darwin-arm64": "21.0.0-beta.1",
87
- "@nx/nx-darwin-x64": "21.0.0-beta.1",
88
- "@nx/nx-freebsd-x64": "21.0.0-beta.1",
89
- "@nx/nx-linux-arm-gnueabihf": "21.0.0-beta.1",
90
- "@nx/nx-linux-arm64-gnu": "21.0.0-beta.1",
91
- "@nx/nx-linux-arm64-musl": "21.0.0-beta.1",
92
- "@nx/nx-linux-x64-gnu": "21.0.0-beta.1",
93
- "@nx/nx-linux-x64-musl": "21.0.0-beta.1",
94
- "@nx/nx-win32-arm64-msvc": "21.0.0-beta.1",
95
- "@nx/nx-win32-x64-msvc": "21.0.0-beta.1"
85
+ "@nx/nx-darwin-arm64": "21.0.0-canary.20250206-8bd0bcd",
86
+ "@nx/nx-darwin-x64": "21.0.0-canary.20250206-8bd0bcd",
87
+ "@nx/nx-freebsd-x64": "21.0.0-canary.20250206-8bd0bcd",
88
+ "@nx/nx-linux-arm-gnueabihf": "21.0.0-canary.20250206-8bd0bcd",
89
+ "@nx/nx-linux-arm64-gnu": "21.0.0-canary.20250206-8bd0bcd",
90
+ "@nx/nx-linux-arm64-musl": "21.0.0-canary.20250206-8bd0bcd",
91
+ "@nx/nx-linux-x64-gnu": "21.0.0-canary.20250206-8bd0bcd",
92
+ "@nx/nx-linux-x64-musl": "21.0.0-canary.20250206-8bd0bcd",
93
+ "@nx/nx-win32-arm64-msvc": "21.0.0-canary.20250206-8bd0bcd",
94
+ "@nx/nx-win32-x64-msvc": "21.0.0-canary.20250206-8bd0bcd"
96
95
  },
97
96
  "nx-migrations": {
98
97
  "migrations": "./migrations.json",
@@ -629,7 +629,6 @@ function getAllTaskGraphsForWorkspace(projectGraph) {
629
629
  taskGraphs[taskId] = {
630
630
  tasks: {},
631
631
  dependencies: {},
632
- continuousDependencies: {},
633
632
  roots: [],
634
633
  };
635
634
  taskGraphErrors[taskId] = err.message;
@@ -645,7 +644,6 @@ function getAllTaskGraphsForWorkspace(projectGraph) {
645
644
  taskGraphs[taskId] = {
646
645
  tasks: {},
647
646
  dependencies: {},
648
- continuousDependencies: {},
649
647
  roots: [],
650
648
  };
651
649
  taskGraphErrors[taskId] = err.message;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getCommandProjects = getCommandProjects;
4
+ const utils_1 = require("../tasks-runner/utils");
4
5
  const create_command_graph_1 = require("./create-command-graph");
5
6
  function getCommandProjects(projectGraph, projects, nxArgs) {
6
7
  const commandGraph = (0, create_command_graph_1.createCommandGraph)(projectGraph, projects.map((project) => project.name), nxArgs);
@@ -12,22 +13,6 @@ function getSortedProjects(commandGraph, sortedProjects = []) {
12
13
  return sortedProjects;
13
14
  }
14
15
  sortedProjects.push(...roots);
15
- const newGraph = removeIdsFromGraph(commandGraph, roots, commandGraph.dependencies);
16
+ const newGraph = (0, utils_1.removeIdsFromGraph)(commandGraph, roots, commandGraph.dependencies);
16
17
  return getSortedProjects(newGraph, sortedProjects);
17
18
  }
18
- function removeIdsFromGraph(graph, ids, mapWithIds) {
19
- const filteredMapWithIds = {};
20
- const dependencies = {};
21
- const removedSet = new Set(ids);
22
- for (let id of Object.keys(mapWithIds)) {
23
- if (!removedSet.has(id)) {
24
- filteredMapWithIds[id] = mapWithIds[id];
25
- dependencies[id] = graph.dependencies[id].filter((depId) => !removedSet.has(depId));
26
- }
27
- }
28
- return {
29
- mapWithIds: filteredMapWithIds,
30
- dependencies: dependencies,
31
- roots: Object.keys(dependencies).filter((k) => dependencies[k].length === 0),
32
- };
33
- }
@@ -84,10 +84,6 @@ export interface Task {
84
84
  * Determines if a given task should be parallelizable.
85
85
  */
86
86
  parallelism: boolean;
87
- /**
88
- * This denotes if the task runs continuously
89
- */
90
- continuous?: boolean;
91
87
  }
92
88
  /**
93
89
  * Graph of Tasks to be executed
@@ -105,5 +101,4 @@ export interface TaskGraph {
105
101
  * Map of Task IDs to IDs of tasks which the task depends on
106
102
  */
107
103
  dependencies: Record<string, string[]>;
108
- continuousDependencies: Record<string, string[]>;
109
104
  }
@@ -238,10 +238,6 @@ export interface TargetConfiguration<T = any> {
238
238
  * Default is true
239
239
  */
240
240
  parallelism?: boolean;
241
- /**
242
- * Whether this target runs continuously
243
- */
244
- continuous?: boolean;
245
241
  /**
246
242
  * List of generators to run before the target to ensure the workspace
247
243
  * is up to date.
@@ -1,25 +1,23 @@
1
1
  import { ExecutorContext } from '../../config/misc-interfaces';
2
- import { ParallelRunningTasks, SeriallyRunningTasks } from './running-tasks';
3
2
  export declare const LARGE_BUFFER: number;
4
3
  export type Json = {
5
4
  [k: string]: any;
6
5
  };
7
- export interface RunCommandsCommandOptions {
8
- command: string;
9
- forwardAllArgs?: boolean;
10
- /**
11
- * description was added to allow users to document their commands inline,
12
- * it is not intended to be used as part of the execution of the command.
13
- */
14
- description?: string;
15
- prefix?: string;
16
- prefixColor?: string;
17
- color?: string;
18
- bgColor?: string;
19
- }
20
6
  export interface RunCommandsOptions extends Json {
21
7
  command?: string | string[];
22
- commands?: Array<RunCommandsCommandOptions | string>;
8
+ commands?: ({
9
+ command: string;
10
+ forwardAllArgs?: boolean;
11
+ /**
12
+ * description was added to allow users to document their commands inline,
13
+ * it is not intended to be used as part of the execution of the command.
14
+ */
15
+ description?: string;
16
+ prefix?: string;
17
+ prefixColor?: string;
18
+ color?: string;
19
+ bgColor?: string;
20
+ } | string)[];
23
21
  color?: boolean;
24
22
  parallel?: boolean;
25
23
  readyWhen?: string | string[];
@@ -57,5 +55,4 @@ export default function (options: RunCommandsOptions, context: ExecutorContext):
57
55
  success: boolean;
58
56
  terminalOutput: string;
59
57
  }>;
60
- export declare function runCommands(options: RunCommandsOptions, context: ExecutorContext): Promise<ParallelRunningTasks | SeriallyRunningTasks>;
61
58
  export declare function interpolateArgsIntoCommand(command: string, opts: Pick<NormalizedRunCommandsOptions, 'args' | 'parsedArgs' | '__unparsed__' | 'unknownOptions' | 'unparsedCommandArgs'>, forwardAllArgs: boolean): string;
@@ -2,13 +2,25 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LARGE_BUFFER = void 0;
4
4
  exports.default = default_1;
5
- exports.runCommands = runCommands;
6
5
  exports.interpolateArgsIntoCommand = interpolateArgsIntoCommand;
6
+ const child_process_1 = require("child_process");
7
+ const path = require("path");
7
8
  const yargsParser = require("yargs-parser");
9
+ const npm_run_path_1 = require("npm-run-path");
10
+ const chalk = require("chalk");
8
11
  const pseudo_terminal_1 = require("../../tasks-runner/pseudo-terminal");
9
12
  const exit_codes_1 = require("../../utils/exit-codes");
10
- const running_tasks_1 = require("./running-tasks");
13
+ const task_env_1 = require("../../tasks-runner/task-env");
11
14
  exports.LARGE_BUFFER = 1024 * 1000000;
15
+ let pseudoTerminal;
16
+ const childProcesses = new Set();
17
+ function loadEnvVarsFile(path, env = {}) {
18
+ (0, task_env_1.unloadDotEnvFile)(path, env);
19
+ const result = (0, task_env_1.loadAndExpandDotEnvFile)(path, env);
20
+ if (result.error) {
21
+ throw result.error;
22
+ }
23
+ }
12
24
  const propKeys = [
13
25
  'command',
14
26
  'commands',
@@ -29,14 +41,7 @@ const propKeys = [
29
41
  'tty',
30
42
  ];
31
43
  async function default_1(options, context) {
32
- const task = await runCommands(options, context);
33
- const results = await task.getResults();
34
- return {
35
- ...results,
36
- success: results.code === 0,
37
- };
38
- }
39
- async function runCommands(options, context) {
44
+ registerProcessListener();
40
45
  const normalized = normalizeOptions(options);
41
46
  if (normalized.readyWhenStatus.length && !normalized.parallel) {
42
47
  throw new Error('ERROR: Bad executor config for run-commands - "readyWhen" can only be used when "parallel=true".');
@@ -45,15 +50,11 @@ async function runCommands(options, context) {
45
50
  !options.parallel) {
46
51
  throw new Error('ERROR: Bad executor config for run-commands - "prefix", "prefixColor", "color" and "bgColor" can only be set when "parallel=true".');
47
52
  }
48
- const pseudoTerminal = !options.parallel && pseudo_terminal_1.PseudoTerminal.isSupported()
49
- ? (0, pseudo_terminal_1.getPseudoTerminal)()
50
- : null;
51
53
  try {
52
- const runningTask = options.parallel
53
- ? new running_tasks_1.ParallelRunningTasks(normalized, context)
54
- : new running_tasks_1.SeriallyRunningTasks(normalized, context, pseudoTerminal);
55
- registerProcessListener(runningTask, pseudoTerminal);
56
- return runningTask;
54
+ const result = options.parallel
55
+ ? await runInParallel(normalized, context)
56
+ : await runSerially(normalized, context);
57
+ return result;
57
58
  }
58
59
  catch (e) {
59
60
  if (process.env.NX_VERBOSE_LOGGING === 'true') {
@@ -62,6 +63,52 @@ async function runCommands(options, context) {
62
63
  throw new Error(`ERROR: Something went wrong in run-commands - ${e.message}`);
63
64
  }
64
65
  }
66
+ async function runInParallel(options, context) {
67
+ const procs = options.commands.map((c) => createProcess(null, c, options.readyWhenStatus, options.color, calculateCwd(options.cwd, context), options.env ?? {}, true, options.usePty, options.streamOutput, options.tty, options.envFile).then((result) => ({
68
+ result,
69
+ command: c.command,
70
+ })));
71
+ let terminalOutput = '';
72
+ if (options.readyWhenStatus.length) {
73
+ const r = await Promise.race(procs);
74
+ terminalOutput += r.result.terminalOutput;
75
+ if (!r.result.success) {
76
+ const output = `Warning: command "${r.command}" exited with non-zero status code`;
77
+ terminalOutput += output;
78
+ if (options.streamOutput) {
79
+ process.stderr.write(output);
80
+ }
81
+ return { success: false, terminalOutput };
82
+ }
83
+ else {
84
+ return { success: true, terminalOutput };
85
+ }
86
+ }
87
+ else {
88
+ const r = await Promise.all(procs);
89
+ terminalOutput += r.map((f) => f.result.terminalOutput).join('');
90
+ const failed = r.filter((v) => !v.result.success);
91
+ if (failed.length > 0) {
92
+ const output = failed
93
+ .map((f) => `Warning: command "${f.command}" exited with non-zero status code`)
94
+ .join('\r\n');
95
+ terminalOutput += output;
96
+ if (options.streamOutput) {
97
+ process.stderr.write(output);
98
+ }
99
+ return {
100
+ success: false,
101
+ terminalOutput,
102
+ };
103
+ }
104
+ else {
105
+ return {
106
+ success: true,
107
+ terminalOutput,
108
+ };
109
+ }
110
+ }
111
+ }
65
112
  function normalizeOptions(options) {
66
113
  if (options.readyWhen && typeof options.readyWhen === 'string') {
67
114
  options.readyWhenStatus = [
@@ -109,6 +156,167 @@ function normalizeOptions(options) {
109
156
  });
110
157
  return options;
111
158
  }
159
+ async function runSerially(options, context) {
160
+ pseudoTerminal ??= pseudo_terminal_1.PseudoTerminal.isSupported() ? (0, pseudo_terminal_1.getPseudoTerminal)() : null;
161
+ let terminalOutput = '';
162
+ for (const c of options.commands) {
163
+ const result = await createProcess(pseudoTerminal, c, [], options.color, calculateCwd(options.cwd, context), options.processEnv ?? options.env ?? {}, false, options.usePty, options.streamOutput, options.tty, options.envFile);
164
+ terminalOutput += result.terminalOutput;
165
+ if (!result.success) {
166
+ const output = `Warning: command "${c.command}" exited with non-zero status code`;
167
+ result.terminalOutput += output;
168
+ if (options.streamOutput) {
169
+ process.stderr.write(output);
170
+ }
171
+ return { success: false, terminalOutput };
172
+ }
173
+ }
174
+ return { success: true, terminalOutput };
175
+ }
176
+ async function createProcess(pseudoTerminal, commandConfig, readyWhenStatus = [], color, cwd, env, isParallel, usePty = true, streamOutput = true, tty, envFile) {
177
+ env = processEnv(color, cwd, env, envFile);
178
+ // The rust runCommand is always a tty, so it will not look nice in parallel and if we need prefixes
179
+ // currently does not work properly in windows
180
+ if (pseudoTerminal &&
181
+ process.env.NX_NATIVE_COMMAND_RUNNER !== 'false' &&
182
+ !commandConfig.prefix &&
183
+ readyWhenStatus.length === 0 &&
184
+ !isParallel &&
185
+ usePty) {
186
+ let terminalOutput = chalk.dim('> ') + commandConfig.command + '\r\n\r\n';
187
+ if (streamOutput) {
188
+ process.stdout.write(terminalOutput);
189
+ }
190
+ const cp = pseudoTerminal.runCommand(commandConfig.command, {
191
+ cwd,
192
+ jsEnv: env,
193
+ quiet: !streamOutput,
194
+ tty,
195
+ });
196
+ childProcesses.add(cp);
197
+ return new Promise((res) => {
198
+ cp.onOutput((output) => {
199
+ terminalOutput += output;
200
+ });
201
+ cp.onExit((code) => {
202
+ if (code >= 128) {
203
+ process.exit(code);
204
+ }
205
+ else {
206
+ res({ success: code === 0, terminalOutput });
207
+ }
208
+ });
209
+ });
210
+ }
211
+ return nodeProcess(commandConfig, cwd, env, readyWhenStatus, streamOutput);
212
+ }
213
+ function nodeProcess(commandConfig, cwd, env, readyWhenStatus, streamOutput = true) {
214
+ let terminalOutput = chalk.dim('> ') + commandConfig.command + '\r\n\r\n';
215
+ if (streamOutput) {
216
+ process.stdout.write(terminalOutput);
217
+ }
218
+ return new Promise((res) => {
219
+ const childProcess = (0, child_process_1.exec)(commandConfig.command, {
220
+ maxBuffer: exports.LARGE_BUFFER,
221
+ env,
222
+ cwd,
223
+ windowsHide: false,
224
+ });
225
+ childProcesses.add(childProcess);
226
+ childProcess.stdout.on('data', (data) => {
227
+ const output = addColorAndPrefix(data, commandConfig);
228
+ terminalOutput += output;
229
+ if (streamOutput) {
230
+ process.stdout.write(output);
231
+ }
232
+ if (readyWhenStatus.length && isReady(readyWhenStatus, data.toString())) {
233
+ res({ success: true, terminalOutput });
234
+ }
235
+ });
236
+ childProcess.stderr.on('data', (err) => {
237
+ const output = addColorAndPrefix(err, commandConfig);
238
+ terminalOutput += output;
239
+ if (streamOutput) {
240
+ process.stderr.write(output);
241
+ }
242
+ if (readyWhenStatus.length && isReady(readyWhenStatus, err.toString())) {
243
+ res({ success: true, terminalOutput });
244
+ }
245
+ });
246
+ childProcess.on('error', (err) => {
247
+ const ouptput = addColorAndPrefix(err.toString(), commandConfig);
248
+ terminalOutput += ouptput;
249
+ if (streamOutput) {
250
+ process.stderr.write(ouptput);
251
+ }
252
+ res({ success: false, terminalOutput });
253
+ });
254
+ childProcess.on('exit', (code) => {
255
+ childProcesses.delete(childProcess);
256
+ if (!readyWhenStatus.length || isReady(readyWhenStatus)) {
257
+ res({ success: code === 0, terminalOutput });
258
+ }
259
+ });
260
+ });
261
+ }
262
+ function addColorAndPrefix(out, config) {
263
+ if (config.prefix) {
264
+ out = out
265
+ .split('\n')
266
+ .map((l) => {
267
+ let prefixText = config.prefix;
268
+ if (config.prefixColor && chalk[config.prefixColor]) {
269
+ prefixText = chalk[config.prefixColor](prefixText);
270
+ }
271
+ prefixText = chalk.bold(prefixText);
272
+ return l.trim().length > 0 ? `${prefixText} ${l}` : l;
273
+ })
274
+ .join('\n');
275
+ }
276
+ if (config.color && chalk[config.color]) {
277
+ out = chalk[config.color](out);
278
+ }
279
+ if (config.bgColor && chalk[config.bgColor]) {
280
+ out = chalk[config.bgColor](out);
281
+ }
282
+ return out;
283
+ }
284
+ function calculateCwd(cwd, context) {
285
+ if (!cwd)
286
+ return context.root;
287
+ if (path.isAbsolute(cwd))
288
+ return cwd;
289
+ return path.join(context.root, cwd);
290
+ }
291
+ /**
292
+ * Env variables are processed in the following order:
293
+ * - env option from executor options
294
+ * - env file from envFile option if provided
295
+ * - local env variables
296
+ */
297
+ function processEnv(color, cwd, envOptionFromExecutor, envFile) {
298
+ let localEnv = (0, npm_run_path_1.env)({ cwd: cwd ?? process.cwd() });
299
+ localEnv = {
300
+ ...process.env,
301
+ ...localEnv,
302
+ };
303
+ if (process.env.NX_LOAD_DOT_ENV_FILES !== 'false' && envFile) {
304
+ loadEnvVarsFile(envFile, localEnv);
305
+ }
306
+ let res = {
307
+ ...localEnv,
308
+ ...envOptionFromExecutor,
309
+ };
310
+ // need to override PATH to make sure we are using the local node_modules
311
+ if (localEnv.PATH)
312
+ res.PATH = localEnv.PATH; // UNIX-like
313
+ if (localEnv.Path)
314
+ res.Path = localEnv.Path; // Windows
315
+ if (color) {
316
+ res.FORCE_COLOR = `${color}`;
317
+ }
318
+ return res;
319
+ }
112
320
  function interpolateArgsIntoCommand(command, opts, forwardAllArgs) {
113
321
  if (command.indexOf('{args.') > -1) {
114
322
  const regex = /{args\.([^}]+)}/g;
@@ -196,7 +404,7 @@ function filterPropKeysFromUnParsedOptions(__unparsed__, parseArgs = {}) {
196
404
  return parsedOptions;
197
405
  }
198
406
  let registered = false;
199
- function registerProcessListener(runningTask, pseudoTerminal) {
407
+ function registerProcessListener() {
200
408
  if (registered) {
201
409
  return;
202
410
  }
@@ -207,24 +415,44 @@ function registerProcessListener(runningTask, pseudoTerminal) {
207
415
  if (pseudoTerminal) {
208
416
  pseudoTerminal.sendMessageToChildren(message);
209
417
  }
210
- runningTask.send(message);
418
+ childProcesses.forEach((p) => {
419
+ if ('connected' in p && p.connected) {
420
+ p.send(message);
421
+ }
422
+ });
211
423
  });
212
424
  // Terminate any task processes on exit
213
425
  process.on('exit', () => {
214
- runningTask.kill();
426
+ childProcesses.forEach((p) => {
427
+ if ('connected' in p ? p.connected : p.isAlive) {
428
+ p.kill();
429
+ }
430
+ });
215
431
  });
216
432
  process.on('SIGINT', () => {
217
- runningTask.kill('SIGTERM');
433
+ childProcesses.forEach((p) => {
434
+ if ('connected' in p ? p.connected : p.isAlive) {
435
+ p.kill('SIGTERM');
436
+ }
437
+ });
218
438
  // we exit here because we don't need to write anything to cache.
219
439
  process.exit((0, exit_codes_1.signalToCode)('SIGINT'));
220
440
  });
221
441
  process.on('SIGTERM', () => {
222
- runningTask.kill('SIGTERM');
442
+ childProcesses.forEach((p) => {
443
+ if ('connected' in p ? p.connected : p.isAlive) {
444
+ p.kill('SIGTERM');
445
+ }
446
+ });
223
447
  // no exit here because we expect child processes to terminate which
224
448
  // will store results to the cache and will terminate this process
225
449
  });
226
450
  process.on('SIGHUP', () => {
227
- runningTask.kill('SIGTERM');
451
+ childProcesses.forEach((p) => {
452
+ if ('connected' in p ? p.connected : p.isAlive) {
453
+ p.kill('SIGTERM');
454
+ }
455
+ });
228
456
  // no exit here because we expect child processes to terminate which
229
457
  // will store results to the cache and will terminate this process
230
458
  });
@@ -246,3 +474,14 @@ function wrapArgIntoQuotesIfNeeded(arg) {
246
474
  return arg;
247
475
  }
248
476
  }
477
+ function isReady(readyWhenStatus = [], data) {
478
+ if (data) {
479
+ for (const readyWhenElement of readyWhenStatus) {
480
+ if (data.toString().indexOf(readyWhenElement.stringToMatch) > -1) {
481
+ readyWhenElement.found = true;
482
+ break;
483
+ }
484
+ }
485
+ }
486
+ return readyWhenStatus.every((readyWhenElement) => readyWhenElement.found);
487
+ }
@@ -11,7 +11,6 @@ export declare class ChildProcess {
11
11
  kill(): void
12
12
  onExit(callback: (message: string) => void): void
13
13
  onOutput(callback: (message: string) => void): void
14
- cleanup(): void
15
14
  }
16
15
 
17
16
  export declare class FileLock {
Binary file
@@ -11,9 +11,6 @@ export declare class ProcessTasks {
11
11
  readonly dependencies: {
12
12
  [k: string]: string[];
13
13
  };
14
- readonly continuousDependencies: {
15
- [k: string]: string[];
16
- };
17
14
  private readonly allTargetNames;
18
15
  constructor(extraTargetDependencies: TargetDependencies, projectGraph: ProjectGraph);
19
16
  processTasks(projectNames: string[], targets: string[], configuration: string, overrides: Object, excludeTaskDependencies: boolean): string[];
@@ -17,7 +17,6 @@ class ProcessTasks {
17
17
  this.seen = new Set();
18
18
  this.tasks = {};
19
19
  this.dependencies = {};
20
- this.continuousDependencies = {};
21
20
  const allTargetNames = new Set();
22
21
  for (const projectName in projectGraph.nodes) {
23
22
  const project = projectGraph.nodes[projectName];
@@ -37,7 +36,6 @@ class ProcessTasks {
37
36
  const task = this.createTask(id, project, target, resolvedConfiguration, overrides);
38
37
  this.tasks[task.id] = task;
39
38
  this.dependencies[task.id] = [];
40
- this.continuousDependencies[task.id] = [];
41
39
  }
42
40
  }
43
41
  }
@@ -52,15 +50,11 @@ class ProcessTasks {
52
50
  if (!initialTasks[t]) {
53
51
  delete this.tasks[t];
54
52
  delete this.dependencies[t];
55
- delete this.continuousDependencies[t];
56
53
  }
57
54
  }
58
55
  for (let d of Object.keys(this.dependencies)) {
59
56
  this.dependencies[d] = this.dependencies[d].filter((dd) => !!initialTasks[dd]);
60
57
  }
61
- for (let d of Object.keys(this.continuousDependencies)) {
62
- this.continuousDependencies[d] = this.continuousDependencies[d].filter((dd) => !!initialTasks[dd]);
63
- }
64
58
  }
65
59
  filterDummyTasks(this.dependencies);
66
60
  for (const taskId of Object.keys(this.dependencies)) {
@@ -70,16 +64,7 @@ class ProcessTasks {
70
64
  ];
71
65
  }
72
66
  }
73
- filterDummyTasks(this.continuousDependencies);
74
- for (const taskId of Object.keys(this.continuousDependencies)) {
75
- if (this.continuousDependencies[taskId].length > 0) {
76
- this.continuousDependencies[taskId] = [
77
- ...new Set(this.continuousDependencies[taskId].filter((d) => d !== taskId)).values(),
78
- ];
79
- }
80
- }
81
- return Object.keys(this.tasks).filter((d) => this.dependencies[d].length === 0 &&
82
- this.continuousDependencies[d].length === 0);
67
+ return Object.keys(this.dependencies).filter((d) => this.dependencies[d].length === 0);
83
68
  }
84
69
  processTask(task, projectUsedToDeriveDependencies, configuration, overrides) {
85
70
  const seenKey = `${task.id}-${projectUsedToDeriveDependencies}`;
@@ -121,21 +106,15 @@ class ProcessTasks {
121
106
  if ((0, project_graph_utils_1.projectHasTarget)(selfProject, dependencyConfig.target)) {
122
107
  const resolvedConfiguration = this.resolveConfiguration(selfProject, dependencyConfig.target, configuration);
123
108
  const selfTaskId = this.getId(selfProject.name, dependencyConfig.target, resolvedConfiguration);
109
+ if (task.id !== selfTaskId) {
110
+ this.dependencies[task.id].push(selfTaskId);
111
+ }
124
112
  if (!this.tasks[selfTaskId]) {
125
113
  const newTask = this.createTask(selfTaskId, selfProject, dependencyConfig.target, resolvedConfiguration, taskOverrides);
126
114
  this.tasks[selfTaskId] = newTask;
127
115
  this.dependencies[selfTaskId] = [];
128
- this.continuousDependencies[selfTaskId] = [];
129
116
  this.processTask(newTask, newTask.target.project, configuration, overrides);
130
117
  }
131
- if (task.id !== selfTaskId) {
132
- if (this.tasks[selfTaskId].continuous) {
133
- this.continuousDependencies[task.id].push(selfTaskId);
134
- }
135
- else {
136
- this.dependencies[task.id].push(selfTaskId);
137
- }
138
- }
139
118
  }
140
119
  }
141
120
  processTasksForDependencies(projectUsedToDeriveDependencies, dependencyConfig, configuration, task, taskOverrides, overrides) {
@@ -150,20 +129,13 @@ class ProcessTasks {
150
129
  if ((0, project_graph_utils_1.projectHasTarget)(depProject, dependencyConfig.target)) {
151
130
  const resolvedConfiguration = this.resolveConfiguration(depProject, dependencyConfig.target, configuration);
152
131
  const depTargetId = this.getId(depProject.name, dependencyConfig.target, resolvedConfiguration);
153
- const depTargetConfiguration = this.projectGraph.nodes[depProject.name].data.targets[dependencyConfig.target];
154
132
  if (task.id !== depTargetId) {
155
- if (depTargetConfiguration.continuous) {
156
- this.continuousDependencies[task.id].push(depTargetId);
157
- }
158
- else {
159
- this.dependencies[task.id].push(depTargetId);
160
- }
133
+ this.dependencies[task.id].push(depTargetId);
161
134
  }
162
135
  if (!this.tasks[depTargetId]) {
163
136
  const newTask = this.createTask(depTargetId, depProject, dependencyConfig.target, resolvedConfiguration, taskOverrides);
164
137
  this.tasks[depTargetId] = newTask;
165
138
  this.dependencies[depTargetId] = [];
166
- this.continuousDependencies[depTargetId] = [];
167
139
  this.processTask(newTask, newTask.target.project, configuration, overrides);
168
140
  }
169
141
  }
@@ -175,7 +147,6 @@ class ProcessTasks {
175
147
  DUMMY_TASK_TARGET, undefined);
176
148
  this.dependencies[task.id].push(dummyId);
177
149
  this.dependencies[dummyId] ??= [];
178
- this.continuousDependencies[dummyId] ??= [];
179
150
  const noopTask = this.createDummyTask(dummyId, task);
180
151
  this.processTask(noopTask, depProject.name, configuration, overrides);
181
152
  }
@@ -208,7 +179,6 @@ class ProcessTasks {
208
179
  outputs: (0, utils_1.getOutputs)(this.projectGraph.nodes, qualifiedTarget, interpolatedOverrides),
209
180
  cache: project.data.targets[target].cache,
210
181
  parallelism: project.data.targets[target].parallelism ?? true,
211
- continuous: project.data.targets[target].continuous ?? false,
212
182
  };
213
183
  }
214
184
  resolveConfiguration(project, target, configuration) {
@@ -234,7 +204,6 @@ function createTaskGraph(projectGraph, extraTargetDependencies, projectNames, ta
234
204
  roots,
235
205
  tasks: p.tasks,
236
206
  dependencies: p.dependencies,
237
- continuousDependencies: p.continuousDependencies,
238
207
  };
239
208
  }
240
209
  function mapTargetDefaultsToDependencies(defaults) {