@depup/nx 23.2.1-depup.8 → 23.3.0-depup.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -18
- package/changes.json +9 -53
- 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 +36 -98
- 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
|
@@ -54,14 +54,14 @@ const PNPM_LOCK_PATH = (0, node_path_1.join)(workspace_root_1.workspaceRoot, PNP
|
|
|
54
54
|
const BUN_LOCK_PATH = (0, node_path_1.join)(workspace_root_1.workspaceRoot, bun_parser_1.BUN_LOCK_FILE);
|
|
55
55
|
const BUN_TEXT_LOCK_PATH = (0, node_path_1.join)(workspace_root_1.workspaceRoot, bun_parser_1.BUN_TEXT_LOCK_FILE);
|
|
56
56
|
/**
|
|
57
|
-
* Parses
|
|
57
|
+
* Parses the lockfile into external nodes, plus the keyMap that getLockFileDependencies reads.
|
|
58
58
|
*/
|
|
59
|
-
function getLockFileNodes(packageManager, contents, lockFileHash, context) {
|
|
59
|
+
function getLockFileNodes(packageManager, lockFile, contents, lockFileHash, context) {
|
|
60
60
|
try {
|
|
61
61
|
const packageJson = packageManager === 'yarn' || packageManager === 'bun'
|
|
62
62
|
? (0, fileutils_1.readJsonFile)((0, node_path_1.join)(context.workspaceRoot, 'package.json'))
|
|
63
63
|
: undefined;
|
|
64
|
-
return getLockFileNodesForName(
|
|
64
|
+
return getLockFileNodesForName(lockFile, contents, lockFileHash, packageJson);
|
|
65
65
|
}
|
|
66
66
|
catch (e) {
|
|
67
67
|
if (!isPostInstallProcess()) {
|
|
@@ -94,9 +94,9 @@ function getLockFileNodesForName(lockFile, contents, lockFileHash, packageJson)
|
|
|
94
94
|
throw new Error(`Unknown lock file: ${lockFile}`);
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
97
|
-
* Parses
|
|
97
|
+
* Parses the lockfile into dependencies between external nodes.
|
|
98
98
|
*/
|
|
99
|
-
function getLockFileDependencies(packageManager, contents, lockFileHash, context, keyMap) {
|
|
99
|
+
function getLockFileDependencies(packageManager, lockFile, contents, lockFileHash, context, keyMap) {
|
|
100
100
|
try {
|
|
101
101
|
if (packageManager === 'yarn') {
|
|
102
102
|
return (0, yarn_parser_1.getYarnLockfileDependencies)(contents, lockFileHash, context, keyMap);
|
|
@@ -108,8 +108,7 @@ function getLockFileDependencies(packageManager, contents, lockFileHash, context
|
|
|
108
108
|
return (0, npm_parser_1.getNpmLockfileDependencies)(contents, lockFileHash, context, keyMap);
|
|
109
109
|
}
|
|
110
110
|
if (packageManager === 'bun') {
|
|
111
|
-
|
|
112
|
-
if (lockFilePath.endsWith(bun_parser_1.BUN_TEXT_LOCK_FILE)) {
|
|
111
|
+
if (lockFile === bun_parser_1.BUN_TEXT_LOCK_FILE) {
|
|
113
112
|
// Bun parser doesn't use keyMap
|
|
114
113
|
return (0, bun_parser_1.getBunTextLockfileDependencies)(contents, lockFileHash, context);
|
|
115
114
|
}
|
|
@@ -663,7 +663,7 @@ function stringifyPnpmLockfile(graph, rootLockFileContent, packageJson, workspac
|
|
|
663
663
|
}
|
|
664
664
|
output.packages = (0, object_sort_1.sortObjectByKeys)(output.packages);
|
|
665
665
|
stripStandaloneLockfileConfig(output);
|
|
666
|
-
return (0, pnpm_normalizer_1.stringifyToPnpmYaml)(output);
|
|
666
|
+
return (0, pnpm_normalizer_1.joinPnpmLockfileDocuments)((0, pnpm_normalizer_1.extractEnvLockfileDocument)(rootLockFileContent), (0, pnpm_normalizer_1.stringifyToPnpmYaml)(output));
|
|
667
667
|
}
|
|
668
668
|
/**
|
|
669
669
|
* Removes settings a standalone, pruned lockfile cannot satisfy on its own.
|
|
@@ -15,6 +15,8 @@ export declare function loadPnpmHoistedDepsDefinition(): any;
|
|
|
15
15
|
*/
|
|
16
16
|
export declare function parseAndNormalizePnpmLockfile(content: string): Lockfile;
|
|
17
17
|
export declare function extractMainLockfileDocument(content: string): string;
|
|
18
|
+
export declare function extractEnvLockfileDocument(content: string): string | null;
|
|
19
|
+
export declare function joinPnpmLockfileDocuments(envDocument: string | null, mainDocument: string): string;
|
|
18
20
|
/**
|
|
19
21
|
* Mapping and writing logic from pnpm lockfile `write` function
|
|
20
22
|
*/
|
|
@@ -9,6 +9,8 @@ exports.usesLeadingDash = usesLeadingDash;
|
|
|
9
9
|
exports.loadPnpmHoistedDepsDefinition = loadPnpmHoistedDepsDefinition;
|
|
10
10
|
exports.parseAndNormalizePnpmLockfile = parseAndNormalizePnpmLockfile;
|
|
11
11
|
exports.extractMainLockfileDocument = extractMainLockfileDocument;
|
|
12
|
+
exports.extractEnvLockfileDocument = extractEnvLockfileDocument;
|
|
13
|
+
exports.joinPnpmLockfileDocuments = joinPnpmLockfileDocuments;
|
|
12
14
|
exports.stringifyToPnpmYaml = stringifyToPnpmYaml;
|
|
13
15
|
const node_fs_1 = require("node:fs");
|
|
14
16
|
const semver_1 = require("semver");
|
|
@@ -68,6 +70,26 @@ function extractMainLockfileDocument(content) {
|
|
|
68
70
|
}
|
|
69
71
|
return content.slice(separatorIndex + YAML_DOCUMENT_SEPARATOR.length);
|
|
70
72
|
}
|
|
73
|
+
// The package-manager document (`packageManagerDependencies`) must ship with a
|
|
74
|
+
// pruned lockfile whenever the pruned manifest keeps `packageManager`: pnpm
|
|
75
|
+
// refuses a frozen install when the pin is not recorded in the lockfile.
|
|
76
|
+
function extractEnvLockfileDocument(content) {
|
|
77
|
+
content = content.replace(/\r\n/g, '\n');
|
|
78
|
+
if (!content.startsWith(YAML_DOCUMENT_START)) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
const separatorIndex = content.indexOf(YAML_DOCUMENT_SEPARATOR, YAML_DOCUMENT_START.length);
|
|
82
|
+
if (separatorIndex === -1) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
return content.slice(YAML_DOCUMENT_START.length, separatorIndex);
|
|
86
|
+
}
|
|
87
|
+
function joinPnpmLockfileDocuments(envDocument, mainDocument) {
|
|
88
|
+
if (envDocument === null) {
|
|
89
|
+
return mainDocument;
|
|
90
|
+
}
|
|
91
|
+
return `${YAML_DOCUMENT_START}${envDocument}${YAML_DOCUMENT_SEPARATOR}${mainDocument}`;
|
|
92
|
+
}
|
|
71
93
|
// https://github.com/pnpm/pnpm/blob/50e37072f42bcca6d393a74bed29f7f0e029805d/lockfile/lockfile-file/src/write.ts#L22
|
|
72
94
|
const LOCKFILE_YAML_FORMAT = {
|
|
73
95
|
blankLines: true,
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
import { TouchedProjectLocator } from '../../../../project-graph/affected/affected-project-graph-models';
|
|
2
|
-
import { LockFileChange, WholeFileChange } from '../../../../project-graph/file-utils';
|
|
1
|
+
import { DependencyChanges, TouchedProjectLocator } from '../../../../project-graph/affected/affected-project-graph-models';
|
|
2
|
+
import { FileChange, LockFileChange, WholeFileChange } from '../../../../project-graph/file-utils';
|
|
3
|
+
import { ProjectGraph, ProjectGraphProjectNode } from '../../../../config/project-graph';
|
|
4
|
+
import { NxJsonConfiguration } from '../../../../config/nx-json';
|
|
5
|
+
import { PackageJson } from '../../../../utils/package-json';
|
|
3
6
|
export declare const getTouchedProjectsFromLockFile: TouchedProjectLocator<WholeFileChange | LockFileChange>;
|
|
7
|
+
/**
|
|
8
|
+
* The same change as task selection consumes it: the packages that moved,
|
|
9
|
+
* which a plan names as `External`, rather than the projects depending on them.
|
|
10
|
+
*/
|
|
11
|
+
export declare function lockFileDependencyChanges(fileChanges: FileChange<WholeFileChange | LockFileChange>[], projectGraphNodes: Record<string, ProjectGraphProjectNode>, nxJson: NxJsonConfiguration, packageJson: PackageJson | undefined, projectGraph: ProjectGraph): DependencyChanges;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getTouchedProjectsFromLockFile = void 0;
|
|
4
|
+
exports.lockFileDependencyChanges = lockFileDependencyChanges;
|
|
4
5
|
const file_utils_1 = require("../../../../project-graph/file-utils");
|
|
5
6
|
const config_1 = require("../../utils/config");
|
|
6
7
|
const find_matching_projects_1 = require("../../../../utils/find-matching-projects");
|
|
@@ -9,61 +10,82 @@ const output_1 = require("../../../../utils/output");
|
|
|
9
10
|
const lock_file_1 = require("../../lock-file/lock-file");
|
|
10
11
|
const getTouchedProjectsFromLockFile = (fileChanges, projectGraphNodes, nxJson, packageJson, projectGraph) => {
|
|
11
12
|
const { projectsAffectedByDependencyUpdates } = (0, config_1.jsPluginConfig)(nxJson);
|
|
12
|
-
const changedLockFile = fileChanges
|
|
13
|
+
const changedLockFile = findChangedLockFile(fileChanges);
|
|
14
|
+
const allProjectNames = Object.values(projectGraphNodes).map((p) => p.name);
|
|
13
15
|
if (projectsAffectedByDependencyUpdates === 'auto') {
|
|
14
|
-
|
|
16
|
+
if (!changedLockFile) {
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
// External node names, which the reverse walk in filterAffected carries
|
|
20
|
+
// back to the projects depending on them.
|
|
21
|
+
return (changedExternalNodes(changedLockFile, projectGraph, packageJson) ??
|
|
22
|
+
allProjectNames);
|
|
15
23
|
}
|
|
16
24
|
else if (Array.isArray(projectsAffectedByDependencyUpdates)) {
|
|
17
25
|
return (0, find_matching_projects_1.findMatchingProjects)(projectsAffectedByDependencyUpdates, projectGraphNodes);
|
|
18
26
|
}
|
|
19
|
-
|
|
20
|
-
return Object.values(projectGraphNodes).map((p) => p.name);
|
|
21
|
-
}
|
|
22
|
-
return [];
|
|
27
|
+
return changedLockFile ? allProjectNames : [];
|
|
23
28
|
};
|
|
24
29
|
exports.getTouchedProjectsFromLockFile = getTouchedProjectsFromLockFile;
|
|
25
30
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* external-node maps to determine which packages actually changed.
|
|
29
|
-
*
|
|
30
|
-
* Returns external node names (e.g. "npm:lodash@4.17.21") so the
|
|
31
|
-
* graph reversal in filterAffected can walk back to workspace projects.
|
|
31
|
+
* The same change as task selection consumes it: the packages that moved,
|
|
32
|
+
* which a plan names as `External`, rather than the projects depending on them.
|
|
32
33
|
*/
|
|
33
|
-
function
|
|
34
|
-
const
|
|
34
|
+
function lockFileDependencyChanges(fileChanges, projectGraphNodes, nxJson, packageJson, projectGraph) {
|
|
35
|
+
const none = {
|
|
36
|
+
externals: [],
|
|
37
|
+
changedExternalTypes: [],
|
|
38
|
+
projects: [],
|
|
39
|
+
};
|
|
40
|
+
const changedLockFile = findChangedLockFile(fileChanges);
|
|
35
41
|
if (!changedLockFile) {
|
|
36
|
-
return
|
|
42
|
+
return none;
|
|
43
|
+
}
|
|
44
|
+
const { projectsAffectedByDependencyUpdates } = (0, config_1.jsPluginConfig)(nxJson);
|
|
45
|
+
if (Array.isArray(projectsAffectedByDependencyUpdates)) {
|
|
46
|
+
return {
|
|
47
|
+
...none,
|
|
48
|
+
projects: (0, find_matching_projects_1.findMatchingProjects)(projectsAffectedByDependencyUpdates, projectGraphNodes),
|
|
49
|
+
};
|
|
37
50
|
}
|
|
51
|
+
const externals = projectsAffectedByDependencyUpdates === 'auto'
|
|
52
|
+
? changedExternalNodes(changedLockFile, projectGraph, packageJson)
|
|
53
|
+
: null;
|
|
54
|
+
return externals
|
|
55
|
+
? { ...none, externals }
|
|
56
|
+
: { ...none, changedExternalTypes: ['npm'] };
|
|
57
|
+
}
|
|
58
|
+
function findChangedLockFile(fileChanges) {
|
|
59
|
+
return fileChanges.find((f) => lock_file_1.AUTO_AFFECTED_LOCK_FILES.includes(f.file));
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Diffs the lock file's base and head revisions with the parsers the project
|
|
63
|
+
* graph is built from, and names the external nodes whose package changed.
|
|
64
|
+
*
|
|
65
|
+
* Null when the diff cannot be pinned to packages: a WholeFileChange (a
|
|
66
|
+
* revision could not be read), a parse failure, or a changed package with no
|
|
67
|
+
* external node in the head graph.
|
|
68
|
+
*/
|
|
69
|
+
function changedExternalNodes(changedLockFile, projectGraph, packageJson) {
|
|
38
70
|
const changes = changedLockFile.getChanges();
|
|
39
|
-
// A WholeFileChange means we were unable to read both revisions of
|
|
40
|
-
// the lock file (e.g. missing base revision, git error). Fall back
|
|
41
|
-
// to marking all projects affected.
|
|
42
71
|
if (!changes.every(file_utils_1.isLockFileChange)) {
|
|
43
|
-
return
|
|
72
|
+
return null;
|
|
44
73
|
}
|
|
45
74
|
const changedPackageNames = getChangedPackageNames(changedLockFile.file, changes, packageJson);
|
|
46
75
|
if (changedPackageNames === null) {
|
|
47
|
-
return
|
|
76
|
+
return null;
|
|
48
77
|
}
|
|
49
78
|
if (changedPackageNames.size === 0) {
|
|
50
79
|
return [];
|
|
51
80
|
}
|
|
52
|
-
// Look up the changed packages in the project graph's external nodes
|
|
53
|
-
// and return the external node names. The graph reversal in
|
|
54
|
-
// filterAffected walks from these nodes to workspace projects.
|
|
55
81
|
const { touchedNodeNames, missingPackageNames } = findExternalNodesByPackageName(changedPackageNames, projectGraph.externalNodes ?? {});
|
|
56
|
-
|
|
57
|
-
return allProjectNames;
|
|
58
|
-
}
|
|
59
|
-
return touchedNodeNames;
|
|
82
|
+
return missingPackageNames.size > 0 ? null : touchedNodeNames;
|
|
60
83
|
}
|
|
61
84
|
/**
|
|
62
85
|
* Parse the base and head revisions of the lock file with Nx's
|
|
63
86
|
* existing parsers and diff the resulting package -> version maps.
|
|
64
87
|
*
|
|
65
|
-
* Returns the set of changed package names, or null if parsing
|
|
66
|
-
* failed (in which case the caller should fall back to all projects).
|
|
88
|
+
* Returns the set of changed package names, or null if parsing failed.
|
|
67
89
|
*/
|
|
68
90
|
function getChangedPackageNames(file, changes, packageJson) {
|
|
69
91
|
try {
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import { WholeFileChange } from '../../../../project-graph/file-utils';
|
|
1
|
+
import { FileChange, WholeFileChange } from '../../../../project-graph/file-utils';
|
|
2
2
|
import { JsonChange } from '../../../../utils/json-diff';
|
|
3
|
-
import { TouchedProjectLocator } from '../../../../project-graph/affected/affected-project-graph-models';
|
|
3
|
+
import { DependencyChanges, TouchedProjectLocator } from '../../../../project-graph/affected/affected-project-graph-models';
|
|
4
|
+
import { ProjectGraph } from '../../../../config/project-graph';
|
|
5
|
+
import { NxJsonConfiguration } from '../../../../config/nx-json';
|
|
4
6
|
export declare const getTouchedNpmPackages: TouchedProjectLocator<WholeFileChange | JsonChange>;
|
|
7
|
+
/**
|
|
8
|
+
* The same change as task selection consumes it: the packages that moved,
|
|
9
|
+
* which a plan names as `External`, and the workspace projects the root
|
|
10
|
+
* package.json depends on directly.
|
|
11
|
+
*/
|
|
12
|
+
export declare function packageJsonDependencyChanges(touchedFiles: FileChange<WholeFileChange | JsonChange>[], nxJson: NxJsonConfiguration, projectGraph: ProjectGraph): DependencyChanges;
|
|
@@ -1,11 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getTouchedNpmPackages = void 0;
|
|
4
|
+
exports.packageJsonDependencyChanges = packageJsonDependencyChanges;
|
|
4
5
|
const file_utils_1 = require("../../../../project-graph/file-utils");
|
|
5
6
|
const json_diff_1 = require("../../../../utils/json-diff");
|
|
6
7
|
const logger_1 = require("../../../../utils/logger");
|
|
7
8
|
const get_package_name_from_import_path_1 = require("../../../../utils/get-package-name-from-import-path");
|
|
8
|
-
const getTouchedNpmPackages = (touchedFiles,
|
|
9
|
+
const getTouchedNpmPackages = (touchedFiles, _nodes, nxJson, _packageJson, projectGraph) => touchedNpmPackages(touchedFiles, nxJson, projectGraph) ??
|
|
10
|
+
Object.keys(projectGraph.nodes);
|
|
11
|
+
exports.getTouchedNpmPackages = getTouchedNpmPackages;
|
|
12
|
+
/**
|
|
13
|
+
* The same change as task selection consumes it: the packages that moved,
|
|
14
|
+
* which a plan names as `External`, and the workspace projects the root
|
|
15
|
+
* package.json depends on directly.
|
|
16
|
+
*/
|
|
17
|
+
function packageJsonDependencyChanges(touchedFiles, nxJson, projectGraph) {
|
|
18
|
+
const touched = touchedNpmPackages(touchedFiles, nxJson, projectGraph);
|
|
19
|
+
if (touched === null) {
|
|
20
|
+
return { externals: [], changedExternalTypes: ['npm'], projects: [] };
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
externals: touched.filter((name) => name in projectGraph.externalNodes),
|
|
24
|
+
changedExternalTypes: [],
|
|
25
|
+
projects: touched.filter((name) => name in projectGraph.nodes),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* External nodes and workspace projects the root package.json change names,
|
|
30
|
+
* or null when it cannot be pinned to them: a removed dependency, a global
|
|
31
|
+
* package, or an override selector matching nothing in the graph.
|
|
32
|
+
*/
|
|
33
|
+
function touchedNpmPackages(touchedFiles, nxJson, projectGraph) {
|
|
9
34
|
const packageJsonChange = touchedFiles.find((f) => f.file === 'package.json');
|
|
10
35
|
if (!packageJsonChange)
|
|
11
36
|
return [];
|
|
@@ -19,10 +44,8 @@ const getTouchedNpmPackages = (touchedFiles, _, nxJson, packageJson, projectGrap
|
|
|
19
44
|
if ((0, json_diff_1.isJsonChange)(c) &&
|
|
20
45
|
(c.path[0] === 'dependencies' || c.path[0] === 'devDependencies') &&
|
|
21
46
|
c.path.length === 2) {
|
|
22
|
-
// A package was deleted so mark all workspace projects as touched.
|
|
23
47
|
if (c.type === json_diff_1.JsonDiffType.Deleted) {
|
|
24
|
-
|
|
25
|
-
break;
|
|
48
|
+
return null;
|
|
26
49
|
}
|
|
27
50
|
else {
|
|
28
51
|
let npmPackage = npmPackages.find((pkg) => pkg.data.packageName === c.path[1]);
|
|
@@ -45,7 +68,7 @@ const getTouchedNpmPackages = (touchedFiles, _, nxJson, packageJson, projectGrap
|
|
|
45
68
|
}
|
|
46
69
|
if ('packageName' in npmPackage.data) {
|
|
47
70
|
if (globalPackages.has(npmPackage.data.packageName)) {
|
|
48
|
-
return
|
|
71
|
+
return null;
|
|
49
72
|
}
|
|
50
73
|
}
|
|
51
74
|
}
|
|
@@ -59,13 +82,12 @@ const getTouchedNpmPackages = (touchedFiles, _, nxJson, packageJson, projectGrap
|
|
|
59
82
|
continue;
|
|
60
83
|
packagesByName ??= groupPackagesByName(npmPackages);
|
|
61
84
|
const matchingNpmPackages = findPackagesForSelector(packageSelector, packagesByName, c.path[0] === 'pnpm');
|
|
62
|
-
// An unresolved selector can still target a transitive dependency
|
|
63
|
-
// so fall back to marking every project affected.
|
|
85
|
+
// An unresolved selector can still target a transitive dependency.
|
|
64
86
|
if (!matchingNpmPackages.length) {
|
|
65
|
-
return
|
|
87
|
+
return null;
|
|
66
88
|
}
|
|
67
89
|
if (matchingNpmPackages.some((pkg) => globalPackages.has(pkg.data.packageName))) {
|
|
68
|
-
return
|
|
90
|
+
return null;
|
|
69
91
|
}
|
|
70
92
|
touched.push(...matchingNpmPackages.map((pkg) => pkg.name));
|
|
71
93
|
}
|
|
@@ -79,8 +101,7 @@ const getTouchedNpmPackages = (touchedFiles, _, nxJson, packageJson, projectGrap
|
|
|
79
101
|
logger_1.logger.warn(`The affected projects might have not been identified properly. The package(s) ${missingTouchedNpmPackages.join(', ')} were not found. Please open an issue in GitHub including the package.json file.`);
|
|
80
102
|
}
|
|
81
103
|
return [...new Set(touched)];
|
|
82
|
-
}
|
|
83
|
-
exports.getTouchedNpmPackages = getTouchedNpmPackages;
|
|
104
|
+
}
|
|
84
105
|
function getPackageSelector(change) {
|
|
85
106
|
if (typeof change.value.lhs !== 'string' &&
|
|
86
107
|
typeof change.value.rhs !== 'string') {
|
|
@@ -416,17 +416,16 @@ class TargetProjectLocator {
|
|
|
416
416
|
const packageJsonPath = (0, resolve_relative_to_dir_1.resolveRelativeToDir)((0, node_path_1.join)(packageName, 'package.json'), relativeToDir);
|
|
417
417
|
if (packageJsonPath) {
|
|
418
418
|
if (this.packageJsonResolutionCache.has(packageJsonPath)) {
|
|
419
|
-
|
|
419
|
+
const cached = this.packageJsonResolutionCache.get(packageJsonPath);
|
|
420
|
+
if (cached) {
|
|
421
|
+
return cached;
|
|
422
|
+
}
|
|
420
423
|
}
|
|
421
424
|
const parsedPackageJson = (0, fileutils_1.readJsonFile)(packageJsonPath);
|
|
422
425
|
if (parsedPackageJson.name && parsedPackageJson.version) {
|
|
423
426
|
this.packageJsonResolutionCache.set(packageJsonPath, parsedPackageJson);
|
|
424
427
|
return parsedPackageJson;
|
|
425
428
|
}
|
|
426
|
-
else {
|
|
427
|
-
this.packageJsonResolutionCache.set(packageJsonPath, null);
|
|
428
|
-
return null;
|
|
429
|
-
}
|
|
430
429
|
}
|
|
431
430
|
try {
|
|
432
431
|
// Resolve the main entry point of the package
|
|
@@ -435,22 +434,27 @@ class TargetProjectLocator {
|
|
|
435
434
|
while (dir !== (0, node_path_1.dirname)(dir)) {
|
|
436
435
|
const packageJsonPath = (0, node_path_1.join)(dir, 'package.json');
|
|
437
436
|
if (this.packageJsonResolutionCache.has(packageJsonPath)) {
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
const parsedPackageJson = (0, fileutils_1.readJsonFile)(packageJsonPath);
|
|
442
|
-
// Ensure the package.json contains the "name" and "version" fields
|
|
443
|
-
if (parsedPackageJson.name && parsedPackageJson.version) {
|
|
444
|
-
this.packageJsonResolutionCache.set(packageJsonPath, parsedPackageJson);
|
|
445
|
-
return parsedPackageJson;
|
|
437
|
+
const cached = this.packageJsonResolutionCache.get(packageJsonPath);
|
|
438
|
+
if (cached) {
|
|
439
|
+
return cached;
|
|
446
440
|
}
|
|
447
|
-
|
|
441
|
+
// Cached incomplete manifests are traversal points, not terminal misses.
|
|
442
|
+
}
|
|
443
|
+
else {
|
|
444
|
+
try {
|
|
445
|
+
const parsedPackageJson = (0, fileutils_1.readJsonFile)(packageJsonPath);
|
|
446
|
+
// Ensure the package.json contains the "name" and "version" fields
|
|
447
|
+
if (parsedPackageJson.name && parsedPackageJson.version) {
|
|
448
|
+
this.packageJsonResolutionCache.set(packageJsonPath, parsedPackageJson);
|
|
449
|
+
return parsedPackageJson;
|
|
450
|
+
}
|
|
451
|
+
// A module-format stub without name/version: remember it and keep
|
|
452
|
+
// traversing towards the real manifest.
|
|
448
453
|
this.packageJsonResolutionCache.set(packageJsonPath, null);
|
|
449
|
-
return null;
|
|
450
454
|
}
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
455
|
+
catch {
|
|
456
|
+
// Package.json is invalid, keep traversing
|
|
457
|
+
}
|
|
454
458
|
}
|
|
455
459
|
dir = (0, node_path_1.dirname)(dir);
|
|
456
460
|
}
|
|
@@ -24,6 +24,7 @@ exports.registerTsConfigPaths = registerTsConfigPaths;
|
|
|
24
24
|
exports.getTsNodeCompilerOptions = getTsNodeCompilerOptions;
|
|
25
25
|
const path_1 = require("path");
|
|
26
26
|
const fs_1 = require("fs");
|
|
27
|
+
const fileutils_1 = require("../../../utils/fileutils");
|
|
27
28
|
const logger_1 = require("../../../utils/logger");
|
|
28
29
|
const workspace_root_1 = require("../../../utils/workspace-root");
|
|
29
30
|
const typescript_1 = require("./typescript");
|
|
@@ -846,6 +847,13 @@ function loadTsFile(filePath, tsConfigPath) {
|
|
|
846
847
|
if (isInvokedByTsx) {
|
|
847
848
|
return require(filePath);
|
|
848
849
|
}
|
|
850
|
+
// Executors and generators load in processes that never loaded a plugin
|
|
851
|
+
// (batch workers, forked tasks), so the NodeNext `.js` -> `.ts` resolvers the
|
|
852
|
+
// plugin loader installs are not there yet. Both are idempotent.
|
|
853
|
+
ensureCjsResolverPatched();
|
|
854
|
+
if (preferNodeStripTypes) {
|
|
855
|
+
ensureNodeNextEsmResolverRegistered();
|
|
856
|
+
}
|
|
849
857
|
if (!preferNodeStripTypes) {
|
|
850
858
|
if (!resolvedTsConfigPath) {
|
|
851
859
|
throw new Error(`${logger_1.NX_PREFIX} loadTsFile could not find a workspace tsconfig while loading ${filePath} on the swc/ts-node path. Pass an explicit tsConfigPath or add a tsconfig.base.json/tsconfig.json at the workspace root.`);
|
|
@@ -858,9 +866,10 @@ function loadTsFile(filePath, tsConfigPath) {
|
|
|
858
866
|
cleanup();
|
|
859
867
|
}
|
|
860
868
|
}
|
|
861
|
-
// Native strip path: no
|
|
862
|
-
// resolve aliases without tsconfig-paths.
|
|
863
|
-
// the specific error code indicates is
|
|
869
|
+
// Native strip path: no tsconfig-paths or transpiler registration up
|
|
870
|
+
// front. pnpm/npm/yarn workspaces resolve aliases without tsconfig-paths.
|
|
871
|
+
// On failure, lazy-register what the specific error code indicates is
|
|
872
|
+
// needed and retry:
|
|
864
873
|
// - MODULE_NOT_FOUND -> first try tsconfig-paths (alias resolution).
|
|
865
874
|
// If that still fails (e.g. extensionless `import './foo'` when
|
|
866
875
|
// `foo.ts` is adjacent - Node's resolver doesn't add `.ts`), escalate
|
|
@@ -1208,7 +1217,7 @@ function resolvePathsBaseUrl(tsconfigPath) {
|
|
|
1208
1217
|
const absolute = (0, path_1.resolve)(queue.shift());
|
|
1209
1218
|
const dir = (0, path_1.dirname)(absolute);
|
|
1210
1219
|
try {
|
|
1211
|
-
const raw =
|
|
1220
|
+
const raw = (0, fileutils_1.readJsonFile)(absolute);
|
|
1212
1221
|
chain.push({ dir, raw });
|
|
1213
1222
|
const exts = raw.extends
|
|
1214
1223
|
? Array.isArray(raw.extends)
|
|
@@ -3,7 +3,7 @@ import type { ProjectConfiguration } from '../../config/workspace-json-project-j
|
|
|
3
3
|
import { PackageJson } from '../../utils/package-json';
|
|
4
4
|
import { PackageManagerCommands } from '../../utils/package-manager';
|
|
5
5
|
import { CreateNodes } from '../../project-graph/plugins';
|
|
6
|
-
import { PackageJsonConfigurationCache } from '../../../plugins/package-json';
|
|
6
|
+
import type { PackageJsonConfigurationCache } from '../../../plugins/package-json';
|
|
7
7
|
export declare const createNodes: CreateNodes;
|
|
8
8
|
export declare function buildPackageJsonPatterns(workspaceRoot: string, readJson: (path: string) => any): PackageJsonPatterns;
|
|
9
9
|
type PackageJsonPatterns = {
|
|
@@ -13,7 +13,7 @@ type PackageJsonPatterns = {
|
|
|
13
13
|
negativeLookup: Record<string, boolean>;
|
|
14
14
|
};
|
|
15
15
|
export declare function buildPackageJsonWorkspacesMatcher(patterns: PackageJsonPatterns): (p: any) => boolean;
|
|
16
|
-
export declare function createNodeFromPackageJson(pkgJsonPath: string, workspaceRoot: string, cache: PackageJsonConfigurationCache, isInPackageManagerWorkspaces: boolean, packageManagerCommand: PackageManagerCommands): {
|
|
16
|
+
export declare function createNodeFromPackageJson(pkgJsonPath: string, workspaceRoot: string, cache: PackageJsonConfigurationCache | undefined, isInPackageManagerWorkspaces: boolean, packageManagerCommand: PackageManagerCommands, nxJson?: NxJsonConfiguration): {
|
|
17
17
|
projects: {
|
|
18
18
|
[x: string]: ProjectConfiguration;
|
|
19
19
|
};
|
|
@@ -22,7 +22,6 @@ const versions_1 = require("../../utils/versions");
|
|
|
22
22
|
const plugins_1 = require("../../project-graph/plugins");
|
|
23
23
|
const path_2 = require("path");
|
|
24
24
|
const file_hasher_1 = require("../../hasher/file-hasher");
|
|
25
|
-
const package_json_2 = require("../../../plugins/package-json");
|
|
26
25
|
const globPatterns = (0, globs_1.combineGlobPatterns)('package.json', '**/package.json', 'project.json', '**/project.json');
|
|
27
26
|
exports.createNodes = [
|
|
28
27
|
globPatterns,
|
|
@@ -38,7 +37,6 @@ exports.createNodes = [
|
|
|
38
37
|
const isNextToProjectJson = (packageJsonPath) => {
|
|
39
38
|
return projectJsonRoots.has((0, node_path_1.dirname)(packageJsonPath));
|
|
40
39
|
};
|
|
41
|
-
const cache = (0, package_json_2.readPackageJsonConfigurationCache)();
|
|
42
40
|
const packageManagerCommand = (0, package_manager_1.getPackageManagerCommand)((0, package_manager_1.detectPackageManager)(context.workspaceRoot), context.workspaceRoot);
|
|
43
41
|
return (0, plugins_1.createNodesFromFiles)((packageJsonPath, options, context) => {
|
|
44
42
|
const isInPackageManagerWorkspaces = isInPackageJsonWorkspaces(packageJsonPath);
|
|
@@ -47,7 +45,7 @@ exports.createNodes = [
|
|
|
47
45
|
// Skip if package.json is not part of the package.json workspaces and not next to a project.json.
|
|
48
46
|
return null;
|
|
49
47
|
}
|
|
50
|
-
return createNodeFromPackageJson(packageJsonPath, context.workspaceRoot,
|
|
48
|
+
return createNodeFromPackageJson(packageJsonPath, context.workspaceRoot, undefined, isInPackageManagerWorkspaces, packageManagerCommand, context.nxJsonConfiguration);
|
|
51
49
|
}, packageJsons, _, context);
|
|
52
50
|
},
|
|
53
51
|
];
|
|
@@ -115,16 +113,18 @@ function buildPackageJsonWorkspacesMatcher(patterns) {
|
|
|
115
113
|
!patterns.negativeLookup[p] &&
|
|
116
114
|
negative.every((m) => m.match(p));
|
|
117
115
|
}
|
|
118
|
-
function createNodeFromPackageJson(pkgJsonPath, workspaceRoot, cache, isInPackageManagerWorkspaces, packageManagerCommand) {
|
|
116
|
+
function createNodeFromPackageJson(pkgJsonPath, workspaceRoot, cache, isInPackageManagerWorkspaces, packageManagerCommand, nxJson) {
|
|
119
117
|
const json = (0, fileutils_1.readJsonFile)((0, node_path_1.join)(workspaceRoot, pkgJsonPath));
|
|
120
118
|
const projectRoot = (0, node_path_1.dirname)(pkgJsonPath);
|
|
121
|
-
const hash =
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
119
|
+
const hash = cache
|
|
120
|
+
? (0, file_hasher_1.hashObject)({
|
|
121
|
+
...json,
|
|
122
|
+
root: projectRoot,
|
|
123
|
+
isInPackageManagerWorkspaces,
|
|
124
|
+
nxVersion: versions_1.nxVersion,
|
|
125
|
+
})
|
|
126
|
+
: undefined;
|
|
127
|
+
const cached = cache?.get(hash);
|
|
128
128
|
if (cached) {
|
|
129
129
|
return {
|
|
130
130
|
projects: {
|
|
@@ -132,8 +132,8 @@ function createNodeFromPackageJson(pkgJsonPath, workspaceRoot, cache, isInPackag
|
|
|
132
132
|
},
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
|
-
const project = buildProjectConfigurationFromPackageJson(json, workspaceRoot, pkgJsonPath, (0, nx_json_1.readNxJson)(workspaceRoot), isInPackageManagerWorkspaces, packageManagerCommand);
|
|
136
|
-
cache
|
|
135
|
+
const project = buildProjectConfigurationFromPackageJson(json, workspaceRoot, pkgJsonPath, nxJson ?? (0, nx_json_1.readNxJson)(workspaceRoot), isInPackageManagerWorkspaces, packageManagerCommand);
|
|
136
|
+
cache?.set(hash, project);
|
|
137
137
|
return {
|
|
138
138
|
projects: {
|
|
139
139
|
[project.root]: project,
|
|
@@ -6,6 +6,20 @@ export interface AffectedProjectGraphContext {
|
|
|
6
6
|
nxJson: NxJsonConfiguration<any>;
|
|
7
7
|
touchedProjects: string[];
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* What a lockfile or package.json change moved, before it is projected onto
|
|
11
|
+
* projects (the reverse walk) or tasks (matched against each plan's externals).
|
|
12
|
+
*/
|
|
13
|
+
export interface DependencyChanges {
|
|
14
|
+
/** External node names whose version or integrity moved. */
|
|
15
|
+
externals: string[];
|
|
16
|
+
/** Ecosystems whose manifest changed without the change being pinnable to
|
|
17
|
+
* packages, so every node of that type counts as moved. A locator names the
|
|
18
|
+
* ecosystem it reads, since a change to one cannot move another's nodes. */
|
|
19
|
+
changedExternalTypes: string[];
|
|
20
|
+
/** Workspace projects the change names outright. */
|
|
21
|
+
projects: string[];
|
|
22
|
+
}
|
|
9
23
|
export interface TouchedProjectLocator<T extends Change = Change> {
|
|
10
24
|
(fileChanges: FileChange<T>[], projectGraphNodes?: Record<string, ProjectGraphProjectNode>, nxJson?: NxJsonConfiguration<any>, packageJson?: any, projectGraph?: ProjectGraph, projectDeletionAffectsAllProjects?: boolean): string[] | Promise<string[]>;
|
|
11
25
|
}
|
|
@@ -2,27 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.filterAffected = filterAffected;
|
|
4
4
|
const file_utils_1 = require("../file-utils");
|
|
5
|
-
const workspace_projects_1 = require("./locators/workspace-projects");
|
|
6
|
-
const touched_projects_1 = require("../../plugins/js/project-graph/affected/touched-projects");
|
|
7
5
|
const operators_1 = require("../operators");
|
|
8
6
|
const configuration_1 = require("../../config/configuration");
|
|
9
|
-
const
|
|
7
|
+
const affected_projects_1 = require("./affected-projects");
|
|
10
8
|
async function filterAffected(graph, touchedFiles, nxJson = (0, configuration_1.readNxJson)(), packageJson = (0, file_utils_1.readPackageJson)(), projectDeletionAffectsAllProjects = true) {
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
project_glob_changes_1.getTouchedProjectsFromProjectGlobChanges,
|
|
16
|
-
touched_projects_1.getTouchedProjects,
|
|
17
|
-
];
|
|
18
|
-
const touchedProjects = [];
|
|
19
|
-
for (const locator of touchedProjectLocators) {
|
|
20
|
-
performance.mark(locator.name + ':start');
|
|
21
|
-
const projects = await locator(touchedFiles, graph.nodes, nxJson, packageJson, graph, projectDeletionAffectsAllProjects);
|
|
22
|
-
performance.mark(locator.name + ':end');
|
|
23
|
-
performance.measure(locator.name, locator.name + ':start', locator.name + ':end');
|
|
24
|
-
touchedProjects.push(...projects);
|
|
25
|
-
}
|
|
9
|
+
performance.mark('locateTouchedProjects:start');
|
|
10
|
+
const touchedProjects = await (0, affected_projects_1.runTouchedProjectLocators)(graph, touchedFiles, nxJson, packageJson, projectDeletionAffectsAllProjects);
|
|
11
|
+
performance.mark('locateTouchedProjects:end');
|
|
12
|
+
performance.measure('locateTouchedProjects', 'locateTouchedProjects:start', 'locateTouchedProjects:end');
|
|
26
13
|
return filterAffectedProjects(graph, {
|
|
27
14
|
projectGraphNodes: graph.nodes,
|
|
28
15
|
nxJson,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { NxJsonConfiguration } from '../../config/nx-json';
|
|
2
|
+
import { ProjectGraph } from '../../config/project-graph';
|
|
3
|
+
import { FileChange } from '../file-utils';
|
|
4
|
+
/** Runs every locator and returns what each one marked, duplicates included. */
|
|
5
|
+
export declare function runTouchedProjectLocators(graph: ProjectGraph, touchedFiles: FileChange[], nxJson: NxJsonConfiguration, packageJson?: any, projectDeletionAffectsAllProjects?: boolean): Promise<string[]>;
|
|
6
|
+
/** Resolved here because the native side takes the patterns, not the plugins. */
|
|
7
|
+
export declare function getProjectGlobPatterns(nxJson: NxJsonConfiguration): Promise<string[]>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runTouchedProjectLocators = runTouchedProjectLocators;
|
|
4
|
+
exports.getProjectGlobPatterns = getProjectGlobPatterns;
|
|
5
|
+
const native_1 = require("../../native");
|
|
6
|
+
const get_plugins_1 = require("../plugins/get-plugins");
|
|
7
|
+
const workspace_root_1 = require("../../utils/workspace-root");
|
|
8
|
+
const file_utils_1 = require("../file-utils");
|
|
9
|
+
const touched_projects_1 = require("../../plugins/js/project-graph/affected/touched-projects");
|
|
10
|
+
const transform_objects_1 = require("../../native/transform-objects");
|
|
11
|
+
/** Runs every locator and returns what each one marked, duplicates included. */
|
|
12
|
+
async function runTouchedProjectLocators(graph, touchedFiles, nxJson, packageJson, projectDeletionAffectsAllProjects = true) {
|
|
13
|
+
return (0, native_1.locateTouchedProjects)((0, transform_objects_1.transformProjectGraphForLocators)(graph), nxJson, touchedFiles.map((f) => f.file), {
|
|
14
|
+
// Only a deletion reaches projects_from_project_glob_changes, and
|
|
15
|
+
// resolving the patterns can fall back to starting plugin workers.
|
|
16
|
+
projectGlobPatterns: touchedFiles.some((f) => (0, file_utils_1.isDeletedFile)(f.file))
|
|
17
|
+
? await getProjectGlobPatterns(nxJson)
|
|
18
|
+
: [],
|
|
19
|
+
projectDeletionAffectsAllProjects,
|
|
20
|
+
workspaceRoot: workspace_root_1.workspaceRoot,
|
|
21
|
+
},
|
|
22
|
+
// Takes only paths, so the closure carries the FileChange objects: their
|
|
23
|
+
// lazy getChanges() cannot cross the native boundary.
|
|
24
|
+
[
|
|
25
|
+
async () => (0, touched_projects_1.getTouchedProjects)(touchedFiles, graph.nodes, nxJson, packageJson, graph, projectDeletionAffectsAllProjects),
|
|
26
|
+
]);
|
|
27
|
+
}
|
|
28
|
+
/** Resolved here because the native side takes the patterns, not the plugins. */
|
|
29
|
+
async function getProjectGlobPatterns(nxJson) {
|
|
30
|
+
if (process.env.NX_FORCE_REUSE_CACHED_GRAPH === 'true') {
|
|
31
|
+
return [
|
|
32
|
+
'**/package.json',
|
|
33
|
+
'**/project.json',
|
|
34
|
+
'project.json',
|
|
35
|
+
'package.json',
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
const capabilities = await (0, get_plugins_1.capabilitiesOfConfiguredPlugins)(nxJson, workspace_root_1.workspaceRoot);
|
|
39
|
+
return capabilities
|
|
40
|
+
.map((capability) => capability.createNodesPattern)
|
|
41
|
+
.filter((pattern) => !!pattern);
|
|
42
|
+
}
|