@depup/nx 23.2.1-depup.8 → 23.3.0-depup.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 +8 -19
- package/changes.json +10 -54
- package/dist/bin/init-local.js +7 -1
- 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/index.d.ts +582 -21
- package/dist/src/native/index.js +3 -3
- package/dist/src/native/native-bindings.js +13 -1
- 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 +38 -100
- 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
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HttpError = void 0;
|
|
4
|
+
exports.createHttpClient = createHttpClient;
|
|
5
|
+
exports.httpRequest = httpRequest;
|
|
6
|
+
const stream_1 = require("stream");
|
|
7
|
+
class HttpError extends Error {
|
|
8
|
+
constructor(response) {
|
|
9
|
+
// Same message copy axios used, in case consumers match on it
|
|
10
|
+
super(`Request failed with status code ${response.status}`);
|
|
11
|
+
this.response = response;
|
|
12
|
+
this.name = 'HttpError';
|
|
13
|
+
this.status = response.status;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.HttpError = HttpError;
|
|
17
|
+
function createHttpClient(defaults = {}) {
|
|
18
|
+
const merge = (config = {}) => ({
|
|
19
|
+
...defaults,
|
|
20
|
+
...config,
|
|
21
|
+
headers: {
|
|
22
|
+
...toLowerCaseKeys(defaults.headers),
|
|
23
|
+
...toLowerCaseKeys(config.headers),
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
return {
|
|
27
|
+
request: (url, config) => httpRequest(url, merge(config)),
|
|
28
|
+
get: (url, config) => httpRequest(url, merge({ ...config, method: 'GET' })),
|
|
29
|
+
post: (url, data, config) => httpRequest(url, merge({ ...config, method: 'POST', data })),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
async function httpRequest(url, config = {}) {
|
|
33
|
+
const fullUrl = buildFullUrl(url, config);
|
|
34
|
+
const { fetchImpl, dispatcher } = resolveFetch();
|
|
35
|
+
// Lowercase keys so differently-cased duplicates override instead of
|
|
36
|
+
// sending both values
|
|
37
|
+
const headers = toLowerCaseKeys(config.headers);
|
|
38
|
+
let body;
|
|
39
|
+
if (config.data !== undefined) {
|
|
40
|
+
body = JSON.stringify(config.data);
|
|
41
|
+
headers['content-type'] ??= 'application/json';
|
|
42
|
+
}
|
|
43
|
+
const controller = new AbortController();
|
|
44
|
+
if (config.signal) {
|
|
45
|
+
if (config.signal.aborted) {
|
|
46
|
+
controller.abort(config.signal.reason);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
config.signal.addEventListener('abort', () => controller.abort(config.signal.reason), { once: true });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const timer = config.timeout
|
|
53
|
+
? setTimeout(() => controller.abort(new DOMException(`Request timed out after ${config.timeout}ms`, 'TimeoutError')), config.timeout)
|
|
54
|
+
: null;
|
|
55
|
+
let res;
|
|
56
|
+
try {
|
|
57
|
+
res = await fetchImpl(fullUrl, {
|
|
58
|
+
method: config.method ?? 'GET',
|
|
59
|
+
headers,
|
|
60
|
+
body,
|
|
61
|
+
redirect: 'follow',
|
|
62
|
+
signal: controller.signal,
|
|
63
|
+
...(dispatcher ? { dispatcher } : {}),
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
catch (e) {
|
|
67
|
+
if (timer)
|
|
68
|
+
clearTimeout(timer);
|
|
69
|
+
throw e;
|
|
70
|
+
}
|
|
71
|
+
const responseHeaders = Object.fromEntries(res.headers.entries());
|
|
72
|
+
if (config.responseType === 'stream') {
|
|
73
|
+
if (!res.ok) {
|
|
74
|
+
try {
|
|
75
|
+
throw new HttpError({
|
|
76
|
+
status: res.status,
|
|
77
|
+
headers: responseHeaders,
|
|
78
|
+
data: await parseResponseData(res),
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
finally {
|
|
82
|
+
if (timer)
|
|
83
|
+
clearTimeout(timer);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
// The headers timeout ends here; the body gets a per-chunk inactivity
|
|
87
|
+
// guard instead, so slow-but-progressing downloads survive
|
|
88
|
+
if (timer)
|
|
89
|
+
clearTimeout(timer);
|
|
90
|
+
return {
|
|
91
|
+
status: res.status,
|
|
92
|
+
headers: responseHeaders,
|
|
93
|
+
data: (res.body
|
|
94
|
+
? guardStreamStall(stream_1.Readable.fromWeb(res.body), config.timeout)
|
|
95
|
+
: stream_1.Readable.from([])),
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
try {
|
|
99
|
+
const data = await parseResponseData(res);
|
|
100
|
+
if (!res.ok) {
|
|
101
|
+
throw new HttpError({
|
|
102
|
+
status: res.status,
|
|
103
|
+
headers: responseHeaders,
|
|
104
|
+
data,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
return { status: res.status, headers: responseHeaders, data };
|
|
108
|
+
}
|
|
109
|
+
finally {
|
|
110
|
+
if (timer)
|
|
111
|
+
clearTimeout(timer);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
async function parseResponseData(res) {
|
|
115
|
+
const text = await res.text();
|
|
116
|
+
try {
|
|
117
|
+
return JSON.parse(text);
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
return text;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function toLowerCaseKeys(headers) {
|
|
124
|
+
const result = {};
|
|
125
|
+
for (const [key, value] of Object.entries(headers ?? {})) {
|
|
126
|
+
result[key.toLowerCase()] = value;
|
|
127
|
+
}
|
|
128
|
+
return result;
|
|
129
|
+
}
|
|
130
|
+
function buildFullUrl(url, config) {
|
|
131
|
+
let fullUrl = url;
|
|
132
|
+
if (config.baseURL && !/^https?:\/\//i.test(url)) {
|
|
133
|
+
// Concatenate rather than `new URL(url, base)` so a base with a path
|
|
134
|
+
// prefix (e.g. on-prem Nx Cloud) is preserved
|
|
135
|
+
fullUrl =
|
|
136
|
+
config.baseURL.replace(/\/+$/, '') + '/' + url.replace(/^\/+/, '');
|
|
137
|
+
}
|
|
138
|
+
if (config.params) {
|
|
139
|
+
const search = new URLSearchParams();
|
|
140
|
+
for (const [key, value] of Object.entries(config.params)) {
|
|
141
|
+
if (value !== null && value !== undefined) {
|
|
142
|
+
search.append(key, String(value));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
const queryString = search.toString();
|
|
146
|
+
if (queryString) {
|
|
147
|
+
fullUrl += (fullUrl.includes('?') ? '&' : '?') + queryString;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return fullUrl;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Destroys the stream if no data arrives for `timeout` ms. Resets per chunk,
|
|
154
|
+
* so slow-but-progressing downloads survive while stalls still abort.
|
|
155
|
+
*/
|
|
156
|
+
function guardStreamStall(source, timeout) {
|
|
157
|
+
if (!timeout)
|
|
158
|
+
return source;
|
|
159
|
+
const out = new stream_1.PassThrough();
|
|
160
|
+
let timer;
|
|
161
|
+
const arm = () => {
|
|
162
|
+
clearTimeout(timer);
|
|
163
|
+
timer = setTimeout(() => {
|
|
164
|
+
const error = new DOMException(`Response stalled for ${timeout}ms`, 'TimeoutError');
|
|
165
|
+
source.destroy(error);
|
|
166
|
+
out.destroy(error);
|
|
167
|
+
}, timeout);
|
|
168
|
+
};
|
|
169
|
+
arm();
|
|
170
|
+
source.on('data', arm);
|
|
171
|
+
source.on('end', () => clearTimeout(timer));
|
|
172
|
+
source.on('close', () => clearTimeout(timer));
|
|
173
|
+
source.on('error', (e) => {
|
|
174
|
+
clearTimeout(timer);
|
|
175
|
+
out.destroy(e);
|
|
176
|
+
});
|
|
177
|
+
source.pipe(out);
|
|
178
|
+
return out;
|
|
179
|
+
}
|
|
180
|
+
let envProxyAgent;
|
|
181
|
+
function resolveFetch() {
|
|
182
|
+
// Native fetch ignores HTTP(S)_PROXY env vars, which axios honored; route
|
|
183
|
+
// through undici's EnvHttpProxyAgent (also handles NO_PROXY) when they are set
|
|
184
|
+
const allProxy = process.env.all_proxy || process.env.ALL_PROXY;
|
|
185
|
+
const httpProxy = process.env.http_proxy || process.env.HTTP_PROXY || allProxy;
|
|
186
|
+
const httpsProxy = process.env.https_proxy || process.env.HTTPS_PROXY || allProxy;
|
|
187
|
+
if (httpProxy || httpsProxy) {
|
|
188
|
+
const undici = require('undici');
|
|
189
|
+
envProxyAgent ??= new undici.EnvHttpProxyAgent({ httpProxy, httpsProxy });
|
|
190
|
+
return { fetchImpl: undici.fetch, dispatcher: envProxyAgent };
|
|
191
|
+
}
|
|
192
|
+
return { fetchImpl: fetch };
|
|
193
|
+
}
|
|
@@ -4,8 +4,6 @@ exports.getInstalledVersion = getInstalledVersion;
|
|
|
4
4
|
exports.getInstalledNxVersion = getInstalledNxVersion;
|
|
5
5
|
exports.getInstalledLegacyNrwlWorkspaceVersion = getInstalledLegacyNrwlWorkspaceVersion;
|
|
6
6
|
exports.getInstalledPackageGroup = getInstalledPackageGroup;
|
|
7
|
-
const tslib_1 = require("tslib");
|
|
8
|
-
const node_module_1 = tslib_1.__importStar(require("node:module"));
|
|
9
7
|
const fileutils_1 = require("./fileutils");
|
|
10
8
|
const package_json_1 = require("./package-json");
|
|
11
9
|
const workspace_root_1 = require("./workspace-root");
|
|
@@ -15,15 +13,11 @@ const installation_directory_1 = require("./installation-directory");
|
|
|
15
13
|
* resolver. The resolver always reflects the workspace's `node_modules`/PnP
|
|
16
14
|
* store rather than whichever copy happens to be loaded in the current process
|
|
17
15
|
* (e.g. the temp `nx@latest` install used by the migrate bootstrap). See
|
|
18
|
-
* nrwl/nx#35444 and `
|
|
16
|
+
* nrwl/nx#35444 and `resolveWithoutCachePollution`.
|
|
19
17
|
*/
|
|
20
18
|
function readInstalledPackageJson(packageName) {
|
|
21
|
-
const path = resolvePackageJsonWithoutCachePollution(packageName, (0, installation_directory_1.getNxRequirePaths)(workspace_root_1.workspaceRoot));
|
|
22
|
-
if (!path) {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
19
|
try {
|
|
26
|
-
return (0, fileutils_1.readJsonFile)(
|
|
20
|
+
return (0, fileutils_1.readJsonFile)((0, package_json_1.resolveWithoutCachePollution)(`${packageName}/package.json`, (0, installation_directory_1.getNxRequirePaths)(workspace_root_1.workspaceRoot)));
|
|
27
21
|
}
|
|
28
22
|
catch {
|
|
29
23
|
return null;
|
|
@@ -71,43 +65,3 @@ function getInstalledPackageGroup(packageName) {
|
|
|
71
65
|
}
|
|
72
66
|
return set;
|
|
73
67
|
}
|
|
74
|
-
/**
|
|
75
|
-
* Resolve `<packageName>/package.json` via Node's CJS resolver while
|
|
76
|
-
* neutralising both ways `require.resolve(req, { paths })` can lie about
|
|
77
|
-
* the `paths` argument:
|
|
78
|
-
*
|
|
79
|
-
* 1. Process-wide `Module._pathCache` — swapped out for the duration of
|
|
80
|
-
* the call, so any cache entries written are discarded and any
|
|
81
|
-
* previously-poisoned entries are not read. Without this, an
|
|
82
|
-
* in-process load of a second `nx` package (e.g. the temp `nx@latest`
|
|
83
|
-
* install used by the daemon's AI-agents and console-status checks)
|
|
84
|
-
* can poison the cache key this call uses and make us read the temp
|
|
85
|
-
* path instead of the workspace path.
|
|
86
|
-
*
|
|
87
|
-
* 2. Package self-reference — when a file inside package `nx` calls
|
|
88
|
-
* `require.resolve('nx/...')`, Node returns that calling package's
|
|
89
|
-
* own file regardless of `paths`. We avoid that by issuing the
|
|
90
|
-
* resolve from a `createRequire` rooted at a synthetic path that is
|
|
91
|
-
* outside any package, so the resolver has no "self" to reference
|
|
92
|
-
* and must honour `paths`.
|
|
93
|
-
*
|
|
94
|
-
* Node's single-threaded synchronous execution means `require.resolve` does
|
|
95
|
-
* not yield, so no other code in the process can observe the swapped cache.
|
|
96
|
-
*/
|
|
97
|
-
function resolvePackageJsonWithoutCachePollution(packageName, requirePaths) {
|
|
98
|
-
// `_pathCache` is an internal Node API not exposed in @types/node.
|
|
99
|
-
const realCache = node_module_1.default._pathCache;
|
|
100
|
-
node_module_1.default._pathCache = Object.create(null);
|
|
101
|
-
try {
|
|
102
|
-
const detachedRequire = (0, node_module_1.createRequire)('/__nx_detached_resolver__/x.js');
|
|
103
|
-
return detachedRequire.resolve(`${packageName}/package.json`, {
|
|
104
|
-
paths: requirePaths,
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
catch {
|
|
108
|
-
return null;
|
|
109
|
-
}
|
|
110
|
-
finally {
|
|
111
|
-
node_module_1.default._pathCache = realCache;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
@@ -13,6 +13,8 @@ export interface JsonChange extends Change {
|
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
export declare function isJsonChange(change: Change): change is JsonChange;
|
|
16
|
+
/**
|
|
17
|
+
* The changes from `lhs` to `rhs`: every path whose value was deleted or
|
|
18
|
+
* modified, containers included, then every added path.
|
|
19
|
+
*/
|
|
16
20
|
export declare function jsonDiff(lhs: any, rhs: any): JsonChange[];
|
|
17
|
-
export declare function walkJsonTree(json: any, currPath: string[], visitor: (path: string[], value: any) => boolean): void;
|
|
18
|
-
export declare function deepEquals(a: any, b: any): boolean;
|
|
@@ -3,8 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.JsonDiffType = void 0;
|
|
4
4
|
exports.isJsonChange = isJsonChange;
|
|
5
5
|
exports.jsonDiff = jsonDiff;
|
|
6
|
-
|
|
7
|
-
exports.deepEquals = deepEquals;
|
|
6
|
+
const native_1 = require("../native");
|
|
8
7
|
var JsonDiffType;
|
|
9
8
|
(function (JsonDiffType) {
|
|
10
9
|
JsonDiffType["Deleted"] = "JsonPropertyDeleted";
|
|
@@ -16,97 +15,10 @@ function isJsonChange(change) {
|
|
|
16
15
|
change.type === JsonDiffType.Deleted ||
|
|
17
16
|
change.type === JsonDiffType.Modified);
|
|
18
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* The changes from `lhs` to `rhs`: every path whose value was deleted or
|
|
20
|
+
* modified, containers included, then every added path.
|
|
21
|
+
*/
|
|
19
22
|
function jsonDiff(lhs, rhs) {
|
|
20
|
-
|
|
21
|
-
const seenInLhs = new Set();
|
|
22
|
-
walkJsonTree(lhs, [], (path, lhsValue) => {
|
|
23
|
-
seenInLhs.add(hashArray(path));
|
|
24
|
-
const rhsValue = getJsonValue(path, rhs);
|
|
25
|
-
if (rhsValue === undefined) {
|
|
26
|
-
result.push({
|
|
27
|
-
type: JsonDiffType.Deleted,
|
|
28
|
-
path,
|
|
29
|
-
value: {
|
|
30
|
-
lhs: lhsValue,
|
|
31
|
-
rhs: undefined,
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
else if (!deepEquals(lhsValue, rhsValue)) {
|
|
36
|
-
result.push({
|
|
37
|
-
type: JsonDiffType.Modified,
|
|
38
|
-
path,
|
|
39
|
-
value: {
|
|
40
|
-
lhs: lhsValue,
|
|
41
|
-
rhs: rhsValue,
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
return typeof lhsValue === 'object' || Array.isArray(lhsValue);
|
|
46
|
-
});
|
|
47
|
-
walkJsonTree(rhs, [], (path, rhsValue) => {
|
|
48
|
-
const addedInRhs = !seenInLhs.has(hashArray(path));
|
|
49
|
-
if (addedInRhs) {
|
|
50
|
-
result.push({
|
|
51
|
-
type: JsonDiffType.Added,
|
|
52
|
-
path,
|
|
53
|
-
value: {
|
|
54
|
-
lhs: undefined,
|
|
55
|
-
rhs: rhsValue,
|
|
56
|
-
},
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
return typeof rhsValue === 'object' || Array.isArray(rhsValue);
|
|
60
|
-
});
|
|
61
|
-
return result;
|
|
62
|
-
}
|
|
63
|
-
// Depth-first walk down JSON tree.
|
|
64
|
-
function walkJsonTree(json, currPath, visitor) {
|
|
65
|
-
if (!json || typeof json !== 'object') {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
Object.keys(json).forEach((key) => {
|
|
69
|
-
const path = currPath.concat([key]);
|
|
70
|
-
const shouldContinue = visitor(path, json[key]);
|
|
71
|
-
if (shouldContinue) {
|
|
72
|
-
walkJsonTree(json[key], path, visitor);
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
function hashArray(ary) {
|
|
77
|
-
return JSON.stringify(ary);
|
|
78
|
-
}
|
|
79
|
-
function getJsonValue(path, json) {
|
|
80
|
-
let curr = json;
|
|
81
|
-
for (const k of path) {
|
|
82
|
-
curr = curr[k];
|
|
83
|
-
if (curr === undefined) {
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return curr;
|
|
88
|
-
}
|
|
89
|
-
function deepEquals(a, b) {
|
|
90
|
-
if (a === b) {
|
|
91
|
-
return true;
|
|
92
|
-
}
|
|
93
|
-
// Values do not need to be checked for deep equality and the above is false
|
|
94
|
-
if (
|
|
95
|
-
// Values are different types
|
|
96
|
-
typeof a !== typeof b ||
|
|
97
|
-
// Values are the same type but not an object or array
|
|
98
|
-
(typeof a !== 'object' && !Array.isArray(a)) ||
|
|
99
|
-
// Objects are the same type, objects or arrays, but do not have the same number of keys
|
|
100
|
-
Object.keys(a).length !== Object.keys(b).length) {
|
|
101
|
-
return false;
|
|
102
|
-
}
|
|
103
|
-
// Values need to be checked for deep equality
|
|
104
|
-
return Object.entries(a).reduce((equal, [key, aValue]) => {
|
|
105
|
-
// Skip other keys if it is already not equal.
|
|
106
|
-
if (!equal) {
|
|
107
|
-
return equal;
|
|
108
|
-
}
|
|
109
|
-
// Traverse the object
|
|
110
|
-
return deepEquals(aValue, b[key]);
|
|
111
|
-
}, true);
|
|
23
|
+
return ((0, native_1.diffJson)(JSON.stringify(lhs ?? null), JSON.stringify(rhs ?? null)) ?? []);
|
|
112
24
|
}
|
|
@@ -17,7 +17,7 @@ function toArray(value) {
|
|
|
17
17
|
*/
|
|
18
18
|
async function fetchRegistryMetadata(pkg) {
|
|
19
19
|
const raw = await (0, package_manager_1.packageRegistryView)(pkg, '', ['--json']);
|
|
20
|
-
const parsed =
|
|
20
|
+
const parsed = (0, package_manager_1.parseRegistryViewJson)(raw);
|
|
21
21
|
const time = parsed.time ?? null;
|
|
22
22
|
if (time) {
|
|
23
23
|
// The time map carries 'created'/'modified' alongside versions; they are
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { NxJsonConfiguration } from '../config/nx-json';
|
|
2
2
|
export declare function isNxCloudDisabled(nxJson: NxJsonConfiguration): boolean;
|
|
3
3
|
export declare function isNxCloudUsed(nxJson: NxJsonConfiguration): boolean;
|
|
4
|
+
/** Whether nx.json connects the workspace to Nx Cloud, ignoring the env. */
|
|
5
|
+
export declare function isNxCloudConfigured(nxJson: NxJsonConfiguration): boolean;
|
|
4
6
|
export declare function getNxCloudUrl(nxJson: NxJsonConfiguration): string;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isNxCloudDisabled = isNxCloudDisabled;
|
|
4
4
|
exports.isNxCloudUsed = isNxCloudUsed;
|
|
5
|
+
exports.isNxCloudConfigured = isNxCloudConfigured;
|
|
5
6
|
exports.getNxCloudUrl = getNxCloudUrl;
|
|
6
7
|
function isNxCloudDisabled(nxJson) {
|
|
7
8
|
return process.env.NX_NO_CLOUD === 'true' || nxJson.neverConnectToCloud;
|
|
@@ -12,7 +13,11 @@ function isNxCloudUsed(nxJson) {
|
|
|
12
13
|
}
|
|
13
14
|
return (!!process.env.NX_CLOUD_AUTH_TOKEN ||
|
|
14
15
|
!!process.env.NX_CLOUD_ACCESS_TOKEN ||
|
|
15
|
-
|
|
16
|
+
isNxCloudConfigured(nxJson));
|
|
17
|
+
}
|
|
18
|
+
/** Whether nx.json connects the workspace to Nx Cloud, ignoring the env. */
|
|
19
|
+
function isNxCloudConfigured(nxJson) {
|
|
20
|
+
return (!!nxJson.nxCloudAccessToken ||
|
|
16
21
|
!!nxJson.nxCloudId ||
|
|
17
22
|
!!Object.values(nxJson.tasksRunnerOptions ?? {}).find((r) => r.runner == '@nrwl/nx-cloud' || r.runner == 'nx-cloud'));
|
|
18
23
|
}
|
|
@@ -12,14 +12,33 @@ export type CollapsibleTaskStatus = Extract<TaskStatus, 'success' | 'local-cache
|
|
|
12
12
|
* routed, the two behave identically.
|
|
13
13
|
*/
|
|
14
14
|
export declare function isStaticOutputStyle(outputStyle: string | undefined): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Whether a style puts task output on the terminal at all.
|
|
17
|
+
*
|
|
18
|
+
* `summary` does not - it prints a status line and the path to each task's log,
|
|
19
|
+
* deliberately addressing the output instead of reproducing it. So every
|
|
20
|
+
* decision that would put a task's bytes on the terminal has to consult this
|
|
21
|
+
* first, including ones that bypass the life cycle: both batch folds and
|
|
22
|
+
* `BatchProcess`'s live forward write to `output` directly, and under `summary`
|
|
23
|
+
* each would dump exactly what the style exists to keep off the screen.
|
|
24
|
+
*
|
|
25
|
+
* Withholding is only half of it. Whatever a caller suppresses here has to be
|
|
26
|
+
* readable somewhere else, because the style's contract is that the output
|
|
27
|
+
* moved, not that it is gone - `BatchProcess` captures to a file rather than
|
|
28
|
+
* dropping, and `runBatch` hands its path to the life cycle.
|
|
29
|
+
*/
|
|
30
|
+
export declare function printsTaskOutput(outputStyle: string | undefined): boolean;
|
|
15
31
|
/**
|
|
16
32
|
* Whether a run prints every task's output in full rather than collapsing the
|
|
17
33
|
* ones that succeeded. Both static life cycles and the batch renderer have to
|
|
18
34
|
* agree on this, so they read it from here rather than each deriving it.
|
|
19
35
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
36
|
+
* Two styles collapse. `static-failures-only` shows only what failed, and is
|
|
37
|
+
* what a run that named no style gets; `summary` withholds task output
|
|
38
|
+
* altogether, addressing each log by path instead, and outranks `verbose` -
|
|
39
|
+
* asking for more detail cannot turn a style whose whole contract is "the
|
|
40
|
+
* output is on disk" back into one that prints. Every other style prints in
|
|
41
|
+
* full because it was asked for explicitly. Note the static life cycles serve more
|
|
23
42
|
* styles than the static-sounding ones: `shouldUseDynamicLifeCycle` bails on
|
|
24
43
|
* `isCI()` before it looks at the style at all, so in CI `dynamic` and `tui`
|
|
25
44
|
* land here too. This is written as a deny-list for that reason — a new style
|
package/dist/src/utils/output.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.output = void 0;
|
|
4
4
|
exports.isStaticOutputStyle = isStaticOutputStyle;
|
|
5
|
+
exports.printsTaskOutput = printsTaskOutput;
|
|
5
6
|
exports.printsFullTaskOutput = printsFullTaskOutput;
|
|
6
7
|
exports.isLogGroupingEnabled = isLogGroupingEnabled;
|
|
7
8
|
exports.shouldGroupBatchOutput = shouldGroupBatchOutput;
|
|
@@ -23,14 +24,35 @@ const GH_GROUP_SUFFIX = '::endgroup::';
|
|
|
23
24
|
function isStaticOutputStyle(outputStyle) {
|
|
24
25
|
return outputStyle === 'static' || outputStyle === 'static-failures-only';
|
|
25
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Whether a style puts task output on the terminal at all.
|
|
29
|
+
*
|
|
30
|
+
* `summary` does not - it prints a status line and the path to each task's log,
|
|
31
|
+
* deliberately addressing the output instead of reproducing it. So every
|
|
32
|
+
* decision that would put a task's bytes on the terminal has to consult this
|
|
33
|
+
* first, including ones that bypass the life cycle: both batch folds and
|
|
34
|
+
* `BatchProcess`'s live forward write to `output` directly, and under `summary`
|
|
35
|
+
* each would dump exactly what the style exists to keep off the screen.
|
|
36
|
+
*
|
|
37
|
+
* Withholding is only half of it. Whatever a caller suppresses here has to be
|
|
38
|
+
* readable somewhere else, because the style's contract is that the output
|
|
39
|
+
* moved, not that it is gone - `BatchProcess` captures to a file rather than
|
|
40
|
+
* dropping, and `runBatch` hands its path to the life cycle.
|
|
41
|
+
*/
|
|
42
|
+
function printsTaskOutput(outputStyle) {
|
|
43
|
+
return outputStyle !== 'summary';
|
|
44
|
+
}
|
|
26
45
|
/**
|
|
27
46
|
* Whether a run prints every task's output in full rather than collapsing the
|
|
28
47
|
* ones that succeeded. Both static life cycles and the batch renderer have to
|
|
29
48
|
* agree on this, so they read it from here rather than each deriving it.
|
|
30
49
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
50
|
+
* Two styles collapse. `static-failures-only` shows only what failed, and is
|
|
51
|
+
* what a run that named no style gets; `summary` withholds task output
|
|
52
|
+
* altogether, addressing each log by path instead, and outranks `verbose` -
|
|
53
|
+
* asking for more detail cannot turn a style whose whole contract is "the
|
|
54
|
+
* output is on disk" back into one that prints. Every other style prints in
|
|
55
|
+
* full because it was asked for explicitly. Note the static life cycles serve more
|
|
34
56
|
* styles than the static-sounding ones: `shouldUseDynamicLifeCycle` bails on
|
|
35
57
|
* `isCI()` before it looks at the style at all, so in CI `dynamic` and `tui`
|
|
36
58
|
* land here too. This is written as a deny-list for that reason — a new style
|
|
@@ -43,8 +65,9 @@ function isStaticOutputStyle(outputStyle) {
|
|
|
43
65
|
* ever being consulted — including for the continuous tasks that must stream.
|
|
44
66
|
*/
|
|
45
67
|
function printsFullTaskOutput(args) {
|
|
46
|
-
return (
|
|
47
|
-
(args.
|
|
68
|
+
return (printsTaskOutput(args.outputStyle) &&
|
|
69
|
+
(!!args.verbose ||
|
|
70
|
+
(args.outputStyle ?? 'static-failures-only') !== 'static-failures-only'));
|
|
48
71
|
}
|
|
49
72
|
/**
|
|
50
73
|
* Whether task output should be wrapped in collapsible log groups. Grouping
|
|
@@ -143,6 +143,31 @@ export declare function readModulePackageJson(moduleSpecifier: string, requirePa
|
|
|
143
143
|
packageJson: PackageJson;
|
|
144
144
|
path: string;
|
|
145
145
|
};
|
|
146
|
+
/**
|
|
147
|
+
* Resolve `request` via Node's CJS resolver while neutralising both ways
|
|
148
|
+
* `require.resolve(req, { paths })` can lie about the `paths` argument:
|
|
149
|
+
*
|
|
150
|
+
* 1. Process-wide `Module._pathCache`. It is swapped out for the duration
|
|
151
|
+
* of the call, so any cache entries written are discarded and any
|
|
152
|
+
* previously-poisoned entries are not read. Without this, an
|
|
153
|
+
* in-process load of a second `nx` package (e.g. the temp `nx@latest`
|
|
154
|
+
* install used by the daemon's AI-agents and console-status checks)
|
|
155
|
+
* can poison the cache key this call uses and make us read the temp
|
|
156
|
+
* path instead of the workspace path.
|
|
157
|
+
*
|
|
158
|
+
* 2. Package self-reference. When a file inside package `nx` calls
|
|
159
|
+
* `require.resolve('nx/...')`, Node returns that calling package's
|
|
160
|
+
* own file regardless of `paths`. We avoid that by issuing the
|
|
161
|
+
* resolve from a `createRequire` rooted at a synthetic path that is
|
|
162
|
+
* outside any package, so the resolver has no "self" to reference
|
|
163
|
+
* and must honour `paths`.
|
|
164
|
+
*
|
|
165
|
+
* Node's single-threaded synchronous execution means `require.resolve` does
|
|
166
|
+
* not yield, so no other code in the process can observe the swapped cache.
|
|
167
|
+
*
|
|
168
|
+
* Throws like `require.resolve` when nothing matches.
|
|
169
|
+
*/
|
|
170
|
+
export declare function resolveWithoutCachePollution(request: string, requirePaths: string[]): string;
|
|
146
171
|
export declare function installPackageToTmp(pkg: string, requiredVersion: string, packageManager: PackageManager): {
|
|
147
172
|
tempDir: string;
|
|
148
173
|
cleanup: () => void;
|
|
@@ -8,12 +8,15 @@ exports.getTagsFromPackageJson = getTagsFromPackageJson;
|
|
|
8
8
|
exports.readTargetsFromPackageJson = readTargetsFromPackageJson;
|
|
9
9
|
exports.readModulePackageJsonWithoutFallbacks = readModulePackageJsonWithoutFallbacks;
|
|
10
10
|
exports.readModulePackageJson = readModulePackageJson;
|
|
11
|
+
exports.resolveWithoutCachePollution = resolveWithoutCachePollution;
|
|
11
12
|
exports.installPackageToTmp = installPackageToTmp;
|
|
12
13
|
exports.installPackageToTmpAsync = installPackageToTmpAsync;
|
|
13
14
|
exports.getDependencyVersionFromPackageJson = getDependencyVersionFromPackageJson;
|
|
15
|
+
const tslib_1 = require("tslib");
|
|
14
16
|
const child_process_1 = require("child_process");
|
|
15
17
|
const util_1 = require("util");
|
|
16
18
|
const fs_1 = require("fs");
|
|
19
|
+
const node_module_1 = tslib_1.__importStar(require("node:module"));
|
|
17
20
|
const path_1 = require("path");
|
|
18
21
|
const execAsync = (0, util_1.promisify)(child_process_1.exec);
|
|
19
22
|
const tmp_1 = require("tmp");
|
|
@@ -169,9 +172,7 @@ function readTargetsFromPackageJson(packageJson, nxJson, projectRoot, workspaceR
|
|
|
169
172
|
* @returns package json contents and path
|
|
170
173
|
*/
|
|
171
174
|
function readModulePackageJsonWithoutFallbacks(moduleSpecifier, requirePaths = (0, installation_directory_1.getNxRequirePaths)()) {
|
|
172
|
-
const packageJsonPath =
|
|
173
|
-
paths: requirePaths,
|
|
174
|
-
});
|
|
175
|
+
const packageJsonPath = resolveWithoutCachePollution(`${moduleSpecifier}/package.json`, requirePaths);
|
|
175
176
|
const packageJson = (0, fileutils_1.readJsonFile)(packageJsonPath);
|
|
176
177
|
return {
|
|
177
178
|
path: packageJsonPath,
|
|
@@ -200,9 +201,7 @@ function readModulePackageJson(moduleSpecifier, requirePaths = (0, installation_
|
|
|
200
201
|
readModulePackageJsonWithoutFallbacks(moduleSpecifier, requirePaths));
|
|
201
202
|
}
|
|
202
203
|
catch {
|
|
203
|
-
const entryPoint =
|
|
204
|
-
paths: requirePaths,
|
|
205
|
-
});
|
|
204
|
+
const entryPoint = resolveWithoutCachePollution(moduleSpecifier, requirePaths);
|
|
206
205
|
let moduleRootPath = (0, path_1.dirname)(entryPoint);
|
|
207
206
|
packageJsonPath = (0, path_1.join)(moduleRootPath, 'package.json');
|
|
208
207
|
while (!(0, fs_1.existsSync)(packageJsonPath)) {
|
|
@@ -219,6 +218,42 @@ function readModulePackageJson(moduleSpecifier, requirePaths = (0, installation_
|
|
|
219
218
|
path: packageJsonPath,
|
|
220
219
|
};
|
|
221
220
|
}
|
|
221
|
+
/**
|
|
222
|
+
* Resolve `request` via Node's CJS resolver while neutralising both ways
|
|
223
|
+
* `require.resolve(req, { paths })` can lie about the `paths` argument:
|
|
224
|
+
*
|
|
225
|
+
* 1. Process-wide `Module._pathCache`. It is swapped out for the duration
|
|
226
|
+
* of the call, so any cache entries written are discarded and any
|
|
227
|
+
* previously-poisoned entries are not read. Without this, an
|
|
228
|
+
* in-process load of a second `nx` package (e.g. the temp `nx@latest`
|
|
229
|
+
* install used by the daemon's AI-agents and console-status checks)
|
|
230
|
+
* can poison the cache key this call uses and make us read the temp
|
|
231
|
+
* path instead of the workspace path.
|
|
232
|
+
*
|
|
233
|
+
* 2. Package self-reference. When a file inside package `nx` calls
|
|
234
|
+
* `require.resolve('nx/...')`, Node returns that calling package's
|
|
235
|
+
* own file regardless of `paths`. We avoid that by issuing the
|
|
236
|
+
* resolve from a `createRequire` rooted at a synthetic path that is
|
|
237
|
+
* outside any package, so the resolver has no "self" to reference
|
|
238
|
+
* and must honour `paths`.
|
|
239
|
+
*
|
|
240
|
+
* Node's single-threaded synchronous execution means `require.resolve` does
|
|
241
|
+
* not yield, so no other code in the process can observe the swapped cache.
|
|
242
|
+
*
|
|
243
|
+
* Throws like `require.resolve` when nothing matches.
|
|
244
|
+
*/
|
|
245
|
+
function resolveWithoutCachePollution(request, requirePaths) {
|
|
246
|
+
// `_pathCache` is an internal Node API not exposed in @types/node.
|
|
247
|
+
const realCache = node_module_1.default._pathCache;
|
|
248
|
+
node_module_1.default._pathCache = Object.create(null);
|
|
249
|
+
try {
|
|
250
|
+
const detachedRequire = (0, node_module_1.createRequire)('/__nx_detached_resolver__/x.js');
|
|
251
|
+
return detachedRequire.resolve(request, { paths: requirePaths });
|
|
252
|
+
}
|
|
253
|
+
finally {
|
|
254
|
+
node_module_1.default._pathCache = realCache;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
222
257
|
/**
|
|
223
258
|
* Prepares all necessary information for installing a package to a temporary directory.
|
|
224
259
|
* This is used by both sync and async installation functions.
|
|
@@ -244,11 +279,18 @@ function preparePackageInstallation(pkg, requiredVersion, packageManager) {
|
|
|
244
279
|
// npm needs `--legacy-peer-deps` rather than `--omit=peer`: npm marks a package
|
|
245
280
|
// as a peer if anything in the tree peer-depends on it, so `--omit=peer` also
|
|
246
281
|
// prunes packages that are real dependencies. Bun's `--omit=peer` does not.
|
|
282
|
+
//
|
|
283
|
+
// pnpm has no plain flag for it. Up to 11 it takes `--config.<setting>`;
|
|
284
|
+
// pnpm 12 gave `--config` a meaning of its own and takes the setting from
|
|
285
|
+
// the environment instead.
|
|
247
286
|
const skipPeerDependenciesFlags = {
|
|
248
287
|
npm: '--legacy-peer-deps',
|
|
249
288
|
bun: '--omit=peer',
|
|
250
289
|
pnpm: '--config.auto-install-peers=false',
|
|
251
290
|
};
|
|
291
|
+
const skipPeerDependenciesEnv = packageManager === 'pnpm'
|
|
292
|
+
? { PNPM_CONFIG_AUTO_INSTALL_PEERS: 'false' }
|
|
293
|
+
: {};
|
|
252
294
|
const installCommand = [
|
|
253
295
|
pmCommands.addDev,
|
|
254
296
|
`${pkg}@${requiredVersion}`,
|
|
@@ -266,6 +308,7 @@ function preparePackageInstallation(pkg, requiredVersion, packageManager) {
|
|
|
266
308
|
env: {
|
|
267
309
|
...process.env,
|
|
268
310
|
YARN_ENABLE_SCRIPTS: 'false',
|
|
311
|
+
...skipPeerDependenciesEnv,
|
|
269
312
|
},
|
|
270
313
|
};
|
|
271
314
|
return {
|