@ohos-ports/nx 23.2.1-beta.1 → 23.3.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/bin/init-local.js +7 -1
- package/dist/bin/nx.js +2 -2
- package/dist/nx-cloud-internals.d.ts +1 -0
- package/dist/nx-cloud-internals.js +9 -0
- package/dist/plugins/package-json.js +1 -1
- package/dist/src/command-line/add/add.js +5 -1
- package/dist/src/command-line/affected/affected.js +70 -9
- package/dist/src/command-line/affected/command-object.js +1 -1
- package/dist/src/command-line/format/format.js +2 -18
- package/dist/src/command-line/graph/graph.d.ts +31 -0
- package/dist/src/command-line/graph/graph.js +113 -20
- package/dist/src/command-line/init/implementation/add-nx-to-monorepo.js +0 -3
- package/dist/src/command-line/init/implementation/add-nx-to-nest.js +0 -3
- package/dist/src/command-line/init/implementation/add-nx-to-npm-repo.js +0 -3
- package/dist/src/command-line/init/implementation/angular/index.js +0 -3
- package/dist/src/command-line/init/implementation/angular/legacy-angular-versions.js +0 -3
- package/dist/src/command-line/init/implementation/format.js +2 -3
- package/dist/src/command-line/init/implementation/utils.d.ts +0 -1
- package/dist/src/command-line/init/implementation/utils.js +6 -9
- package/dist/src/command-line/init/init-v2.js +0 -3
- package/dist/src/command-line/migrate/agentic/capture-generator-output.d.ts +25 -0
- package/dist/src/command-line/migrate/agentic/capture-generator-output.js +121 -5
- package/dist/src/command-line/migrate/agentic/close-agent-session.d.ts +21 -0
- package/dist/src/command-line/migrate/agentic/close-agent-session.js +126 -0
- package/dist/src/command-line/migrate/agentic/definitions.d.ts +24 -0
- package/dist/src/command-line/migrate/agentic/definitions.js +79 -20
- package/dist/src/command-line/migrate/agentic/format-command.d.ts +14 -0
- package/dist/src/command-line/migrate/agentic/format-command.js +44 -0
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +3 -3
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +3 -3
- package/dist/src/command-line/migrate/agentic/handoff.d.ts +50 -17
- package/dist/src/command-line/migrate/agentic/handoff.js +166 -24
- package/dist/src/command-line/migrate/agentic/instruction-files.d.ts +23 -0
- package/dist/src/command-line/migrate/agentic/instruction-files.js +41 -0
- package/dist/src/command-line/migrate/agentic/master/invocations.d.ts +12 -0
- package/dist/src/command-line/migrate/agentic/master/invocations.js +54 -0
- package/dist/src/command-line/migrate/agentic/master/run-master-session.d.ts +16 -0
- package/dist/src/command-line/migrate/agentic/master/run-master-session.js +175 -0
- package/dist/src/command-line/migrate/agentic/master/spawn-master.d.ts +31 -0
- package/dist/src/command-line/migrate/agentic/master/spawn-master.js +222 -0
- package/dist/src/command-line/migrate/agentic/prompts/final-validation.d.ts +13 -0
- package/dist/src/command-line/migrate/agentic/prompts/final-validation.js +41 -0
- package/dist/src/command-line/migrate/agentic/prompts/fragments.d.ts +17 -0
- package/dist/src/command-line/migrate/agentic/prompts/fragments.js +90 -0
- package/dist/src/command-line/migrate/agentic/prompts/generic-validation.js +4 -3
- package/dist/src/command-line/migrate/agentic/prompts/system-prompt.d.ts +25 -1
- package/dist/src/command-line/migrate/agentic/prompts/system-prompt.js +57 -34
- package/dist/src/command-line/migrate/agentic/run-step.js +28 -4
- package/dist/src/command-line/migrate/agentic/runner.d.ts +3 -15
- package/dist/src/command-line/migrate/agentic/runner.js +57 -239
- package/dist/src/command-line/migrate/agentic/terminal-repair.d.ts +1 -0
- package/dist/src/command-line/migrate/agentic/terminal-repair.js +27 -0
- package/dist/src/command-line/migrate/agentic/types.d.ts +23 -8
- package/dist/src/command-line/migrate/agentic/types.js +10 -7
- package/dist/src/command-line/migrate/agentic/windows-cmd.d.ts +33 -0
- package/dist/src/command-line/migrate/agentic/windows-cmd.js +88 -0
- package/dist/src/command-line/migrate/command-object.d.ts +2 -0
- package/dist/src/command-line/migrate/command-object.js +11 -1
- package/dist/src/command-line/migrate/deferred-output.d.ts +44 -0
- package/dist/src/command-line/migrate/deferred-output.js +92 -0
- package/dist/src/command-line/migrate/execute-migration.d.ts +9 -3
- package/dist/src/command-line/migrate/execute-migration.js +53 -16
- package/dist/src/command-line/migrate/migrate-analytics.d.ts +34 -9
- package/dist/src/command-line/migrate/migrate-analytics.js +71 -10
- package/dist/src/command-line/migrate/migrate-commits.d.ts +5 -4
- package/dist/src/command-line/migrate/migrate-commits.js +16 -6
- package/dist/src/command-line/migrate/migrate-config.d.ts +5 -2
- package/dist/src/command-line/migrate/migrate-config.js +19 -11
- package/dist/src/command-line/migrate/migrate-output.d.ts +3 -7
- package/dist/src/command-line/migrate/migrate-output.js +3 -7
- package/dist/src/command-line/migrate/migrate.d.ts +3 -0
- package/dist/src/command-line/migrate/migrate.js +183 -46
- package/dist/src/command-line/migrate/resolve-package-version.js +2 -19
- package/dist/src/command-line/migrate/run/agent-output.d.ts +11 -0
- package/dist/src/command-line/migrate/run/agent-output.js +21 -2
- package/dist/src/command-line/migrate/run/agent-work-payload.d.ts +37 -0
- package/dist/src/command-line/migrate/run/agent-work-payload.js +156 -0
- package/dist/src/command-line/migrate/run/atomic-write.d.ts +8 -0
- package/dist/src/command-line/migrate/run/atomic-write.js +17 -0
- package/dist/src/command-line/migrate/run/broker.d.ts +150 -0
- package/dist/src/command-line/migrate/run/broker.js +568 -0
- package/dist/src/command-line/migrate/run/clean-retry.d.ts +12 -0
- package/dist/src/command-line/migrate/run/clean-retry.js +99 -0
- package/dist/src/command-line/migrate/run/existing-run-report.d.ts +55 -0
- package/dist/src/command-line/migrate/run/existing-run-report.js +227 -0
- package/dist/src/command-line/migrate/run/give-up.d.ts +41 -0
- package/dist/src/command-line/migrate/run/give-up.js +148 -0
- package/dist/src/command-line/migrate/run/index.d.ts +9 -6
- package/dist/src/command-line/migrate/run/index.js +21 -2
- package/dist/src/command-line/migrate/run/issues.d.ts +127 -0
- package/dist/src/command-line/migrate/run/issues.js +1121 -0
- package/dist/src/command-line/migrate/run/orchestrator.d.ts +59 -1
- package/dist/src/command-line/migrate/run/orchestrator.js +1529 -457
- package/dist/src/command-line/migrate/run/run-id.d.ts +0 -8
- package/dist/src/command-line/migrate/run/run-id.js +0 -30
- package/dist/src/command-line/migrate/run/run-state.d.ts +77 -17
- package/dist/src/command-line/migrate/run/run-state.js +263 -32
- package/dist/src/command-line/migrate/run/runbook.d.ts +18 -0
- package/dist/src/command-line/migrate/run/runbook.js +118 -0
- package/dist/src/command-line/migrate/run/state-lock.d.ts +33 -2
- package/dist/src/command-line/migrate/run/state-lock.js +128 -2
- package/dist/src/command-line/migrate/run/state-machine.d.ts +50 -1
- package/dist/src/command-line/migrate/run/state-machine.js +339 -26
- package/dist/src/command-line/migrate/run/util.d.ts +3 -1
- package/dist/src/command-line/migrate/run/util.js +24 -3
- package/dist/src/command-line/migrate/run/worker.js +290 -129
- package/dist/src/command-line/migrate/step-actions.d.ts +1 -1
- package/dist/src/command-line/migrate/step-actions.js +7 -1
- package/dist/src/command-line/migrate/text.d.ts +6 -0
- package/dist/src/command-line/migrate/text.js +25 -0
- package/dist/src/command-line/migrate/version-skew-guard.js +2 -0
- package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +5 -11
- package/dist/src/command-line/release/publish.js +11 -8
- package/dist/src/command-line/release/utils/get-touched-projects-for-group.js +3 -3
- package/dist/src/command-line/release/utils/release-graph.js +1 -1
- package/dist/src/command-line/release/utils/remote-release-clients/github.js +5 -8
- package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +3 -3
- package/dist/src/command-line/release/utils/remote-release-clients/remote-release-client.d.ts +4 -2
- package/dist/src/command-line/release/utils/remote-release-clients/remote-release-client.js +37 -3
- package/dist/src/command-line/release/version/version-actions.d.ts +3 -0
- package/dist/src/command-line/reset/reset.js +10 -4
- package/dist/src/command-line/run/run-one.js +5 -1
- package/dist/src/command-line/run-many/run-many.js +6 -12
- package/dist/src/command-line/show/command-object.js +1 -1
- package/dist/src/command-line/show/projects.js +52 -1
- package/dist/src/command-line/yargs-utils/shared-options.d.ts +5 -1
- package/dist/src/command-line/yargs-utils/shared-options.js +38 -4
- package/dist/src/config/task-graph.d.ts +1 -1
- package/dist/src/config/workspace-json-project-json.d.ts +23 -1
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/core/graph/runtime.js +1 -1
- package/dist/src/core/graph/styles.js +1 -1
- package/dist/src/daemon/client/client.d.ts +14 -8
- package/dist/src/daemon/client/client.js +41 -12
- package/dist/src/daemon/message-types/get-plugin-capabilities.d.ts +5 -0
- package/dist/src/daemon/message-types/get-plugin-capabilities.js +11 -0
- package/dist/src/daemon/message-types/run-tasks-execution-hooks.d.ts +3 -2
- package/dist/src/daemon/message-types/select-affected-tasks.d.ts +21 -0
- package/dist/src/daemon/message-types/select-affected-tasks.js +11 -0
- package/dist/src/daemon/message-types/ultracache-configuration-version.d.ts +8 -0
- package/dist/src/daemon/message-types/ultracache-configuration-version.js +2 -0
- package/dist/src/daemon/server/dotenv-graph-changes.d.ts +1 -1
- package/dist/src/daemon/server/dotenv-graph-changes.js +2 -2
- package/dist/src/daemon/server/handle-get-plugin-capabilities.d.ts +2 -0
- package/dist/src/daemon/server/handle-get-plugin-capabilities.js +13 -0
- package/dist/src/daemon/server/handle-hash-tasks.d.ts +10 -2
- package/dist/src/daemon/server/handle-hash-tasks.js +18 -3
- package/dist/src/daemon/server/handle-select-affected-tasks.d.ts +3 -0
- package/dist/src/daemon/server/handle-select-affected-tasks.js +26 -0
- package/dist/src/daemon/server/handle-tasks-execution-hooks.d.ts +3 -2
- package/dist/src/daemon/server/{handle-outputs-changes.d.ts → handle-watch-events.d.ts} +4 -4
- package/dist/src/daemon/server/{handle-outputs-changes.js → handle-watch-events.js} +36 -37
- package/dist/src/daemon/server/outputs-tracking.d.ts +7 -19
- package/dist/src/daemon/server/outputs-tracking.js +7 -107
- package/dist/src/daemon/server/planning-context.d.ts +8 -0
- package/dist/src/daemon/server/planning-context.js +18 -0
- package/dist/src/daemon/server/project-graph-incremental-recomputation.d.ts +22 -7
- package/dist/src/daemon/server/project-graph-incremental-recomputation.js +104 -74
- package/dist/src/daemon/server/restart-checks.d.ts +22 -0
- package/dist/src/daemon/server/restart-checks.js +77 -0
- package/dist/src/daemon/server/server.d.ts +1 -0
- package/dist/src/daemon/server/server.js +54 -30
- package/dist/src/daemon/server/shutdown-utils.d.ts +0 -5
- package/dist/src/daemon/server/shutdown-utils.js +3 -26
- package/dist/src/daemon/server/ultracache-configuration-state.d.ts +7 -0
- package/dist/src/daemon/server/ultracache-configuration-state.js +36 -0
- package/dist/src/devkit-internals.d.ts +3 -1
- package/dist/src/devkit-internals.js +8 -3
- package/dist/src/executors/run-commands/run-commands.impl.d.ts +2 -1
- package/dist/src/executors/run-commands/run-commands.impl.js +19 -5
- package/dist/src/executors/run-commands/running-tasks.d.ts +5 -4
- package/dist/src/executors/run-commands/running-tasks.js +13 -13
- package/dist/src/hasher/create-task-hasher.d.ts +8 -1
- package/dist/src/hasher/create-task-hasher.js +13 -3
- package/dist/src/hasher/hash-plan-inspector.js +2 -2
- package/dist/src/hasher/hash-task.d.ts +2 -2
- package/dist/src/hasher/hash-task.js +28 -17
- package/dist/src/hasher/native-task-hasher-impl.d.ts +20 -4
- package/dist/src/hasher/native-task-hasher-impl.js +75 -9
- package/dist/src/hasher/task-hasher.d.ts +24 -7
- package/dist/src/hasher/task-hasher.js +27 -8
- package/dist/src/hasher/task-planning-context.d.ts +13 -0
- package/dist/src/hasher/task-planning-context.js +12 -0
- package/dist/src/native/assert-supported-platform.js +1 -1
- package/dist/src/native/index.d.ts +582 -21
- package/dist/src/native/index.js +3 -5
- package/dist/src/native/native-bindings.js +19 -7
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/native/transform-objects.d.ts +11 -2
- package/dist/src/native/transform-objects.js +46 -0
- package/dist/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +15 -8
- package/dist/src/nx-cloud/update-manager.d.ts +3 -0
- package/dist/src/nx-cloud/update-manager.js +19 -13
- package/dist/src/nx-cloud/utilities/client.d.ts +1 -1
- package/dist/src/nx-cloud/utilities/client.js +1 -1
- package/dist/src/nx-cloud/utilities/is-workspace-claimed.js +2 -1
- package/dist/src/nx-cloud/utilities/nx-cloud-http-client.d.ts +5 -0
- package/dist/src/nx-cloud/utilities/nx-cloud-http-client.js +16 -0
- package/dist/src/nx-cloud/utilities/url-shorten.js +17 -10
- package/dist/src/plugins/js/index.js +45 -64
- package/dist/src/plugins/js/lock-file/lock-file.d.ts +4 -4
- package/dist/src/plugins/js/lock-file/lock-file.js +6 -7
- package/dist/src/plugins/js/lock-file/pnpm-parser.js +1 -1
- package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.d.ts +2 -0
- package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.js +22 -0
- package/dist/src/plugins/js/project-graph/affected/lock-file-changes.d.ts +10 -2
- package/dist/src/plugins/js/project-graph/affected/lock-file-changes.js +51 -29
- package/dist/src/plugins/js/project-graph/affected/npm-packages.d.ts +10 -2
- package/dist/src/plugins/js/project-graph/affected/npm-packages.js +32 -11
- package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +22 -18
- package/dist/src/plugins/js/utils/register.js +13 -4
- package/dist/src/plugins/package-json/create-nodes.d.ts +2 -2
- package/dist/src/plugins/package-json/create-nodes.js +13 -13
- package/dist/src/project-graph/affected/affected-project-graph-models.d.ts +14 -0
- package/dist/src/project-graph/affected/affected-project-graph.js +5 -18
- package/dist/src/project-graph/affected/affected-projects.d.ts +7 -0
- package/dist/src/project-graph/affected/affected-projects.js +42 -0
- package/dist/src/project-graph/affected/affected-reasons.d.ts +116 -0
- package/dist/src/project-graph/affected/affected-reasons.js +459 -0
- package/dist/src/project-graph/affected/affected-tasks.d.ts +103 -0
- package/dist/src/project-graph/affected/affected-tasks.js +386 -0
- package/dist/src/project-graph/affected/print-explanation.d.ts +11 -0
- package/dist/src/project-graph/affected/print-explanation.js +44 -0
- package/dist/src/project-graph/error-types.d.ts +5 -0
- package/dist/src/project-graph/error-types.js +44 -5
- package/dist/src/project-graph/file-utils.d.ts +2 -0
- package/dist/src/project-graph/file-utils.js +12 -3
- package/dist/src/project-graph/nx-deps-cache.d.ts +5 -2
- package/dist/src/project-graph/nx-deps-cache.js +4 -4
- package/dist/src/project-graph/plugins/get-plugins.d.ts +3 -1
- package/dist/src/project-graph/plugins/get-plugins.js +60 -82
- package/dist/src/project-graph/plugins/in-process-loader.d.ts +1 -1
- package/dist/src/project-graph/plugins/in-process-loader.js +1 -4
- package/dist/src/project-graph/plugins/isolation/index.d.ts +1 -1
- package/dist/src/project-graph/plugins/isolation/index.js +3 -1
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.d.ts +8 -0
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +42 -6
- package/dist/src/project-graph/plugins/isolation/load-isolated-plugin.d.ts +10 -1
- package/dist/src/project-graph/plugins/isolation/load-isolated-plugin.js +67 -17
- package/dist/src/project-graph/plugins/isolation/messaging.d.ts +3 -2
- package/dist/src/project-graph/plugins/isolation/plugin-worker.js +5 -1
- package/dist/src/project-graph/plugins/loaded-nx-plugin.d.ts +5 -2
- package/dist/src/project-graph/plugins/loaded-nx-plugin.js +14 -1
- package/dist/src/project-graph/plugins/nx-plugin-capabilities.d.ts +6 -0
- package/dist/src/project-graph/plugins/nx-plugin-capabilities.js +28 -0
- package/dist/src/project-graph/plugins/task-results-stub.d.ts +50 -0
- package/dist/src/project-graph/plugins/task-results-stub.js +111 -0
- package/dist/src/project-graph/plugins/tasks-execution-hooks.d.ts +3 -2
- package/dist/src/project-graph/plugins/tasks-execution-hooks.js +14 -1
- package/dist/src/project-graph/project-graph.js +43 -42
- package/dist/src/project-graph/utils/project-configuration/target-merging.js +67 -0
- package/dist/src/project-graph/utils/project-configuration/target-normalization.js +83 -0
- package/dist/src/project-graph/utils/project-configuration/utils.d.ts +1 -0
- package/dist/src/project-graph/utils/project-configuration/utils.js +1 -0
- package/dist/src/tasks-runner/batch/run-batch.js +15 -0
- package/dist/src/tasks-runner/cache.d.ts +37 -2
- package/dist/src/tasks-runner/cache.js +42 -1
- package/dist/src/tasks-runner/create-task-graph.d.ts +24 -1
- package/dist/src/tasks-runner/create-task-graph.js +57 -2
- package/dist/src/tasks-runner/default-tasks-runner.js +1 -1
- package/dist/src/tasks-runner/forked-process-task-runner.d.ts +1 -1
- package/dist/src/tasks-runner/forked-process-task-runner.js +11 -10
- package/dist/src/tasks-runner/init-tasks-runner.d.ts +7 -2
- package/dist/src/tasks-runner/init-tasks-runner.js +15 -7
- package/dist/src/tasks-runner/is-tui-enabled.js +4 -3
- package/dist/src/tasks-runner/life-cycle.d.ts +7 -0
- package/dist/src/tasks-runner/life-cycle.js +7 -0
- package/dist/src/tasks-runner/life-cycles/summary-terminal-output-life-cycle.d.ts +35 -0
- package/dist/src/tasks-runner/life-cycles/summary-terminal-output-life-cycle.js +146 -0
- package/dist/src/tasks-runner/prune-task-graph.d.ts +17 -0
- package/dist/src/tasks-runner/prune-task-graph.js +45 -0
- package/dist/src/tasks-runner/run-command.d.ts +41 -5
- package/dist/src/tasks-runner/run-command.js +98 -22
- package/dist/src/tasks-runner/running-tasks/batch-process.d.ts +93 -19
- package/dist/src/tasks-runner/running-tasks/batch-process.js +184 -88
- package/dist/src/tasks-runner/task-io-service.d.ts +11 -3
- package/dist/src/tasks-runner/task-io-service.js +14 -5
- package/dist/src/tasks-runner/task-orchestrator.d.ts +71 -4
- package/dist/src/tasks-runner/task-orchestrator.js +266 -66
- package/dist/src/tasks-runner/tasks-runner.d.ts +2 -0
- package/dist/src/tasks-runner/terminal-output-path.d.ts +11 -0
- package/dist/src/tasks-runner/terminal-output-path.js +18 -0
- package/dist/src/tasks-runner/utils.d.ts +5 -0
- package/dist/src/tasks-runner/utils.js +14 -2
- package/dist/src/ultracache/config.d.ts +21 -0
- package/dist/src/ultracache/config.js +29 -0
- package/dist/src/ultracache/fetch.d.ts +21 -0
- package/dist/src/ultracache/fetch.js +43 -0
- package/dist/src/ultracache/overrides.d.ts +17 -0
- package/dist/src/ultracache/overrides.js +61 -0
- package/dist/src/ultracache/report.d.ts +13 -0
- package/dist/src/ultracache/report.js +62 -0
- package/dist/src/ultracache/store.d.ts +41 -0
- package/dist/src/ultracache/store.js +158 -0
- package/dist/src/utils/ab-testing.d.ts +4 -1
- package/dist/src/utils/ab-testing.js +22 -19
- package/dist/src/utils/chunkify.d.ts +1 -7
- package/dist/src/utils/chunkify.js +2 -8
- package/dist/src/utils/command-line-utils.d.ts +20 -0
- package/dist/src/utils/command-line-utils.js +10 -3
- package/dist/src/utils/create-cli-options.d.ts +6 -0
- package/dist/src/utils/create-cli-options.js +29 -0
- package/dist/src/utils/db-connection.d.ts +2 -0
- package/dist/src/utils/db-connection.js +2 -0
- package/dist/src/utils/formatters/index.d.ts +6 -0
- package/dist/src/utils/formatters/index.js +5 -0
- package/dist/src/utils/formatters/prettier.d.ts +0 -8
- package/dist/src/utils/formatters/prettier.js +4 -26
- package/dist/src/utils/git-utils.d.ts +19 -0
- package/dist/src/utils/git-utils.js +97 -39
- package/dist/src/utils/handle-errors.js +5 -43
- package/dist/src/utils/http-client.d.ts +27 -0
- package/dist/src/utils/http-client.js +193 -0
- package/dist/src/utils/installed-nx-version.js +2 -48
- package/dist/src/utils/json-diff.d.ts +4 -2
- package/dist/src/utils/json-diff.js +6 -94
- package/dist/src/utils/min-release-age/packument.js +1 -1
- package/dist/src/utils/nx-cloud-utils.d.ts +2 -0
- package/dist/src/utils/nx-cloud-utils.js +6 -1
- package/dist/src/utils/output.d.ts +22 -3
- package/dist/src/utils/output.js +28 -5
- package/dist/src/utils/package-json.d.ts +25 -0
- package/dist/src/utils/package-json.js +49 -6
- package/dist/src/utils/package-manager.d.ts +6 -0
- package/dist/src/utils/package-manager.js +10 -0
- package/dist/src/utils/plugins/plugin-capabilities.js +7 -2
- package/dist/src/utils/project-graph-utils.d.ts +2 -0
- package/dist/src/utils/project-graph-utils.js +12 -0
- package/dist/src/utils/provenance.js +20 -4
- package/dist/src/utils/serialize-overrides-into-command-line.js +2 -4
- package/dist/src/utils/workspace-context.d.ts +51 -3
- package/dist/src/utils/workspace-context.js +174 -10
- package/package.json +31 -47
- package/schemas/nx-schema.json +38 -0
- package/schemas/project-schema.json +35 -0
- package/dist/src/daemon/server/file-watching/route-workspace-changes.d.ts +0 -9
- package/dist/src/daemon/server/file-watching/route-workspace-changes.js +0 -76
- package/dist/src/daemon/server/watcher.d.ts +0 -18
- package/dist/src/daemon/server/watcher.js +0 -126
- package/dist/src/nx-cloud/utilities/axios.d.ts +0 -4
- package/dist/src/nx-cloud/utilities/axios.js +0 -17
- package/dist/src/project-graph/affected/locators/project-glob-changes.d.ts +0 -2
- package/dist/src/project-graph/affected/locators/project-glob-changes.js +0 -47
- package/dist/src/project-graph/affected/locators/workspace-json-changes.d.ts +0 -4
- package/dist/src/project-graph/affected/locators/workspace-json-changes.js +0 -47
- package/dist/src/project-graph/affected/locators/workspace-projects.d.ts +0 -3
- package/dist/src/project-graph/affected/locators/workspace-projects.js +0 -74
- package/dist/src/utils/collapse-expanded-outputs.d.ts +0 -10
- package/dist/src/utils/collapse-expanded-outputs.js +0 -72
|
@@ -139,6 +139,60 @@ function mergeConfigurationValue(newConfig, baseConfig, projectConfigSourceMap,
|
|
|
139
139
|
}
|
|
140
140
|
return merged;
|
|
141
141
|
}
|
|
142
|
+
// `ultracache` keeps replace-unless-`'...'` semantics at the object level, but its
|
|
143
|
+
// values still have to be merged per key: neither the wholesale replace nor
|
|
144
|
+
// `mergeObjectWithSpread` recurses, so an `ignoredReads: ['...', 'tmp/**']`
|
|
145
|
+
// would otherwise reach the task graph with `'...'` intact — a glob matching
|
|
146
|
+
// nothing, silently dropping the inherited patterns.
|
|
147
|
+
function mergeUltracache(newUltracache, baseUltracache, projectConfigSourceMap, sourceInformation, targetIdentifier, deferSpreadsWithoutBase) {
|
|
148
|
+
if (newUltracache === undefined) {
|
|
149
|
+
return baseUltracache;
|
|
150
|
+
}
|
|
151
|
+
const sourceMapContext = projectConfigSourceMap
|
|
152
|
+
? {
|
|
153
|
+
sourceMap: projectConfigSourceMap,
|
|
154
|
+
key: `${targetIdentifier}.ultracache`,
|
|
155
|
+
sourceInformation,
|
|
156
|
+
}
|
|
157
|
+
: undefined;
|
|
158
|
+
// Object level first: this settles which keys survive, their order, and
|
|
159
|
+
// their source-map attribution.
|
|
160
|
+
const merged = (0, utils_1.getMergeValueResult)(baseUltracache, newUltracache, sourceMapContext, deferSpreadsWithoutBase);
|
|
161
|
+
if (!merged || typeof merged !== 'object' || Array.isArray(merged)) {
|
|
162
|
+
return merged;
|
|
163
|
+
}
|
|
164
|
+
// Copy before resolving: with no object-level spread `getMergeValueResult`
|
|
165
|
+
// returns `newUltracache` itself, and writing through it would edit the
|
|
166
|
+
// caller's target in place, corrupting later merge layers.
|
|
167
|
+
const resolved = { ...merged };
|
|
168
|
+
// Keys authored before `'...'` let the base win, exactly as they do at the
|
|
169
|
+
// target level. Re-resolving those would overwrite the object-level merge's
|
|
170
|
+
// decision and make authored position meaningless for array keys while
|
|
171
|
+
// still honouring it for scalar ones.
|
|
172
|
+
const authoredKeys = Object.keys(newUltracache);
|
|
173
|
+
const spreadPosition = authoredKeys.indexOf(utils_1.NX_SPREAD_TOKEN);
|
|
174
|
+
const keysBeforeSpread = spreadPosition >= 0
|
|
175
|
+
? new Set(authoredKeys.slice(0, spreadPosition))
|
|
176
|
+
: new Set();
|
|
177
|
+
// Then re-resolve any key the target authored as an array, so a nested
|
|
178
|
+
// `'...'` expands against the inherited value rather than surviving as a
|
|
179
|
+
// literal element.
|
|
180
|
+
for (const key of Object.keys(resolved)) {
|
|
181
|
+
if (!Array.isArray(newUltracache[key]))
|
|
182
|
+
continue;
|
|
183
|
+
if (keysBeforeSpread.has(key) && baseUltracache && key in baseUltracache) {
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
resolved[key] = (0, utils_1.getMergeValueResult)(baseUltracache?.[key], newUltracache[key], projectConfigSourceMap
|
|
187
|
+
? {
|
|
188
|
+
sourceMap: projectConfigSourceMap,
|
|
189
|
+
key: `${targetIdentifier}.ultracache.${key}`,
|
|
190
|
+
sourceInformation,
|
|
191
|
+
}
|
|
192
|
+
: undefined, deferSpreadsWithoutBase);
|
|
193
|
+
}
|
|
194
|
+
return resolved;
|
|
195
|
+
}
|
|
142
196
|
function mergeConfigurations(newConfigurations, baseConfigurations, projectConfigSourceMap, sourceInformation, targetIdentifier, deferSpreadsWithoutBase) {
|
|
143
197
|
const mergedConfigurations = {};
|
|
144
198
|
// Keys before '...' let base win for shared names; keys after '...'
|
|
@@ -305,6 +359,7 @@ function mergeTargetConfigurations(target, baseTarget, projectConfigSourceMap, s
|
|
|
305
359
|
const skipForOwnMerge = new Set([
|
|
306
360
|
'options',
|
|
307
361
|
'configurations',
|
|
362
|
+
'ultracache',
|
|
308
363
|
utils_1.NX_SPREAD_TOKEN,
|
|
309
364
|
]);
|
|
310
365
|
const processKey = (key) => {
|
|
@@ -428,6 +483,18 @@ function mergeTargetConfigurations(target, baseTarget, projectConfigSourceMap, s
|
|
|
428
483
|
sourceInformation;
|
|
429
484
|
}
|
|
430
485
|
}
|
|
486
|
+
// merge ultracache if either side declares one
|
|
487
|
+
// as with options, an incompatible target discards the base.
|
|
488
|
+
// `ultracache` is in `skipForOwnMerge` so the key-by-key pass leaves it to
|
|
489
|
+
// this block; removing it from that set would change only the key's position
|
|
490
|
+
// in the result, since this overwrites whatever the generic pass produced.
|
|
491
|
+
if ('ultracache' in target ||
|
|
492
|
+
(isCompatible && baseTarget && 'ultracache' in baseTarget)) {
|
|
493
|
+
const mergedUltracache = mergeUltracache(target.ultracache, isCompatible ? baseTarget?.ultracache : undefined, projectConfigSourceMap, sourceInformation, targetIdentifier, deferSpreadsWithoutBase);
|
|
494
|
+
if (mergedUltracache !== undefined) {
|
|
495
|
+
result.ultracache = mergedUltracache;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
431
498
|
if (target.metadata) {
|
|
432
499
|
result.metadata = mergeMetadata(projectConfigSourceMap, sourceInformation, `${targetIdentifier}.metadata`, target.metadata, baseTarget?.metadata);
|
|
433
500
|
}
|
|
@@ -10,6 +10,7 @@ const output_1 = require("../../../utils/output");
|
|
|
10
10
|
const to_project_name_1 = require("../../../config/to-project-name");
|
|
11
11
|
const error_types_1 = require("../../error-types");
|
|
12
12
|
const target_merging_1 = require("./target-merging");
|
|
13
|
+
const utils_1 = require("./utils");
|
|
13
14
|
const node_fs_1 = require("node:fs");
|
|
14
15
|
const git_worktrees_1 = require("../../../utils/git-worktrees");
|
|
15
16
|
const path_1 = require("path");
|
|
@@ -176,6 +177,87 @@ function warnAboutLegacyCachedTargets(legacyCacheReads) {
|
|
|
176
177
|
bodyLines,
|
|
177
178
|
});
|
|
178
179
|
}
|
|
180
|
+
/**
|
|
181
|
+
* Nothing downstream rejects a key it does not know — the Rust hasher drops it,
|
|
182
|
+
* the Cloud runner reads only the keys it reads, and the Kotlin API decodes with
|
|
183
|
+
* `ignoreUnknownKeys`. So a typo is silent everywhere else, and this is the only
|
|
184
|
+
* place a misspelled option can be reported at all. `'...'` is listed because a
|
|
185
|
+
* spread with no base to resolve against survives merging.
|
|
186
|
+
*/
|
|
187
|
+
const KNOWN_ULTRACACHE_KEYS = new Set([
|
|
188
|
+
'mode',
|
|
189
|
+
'ignoredReads',
|
|
190
|
+
'ignoredWrites',
|
|
191
|
+
utils_1.NX_SPREAD_TOKEN,
|
|
192
|
+
]);
|
|
193
|
+
const ULTRACACHE_MODES = ['on', 'warn', 'error', 'off'];
|
|
194
|
+
function describeUltracacheValue(value) {
|
|
195
|
+
if (Array.isArray(value))
|
|
196
|
+
return 'an array';
|
|
197
|
+
if (value === null)
|
|
198
|
+
return 'null';
|
|
199
|
+
return `a ${typeof value}`;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Describes every way an `ultracache` violates the shape the schema forbids.
|
|
203
|
+
*
|
|
204
|
+
* The schema is editor-only, and everything downstream — the Rust task hasher,
|
|
205
|
+
* the cloud runner's Go and Kotlin deserializers — is strict. A bad value that
|
|
206
|
+
* gets this far is reported far from its source, or silently drops the task's
|
|
207
|
+
* tracking, so it is worth reporting here where the project, target and file
|
|
208
|
+
* are all still in hand.
|
|
209
|
+
*
|
|
210
|
+
* Returns messages rather than throwing: only a WorkspaceValidityError is
|
|
211
|
+
* collected by `validateAndNormalizeProjectRootMap`, and anything else escapes
|
|
212
|
+
* as far as the daemon, which exits on an error it cannot classify.
|
|
213
|
+
*/
|
|
214
|
+
function validateTargetUltracache(ultracache, projectName, projectRoot, targetName, sourceMaps) {
|
|
215
|
+
if (ultracache === undefined) {
|
|
216
|
+
return [];
|
|
217
|
+
}
|
|
218
|
+
const targetSourceMaps = sourceMaps?.[projectRoot];
|
|
219
|
+
const [file, plugin] = targetSourceMaps?.[`targets.${targetName}.ultracache`] ??
|
|
220
|
+
targetSourceMaps?.[`targets.${targetName}`] ??
|
|
221
|
+
[];
|
|
222
|
+
const origin = file
|
|
223
|
+
? ` (defined in ${file})`
|
|
224
|
+
: plugin
|
|
225
|
+
? ` (defined by ${plugin})`
|
|
226
|
+
: '';
|
|
227
|
+
const where = `"${targetName}" in project "${projectName}"${origin}`;
|
|
228
|
+
if (!(0, utils_1.isObject)(ultracache)) {
|
|
229
|
+
return [
|
|
230
|
+
`The "ultracache" configuration for target ${where} must be an object, but it is ${describeUltracacheValue(ultracache)}.`,
|
|
231
|
+
];
|
|
232
|
+
}
|
|
233
|
+
const errors = [];
|
|
234
|
+
for (const key of Object.keys(ultracache)) {
|
|
235
|
+
if (!KNOWN_ULTRACACHE_KEYS.has(key)) {
|
|
236
|
+
errors.push(`"ultracache.${key}" for target ${where} is not an ultracache option. Supported options are "mode", "ignoredReads" and "ignoredWrites".`);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
if (ultracache.mode !== undefined &&
|
|
240
|
+
!ULTRACACHE_MODES.includes(ultracache.mode)) {
|
|
241
|
+
const supported = ULTRACACHE_MODES.map((mode) => `"${mode}"`).join(', ');
|
|
242
|
+
errors.push(`"ultracache.mode" for target ${where} must be one of ${supported}, but it is ${typeof ultracache.mode === 'string'
|
|
243
|
+
? `"${ultracache.mode}"`
|
|
244
|
+
: describeUltracacheValue(ultracache.mode)}.`);
|
|
245
|
+
}
|
|
246
|
+
for (const key of ['ignoredReads', 'ignoredWrites']) {
|
|
247
|
+
const value = ultracache[key];
|
|
248
|
+
if (value === undefined)
|
|
249
|
+
continue;
|
|
250
|
+
if (!Array.isArray(value)) {
|
|
251
|
+
errors.push(`"ultracache.${key}" for target ${where} must be an array of glob patterns, but it is ${describeUltracacheValue(value)}.`);
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
const badIndex = value.findIndex((glob) => typeof glob !== 'string');
|
|
255
|
+
if (badIndex !== -1) {
|
|
256
|
+
errors.push(`"ultracache.${key}[${badIndex}]" for target ${where} must be a glob pattern string, but it is ${describeUltracacheValue(value[badIndex])}.`);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
return errors;
|
|
260
|
+
}
|
|
179
261
|
function normalizeTargets(project, sourceMaps, nxJsonConfiguration, workspaceRoot,
|
|
180
262
|
/**
|
|
181
263
|
* Project configurations keyed by project name
|
|
@@ -190,6 +272,7 @@ legacyCacheReads) {
|
|
|
190
272
|
for (const targetName in project.targets) {
|
|
191
273
|
project.targets[targetName] = normalizeTarget(project.targets[targetName], project, workspaceRoot, projects, [project.root, targetName].join(':'));
|
|
192
274
|
const target = project.targets[targetName];
|
|
275
|
+
targetErrorMessage.push(...validateTargetUltracache(target.ultracache, project.name ?? project.root, project.root, targetName, sourceMaps).map((message) => `- ${message}`));
|
|
193
276
|
const targetDefaults = nxJsonConfiguration.targetDefaults;
|
|
194
277
|
if (isLegacyCachedTarget(targetName, targetDefaults, target)) {
|
|
195
278
|
target.cache = true;
|
|
@@ -35,4 +35,5 @@ type SourceMapContext = {
|
|
|
35
35
|
* preserved so a later merge layer can expand it.
|
|
36
36
|
*/
|
|
37
37
|
export declare function getMergeValueResult<T>(baseValue: unknown, newValue: T | undefined, sourceMapContext?: SourceMapContext, deferSpreadsWithoutBase?: boolean): T | undefined;
|
|
38
|
+
export declare function isObject(value: unknown): value is Record<string, unknown>;
|
|
38
39
|
export {};
|
|
@@ -4,6 +4,7 @@ exports.IntegerLikeSpreadKeyError = exports.INTEGER_LIKE_KEY_PATTERN = exports.N
|
|
|
4
4
|
exports.uniqueKeysInObjects = uniqueKeysInObjects;
|
|
5
5
|
exports.assertNoIntegerLikeSpreadKey = assertNoIntegerLikeSpreadKey;
|
|
6
6
|
exports.getMergeValueResult = getMergeValueResult;
|
|
7
|
+
exports.isObject = isObject;
|
|
7
8
|
const source_maps_1 = require("./source-maps");
|
|
8
9
|
exports.NX_SPREAD_TOKEN = '...';
|
|
9
10
|
/**
|
|
@@ -62,13 +62,28 @@ async function runTasks(executorName, projectGraph, batchTaskGraph, fullTaskGrap
|
|
|
62
62
|
catch (e) {
|
|
63
63
|
const isVerbose = tasks[0].overrides.verbose;
|
|
64
64
|
console.error(isVerbose ? e : e.message);
|
|
65
|
+
// `process.exit` does not wait for pipe writes, so the reason this worker
|
|
66
|
+
// died could otherwise be the one line that never arrives.
|
|
67
|
+
await flushStdio();
|
|
65
68
|
process.exit(1);
|
|
66
69
|
}
|
|
67
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Waits until everything written to stdout and stderr so far has reached the
|
|
73
|
+
* pipe. Writes to a pipe are asynchronous, and the parent learns the batch is
|
|
74
|
+
* over through a separate IPC channel - so without this it can be told the batch
|
|
75
|
+
* finished, or see the process exit, while the end of its output is still in
|
|
76
|
+
* memory here. That tail is where a tool reports what went wrong.
|
|
77
|
+
*/
|
|
78
|
+
function flushStdio() {
|
|
79
|
+
const flush = (stream) => new Promise((resolve) => stream.write('', () => resolve()));
|
|
80
|
+
return Promise.all([flush(process.stdout), flush(process.stderr)]).then(() => undefined);
|
|
81
|
+
}
|
|
68
82
|
process.on('message', async (message) => {
|
|
69
83
|
switch (message.type) {
|
|
70
84
|
case batch_messages_1.BatchMessageType.RunTasks: {
|
|
71
85
|
const results = await runTasks(message.executorName, message.projectGraph, message.batchTaskGraph, message.fullTaskGraph);
|
|
86
|
+
await flushStdio();
|
|
72
87
|
process.send({
|
|
73
88
|
type: batch_messages_1.BatchMessageType.CompleteBatchExecution,
|
|
74
89
|
results,
|
|
@@ -13,6 +13,23 @@ export type TaskWithCachedResult = {
|
|
|
13
13
|
};
|
|
14
14
|
export declare function dbCacheEnabled(): boolean;
|
|
15
15
|
export declare function getCache(options: DefaultTasksRunnerOptions): DbCache | Cache;
|
|
16
|
+
/**
|
|
17
|
+
* Collects the batch worker logs written by `batchOutputPathForKey`.
|
|
18
|
+
*
|
|
19
|
+
* Guarded rather than called straight through: `cache.rs` is
|
|
20
|
+
* `#[cfg(not(target_arch = "wasm32"))]`, so this export does not exist in the
|
|
21
|
+
* WASM binding and calling it there is a `TypeError`. Every other native cache
|
|
22
|
+
* entry point is kept off that path by `dbCacheEnabled()`; this one is a free
|
|
23
|
+
* function, so it needs its own guard. The logs are collected on the next
|
|
24
|
+
* non-WASM run.
|
|
25
|
+
*/
|
|
26
|
+
export declare function sweepBatchOutputs(): void;
|
|
27
|
+
/**
|
|
28
|
+
* Where a batch worker's own log lives. Mirrors `batch_outputs_path` in
|
|
29
|
+
* cache.rs, which is what sweeps the directory — the same mirroring
|
|
30
|
+
* `terminalOutputPathForHash` does for `get_task_outputs_path_internal`.
|
|
31
|
+
*/
|
|
32
|
+
export declare function batchOutputPathForKey(key: string): string;
|
|
16
33
|
export declare class DbCache {
|
|
17
34
|
private readonly options;
|
|
18
35
|
private nxJson;
|
|
@@ -31,8 +48,18 @@ export declare class DbCache {
|
|
|
31
48
|
}>>;
|
|
32
49
|
getUsedCacheSpace(): number;
|
|
33
50
|
private applyRemoteCacheResults;
|
|
34
|
-
put(task: Task, terminalOutput: string | null, outputs: string[], code: number): Promise<
|
|
35
|
-
|
|
51
|
+
put(task: Task, terminalOutput: string | null, outputs: string[], code: number): Promise<import("../native").OutputFile[]>;
|
|
52
|
+
/**
|
|
53
|
+
* Register terminal outputs that were written outside of `put` — uncacheable
|
|
54
|
+
* tasks, and cacheable ones run with `--skip-nx-cache`. `removeOldCacheRecords`
|
|
55
|
+
* only collects hashes it finds in the database, so without this the files
|
|
56
|
+
* would never be cleaned up.
|
|
57
|
+
*/
|
|
58
|
+
recordTerminalOutputs(records: {
|
|
59
|
+
hash: string;
|
|
60
|
+
size: number;
|
|
61
|
+
}[]): void;
|
|
62
|
+
copyFilesFromCache(_: string, cachedResult: CachedResult, outputs: string[]): Promise<import("../native").OutputFile[]>;
|
|
36
63
|
removeOldCacheRecords(): void;
|
|
37
64
|
temporaryOutputPath(task: Task): string;
|
|
38
65
|
private getRemoteCache;
|
|
@@ -63,6 +90,14 @@ export declare class Cache {
|
|
|
63
90
|
put(task: Task, terminalOutput: string | null, outputs: string[], code: number): Promise<void>;
|
|
64
91
|
copyFilesFromCache(hash: string, cachedResult: CachedResult, outputs: string[]): Promise<void>;
|
|
65
92
|
temporaryOutputPath(task: Task): string;
|
|
93
|
+
/**
|
|
94
|
+
* No-op: the legacy cache has no database to record against, and its
|
|
95
|
+
* collection is directory-based rather than driven by cache records.
|
|
96
|
+
*/
|
|
97
|
+
recordTerminalOutputs(_records: {
|
|
98
|
+
hash: string;
|
|
99
|
+
size: number;
|
|
100
|
+
}[]): void;
|
|
66
101
|
private expandOutputsInWorkspace;
|
|
67
102
|
private expandOutputsInCache;
|
|
68
103
|
private _expandOutputs;
|
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Cache = exports.DbCache = void 0;
|
|
4
4
|
exports.dbCacheEnabled = dbCacheEnabled;
|
|
5
5
|
exports.getCache = getCache;
|
|
6
|
+
exports.sweepBatchOutputs = sweepBatchOutputs;
|
|
7
|
+
exports.batchOutputPathForKey = batchOutputPathForKey;
|
|
6
8
|
exports.resolveMaxCacheSize = resolveMaxCacheSize;
|
|
7
9
|
exports.parseMaxCacheSize = parseMaxCacheSize;
|
|
8
10
|
exports.formatCacheSize = formatCacheSize;
|
|
@@ -54,6 +56,30 @@ function getCache(options) {
|
|
|
54
56
|
})
|
|
55
57
|
: new Cache(options);
|
|
56
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Collects the batch worker logs written by `batchOutputPathForKey`.
|
|
61
|
+
*
|
|
62
|
+
* Guarded rather than called straight through: `cache.rs` is
|
|
63
|
+
* `#[cfg(not(target_arch = "wasm32"))]`, so this export does not exist in the
|
|
64
|
+
* WASM binding and calling it there is a `TypeError`. Every other native cache
|
|
65
|
+
* entry point is kept off that path by `dbCacheEnabled()`; this one is a free
|
|
66
|
+
* function, so it needs its own guard. The logs are collected on the next
|
|
67
|
+
* non-WASM run.
|
|
68
|
+
*/
|
|
69
|
+
function sweepBatchOutputs() {
|
|
70
|
+
if (native_1.IS_WASM) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
(0, native_1.sweepBatchOutputs)(cache_directory_1.cacheDir);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Where a batch worker's own log lives. Mirrors `batch_outputs_path` in
|
|
77
|
+
* cache.rs, which is what sweeps the directory — the same mirroring
|
|
78
|
+
* `terminalOutputPathForHash` does for `get_task_outputs_path_internal`.
|
|
79
|
+
*/
|
|
80
|
+
function batchOutputPathForKey(key) {
|
|
81
|
+
return (0, path_1.join)(cache_directory_1.cacheDir, 'batchOutputs', `${key}.log`);
|
|
82
|
+
}
|
|
57
83
|
class DbCache {
|
|
58
84
|
constructor(options) {
|
|
59
85
|
this.options = options;
|
|
@@ -153,14 +179,24 @@ class DbCache {
|
|
|
153
179
|
}
|
|
154
180
|
async put(task, terminalOutput, outputs, code) {
|
|
155
181
|
return tryAndRetry(async () => {
|
|
156
|
-
const expandedOutputs = this.cache.put(task.hash, terminalOutput, outputs, code);
|
|
182
|
+
const { expandedOutputs, files } = this.cache.put(task.hash, terminalOutput, outputs, code);
|
|
157
183
|
// Notify TaskIOService of actual output files
|
|
158
184
|
(0, task_io_service_1.getTaskIOService)().notifyTaskOutputs(task.id, expandedOutputs);
|
|
159
185
|
if (this.remoteCache) {
|
|
160
186
|
await this.remoteCache.store(task.hash, this.cache.cacheDirectory, terminalOutput, code);
|
|
161
187
|
}
|
|
188
|
+
return files;
|
|
162
189
|
});
|
|
163
190
|
}
|
|
191
|
+
/**
|
|
192
|
+
* Register terminal outputs that were written outside of `put` — uncacheable
|
|
193
|
+
* tasks, and cacheable ones run with `--skip-nx-cache`. `removeOldCacheRecords`
|
|
194
|
+
* only collects hashes it finds in the database, so without this the files
|
|
195
|
+
* would never be cleaned up.
|
|
196
|
+
*/
|
|
197
|
+
recordTerminalOutputs(records) {
|
|
198
|
+
this.cache.recordTerminalOutputs(records);
|
|
199
|
+
}
|
|
164
200
|
copyFilesFromCache(_, cachedResult, outputs) {
|
|
165
201
|
return tryAndRetry(async () => this.cache.copyFilesFromCache(cachedResult, outputs));
|
|
166
202
|
}
|
|
@@ -421,6 +457,11 @@ class Cache {
|
|
|
421
457
|
temporaryOutputPath(task) {
|
|
422
458
|
return (0, path_1.join)(this.terminalOutputsDir, task.hash);
|
|
423
459
|
}
|
|
460
|
+
/**
|
|
461
|
+
* No-op: the legacy cache has no database to record against, and its
|
|
462
|
+
* collection is directory-based rather than driven by cache records.
|
|
463
|
+
*/
|
|
464
|
+
recordTerminalOutputs(_records) { }
|
|
424
465
|
async expandOutputsInWorkspace(outputs) {
|
|
425
466
|
return this._expandOutputs(outputs, workspace_root_1.workspaceRoot);
|
|
426
467
|
}
|
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
import { ProjectGraph, ProjectGraphProjectNode } from '../config/project-graph';
|
|
2
2
|
import { Task, TaskGraph } from '../config/task-graph';
|
|
3
3
|
import { TargetDependencies } from '../config/nx-json';
|
|
4
|
+
/**
|
|
5
|
+
* For each task, the overrides every `dependsOn` edge into it would give it,
|
|
6
|
+
* whether or not that edge created the task. `from` is the task the edge
|
|
7
|
+
* leaves; an edge crossing a project without the target is recorded against
|
|
8
|
+
* the task it started from.
|
|
9
|
+
*/
|
|
10
|
+
export type DependencyOverrides = Record<string, Array<{
|
|
11
|
+
from: string;
|
|
12
|
+
overrides: Record<string, unknown>;
|
|
13
|
+
}>>;
|
|
4
14
|
export declare class ProcessTasks {
|
|
5
15
|
private readonly extraTargetDependencies;
|
|
6
16
|
private readonly projectGraph;
|
|
17
|
+
private readonly recordDependencyOverrides;
|
|
7
18
|
private readonly seen;
|
|
8
19
|
readonly tasks: {
|
|
9
20
|
[id: string]: Task;
|
|
@@ -14,18 +25,30 @@ export declare class ProcessTasks {
|
|
|
14
25
|
readonly continuousDependencies: {
|
|
15
26
|
[k: string]: string[];
|
|
16
27
|
};
|
|
28
|
+
readonly dependencyOverrides: DependencyOverrides;
|
|
17
29
|
private readonly allTargetNames;
|
|
18
|
-
constructor(extraTargetDependencies: TargetDependencies, projectGraph: ProjectGraph);
|
|
30
|
+
constructor(extraTargetDependencies: TargetDependencies, projectGraph: ProjectGraph, recordDependencyOverrides?: boolean);
|
|
19
31
|
processTasks(projectNames: string[], targets: string[], configuration: string, overrides: Record<string, unknown>, excludeTaskDependencies: boolean): string[];
|
|
20
32
|
processTask(task: Task, projectUsedToDeriveDependencies: string, configuration: string, overrides: Record<string, unknown>): void;
|
|
21
33
|
private processTasksForMultipleProjects;
|
|
22
34
|
private processTasksForSingleProject;
|
|
23
35
|
private processTasksForDependencies;
|
|
36
|
+
private recordEdge;
|
|
24
37
|
private createDummyTask;
|
|
25
38
|
createTask(id: string, project: ProjectGraphProjectNode, target: string, resolvedConfiguration: string | undefined, overrides: Record<string, unknown>): Task;
|
|
26
39
|
resolveConfiguration(project: ProjectGraphProjectNode, target: string, configuration: string | undefined): string;
|
|
27
40
|
}
|
|
28
41
|
export declare function createTaskGraph(projectGraph: ProjectGraph, extraTargetDependencies: TargetDependencies, projectNames: string[], targets: string[], configuration: string | undefined, overrides: Record<string, unknown>, excludeTaskDependencies?: boolean): TaskGraph;
|
|
42
|
+
/** `createTaskGraph`, plus the overrides each dependency edge would give. */
|
|
43
|
+
export declare function createTaskGraphWithDependencyOverrides(projectGraph: ProjectGraph, extraTargetDependencies: TargetDependencies, projectNames: string[], targets: string[], configuration: string | undefined, overrides: Record<string, unknown>, excludeTaskDependencies?: boolean): {
|
|
44
|
+
taskGraph: TaskGraph;
|
|
45
|
+
dependencyOverrides: DependencyOverrides;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* `taskGraph` pruned to `keep`, as if built from `initial` alone: a kept dependency
|
|
49
|
+
* takes the overrides its edges give it. Undefined when those edges disagree or are missing.
|
|
50
|
+
*/
|
|
51
|
+
export declare function filterTaskGraphToSelection(projectGraph: ProjectGraph, taskGraph: TaskGraph, dependencyOverrides: DependencyOverrides, initial: Set<string>, keep: Set<string>): TaskGraph | undefined;
|
|
29
52
|
/**
|
|
30
53
|
* This function is used to filter out the dummy tasks from the dependencies
|
|
31
54
|
* It will manipulate the dependencies object in place
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ProcessTasks = void 0;
|
|
4
4
|
exports.createTaskGraph = createTaskGraph;
|
|
5
|
+
exports.createTaskGraphWithDependencyOverrides = createTaskGraphWithDependencyOverrides;
|
|
6
|
+
exports.filterTaskGraphToSelection = filterTaskGraphToSelection;
|
|
5
7
|
exports.filterDummyTasks = filterDummyTasks;
|
|
6
8
|
exports.getNonDummyDeps = getNonDummyDeps;
|
|
7
9
|
const utils_1 = require("./utils");
|
|
@@ -10,13 +12,15 @@ const output_1 = require("../utils/output");
|
|
|
10
12
|
const task_graph_utils_1 = require("./task-graph-utils");
|
|
11
13
|
const DUMMY_TASK_TARGET = '__nx_dummy_task__';
|
|
12
14
|
class ProcessTasks {
|
|
13
|
-
constructor(extraTargetDependencies, projectGraph) {
|
|
15
|
+
constructor(extraTargetDependencies, projectGraph, recordDependencyOverrides = false) {
|
|
14
16
|
this.extraTargetDependencies = extraTargetDependencies;
|
|
15
17
|
this.projectGraph = projectGraph;
|
|
18
|
+
this.recordDependencyOverrides = recordDependencyOverrides;
|
|
16
19
|
this.seen = new Set();
|
|
17
20
|
this.tasks = {};
|
|
18
21
|
this.dependencies = {};
|
|
19
22
|
this.continuousDependencies = {};
|
|
23
|
+
this.dependencyOverrides = {};
|
|
20
24
|
const allTargetNames = new Set();
|
|
21
25
|
for (const projectName in projectGraph.nodes) {
|
|
22
26
|
const project = projectGraph.nodes[projectName];
|
|
@@ -126,6 +130,7 @@ class ProcessTasks {
|
|
|
126
130
|
this.processTask(newTask, newTask.target.project, configuration, overrides);
|
|
127
131
|
}
|
|
128
132
|
if (task.id !== selfTaskId) {
|
|
133
|
+
this.recordEdge(task, selfTaskId, taskOverrides);
|
|
129
134
|
if (this.tasks[selfTaskId].continuous) {
|
|
130
135
|
this.continuousDependencies[task.id].push(selfTaskId);
|
|
131
136
|
}
|
|
@@ -149,6 +154,7 @@ class ProcessTasks {
|
|
|
149
154
|
const depTargetId = (0, utils_1.createTaskId)(depProject.name, dependencyConfig.target, resolvedConfiguration);
|
|
150
155
|
const depTargetConfiguration = this.projectGraph.nodes[depProject.name].data.targets[dependencyConfig.target];
|
|
151
156
|
if (task.id !== depTargetId) {
|
|
157
|
+
this.recordEdge(task, depTargetId, taskOverrides);
|
|
152
158
|
if (depTargetConfiguration.continuous) {
|
|
153
159
|
this.continuousDependencies[task.id].push(depTargetId);
|
|
154
160
|
}
|
|
@@ -172,6 +178,7 @@ class ProcessTasks {
|
|
|
172
178
|
dependencyConfig.target +
|
|
173
179
|
DUMMY_TASK_TARGET, undefined);
|
|
174
180
|
this.dependencies[task.id].push(dummyId);
|
|
181
|
+
this.continuousDependencies[task.id].push(dummyId);
|
|
175
182
|
this.dependencies[dummyId] ??= [];
|
|
176
183
|
this.continuousDependencies[dummyId] ??= [];
|
|
177
184
|
const noopTask = this.createDummyTask(dummyId, task);
|
|
@@ -179,6 +186,14 @@ class ProcessTasks {
|
|
|
179
186
|
}
|
|
180
187
|
}
|
|
181
188
|
}
|
|
189
|
+
recordEdge(task, dependencyId, overrides) {
|
|
190
|
+
if (!this.recordDependencyOverrides) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
// A dummy task keeps its creator's target, so `from` is the real task the edge started from.
|
|
194
|
+
const from = (0, utils_1.createTaskId)(task.target.project, task.target.target, task.target.configuration);
|
|
195
|
+
(this.dependencyOverrides[dependencyId] ??= []).push({ from, overrides });
|
|
196
|
+
}
|
|
182
197
|
createDummyTask(id, task) {
|
|
183
198
|
return {
|
|
184
199
|
...task,
|
|
@@ -207,6 +222,7 @@ class ProcessTasks {
|
|
|
207
222
|
cache: project.data.targets[target].cache ?? false,
|
|
208
223
|
parallelism: project.data.targets[target].parallelism ?? true,
|
|
209
224
|
continuous: project.data.targets[target].continuous ?? false,
|
|
225
|
+
ultracache: project.data.targets[target].ultracache,
|
|
210
226
|
};
|
|
211
227
|
}
|
|
212
228
|
resolveConfiguration(project, target, configuration) {
|
|
@@ -219,7 +235,46 @@ class ProcessTasks {
|
|
|
219
235
|
}
|
|
220
236
|
exports.ProcessTasks = ProcessTasks;
|
|
221
237
|
function createTaskGraph(projectGraph, extraTargetDependencies, projectNames, targets, configuration, overrides, excludeTaskDependencies = false) {
|
|
222
|
-
|
|
238
|
+
return buildTaskGraph(new ProcessTasks(extraTargetDependencies, projectGraph), projectNames, targets, configuration, overrides, excludeTaskDependencies);
|
|
239
|
+
}
|
|
240
|
+
/** `createTaskGraph`, plus the overrides each dependency edge would give. */
|
|
241
|
+
function createTaskGraphWithDependencyOverrides(projectGraph, extraTargetDependencies, projectNames, targets, configuration, overrides, excludeTaskDependencies = false) {
|
|
242
|
+
const p = new ProcessTasks(extraTargetDependencies, projectGraph, true);
|
|
243
|
+
const taskGraph = buildTaskGraph(p, projectNames, targets, configuration, overrides, excludeTaskDependencies);
|
|
244
|
+
return { taskGraph, dependencyOverrides: p.dependencyOverrides };
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* `taskGraph` pruned to `keep`, as if built from `initial` alone: a kept dependency
|
|
248
|
+
* takes the overrides its edges give it. Undefined when those edges disagree or are missing.
|
|
249
|
+
*/
|
|
250
|
+
function filterTaskGraphToSelection(projectGraph, taskGraph, dependencyOverrides, initial, keep) {
|
|
251
|
+
const tasks = {};
|
|
252
|
+
for (const id of keep) {
|
|
253
|
+
const task = taskGraph.tasks[id];
|
|
254
|
+
if (initial.has(id)) {
|
|
255
|
+
tasks[id] = { ...task };
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
258
|
+
const edges = dependencyOverrides[id] ?? [];
|
|
259
|
+
if (!edges.length) {
|
|
260
|
+
return undefined;
|
|
261
|
+
}
|
|
262
|
+
const first = JSON.stringify(edges[0].overrides);
|
|
263
|
+
if (edges.some((e) => JSON.stringify(e.overrides) !== first)) {
|
|
264
|
+
return undefined;
|
|
265
|
+
}
|
|
266
|
+
const project = projectGraph.nodes[task.target.project];
|
|
267
|
+
const overrides = interpolateOverrides(edges[0].overrides, project.name, project.data);
|
|
268
|
+
tasks[id] = {
|
|
269
|
+
...task,
|
|
270
|
+
overrides,
|
|
271
|
+
outputs: (0, utils_1.getOutputs)(projectGraph.nodes, task.target, overrides),
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
const pruned = (0, utils_1.removeTasksFromTaskGraph)(taskGraph, Object.keys(taskGraph.tasks).filter((id) => !keep.has(id)));
|
|
275
|
+
return { ...pruned, tasks };
|
|
276
|
+
}
|
|
277
|
+
function buildTaskGraph(p, projectNames, targets, configuration, overrides, excludeTaskDependencies) {
|
|
223
278
|
const roots = p.processTasks(projectNames, targets, configuration, overrides, excludeTaskDependencies);
|
|
224
279
|
return {
|
|
225
280
|
roots,
|
|
@@ -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?.
|
|
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.deferredTaskIds);
|
|
72
72
|
return orchestrator.run();
|
|
73
73
|
}
|
|
74
74
|
exports.default = exports.defaultTasksRunner;
|
|
@@ -17,7 +17,7 @@ export declare class ForkedProcessTaskRunner {
|
|
|
17
17
|
private pseudoTerminals;
|
|
18
18
|
constructor(options: DefaultTasksRunnerOptions, tuiEnabled: boolean);
|
|
19
19
|
init(): Promise<void>;
|
|
20
|
-
forkProcessForBatch({ id: batchId, executorName, taskGraph: batchTaskGraph }: Batch, projectGraph: ProjectGraph, fullTaskGraph: TaskGraph, env: NodeJS.ProcessEnv): Promise<BatchProcess>;
|
|
20
|
+
forkProcessForBatch({ id: batchId, executorName, taskGraph: batchTaskGraph }: Batch, projectGraph: ProjectGraph, fullTaskGraph: TaskGraph, env: NodeJS.ProcessEnv, printsOutput?: boolean): Promise<BatchProcess>;
|
|
21
21
|
cleanUpBatchProcesses(): void;
|
|
22
22
|
forkProcessLegacy(task: Task, { temporaryOutputPath, streamOutput, pipeOutput, taskGraph, env, }: {
|
|
23
23
|
temporaryOutputPath: string;
|
|
@@ -5,6 +5,7 @@ const child_process_1 = require("child_process");
|
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
const output_1 = require("../utils/output");
|
|
8
|
+
const prune_task_graph_1 = require("./prune-task-graph");
|
|
8
9
|
const strip_indents_1 = require("../utils/strip-indents");
|
|
9
10
|
const batch_messages_1 = require("./batch/batch-messages");
|
|
10
11
|
const process_metrics_service_1 = require("./process-metrics-service");
|
|
@@ -29,7 +30,7 @@ class ForkedProcessTaskRunner {
|
|
|
29
30
|
this.setupProcessEventListeners();
|
|
30
31
|
}
|
|
31
32
|
// TODO: vsavkin delegate terminal output printing
|
|
32
|
-
async forkProcessForBatch({ id: batchId, executorName, taskGraph: batchTaskGraph }, projectGraph, fullTaskGraph, env) {
|
|
33
|
+
async forkProcessForBatch({ id: batchId, executorName, taskGraph: batchTaskGraph }, projectGraph, fullTaskGraph, env, printsOutput = true) {
|
|
33
34
|
const count = Object.keys(batchTaskGraph.tasks).length;
|
|
34
35
|
if (count > 1) {
|
|
35
36
|
output_1.output.logSingleLine(`Running ${output_1.output.bold(count)} ${output_1.output.bold('tasks')} with ${output_1.output.bold(executorName)}`);
|
|
@@ -50,7 +51,7 @@ class ForkedProcessTaskRunner {
|
|
|
50
51
|
const taskIds = Object.keys(batchTaskGraph.tasks);
|
|
51
52
|
(0, process_metrics_service_1.getProcessMetricsService)().registerBatch(batchId, taskIds, p.pid);
|
|
52
53
|
}
|
|
53
|
-
const cp = new batch_process_1.BatchProcess(p, executorName);
|
|
54
|
+
const cp = new batch_process_1.BatchProcess(p, executorName, printsOutput, batchId);
|
|
54
55
|
this.processes.add(cp);
|
|
55
56
|
cp.onExit(() => {
|
|
56
57
|
this.processes.delete(cp);
|
|
@@ -60,8 +61,8 @@ class ForkedProcessTaskRunner {
|
|
|
60
61
|
type: batch_messages_1.BatchMessageType.RunTasks,
|
|
61
62
|
executorName,
|
|
62
63
|
projectGraph,
|
|
63
|
-
batchTaskGraph,
|
|
64
|
-
fullTaskGraph,
|
|
64
|
+
batchTaskGraph: (0, prune_task_graph_1.pruneTaskGraph)(batchTaskGraph),
|
|
65
|
+
fullTaskGraph: (0, prune_task_graph_1.pruneTaskGraph)(fullTaskGraph),
|
|
65
66
|
});
|
|
66
67
|
return cp;
|
|
67
68
|
}
|
|
@@ -143,12 +144,12 @@ class ForkedProcessTaskRunner {
|
|
|
143
144
|
// Register forked process for metrics collection
|
|
144
145
|
const pid = p.getPid();
|
|
145
146
|
if (pid) {
|
|
146
|
-
(0, task_io_service_1.registerTaskProcessStart)(task
|
|
147
|
+
(0, task_io_service_1.registerTaskProcessStart)(task, pid);
|
|
147
148
|
}
|
|
148
149
|
p.send({
|
|
149
150
|
targetDescription: task.target,
|
|
150
151
|
overrides: task.overrides,
|
|
151
|
-
taskGraph,
|
|
152
|
+
taskGraph: (0, prune_task_graph_1.pruneTaskGraph)(taskGraph),
|
|
152
153
|
isVerbose: this.verbose,
|
|
153
154
|
});
|
|
154
155
|
this.processes.add(p);
|
|
@@ -180,13 +181,13 @@ class ForkedProcessTaskRunner {
|
|
|
180
181
|
});
|
|
181
182
|
// Register forked process for metrics collection
|
|
182
183
|
if (p.pid) {
|
|
183
|
-
(0, task_io_service_1.registerTaskProcessStart)(task
|
|
184
|
+
(0, task_io_service_1.registerTaskProcessStart)(task, p.pid);
|
|
184
185
|
}
|
|
185
186
|
// Send message to run the executor
|
|
186
187
|
p.send({
|
|
187
188
|
targetDescription: task.target,
|
|
188
189
|
overrides: task.overrides,
|
|
189
|
-
taskGraph,
|
|
190
|
+
taskGraph: (0, prune_task_graph_1.pruneTaskGraph)(taskGraph),
|
|
190
191
|
isVerbose: this.verbose,
|
|
191
192
|
});
|
|
192
193
|
const cp = new node_child_process_1.NodeChildProcessWithNonDirectOutput(p, {
|
|
@@ -223,7 +224,7 @@ class ForkedProcessTaskRunner {
|
|
|
223
224
|
});
|
|
224
225
|
// Register forked process for metrics collection
|
|
225
226
|
if (p.pid) {
|
|
226
|
-
(0, task_io_service_1.registerTaskProcessStart)(task
|
|
227
|
+
(0, task_io_service_1.registerTaskProcessStart)(task, p.pid);
|
|
227
228
|
}
|
|
228
229
|
const cp = new node_child_process_1.NodeChildProcessWithDirectOutput(p, temporaryOutputPath);
|
|
229
230
|
this.processes.add(cp);
|
|
@@ -231,7 +232,7 @@ class ForkedProcessTaskRunner {
|
|
|
231
232
|
p.send({
|
|
232
233
|
targetDescription: task.target,
|
|
233
234
|
overrides: task.overrides,
|
|
234
|
-
taskGraph,
|
|
235
|
+
taskGraph: (0, prune_task_graph_1.pruneTaskGraph)(taskGraph),
|
|
235
236
|
isVerbose: this.verbose,
|
|
236
237
|
});
|
|
237
238
|
cp.onExit((code, signal) => {
|