@ohos-ports/nx 23.3.0-beta.2 → 24.0.2-beta.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.
- package/README.md +3 -6
- package/dist/bin/nx.js +2 -2
- package/dist/bin/post-install.js +5 -3
- package/dist/nx-cloud-internals.d.ts +1 -0
- package/dist/nx-cloud-internals.js +7 -1
- package/dist/src/adapter/ngcli-adapter.js +2 -2
- package/dist/src/ai/clone-ai-config-repo.js +49 -12
- package/dist/src/command-line/add/add.d.ts +2 -0
- package/dist/src/command-line/add/add.js +23 -5
- package/dist/src/command-line/affected/affected.js +2 -2
- package/dist/src/command-line/configure-ai-agents/configure-ai-agents.js +0 -12
- package/dist/src/command-line/graph/graph.js +38 -10
- package/dist/src/command-line/init/command-object.js +0 -12
- package/dist/src/command-line/init/implementation/add-nx-to-nest.js +21 -62
- package/dist/src/command-line/init/init-v2.js +0 -2
- package/dist/src/command-line/migrate/agentic/close-agent-session.d.ts +1 -1
- package/dist/src/command-line/migrate/agentic/close-agent-session.js +4 -3
- package/dist/src/command-line/migrate/agentic/definitions.d.ts +1 -3
- package/dist/src/command-line/migrate/agentic/definitions.js +5 -97
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +7 -45
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +9 -51
- package/dist/src/command-line/migrate/agentic/handoff.d.ts +1 -43
- package/dist/src/command-line/migrate/agentic/handoff.js +3 -119
- package/dist/src/command-line/migrate/agentic/instruction-files.d.ts +0 -21
- package/dist/src/command-line/migrate/agentic/instruction-files.js +6 -27
- package/dist/src/command-line/migrate/agentic/master/run-master-session.d.ts +19 -1
- package/dist/src/command-line/migrate/agentic/master/run-master-session.js +88 -49
- package/dist/src/command-line/migrate/agentic/master/spawn-master.d.ts +1 -0
- package/dist/src/command-line/migrate/agentic/master/spawn-master.js +86 -24
- package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.d.ts +2 -2
- package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.js +2 -2
- package/dist/src/command-line/migrate/agentic/prompts/fragments.d.ts +1 -12
- package/dist/src/command-line/migrate/agentic/prompts/fragments.js +8 -17
- package/dist/src/command-line/migrate/agentic/prompts/shared-rendering.d.ts +0 -15
- package/dist/src/command-line/migrate/agentic/prompts/shared-rendering.js +3 -100
- package/dist/src/command-line/migrate/agentic/select.d.ts +12 -6
- package/dist/src/command-line/migrate/agentic/select.js +38 -8
- package/dist/src/command-line/migrate/agentic/types.d.ts +9 -68
- package/dist/src/command-line/migrate/agentic/types.js +6 -8
- package/dist/src/command-line/migrate/command-object.js +6 -10
- package/dist/src/command-line/migrate/execute-migration.d.ts +6 -6
- package/dist/src/command-line/migrate/execute-migration.js +25 -15
- package/dist/src/command-line/migrate/migrate-analytics.d.ts +18 -1
- package/dist/src/command-line/migrate/migrate-analytics.js +38 -0
- package/dist/src/command-line/migrate/migrate-commits.d.ts +29 -17
- package/dist/src/command-line/migrate/migrate-commits.js +86 -32
- package/dist/src/command-line/migrate/migrate-config.d.ts +6 -6
- package/dist/src/command-line/migrate/migrate-config.js +12 -6
- package/dist/src/command-line/migrate/migrate-output.d.ts +1 -6
- package/dist/src/command-line/migrate/migrate-output.js +1 -10
- package/dist/src/command-line/migrate/migrate.d.ts +6 -30
- package/dist/src/command-line/migrate/migrate.js +257 -255
- package/dist/src/command-line/migrate/resolve-package-version.d.ts +2 -4
- package/dist/src/command-line/migrate/resolve-package-version.js +2 -35
- package/dist/src/command-line/migrate/run/agent-output.d.ts +2 -0
- package/dist/src/command-line/migrate/run/agent-output.js +9 -0
- package/dist/src/command-line/migrate/run/broker.d.ts +14 -5
- package/dist/src/command-line/migrate/run/broker.js +69 -21
- package/dist/src/command-line/migrate/run/clean-retry.js +4 -2
- package/dist/src/command-line/migrate/run/existing-run-report.d.ts +1 -1
- package/dist/src/command-line/migrate/run/existing-run-report.js +7 -5
- package/dist/src/command-line/migrate/run/give-up.d.ts +4 -3
- package/dist/src/command-line/migrate/run/give-up.js +8 -5
- package/dist/src/command-line/migrate/run/index.d.ts +7 -5
- package/dist/src/command-line/migrate/run/index.js +16 -1
- package/dist/src/command-line/migrate/run/issues.js +7 -2
- package/dist/src/command-line/migrate/run/orchestrator.d.ts +61 -4
- package/dist/src/command-line/migrate/run/orchestrator.js +397 -133
- package/dist/src/command-line/migrate/run/run-state.d.ts +17 -1
- package/dist/src/command-line/migrate/run/run-state.js +41 -2
- package/dist/src/command-line/migrate/run/runbook.d.ts +1 -0
- package/dist/src/command-line/migrate/run/runbook.js +115 -18
- package/dist/src/command-line/migrate/run/state-lock.d.ts +29 -4
- package/dist/src/command-line/migrate/run/state-lock.js +102 -10
- package/dist/src/command-line/migrate/run/state-machine.js +4 -1
- package/dist/src/command-line/migrate/run/util.d.ts +7 -2
- package/dist/src/command-line/migrate/run/util.js +30 -3
- package/dist/src/command-line/migrate/run/worker.d.ts +1 -1
- package/dist/src/command-line/migrate/run/worker.js +252 -250
- package/dist/src/command-line/migrate/sort-migrations.d.ts +1 -7
- package/dist/src/command-line/migrate/sort-migrations.js +1 -12
- package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +17 -12
- package/dist/src/command-line/release/changelog.js +9 -6
- package/dist/src/command-line/release/config/config.d.ts +1 -0
- package/dist/src/command-line/release/config/config.js +48 -9
- package/dist/src/command-line/release/release.js +2 -2
- package/dist/src/command-line/release/utils/git.js +8 -7
- package/dist/src/command-line/release/utils/interpolate-release-config.d.ts +6 -0
- package/dist/src/command-line/release/utils/interpolate-release-config.js +39 -0
- package/dist/src/command-line/release/utils/release-graph.d.ts +5 -0
- package/dist/src/command-line/release/utils/release-graph.js +1 -0
- package/dist/src/command-line/release/utils/remote-release-clients/github.js +5 -6
- package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +5 -6
- package/dist/src/command-line/release/utils/resolve-changelog-renderer.js +2 -2
- package/dist/src/command-line/release/utils/shared.js +10 -10
- package/dist/src/command-line/release/utils/version-plan-utils.d.ts +3 -12
- package/dist/src/command-line/release/utils/version-plan-utils.js +33 -55
- package/dist/src/command-line/release/version/version-actions.js +2 -1
- package/dist/src/command-line/release/version.js +5 -2
- package/dist/src/command-line/reset/reset.js +58 -62
- package/dist/src/command-line/run/executor-utils.js +1 -0
- package/dist/src/command-line/run/run-one.d.ts +20 -1
- package/dist/src/command-line/run/run-one.js +153 -5
- package/dist/src/command-line/run/run.js +2 -1
- package/dist/src/command-line/show/projects.js +5 -3
- package/dist/src/command-line/show/show-target/info.d.ts +10 -1
- package/dist/src/command-line/show/show-target/info.js +100 -15
- package/dist/src/command-line/show/show-target/inputs.js +10 -2
- package/dist/src/command-line/show/show-target/utils.js +1 -0
- package/dist/src/command-line/watch/command-object.js +3 -22
- package/dist/src/command-line/watch/watch.d.ts +0 -7
- package/dist/src/command-line/watch/watch.js +1 -1
- package/dist/src/command-line/yargs-utils/shared-options.js +1 -1
- package/dist/src/config/misc-interfaces.d.ts +18 -0
- package/dist/src/config/nx-json.d.ts +22 -11
- package/dist/src/config/task-graph.d.ts +1 -1
- package/dist/src/config/workspace-json-project-json.d.ts +88 -0
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/core/graph/runtime.js +1 -1
- package/dist/src/core/graph/styles.css +1 -1
- package/dist/src/core/graph/styles.js +1 -1
- package/dist/src/daemon/client/client.d.ts +15 -0
- package/dist/src/daemon/client/client.js +181 -71
- package/dist/src/daemon/client/daemon-socket-messenger.d.ts +1 -1
- package/dist/src/daemon/client/daemon-socket-messenger.js +2 -2
- package/dist/src/daemon/server/client-socket-context.js +1 -1
- package/dist/src/daemon/server/handle-process-in-background.js +21 -9
- package/dist/src/daemon/server/handle-select-affected-tasks.d.ts +2 -1
- package/dist/src/daemon/server/handle-select-affected-tasks.js +21 -13
- package/dist/src/daemon/server/native-js-loader.d.ts +1 -0
- package/dist/src/daemon/server/native-js-loader.js +21 -0
- package/dist/src/daemon/server/project-graph-incremental-recomputation.js +4 -8
- package/dist/src/daemon/server/server.d.ts +2 -1
- package/dist/src/daemon/server/server.js +17 -4
- package/dist/src/daemon/server/shutdown-utils.js +0 -3
- package/dist/src/daemon/server/start.d.ts +1 -0
- package/dist/src/daemon/server/start.js +2 -0
- package/dist/src/daemon/socket-utils.d.ts +11 -9
- package/dist/src/daemon/socket-utils.js +31 -61
- package/dist/src/daemon/tmp-dir.d.ts +19 -14
- package/dist/src/daemon/tmp-dir.js +142 -354
- package/dist/src/devkit-exports.d.ts +9 -1
- package/dist/src/devkit-exports.js +12 -1
- package/dist/src/devkit-internals.d.ts +6 -5
- package/dist/src/devkit-internals.js +13 -4
- package/dist/src/executors/run-commands/run-commands.impl.d.ts +4 -2
- package/dist/src/executors/run-commands/run-commands.impl.js +53 -27
- package/dist/src/executors/run-commands/running-tasks.d.ts +13 -4
- package/dist/src/executors/run-commands/running-tasks.js +148 -95
- package/dist/src/executors/run-commands/schema.json +1 -1
- package/dist/src/hasher/check-task-files.js +5 -8
- package/dist/src/hasher/file-hasher.js +9 -7
- package/dist/src/hasher/hash-task.js +4 -0
- package/dist/src/hasher/native-task-hasher-impl.js +3 -1
- package/dist/src/hasher/task-hasher.d.ts +2 -0
- package/dist/src/hasher/task-hasher.js +4 -1
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.d.ts +1 -2
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.js +6 -11
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.md +2 -2
- package/dist/src/migrations/update-24-0-0/enable-legacy-affected.d.ts +4 -0
- package/dist/src/migrations/update-24-0-0/enable-legacy-affected.js +15 -0
- package/dist/src/migrations/update-24-0-0/enable-legacy-affected.md +30 -0
- package/dist/src/migrations/update-24-0-0/find-custom-hashers.d.ts +3 -0
- package/dist/src/migrations/update-24-0-0/find-custom-hashers.js +100 -0
- package/dist/src/migrations/update-24-0-0/find-custom-hashers.md +63 -0
- package/dist/src/migrations/update-24-0-0/move-custom-hashers-to-inputs.md +146 -0
- package/dist/src/migrations/update-24-0-0/rename-ultracache-ignore-options.d.ts +3 -0
- package/dist/src/migrations/update-24-0-0/rename-ultracache-ignore-options.js +130 -0
- package/dist/src/migrations/update-24-0-0/rename-ultracache-ignore-options.md +62 -0
- package/dist/src/native/assert-supported-platform.js +1 -1
- package/dist/src/native/index.d.ts +238 -18
- package/dist/src/native/index.js +6 -1
- package/dist/src/native/native-bindings.js +15 -6
- package/dist/src/native/nx.openharmony-arm64.node +0 -0
- package/dist/src/native/nx.wasi-browser.js +1 -0
- package/dist/src/native/nx.wasi.cjs +1 -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/nx-cloud/update-manager.d.ts +14 -0
- package/dist/src/nx-cloud/update-manager.js +237 -50
- package/dist/src/plugins/js/lock-file/pnpm-parser.js +3 -4
- package/dist/src/plugins/js/lock-file/pruned-output.d.ts +2 -2
- package/dist/src/plugins/js/lock-file/pruned-output.js +4 -4
- package/dist/src/plugins/js/utils/register.js +9 -4
- package/dist/src/project-graph/affected/affected-tasks.d.ts +9 -6
- package/dist/src/project-graph/affected/affected-tasks.js +31 -7
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +7 -0
- package/dist/src/project-graph/plugins/loaded-nx-plugin.js +49 -6
- package/dist/src/project-graph/utils/project-configuration/target-merging.js +1 -1
- package/dist/src/project-graph/utils/project-configuration/target-normalization.js +12 -133
- package/dist/src/project-graph/utils/project-configuration-utils.js +2 -2
- package/dist/src/project-graph/utils/retrieve-workspace-files.js +27 -6
- package/dist/src/tasks-runner/create-task-graph.d.ts +8 -7
- package/dist/src/tasks-runner/create-task-graph.js +50 -27
- package/dist/src/tasks-runner/default-tasks-runner.js +1 -1
- package/dist/src/tasks-runner/init-tasks-runner.js +116 -59
- package/dist/src/tasks-runner/life-cycle.d.ts +4 -1
- package/dist/src/tasks-runner/life-cycle.js +7 -0
- package/dist/src/tasks-runner/life-cycles/performance-analysis.d.ts +5 -2
- package/dist/src/tasks-runner/life-cycles/performance-analysis.js +13 -7
- package/dist/src/tasks-runner/life-cycles/performance-life-cycle.d.ts +4 -3
- package/dist/src/tasks-runner/life-cycles/performance-life-cycle.js +9 -2
- package/dist/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +5 -2
- package/dist/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.js +4 -1
- package/dist/src/tasks-runner/life-cycles/summary-terminal-output-life-cycle.js +5 -1
- package/dist/src/tasks-runner/pseudo-ipc.d.ts +1 -0
- package/dist/src/tasks-runner/pseudo-ipc.js +4 -0
- package/dist/src/tasks-runner/pseudo-terminal.d.ts +1 -1
- package/dist/src/tasks-runner/pseudo-terminal.js +2 -2
- package/dist/src/tasks-runner/readiness/executor-ready-signal.d.ts +7 -0
- package/dist/src/tasks-runner/readiness/executor-ready-signal.js +43 -0
- package/dist/src/tasks-runner/readiness/probes.d.ts +14 -0
- package/dist/src/tasks-runner/readiness/probes.js +101 -0
- package/dist/src/tasks-runner/readiness/ready-signal-server.d.ts +18 -0
- package/dist/src/tasks-runner/readiness/ready-signal-server.js +72 -0
- package/dist/src/tasks-runner/readiness/ready-signal.d.ts +33 -0
- package/dist/src/tasks-runner/readiness/ready-signal.js +92 -0
- package/dist/src/tasks-runner/readiness/ready-when.d.ts +84 -0
- package/dist/src/tasks-runner/readiness/ready-when.js +371 -0
- package/dist/src/tasks-runner/readiness/startup-host.d.ts +1 -0
- package/dist/src/tasks-runner/readiness/startup-host.js +32 -0
- package/dist/src/tasks-runner/run-command.d.ts +6 -2
- package/dist/src/tasks-runner/run-command.js +21 -31
- package/dist/src/tasks-runner/run-outcome.d.ts +16 -0
- package/dist/src/tasks-runner/run-outcome.js +39 -0
- package/dist/src/tasks-runner/running-tasks/batch-process.js +6 -0
- package/dist/src/tasks-runner/running-tasks/node-child-process.js +5 -4
- package/dist/src/tasks-runner/running-tasks/running-task.d.ts +1 -1
- package/dist/src/tasks-runner/task-env.d.ts +10 -0
- package/dist/src/tasks-runner/task-env.js +37 -5
- package/dist/src/tasks-runner/task-graph-utils.d.ts +9 -6
- package/dist/src/tasks-runner/task-graph-utils.js +17 -12
- package/dist/src/tasks-runner/task-orchestrator.d.ts +62 -18
- package/dist/src/tasks-runner/task-orchestrator.js +750 -150
- package/dist/src/tasks-runner/tasks-runner.d.ts +1 -1
- package/dist/src/tasks-runner/tasks-schedule.d.ts +18 -1
- package/dist/src/tasks-runner/tasks-schedule.js +63 -6
- package/dist/src/tasks-runner/tokens.d.ts +54 -0
- package/dist/src/tasks-runner/tokens.js +161 -0
- package/dist/src/tasks-runner/utils.d.ts +35 -6
- package/dist/src/tasks-runner/utils.js +149 -68
- package/dist/src/ultracache/ci-status.d.ts +24 -0
- package/dist/src/ultracache/ci-status.js +87 -0
- package/dist/src/ultracache/config.d.ts +3 -3
- package/dist/src/ultracache/config.js +4 -4
- package/dist/src/ultracache/fetch.d.ts +2 -0
- package/dist/src/ultracache/fetch.js +1 -0
- package/dist/src/ultracache/overrides.js +4 -0
- package/dist/src/utils/acknowledge-build-scripts.d.ts +34 -1
- package/dist/src/utils/acknowledge-build-scripts.js +171 -32
- package/dist/src/utils/child-process.js +2 -1
- package/dist/src/utils/find-matching-projects.js +9 -6
- package/dist/src/utils/git-utils.d.ts +12 -5
- package/dist/src/utils/git-utils.js +69 -11
- package/dist/src/utils/long-running-target.d.ts +1 -3
- package/dist/src/utils/long-running-target.js +1 -3
- package/dist/src/utils/output.d.ts +4 -3
- package/dist/src/utils/output.js +4 -3
- package/dist/src/utils/owned-private-dir.d.ts +1 -17
- package/dist/src/utils/owned-private-dir.js +10 -62
- package/dist/src/utils/package-manager.d.ts +8 -0
- package/dist/src/utils/package-manager.js +65 -8
- package/dist/src/utils/perf-hooks.d.ts +1 -0
- package/dist/src/utils/plugins/core-plugins.js +5 -1
- package/dist/src/utils/progress-topics.d.ts +1 -0
- package/dist/src/utils/progress-topics.js +1 -0
- package/dist/src/utils/safe-spawn.js +1 -5
- package/dist/src/utils/shell-quoting.d.ts +8 -1
- package/dist/src/utils/shell-quoting.js +12 -1
- package/dist/src/utils/spawn-without-terminal.d.ts +27 -0
- package/dist/src/utils/spawn-without-terminal.js +110 -0
- package/dist/src/utils/string-similarity.d.ts +38 -0
- package/dist/src/utils/string-similarity.js +108 -0
- package/migrations.json +20 -6
- package/package.json +15 -24
- package/schemas/migrations-schema.json +11 -0
- package/schemas/nx-schema.json +133 -11
- package/schemas/project-schema.json +114 -4
- package/dist/src/command-line/migrate/agentic/prompts/generic-validation.d.ts +0 -56
- package/dist/src/command-line/migrate/agentic/prompts/generic-validation.js +0 -67
- package/dist/src/command-line/migrate/agentic/prompts/hybrid-prompt-migration.d.ts +0 -49
- package/dist/src/command-line/migrate/agentic/prompts/hybrid-prompt-migration.js +0 -53
- package/dist/src/command-line/migrate/agentic/prompts/prompt-migration.d.ts +0 -26
- package/dist/src/command-line/migrate/agentic/prompts/prompt-migration.js +0 -27
- package/dist/src/command-line/migrate/agentic/prompts/system-prompt.d.ts +0 -70
- package/dist/src/command-line/migrate/agentic/prompts/system-prompt.js +0 -113
- package/dist/src/command-line/migrate/agentic/run-step.d.ts +0 -68
- package/dist/src/command-line/migrate/agentic/run-step.js +0 -148
- package/dist/src/command-line/migrate/agentic/runner.d.ts +0 -21
- package/dist/src/command-line/migrate/agentic/runner.js +0 -262
- package/dist/src/migrations/update-23-0-0/consolidate-release-tag-config.d.ts +0 -9
- package/dist/src/migrations/update-23-0-0/consolidate-release-tag-config.js +0 -18
- package/dist/src/tasks-runner/legacy-depends-on-warning.d.ts +0 -18
- package/dist/src/tasks-runner/legacy-depends-on-warning.js +0 -109
|
@@ -32,17 +32,13 @@ class LoadedNxPlugin {
|
|
|
32
32
|
},
|
|
33
33
|
];
|
|
34
34
|
}
|
|
35
|
-
/**
|
|
36
|
-
* Wraps the plugin-provided createNodes function to provide performance
|
|
37
|
-
* measurement and error handling.
|
|
38
|
-
*/
|
|
39
35
|
if (this.createNodes) {
|
|
40
36
|
const inner = this.createNodes[1];
|
|
41
37
|
this.createNodes[1] = async (...args) => {
|
|
42
38
|
performance.mark(`${plugin.name}:createNodes - start`);
|
|
43
39
|
let projectCount = 0;
|
|
44
40
|
try {
|
|
45
|
-
const result = await inner(...args);
|
|
41
|
+
const result = (await inner(...args)).map(([pluginName, file, r]) => [pluginName, file, withoutUndefinedValues(r)]);
|
|
46
42
|
for (const [, , r] of result) {
|
|
47
43
|
projectCount += Object.keys(r.projects ?? {}).length;
|
|
48
44
|
}
|
|
@@ -50,7 +46,15 @@ class LoadedNxPlugin {
|
|
|
50
46
|
}
|
|
51
47
|
catch (e) {
|
|
52
48
|
if ((0, error_types_1.isAggregateCreateNodesError)(e)) {
|
|
53
|
-
|
|
49
|
+
const partialResults = e.partialResults.map(([file, r]) => [file, withoutUndefinedValues(r)]);
|
|
50
|
+
if (partialResults.every(([, r], i) => r === e.partialResults[i][1])) {
|
|
51
|
+
throw e;
|
|
52
|
+
}
|
|
53
|
+
// Fresh tuples, as the constructor coerces each error in place.
|
|
54
|
+
throw new error_types_1.AggregateCreateNodesError(e.errors.map(([file, error]) => [
|
|
55
|
+
file,
|
|
56
|
+
error,
|
|
57
|
+
]), partialResults);
|
|
54
58
|
}
|
|
55
59
|
// The underlying plugin errored out. We can't know any partial results.
|
|
56
60
|
throw new error_types_1.AggregateCreateNodesError([[null, e]], []);
|
|
@@ -115,3 +119,42 @@ class LoadedNxPlugin {
|
|
|
115
119
|
}
|
|
116
120
|
}
|
|
117
121
|
exports.LoadedNxPlugin = LoadedNxPlugin;
|
|
122
|
+
/**
|
|
123
|
+
* Drops `undefined` values (`null` in arrays) like the default JSON transport,
|
|
124
|
+
* so results from in-process plugins or the v8 serializer can't override an
|
|
125
|
+
* earlier plugin's value with `undefined`. Copies what it changes instead of
|
|
126
|
+
* writing to plugin-owned objects.
|
|
127
|
+
*/
|
|
128
|
+
function withoutUndefinedValues(value) {
|
|
129
|
+
if (value === null || typeof value !== 'object') {
|
|
130
|
+
return value;
|
|
131
|
+
}
|
|
132
|
+
if (Array.isArray(value)) {
|
|
133
|
+
let copy;
|
|
134
|
+
for (let i = 0; i < value.length; i++) {
|
|
135
|
+
const item = value[i];
|
|
136
|
+
const normalized = item === undefined ? null : withoutUndefinedValues(item);
|
|
137
|
+
if (!copy && normalized !== item) {
|
|
138
|
+
copy = value.slice(0, i);
|
|
139
|
+
}
|
|
140
|
+
copy?.push(normalized);
|
|
141
|
+
}
|
|
142
|
+
return (copy ?? value);
|
|
143
|
+
}
|
|
144
|
+
const record = value;
|
|
145
|
+
const keys = Object.keys(record);
|
|
146
|
+
let entries;
|
|
147
|
+
for (let i = 0; i < keys.length; i++) {
|
|
148
|
+
const item = record[keys[i]];
|
|
149
|
+
const normalized = item === undefined ? undefined : withoutUndefinedValues(item);
|
|
150
|
+
if (!entries && (item === undefined || normalized !== item)) {
|
|
151
|
+
entries = keys.slice(0, i).map((key) => [key, record[key]]);
|
|
152
|
+
}
|
|
153
|
+
if (entries && normalized !== undefined) {
|
|
154
|
+
entries.push([keys[i], normalized]);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// `Object.fromEntries` defines own properties, so a `__proto__` key stays
|
|
158
|
+
// a key instead of setting the copy's prototype.
|
|
159
|
+
return (entries ? Object.fromEntries(entries) : value);
|
|
160
|
+
}
|
|
@@ -141,7 +141,7 @@ function mergeConfigurationValue(newConfig, baseConfig, projectConfigSourceMap,
|
|
|
141
141
|
}
|
|
142
142
|
// `ultracache` keeps replace-unless-`'...'` semantics at the object level, but its
|
|
143
143
|
// values still have to be merged per key: neither the wholesale replace nor
|
|
144
|
-
// `mergeObjectWithSpread` recurses, so an `
|
|
144
|
+
// `mergeObjectWithSpread` recurses, so an `ignoreReads: ['...', 'tmp/**']`
|
|
145
145
|
// would otherwise reach the task graph with `'...'` intact — a glob matching
|
|
146
146
|
// nothing, silently dropping the inherited patterns.
|
|
147
147
|
function mergeUltracache(newUltracache, baseUltracache, projectConfigSourceMap, sourceInformation, targetIdentifier, deferSpreadsWithoutBase) {
|
|
@@ -5,8 +5,6 @@ exports.normalizeTarget = normalizeTarget;
|
|
|
5
5
|
exports.validateAndNormalizeProjectRootMap = validateAndNormalizeProjectRootMap;
|
|
6
6
|
const executor_utils_1 = require("../../../command-line/run/executor-utils");
|
|
7
7
|
const fileutils_1 = require("../../../utils/fileutils");
|
|
8
|
-
const long_running_target_1 = require("../../../utils/long-running-target");
|
|
9
|
-
const output_1 = require("../../../utils/output");
|
|
10
8
|
const to_project_name_1 = require("../../../config/to-project-name");
|
|
11
9
|
const error_types_1 = require("../../error-types");
|
|
12
10
|
const target_merging_1 = require("./target-merging");
|
|
@@ -69,114 +67,6 @@ function normalizeTarget(target, project, workspaceRoot, projectsMap, errorMsgKe
|
|
|
69
67
|
}
|
|
70
68
|
return target;
|
|
71
69
|
}
|
|
72
|
-
// TODO(v24): remove the legacy target-name cache fallback and its warning.
|
|
73
|
-
// Removal needs a second mechanism for plugin-inferred targets, which the
|
|
74
|
-
// accompanying migration cannot reach.
|
|
75
|
-
/**
|
|
76
|
-
* Whether `target` is cacheable only by way of the legacy name-based fallback:
|
|
77
|
-
* the exact target-name key of `targetDefaults` declares `cache: true`, but an
|
|
78
|
-
* executor key won target-default resolution instead, so the merged target never
|
|
79
|
-
* received it.
|
|
80
|
-
*
|
|
81
|
-
* A `true` result means the user's `cache: true` silently lost, so this doubles
|
|
82
|
-
* as the condition for warning them that the name key is being shadowed.
|
|
83
|
-
*/
|
|
84
|
-
function isLegacyCachedTarget(targetName, targetDefaults, target) {
|
|
85
|
-
// Resolution already decided `cache`, so the name key isn't shadowed.
|
|
86
|
-
if (target.cache !== undefined) {
|
|
87
|
-
return false;
|
|
88
|
-
}
|
|
89
|
-
if (isLongRunningTarget(targetName, target)) {
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
// Restricted to shadowing, which is narrower than what pre-23 restored: that
|
|
93
|
-
// derivation matched on target name alone, so a name key dropped as
|
|
94
|
-
// incompatible (its entry declared a foreign executor) was cacheable too.
|
|
95
|
-
// Restoring that as well would mean writing `cache` with no key to name in
|
|
96
|
-
// the warning, and no migration able to retire it. Deliberately not covered.
|
|
97
|
-
if (!findShadowingTargetDefaultKey(targetDefaults, target)) {
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
100
|
-
return declaresCacheTrue(targetDefaults?.[targetName]);
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Whether the name key declares `cache: true` on an entry that always applies.
|
|
104
|
-
*
|
|
105
|
-
* Filters are deliberately not evaluated. They cannot express a pre-23 config
|
|
106
|
-
* (the filtered array shape postdates the behavior being restored), and a
|
|
107
|
-
* filtered entry declaring `cache` may or may not apply to this project — so
|
|
108
|
-
* rather than guess, a filtered `cache` declares the value unknowable and
|
|
109
|
-
* nothing is restored. Among unfiltered entries the last wins, matching the
|
|
110
|
-
* in-key merge order.
|
|
111
|
-
*/
|
|
112
|
-
function declaresCacheTrue(value) {
|
|
113
|
-
if (!value) {
|
|
114
|
-
return false;
|
|
115
|
-
}
|
|
116
|
-
const entries = Array.isArray(value) ? value : [value];
|
|
117
|
-
let declared;
|
|
118
|
-
for (const entry of entries) {
|
|
119
|
-
// `nx.json` is hand-edited; a null or scalar entry would throw here.
|
|
120
|
-
if (!entry || typeof entry !== 'object')
|
|
121
|
-
continue;
|
|
122
|
-
if (entry.cache === undefined)
|
|
123
|
-
continue;
|
|
124
|
-
if (entry.filter)
|
|
125
|
-
return false;
|
|
126
|
-
declared = entry.cache;
|
|
127
|
-
}
|
|
128
|
-
return declared === true;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* The normalization-time half of the pre-23 `longRunningTask` guard, which kept
|
|
132
|
-
* `cacheableOperations` from ever making these cacheable. Its remaining clause
|
|
133
|
-
* — `task.overrides['watch']` — is a runtime invocation override with no target
|
|
134
|
-
* equivalent, so it has no counterpart here.
|
|
135
|
-
*/
|
|
136
|
-
function isLongRunningTarget(targetName, target) {
|
|
137
|
-
return !!target.continuous || (0, long_running_target_1.isLongRunningTargetName)(targetName);
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* The `targetDefaults` key that beat the target-name key for `target`. Only an
|
|
141
|
-
* executor key can: key precedence puts the exact target name ahead of every
|
|
142
|
-
* glob, so nothing else outranks it. Undefined when the name key lost for
|
|
143
|
-
* another reason (e.g. its entry declared a foreign executor and was dropped as
|
|
144
|
-
* incompatible) — see {@link isLegacyCachedTarget} for why that case is left
|
|
145
|
-
* alone even though pre-23 restored it.
|
|
146
|
-
*
|
|
147
|
-
* `hasOwnProperty` rather than a lookup: an executor named `__proto__` resolves
|
|
148
|
-
* through the prototype chain to a truthy object, which would report a key the
|
|
149
|
-
* user never wrote.
|
|
150
|
-
*/
|
|
151
|
-
function findShadowingTargetDefaultKey(targetDefaults, target) {
|
|
152
|
-
return target.executor &&
|
|
153
|
-
targetDefaults &&
|
|
154
|
-
Object.prototype.hasOwnProperty.call(targetDefaults, target.executor)
|
|
155
|
-
? target.executor
|
|
156
|
-
: undefined;
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Emits a single grouped warning for every (shadowing key, target-name key)
|
|
160
|
-
* pair that relied on the deprecated fallback. Grouping matters because the
|
|
161
|
-
* same pair recurs in every affected project — a per-target warning would
|
|
162
|
-
* print hundreds of identical lines in a large workspace.
|
|
163
|
-
*/
|
|
164
|
-
function warnAboutLegacyCachedTargets(legacyCacheReads) {
|
|
165
|
-
if (legacyCacheReads.size === 0) {
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
const bodyLines = [];
|
|
169
|
-
for (const [shadowingKey, targetKeys] of legacyCacheReads) {
|
|
170
|
-
for (const targetKey of targetKeys) {
|
|
171
|
-
bodyLines.push(` - "${shadowingKey}" does not set "cache", so it was read from "${targetKey}"`);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
bodyLines.push('', 'An executor key applies to every target that resolves through it, so exclude any continuous target before setting "cache" on one — a target that is both cacheable and continuous is rejected.', 'Target defaults resolve to a single key rather than merging, so an executor key hides the target name key entirely.', 'Set "cache" on the executor key to keep these targets cacheable — reading it from the target name key is deprecated and will be removed in Nx 24.');
|
|
175
|
-
output_1.output.warn({
|
|
176
|
-
title: 'Some targets are only cacheable through a deprecated fallback.',
|
|
177
|
-
bodyLines,
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
70
|
/**
|
|
181
71
|
* Nothing downstream rejects a key it does not know — the Rust hasher drops it,
|
|
182
72
|
* the Cloud runner reads only the keys it reads, and the Kotlin API decodes with
|
|
@@ -186,8 +76,9 @@ function warnAboutLegacyCachedTargets(legacyCacheReads) {
|
|
|
186
76
|
*/
|
|
187
77
|
const KNOWN_ULTRACACHE_KEYS = new Set([
|
|
188
78
|
'mode',
|
|
189
|
-
'
|
|
190
|
-
'
|
|
79
|
+
'collectStats',
|
|
80
|
+
'ignoreReads',
|
|
81
|
+
'ignoreWrites',
|
|
191
82
|
utils_1.NX_SPREAD_TOKEN,
|
|
192
83
|
]);
|
|
193
84
|
const ULTRACACHE_MODES = ['on', 'warn', 'error', 'off'];
|
|
@@ -233,7 +124,7 @@ function validateTargetUltracache(ultracache, projectName, projectRoot, targetNa
|
|
|
233
124
|
const errors = [];
|
|
234
125
|
for (const key of Object.keys(ultracache)) {
|
|
235
126
|
if (!KNOWN_ULTRACACHE_KEYS.has(key)) {
|
|
236
|
-
errors.push(`"ultracache.${key}" for target ${where} is not an ultracache option. Supported options are "mode", "
|
|
127
|
+
errors.push(`"ultracache.${key}" for target ${where} is not an ultracache option. Supported options are "mode", "collectStats", "ignoreReads" and "ignoreWrites".`);
|
|
237
128
|
}
|
|
238
129
|
}
|
|
239
130
|
if (ultracache.mode !== undefined &&
|
|
@@ -243,7 +134,11 @@ function validateTargetUltracache(ultracache, projectName, projectRoot, targetNa
|
|
|
243
134
|
? `"${ultracache.mode}"`
|
|
244
135
|
: describeUltracacheValue(ultracache.mode)}.`);
|
|
245
136
|
}
|
|
246
|
-
|
|
137
|
+
if (ultracache.collectStats !== undefined &&
|
|
138
|
+
typeof ultracache.collectStats !== 'boolean') {
|
|
139
|
+
errors.push(`"ultracache.collectStats" for target ${where} must be a boolean, but it is ${describeUltracacheValue(ultracache.collectStats)}.`);
|
|
140
|
+
}
|
|
141
|
+
for (const key of ['ignoreReads', 'ignoreWrites']) {
|
|
247
142
|
const value = ultracache[key];
|
|
248
143
|
if (value === undefined)
|
|
249
144
|
continue;
|
|
@@ -258,30 +153,16 @@ function validateTargetUltracache(ultracache, projectName, projectRoot, targetNa
|
|
|
258
153
|
}
|
|
259
154
|
return errors;
|
|
260
155
|
}
|
|
261
|
-
function normalizeTargets(project, sourceMaps,
|
|
156
|
+
function normalizeTargets(project, sourceMaps, workspaceRoot,
|
|
262
157
|
/**
|
|
263
158
|
* Project configurations keyed by project name
|
|
264
159
|
*/
|
|
265
|
-
projects
|
|
266
|
-
/**
|
|
267
|
-
* Shadowing `targetDefaults` key -> target name keys its `cache` was read
|
|
268
|
-
* from. Accumulated across projects so the deprecation warns once per pair.
|
|
269
|
-
*/
|
|
270
|
-
legacyCacheReads) {
|
|
160
|
+
projects) {
|
|
271
161
|
const targetErrorMessage = [];
|
|
272
162
|
for (const targetName in project.targets) {
|
|
273
163
|
project.targets[targetName] = normalizeTarget(project.targets[targetName], project, workspaceRoot, projects, [project.root, targetName].join(':'));
|
|
274
164
|
const target = project.targets[targetName];
|
|
275
165
|
targetErrorMessage.push(...validateTargetUltracache(target.ultracache, project.name ?? project.root, project.root, targetName, sourceMaps).map((message) => `- ${message}`));
|
|
276
|
-
const targetDefaults = nxJsonConfiguration.targetDefaults;
|
|
277
|
-
if (isLegacyCachedTarget(targetName, targetDefaults, target)) {
|
|
278
|
-
target.cache = true;
|
|
279
|
-
// Always defined: `isLegacyCachedTarget` returns false without it.
|
|
280
|
-
const shadowingKey = findShadowingTargetDefaultKey(targetDefaults, target);
|
|
281
|
-
const targetKeys = legacyCacheReads.get(shadowingKey) ?? new Set();
|
|
282
|
-
targetKeys.add(targetName);
|
|
283
|
-
legacyCacheReads.set(shadowingKey, targetKeys);
|
|
284
|
-
}
|
|
285
166
|
if (
|
|
286
167
|
// If the target has no executor or command, it doesn't do anything
|
|
287
168
|
!target.executor &&
|
|
@@ -314,7 +195,6 @@ function validateAndNormalizeProjectRootMap(workspaceRoot, projectRootMap, nxJso
|
|
|
314
195
|
const conflicts = new Map();
|
|
315
196
|
const projectRootsWithNoName = [];
|
|
316
197
|
const validityErrors = [];
|
|
317
|
-
const legacyCacheReads = new Map();
|
|
318
198
|
for (const root in projectRootMap) {
|
|
319
199
|
const project = projectRootMap[root];
|
|
320
200
|
// We're setting `// targets` as a comment `targets` is empty due to Project Crystal.
|
|
@@ -364,7 +244,7 @@ function validateAndNormalizeProjectRootMap(workspaceRoot, projectRootMap, nxJso
|
|
|
364
244
|
for (const root in projectRootMap) {
|
|
365
245
|
const project = projectRootMap[root];
|
|
366
246
|
try {
|
|
367
|
-
normalizeTargets(project, sourceMaps,
|
|
247
|
+
normalizeTargets(project, sourceMaps, workspaceRoot, projects);
|
|
368
248
|
}
|
|
369
249
|
catch (e) {
|
|
370
250
|
if (e instanceof error_types_1.WorkspaceValidityError) {
|
|
@@ -375,7 +255,6 @@ function validateAndNormalizeProjectRootMap(workspaceRoot, projectRootMap, nxJso
|
|
|
375
255
|
}
|
|
376
256
|
}
|
|
377
257
|
}
|
|
378
|
-
warnAboutLegacyCachedTargets(legacyCacheReads);
|
|
379
258
|
const errors = [];
|
|
380
259
|
if (conflicts.size > 0) {
|
|
381
260
|
// Only on the way to throwing, so a workspace without duplicates never
|
|
@@ -316,8 +316,8 @@ function createMatcher(patterns, emptyValue) {
|
|
|
316
316
|
return (file) => compiled.some((m) => m.match(file));
|
|
317
317
|
}
|
|
318
318
|
function findMatchingConfigFiles(projectFiles, include, exclude) {
|
|
319
|
-
//
|
|
320
|
-
//
|
|
319
|
+
// Callers pass files that already match the plugin's createNodes pattern,
|
|
320
|
+
// so only include/exclude filters remain here.
|
|
321
321
|
// Empty include means include everything, empty exclude means exclude nothing
|
|
322
322
|
const includes = createMatcher(include, true);
|
|
323
323
|
const excludes = createMatcher(exclude, false);
|
|
@@ -12,6 +12,7 @@ const angular_json_1 = require("../../adapter/angular-json");
|
|
|
12
12
|
const nx_json_1 = require("../../config/nx-json");
|
|
13
13
|
const project_configuration_utils_1 = require("./project-configuration-utils");
|
|
14
14
|
const workspace_context_1 = require("../../utils/workspace-context");
|
|
15
|
+
const minimatch_1 = require("minimatch");
|
|
15
16
|
const path_1 = require("path");
|
|
16
17
|
const get_plugins_1 = require("../plugins/get-plugins");
|
|
17
18
|
/**
|
|
@@ -45,11 +46,9 @@ async function retrieveWorkspaceFiles(workspaceRoot, projectRootMap) {
|
|
|
45
46
|
async function retrieveProjectConfigurations(separatedPlugins, workspaceRoot, nxJson) {
|
|
46
47
|
const specifiedWithCreateNodes = separatedPlugins.specifiedPlugins.filter((p) => !!p.createNodes);
|
|
47
48
|
const defaultWithCreateNodes = separatedPlugins.defaultPlugins.filter((p) => !!p.createNodes);
|
|
48
|
-
const specifiedGlobPatterns = getGlobPatternsOfPlugins(specifiedWithCreateNodes);
|
|
49
|
-
const defaultGlobPatterns = getGlobPatternsOfPlugins(defaultWithCreateNodes);
|
|
50
49
|
const [specifiedPluginFiles, defaultPluginFiles] = await Promise.all([
|
|
51
|
-
(
|
|
52
|
-
(
|
|
50
|
+
globPluginFiles(workspaceRoot, specifiedWithCreateNodes),
|
|
51
|
+
globPluginFiles(workspaceRoot, defaultWithCreateNodes),
|
|
53
52
|
]);
|
|
54
53
|
return (0, project_configuration_utils_1.createProjectConfigurationsWithPlugins)(workspaceRoot, nxJson, {
|
|
55
54
|
specifiedPluginFiles: specifiedPluginFiles ?? [],
|
|
@@ -71,8 +70,7 @@ async function retrieveProjectConfigurationsWithAngularProjects(workspaceRoot, n
|
|
|
71
70
|
return res;
|
|
72
71
|
}
|
|
73
72
|
async function retrieveProjectConfigurationPaths(root, plugins) {
|
|
74
|
-
const
|
|
75
|
-
const pluginConfigFiles = await (0, workspace_context_1.multiGlobWithWorkspaceContext)(root, projectGlobPatterns);
|
|
73
|
+
const pluginConfigFiles = await globPluginFiles(root, plugins);
|
|
76
74
|
return pluginConfigFiles.flat();
|
|
77
75
|
}
|
|
78
76
|
const projectsWithoutPluginCache = new Map();
|
|
@@ -105,6 +103,29 @@ async function retrieveProjectConfigurationsWithoutPluginInference(root) {
|
|
|
105
103
|
function clearProjectsWithoutPluginInferenceCache() {
|
|
106
104
|
projectsWithoutPluginCache.clear();
|
|
107
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* Files each plugin's createNodes pattern matches, in plugin order. A plugin
|
|
108
|
+
* scoped by `include` globs only those patterns natively, so a broad pattern
|
|
109
|
+
* (every `.ts` file, say) is never matched against the whole workspace in JS.
|
|
110
|
+
*/
|
|
111
|
+
async function globPluginFiles(root, plugins) {
|
|
112
|
+
const unscoped = plugins.filter((p) => !canGlobInclude(p));
|
|
113
|
+
const unscopedFiles = (await (0, workspace_context_1.multiGlobWithWorkspaceContext)(root, unscoped.map((p) => p.createNodes[0]))) ?? [];
|
|
114
|
+
return Promise.all(plugins.map(async (plugin) => {
|
|
115
|
+
if (!canGlobInclude(plugin)) {
|
|
116
|
+
return unscopedFiles[unscoped.indexOf(plugin)] ?? [];
|
|
117
|
+
}
|
|
118
|
+
const pattern = new minimatch_1.Minimatch(plugin.createNodes[0], { dot: true });
|
|
119
|
+
const included = await (0, workspace_context_1.globWithWorkspaceContext)(root, plugin.include);
|
|
120
|
+
return included.filter((file) => pattern.match(file));
|
|
121
|
+
}));
|
|
122
|
+
}
|
|
123
|
+
// Only narrow includes: a `**` scope can return more files than the plugin
|
|
124
|
+
// pattern does. Negations and extglobs keep the JS matcher's semantics.
|
|
125
|
+
function canGlobInclude(plugin) {
|
|
126
|
+
return (plugin.include?.length > 0 &&
|
|
127
|
+
plugin.include.every((pattern) => !pattern.includes('**') && !/[!()]/.test(pattern)));
|
|
128
|
+
}
|
|
108
129
|
function getGlobPatternsOfPlugins(plugins) {
|
|
109
130
|
return plugins.map((p) => p.createNodes[0]);
|
|
110
131
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ProjectGraph, ProjectGraphProjectNode } from '../config/project-graph';
|
|
2
|
-
import { Task, TaskGraph } from '../config/task-graph';
|
|
2
|
+
import { Task, TaskGraph, TaskGraphEdge } from '../config/task-graph';
|
|
3
3
|
import { TargetDependencies } from '../config/nx-json';
|
|
4
4
|
/**
|
|
5
5
|
* For each task, the overrides every `dependsOn` edge into it would give it,
|
|
@@ -20,10 +20,10 @@ export declare class ProcessTasks {
|
|
|
20
20
|
[id: string]: Task;
|
|
21
21
|
};
|
|
22
22
|
readonly dependencies: {
|
|
23
|
-
[k: string]:
|
|
23
|
+
[k: string]: TaskGraphEdge[];
|
|
24
24
|
};
|
|
25
25
|
readonly continuousDependencies: {
|
|
26
|
-
[k: string]:
|
|
26
|
+
[k: string]: TaskGraphEdge[];
|
|
27
27
|
};
|
|
28
28
|
readonly dependencyOverrides: DependencyOverrides;
|
|
29
29
|
private readonly allTargetNames;
|
|
@@ -33,6 +33,7 @@ export declare class ProcessTasks {
|
|
|
33
33
|
private processTasksForMultipleProjects;
|
|
34
34
|
private processTasksForSingleProject;
|
|
35
35
|
private processTasksForDependencies;
|
|
36
|
+
private addContinuousEdge;
|
|
36
37
|
private recordEdge;
|
|
37
38
|
private createDummyTask;
|
|
38
39
|
createTask(id: string, project: ProjectGraphProjectNode, target: string, resolvedConfiguration: string | undefined, overrides: Record<string, unknown>): Task;
|
|
@@ -54,11 +55,11 @@ export declare function filterTaskGraphToSelection(projectGraph: ProjectGraph, t
|
|
|
54
55
|
* It will manipulate the dependencies object in place
|
|
55
56
|
*/
|
|
56
57
|
export declare function filterDummyTasks(dependencies: {
|
|
57
|
-
[k: string]:
|
|
58
|
+
[k: string]: TaskGraphEdge[];
|
|
58
59
|
}): void;
|
|
59
60
|
/**
|
|
60
61
|
* this function is used to get the non dummy dependencies of a task recursively
|
|
61
62
|
*/
|
|
62
|
-
export declare function getNonDummyDeps(
|
|
63
|
-
[k: string]:
|
|
64
|
-
}, cycles?: Set<string>, seen?: Set<string>):
|
|
63
|
+
export declare function getNonDummyDeps(currentEdge: TaskGraphEdge, dependencies: {
|
|
64
|
+
[k: string]: TaskGraphEdge[];
|
|
65
|
+
}, cycles?: Set<string>, seen?: Set<string>): TaskGraphEdge[];
|
|
@@ -59,28 +59,14 @@ class ProcessTasks {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
for (let d of Object.keys(this.dependencies)) {
|
|
62
|
-
this.dependencies[d] = this.dependencies[d].filter((dd) => !!initialTasks[dd]);
|
|
62
|
+
this.dependencies[d] = this.dependencies[d].filter((dd) => !!initialTasks[dd.id]);
|
|
63
63
|
}
|
|
64
64
|
for (let d of Object.keys(this.continuousDependencies)) {
|
|
65
|
-
this.continuousDependencies[d] = this.continuousDependencies[d].filter((dd) => !!initialTasks[dd]);
|
|
65
|
+
this.continuousDependencies[d] = this.continuousDependencies[d].filter((dd) => !!initialTasks[dd.id]);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
filterDummyTasks(this.dependencies);
|
|
69
|
-
for (const taskId of Object.keys(this.dependencies)) {
|
|
70
|
-
if (this.dependencies[taskId].length > 0) {
|
|
71
|
-
this.dependencies[taskId] = [
|
|
72
|
-
...new Set(this.dependencies[taskId].filter((d) => d !== taskId)).values(),
|
|
73
|
-
];
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
69
|
filterDummyTasks(this.continuousDependencies);
|
|
77
|
-
for (const taskId of Object.keys(this.continuousDependencies)) {
|
|
78
|
-
if (this.continuousDependencies[taskId].length > 0) {
|
|
79
|
-
this.continuousDependencies[taskId] = [
|
|
80
|
-
...new Set(this.continuousDependencies[taskId].filter((d) => d !== taskId)).values(),
|
|
81
|
-
];
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
70
|
return Object.keys(this.tasks).filter((d) => this.dependencies[d].length === 0 &&
|
|
85
71
|
this.continuousDependencies[d].length === 0);
|
|
86
72
|
}
|
|
@@ -132,10 +118,10 @@ class ProcessTasks {
|
|
|
132
118
|
if (task.id !== selfTaskId) {
|
|
133
119
|
this.recordEdge(task, selfTaskId, taskOverrides);
|
|
134
120
|
if (this.tasks[selfTaskId].continuous) {
|
|
135
|
-
this.
|
|
121
|
+
this.addContinuousEdge(task, selfTaskId, dependencyConfig);
|
|
136
122
|
}
|
|
137
123
|
else {
|
|
138
|
-
this.dependencies[task.id].push(selfTaskId);
|
|
124
|
+
this.dependencies[task.id].push({ id: selfTaskId });
|
|
139
125
|
}
|
|
140
126
|
}
|
|
141
127
|
}
|
|
@@ -156,10 +142,10 @@ class ProcessTasks {
|
|
|
156
142
|
if (task.id !== depTargetId) {
|
|
157
143
|
this.recordEdge(task, depTargetId, taskOverrides);
|
|
158
144
|
if (depTargetConfiguration.continuous) {
|
|
159
|
-
this.
|
|
145
|
+
this.addContinuousEdge(task, depTargetId, dependencyConfig);
|
|
160
146
|
}
|
|
161
147
|
else {
|
|
162
|
-
this.dependencies[task.id].push(depTargetId);
|
|
148
|
+
this.dependencies[task.id].push({ id: depTargetId });
|
|
163
149
|
}
|
|
164
150
|
}
|
|
165
151
|
if (!this.tasks[depTargetId]) {
|
|
@@ -177,8 +163,8 @@ class ProcessTasks {
|
|
|
177
163
|
'__' +
|
|
178
164
|
dependencyConfig.target +
|
|
179
165
|
DUMMY_TASK_TARGET, undefined);
|
|
180
|
-
this.dependencies[task.id].push(dummyId);
|
|
181
|
-
this.continuousDependencies[task.id].push(dummyId);
|
|
166
|
+
this.dependencies[task.id].push({ id: dummyId });
|
|
167
|
+
this.continuousDependencies[task.id].push({ id: dummyId });
|
|
182
168
|
this.dependencies[dummyId] ??= [];
|
|
183
169
|
this.continuousDependencies[dummyId] ??= [];
|
|
184
170
|
const noopTask = this.createDummyTask(dummyId, task);
|
|
@@ -186,6 +172,9 @@ class ProcessTasks {
|
|
|
186
172
|
}
|
|
187
173
|
}
|
|
188
174
|
}
|
|
175
|
+
addContinuousEdge(task, dependencyId, dependencyConfig) {
|
|
176
|
+
this.continuousDependencies[task.id].push(continuousEdge(dependencyId, dependencyConfig));
|
|
177
|
+
}
|
|
189
178
|
recordEdge(task, dependencyId, overrides) {
|
|
190
179
|
if (!this.recordDependencyOverrides) {
|
|
191
180
|
return;
|
|
@@ -228,9 +217,11 @@ class ProcessTasks {
|
|
|
228
217
|
resolveConfiguration(project, target, configuration) {
|
|
229
218
|
const defaultConfiguration = project.data.targets?.[target]?.defaultConfiguration;
|
|
230
219
|
configuration ??= defaultConfiguration;
|
|
231
|
-
|
|
220
|
+
const resolved = (0, project_graph_utils_1.projectHasTargetAndConfiguration)(project, target, configuration)
|
|
232
221
|
? configuration
|
|
233
222
|
: defaultConfiguration;
|
|
223
|
+
// `createTaskId` drops an empty configuration, so the target must too.
|
|
224
|
+
return resolved || undefined;
|
|
234
225
|
}
|
|
235
226
|
}
|
|
236
227
|
exports.ProcessTasks = ProcessTasks;
|
|
@@ -298,6 +289,37 @@ function interpolateOverrides(args, projectName, project) {
|
|
|
298
289
|
});
|
|
299
290
|
return interpolatedArgs;
|
|
300
291
|
}
|
|
292
|
+
function continuousEdge(id, dependencyConfig) {
|
|
293
|
+
const edge = { id };
|
|
294
|
+
if (dependencyConfig.waitFor === 'ready') {
|
|
295
|
+
edge.waitFor = 'ready';
|
|
296
|
+
}
|
|
297
|
+
if (dependencyConfig.inputs === false) {
|
|
298
|
+
edge.inputs = false;
|
|
299
|
+
}
|
|
300
|
+
return edge;
|
|
301
|
+
}
|
|
302
|
+
// A task reached by several edges waits for ready when any of them does, and
|
|
303
|
+
// keeps its inputs unless all of them opt out
|
|
304
|
+
function mergeEdges(edges) {
|
|
305
|
+
const byId = new Map();
|
|
306
|
+
for (const edge of edges) {
|
|
307
|
+
const seen = byId.get(edge.id);
|
|
308
|
+
if (!seen) {
|
|
309
|
+
byId.set(edge.id, edge);
|
|
310
|
+
continue;
|
|
311
|
+
}
|
|
312
|
+
const merged = { id: edge.id };
|
|
313
|
+
if (seen.waitFor === 'ready' || edge.waitFor === 'ready') {
|
|
314
|
+
merged.waitFor = 'ready';
|
|
315
|
+
}
|
|
316
|
+
if (seen.inputs === false && edge.inputs === false) {
|
|
317
|
+
merged.inputs = false;
|
|
318
|
+
}
|
|
319
|
+
byId.set(edge.id, merged);
|
|
320
|
+
}
|
|
321
|
+
return [...byId.values()];
|
|
322
|
+
}
|
|
301
323
|
/**
|
|
302
324
|
* This function is used to filter out the dummy tasks from the dependencies
|
|
303
325
|
* It will manipulate the dependencies object in place
|
|
@@ -310,7 +332,7 @@ function filterDummyTasks(dependencies) {
|
|
|
310
332
|
for (const dep of deps) {
|
|
311
333
|
normalizedDeps.push(...getNonDummyDeps(dep, dependencies, cycles, new Set([key])));
|
|
312
334
|
}
|
|
313
|
-
dependencies[key] = normalizedDeps;
|
|
335
|
+
dependencies[key] = mergeEdges(normalizedDeps);
|
|
314
336
|
}
|
|
315
337
|
}
|
|
316
338
|
for (const key of Object.keys(dependencies)) {
|
|
@@ -322,12 +344,13 @@ function filterDummyTasks(dependencies) {
|
|
|
322
344
|
/**
|
|
323
345
|
* this function is used to get the non dummy dependencies of a task recursively
|
|
324
346
|
*/
|
|
325
|
-
function getNonDummyDeps(
|
|
347
|
+
function getNonDummyDeps(currentEdge, dependencies, cycles, seen = new Set()) {
|
|
348
|
+
const currentTask = currentEdge.id;
|
|
326
349
|
if (seen.has(currentTask)) {
|
|
327
350
|
return [];
|
|
328
351
|
}
|
|
329
|
-
seen.add(currentTask);
|
|
330
352
|
if (currentTask.endsWith(DUMMY_TASK_TARGET)) {
|
|
353
|
+
seen.add(currentTask);
|
|
331
354
|
if (cycles?.has(currentTask)) {
|
|
332
355
|
return [];
|
|
333
356
|
}
|
|
@@ -339,7 +362,7 @@ function getNonDummyDeps(currentTask, dependencies, cycles, seen = new Set()) {
|
|
|
339
362
|
return deps.flatMap((dep) => getNonDummyDeps(dep, dependencies, cycles, seen));
|
|
340
363
|
}
|
|
341
364
|
else {
|
|
342
|
-
return [
|
|
365
|
+
return [currentEdge];
|
|
343
366
|
}
|
|
344
367
|
}
|
|
345
368
|
function createTaskOverrides(dependencyConfig, cliOverrides, sourceTask, projectGraph) {
|
|
@@ -68,7 +68,7 @@ const defaultTasksRunner = async (tasks, options, context) => {
|
|
|
68
68
|
};
|
|
69
69
|
exports.defaultTasksRunner = defaultTasksRunner;
|
|
70
70
|
async function runAllTasks(options, context) {
|
|
71
|
-
const orchestrator = new task_orchestrator_1.TaskOrchestrator(context.hasher, context.initiatingProject, context.initiatingTasks, context.projectGraph, context.taskGraph, context.nxJson, options, context.nxArgs?.nxBail, context.daemon, context.nxArgs?.specifiedOutputStyle, context.nxArgs?.resolvedOutputStyle ?? 'static-failures-only', context.taskGraph, context.
|
|
71
|
+
const orchestrator = new task_orchestrator_1.TaskOrchestrator(context.hasher, context.initiatingProject, context.initiatingTasks, context.projectGraph, context.taskGraph, context.nxJson, options, context.nxArgs?.nxBail, context.daemon, context.nxArgs?.specifiedOutputStyle, context.nxArgs?.resolvedOutputStyle ?? 'static-failures-only', context.taskGraph, context.hashingDeferredTaskIds);
|
|
72
72
|
return orchestrator.run();
|
|
73
73
|
}
|
|
74
74
|
exports.default = exports.defaultTasksRunner;
|