@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
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
[](<>)
|
|
13
13
|
[](http://commitizen.github.io/cz-cli/)
|
|
14
14
|
[](https://go.nx.dev/community)
|
|
15
|
-
[](https://nx.dev/nx-cloud)
|
|
16
16
|
|
|
17
17
|
</div>
|
|
18
18
|
|
package/dist/bin/init-local.js
CHANGED
|
@@ -9,6 +9,7 @@ const client_1 = require("../src/daemon/client/client");
|
|
|
9
9
|
const prompt_helpers_1 = require("../src/utils/prompt-helpers");
|
|
10
10
|
const output_1 = require("../src/utils/output");
|
|
11
11
|
const analytics_1 = require("../src/analytics");
|
|
12
|
+
const is_ci_1 = require("../src/utils/is-ci");
|
|
12
13
|
/**
|
|
13
14
|
* Nx is being run inside a workspace.
|
|
14
15
|
*
|
|
@@ -119,6 +120,11 @@ function shouldDelegateToAngularCLI() {
|
|
|
119
120
|
return commands.indexOf(command) > -1;
|
|
120
121
|
}
|
|
121
122
|
async function ensureNxConsoleInstalledViaDaemon() {
|
|
123
|
+
// Asking the daemon makes a fresh daemon install nx@latest in the background,
|
|
124
|
+
// so skip it whenever the prompt could not be shown anyway.
|
|
125
|
+
if (!process.stdout.isTTY || (0, is_ci_1.isCI)()) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
122
128
|
// Only proceed if daemon is available
|
|
123
129
|
if (!client_1.daemonClient.enabled() || !(await client_1.daemonClient.isServerAvailable())) {
|
|
124
130
|
return;
|
|
@@ -126,7 +132,7 @@ async function ensureNxConsoleInstalledViaDaemon() {
|
|
|
126
132
|
// Get status from daemon
|
|
127
133
|
const status = await client_1.daemonClient.getNxConsoleStatus();
|
|
128
134
|
// If we should prompt the user
|
|
129
|
-
if (status.shouldPrompt
|
|
135
|
+
if (status.shouldPrompt) {
|
|
130
136
|
output_1.output.log({
|
|
131
137
|
title: "Install Nx's official editor extension to:",
|
|
132
138
|
bodyLines: [
|
package/dist/bin/nx.js
CHANGED
|
@@ -198,13 +198,13 @@ function resolveNx(workspace) {
|
|
|
198
198
|
const installPath = (0, installation_directory_1.getNxInstallationPath)(root);
|
|
199
199
|
if ((0, fs_1.existsSync)(installPath)) {
|
|
200
200
|
const installRequire = (0, module_1.createRequire)((0, path_1.join)(installPath, 'package.json'));
|
|
201
|
-
return installRequire.resolve('nx/bin/nx.js');
|
|
201
|
+
return installRequire.resolve('@ohos-ports/nx/dist/bin/nx.js');
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
catch { }
|
|
205
205
|
// check for root install
|
|
206
206
|
const rootRequire = (0, module_1.createRequire)((0, path_1.join)(root, 'package.json'));
|
|
207
|
-
return rootRequire.resolve('nx/bin/nx.js');
|
|
207
|
+
return rootRequire.resolve('@ohos-ports/nx/dist/bin/nx.js');
|
|
208
208
|
}
|
|
209
209
|
function isNxCloudCommand(command) {
|
|
210
210
|
const nxCloudCommands = [
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { importUltracacheConfigurations, openUltracacheConfigurations, } from './src/ultracache/store';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Nx internals for the Nx Cloud client, loaded as `nx/nx-cloud-internals`; not
|
|
3
|
+
// a public API. The client probes these exports to tell what this nx supports,
|
|
4
|
+
// so keep them stable.
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.openUltracacheConfigurations = exports.importUltracacheConfigurations = void 0;
|
|
7
|
+
var store_1 = require("./src/ultracache/store");
|
|
8
|
+
Object.defineProperty(exports, "importUltracacheConfigurations", { enumerable: true, get: function () { return store_1.importUltracacheConfigurations; } });
|
|
9
|
+
Object.defineProperty(exports, "openUltracacheConfigurations", { enumerable: true, get: function () { return store_1.openUltracacheConfigurations; } });
|
|
@@ -29,7 +29,7 @@ const plugin = {
|
|
|
29
29
|
const patterns = (0, package_json_1.buildPackageJsonPatterns)(context.workspaceRoot, (f) => (0, fileutils_1.readJsonFile)((0, path_1.join)(context.workspaceRoot, f)));
|
|
30
30
|
const isInPackageJsonWorkspaces = (0, package_json_1.buildPackageJsonWorkspacesMatcher)(patterns);
|
|
31
31
|
const packageManagerCommand = (0, package_manager_1.getPackageManagerCommand)((0, package_manager_1.detectPackageManager)(context.workspaceRoot), context.workspaceRoot);
|
|
32
|
-
const result = (0, plugins_1.createNodesFromFiles)((packageJsonPath) => (0, package_json_1.createNodeFromPackageJson)(packageJsonPath, workspace_root_1.workspaceRoot, cache, isInPackageJsonWorkspaces(packageJsonPath), packageManagerCommand), configFiles, options, context);
|
|
32
|
+
const result = (0, plugins_1.createNodesFromFiles)((packageJsonPath) => (0, package_json_1.createNodeFromPackageJson)(packageJsonPath, workspace_root_1.workspaceRoot, cache, isInPackageJsonWorkspaces(packageJsonPath), packageManagerCommand, context.nxJsonConfiguration), configFiles, options, context);
|
|
33
33
|
writeCache();
|
|
34
34
|
return result;
|
|
35
35
|
},
|
|
@@ -49,12 +49,16 @@ async function installPackage(pkgName, version, nxJson) {
|
|
|
49
49
|
// pnpm 11+ fails the install when the plugin's own dependency tree
|
|
50
50
|
// carries unacknowledged build scripts, and the plugin's generators can
|
|
51
51
|
// only record allowBuilds decisions after this install. Warn and skip
|
|
52
|
-
// for this one install, like pnpm 10 did.
|
|
52
|
+
// for this one install, like pnpm 10 did. pnpm 12 gave `--config` a
|
|
53
|
+
// meaning of its own and takes the setting from the environment instead.
|
|
54
|
+
const env = { ...process.env };
|
|
53
55
|
if (pm === 'pnpm' && (0, semver_1.gte)(pmv, '11.0.0')) {
|
|
54
56
|
command += ' --config.strictDepBuilds=false';
|
|
57
|
+
env.PNPM_CONFIG_STRICT_DEP_BUILDS = 'false';
|
|
55
58
|
}
|
|
56
59
|
await new Promise((resolve) => (0, child_process_1.exec)(command, {
|
|
57
60
|
windowsHide: true,
|
|
61
|
+
env,
|
|
58
62
|
}, (error, stdout, stderr) => {
|
|
59
63
|
if (error) {
|
|
60
64
|
spinner.fail();
|
|
@@ -14,6 +14,9 @@ const affected_project_graph_1 = require("../../project-graph/affected/affected-
|
|
|
14
14
|
const configuration_1 = require("../../config/configuration");
|
|
15
15
|
const find_matching_projects_1 = require("../../utils/find-matching-projects");
|
|
16
16
|
const graph_1 = require("../graph/graph");
|
|
17
|
+
const affected_tasks_1 = require("../../project-graph/affected/affected-tasks");
|
|
18
|
+
const affected_reasons_1 = require("../../project-graph/affected/affected-reasons");
|
|
19
|
+
const print_explanation_1 = require("../../project-graph/affected/print-explanation");
|
|
17
20
|
async function affected(command, args, extraTargetDependencies = {}, extraOptions = {
|
|
18
21
|
excludeTaskDependencies: args.excludeTaskDependencies,
|
|
19
22
|
loadDotEnvFiles: process.env.NX_LOAD_DOT_ENV_FILES !== 'false',
|
|
@@ -25,16 +28,64 @@ async function affected(command, args, extraTargetDependencies = {}, extraOption
|
|
|
25
28
|
printWarnings: command !== 'print-affected' && !args.plain && args.graph !== 'stdout',
|
|
26
29
|
}, nxJson);
|
|
27
30
|
await (0, connect_to_nx_cloud_1.connectToNxCloudIfExplicitlyAsked)(nxArgs);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
// Task selection needs a target to select against, so `nx graph --affected`
|
|
32
|
+
// and the deprecated print-affected stay project-grained.
|
|
33
|
+
const useTasks = (0, affected_tasks_1.selectsAffectedTasks)() &&
|
|
34
|
+
command === 'affected' &&
|
|
35
|
+
!!nxArgs.targets?.length;
|
|
36
|
+
if ((0, affected_reasons_1.isExplaining)(nxArgs.explain) && !useTasks) {
|
|
37
|
+
throw new Error((0, affected_reasons_1.explainUnavailable)([
|
|
38
|
+
!(0, affected_tasks_1.selectsAffectedTasks)() && 'NX_LEGACY_AFFECTED=false',
|
|
39
|
+
!nxArgs.targets?.length && 'targets passed with --targets (-t)',
|
|
40
|
+
].filter(Boolean)));
|
|
41
|
+
}
|
|
42
|
+
// Outside the try so errors reach handleErrors, as they did from inside runCommand.
|
|
43
|
+
let projectGraph;
|
|
44
|
+
let taskSelection;
|
|
45
|
+
let projects = [];
|
|
46
|
+
if (useTasks) {
|
|
47
|
+
let explanation;
|
|
48
|
+
({ projectGraph, taskSelection, explanation } = await (0, affected_tasks_1.computeAffectedTasks)({
|
|
49
|
+
nxJson,
|
|
50
|
+
targets: nxArgs.targets,
|
|
51
|
+
touchedFiles: (0, file_utils_1.calculateFileChanges)((0, command_line_utils_1.parseFiles)(nxArgs).files, nxArgs),
|
|
52
|
+
fileChangeArgs: {
|
|
53
|
+
base: nxArgs.base,
|
|
54
|
+
head: nxArgs.head,
|
|
55
|
+
files: nxArgs.files,
|
|
56
|
+
},
|
|
57
|
+
configuration: nxArgs.configuration,
|
|
58
|
+
overrides,
|
|
59
|
+
extraTargetDependencies,
|
|
60
|
+
excludeTaskDependencies: extraOptions.excludeTaskDependencies,
|
|
61
|
+
exclude: nxArgs.exclude,
|
|
62
|
+
explain: (0, affected_reasons_1.isExplaining)(nxArgs.explain),
|
|
63
|
+
...(await (0, run_command_1.runnerInputsForSelection)(nxArgs, nxJson)),
|
|
64
|
+
}));
|
|
65
|
+
// --explain reports the selection rather than acting on it: someone asking
|
|
66
|
+
// why a task is affected does not also want it to run.
|
|
67
|
+
if ((0, affected_reasons_1.isExplaining)(nxArgs.explain)) {
|
|
68
|
+
(0, print_explanation_1.printAffectedExplanation)(explanation, 'Affected tasks', nxArgs.explain, {
|
|
69
|
+
verbose: args.verbose,
|
|
70
|
+
});
|
|
71
|
+
await output_1.output.drain();
|
|
72
|
+
process.exit(0);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
projectGraph = await (0, project_graph_1.createProjectGraphAsync)({ exitOnError: true });
|
|
77
|
+
projects = await getAffectedGraphNodes(nxArgs, projectGraph);
|
|
78
|
+
if (command === 'affected' && !nxArgs.graph) {
|
|
79
|
+
taskSelection = (0, run_command_1.selectTasksForProjects)(projectGraph, projectsWithTarget(projects, nxArgs), nxArgs, overrides, extraTargetDependencies, extraOptions.excludeTaskDependencies);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
32
82
|
try {
|
|
33
83
|
switch (command) {
|
|
34
84
|
case 'affected': {
|
|
35
|
-
const projectsWithTarget = allProjectsWithTarget(projects, nxArgs);
|
|
36
85
|
if (nxArgs.graph) {
|
|
37
|
-
const projectNames =
|
|
86
|
+
const projectNames = useTasks
|
|
87
|
+
? initiatingProjects(taskSelection)
|
|
88
|
+
: projectsWithTarget(projects, nxArgs);
|
|
38
89
|
const file = (0, command_line_utils_1.readGraphFileFromGraphArg)(nxArgs);
|
|
39
90
|
return await (0, graph_1.generateGraph)({
|
|
40
91
|
watch: true,
|
|
@@ -45,10 +96,13 @@ async function affected(command, args, extraTargetDependencies = {}, extraOption
|
|
|
45
96
|
(!nxArgs.projects || nxArgs.projects.length === 0),
|
|
46
97
|
projects: projectNames,
|
|
47
98
|
file,
|
|
99
|
+
taskSelection: taskSelection ??
|
|
100
|
+
(() => (0, run_command_1.selectTasksForProjects)(projectGraph, projectNames, nxArgs, overrides, extraTargetDependencies, extraOptions.excludeTaskDependencies)),
|
|
101
|
+
configuration: nxArgs.configuration,
|
|
48
102
|
}, projectNames);
|
|
49
103
|
}
|
|
50
104
|
else {
|
|
51
|
-
const status = await (0, run_command_1.runCommand)(
|
|
105
|
+
const status = await (0, run_command_1.runCommand)(taskSelection, projectGraph, { nxJson }, nxArgs, overrides, null, extraTargetDependencies, extraOptions);
|
|
52
106
|
await output_1.output.drain();
|
|
53
107
|
process.exit(status);
|
|
54
108
|
}
|
|
@@ -74,8 +128,15 @@ async function getAffectedGraphNodes(nxArgs, projectGraph) {
|
|
|
74
128
|
}
|
|
75
129
|
return Object.values(affectedGraph.nodes);
|
|
76
130
|
}
|
|
77
|
-
function
|
|
78
|
-
return
|
|
131
|
+
function initiatingProjects(selection) {
|
|
132
|
+
return [
|
|
133
|
+
...new Set(selection.initiatingTaskIds.map((id) => selection.taskGraph.tasks[id].target.project)),
|
|
134
|
+
];
|
|
135
|
+
}
|
|
136
|
+
function projectsWithTarget(projects, nxArgs) {
|
|
137
|
+
return projects
|
|
138
|
+
.filter((p) => nxArgs.targets.find((target) => (0, project_graph_utils_1.projectHasTarget)(p, target)))
|
|
139
|
+
.map((p) => p.name);
|
|
79
140
|
}
|
|
80
141
|
function printError(e, verbose) {
|
|
81
142
|
const bodyLines = [e.message];
|
|
@@ -8,7 +8,7 @@ const shared_options_1 = require("../yargs-utils/shared-options");
|
|
|
8
8
|
exports.yargsAffectedCommand = {
|
|
9
9
|
command: 'affected',
|
|
10
10
|
describe: 'Run target for affected projects. Affected projects are projects that have been changed and projects that depend on the changed projects. See https://nx.dev/ci/features/affected for more details.',
|
|
11
|
-
builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)((0, shared_options_1.withAffectedOptions)((0, shared_options_1.withTuiOptions)((0, shared_options_1.withRunOptions)((0, shared_options_1.withOutputStyleOption)((0, shared_options_1.withTargetAndConfigurationOption)((0, shared_options_1.withBatch)(yargs))))))
|
|
11
|
+
builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)((0, shared_options_1.withAffectedOptions)((0, shared_options_1.withTuiOptions)((0, shared_options_1.withRunOptions)((0, shared_options_1.withOutputStyleOption)((0, shared_options_1.withTargetAndConfigurationOption)((0, shared_options_1.withBatch)((0, shared_options_1.withExplainOption)(yargs)))))))
|
|
12
12
|
.option('all', {
|
|
13
13
|
type: 'boolean',
|
|
14
14
|
deprecated: 'Use `nx run-many` instead',
|
|
@@ -18,15 +18,6 @@ const ignore_1 = require("../../utils/ignore");
|
|
|
18
18
|
const object_sort_1 = require("../../utils/object-sort");
|
|
19
19
|
const output_1 = require("../../utils/output");
|
|
20
20
|
const workspace_root_1 = require("../../utils/workspace-root");
|
|
21
|
-
/**
|
|
22
|
-
* A table, not a `switch`: this lookup sits inside a `try` whose `catch`
|
|
23
|
-
* reports "configured but not installed", and a `never` arm would throw into
|
|
24
|
-
* that catch and be misreported. A missing member is a compile error here.
|
|
25
|
-
*/
|
|
26
|
-
const resolveFormatterBin = {
|
|
27
|
-
oxfmt: oxfmt_1.getOxfmtBinPath,
|
|
28
|
-
prettier: prettier_1.getPrettierPath,
|
|
29
|
-
};
|
|
30
21
|
async function format(command, args) {
|
|
31
22
|
const formatterType = (0, formatters_1.detectFormatter)(workspace_root_1.workspaceRoot);
|
|
32
23
|
if (!formatterType) {
|
|
@@ -41,7 +32,7 @@ async function format(command, args) {
|
|
|
41
32
|
// node_modules. Resolving now turns a raw MODULE_NOT_FOUND into something
|
|
42
33
|
// actionable.
|
|
43
34
|
try {
|
|
44
|
-
resolveFormatterBin[formatterType]();
|
|
35
|
+
formatters_1.resolveFormatterBin[formatterType]();
|
|
45
36
|
}
|
|
46
37
|
catch {
|
|
47
38
|
output_1.output.error({
|
|
@@ -53,19 +44,12 @@ async function format(command, args) {
|
|
|
53
44
|
process.exit(1);
|
|
54
45
|
}
|
|
55
46
|
const { nxArgs } = (0, command_line_utils_1.splitArgsIntoNxArgsAndOverrides)(args, 'affected', { printWarnings: false }, (0, configuration_1.readNxJson)());
|
|
56
|
-
// Patterns are kept raw here. Prettier is invoked through a shell so it
|
|
57
|
-
// quotes them at the call site; oxfmt is invoked with execFile and needs
|
|
58
|
-
// the unquoted paths.
|
|
59
47
|
const patterns = await getPatterns(formatterType, {
|
|
60
48
|
...args,
|
|
61
49
|
...nxArgs,
|
|
62
50
|
});
|
|
63
51
|
// Chunkify the patterns array to prevent crashing the windows terminal.
|
|
64
|
-
|
|
65
|
-
// chunks against that; oxfmt goes through execFile and gets them raw.
|
|
66
|
-
const chunkList = (0, chunkify_1.chunkify)(patterns, undefined, formatterType === 'prettier'
|
|
67
|
-
? (pattern) => (0, prettier_1.quoteForShell)(pattern).length
|
|
68
|
-
: undefined);
|
|
52
|
+
const chunkList = (0, chunkify_1.chunkify)(patterns);
|
|
69
53
|
switch (command) {
|
|
70
54
|
case 'write':
|
|
71
55
|
if (nxArgs.sortRootTsconfigPaths) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ProjectFileMap, ProjectGraph, ProjectGraphDependency, ProjectGraphProjectNode } from '../../config/project-graph';
|
|
2
2
|
import { TaskGraph } from '../../config/task-graph';
|
|
3
|
+
import { type TaskSelection } from '../../tasks-runner/run-command';
|
|
3
4
|
export interface GraphError {
|
|
4
5
|
message: string;
|
|
5
6
|
stack: string;
|
|
@@ -49,7 +50,37 @@ export declare function generateGraph(args: {
|
|
|
49
50
|
focus?: string;
|
|
50
51
|
exclude?: string[];
|
|
51
52
|
affected?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* What the command would run for `targets`, or how to build it. A builder
|
|
55
|
+
* is only called where an output needs it, so the live graph can still
|
|
56
|
+
* open, and show the error, when the task graph cannot be built.
|
|
57
|
+
*/
|
|
58
|
+
taskSelection?: TaskSelection | (() => TaskSelection);
|
|
59
|
+
/** The `-c` the tasks run with; their ids carry it. */
|
|
60
|
+
configuration?: string;
|
|
52
61
|
}, affectedProjects: string[]): Promise<void>;
|
|
62
|
+
export interface TaskSelectionForGraph {
|
|
63
|
+
targets: string[];
|
|
64
|
+
configuration?: string;
|
|
65
|
+
taskIds: string[];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The selection applies only to a page asking for its exact targets with its configuration
|
|
69
|
+
* or none (the ids carry it); anything else would prune to nothing, so it is shown whole.
|
|
70
|
+
*/
|
|
71
|
+
export declare function selectedFor(targets: string[], configuration: string | undefined, selection: TaskSelectionForGraph | undefined): {
|
|
72
|
+
configuration?: string;
|
|
73
|
+
taskIds?: string[];
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* The task graph to draw: the selection's own when it has one, otherwise built
|
|
77
|
+
* and, given ids, pruned to them. The live graph rebuilds per request, so it
|
|
78
|
+
* passes only ids.
|
|
79
|
+
*/
|
|
80
|
+
export declare function taskGraphForSelection(build: () => TaskGraph, selection?: {
|
|
81
|
+
taskGraph?: TaskGraph;
|
|
82
|
+
taskIds?: string[];
|
|
83
|
+
}): TaskGraph;
|
|
53
84
|
export declare function getExpandedTaskInputs(depGraphClientResponse: ProjectGraphClientResponse, expandedTaskInputsCache: Map<string, Record<string, string[]>>, taskId: string): Promise<Record<string, string[]>>;
|
|
54
85
|
/**
|
|
55
86
|
* The data type that `nx graph --file graph.json` or `nx build --graph graph.json` contains
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateGraph = generateGraph;
|
|
4
|
+
exports.selectedFor = selectedFor;
|
|
5
|
+
exports.taskGraphForSelection = taskGraphForSelection;
|
|
4
6
|
exports.getExpandedTaskInputs = getExpandedTaskInputs;
|
|
5
7
|
const tslib_1 = require("tslib");
|
|
6
8
|
const crypto_1 = require("crypto");
|
|
@@ -22,6 +24,9 @@ const typescript_1 = require("../../plugins/js/utils/typescript");
|
|
|
22
24
|
const operators_1 = require("../../project-graph/operators");
|
|
23
25
|
const project_graph_1 = require("../../project-graph/project-graph");
|
|
24
26
|
const create_task_graph_1 = require("../../tasks-runner/create-task-graph");
|
|
27
|
+
const utils_1 = require("../../tasks-runner/utils");
|
|
28
|
+
const run_command_1 = require("../../tasks-runner/run-command");
|
|
29
|
+
const project_graph_utils_1 = require("../../utils/project-graph-utils");
|
|
25
30
|
const all_file_data_1 = require("../../utils/all-file-data");
|
|
26
31
|
const command_line_utils_1 = require("../../utils/command-line-utils");
|
|
27
32
|
const native_1 = require("../../native");
|
|
@@ -178,6 +183,17 @@ async function generateGraph(args, affectedProjects) {
|
|
|
178
183
|
}
|
|
179
184
|
}
|
|
180
185
|
let prunedGraph = (0, operators_1.pruneExternalNodes)(rawGraph);
|
|
186
|
+
// `nx graph --targets` has no command to take a selection from, so it draws
|
|
187
|
+
// the projects' targets.
|
|
188
|
+
const jsonTaskSelection = () => args.targets?.length
|
|
189
|
+
? (resolveSelection(args.taskSelection) ??
|
|
190
|
+
(0, run_command_1.selectTasksForProjects)(rawGraph, args.projects?.length
|
|
191
|
+
? args.projects
|
|
192
|
+
: [...(0, project_graph_utils_1.runnableForTarget)(rawGraph.nodes, args.targets)], {
|
|
193
|
+
targets: args.targets,
|
|
194
|
+
configuration: args.configuration,
|
|
195
|
+
}, {}, {}, false))
|
|
196
|
+
: undefined;
|
|
181
197
|
const projects = Object.values(prunedGraph.nodes);
|
|
182
198
|
projects.sort((a, b) => {
|
|
183
199
|
return a.name.localeCompare(b.name);
|
|
@@ -231,7 +247,7 @@ async function generateGraph(args, affectedProjects) {
|
|
|
231
247
|
let html = (0, node_fs_1.readFileSync)((0, node_path_1.join)(__dirname, '../../core/graph/index.html'), 'utf-8');
|
|
232
248
|
prunedGraph = filterGraph(prunedGraph, args.focus || null, excludePatterns);
|
|
233
249
|
if (args.print || args.file === 'stdout') {
|
|
234
|
-
console.log(JSON.stringify(await createJsonOutput(prunedGraph, rawGraph,
|
|
250
|
+
console.log(JSON.stringify(await createJsonOutput(prunedGraph, rawGraph, jsonTaskSelection()), null, 2));
|
|
235
251
|
await output_1.output.drain();
|
|
236
252
|
await new Promise((res) => setImmediate(res));
|
|
237
253
|
process.exit(0);
|
|
@@ -258,7 +274,7 @@ async function generateGraph(args, affectedProjects) {
|
|
|
258
274
|
});
|
|
259
275
|
const { projectGraphClientResponse } = await createProjectGraphAndSourceMapClientResponse(affectedProjects);
|
|
260
276
|
const taskGraphClientResponse = args.targets
|
|
261
|
-
? await createTaskGraphForTargetsAndProjects(args.targets, args.projects)
|
|
277
|
+
? await createTaskGraphForTargetsAndProjects(args.targets, args.projects, args.configuration, args.taskSelection)
|
|
262
278
|
: await createTaskGraphClientResponse();
|
|
263
279
|
const taskInputsReponse = await createExpandedTaskInputResponse(taskGraphClientResponse, projectGraphClientResponse);
|
|
264
280
|
const environmentJs = buildEnvironmentJs(excludePatterns, args.watch, !!args.file && args.file.endsWith('html') ? 'build' : 'serve', projectGraphClientResponse, taskGraphClientResponse, taskInputsReponse, sourceMaps);
|
|
@@ -275,7 +291,7 @@ async function generateGraph(args, affectedProjects) {
|
|
|
275
291
|
}
|
|
276
292
|
else if (ext === '.json') {
|
|
277
293
|
(0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(fullFilePath), { recursive: true });
|
|
278
|
-
const json = await createJsonOutput(prunedGraph, rawGraph,
|
|
294
|
+
const json = await createJsonOutput(prunedGraph, rawGraph, jsonTaskSelection());
|
|
279
295
|
(0, fileutils_1.writeJsonFile)(fullFilePath, json);
|
|
280
296
|
output_1.output.success({
|
|
281
297
|
title: `JSON output created in ${fileFolderPath}`,
|
|
@@ -297,7 +313,13 @@ async function generateGraph(args, affectedProjects) {
|
|
|
297
313
|
let app;
|
|
298
314
|
let url;
|
|
299
315
|
try {
|
|
300
|
-
const result = await startServer(html, environmentJs, args.host || '127.0.0.1', args.port || 4211, args.watch, affectedProjects, args.focus, args.groupByFolder, excludePatterns
|
|
316
|
+
const result = await startServer(html, environmentJs, args.host || '127.0.0.1', args.port || 4211, args.watch, affectedProjects, args.focus, args.groupByFolder, excludePatterns, typeof args.taskSelection === 'object' && args.taskSelection.taskIds
|
|
317
|
+
? {
|
|
318
|
+
targets: args.targets,
|
|
319
|
+
configuration: args.configuration,
|
|
320
|
+
taskIds: args.taskSelection.taskIds,
|
|
321
|
+
}
|
|
322
|
+
: undefined);
|
|
301
323
|
app = result.app;
|
|
302
324
|
url = result.url;
|
|
303
325
|
}
|
|
@@ -383,7 +405,7 @@ function findAvailablePort(startPort, host = '127.0.0.1') {
|
|
|
383
405
|
});
|
|
384
406
|
});
|
|
385
407
|
}
|
|
386
|
-
async function startServer(html, environmentJs, host, port = 4211, watchForChanges = true, affected = [], focus = null, groupByFolder = false, exclude = []) {
|
|
408
|
+
async function startServer(html, environmentJs, host, port = 4211, watchForChanges = true, affected = [], focus = null, groupByFolder = false, exclude = [], selection) {
|
|
387
409
|
let unregisterFileWatcher;
|
|
388
410
|
if (watchForChanges && !client_1.daemonClient.enabled()) {
|
|
389
411
|
output_1.output.warn({
|
|
@@ -427,14 +449,15 @@ async function startServer(html, environmentJs, host, port = 4211, watchForChang
|
|
|
427
449
|
if (sanitizePath === 'task-graph.json') {
|
|
428
450
|
const projectsParam = parsedUrl.searchParams.get('projects');
|
|
429
451
|
const targetsParam = parsedUrl.searchParams.get('targets');
|
|
430
|
-
const configuration = parsedUrl.searchParams.get('configuration');
|
|
452
|
+
const configuration = parsedUrl.searchParams.get('configuration') || undefined;
|
|
431
453
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
432
454
|
if (targetsParam) {
|
|
433
455
|
const targetNames = targetsParam.split(' ').filter(Boolean);
|
|
434
456
|
const projectNames = projectsParam
|
|
435
457
|
? projectsParam.split(' ').filter(Boolean)
|
|
436
458
|
: undefined;
|
|
437
|
-
|
|
459
|
+
const request = selectedFor(targetNames, configuration, selection);
|
|
460
|
+
return res.end(JSON.stringify(await createTaskGraphForTargetsAndProjects(targetNames, projectNames, request.configuration, { taskIds: request.taskIds })));
|
|
438
461
|
}
|
|
439
462
|
// load all task graphs if there's no targets specified
|
|
440
463
|
return res.end(JSON.stringify(await createTaskGraphClientResponse()));
|
|
@@ -726,7 +749,7 @@ async function createTaskGraphClientResponse(pruneExternal = false) {
|
|
|
726
749
|
try {
|
|
727
750
|
const taskGraph = (0, create_task_graph_1.createTaskGraph)(graph, {}, projects, targets, undefined, {});
|
|
728
751
|
node_perf_hooks_1.performance.mark('task graph generation:end');
|
|
729
|
-
const planner = new native_1.HashPlanner(nxJson, (0,
|
|
752
|
+
const planner = new native_1.HashPlanner(nxJson, (0, transform_objects_1.transformProjectGraphForRust)(graph));
|
|
730
753
|
node_perf_hooks_1.performance.mark('task hash plan generation:start');
|
|
731
754
|
const taskIds = Object.keys(taskGraph.tasks);
|
|
732
755
|
const plans = taskIds.length > 0 ? planner.getPlans(taskIds, taskGraph) : {};
|
|
@@ -774,10 +797,40 @@ function clearTaskGraphCache() {
|
|
|
774
797
|
expandedTaskInputsCache.clear();
|
|
775
798
|
}
|
|
776
799
|
/**
|
|
777
|
-
*
|
|
778
|
-
*
|
|
800
|
+
* The selection applies only to a page asking for its exact targets with its configuration
|
|
801
|
+
* or none (the ids carry it); anything else would prune to nothing, so it is shown whole.
|
|
802
|
+
*/
|
|
803
|
+
function selectedFor(targets, configuration, selection) {
|
|
804
|
+
const applies = selection &&
|
|
805
|
+
targets.length === selection.targets.length &&
|
|
806
|
+
targets.every((target) => selection.targets.includes(target)) &&
|
|
807
|
+
(configuration === undefined || configuration === selection.configuration);
|
|
808
|
+
return applies
|
|
809
|
+
? { configuration: selection.configuration, taskIds: selection.taskIds }
|
|
810
|
+
: { configuration };
|
|
811
|
+
}
|
|
812
|
+
function resolveSelection(selection) {
|
|
813
|
+
return typeof selection === 'function' ? selection() : selection;
|
|
814
|
+
}
|
|
815
|
+
/**
|
|
816
|
+
* The task graph to draw: the selection's own when it has one, otherwise built
|
|
817
|
+
* and, given ids, pruned to them. The live graph rebuilds per request, so it
|
|
818
|
+
* passes only ids.
|
|
819
|
+
*/
|
|
820
|
+
function taskGraphForSelection(build, selection) {
|
|
821
|
+
if (selection?.taskGraph) {
|
|
822
|
+
return selection.taskGraph;
|
|
823
|
+
}
|
|
824
|
+
const taskGraph = build();
|
|
825
|
+
return selection?.taskIds
|
|
826
|
+
? (0, utils_1.pruneToSelectedTasks)(taskGraph, selection.taskIds)
|
|
827
|
+
: taskGraph;
|
|
828
|
+
}
|
|
829
|
+
/**
|
|
830
|
+
* The task graph client response for `targetNames`: `selection`'s graph when given,
|
|
831
|
+
* else built for `projectNames` (default: every project with one of the targets).
|
|
779
832
|
*/
|
|
780
|
-
async function createTaskGraphForTargetsAndProjects(targetNames, projectNames, configuration) {
|
|
833
|
+
async function createTaskGraphForTargetsAndProjects(targetNames, projectNames, configuration, selection) {
|
|
781
834
|
// Get project graph
|
|
782
835
|
let graph;
|
|
783
836
|
try {
|
|
@@ -801,10 +854,11 @@ async function createTaskGraphForTargetsAndProjects(targetNames, projectNames, c
|
|
|
801
854
|
.map(([projectName]) => projectName);
|
|
802
855
|
}
|
|
803
856
|
try {
|
|
804
|
-
|
|
805
|
-
|
|
857
|
+
const taskGraph = taskGraphForSelection(() => (0, create_task_graph_1.createTaskGraph)(graph, {}, projectsToUse, targetNames, configuration, {}),
|
|
858
|
+
// Built in here, so an error is reported in the page like any other.
|
|
859
|
+
resolveSelection(selection));
|
|
806
860
|
node_perf_hooks_1.performance.mark(`task graph generation:end`);
|
|
807
|
-
const planner = new native_1.HashPlanner(nxJson, (0,
|
|
861
|
+
const planner = new native_1.HashPlanner(nxJson, (0, transform_objects_1.transformProjectGraphForRust)(graph));
|
|
808
862
|
node_perf_hooks_1.performance.mark('task hash plan generation:start');
|
|
809
863
|
const taskIds = Object.keys(taskGraph.tasks);
|
|
810
864
|
const plans = taskIds.length > 0 ? planner.getPlans(taskIds, taskGraph) : {};
|
|
@@ -850,17 +904,51 @@ async function getExpandedTaskInputs(depGraphClientResponse, expandedTaskInputsC
|
|
|
850
904
|
expandedTaskInputsCache.set(taskId, result);
|
|
851
905
|
return result;
|
|
852
906
|
}
|
|
907
|
+
// A brace group ({a,b}.json) carries commas, so a glob list joined with
|
|
908
|
+
// commas can only be split at brace depth zero.
|
|
909
|
+
function splitGlobGroup(group) {
|
|
910
|
+
const globs = [];
|
|
911
|
+
let current = '';
|
|
912
|
+
let depth = 0;
|
|
913
|
+
for (const char of group) {
|
|
914
|
+
if (char === '{') {
|
|
915
|
+
depth++;
|
|
916
|
+
}
|
|
917
|
+
else if (char === '}' && depth > 0) {
|
|
918
|
+
depth--;
|
|
919
|
+
}
|
|
920
|
+
if (char === ',' && depth === 0) {
|
|
921
|
+
globs.push(current);
|
|
922
|
+
current = '';
|
|
923
|
+
}
|
|
924
|
+
else {
|
|
925
|
+
current += char;
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
globs.push(current);
|
|
929
|
+
// An unbalanced `{` would swallow the rest of the list; a plain split is
|
|
930
|
+
// the better guess then.
|
|
931
|
+
return depth === 0 ? globs : group.split(',');
|
|
932
|
+
}
|
|
853
933
|
function expandInputs(inputs, project, allWorkspaceFiles, depGraphClientResponse) {
|
|
854
934
|
const projectNames = depGraphClientResponse.projects.map((p) => p.name);
|
|
855
935
|
const workspaceRootInputs = [];
|
|
856
936
|
const projectRootInputs = [];
|
|
857
937
|
const externalInputs = [];
|
|
858
938
|
const otherInputs = [];
|
|
939
|
+
const filesInputs = [];
|
|
859
940
|
inputs.forEach((input) => {
|
|
860
941
|
// grouped workspace inputs look like workspace:[pattern,otherPattern]
|
|
861
942
|
if (input.startsWith('workspace:[')) {
|
|
862
|
-
|
|
863
|
-
|
|
943
|
+
workspaceRootInputs.push(...splitGlobGroup(input.substring(11, input.length - 1)));
|
|
944
|
+
return;
|
|
945
|
+
}
|
|
946
|
+
// Disk-backed groups look like files:[glob,!otherGlob]. They expand on
|
|
947
|
+
// disk, so they must be matched before the `:` catch-all below classifies
|
|
948
|
+
// them as external dependencies.
|
|
949
|
+
const diskBacked = /^files:\[(.*)\]$/.exec(input);
|
|
950
|
+
if (diskBacked) {
|
|
951
|
+
filesInputs.push(splitGlobGroup(diskBacked[1]));
|
|
864
952
|
return;
|
|
865
953
|
}
|
|
866
954
|
const maybeProjectName = input.split(':')[0];
|
|
@@ -881,6 +969,7 @@ function expandInputs(inputs, project, allWorkspaceFiles, depGraphClientResponse
|
|
|
881
969
|
}
|
|
882
970
|
});
|
|
883
971
|
const workspaceRootsExpanded = getExpandedWorkspaceRoots(workspaceRootInputs, allWorkspaceFiles);
|
|
972
|
+
const filesExpanded = filesInputs.flatMap((globs) => (0, native_1.expandFilesInput)(workspace_root_1.workspaceRoot, globs));
|
|
884
973
|
const otherInputsExpanded = otherInputs.map((input) => {
|
|
885
974
|
if (input === 'TsConfig') {
|
|
886
975
|
return (0, node_path_1.relative)(workspace_root_1.workspaceRoot, (0, typescript_1.getRootTsConfigPath)());
|
|
@@ -908,7 +997,11 @@ function expandInputs(inputs, project, allWorkspaceFiles, depGraphClientResponse
|
|
|
908
997
|
return acc;
|
|
909
998
|
}, {});
|
|
910
999
|
return {
|
|
911
|
-
general: [
|
|
1000
|
+
general: [
|
|
1001
|
+
...workspaceRootsExpanded,
|
|
1002
|
+
...filesExpanded,
|
|
1003
|
+
...otherInputsExpanded,
|
|
1004
|
+
],
|
|
912
1005
|
...projectRootsExpanded,
|
|
913
1006
|
external: externalInputs,
|
|
914
1007
|
};
|
|
@@ -943,12 +1036,12 @@ function getExpandedWorkspaceRoots(workspaceRootInputs, allWorkspaceFiles) {
|
|
|
943
1036
|
workspaceRootsExpanded.sort();
|
|
944
1037
|
return workspaceRootsExpanded;
|
|
945
1038
|
}
|
|
946
|
-
async function createJsonOutput(prunedGraph, rawGraph,
|
|
1039
|
+
async function createJsonOutput(prunedGraph, rawGraph, taskSelection) {
|
|
947
1040
|
const response = {
|
|
948
1041
|
graph: prunedGraph,
|
|
949
1042
|
};
|
|
950
|
-
if (
|
|
951
|
-
const taskGraph =
|
|
1043
|
+
if (taskSelection) {
|
|
1044
|
+
const taskGraph = taskSelection.taskGraph;
|
|
952
1045
|
const hasher = (0, create_task_hasher_1.createTaskHasher)(rawGraph, (0, configuration_1.readNxJson)());
|
|
953
1046
|
let tasks = Object.values(taskGraph.tasks);
|
|
954
1047
|
// Match the runtime path: each task is hashed against its own env so
|
|
@@ -65,9 +65,6 @@ async function addNxToMonorepo(options, guided = true) {
|
|
|
65
65
|
output_1.output.log({ title: '🛠️ Setting up Nx Cloud' });
|
|
66
66
|
await (0, utils_1.initCloud)('nx-init-monorepo');
|
|
67
67
|
}
|
|
68
|
-
else if (nxCloudChoice === 'never') {
|
|
69
|
-
(0, utils_1.setNeverConnectToCloud)(repoRoot);
|
|
70
|
-
}
|
|
71
68
|
}
|
|
72
69
|
// scanning package.json files
|
|
73
70
|
function allProjectPackageJsonFiles(repoRoot) {
|
|
@@ -92,9 +92,6 @@ async function addNxToNest(options, packageJson) {
|
|
|
92
92
|
output_1.output.log({ title: '🛠️ Setting up Nx Cloud' });
|
|
93
93
|
await (0, utils_1.initCloud)('nx-init-nest');
|
|
94
94
|
}
|
|
95
|
-
else if (nxCloudChoice === 'never') {
|
|
96
|
-
(0, utils_1.setNeverConnectToCloud)(repoRoot);
|
|
97
|
-
}
|
|
98
95
|
}
|
|
99
96
|
function addNestPluginToPackageJson(repoRoot) {
|
|
100
97
|
const path = (0, path_1.join)(repoRoot, `package.json`);
|
|
@@ -64,7 +64,4 @@ async function addNxToNpmRepo(options, guided = true) {
|
|
|
64
64
|
output_1.output.log({ title: '🛠️ Setting up Nx Cloud' });
|
|
65
65
|
await (0, utils_1.initCloud)('nx-init-npm-repo');
|
|
66
66
|
}
|
|
67
|
-
else if (nxCloudChoice === 'never') {
|
|
68
|
-
(0, utils_1.setNeverConnectToCloud)(repoRoot);
|
|
69
|
-
}
|
|
70
67
|
}
|
|
@@ -56,9 +56,6 @@ async function addNxToAngularCliRepo(options) {
|
|
|
56
56
|
output_1.output.log({ title: '🛠️ Setting up Nx Cloud' });
|
|
57
57
|
await (0, utils_1.initCloud)('nx-init-angular');
|
|
58
58
|
}
|
|
59
|
-
else if (nxCloudChoice === 'never') {
|
|
60
|
-
(0, utils_1.setNeverConnectToCloud)(repoRoot);
|
|
61
|
-
}
|
|
62
59
|
}
|
|
63
60
|
async function collectCacheableOperations(options) {
|
|
64
61
|
let cacheableOperations;
|
|
@@ -119,9 +119,6 @@ async function getLegacyMigrationFunctionIfApplicable(repoRoot, options) {
|
|
|
119
119
|
output_1.output.log({ title: '🛠️ Setting up Nx Cloud' });
|
|
120
120
|
await (0, utils_1.initCloud)('nx-init-angular');
|
|
121
121
|
}
|
|
122
|
-
else if (nxCloudChoice === 'never') {
|
|
123
|
-
(0, utils_1.setNeverConnectToCloud)(repoRoot);
|
|
124
|
-
}
|
|
125
122
|
};
|
|
126
123
|
}
|
|
127
124
|
async function installDependencies(repoRoot, pkgInfo, pmc) {
|