nx 23.0.0-beta.2 → 23.0.0-beta.21
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.
- package/dist/bin/init-local.js +11 -20
- package/dist/bin/nx.d.ts +1 -0
- package/dist/bin/nx.js +28 -2
- package/dist/plugins/package-json.js +4 -2
- package/dist/src/adapter/ngcli-adapter.d.ts +2 -1
- package/dist/src/adapter/ngcli-adapter.js +25 -2
- package/dist/src/ai/clone-ai-config-repo.js +20 -3
- package/dist/src/analytics/analytics.js +10 -1
- package/dist/src/command-line/add/completion.d.ts +1 -0
- package/dist/src/command-line/add/completion.js +15 -0
- package/dist/src/command-line/affected/completion.d.ts +1 -0
- package/dist/src/command-line/affected/completion.js +15 -0
- package/dist/src/command-line/completion/argv-layout.d.ts +6 -0
- package/dist/src/command-line/completion/argv-layout.js +19 -0
- package/dist/src/command-line/completion/command-completions.d.ts +19 -0
- package/dist/src/command-line/completion/command-completions.js +120 -0
- package/dist/src/command-line/completion/command-handlers.d.ts +30 -0
- package/dist/src/command-line/completion/command-handlers.js +69 -0
- package/dist/src/command-line/completion/command-object.d.ts +10 -0
- package/dist/src/command-line/completion/command-object.js +95 -0
- package/dist/src/command-line/completion/completion-providers.d.ts +21 -0
- package/dist/src/command-line/completion/completion-providers.js +194 -0
- package/dist/src/command-line/completion/infix-targets.d.ts +1 -0
- package/dist/src/command-line/completion/infix-targets.js +48 -0
- package/dist/src/command-line/completion/metadata.d.ts +22 -0
- package/dist/src/command-line/completion/metadata.js +71 -0
- package/dist/src/command-line/completion/registrations.d.ts +9 -0
- package/dist/src/command-line/completion/registrations.js +16 -0
- package/dist/src/command-line/completion/scripts/bash.sh +51 -0
- package/dist/src/command-line/completion/scripts/fish.fish +47 -0
- package/dist/src/command-line/completion/scripts/powershell.ps1 +52 -0
- package/dist/src/command-line/completion/scripts/zsh.zsh +69 -0
- package/dist/src/command-line/completion/scripts.d.ts +18 -0
- package/dist/src/command-line/completion/scripts.js +140 -0
- package/dist/src/command-line/completion/trigger.d.ts +3 -0
- package/dist/src/command-line/completion/trigger.js +21 -0
- package/dist/src/command-line/completion/value-completions.d.ts +3 -0
- package/dist/src/command-line/completion/value-completions.js +21 -0
- package/dist/src/command-line/examples.js +1 -1
- package/dist/src/command-line/format/format.js +15 -5
- package/dist/src/command-line/generate/completion.d.ts +1 -0
- package/dist/src/command-line/generate/completion.js +9 -0
- package/dist/src/command-line/graph/completion.d.ts +1 -0
- package/dist/src/command-line/graph/completion.js +13 -0
- package/dist/src/command-line/init/implementation/angular/standalone-workspace.js +14 -18
- package/dist/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +1 -0
- package/dist/src/command-line/init/implementation/utils.d.ts +7 -1
- package/dist/src/command-line/init/implementation/utils.js +51 -14
- package/dist/src/command-line/migrate/agentic/capture-generator-output.d.ts +22 -0
- package/dist/src/command-line/migrate/agentic/capture-generator-output.js +100 -0
- package/dist/src/command-line/migrate/agentic/cli-args.d.ts +12 -0
- package/dist/src/command-line/migrate/agentic/cli-args.js +38 -0
- package/dist/src/command-line/migrate/agentic/definitions.d.ts +6 -0
- package/dist/src/command-line/migrate/agentic/definitions.js +98 -0
- package/dist/src/command-line/migrate/agentic/detect-installed.d.ts +10 -0
- package/dist/src/command-line/migrate/agentic/detect-installed.js +68 -0
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +46 -0
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +87 -0
- package/dist/src/command-line/migrate/agentic/handoff.d.ts +63 -0
- package/dist/src/command-line/migrate/agentic/handoff.js +183 -0
- package/dist/src/command-line/migrate/agentic/inception.d.ts +9 -0
- package/dist/src/command-line/migrate/agentic/inception.js +15 -0
- package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.d.ts +22 -0
- package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.js +50 -0
- package/dist/src/command-line/migrate/agentic/prompts/generic-validation.d.ts +51 -0
- package/dist/src/command-line/migrate/agentic/prompts/generic-validation.js +65 -0
- package/dist/src/command-line/migrate/agentic/prompts/hybrid-prompt-migration.d.ts +44 -0
- package/dist/src/command-line/migrate/agentic/prompts/hybrid-prompt-migration.js +52 -0
- package/dist/src/command-line/migrate/agentic/prompts/prompt-migration.d.ts +21 -0
- package/dist/src/command-line/migrate/agentic/prompts/prompt-migration.js +26 -0
- package/dist/src/command-line/migrate/agentic/prompts/shared-rendering.d.ts +18 -0
- package/dist/src/command-line/migrate/agentic/prompts/shared-rendering.js +130 -0
- package/dist/src/command-line/migrate/agentic/prompts/system-prompt.d.ts +46 -0
- package/dist/src/command-line/migrate/agentic/prompts/system-prompt.js +88 -0
- package/dist/src/command-line/migrate/agentic/run-step.d.ts +51 -0
- package/dist/src/command-line/migrate/agentic/run-step.js +121 -0
- package/dist/src/command-line/migrate/agentic/runner.d.ts +33 -0
- package/dist/src/command-line/migrate/agentic/runner.js +442 -0
- package/dist/src/command-line/migrate/agentic/select.d.ts +14 -0
- package/dist/src/command-line/migrate/agentic/select.js +150 -0
- package/dist/src/command-line/migrate/agentic/types.d.ts +102 -0
- package/dist/src/command-line/migrate/agentic/types.js +2 -0
- package/dist/src/command-line/migrate/command-object.d.ts +1 -0
- package/dist/src/command-line/migrate/command-object.js +32 -7
- package/dist/src/command-line/migrate/migrate-commits.d.ts +50 -0
- package/dist/src/command-line/migrate/migrate-commits.js +102 -0
- package/dist/src/command-line/migrate/migrate-output.d.ts +180 -0
- package/dist/src/command-line/migrate/migrate-output.js +258 -0
- package/dist/src/command-line/migrate/migrate.d.ts +122 -12
- package/dist/src/command-line/migrate/migrate.js +1036 -217
- package/dist/src/command-line/migrate/migration-shape.d.ts +8 -0
- package/dist/src/command-line/migrate/migration-shape.js +13 -0
- package/dist/src/command-line/migrate/multi-major.d.ts +30 -0
- package/dist/src/command-line/migrate/multi-major.js +185 -0
- package/dist/src/command-line/migrate/prompt-files.d.ts +31 -0
- package/dist/src/command-line/migrate/prompt-files.js +141 -0
- package/dist/src/command-line/migrate/run-migration-process.js +28 -6
- package/dist/src/command-line/migrate/safe-prompt.d.ts +28 -0
- package/dist/src/command-line/migrate/safe-prompt.js +49 -0
- package/dist/src/command-line/migrate/update-filters.d.ts +11 -0
- package/dist/src/command-line/migrate/update-filters.js +44 -0
- package/dist/src/command-line/migrate/version-utils.d.ts +6 -0
- package/dist/src/command-line/migrate/version-utils.js +59 -0
- package/dist/src/command-line/nx-commands.js +9 -0
- package/dist/src/command-line/release/config/config.d.ts +3 -6
- package/dist/src/command-line/release/config/config.js +77 -45
- package/dist/src/command-line/release/config/use-legacy-versioning.d.ts +2 -0
- package/dist/src/command-line/release/config/use-legacy-versioning.js +8 -0
- package/dist/src/command-line/release/utils/release-graph.js +2 -3
- package/dist/src/command-line/release/utils/repository-git-tags.js +1 -1
- package/dist/src/command-line/release/utils/resolve-changelog-renderer.js +7 -19
- package/dist/src/command-line/release/version/resolve-current-version.js +1 -1
- package/dist/src/command-line/release/version/version-actions.js +3 -7
- package/dist/src/command-line/report/report.js +2 -2
- package/dist/src/command-line/run/completion.d.ts +1 -0
- package/dist/src/command-line/run/completion.js +7 -0
- package/dist/src/command-line/run-many/completion.d.ts +1 -0
- package/dist/src/command-line/run-many/completion.js +13 -0
- package/dist/src/command-line/show/completion.d.ts +1 -0
- package/dist/src/command-line/show/completion.js +27 -0
- package/dist/src/command-line/show/show-target/info.d.ts +1 -0
- package/dist/src/command-line/show/show-target/info.js +100 -19
- package/dist/src/command-line/watch/command-object.js +24 -4
- package/dist/src/command-line/watch/completion.d.ts +1 -0
- package/dist/src/command-line/watch/completion.js +10 -0
- package/dist/src/command-line/watch/watch.d.ts +7 -0
- package/dist/src/command-line/watch/watch.js +1 -1
- package/dist/src/config/misc-interfaces.d.ts +25 -2
- package/dist/src/config/nx-json.d.ts +43 -56
- package/dist/src/config/schema-utils.d.ts +21 -0
- package/dist/src/config/schema-utils.js +92 -18
- package/dist/src/config/task-graph.d.ts +4 -107
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/core/graph/styles.css +2 -3
- package/dist/src/core/graph/styles.js +1 -1
- package/dist/src/daemon/client/client.d.ts +1 -1
- package/dist/src/daemon/server/file-watching/file-watcher-sockets.d.ts +1 -1
- package/dist/src/daemon/server/file-watching/file-watcher-sockets.js +1 -1
- package/dist/src/daemon/server/file-watching/route-workspace-changes.d.ts +9 -0
- package/dist/src/daemon/server/file-watching/route-workspace-changes.js +76 -0
- package/dist/src/daemon/server/project-graph-incremental-recomputation.js +45 -11
- package/dist/src/daemon/server/server.js +4 -43
- package/dist/src/daemon/server/start.d.ts +1 -1
- package/dist/src/daemon/server/start.js +2 -0
- package/dist/src/devkit-exports.d.ts +2 -2
- package/dist/src/devkit-internals.d.ts +5 -1
- package/dist/src/devkit-internals.js +17 -1
- package/dist/src/executors/run-commands/running-tasks.d.ts +7 -0
- package/dist/src/executors/run-commands/running-tasks.js +178 -105
- package/dist/src/executors/run-script/run-script.impl.js +3 -10
- package/dist/src/executors/utils/convert-nx-executor.js +1 -1
- package/dist/src/hasher/hash-plan-inspector.d.ts +1 -1
- package/dist/src/hasher/task-hasher.js +6 -4
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +0 -3
- package/dist/src/migrations/update-16-2-0/remove-run-commands-output-path.js +6 -2
- package/dist/src/migrations/update-17-0-0/move-cache-directory.md +31 -0
- package/dist/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +20 -4
- package/dist/src/migrations/update-20-0-0/move-use-daemon-process.md +27 -0
- package/dist/src/migrations/update-20-0-1/use-legacy-cache.md +24 -0
- package/dist/src/migrations/update-21-0-0/release-changelog-config-changes.md +49 -0
- package/dist/src/migrations/update-21-0-0/release-version-config-changes.md +54 -0
- package/dist/src/migrations/update-21-0-0/remove-custom-tasks-runner.md +28 -0
- package/dist/src/migrations/update-21-0-0/remove-legacy-cache.md +22 -0
- package/dist/src/migrations/update-22-2-0/add-self-healing-to-gitignore.md +11 -0
- package/dist/src/migrations/update-23-0-0/add-migrate-runs-to-git-ignore.d.ts +2 -0
- package/dist/src/migrations/update-23-0-0/add-migrate-runs-to-git-ignore.js +16 -0
- package/dist/src/migrations/update-23-0-0/consolidate-release-tag-config.d.ts +9 -0
- package/dist/src/migrations/update-23-0-0/consolidate-release-tag-config.js +18 -0
- package/dist/src/migrations/update-23-0-0/convert-target-defaults-to-array.d.ts +35 -0
- package/dist/src/migrations/update-23-0-0/convert-target-defaults-to-array.js +139 -0
- package/dist/src/migrations/update-23-0-0/convert-target-defaults-to-array.md +66 -0
- package/dist/src/native/index.d.ts +79 -2
- package/dist/src/native/native-bindings.js +3 -0
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/plugins/js/lock-file/npm-parser.js +37 -19
- package/dist/src/plugins/js/lock-file/pnpm-parser.js +51 -4
- package/dist/src/plugins/js/lock-file/project-graph-pruning.js +12 -4
- package/dist/src/plugins/js/utils/packages.js +1 -1
- package/dist/src/plugins/js/utils/register.d.ts +103 -14
- package/dist/src/plugins/js/utils/register.js +434 -39
- package/dist/src/plugins/js/utils/typescript.d.ts +7 -0
- package/dist/src/plugins/js/utils/typescript.js +39 -0
- package/dist/src/plugins/package-json/create-nodes.d.ts +3 -2
- package/dist/src/plugins/package-json/create-nodes.js +7 -5
- package/dist/src/project-graph/affected/locators/project-glob-changes.js +2 -1
- package/dist/src/project-graph/build-project-graph.d.ts +5 -0
- package/dist/src/project-graph/build-project-graph.js +6 -2
- package/dist/src/project-graph/file-map-utils.d.ts +5 -0
- package/dist/src/project-graph/file-map-utils.js +10 -1
- package/dist/src/project-graph/plugins/get-plugins.d.ts +7 -2
- package/dist/src/project-graph/plugins/get-plugins.js +8 -5
- package/dist/src/project-graph/plugins/isolation/plugin-worker.d.ts +1 -0
- package/dist/src/project-graph/plugins/isolation/plugin-worker.js +2 -0
- package/dist/src/project-graph/plugins/resolve-plugin.d.ts +7 -4
- package/dist/src/project-graph/plugins/resolve-plugin.js +152 -33
- package/dist/src/project-graph/plugins/tasks-execution-hooks.js +4 -2
- package/dist/src/project-graph/plugins/transpiler.d.ts +12 -0
- package/dist/src/project-graph/plugins/transpiler.js +37 -0
- package/dist/src/project-graph/plugins/utils.js +13 -7
- package/dist/src/project-graph/project-graph.js +1 -1
- package/dist/src/project-graph/utils/project-configuration/target-defaults.d.ts +95 -4
- package/dist/src/project-graph/utils/project-configuration/target-defaults.js +515 -68
- package/dist/src/project-graph/utils/project-configuration-utils.d.ts +13 -5
- package/dist/src/project-graph/utils/project-configuration-utils.js +14 -6
- package/dist/src/project-graph/utils/retrieve-workspace-files.js +1 -1
- package/dist/src/tasks-runner/create-task-graph.d.ts +4 -4
- package/dist/src/tasks-runner/create-task-graph.js +1 -1
- package/dist/src/tasks-runner/default-tasks-runner.d.ts +0 -2
- package/dist/src/tasks-runner/forked-process-task-runner.d.ts +1 -1
- package/dist/src/tasks-runner/forked-process-task-runner.js +11 -6
- package/dist/src/tasks-runner/init-tasks-runner.d.ts +0 -15
- package/dist/src/tasks-runner/init-tasks-runner.js +0 -63
- package/dist/src/tasks-runner/legacy-depends-on-warning.d.ts +18 -0
- package/dist/src/tasks-runner/legacy-depends-on-warning.js +109 -0
- package/dist/src/tasks-runner/life-cycle.d.ts +7 -8
- package/dist/src/tasks-runner/life-cycles/invoke-runner-terminal-output-life-cycle.js +6 -6
- package/dist/src/tasks-runner/life-cycles/task-history-life-cycle-old.js +13 -2
- package/dist/src/tasks-runner/life-cycles/task-history-life-cycle.js +16 -5
- package/dist/src/tasks-runner/life-cycles/tui-summary-life-cycle.js +11 -2
- package/dist/src/tasks-runner/pseudo-terminal.d.ts +1 -1
- package/dist/src/tasks-runner/pseudo-terminal.js +22 -10
- package/dist/src/tasks-runner/run-command.js +8 -11
- package/dist/src/tasks-runner/running-tasks/batch-process.d.ts +1 -1
- package/dist/src/tasks-runner/running-tasks/batch-process.js +3 -5
- package/dist/src/tasks-runner/running-tasks/node-child-process.d.ts +2 -2
- package/dist/src/tasks-runner/running-tasks/node-child-process.js +5 -7
- package/dist/src/tasks-runner/task-env.d.ts +1 -1
- package/dist/src/tasks-runner/task-env.js +6 -1
- package/dist/src/tasks-runner/task-orchestrator.d.ts +11 -1
- package/dist/src/tasks-runner/task-orchestrator.js +112 -38
- package/dist/src/tasks-runner/tasks-schedule.js +3 -3
- package/dist/src/tasks-runner/utils.d.ts +7 -8
- package/dist/src/tasks-runner/utils.js +23 -27
- package/dist/src/utils/child-process.js +2 -2
- package/dist/src/utils/compile-cache.d.ts +24 -0
- package/dist/src/utils/compile-cache.js +49 -0
- package/dist/src/utils/enable-compile-cache.d.ts +1 -0
- package/dist/src/utils/enable-compile-cache.js +7 -0
- package/dist/src/utils/fileutils.d.ts +0 -8
- package/dist/src/utils/fileutils.js +0 -40
- package/dist/src/utils/git-utils.d.ts +15 -0
- package/dist/src/utils/git-utils.js +138 -0
- package/dist/src/utils/handle-import.d.ts +4 -1
- package/dist/src/utils/handle-import.js +56 -2
- package/dist/src/utils/has-nx-js-plugin.d.ts +9 -0
- package/dist/src/utils/has-nx-js-plugin.js +24 -0
- package/dist/src/utils/installed-nx-version.d.ts +14 -4
- package/dist/src/utils/installed-nx-version.js +54 -7
- package/dist/src/utils/logger.d.ts +12 -1
- package/dist/src/utils/logger.js +57 -36
- package/dist/src/utils/nx-key.d.ts +0 -1
- package/dist/src/utils/nx-key.js +20 -23
- package/dist/src/utils/nx-package-group.d.ts +8 -0
- package/dist/src/utils/nx-package-group.js +15 -0
- package/dist/src/utils/output.d.ts +3 -2
- package/dist/src/utils/output.js +29 -28
- package/dist/src/utils/package-json.d.ts +14 -1
- package/dist/src/utils/package-json.js +20 -21
- package/dist/src/utils/perf-logging.js +3 -1
- package/dist/src/utils/plugin-cache-utils.d.ts +13 -4
- package/dist/src/utils/plugin-cache-utils.js +23 -13
- package/dist/src/utils/plugins/local-plugins.d.ts +18 -0
- package/dist/src/utils/plugins/local-plugins.js +30 -0
- package/dist/src/utils/tar.d.ts +8 -0
- package/dist/src/utils/tar.js +44 -0
- package/migrations.json +16 -0
- package/package.json +28 -28
- package/schemas/nx-schema.json +114 -80
- package/dist/src/plugins/js/project-graph/build-dependencies/strip-source-code.d.ts +0 -7
- package/dist/src/plugins/js/project-graph/build-dependencies/strip-source-code.js +0 -155
- package/dist/src/plugins/js/project-graph/build-dependencies/typescript-import-locator.d.ts +0 -16
- package/dist/src/plugins/js/project-graph/build-dependencies/typescript-import-locator.js +0 -121
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BatchProcess = void 0;
|
|
4
|
-
const
|
|
5
|
-
const tree_kill_1 = tslib_1.__importDefault(require("tree-kill"));
|
|
4
|
+
const native_1 = require("../../native");
|
|
6
5
|
const exit_codes_1 = require("../../utils/exit-codes");
|
|
7
6
|
const batch_messages_1 = require("../batch/batch-messages");
|
|
8
7
|
class BatchProcess {
|
|
@@ -103,10 +102,9 @@ class BatchProcess {
|
|
|
103
102
|
}
|
|
104
103
|
kill(signal) {
|
|
105
104
|
if (this.childProcess?.pid) {
|
|
106
|
-
(0,
|
|
107
|
-
// Ignore errors - process may have already exited
|
|
108
|
-
});
|
|
105
|
+
return (0, native_1.killProcessTreeGraceful)(this.childProcess.pid, signal);
|
|
109
106
|
}
|
|
107
|
+
return Promise.resolve();
|
|
110
108
|
}
|
|
111
109
|
}
|
|
112
110
|
exports.BatchProcess = BatchProcess;
|
|
@@ -18,7 +18,7 @@ export declare class NodeChildProcessWithNonDirectOutput implements RunningTask
|
|
|
18
18
|
terminalOutput: string;
|
|
19
19
|
}>;
|
|
20
20
|
send(message: Serializable): void;
|
|
21
|
-
kill(signal?: NodeJS.Signals): void
|
|
21
|
+
kill(signal?: NodeJS.Signals): Promise<void>;
|
|
22
22
|
}
|
|
23
23
|
export declare class NodeChildProcessWithDirectOutput implements RunningTask {
|
|
24
24
|
private childProcess;
|
|
@@ -36,5 +36,5 @@ export declare class NodeChildProcessWithDirectOutput implements RunningTask {
|
|
|
36
36
|
}>;
|
|
37
37
|
waitForExit(): Promise<void>;
|
|
38
38
|
getTerminalOutput(): string;
|
|
39
|
-
kill(signal?: NodeJS.Signals): void
|
|
39
|
+
kill(signal?: NodeJS.Signals): Promise<void>;
|
|
40
40
|
}
|
|
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const pc = tslib_1.__importStar(require("picocolors"));
|
|
6
6
|
const fs_1 = require("fs");
|
|
7
7
|
const stream_1 = require("stream");
|
|
8
|
-
const
|
|
8
|
+
const native_1 = require("../../native");
|
|
9
9
|
const exit_codes_1 = require("../../utils/exit-codes");
|
|
10
10
|
const output_prefix_1 = require("./output-prefix");
|
|
11
11
|
class NodeChildProcessWithNonDirectOutput {
|
|
@@ -97,10 +97,9 @@ class NodeChildProcessWithNonDirectOutput {
|
|
|
97
97
|
}
|
|
98
98
|
kill(signal) {
|
|
99
99
|
if (this.childProcess?.pid) {
|
|
100
|
-
(0,
|
|
101
|
-
// Ignore errors - process may have already exited
|
|
102
|
-
});
|
|
100
|
+
return (0, native_1.killProcessTreeGraceful)(this.childProcess.pid, signal);
|
|
103
101
|
}
|
|
102
|
+
return Promise.resolve();
|
|
104
103
|
}
|
|
105
104
|
}
|
|
106
105
|
exports.NodeChildProcessWithNonDirectOutput = NodeChildProcessWithNonDirectOutput;
|
|
@@ -168,10 +167,9 @@ class NodeChildProcessWithDirectOutput {
|
|
|
168
167
|
}
|
|
169
168
|
kill(signal) {
|
|
170
169
|
if (this.childProcess?.pid) {
|
|
171
|
-
(0,
|
|
172
|
-
// Ignore errors - process may have already exited
|
|
173
|
-
});
|
|
170
|
+
return (0, native_1.killProcessTreeGraceful)(this.childProcess.pid, signal);
|
|
174
171
|
}
|
|
172
|
+
return Promise.resolve();
|
|
175
173
|
}
|
|
176
174
|
}
|
|
177
175
|
exports.NodeChildProcessWithDirectOutput = NodeChildProcessWithDirectOutput;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Task } from '../config/task-graph';
|
|
2
1
|
import { ProjectGraph } from '../config/project-graph';
|
|
2
|
+
import { Task } from '../config/task-graph';
|
|
3
3
|
export declare function getEnvVariablesForBatchProcess(skipNxCache: boolean, captureStderr: boolean): NodeJS.ProcessEnv;
|
|
4
4
|
export declare function getTaskSpecificEnv(task: Task, graph: ProjectGraph): NodeJS.ProcessEnv;
|
|
5
5
|
export declare function getEnvVariablesForTask(task: Task, taskSpecificEnv: NodeJS.ProcessEnv, forceColor: string, skipNxCache: boolean, captureStderr: boolean, outputPath: string, streamOutput: boolean): NodeJS.ProcessEnv;
|
|
@@ -8,8 +8,8 @@ exports.unloadDotEnvFile = unloadDotEnvFile;
|
|
|
8
8
|
exports.getEnvFilesForTask = getEnvFilesForTask;
|
|
9
9
|
const dotenv_1 = require("dotenv");
|
|
10
10
|
const dotenv_expand_1 = require("dotenv-expand");
|
|
11
|
-
const workspace_root_1 = require("../utils/workspace-root");
|
|
12
11
|
const node_path_1 = require("node:path");
|
|
12
|
+
const workspace_root_1 = require("../utils/workspace-root");
|
|
13
13
|
const task_env_paths_1 = require("./task-env-paths");
|
|
14
14
|
function getEnvVariablesForBatchProcess(skipNxCache, captureStderr) {
|
|
15
15
|
return {
|
|
@@ -90,11 +90,16 @@ function getNxEnvVariablesForTask(task, forceColor, skipNxCache, captureStderr,
|
|
|
90
90
|
if (task.target.target === 'test') {
|
|
91
91
|
env.NX_TERMINAL_CAPTURE_STDERR = 'true';
|
|
92
92
|
}
|
|
93
|
+
// Pass the root Nx process PID to nested processes for DB-based loop detection.
|
|
94
|
+
// The root PID is used as a key in the task_invocations table to track which tasks
|
|
95
|
+
// have been invoked across nested Nx processes.
|
|
93
96
|
return {
|
|
94
97
|
...getNxEnvVariablesForForkedProcess(forceColor, skipNxCache, captureStderr, outputPath, streamOutput),
|
|
95
98
|
...env,
|
|
96
99
|
// Ensure the TUI does not get spawned within the TUI if ever tasks invoke Nx again
|
|
97
100
|
NX_TUI: 'false',
|
|
101
|
+
// tracks the root PID for child nx tasks, used to verify nx is infinitely recursing through the same tasks
|
|
102
|
+
NX_INVOCATION_ROOT_PID: process.env.NX_INVOCATION_ROOT_PID ?? String(process.pid),
|
|
98
103
|
};
|
|
99
104
|
}
|
|
100
105
|
/**
|
|
@@ -7,9 +7,9 @@ import { NxArgs } from '../utils/command-line-utils';
|
|
|
7
7
|
import { DefaultTasksRunnerOptions } from './default-tasks-runner';
|
|
8
8
|
import { TaskResult } from './life-cycle';
|
|
9
9
|
import { RunningTask } from './running-tasks/running-task';
|
|
10
|
+
import { SharedRunningTask } from './running-tasks/shared-running-task';
|
|
10
11
|
import { TaskStatus } from './tasks-runner';
|
|
11
12
|
import { Batch } from './tasks-schedule';
|
|
12
|
-
import { SharedRunningTask } from './running-tasks/shared-running-task';
|
|
13
13
|
export declare class TaskOrchestrator {
|
|
14
14
|
private readonly hasher;
|
|
15
15
|
private readonly initiatingProject;
|
|
@@ -28,6 +28,8 @@ export declare class TaskOrchestrator {
|
|
|
28
28
|
private readonly projects;
|
|
29
29
|
private forkedProcessTaskRunner;
|
|
30
30
|
private runningTasksService;
|
|
31
|
+
private taskInvocationTracker;
|
|
32
|
+
private registeredInvocations;
|
|
31
33
|
private tasksSchedule;
|
|
32
34
|
private batchEnv;
|
|
33
35
|
private reverseTaskDeps;
|
|
@@ -67,6 +69,13 @@ export declare class TaskOrchestrator {
|
|
|
67
69
|
private executeContinuousTaskLoop;
|
|
68
70
|
private processTask;
|
|
69
71
|
processAllScheduledTasks(): void;
|
|
72
|
+
/**
|
|
73
|
+
* Registers a task invocation and checks for loops across nested Nx processes.
|
|
74
|
+
* Uses the task_invocations DB table keyed by root PID. registerTask() throws
|
|
75
|
+
* on unique constraint violation when a parent Nx process already registered
|
|
76
|
+
* this task — indicating an infinite loop.
|
|
77
|
+
*/
|
|
78
|
+
private detectTaskInvocationLoop;
|
|
70
79
|
private applyCachedResults;
|
|
71
80
|
/**
|
|
72
81
|
* Batch cache lookup + filter to successful entries. Handles both
|
|
@@ -166,6 +175,7 @@ export declare class TaskOrchestrator {
|
|
|
166
175
|
private shouldCopyOutputsFromCacheBatch;
|
|
167
176
|
private recordOutputsHashBatch;
|
|
168
177
|
private handleContinuousTaskExit;
|
|
178
|
+
private isContinuousTaskNeeded;
|
|
169
179
|
private completeContinuousTask;
|
|
170
180
|
private cleanup;
|
|
171
181
|
private performCleanup;
|
|
@@ -5,9 +5,9 @@ exports.getThreadPoolSize = getThreadPoolSize;
|
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
const events_1 = require("events");
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
|
-
const pc = tslib_1.__importStar(require("picocolors"));
|
|
9
8
|
const path_1 = require("path");
|
|
10
9
|
const perf_hooks_1 = require("perf_hooks");
|
|
10
|
+
const pc = tslib_1.__importStar(require("picocolors"));
|
|
11
11
|
const project_graph_1 = require("../project-graph/project-graph");
|
|
12
12
|
const run_commands_impl_1 = require("../executors/run-commands/run-commands.impl");
|
|
13
13
|
const hash_task_1 = require("../hasher/hash-task");
|
|
@@ -15,20 +15,28 @@ const task_graph_utils_1 = require("./task-graph-utils");
|
|
|
15
15
|
const task_hasher_1 = require("../hasher/task-hasher");
|
|
16
16
|
const native_1 = require("../native");
|
|
17
17
|
const db_connection_1 = require("../utils/db-connection");
|
|
18
|
+
const exit_codes_1 = require("../utils/exit-codes");
|
|
18
19
|
const output_1 = require("../utils/output");
|
|
19
20
|
const params_1 = require("../utils/params");
|
|
20
21
|
const workspace_root_1 = require("../utils/workspace-root");
|
|
21
|
-
const exit_codes_1 = require("../utils/exit-codes");
|
|
22
22
|
const cache_1 = require("./cache");
|
|
23
23
|
const forked_process_task_runner_1 = require("./forked-process-task-runner");
|
|
24
24
|
const is_tui_enabled_1 = require("./is-tui-enabled");
|
|
25
25
|
const pseudo_terminal_1 = require("./pseudo-terminal");
|
|
26
|
-
const output_prefix_1 = require("./running-tasks/output-prefix");
|
|
27
26
|
const noop_child_process_1 = require("./running-tasks/noop-child-process");
|
|
27
|
+
const output_prefix_1 = require("./running-tasks/output-prefix");
|
|
28
|
+
const shared_running_task_1 = require("./running-tasks/shared-running-task");
|
|
28
29
|
const task_env_1 = require("./task-env");
|
|
29
30
|
const tasks_schedule_1 = require("./tasks-schedule");
|
|
30
31
|
const utils_1 = require("./utils");
|
|
31
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Resolve a batch executor's per-task result to a TaskStatus. Prefers an
|
|
34
|
+
* explicit `status` from the executor; falls back to the `success` boolean
|
|
35
|
+
* for executors that pre-date the `status` field.
|
|
36
|
+
*/
|
|
37
|
+
function resolveBatchTaskStatus(result) {
|
|
38
|
+
return result.status ?? (result.success ? 'success' : 'failure');
|
|
39
|
+
}
|
|
32
40
|
class TaskOrchestrator {
|
|
33
41
|
// endregion internal state
|
|
34
42
|
constructor(hasher, initiatingProject, initiatingTasks, projectGraph, taskGraph, nxJson, options, bail, daemon, outputStyle, taskGraphForHashing = taskGraph) {
|
|
@@ -53,6 +61,13 @@ class TaskOrchestrator {
|
|
|
53
61
|
this.runningTasksService = !native_1.IS_WASM
|
|
54
62
|
? new native_1.RunningTasksService((0, db_connection_1.getLocalDbConnection)())
|
|
55
63
|
: null;
|
|
64
|
+
this.taskInvocationTracker = !native_1.IS_WASM
|
|
65
|
+
? new native_1.TaskInvocationTracker((0, db_connection_1.getLocalDbConnection)(), Number(process.env.NX_INVOCATION_ROOT_PID ?? process.pid))
|
|
66
|
+
: null;
|
|
67
|
+
// Tracks tasks registered by THIS process so that recursive code paths
|
|
68
|
+
// (e.g. applyFromCacheOrRunBatch looping on incomplete batches) don't
|
|
69
|
+
// re-register and trip the DB uniqueness constraint.
|
|
70
|
+
this.registeredInvocations = new Set();
|
|
56
71
|
this.tasksSchedule = new tasks_schedule_1.TasksSchedule(this.projectGraph, this.projects, this.taskGraph, this.options);
|
|
57
72
|
// region internal state
|
|
58
73
|
this.batchEnv = (0, task_env_1.getEnvVariablesForBatchProcess)(this.options.skipNxCache, this.options.captureStderr);
|
|
@@ -81,6 +96,7 @@ class TaskOrchestrator {
|
|
|
81
96
|
}
|
|
82
97
|
async init() {
|
|
83
98
|
this.setupSignalHandlers();
|
|
99
|
+
this.taskInvocationTracker?.cleanupStale();
|
|
84
100
|
// Init the ForkedProcessTaskRunner, TasksSchedule, and Cache
|
|
85
101
|
await Promise.all([
|
|
86
102
|
this.forkedProcessTaskRunner.init(),
|
|
@@ -255,10 +271,46 @@ class TaskOrchestrator {
|
|
|
255
271
|
}
|
|
256
272
|
}
|
|
257
273
|
}
|
|
274
|
+
/**
|
|
275
|
+
* Registers a task invocation and checks for loops across nested Nx processes.
|
|
276
|
+
* Uses the task_invocations DB table keyed by root PID. registerTask() throws
|
|
277
|
+
* on unique constraint violation when a parent Nx process already registered
|
|
278
|
+
* this task — indicating an infinite loop.
|
|
279
|
+
*/
|
|
280
|
+
detectTaskInvocationLoop(task) {
|
|
281
|
+
if (!this.taskInvocationTracker)
|
|
282
|
+
return;
|
|
283
|
+
if (this.registeredInvocations.has(task.id))
|
|
284
|
+
return;
|
|
285
|
+
try {
|
|
286
|
+
this.taskInvocationTracker.registerTask(process.pid, task.id);
|
|
287
|
+
this.registeredInvocations.add(task.id);
|
|
288
|
+
}
|
|
289
|
+
catch {
|
|
290
|
+
// Unique constraint violation — task already invoked by an ancestor Nx process
|
|
291
|
+
const chain = this.taskInvocationTracker.getInvocationChain();
|
|
292
|
+
const chainDisplay = chain.map((r) => r.taskId).join(' -> ');
|
|
293
|
+
output_1.output.error({
|
|
294
|
+
title: 'Recursive task invocation detected',
|
|
295
|
+
bodyLines: [
|
|
296
|
+
`Nx detected a recursive loop of task invocations:`,
|
|
297
|
+
``,
|
|
298
|
+
` ${chainDisplay} -> ${task.id}`,
|
|
299
|
+
``,
|
|
300
|
+
`Task "${task.id}" was already invoked by a parent Nx process in this chain.`,
|
|
301
|
+
`This typically happens when a task's command (e.g., "nx ${task.target.target} ${task.target.project}")`,
|
|
302
|
+
`triggers a chain of tasks that eventually re-invokes itself.`,
|
|
303
|
+
``,
|
|
304
|
+
`To fix this, review the command configuration for the tasks in the chain above.`,
|
|
305
|
+
],
|
|
306
|
+
});
|
|
307
|
+
process.exit(1);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
258
310
|
// endregion Processing Scheduled Tasks
|
|
259
311
|
// region Applying Cache
|
|
260
312
|
async applyCachedResults(tasks) {
|
|
261
|
-
const cacheableTasks = tasks.filter((t) =>
|
|
313
|
+
const cacheableTasks = tasks.filter((t) => t.cache);
|
|
262
314
|
if (cacheableTasks.length === 0)
|
|
263
315
|
return [];
|
|
264
316
|
const cacheHits = await this.fetchCacheHits(cacheableTasks);
|
|
@@ -340,9 +392,7 @@ class TaskOrchestrator {
|
|
|
340
392
|
const candidates = [];
|
|
341
393
|
for (const id of scheduledTasks) {
|
|
342
394
|
const task = this.taskGraph.tasks[id];
|
|
343
|
-
if (task.hash &&
|
|
344
|
-
!task.continuous &&
|
|
345
|
-
(0, utils_1.isCacheableTask)(task, this.options)) {
|
|
395
|
+
if (task.hash && !task.continuous && task.cache) {
|
|
346
396
|
candidates.push(task);
|
|
347
397
|
}
|
|
348
398
|
}
|
|
@@ -448,6 +498,9 @@ class TaskOrchestrator {
|
|
|
448
498
|
let batchResults = [];
|
|
449
499
|
if (taskIdsToSkip.length < tasks.length) {
|
|
450
500
|
const runGraph = (0, utils_1.removeTasksFromTaskGraph)(batch.taskGraph, taskIdsToSkip);
|
|
501
|
+
for (const task of Object.values(runGraph.tasks)) {
|
|
502
|
+
this.detectTaskInvocationLoop(task);
|
|
503
|
+
}
|
|
451
504
|
batchResults = await this.runBatch({
|
|
452
505
|
id: batch.id,
|
|
453
506
|
executorName: batch.executorName,
|
|
@@ -498,11 +551,18 @@ class TaskOrchestrator {
|
|
|
498
551
|
// Heavy operations (caching, scheduling, complete) happen at batch-end in postRunSteps
|
|
499
552
|
batchProcess.onTaskResults((taskId, result) => {
|
|
500
553
|
const task = this.taskGraph.tasks[taskId];
|
|
501
|
-
const status = result
|
|
502
|
-
|
|
554
|
+
const status = resolveBatchTaskStatus(result);
|
|
555
|
+
// Append before print so printTaskTerminalOutput finds the PTY already
|
|
556
|
+
// populated and no-ops; reversing the order writes terminalOutput twice.
|
|
503
557
|
if (result.terminalOutput) {
|
|
504
558
|
this.options.lifeCycle.appendTaskOutput(taskId, result.terminalOutput, false);
|
|
505
559
|
}
|
|
560
|
+
// Skipped tasks didn't run, so they have no terminal output and don't
|
|
561
|
+
// need a per-task PTY — calling printTaskTerminalOutput would otherwise
|
|
562
|
+
// allocate one just to write a cursor-hide escape.
|
|
563
|
+
if (status !== 'skipped') {
|
|
564
|
+
this.options.lifeCycle.printTaskTerminalOutput(task, status, result.terminalOutput ?? '');
|
|
565
|
+
}
|
|
506
566
|
task.startTime = result.startTime;
|
|
507
567
|
task.endTime = result.endTime;
|
|
508
568
|
if (result.startTime && result.endTime) {
|
|
@@ -516,10 +576,11 @@ class TaskOrchestrator {
|
|
|
516
576
|
const task = this.taskGraph.tasks[taskId];
|
|
517
577
|
task.startTime = result.startTime;
|
|
518
578
|
task.endTime = result.endTime;
|
|
579
|
+
const status = resolveBatchTaskStatus(result);
|
|
519
580
|
return {
|
|
520
|
-
code:
|
|
581
|
+
code: status === 'success' ? 0 : 1,
|
|
521
582
|
task,
|
|
522
|
-
status
|
|
583
|
+
status,
|
|
523
584
|
terminalOutput: result.terminalOutput,
|
|
524
585
|
};
|
|
525
586
|
});
|
|
@@ -563,7 +624,7 @@ class TaskOrchestrator {
|
|
|
563
624
|
async resolveCachedTasks(doNotSkipCache, tasks, groupId) {
|
|
564
625
|
if (!doNotSkipCache || tasks.length === 0)
|
|
565
626
|
return [];
|
|
566
|
-
const cacheableTasks = tasks.filter((t) =>
|
|
627
|
+
const cacheableTasks = tasks.filter((t) => t.cache);
|
|
567
628
|
if (cacheableTasks.length === 0)
|
|
568
629
|
return [];
|
|
569
630
|
// Wait for any queued processTask promises to settle so task.hash is
|
|
@@ -641,6 +702,7 @@ class TaskOrchestrator {
|
|
|
641
702
|
let resolveDiscreteExit;
|
|
642
703
|
const discreteExitHandled = new Promise((r) => (resolveDiscreteExit = r));
|
|
643
704
|
this.discreteTaskExitHandled.set(task.id, discreteExitHandled);
|
|
705
|
+
this.detectTaskInvocationLoop(task);
|
|
644
706
|
const childProcess = await this.runTask(task, streamOutput, env, temporaryOutputPath, pipeOutput);
|
|
645
707
|
this.runningDiscreteTasks.set(task.id, {
|
|
646
708
|
runningTask: childProcess,
|
|
@@ -850,6 +912,7 @@ class TaskOrchestrator {
|
|
|
850
912
|
? 'true'
|
|
851
913
|
: process.env.FORCE_COLOR, this.options.skipNxCache, this.options.captureStderr, null, null)
|
|
852
914
|
: (0, task_env_1.getEnvVariablesForTask)(task, taskSpecificEnv, undefined, this.options.skipNxCache, this.options.captureStderr, temporaryOutputPath, streamOutput);
|
|
915
|
+
this.detectTaskInvocationLoop(task);
|
|
853
916
|
const childProcess = await this.runTask(task, streamOutput, env, temporaryOutputPath, pipeOutput);
|
|
854
917
|
this.runningTasksService?.addRunningTask(task.id);
|
|
855
918
|
this.runningContinuousTasks.set(task.id, {
|
|
@@ -974,6 +1037,8 @@ class TaskOrchestrator {
|
|
|
974
1037
|
if (this.completedTasks.has(task.id))
|
|
975
1038
|
continue;
|
|
976
1039
|
this.completedTasks.set(task.id, status);
|
|
1040
|
+
this.taskInvocationTracker?.unregisterTask(task.id);
|
|
1041
|
+
this.registeredInvocations.delete(task.id);
|
|
977
1042
|
if (this.tuiEnabled) {
|
|
978
1043
|
this.options.lifeCycle.setTaskStatus(task.id, displayStatus ?? (0, native_1.parseTaskStatus)(status));
|
|
979
1044
|
}
|
|
@@ -1028,7 +1093,7 @@ class TaskOrchestrator {
|
|
|
1028
1093
|
}
|
|
1029
1094
|
}
|
|
1030
1095
|
shouldCacheTaskResult(task, code) {
|
|
1031
|
-
return (
|
|
1096
|
+
return (task.cache &&
|
|
1032
1097
|
(process.env.NX_CACHE_FAILURES == 'true' ? true : code === 0));
|
|
1033
1098
|
}
|
|
1034
1099
|
closeGroup() {
|
|
@@ -1076,11 +1141,21 @@ class TaskOrchestrator {
|
|
|
1076
1141
|
const reason = stoppingReason === 'fulfilled' ? 'fulfilled' : 'interrupted';
|
|
1077
1142
|
await this.completeContinuousTask(task, groupId, ownsRunningTasksService, reason);
|
|
1078
1143
|
}
|
|
1144
|
+
else if (!this.isContinuousTaskNeeded(task.id)) {
|
|
1145
|
+
// No remaining tasks depend on this — the task was about to be
|
|
1146
|
+
// killed by cleanUpUnneededContinuousTasks anyway.
|
|
1147
|
+
await this.completeContinuousTask(task, groupId, ownsRunningTasksService, 'fulfilled');
|
|
1148
|
+
}
|
|
1079
1149
|
else {
|
|
1080
1150
|
console.error(`Task "${task.id}" is continuous but exited with code ${code}`);
|
|
1081
1151
|
await this.completeContinuousTask(task, groupId, ownsRunningTasksService, 'crashed');
|
|
1082
1152
|
}
|
|
1083
1153
|
}
|
|
1154
|
+
isContinuousTaskNeeded(taskId) {
|
|
1155
|
+
return this.tasksSchedule
|
|
1156
|
+
.getIncompleteTasks()
|
|
1157
|
+
.some((t) => this.taskGraph.continuousDependencies[t.id]?.includes(taskId));
|
|
1158
|
+
}
|
|
1084
1159
|
async completeContinuousTask(task, groupId, ownsRunningTasksService, reason) {
|
|
1085
1160
|
if (this.completedTasks.has(task.id))
|
|
1086
1161
|
return;
|
|
@@ -1134,9 +1209,11 @@ class TaskOrchestrator {
|
|
|
1134
1209
|
continue;
|
|
1135
1210
|
await this.completeContinuousTask(task, groupId, ownsRunningTasksService, reason);
|
|
1136
1211
|
}
|
|
1137
|
-
// Kill all processes
|
|
1138
|
-
this.forkedProcessTaskRunner.cleanup();
|
|
1212
|
+
// Kill all processes — await forked runner cleanup for graceful shutdown
|
|
1213
|
+
const forkedCleanup = this.forkedProcessTaskRunner.cleanup();
|
|
1214
|
+
const continuousTaskIds = new Set(continuousSnapshot.map(([id]) => id));
|
|
1139
1215
|
await Promise.all([
|
|
1216
|
+
forkedCleanup,
|
|
1140
1217
|
...continuousSnapshot.map(async ([taskId, { runningTask }]) => {
|
|
1141
1218
|
try {
|
|
1142
1219
|
await runningTask.kill();
|
|
@@ -1153,7 +1230,10 @@ class TaskOrchestrator {
|
|
|
1153
1230
|
console.error(`Unable to terminate ${taskId}\nError:`, e);
|
|
1154
1231
|
}
|
|
1155
1232
|
}),
|
|
1156
|
-
|
|
1233
|
+
// Skip tasks already killed via continuousSnapshot to avoid duplicate signals
|
|
1234
|
+
...Array.from(this.runningRunCommandsTasks)
|
|
1235
|
+
.filter(([taskId]) => !continuousTaskIds.has(taskId))
|
|
1236
|
+
.map(async ([taskId, t]) => {
|
|
1157
1237
|
try {
|
|
1158
1238
|
await t.kill();
|
|
1159
1239
|
}
|
|
@@ -1168,19 +1248,26 @@ class TaskOrchestrator {
|
|
|
1168
1248
|
await Promise.all(this.discreteTaskExitHandled.values());
|
|
1169
1249
|
}
|
|
1170
1250
|
setupSignalHandlers() {
|
|
1171
|
-
process.
|
|
1251
|
+
// Use process.on (not once) so the handler stays registered and absorbs
|
|
1252
|
+
// re-raised signals from signal-exit. Without this, signal-exit's handler
|
|
1253
|
+
// sees no remaining listeners after our once-handler auto-removes, and
|
|
1254
|
+
// re-raises the signal — killing the process before async cleanup completes.
|
|
1255
|
+
// The cleanup() idempotency guard (cleanupPromise) prevents double execution.
|
|
1256
|
+
const handleSignal = (signal) => {
|
|
1257
|
+
if (this.stopRequested)
|
|
1258
|
+
return;
|
|
1172
1259
|
this.stopRequested = true;
|
|
1173
1260
|
if (!this.tuiEnabled) {
|
|
1174
1261
|
// Synchronously remove DB entries before async cleanup to prevent
|
|
1175
1262
|
// new nx processes from seeing stale "Waiting for ..." messages.
|
|
1176
|
-
// This replicates the cleanup that process.exit() + Rust Drop
|
|
1177
|
-
// previously provided.
|
|
1178
1263
|
for (const [taskId, { ownsRunningTasksService }] of this
|
|
1179
1264
|
.runningContinuousTasks) {
|
|
1180
1265
|
if (ownsRunningTasksService) {
|
|
1181
1266
|
this.runningTasksService?.removeRunningTask(taskId);
|
|
1182
1267
|
}
|
|
1183
1268
|
}
|
|
1269
|
+
}
|
|
1270
|
+
if (signal === 'SIGINT' && !this.tuiEnabled) {
|
|
1184
1271
|
// Silence output — pnpm (and similar wrappers) may exit before nx
|
|
1185
1272
|
// finishes cleanup, returning the shell prompt. Any output after
|
|
1186
1273
|
// that point would appear after the prompt.
|
|
@@ -1197,26 +1284,13 @@ class TaskOrchestrator {
|
|
|
1197
1284
|
this.resolveStopPromise();
|
|
1198
1285
|
}
|
|
1199
1286
|
else {
|
|
1200
|
-
process.exit((0, exit_codes_1.signalToCode)(
|
|
1201
|
-
}
|
|
1202
|
-
});
|
|
1203
|
-
});
|
|
1204
|
-
process.once('SIGTERM', () => {
|
|
1205
|
-
this.stopRequested = true;
|
|
1206
|
-
this.cleanup().finally(() => {
|
|
1207
|
-
if (this.resolveStopPromise) {
|
|
1208
|
-
this.resolveStopPromise();
|
|
1209
|
-
}
|
|
1210
|
-
});
|
|
1211
|
-
});
|
|
1212
|
-
process.once('SIGHUP', () => {
|
|
1213
|
-
this.stopRequested = true;
|
|
1214
|
-
this.cleanup().finally(() => {
|
|
1215
|
-
if (this.resolveStopPromise) {
|
|
1216
|
-
this.resolveStopPromise();
|
|
1287
|
+
process.exit((0, exit_codes_1.signalToCode)(signal));
|
|
1217
1288
|
}
|
|
1218
1289
|
});
|
|
1219
|
-
}
|
|
1290
|
+
};
|
|
1291
|
+
process.on('SIGINT', () => handleSignal('SIGINT'));
|
|
1292
|
+
process.on('SIGTERM', () => handleSignal('SIGTERM'));
|
|
1293
|
+
process.on('SIGHUP', () => handleSignal('SIGHUP'));
|
|
1220
1294
|
}
|
|
1221
1295
|
cleanUpUnneededContinuousTasks() {
|
|
1222
1296
|
const incompleteTasks = this.tasksSchedule.getIncompleteTasks();
|
|
@@ -223,9 +223,9 @@ class TasksSchedule {
|
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
225
|
canBatchTaskBeScheduled(task, batchTaskGraph) {
|
|
226
|
-
// task self needs to
|
|
226
|
+
// task self needs to support parallelism (undefined defaults to parallel)
|
|
227
227
|
// all deps have either completed or belong to the same batch
|
|
228
|
-
return (task.parallelism
|
|
228
|
+
return (task.parallelism !== false &&
|
|
229
229
|
this.taskGraph.dependencies[task.id].every((id) => this.completedTasks.has(id) || !!batchTaskGraph?.tasks[id]));
|
|
230
230
|
}
|
|
231
231
|
canBeScheduled(taskId) {
|
|
@@ -248,7 +248,7 @@ class TasksSchedule {
|
|
|
248
248
|
}
|
|
249
249
|
else {
|
|
250
250
|
// if all running tasks support parallelism, can only schedule task with parallelism
|
|
251
|
-
return this.taskGraph.tasks[taskId].parallelism
|
|
251
|
+
return this.taskGraph.tasks[taskId].parallelism !== false;
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
254
|
getEstimatedTaskTimings() {
|
|
@@ -2,6 +2,7 @@ import { CustomHasher, ExecutorConfig } from '../config/misc-interfaces';
|
|
|
2
2
|
import { ProjectGraph, ProjectGraphProjectNode } from '../config/project-graph';
|
|
3
3
|
import { Task, TaskGraph } from '../config/task-graph';
|
|
4
4
|
import { ProjectConfiguration, TargetConfiguration, TargetDependencyConfig } from '../config/workspace-json-project-json';
|
|
5
|
+
import { LegacyDependsOnLocation } from './legacy-depends-on-warning';
|
|
5
6
|
export type NormalizedTargetDependencyConfig = TargetDependencyConfig & {
|
|
6
7
|
projects: string[];
|
|
7
8
|
};
|
|
@@ -9,8 +10,9 @@ export declare function getDependencyConfigs({ project, target }: {
|
|
|
9
10
|
project: string;
|
|
10
11
|
target: string;
|
|
11
12
|
}, extraTargetDependencies: Record<string, (TargetDependencyConfig | string)[]>, projectGraph: ProjectGraph, allTargetNames: string[]): NormalizedTargetDependencyConfig[] | undefined;
|
|
12
|
-
export
|
|
13
|
-
export declare function
|
|
13
|
+
export type DependsOnEntryLocation = LegacyDependsOnLocation;
|
|
14
|
+
export declare function normalizeDependencyConfigDefinition(definition: string | TargetDependencyConfig, currentProject: string, graph: ProjectGraph, allTargetNames: string[], location?: DependsOnEntryLocation): NormalizedTargetDependencyConfig[];
|
|
15
|
+
export declare function normalizeDependencyConfigProjects(dependencyConfig: TargetDependencyConfig, currentProject: string, graph: ProjectGraph, location?: DependsOnEntryLocation): NormalizedTargetDependencyConfig;
|
|
14
16
|
export declare function expandDependencyConfigSyntaxSugar(dependencyConfigString: string | TargetDependencyConfig, graph: ProjectGraph, currentProject?: string): TargetDependencyConfig;
|
|
15
17
|
export declare function expandWildcardTargetConfiguration(dependencyConfig: NormalizedTargetDependencyConfig, allTargetNames: string[]): NormalizedTargetDependencyConfig[];
|
|
16
18
|
export declare function readProjectAndTargetFromTargetString(targetString: string, projects: Record<string, ProjectGraphProjectNode>, currentProject?: string): {
|
|
@@ -18,8 +20,8 @@ export declare function readProjectAndTargetFromTargetString(targetString: strin
|
|
|
18
20
|
target: string;
|
|
19
21
|
};
|
|
20
22
|
export declare function getOutputs(p: Record<string, ProjectGraphProjectNode>, target: Task['target'], overrides: Task['overrides']): string[];
|
|
21
|
-
export declare function normalizeTargetDependencyWithStringProjects(dependencyConfig: TargetDependencyConfig): Omit<TargetDependencyConfig, 'projects'> & {
|
|
22
|
-
projects
|
|
23
|
+
export declare function normalizeTargetDependencyWithStringProjects(dependencyConfig: TargetDependencyConfig, currentProject?: string, location?: DependsOnEntryLocation): Omit<TargetDependencyConfig, 'projects'> & {
|
|
24
|
+
projects?: string[];
|
|
23
25
|
};
|
|
24
26
|
export declare function validateOutputs(outputs: string[]): void;
|
|
25
27
|
export declare function transformLegacyOutputs(projectRoot: string, outputs: string[]): string[];
|
|
@@ -50,12 +52,9 @@ export declare function getCustomHasher(task: Task, projects: Record<string, Pro
|
|
|
50
52
|
export declare function removeTasksFromTaskGraph(graph: TaskGraph, ids: string[]): TaskGraph;
|
|
51
53
|
export declare function calculateReverseDeps(taskGraph: TaskGraph): Record<string, string[]>;
|
|
52
54
|
export declare function getCliPath(): string;
|
|
55
|
+
export declare function getUnparsedOverrideArgs(task: Task): string[];
|
|
53
56
|
export declare function getPrintableCommandArgsForTask(task: Task): string[];
|
|
54
57
|
export declare function getSerializedArgsForTask(task: Task, isVerbose: boolean): string[];
|
|
55
58
|
export declare function shouldStreamOutput(task: Task, initiatingProject: string | null): boolean;
|
|
56
|
-
export declare function isCacheableTask(task: Task, options: {
|
|
57
|
-
cacheableOperations?: string[] | null;
|
|
58
|
-
cacheableTargets?: string[] | null;
|
|
59
|
-
}): boolean;
|
|
60
59
|
export declare function unparse(options: Object): string[];
|
|
61
60
|
export declare function createTaskId(project: string, target: string, configuration: string | undefined): string;
|
|
@@ -20,10 +20,10 @@ exports.getCustomHasher = getCustomHasher;
|
|
|
20
20
|
exports.removeTasksFromTaskGraph = removeTasksFromTaskGraph;
|
|
21
21
|
exports.calculateReverseDeps = calculateReverseDeps;
|
|
22
22
|
exports.getCliPath = getCliPath;
|
|
23
|
+
exports.getUnparsedOverrideArgs = getUnparsedOverrideArgs;
|
|
23
24
|
exports.getPrintableCommandArgsForTask = getPrintableCommandArgsForTask;
|
|
24
25
|
exports.getSerializedArgsForTask = getSerializedArgsForTask;
|
|
25
26
|
exports.shouldStreamOutput = shouldStreamOutput;
|
|
26
|
-
exports.isCacheableTask = isCacheableTask;
|
|
27
27
|
exports.unparse = unparse;
|
|
28
28
|
exports.createTaskId = createTaskId;
|
|
29
29
|
const minimatch_1 = require("minimatch");
|
|
@@ -33,6 +33,7 @@ const executor_utils_1 = require("../command-line/run/executor-utils");
|
|
|
33
33
|
const native_1 = require("../native");
|
|
34
34
|
const fileutils_1 = require("../utils/fileutils");
|
|
35
35
|
const find_matching_projects_1 = require("../utils/find-matching-projects");
|
|
36
|
+
const legacy_depends_on_warning_1 = require("./legacy-depends-on-warning");
|
|
36
37
|
const globs_1 = require("../utils/globs");
|
|
37
38
|
const path_1 = require("../utils/path");
|
|
38
39
|
const serialize_overrides_into_command_line_1 = require("../utils/serialize-overrides-into-command-line");
|
|
@@ -40,17 +41,21 @@ const split_target_1 = require("../utils/split-target");
|
|
|
40
41
|
const workspace_root_1 = require("../utils/workspace-root");
|
|
41
42
|
const is_tui_enabled_1 = require("./is-tui-enabled");
|
|
42
43
|
function getDependencyConfigs({ project, target }, extraTargetDependencies, projectGraph, allTargetNames) {
|
|
44
|
+
const legacyViolations = [];
|
|
43
45
|
const dependencyConfigs = (projectGraph.nodes[project].data?.targets[target]?.dependsOn ??
|
|
44
46
|
// This is passed into `run-command` from programmatic invocations
|
|
45
47
|
extraTargetDependencies[target] ??
|
|
46
|
-
[]).flatMap((config) => normalizeDependencyConfigDefinition(config, project, projectGraph, allTargetNames));
|
|
48
|
+
[]).flatMap((config, index) => normalizeDependencyConfigDefinition(config, project, projectGraph, allTargetNames, { ownerTarget: target, index, legacyViolations }));
|
|
49
|
+
if (legacyViolations.length) {
|
|
50
|
+
(0, legacy_depends_on_warning_1.flushLegacyDependsOnViolations)(project, target, legacyViolations, projectGraph.nodes[project]?.data?.root);
|
|
51
|
+
}
|
|
47
52
|
return dependencyConfigs;
|
|
48
53
|
}
|
|
49
|
-
function normalizeDependencyConfigDefinition(definition, currentProject, graph, allTargetNames) {
|
|
50
|
-
return expandWildcardTargetConfiguration(normalizeDependencyConfigProjects(expandDependencyConfigSyntaxSugar(definition, graph, currentProject), currentProject, graph), allTargetNames);
|
|
54
|
+
function normalizeDependencyConfigDefinition(definition, currentProject, graph, allTargetNames, location) {
|
|
55
|
+
return expandWildcardTargetConfiguration(normalizeDependencyConfigProjects(expandDependencyConfigSyntaxSugar(definition, graph, currentProject), currentProject, graph, location), allTargetNames);
|
|
51
56
|
}
|
|
52
|
-
function normalizeDependencyConfigProjects(dependencyConfig, currentProject, graph) {
|
|
53
|
-
const noStringConfig = normalizeTargetDependencyWithStringProjects(dependencyConfig);
|
|
57
|
+
function normalizeDependencyConfigProjects(dependencyConfig, currentProject, graph, location) {
|
|
58
|
+
const noStringConfig = normalizeTargetDependencyWithStringProjects(dependencyConfig, currentProject, location);
|
|
54
59
|
if (noStringConfig.projects) {
|
|
55
60
|
dependencyConfig.projects = (0, find_matching_projects_1.findMatchingProjects)(noStringConfig.projects, graph.nodes);
|
|
56
61
|
}
|
|
@@ -125,23 +130,19 @@ function readProjectAndTargetFromTargetString(targetString, projects, currentPro
|
|
|
125
130
|
function getOutputs(p, target, overrides) {
|
|
126
131
|
return getOutputsForTargetAndConfiguration(target, overrides, p[target.project]);
|
|
127
132
|
}
|
|
128
|
-
function normalizeTargetDependencyWithStringProjects(dependencyConfig) {
|
|
133
|
+
function normalizeTargetDependencyWithStringProjects(dependencyConfig, currentProject, location) {
|
|
129
134
|
if (typeof dependencyConfig.projects === 'string') {
|
|
130
|
-
|
|
131
|
-
//
|
|
132
|
-
//
|
|
133
|
-
//
|
|
134
|
-
// This should have been removed in v17, but the updates to lerna had not
|
|
135
|
-
// been made yet.
|
|
136
|
-
//
|
|
137
|
-
// TODO(@agentender): Remove this part in v20
|
|
135
|
+
// TODO(v24): Remove the `self` / `dependencies` magic-string shim.
|
|
136
|
+
// The v16 `update-depends-on-to-tokens` migration already rewrites
|
|
137
|
+
// these to the modern shape, and `nx repair` will re-run it on demand.
|
|
138
138
|
if (dependencyConfig.projects === 'self') {
|
|
139
|
+
(0, legacy_depends_on_warning_1.warnLegacyDependsOnMagicString)(currentProject, dependencyConfig, location);
|
|
139
140
|
delete dependencyConfig.projects;
|
|
140
141
|
}
|
|
141
142
|
else if (dependencyConfig.projects === 'dependencies') {
|
|
143
|
+
(0, legacy_depends_on_warning_1.warnLegacyDependsOnMagicString)(currentProject, dependencyConfig, location);
|
|
142
144
|
dependencyConfig.dependencies = true;
|
|
143
145
|
delete dependencyConfig.projects;
|
|
144
|
-
/** LERNA SUPPORT END - Remove in v20 */
|
|
145
146
|
}
|
|
146
147
|
else {
|
|
147
148
|
dependencyConfig.projects = [dependencyConfig.projects];
|
|
@@ -206,7 +207,7 @@ function transformLegacyOutputs(projectRoot, outputs) {
|
|
|
206
207
|
function getOutputsForTargetAndConfiguration(taskTargetOrTask, overridesOrNode, node) {
|
|
207
208
|
const taskTarget = 'id' in taskTargetOrTask ? taskTargetOrTask.target : taskTargetOrTask;
|
|
208
209
|
const overrides = 'id' in taskTargetOrTask ? taskTargetOrTask.overrides : overridesOrNode;
|
|
209
|
-
node = 'id' in taskTargetOrTask ? overridesOrNode : node;
|
|
210
|
+
node = ('id' in taskTargetOrTask ? overridesOrNode : node);
|
|
210
211
|
const { target, configuration } = taskTarget;
|
|
211
212
|
const targetConfiguration = node.data.targets[target];
|
|
212
213
|
const options = {
|
|
@@ -385,8 +386,12 @@ function calculateReverseDeps(taskGraph) {
|
|
|
385
386
|
function getCliPath() {
|
|
386
387
|
return require.resolve(`../../bin/run-executor.js`);
|
|
387
388
|
}
|
|
389
|
+
function getUnparsedOverrideArgs(task) {
|
|
390
|
+
return task.overrides
|
|
391
|
+
.__overrides_unparsed__;
|
|
392
|
+
}
|
|
388
393
|
function getPrintableCommandArgsForTask(task) {
|
|
389
|
-
const args = task
|
|
394
|
+
const args = getUnparsedOverrideArgs(task);
|
|
390
395
|
const target = task.target.target.includes(':')
|
|
391
396
|
? `"${task.target.target}"`
|
|
392
397
|
: task.target.target;
|
|
@@ -418,15 +423,6 @@ function shouldStreamOutput(task, initiatingProject) {
|
|
|
418
423
|
return true;
|
|
419
424
|
return false;
|
|
420
425
|
}
|
|
421
|
-
function isCacheableTask(task, options) {
|
|
422
|
-
if (task.cache !== undefined) {
|
|
423
|
-
return task.cache;
|
|
424
|
-
}
|
|
425
|
-
const cacheable = options.cacheableOperations || options.cacheableTargets;
|
|
426
|
-
return (cacheable &&
|
|
427
|
-
cacheable.indexOf(task.target.target) > -1 &&
|
|
428
|
-
!longRunningTask(task));
|
|
429
|
-
}
|
|
430
426
|
function longRunningTask(task) {
|
|
431
427
|
const t = task.target.target;
|
|
432
428
|
return (task.continuous ||
|