nx 23.2.0-beta.0 → 23.2.0-beta.10
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/dist/bin/init-local.js +3 -5
- package/dist/bin/nx.js +3 -1
- package/dist/release/changelog-renderer/index.js +4 -5
- package/dist/release/index.d.ts +1 -1
- package/dist/src/adapter/ngcli-adapter.js +60 -1
- package/dist/src/ai/set-up-ai-agents/set-up-ai-agents.js +35 -15
- package/dist/src/analytics/analytics.d.ts +6 -0
- package/dist/src/analytics/analytics.js +16 -10
- package/dist/src/analytics/index.d.ts +1 -1
- package/dist/src/analytics/index.js +2 -1
- package/dist/src/command-line/add/add.js +5 -0
- package/dist/src/command-line/affected/affected.js +1 -0
- package/dist/src/command-line/completion/command-object.js +7 -12
- package/dist/src/command-line/configure-ai-agents/configure-ai-agents.js +19 -25
- package/dist/src/command-line/format/format.js +84 -101
- package/dist/src/command-line/generate/generate.js +35 -35
- package/dist/src/command-line/graph/graph.d.ts +1 -0
- package/dist/src/command-line/graph/graph.js +15 -6
- package/dist/src/command-line/import/import.js +30 -40
- package/dist/src/command-line/init/ai-agent-prompts.d.ts +1 -1
- package/dist/src/command-line/init/ai-agent-prompts.js +12 -17
- package/dist/src/command-line/init/command-object.js +14 -4
- package/dist/src/command-line/init/configure-plugins.js +4 -1
- package/dist/src/command-line/init/implementation/add-nx-to-monorepo.js +12 -32
- package/dist/src/command-line/init/implementation/add-nx-to-nest.js +17 -21
- package/dist/src/command-line/init/implementation/add-nx-to-npm-repo.js +8 -21
- package/dist/src/command-line/init/implementation/add-nx-to-turborepo.js +3 -17
- package/dist/src/command-line/init/implementation/angular/index.js +10 -15
- package/dist/src/command-line/init/implementation/angular/integrated-workspace.js +2 -5
- package/dist/src/command-line/init/implementation/angular/legacy-angular-versions.js +5 -0
- package/dist/src/command-line/init/implementation/angular/standalone-workspace.js +8 -2
- package/dist/src/command-line/init/implementation/check-compatible-with-plugins.js +2 -0
- package/dist/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +9 -1
- package/dist/src/command-line/init/implementation/format.d.ts +18 -0
- package/dist/src/command-line/init/implementation/format.js +114 -0
- package/dist/src/command-line/init/implementation/utils.js +8 -0
- package/dist/src/command-line/init/init-v1.js +15 -18
- package/dist/src/command-line/init/init-v2.js +40 -57
- package/dist/src/command-line/migrate/agentic/definitions.js +36 -9
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +37 -22
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +30 -39
- package/dist/src/command-line/migrate/agentic/handoff.d.ts +7 -7
- package/dist/src/command-line/migrate/agentic/handoff.js +13 -10
- package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.d.ts +7 -12
- package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.js +7 -0
- package/dist/src/command-line/migrate/agentic/run-step.d.ts +10 -0
- package/dist/src/command-line/migrate/agentic/run-step.js +1 -0
- package/dist/src/command-line/migrate/agentic/runner.js +24 -24
- package/dist/src/command-line/migrate/agentic/select.d.ts +10 -2
- package/dist/src/command-line/migrate/agentic/select.js +30 -32
- package/dist/src/command-line/migrate/agentic/types.d.ts +33 -3
- package/dist/src/command-line/migrate/agentic/types.js +35 -0
- package/dist/src/command-line/migrate/command-object.d.ts +6 -0
- package/dist/src/command-line/migrate/command-object.js +19 -1
- package/dist/src/command-line/migrate/execute-migration.d.ts +91 -0
- package/dist/src/command-line/migrate/execute-migration.js +474 -0
- package/dist/src/command-line/migrate/migrate-analytics.d.ts +35 -0
- package/dist/src/command-line/migrate/migrate-analytics.js +64 -0
- package/dist/src/command-line/migrate/migrate-commits.d.ts +38 -8
- package/dist/src/command-line/migrate/migrate-commits.js +130 -15
- package/dist/src/command-line/migrate/migrate-config.d.ts +13 -12
- package/dist/src/command-line/migrate/migrate-config.js +22 -14
- package/dist/src/command-line/migrate/migrate-output.d.ts +45 -7
- package/dist/src/command-line/migrate/migrate-output.js +52 -8
- package/dist/src/command-line/migrate/migrate-ui-api.d.ts +2 -1
- package/dist/src/command-line/migrate/migrate-ui-api.js +33 -19
- package/dist/src/command-line/migrate/migrate.d.ts +29 -113
- package/dist/src/command-line/migrate/migrate.js +666 -664
- package/dist/src/command-line/migrate/migration-shape.d.ts +8 -0
- package/dist/src/command-line/migrate/multi-major.js +7 -10
- package/dist/src/command-line/migrate/resolve-package-version.js +4 -8
- package/dist/src/command-line/migrate/run/agent-output.d.ts +20 -0
- package/dist/src/command-line/migrate/run/agent-output.js +65 -0
- package/dist/src/command-line/migrate/run/index.d.ts +9 -0
- package/dist/src/command-line/migrate/run/index.js +23 -0
- package/dist/src/command-line/migrate/run/orchestrator.d.ts +20 -0
- package/dist/src/command-line/migrate/run/orchestrator.js +1200 -0
- package/dist/src/command-line/migrate/run/run-id.d.ts +16 -0
- package/dist/src/command-line/migrate/run/run-id.js +56 -0
- package/dist/src/command-line/migrate/run/run-state.d.ts +157 -0
- package/dist/src/command-line/migrate/run/run-state.js +438 -0
- package/dist/src/command-line/migrate/run/state-lock.d.ts +25 -0
- package/dist/src/command-line/migrate/run/state-lock.js +76 -0
- package/dist/src/command-line/migrate/run/state-machine.d.ts +84 -0
- package/dist/src/command-line/migrate/run/state-machine.js +315 -0
- package/dist/src/command-line/migrate/run/util.d.ts +59 -0
- package/dist/src/command-line/migrate/run/util.js +148 -0
- package/dist/src/command-line/migrate/run/worker.d.ts +16 -0
- package/dist/src/command-line/migrate/run/worker.js +682 -0
- package/dist/src/command-line/migrate/run-migration-process.js +6 -5
- package/dist/src/command-line/migrate/safe-prompt.d.ts +14 -26
- package/dist/src/command-line/migrate/safe-prompt.js +32 -43
- package/dist/src/command-line/migrate/sort-migrations.d.ts +16 -0
- package/dist/src/command-line/migrate/sort-migrations.js +32 -0
- package/dist/src/command-line/migrate/step-actions.d.ts +5 -0
- package/dist/src/command-line/migrate/step-actions.js +12 -0
- package/dist/src/command-line/migrate/text.d.ts +18 -0
- package/dist/src/command-line/migrate/text.js +26 -0
- package/dist/src/command-line/migrate/version-skew-guard.d.ts +60 -0
- package/dist/src/command-line/migrate/version-skew-guard.js +175 -0
- package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +17 -21
- package/dist/src/command-line/nx-cloud/connect/view-logs.js +2 -0
- package/dist/src/command-line/nx-cloud/start-nx-agents/command-object.d.ts +2 -0
- package/dist/src/command-line/nx-cloud/start-nx-agents/command-object.js +16 -0
- package/dist/src/command-line/nx-cloud/start-nx-agents/start-nx-agents.d.ts +4 -0
- package/dist/src/command-line/nx-cloud/start-nx-agents/start-nx-agents.js +13 -0
- package/dist/src/command-line/nx-commands.js +26 -24
- package/dist/src/command-line/release/changelog.js +11 -17
- package/dist/src/command-line/release/index.d.ts +1 -1
- package/dist/src/command-line/release/plan.js +15 -28
- package/dist/src/command-line/release/publish.js +5 -0
- package/dist/src/command-line/release/release.js +6 -17
- package/dist/src/command-line/release/utils/git.js +1 -1
- package/dist/src/command-line/release/utils/release-graph.d.ts +20 -2
- package/dist/src/command-line/release/utils/release-graph.js +81 -21
- package/dist/src/command-line/release/utils/remote-release-clients/github.js +17 -23
- package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +14 -23
- package/dist/src/command-line/release/utils/resolve-semver-specifier.js +19 -41
- package/dist/src/command-line/release/utils/shared.d.ts +2 -2
- package/dist/src/command-line/release/version/release-group-processor.d.ts +24 -0
- package/dist/src/command-line/release/version/release-group-processor.js +80 -6
- package/dist/src/command-line/release/version/resolve-current-version.js +7 -10
- package/dist/src/command-line/release/version/version-actions.d.ts +27 -2
- package/dist/src/command-line/release/version/version-actions.js +9 -1
- package/dist/src/command-line/release/version.js +10 -6
- package/dist/src/command-line/reset/reset.js +6 -1
- package/dist/src/command-line/run/run-one.js +1 -0
- package/dist/src/command-line/run-many/run-many.js +1 -0
- package/dist/src/command-line/show/show-target/inputs.js +50 -153
- package/dist/src/command-line/show/show-target/outputs.js +48 -173
- package/dist/src/command-line/show/show-target/utils.d.ts +28 -0
- package/dist/src/command-line/show/show-target/utils.js +83 -3
- package/dist/src/command-line/watch/watch.js +13 -0
- package/dist/src/command-line/yargs-utils/shared-options.d.ts +2 -2
- package/dist/src/command-line/yargs-utils/shared-options.js +3 -1
- package/dist/src/commands-runner/create-command-graph.js +5 -0
- package/dist/src/config/misc-interfaces.d.ts +19 -7
- package/dist/src/config/nx-json.d.ts +5 -3
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/core/graph/styles.js +1 -1
- package/dist/src/daemon/client/client.d.ts +52 -1
- package/dist/src/daemon/client/client.js +160 -36
- package/dist/src/daemon/client/daemon-environment.d.ts +17 -0
- package/dist/src/daemon/client/daemon-environment.js +110 -2
- package/dist/src/daemon/client/daemon-socket-messenger.js +4 -0
- package/dist/src/daemon/message-types/daemon-message.d.ts +32 -0
- package/dist/src/daemon/message-types/daemon-message.js +25 -0
- package/dist/src/daemon/server/file-watching/file-watcher-sockets.d.ts +5 -0
- package/dist/src/daemon/server/file-watching/file-watcher-sockets.js +16 -0
- package/dist/src/daemon/server/handle-tasks-execution-hooks.d.ts +1 -1
- package/dist/src/daemon/server/latest-nx.js +5 -2
- package/dist/src/daemon/server/server.js +31 -4
- package/dist/src/daemon/server/shutdown-utils.d.ts +5 -0
- package/dist/src/daemon/server/shutdown-utils.js +11 -4
- package/dist/src/daemon/socket-utils.d.ts +1 -0
- package/dist/src/daemon/socket-utils.js +24 -3
- package/dist/src/daemon/tmp-dir.d.ts +43 -3
- package/dist/src/daemon/tmp-dir.js +437 -15
- package/dist/src/devkit-internals.d.ts +105 -8
- package/dist/src/devkit-internals.js +223 -7
- package/dist/src/executors/run-commands/running-tasks.js +46 -29
- package/dist/src/generators/internal-utils/format-changed-files.d.ts +24 -0
- package/dist/src/generators/internal-utils/format-changed-files.js +163 -0
- package/dist/src/generators/testing-utils/create-tree-with-empty-workspace.d.ts +15 -0
- package/dist/src/generators/testing-utils/create-tree-with-empty-workspace.js +21 -3
- package/dist/src/generators/tree.d.ts +4 -2
- package/dist/src/generators/utils/nx-json.js +13 -3
- package/dist/src/hasher/check-task-files.d.ts +86 -0
- package/dist/src/hasher/check-task-files.js +378 -0
- package/dist/src/migrations/update-15-0-0/prefix-outputs.js +2 -2
- package/dist/src/migrations/update-16-0-0/remove-nrwl-cli.js +2 -2
- package/dist/src/migrations/update-16-0-0/update-depends-on-to-tokens.js +2 -2
- package/dist/src/migrations/update-16-0-0/update-nx-cloud-runner.js +2 -2
- package/dist/src/migrations/update-16-2-0/remove-run-commands-output-path.js +2 -2
- package/dist/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +2 -2
- package/dist/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +2 -2
- package/dist/src/migrations/update-17-2-0/move-default-base.js +2 -2
- package/dist/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +2 -2
- package/dist/src/migrations/update-19-2-4/set-project-name.js +2 -2
- package/dist/src/migrations/update-20-0-0/move-use-daemon-process.js +2 -2
- package/dist/src/migrations/update-20-0-1/use-legacy-cache.js +2 -2
- package/dist/src/migrations/update-21-0-0/release-changelog-config-changes.js +2 -2
- package/dist/src/migrations/update-21-0-0/release-version-config-changes.js +2 -2
- package/dist/src/migrations/update-21-0-0/remove-custom-tasks-runner.js +2 -2
- package/dist/src/migrations/update-21-0-0/remove-legacy-cache.js +2 -2
- package/dist/src/migrations/update-22-0-0/consolidate-release-tag-config.js +2 -2
- package/dist/src/migrations/update-22-0-0/release-version-config-changes.js +2 -2
- package/dist/src/migrations/update-22-2-0/add-self-healing-to-gitignore.js +2 -2
- package/dist/src/migrations/update-22-6-0/add-claude-settings-local-to-git-ignore.js +2 -2
- package/dist/src/migrations/update-22-6-0/add-claude-worktrees-to-git-ignore.js +2 -2
- package/dist/src/migrations/update-22-7-0/add-polygraph-to-git-ignore.js +2 -2
- package/dist/src/migrations/update-23-0-0/add-migrate-runs-to-git-ignore.js +2 -2
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.d.ts +12 -0
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.js +250 -0
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.md +50 -0
- package/dist/src/native/index.d.ts +37 -4
- package/dist/src/native/index.js +71 -28
- package/dist/src/native/native-bindings.js +3 -0
- package/dist/src/native/native-file-cache-location.d.ts +17 -1
- package/dist/src/native/native-file-cache-location.js +86 -12
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +3 -3
- package/dist/src/nx-cloud/utilities/get-cloud-options.js +5 -2
- package/dist/src/nx-cloud/utilities/onboarding.js +5 -2
- package/dist/src/nx-cloud/utilities/url-shorten.d.ts +1 -4
- package/dist/src/nx-cloud/utilities/url-shorten.js +9 -8
- package/dist/src/plugins/js/lock-file/bun-parser.js +43 -10
- package/dist/src/plugins/js/lock-file/lock-file.d.ts +46 -4
- package/dist/src/plugins/js/lock-file/lock-file.js +192 -15
- package/dist/src/plugins/js/lock-file/pnpm-parser.js +420 -64
- package/dist/src/plugins/js/lock-file/project-graph-pruning.d.ts +25 -1
- package/dist/src/plugins/js/lock-file/project-graph-pruning.js +92 -12
- package/dist/src/plugins/js/lock-file/pruned-output.d.ts +330 -0
- package/dist/src/plugins/js/lock-file/pruned-output.js +1441 -0
- package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.d.ts +1 -0
- package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.js +9 -5
- package/dist/src/plugins/js/project-graph/affected/npm-packages.js +51 -20
- package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +14 -4
- package/dist/src/project-graph/affected/affected-project-graph-models.d.ts +1 -1
- package/dist/src/project-graph/affected/affected-project-graph.d.ts +1 -1
- package/dist/src/project-graph/affected/affected-project-graph.js +2 -2
- package/dist/src/project-graph/affected/locators/project-glob-changes.js +5 -2
- package/dist/src/project-graph/build-project-graph.js +7 -1
- package/dist/src/project-graph/error-types.d.ts +12 -1
- package/dist/src/project-graph/error-types.js +27 -2
- package/dist/src/project-graph/file-utils.js +6 -1
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.d.ts +1 -0
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +18 -1
- package/dist/src/project-graph/plugins/isolation/messaging.d.ts +16 -3
- package/dist/src/project-graph/plugins/isolation/messaging.js +3 -0
- package/dist/src/project-graph/plugins/isolation/plugin-worker.js +58 -8
- package/dist/src/project-graph/plugins/loaded-nx-plugin.js +1 -0
- package/dist/src/project-graph/project-graph.js +23 -0
- package/dist/src/project-graph/utils/project-configuration/name-substitution-manager.d.ts +1 -0
- package/dist/src/project-graph/utils/project-configuration/name-substitution-manager.js +16 -2
- package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.d.ts +12 -8
- package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.js +30 -21
- package/dist/src/project-graph/utils/project-configuration/source-maps.d.ts +12 -5
- package/dist/src/project-graph/utils/project-configuration/source-maps.js +21 -7
- package/dist/src/project-graph/utils/project-configuration/target-defaults.d.ts +1 -1
- package/dist/src/project-graph/utils/project-configuration/target-defaults.js +26 -27
- package/dist/src/project-graph/utils/project-configuration/target-merging.js +50 -8
- package/dist/src/project-graph/utils/project-configuration/target-normalization.js +149 -6
- package/dist/src/project-graph/utils/project-configuration/utils.d.ts +15 -0
- package/dist/src/project-graph/utils/project-configuration/utils.js +42 -6
- package/dist/src/project-graph/utils/project-configuration-utils.d.ts +15 -12
- package/dist/src/project-graph/utils/project-configuration-utils.js +79 -99
- package/dist/src/tasks-runner/is-tui-enabled.js +3 -1
- package/dist/src/tasks-runner/life-cycle.d.ts +2 -2
- package/dist/src/tasks-runner/life-cycle.js +2 -2
- package/dist/src/tasks-runner/life-cycles/performance-analysis.d.ts +9 -4
- package/dist/src/tasks-runner/life-cycles/performance-life-cycle.js +5 -4
- package/dist/src/tasks-runner/life-cycles/performance-report.d.ts +28 -8
- package/dist/src/tasks-runner/life-cycles/performance-report.js +117 -30
- package/dist/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.d.ts +26 -1
- package/dist/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +99 -5
- package/dist/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.d.ts +26 -0
- package/dist/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.js +113 -17
- package/dist/src/tasks-runner/pseudo-terminal.d.ts +17 -3
- package/dist/src/tasks-runner/pseudo-terminal.js +22 -10
- package/dist/src/tasks-runner/run-command.js +28 -35
- package/dist/src/tasks-runner/running-tasks/batch-process.d.ts +55 -0
- package/dist/src/tasks-runner/running-tasks/batch-process.js +161 -8
- package/dist/src/tasks-runner/task-env.d.ts +9 -0
- package/dist/src/tasks-runner/task-env.js +31 -4
- package/dist/src/tasks-runner/task-orchestrator.d.ts +72 -1
- package/dist/src/tasks-runner/task-orchestrator.js +182 -18
- package/dist/src/tasks-runner/utils.js +2 -6
- package/dist/src/utils/acknowledge-build-scripts.js +7 -5
- package/dist/src/utils/analytics-enabled.d.ts +7 -0
- package/dist/src/utils/analytics-enabled.js +11 -0
- package/dist/src/utils/analytics-prompt.d.ts +0 -6
- package/dist/src/utils/analytics-prompt.js +4 -58
- package/dist/src/utils/assert-workspace-validity.js +7 -2
- package/dist/src/utils/catalog/bun-manager-utils.d.ts +8 -0
- package/dist/src/utils/catalog/bun-manager-utils.js +174 -0
- package/dist/src/utils/catalog/bun-manager.d.ts +28 -0
- package/dist/src/utils/catalog/bun-manager.js +130 -0
- package/dist/src/utils/catalog/index.d.ts +1 -1
- package/dist/src/utils/catalog/index.js +1 -1
- package/dist/src/utils/catalog/manager-factory.js +3 -0
- package/dist/src/utils/catalog/manager-utils.d.ts +8 -1
- package/dist/src/utils/catalog/manager-utils.js +9 -4
- package/dist/src/utils/catalog/manager.d.ts +13 -1
- package/dist/src/utils/catalog/manager.js +30 -0
- package/dist/src/utils/catalog/pnpm-manager.d.ts +2 -1
- package/dist/src/utils/catalog/pnpm-manager.js +3 -0
- package/dist/src/utils/catalog/types.d.ts +4 -0
- package/dist/src/utils/catalog/yarn-manager.d.ts +6 -2
- package/dist/src/utils/catalog/yarn-manager.js +23 -32
- package/dist/src/utils/child-process.d.ts +31 -1
- package/dist/src/utils/child-process.js +103 -0
- package/dist/src/utils/chunkify.d.ts +7 -1
- package/dist/src/utils/chunkify.js +10 -3
- package/dist/src/utils/command-line-utils.js +30 -20
- package/dist/src/utils/exit-codes.d.ts +9 -0
- package/dist/src/utils/exit-codes.js +19 -0
- package/dist/src/utils/fileutils.d.ts +5 -0
- package/dist/src/utils/fileutils.js +7 -2
- package/dist/src/utils/formatters/index.d.ts +13 -0
- package/dist/src/utils/formatters/index.js +74 -0
- package/dist/src/utils/formatters/oxfmt.d.ts +32 -0
- package/dist/src/utils/formatters/oxfmt.js +764 -0
- package/dist/src/utils/formatters/prettier.d.ts +26 -0
- package/dist/src/utils/formatters/prettier.js +201 -0
- package/dist/src/utils/formatters/shared.d.ts +5 -0
- package/dist/src/utils/formatters/shared.js +8 -0
- package/dist/src/utils/git-revision.d.ts +12 -0
- package/dist/src/utils/git-revision.js +25 -0
- package/dist/src/utils/git-utils.d.ts +48 -2
- package/dist/src/utils/git-utils.js +220 -14
- package/dist/src/utils/git-worktrees.d.ts +30 -0
- package/dist/src/utils/git-worktrees.js +212 -0
- package/dist/src/utils/ignore.d.ts +170 -1
- package/dist/src/utils/ignore.js +263 -11
- package/dist/src/utils/long-running-target.d.ts +10 -0
- package/dist/src/utils/long-running-target.js +19 -0
- package/dist/src/utils/min-release-age/behavior/bun.js +7 -11
- package/dist/src/utils/min-release-age/behavior/npm.js +5 -2
- package/dist/src/utils/min-release-age/packument.js +1 -1
- package/dist/src/utils/nx-console-prompt.js +3 -6
- package/dist/src/utils/nx-tmp-dir.d.ts +18 -0
- package/dist/src/utils/nx-tmp-dir.js +40 -0
- package/dist/src/utils/output.d.ts +153 -0
- package/dist/src/utils/output.js +289 -5
- package/dist/src/utils/owned-private-dir.d.ts +132 -0
- package/dist/src/utils/owned-private-dir.js +323 -0
- package/dist/src/utils/package-json.d.ts +2 -0
- package/dist/src/utils/package-json.js +11 -7
- package/dist/src/utils/package-manager-config/bunfig.d.ts +14 -0
- package/dist/src/utils/package-manager-config/bunfig.js +49 -0
- package/dist/src/utils/package-manager-config/npmrc.d.ts +23 -0
- package/dist/src/utils/package-manager-config/npmrc.js +124 -0
- package/dist/src/utils/package-manager-config/pnpm-config.d.ts +17 -0
- package/dist/src/utils/package-manager-config/pnpm-config.js +60 -0
- package/dist/src/utils/package-manager.d.ts +23 -2
- package/dist/src/utils/package-manager.js +268 -44
- package/dist/src/utils/params.d.ts +7 -1
- package/dist/src/utils/params.js +64 -6
- package/dist/src/utils/plugins/core-plugins.js +4 -0
- package/dist/src/utils/prompt-helpers.d.ts +53 -0
- package/dist/src/utils/prompt-helpers.js +111 -0
- package/dist/src/utils/provenance.js +6 -14
- package/dist/src/utils/registry-config/bun.d.ts +2 -0
- package/dist/src/utils/registry-config/bun.js +257 -0
- package/dist/src/utils/registry-config/index.d.ts +13 -0
- package/dist/src/utils/registry-config/index.js +102 -0
- package/dist/src/utils/registry-config/pnpm.d.ts +2 -0
- package/dist/src/utils/registry-config/pnpm.js +1551 -0
- package/dist/src/utils/registry-config/utils.d.ts +195 -0
- package/dist/src/utils/registry-config/utils.js +496 -0
- package/dist/src/utils/registry-config/yarn-berry.d.ts +2 -0
- package/dist/src/utils/registry-config/yarn-berry.js +612 -0
- package/dist/src/utils/registry-config/yarn-classic.d.ts +2 -0
- package/dist/src/utils/registry-config/yarn-classic.js +1001 -0
- package/dist/src/utils/safe-spawn.d.ts +24 -0
- package/dist/src/utils/safe-spawn.js +104 -0
- package/dist/src/utils/shell-quoting.d.ts +15 -0
- package/dist/src/utils/shell-quoting.js +35 -0
- package/dist/src/utils/wait-for-socket-connection.d.ts +11 -0
- package/dist/src/utils/wait-for-socket-connection.js +14 -8
- package/dist/src/utils/workspace-id.d.ts +20 -0
- package/dist/src/utils/workspace-id.js +54 -0
- package/dist/src/utils/write-formatted-json-file.d.ts +3 -2
- package/dist/src/utils/write-formatted-json-file.js +5 -4
- package/migrations.json +6 -0
- package/package.json +29 -19
- package/dist/src/generators/internal-utils/format-changed-files-with-prettier-if-available.d.ts +0 -19
- package/dist/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +0 -81
- package/dist/src/utils/is-using-prettier.d.ts +0 -3
- package/dist/src/utils/is-using-prettier.js +0 -62
- package/dist/src/utils/min-release-age/npmrc.d.ts +0 -15
- package/dist/src/utils/min-release-age/npmrc.js +0 -45
|
@@ -244,6 +244,7 @@ async function createProjectGraphAndSourceMapsAsync(opts = {
|
|
|
244
244
|
track: true,
|
|
245
245
|
...(analytics_1.customDimensions && {
|
|
246
246
|
[analytics_1.customDimensions.projectCount]: Object.keys(currentProjectGraph.nodes).length,
|
|
247
|
+
[analytics_1.customDimensions.sampleRate]: analytics_1.PERF_SPAN_SAMPLE_RATE,
|
|
247
248
|
}),
|
|
248
249
|
},
|
|
249
250
|
});
|
|
@@ -310,6 +311,7 @@ async function createProjectGraphAndSourceMapsAsync(opts = {
|
|
|
310
311
|
...(analytics_1.customDimensions && {
|
|
311
312
|
[analytics_1.customDimensions.projectCount]: Object.keys(res.projectGraph.nodes)
|
|
312
313
|
.length,
|
|
314
|
+
[analytics_1.customDimensions.sampleRate]: analytics_1.PERF_SPAN_SAMPLE_RATE,
|
|
313
315
|
}),
|
|
314
316
|
},
|
|
315
317
|
});
|
|
@@ -333,6 +335,7 @@ async function createProjectGraphAndSourceMapsAsync(opts = {
|
|
|
333
335
|
track: true,
|
|
334
336
|
...(analytics_1.customDimensions && {
|
|
335
337
|
[analytics_1.customDimensions.projectCount]: Object.keys(projectGraphAndSourceMaps.projectGraph.nodes).length,
|
|
338
|
+
[analytics_1.customDimensions.sampleRate]: analytics_1.PERF_SPAN_SAMPLE_RATE,
|
|
336
339
|
}),
|
|
337
340
|
},
|
|
338
341
|
});
|
|
@@ -351,6 +354,26 @@ async function createProjectGraphAndSourceMapsAsync(opts = {
|
|
|
351
354
|
(0, tmp_dir_1.markDaemonAsDisabled)(e.message);
|
|
352
355
|
return buildProjectGraphAndSourceMapsWithoutDaemon();
|
|
353
356
|
}
|
|
357
|
+
if (e.daemonPermissionError) {
|
|
358
|
+
// Deliberately not disabled: unlike the inotify limit above, a socket
|
|
359
|
+
// owned by someone else stops being there when it is removed or the
|
|
360
|
+
// machine reboots, and disabling until `nx reset` would outlive the
|
|
361
|
+
// cause and hide the fix from anyone who followed the advice.
|
|
362
|
+
// The first line carries the errno, and it is the one token that tells
|
|
363
|
+
// the two causes apart: EACCES is a socket owned by someone else (delete
|
|
364
|
+
// it), EPERM is a sandbox refusing the connect syscall (allow unix
|
|
365
|
+
// sockets under the Nx socket root). The message hedges between exactly
|
|
366
|
+
// those two because it cannot tell them apart, and this branch does not
|
|
367
|
+
// call writeDaemonLogs, so dropping the line loses the errno for good.
|
|
368
|
+
const [summary, ...details] = e.message.split('\n');
|
|
369
|
+
output_1.output.note({
|
|
370
|
+
title: `${summary} Continuing without the daemon.`,
|
|
371
|
+
// The blank line after the summary separates paragraphs when the
|
|
372
|
+
// message is printed as one blob; as bodyLines it is a leading gap.
|
|
373
|
+
bodyLines: details[0] === '' ? details.slice(1) : details,
|
|
374
|
+
});
|
|
375
|
+
return buildProjectGraphAndSourceMapsWithoutDaemon();
|
|
376
|
+
}
|
|
354
377
|
if (e.internalDaemonError) {
|
|
355
378
|
const errorLogFile = (0, tmp_dir_1.writeDaemonLogs)(e.message);
|
|
356
379
|
output_1.output.warn({
|
|
@@ -34,6 +34,7 @@ export declare function isUsageRef(value: unknown): value is UsageRef;
|
|
|
34
34
|
export declare class ProjectNameInNodePropsManager {
|
|
35
35
|
private getNameMap;
|
|
36
36
|
private pendingByName;
|
|
37
|
+
private nameHistory;
|
|
37
38
|
constructor(getNameMap?: () => Record<string, ProjectConfiguration>);
|
|
38
39
|
registerNameRefs(pluginResultProjects?: Record<string, Omit<ProjectConfiguration, 'root'> & Partial<ProjectConfiguration>>): void;
|
|
39
40
|
private processInputs;
|
|
@@ -51,6 +51,9 @@ function isUsageRef(value) {
|
|
|
51
51
|
class ProjectNameInNodePropsManager {
|
|
52
52
|
constructor(getNameMap) {
|
|
53
53
|
this.pendingByName = new Map();
|
|
54
|
+
// name → root for every name a project has ever been identified by, so refs
|
|
55
|
+
// to a since-renamed name still bind to the right root (see createRef).
|
|
56
|
+
this.nameHistory = new Map();
|
|
54
57
|
this.getNameMap = getNameMap ?? (() => ({}));
|
|
55
58
|
}
|
|
56
59
|
// Replaces each project-name ref in `inputs`/`dependsOn` with a sentinel.
|
|
@@ -148,9 +151,14 @@ class ProjectNameInNodePropsManager {
|
|
|
148
151
|
projects[j] = this.createRef(name);
|
|
149
152
|
}
|
|
150
153
|
}
|
|
151
|
-
// Builds a sentinel and registers it.
|
|
154
|
+
// Builds a sentinel and registers it. When `referencedName` isn't in the
|
|
155
|
+
// current name map, fall back to the rename history: a batch may reference a
|
|
156
|
+
// project by a name that a project earlier in the same batch already renamed
|
|
157
|
+
// (refs register after the whole batch merges), and the old name still
|
|
158
|
+
// identifies the same root.
|
|
152
159
|
createRef(referencedName, targetPart) {
|
|
153
|
-
const referencedRoot = this.getNameMap()[referencedName]?.root
|
|
160
|
+
const referencedRoot = this.getNameMap()[referencedName]?.root ??
|
|
161
|
+
this.nameHistory.get(referencedName);
|
|
154
162
|
const ref = referencedRoot !== undefined
|
|
155
163
|
? new RootRef(referencedRoot, targetPart)
|
|
156
164
|
: new UsageRef(referencedName, targetPart);
|
|
@@ -168,6 +176,11 @@ class ProjectNameInNodePropsManager {
|
|
|
168
176
|
// RootRef by prototype swap. Sentinel identity across spread copies means
|
|
169
177
|
// one promotion updates every array the sentinel reached.
|
|
170
178
|
identifyProjectWithRoot(root, name) {
|
|
179
|
+
// Every name a root has ever gone by, including pre-rename names. A later
|
|
180
|
+
// ref to a stale name resolves to the root it identified at the time.
|
|
181
|
+
// (If two roots use the same name over a graph construction, the later
|
|
182
|
+
// one wins — matching how the live name map would have resolved it.)
|
|
183
|
+
this.nameHistory.set(name, root);
|
|
171
184
|
const pending = this.pendingByName.get(name);
|
|
172
185
|
if (!pending)
|
|
173
186
|
return;
|
|
@@ -207,6 +220,7 @@ class ProjectNameInNodePropsManager {
|
|
|
207
220
|
}
|
|
208
221
|
}
|
|
209
222
|
this.pendingByName.clear();
|
|
223
|
+
this.nameHistory.clear();
|
|
210
224
|
}
|
|
211
225
|
substituteInArray(entries, nameByRoot) {
|
|
212
226
|
for (let i = 0; i < entries.length; i++) {
|
|
@@ -4,6 +4,13 @@ export { validateProject } from './target-normalization';
|
|
|
4
4
|
export declare function mergeProjectConfigurationIntoRootMap(projectRootMap: Record<string, ProjectConfiguration>, project: ProjectConfiguration, configurationSourceMaps?: ConfigurationSourceMaps, sourceInformation?: SourceInformation, skipTargetNormalization?: boolean, deferSpreadsWithoutBase?: boolean): {
|
|
5
5
|
nameChanged: boolean;
|
|
6
6
|
};
|
|
7
|
+
/**
|
|
8
|
+
* The existing target names a glob-pattern target key merges onto. This maps
|
|
9
|
+
* atomized targets to the glob pattern the same way targetDefaults does.
|
|
10
|
+
* Returns an empty array for a non-glob key or a pattern matching nothing;
|
|
11
|
+
* the merge treats those as literal target names.
|
|
12
|
+
*/
|
|
13
|
+
export declare function findMatchingTargetNames(pattern: string, targetNames: string[]): string[];
|
|
7
14
|
export declare function readProjectConfigurationsFromRootMap(projectRootMap: Record<string, ProjectConfiguration>): Record<string, ProjectConfiguration>;
|
|
8
15
|
export declare function createRootMap(projectRootMap: Record<string, ProjectConfiguration>): Record<string, string>;
|
|
9
16
|
/**
|
|
@@ -28,15 +35,12 @@ export declare class ProjectNodesManager {
|
|
|
28
35
|
mergeProjectNode(project: ProjectConfiguration, configurationSourceMaps?: ConfigurationSourceMaps, sourceInformation?: SourceInformation): void;
|
|
29
36
|
/**
|
|
30
37
|
* Inserts project-name sentinels into `inputs` and `dependsOn` on the
|
|
31
|
-
* merged objects
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* Pass a different `mergedRootMap` for the default-plugin intermediate
|
|
36
|
-
* pass, then call again with `this.rootMap` after it's applied so
|
|
37
|
-
* name refs introduced by that merge are sentinelized as well.
|
|
38
|
+
* merged objects in this manager's rootMap. Walking the merged entries —
|
|
39
|
+
* not the plugin results — matters because a spread-produced array is a
|
|
40
|
+
* fresh instance, and because sentinels written into plugin-result arrays
|
|
41
|
+
* would corrupt them for any later merge that re-reads the results.
|
|
38
42
|
*/
|
|
39
|
-
registerNameRefs(pluginResultProjects?: Record<string, Omit<ProjectConfiguration, 'root'> & Partial<ProjectConfiguration
|
|
43
|
+
registerNameRefs(pluginResultProjects?: Record<string, Omit<ProjectConfiguration, 'root'> & Partial<ProjectConfiguration>>): void;
|
|
40
44
|
/**
|
|
41
45
|
* Applies all pending name substitutions. Call once after all plugin
|
|
42
46
|
* results have been merged.
|
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ProjectNodesManager = exports.validateProject = void 0;
|
|
4
4
|
exports.mergeProjectConfigurationIntoRootMap = mergeProjectConfigurationIntoRootMap;
|
|
5
|
+
exports.findMatchingTargetNames = findMatchingTargetNames;
|
|
5
6
|
exports.readProjectConfigurationsFromRootMap = readProjectConfigurationsFromRootMap;
|
|
6
7
|
exports.createRootMap = createRootMap;
|
|
7
8
|
const error_types_1 = require("../../error-types");
|
|
8
9
|
const target_merging_1 = require("./target-merging");
|
|
9
10
|
const target_normalization_1 = require("./target-normalization");
|
|
11
|
+
const git_worktrees_1 = require("../../../utils/git-worktrees");
|
|
12
|
+
const workspace_root_1 = require("../../../utils/workspace-root");
|
|
10
13
|
const name_substitution_manager_1 = require("./name-substitution-manager");
|
|
11
14
|
const source_maps_1 = require("./source-maps");
|
|
12
15
|
const minimatch_1 = require("minimatch");
|
|
@@ -129,21 +132,16 @@ deferSpreadsWithoutBase = true) {
|
|
|
129
132
|
// if augmenting an existing target.
|
|
130
133
|
const target = project.targets?.[targetName];
|
|
131
134
|
if (sourceMap) {
|
|
132
|
-
//
|
|
133
|
-
//
|
|
134
|
-
//
|
|
135
|
-
//
|
|
135
|
+
// Claims the node key for a newly-created target (or reclaims it from
|
|
136
|
+
// a weak target-defaults stamp). Whether an *existing* target changes
|
|
137
|
+
// owners is decided inside `mergeTargetConfigurations`, which knows
|
|
138
|
+
// whether this merge changed the target's identity.
|
|
136
139
|
(0, source_maps_1.recordTargetIdentitySourceMapInfo)(sourceMap, (0, source_maps_1.targetSourceMapKey)(targetName), sourceInformation);
|
|
137
140
|
}
|
|
138
141
|
const normalizedTarget = skipTargetNormalization
|
|
139
142
|
? target
|
|
140
143
|
: (0, target_merging_1.resolveCommandSyntacticSugar)(target, project.root);
|
|
141
|
-
let matchingTargets =
|
|
142
|
-
if ((0, globs_1.isGlobPattern)(targetName)) {
|
|
143
|
-
// find all targets matching the glob pattern
|
|
144
|
-
// this will map atomized targets to the glob pattern same as it does for targetDefaults
|
|
145
|
-
matchingTargets = Object.keys(updatedProjectConfiguration.targets).filter((key) => (0, minimatch_1.minimatch)(key, targetName));
|
|
146
|
-
}
|
|
144
|
+
let matchingTargets = findMatchingTargetNames(targetName, Object.keys(updatedProjectConfiguration.targets));
|
|
147
145
|
// If no matching targets were found, we can assume that the target name is not (meant to be) a glob pattern
|
|
148
146
|
if (!matchingTargets.length) {
|
|
149
147
|
matchingTargets = [targetName];
|
|
@@ -160,6 +158,18 @@ deferSpreadsWithoutBase = true) {
|
|
|
160
158
|
updatedProjectConfiguration.name !== matchingProject?.name;
|
|
161
159
|
return { nameChanged };
|
|
162
160
|
}
|
|
161
|
+
/**
|
|
162
|
+
* The existing target names a glob-pattern target key merges onto. This maps
|
|
163
|
+
* atomized targets to the glob pattern the same way targetDefaults does.
|
|
164
|
+
* Returns an empty array for a non-glob key or a pattern matching nothing;
|
|
165
|
+
* the merge treats those as literal target names.
|
|
166
|
+
*/
|
|
167
|
+
function findMatchingTargetNames(pattern, targetNames) {
|
|
168
|
+
if (!(0, globs_1.isGlobPattern)(pattern)) {
|
|
169
|
+
return [];
|
|
170
|
+
}
|
|
171
|
+
return targetNames.filter((name) => (0, minimatch_1.minimatch)(name, pattern));
|
|
172
|
+
}
|
|
163
173
|
function readProjectConfigurationsFromRootMap(projectRootMap) {
|
|
164
174
|
const projects = {};
|
|
165
175
|
// If there are projects that have the same name, that is an error.
|
|
@@ -194,7 +204,9 @@ function readProjectConfigurationsFromRootMap(projectRootMap) {
|
|
|
194
204
|
}
|
|
195
205
|
}
|
|
196
206
|
if (conflicts.size > 0) {
|
|
197
|
-
|
|
207
|
+
// Only on the way to throwing, so a workspace without duplicates never
|
|
208
|
+
// pays for reading git's worktree registry.
|
|
209
|
+
throw new error_types_1.MultipleProjectsWithSameNameError(conflicts, projects, (0, git_worktrees_1.analyzeWorktreeConflicts)(workspace_root_1.workspaceRoot, conflicts) ?? undefined);
|
|
198
210
|
}
|
|
199
211
|
if (projectRootsWithNoName.length > 0) {
|
|
200
212
|
throw new error_types_1.ProjectsWithNoNameError(projectRootsWithNoName, projects);
|
|
@@ -257,21 +269,18 @@ class ProjectNodesManager {
|
|
|
257
269
|
}
|
|
258
270
|
/**
|
|
259
271
|
* Inserts project-name sentinels into `inputs` and `dependsOn` on the
|
|
260
|
-
* merged objects
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
* Pass a different `mergedRootMap` for the default-plugin intermediate
|
|
265
|
-
* pass, then call again with `this.rootMap` after it's applied so
|
|
266
|
-
* name refs introduced by that merge are sentinelized as well.
|
|
272
|
+
* merged objects in this manager's rootMap. Walking the merged entries —
|
|
273
|
+
* not the plugin results — matters because a spread-produced array is a
|
|
274
|
+
* fresh instance, and because sentinels written into plugin-result arrays
|
|
275
|
+
* would corrupt them for any later merge that re-reads the results.
|
|
267
276
|
*/
|
|
268
|
-
registerNameRefs(pluginResultProjects
|
|
277
|
+
registerNameRefs(pluginResultProjects) {
|
|
269
278
|
if (!pluginResultProjects)
|
|
270
279
|
return;
|
|
271
280
|
const scoped = {};
|
|
272
281
|
for (const root in pluginResultProjects) {
|
|
273
|
-
if (
|
|
274
|
-
scoped[root] =
|
|
282
|
+
if (this.rootMap[root]) {
|
|
283
|
+
scoped[root] = this.rootMap[root];
|
|
275
284
|
}
|
|
276
285
|
}
|
|
277
286
|
this.nameSubstitutionManager.registerNameRefs(scoped);
|
|
@@ -9,12 +9,19 @@ export type SourceInformation = [file: string | null, plugin: string];
|
|
|
9
9
|
*/
|
|
10
10
|
export declare const TARGET_DEFAULTS_PLUGIN_NAME = "nx/target-defaults";
|
|
11
11
|
/**
|
|
12
|
-
* Write the source for
|
|
13
|
-
* its
|
|
14
|
-
*
|
|
15
|
-
*
|
|
12
|
+
* Write the source for the target node key (`targets.<name>`). Ownership of a
|
|
13
|
+
* target follows its identity, not the last writer:
|
|
14
|
+
*
|
|
15
|
+
* - An unowned key goes to whoever writes it first (the creator).
|
|
16
|
+
* - A target-defaults stamp is weak — it never authors a target's existence,
|
|
17
|
+
* so any real plugin reclaims the key from it, and it can never take the
|
|
18
|
+
* key from a real plugin.
|
|
19
|
+
* - Between real plugins, the key only changes hands when the merge changed
|
|
20
|
+
* the target's identity (executor/command) — a plugin that merely layers
|
|
21
|
+
* fields (dependsOn, options, …) onto an existing target does not become
|
|
22
|
+
* its owner.
|
|
16
23
|
*/
|
|
17
|
-
export declare function recordTargetIdentitySourceMapInfo(sourceMap: Record<string, SourceInformation>, key: string, sourceInfo: SourceInformation): void;
|
|
24
|
+
export declare function recordTargetIdentitySourceMapInfo(sourceMap: Record<string, SourceInformation>, key: string, sourceInfo: SourceInformation, identityChanged?: boolean): void;
|
|
18
25
|
/** Source map per project root. */
|
|
19
26
|
export type ConfigurationSourceMaps = Record<string, Record<string, SourceInformation>>;
|
|
20
27
|
export declare function forEachSourceMapKeyForArray(prefixKey: string, array: unknown[], callback: (key: string, index: number) => void, startIndex?: number): void;
|
|
@@ -21,14 +21,28 @@ exports.targetConfigurationsSourceMapKey = targetConfigurationsSourceMapKey;
|
|
|
21
21
|
*/
|
|
22
22
|
exports.TARGET_DEFAULTS_PLUGIN_NAME = 'nx/target-defaults';
|
|
23
23
|
/**
|
|
24
|
-
* Write the source for
|
|
25
|
-
* its
|
|
26
|
-
*
|
|
27
|
-
*
|
|
24
|
+
* Write the source for the target node key (`targets.<name>`). Ownership of a
|
|
25
|
+
* target follows its identity, not the last writer:
|
|
26
|
+
*
|
|
27
|
+
* - An unowned key goes to whoever writes it first (the creator).
|
|
28
|
+
* - A target-defaults stamp is weak — it never authors a target's existence,
|
|
29
|
+
* so any real plugin reclaims the key from it, and it can never take the
|
|
30
|
+
* key from a real plugin.
|
|
31
|
+
* - Between real plugins, the key only changes hands when the merge changed
|
|
32
|
+
* the target's identity (executor/command) — a plugin that merely layers
|
|
33
|
+
* fields (dependsOn, options, …) onto an existing target does not become
|
|
34
|
+
* its owner.
|
|
28
35
|
*/
|
|
29
|
-
function recordTargetIdentitySourceMapInfo(sourceMap, key, sourceInfo) {
|
|
30
|
-
|
|
31
|
-
|
|
36
|
+
function recordTargetIdentitySourceMapInfo(sourceMap, key, sourceInfo, identityChanged = false) {
|
|
37
|
+
const existing = sourceMap[key];
|
|
38
|
+
if (existing === undefined) {
|
|
39
|
+
sourceMap[key] = sourceInfo;
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (sourceInfo[1] === exports.TARGET_DEFAULTS_PLUGIN_NAME) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (existing[1] === exports.TARGET_DEFAULTS_PLUGIN_NAME || identityChanged) {
|
|
32
46
|
sourceMap[key] = sourceInfo;
|
|
33
47
|
}
|
|
34
48
|
}
|
|
@@ -19,7 +19,7 @@ type CreateNodesResultEntry = readonly [
|
|
|
19
19
|
* fly. That's all the matcher needs; the full target merge happens
|
|
20
20
|
* downstream in the real merge.
|
|
21
21
|
*/
|
|
22
|
-
export declare function createTargetDefaultsResults(specifiedPluginRootMap: Record<string, ProjectConfiguration>, defaultPluginRootMap: Record<string, ProjectConfiguration>, nxJsonConfiguration: NxJsonConfiguration, specifiedSourceMaps?: ConfigurationSourceMaps
|
|
22
|
+
export declare function createTargetDefaultsResults(specifiedPluginRootMap: Record<string, ProjectConfiguration>, defaultPluginRootMap: Record<string, ProjectConfiguration>, nxJsonConfiguration: NxJsonConfiguration, specifiedSourceMaps?: ConfigurationSourceMaps): CreateNodesResultEntry[];
|
|
23
23
|
/**
|
|
24
24
|
* Public reader that resolves the target defaults applying to a given
|
|
25
25
|
* target. Accepts the nested map shape (a value is either a plain config
|
|
@@ -21,7 +21,7 @@ const utils_1 = require("./utils");
|
|
|
21
21
|
* fly. That's all the matcher needs; the full target merge happens
|
|
22
22
|
* downstream in the real merge.
|
|
23
23
|
*/
|
|
24
|
-
function createTargetDefaultsResults(specifiedPluginRootMap, defaultPluginRootMap, nxJsonConfiguration, specifiedSourceMaps
|
|
24
|
+
function createTargetDefaultsResults(specifiedPluginRootMap, defaultPluginRootMap, nxJsonConfiguration, specifiedSourceMaps) {
|
|
25
25
|
const targetDefaultsConfig = nxJsonConfiguration.targetDefaults;
|
|
26
26
|
if (!targetDefaultsConfig) {
|
|
27
27
|
return [];
|
|
@@ -65,7 +65,7 @@ function createTargetDefaultsResults(specifiedPluginRootMap, defaultPluginRootMa
|
|
|
65
65
|
if (!effective)
|
|
66
66
|
continue;
|
|
67
67
|
const sourcePlugin = needsSourcePlugin
|
|
68
|
-
? resolveSourcePlugin(root, targetName,
|
|
68
|
+
? resolveSourcePlugin(root, targetName, defaultTargets[targetName], specifiedSourceMaps)
|
|
69
69
|
: undefined;
|
|
70
70
|
const syntheticTargets = buildSyntheticTargetsForRoot(targetName, root, effective, targetDefaults, projectName, projectNode, sourcePlugin);
|
|
71
71
|
for (const { key, index, target } of syntheticTargets) {
|
|
@@ -372,34 +372,33 @@ function normalizeTargetDefaultValue(value) {
|
|
|
372
372
|
// A bare config object is functionally a one-element array.
|
|
373
373
|
return [value ?? {}];
|
|
374
374
|
}
|
|
375
|
-
function resolveSourcePlugin(root, targetName,
|
|
376
|
-
//
|
|
377
|
-
//
|
|
378
|
-
//
|
|
379
|
-
//
|
|
380
|
-
//
|
|
381
|
-
//
|
|
382
|
-
//
|
|
383
|
-
//
|
|
384
|
-
//
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
375
|
+
function resolveSourcePlugin(root, targetName, defaultTarget, specifiedSourceMaps) {
|
|
376
|
+
// `filter.plugin` ("targets originated by X") can only name a plugin from
|
|
377
|
+
// nx.json's `plugins` — the specified set. When the default layer authors
|
|
378
|
+
// the target's identity (its merged config carries an executor or command,
|
|
379
|
+
// which the merge lets win), the originator is a default plugin and the
|
|
380
|
+
// target has no matchable source plugin; no source maps are needed to see
|
|
381
|
+
// that. Otherwise the specified layer's executor/command attribution names
|
|
382
|
+
// the originator. The top-level `targets.<name>` node key is deliberately
|
|
383
|
+
// NOT used as a fallback: it tracks ownership, so a later plugin augmenting
|
|
384
|
+
// the target would mis-attribute it. The trade-off is that a target with
|
|
385
|
+
// neither an executor nor a command (a rare, non-runnable shape) resolves to
|
|
386
|
+
// no source plugin and won't match a `filter.plugin` default — accepted,
|
|
387
|
+
// since every runnable target carries one of these keys.
|
|
388
|
+
if (defaultTarget &&
|
|
389
|
+
(defaultTarget.executor !== undefined ||
|
|
390
|
+
defaultTarget.command !== undefined)) {
|
|
391
|
+
return undefined;
|
|
392
|
+
}
|
|
393
|
+
const sourceMap = specifiedSourceMaps?.[root];
|
|
394
|
+
for (const identityKey of ['executor', 'command']) {
|
|
395
|
+
const plugin = sourceMap?.[`${(0, source_maps_1.targetSourceMapKey)(targetName)}.${identityKey}`]?.[1];
|
|
396
|
+
if (plugin && plugin !== source_maps_1.TARGET_DEFAULTS_PLUGIN_NAME) {
|
|
397
|
+
return plugin;
|
|
398
|
+
}
|
|
396
399
|
}
|
|
397
400
|
return undefined;
|
|
398
401
|
}
|
|
399
|
-
function pluginFromSourceMap(maps, root, key) {
|
|
400
|
-
const entry = maps?.[root]?.[key];
|
|
401
|
-
return entry?.[1];
|
|
402
|
-
}
|
|
403
402
|
// Builds a name → MatcherProjectNode view for `findMatchingProjects` to
|
|
404
403
|
// consult, across both layered rootMaps. Tags are unioned across layers. A
|
|
405
404
|
// full `mergeProjectConfigurationIntoRootMap` would be overkill — the matcher
|
|
@@ -170,6 +170,11 @@ function mergeConfigurations(newConfigurations, baseConfigurations, projectConfi
|
|
|
170
170
|
// Before '...': base wins for shared names. Keep base's source-map
|
|
171
171
|
// entries when it owns the config.
|
|
172
172
|
if (baseHasConfig) {
|
|
173
|
+
// Base wins, so the incoming config is dropped without reaching
|
|
174
|
+
// `mergeConfigurationValue`. Validate its nested spread here so an
|
|
175
|
+
// integer-like-key ambiguity throws regardless of which side owns
|
|
176
|
+
// the config name (mirrors the base-independent target-level check).
|
|
177
|
+
(0, utils_1.assertNoIntegerLikeSpreadKey)(newConfigurations?.[configName], configIdentifier ? `Object at "${configIdentifier}"` : 'Object');
|
|
173
178
|
mergedConfigurations[configName] = baseConfigurations[configName];
|
|
174
179
|
}
|
|
175
180
|
else {
|
|
@@ -282,8 +287,11 @@ function mergeTargetConfigurations(target, baseTarget, projectConfigSourceMap, s
|
|
|
282
287
|
? new Set(targetKeys.slice(0, spreadPosInTarget))
|
|
283
288
|
: new Set();
|
|
284
289
|
// Integer-like keys get hoisted to targetKeys[0], making their position
|
|
285
|
-
// relative to '...' unrecoverable.
|
|
286
|
-
|
|
290
|
+
// relative to '...' unrecoverable. This is a property of the authored
|
|
291
|
+
// config, not of the base, so it throws regardless of compatibility —
|
|
292
|
+
// which also keeps the error identical between the target-defaults staging
|
|
293
|
+
// merge and the real merge, whose bases differ.
|
|
294
|
+
if (spreadPosInTarget >= 0 &&
|
|
287
295
|
targetKeys[0] &&
|
|
288
296
|
utils_1.INTEGER_LIKE_KEY_PATTERN.test(targetKeys[0])) {
|
|
289
297
|
throw new utils_1.IntegerLikeSpreadKeyError(targetKeys[0], targetIdentifier ? `Target at "${targetIdentifier}"` : 'Target');
|
|
@@ -304,6 +312,13 @@ function mergeTargetConfigurations(target, baseTarget, projectConfigSourceMap, s
|
|
|
304
312
|
return;
|
|
305
313
|
if (hasSpread && keysBeforeSpread.has(key)) {
|
|
306
314
|
// Before '...': base wins; fall through to target only if base lacks it.
|
|
315
|
+
// When base wins, the incoming `target[key]` is dropped without ever
|
|
316
|
+
// reaching `getMergeValueResult`, so validate its nested spread here —
|
|
317
|
+
// the integer-like-key ambiguity is a property of the authored value,
|
|
318
|
+
// not of which side owns the key, and must throw either way.
|
|
319
|
+
(0, utils_1.assertNoIntegerLikeSpreadKey)(target[key], projectConfigSourceMap
|
|
320
|
+
? `Object at "${targetIdentifier}.${key}"`
|
|
321
|
+
: 'Object');
|
|
307
322
|
result[key] =
|
|
308
323
|
key in mergeBase
|
|
309
324
|
? mergeBase[key]
|
|
@@ -381,13 +396,20 @@ function mergeTargetConfigurations(target, baseTarget, projectConfigSourceMap, s
|
|
|
381
396
|
processKey(key);
|
|
382
397
|
}
|
|
383
398
|
}
|
|
384
|
-
// Update
|
|
385
|
-
//
|
|
386
|
-
//
|
|
387
|
-
//
|
|
388
|
-
//
|
|
399
|
+
// Update the node key once after the loop. Ownership follows identity: this
|
|
400
|
+
// merge claims `targets.<name>` only when it changed the target's identity
|
|
401
|
+
// (a new/different executor or command, or an incompatible replace — whose
|
|
402
|
+
// key purge above empties the slot anyway). A plugin that only layers fields
|
|
403
|
+
// onto an existing target leaves the node with its creator; weak
|
|
404
|
+
// target-defaults stamps are always reclaimable.
|
|
389
405
|
if (projectConfigSourceMap) {
|
|
390
|
-
|
|
406
|
+
const identityChanged = !isCompatible ||
|
|
407
|
+
(target.executor !== undefined &&
|
|
408
|
+
target.executor !== baseTarget?.executor) ||
|
|
409
|
+
(target.command !== undefined &&
|
|
410
|
+
target.command !== baseTarget?.command) ||
|
|
411
|
+
suppliesNewOptionsIdentity(baseTarget, target);
|
|
412
|
+
(0, source_maps_1.recordTargetIdentitySourceMapInfo)(projectConfigSourceMap, targetIdentifier, sourceInformation, identityChanged);
|
|
391
413
|
}
|
|
392
414
|
// merge options if there are any
|
|
393
415
|
// if the targets aren't compatible, we simply discard the old options during the merge
|
|
@@ -443,6 +465,26 @@ function isCompatibleTarget(a, b) {
|
|
|
443
465
|
}
|
|
444
466
|
return true;
|
|
445
467
|
}
|
|
468
|
+
/**
|
|
469
|
+
* Run-commands and run-script targets carry their runnable identity in
|
|
470
|
+
* `options` (see {@link isCompatibleTarget}). A layer that supplies that
|
|
471
|
+
* identity where the base had none changed what the target runs — the same
|
|
472
|
+
* identity change as setting an executor on a target that had none.
|
|
473
|
+
*/
|
|
474
|
+
function suppliesNewOptionsIdentity(baseTarget, target) {
|
|
475
|
+
const executor = target.executor ?? baseTarget?.executor;
|
|
476
|
+
if (executor === 'nx:run-commands') {
|
|
477
|
+
const baseCommand = baseTarget?.options?.command ??
|
|
478
|
+
baseTarget?.options?.commands?.join(' && ');
|
|
479
|
+
const targetCommand = target.options?.command ?? target.options?.commands?.join(' && ');
|
|
480
|
+
return !!targetCommand && targetCommand !== baseCommand;
|
|
481
|
+
}
|
|
482
|
+
if (executor === 'nx:run-script') {
|
|
483
|
+
const targetScript = target.options?.script;
|
|
484
|
+
return !!targetScript && targetScript !== baseTarget?.options?.script;
|
|
485
|
+
}
|
|
486
|
+
return false;
|
|
487
|
+
}
|
|
446
488
|
function resolveNxTokensInOptions(object, project, key) {
|
|
447
489
|
const result = Array.isArray(object) ? [...object] : { ...object };
|
|
448
490
|
for (let [opt, value] of Object.entries(object ?? {})) {
|