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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = update;
|
|
4
4
|
const node_path_1 = require("node:path");
|
|
5
|
-
const
|
|
5
|
+
const format_changed_files_1 = require("../../generators/internal-utils/format-changed-files");
|
|
6
6
|
const json_1 = require("../../generators/utils/json");
|
|
7
7
|
const nx_json_1 = require("../../generators/utils/nx-json");
|
|
8
8
|
const project_configuration_1 = require("../../generators/utils/project-configuration");
|
|
@@ -96,5 +96,5 @@ async function update(tree) {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
(0, nx_json_1.updateNxJson)(tree, nxJson);
|
|
99
|
-
await (0,
|
|
99
|
+
await (0, format_changed_files_1.formatChangedFiles)(tree);
|
|
100
100
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = update;
|
|
4
4
|
const node_path_1 = require("node:path");
|
|
5
|
-
const
|
|
5
|
+
const format_changed_files_1 = require("../../generators/internal-utils/format-changed-files");
|
|
6
6
|
const json_1 = require("../../generators/utils/json");
|
|
7
7
|
const nx_json_1 = require("../../generators/utils/nx-json");
|
|
8
8
|
const project_configuration_1 = require("../../generators/utils/project-configuration");
|
|
@@ -97,5 +97,5 @@ async function update(tree) {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
(0, nx_json_1.updateNxJson)(tree, nxJson);
|
|
100
|
-
await (0,
|
|
100
|
+
await (0, format_changed_files_1.formatChangedFiles)(tree);
|
|
101
101
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = addSelfHealingToGitignore;
|
|
4
|
-
const
|
|
4
|
+
const format_changed_files_1 = require("../../generators/internal-utils/format-changed-files");
|
|
5
5
|
const ignore_1 = require("../../utils/ignore");
|
|
6
6
|
async function addSelfHealingToGitignore(tree) {
|
|
7
7
|
if (!tree.exists('.gitignore')) {
|
|
@@ -15,5 +15,5 @@ async function addSelfHealingToGitignore(tree) {
|
|
|
15
15
|
if (tree.exists('.prettierignore')) {
|
|
16
16
|
(0, ignore_1.addEntryToGitIgnore)(tree, '.prettierignore', '.nx/self-healing');
|
|
17
17
|
}
|
|
18
|
-
await (0,
|
|
18
|
+
await (0, format_changed_files_1.formatChangedFiles)(tree);
|
|
19
19
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = addClaudeSettingsLocalToGitIgnore;
|
|
4
|
-
const
|
|
4
|
+
const format_changed_files_1 = require("../../generators/internal-utils/format-changed-files");
|
|
5
5
|
const ignore_1 = require("../../utils/ignore");
|
|
6
6
|
async function addClaudeSettingsLocalToGitIgnore(tree) {
|
|
7
7
|
if (!tree.exists('.gitignore')) {
|
|
@@ -12,5 +12,5 @@ async function addClaudeSettingsLocalToGitIgnore(tree) {
|
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
14
|
(0, ignore_1.addEntryToGitIgnore)(tree, '.gitignore', '.claude/settings.local.json');
|
|
15
|
-
await (0,
|
|
15
|
+
await (0, format_changed_files_1.formatChangedFiles)(tree);
|
|
16
16
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = addClaudeWorktreesToGitIgnore;
|
|
4
|
-
const
|
|
4
|
+
const format_changed_files_1 = require("../../generators/internal-utils/format-changed-files");
|
|
5
5
|
const ignore_1 = require("../../utils/ignore");
|
|
6
6
|
async function addClaudeWorktreesToGitIgnore(tree) {
|
|
7
7
|
if (!tree.exists('.gitignore')) {
|
|
@@ -12,5 +12,5 @@ async function addClaudeWorktreesToGitIgnore(tree) {
|
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
14
|
(0, ignore_1.addEntryToGitIgnore)(tree, '.gitignore', '.claude/worktrees');
|
|
15
|
-
await (0,
|
|
15
|
+
await (0, format_changed_files_1.formatChangedFiles)(tree);
|
|
16
16
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = addPolygraphToGitIgnore;
|
|
4
|
-
const
|
|
4
|
+
const format_changed_files_1 = require("../../generators/internal-utils/format-changed-files");
|
|
5
5
|
const ignore_1 = require("../../utils/ignore");
|
|
6
6
|
async function addPolygraphToGitIgnore(tree) {
|
|
7
7
|
if (!tree.exists('.gitignore')) {
|
|
@@ -12,5 +12,5 @@ async function addPolygraphToGitIgnore(tree) {
|
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
14
|
(0, ignore_1.addEntryToGitIgnore)(tree, '.gitignore', '.nx/polygraph');
|
|
15
|
-
await (0,
|
|
15
|
+
await (0, format_changed_files_1.formatChangedFiles)(tree);
|
|
16
16
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = addMigrateRunsToGitIgnore;
|
|
4
|
-
const
|
|
4
|
+
const format_changed_files_1 = require("../../generators/internal-utils/format-changed-files");
|
|
5
5
|
const ignore_1 = require("../../utils/ignore");
|
|
6
6
|
async function addMigrateRunsToGitIgnore(tree) {
|
|
7
7
|
if (!tree.exists('.gitignore')) {
|
|
@@ -12,5 +12,5 @@ async function addMigrateRunsToGitIgnore(tree) {
|
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
14
|
(0, ignore_1.addEntryToGitIgnore)(tree, '.gitignore', '.nx/migrate-runs');
|
|
15
|
-
await (0,
|
|
15
|
+
await (0, format_changed_files_1.formatChangedFiles)(tree);
|
|
16
16
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Tree } from '../../generators/tree';
|
|
2
|
+
/**
|
|
3
|
+
* Target defaults resolve to a single key rather than merging, so an executor
|
|
4
|
+
* key hides the target name key entirely. Before Nx 23 a hidden `cache: true`
|
|
5
|
+
* still took effect, because cacheability was also derived from target *names*
|
|
6
|
+
* via `cacheableOperations`; Nx 23 removed that derivation and those targets
|
|
7
|
+
* silently stopped being cacheable.
|
|
8
|
+
*
|
|
9
|
+
* Write the intent into the executor key so it no longer depends on the
|
|
10
|
+
* deprecated fallback that restores the old behavior at run time.
|
|
11
|
+
*/
|
|
12
|
+
export default function update(tree: Tree): Promise<void>;
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = update;
|
|
4
|
+
const executor_utils_1 = require("../../command-line/run/executor-utils");
|
|
5
|
+
const format_changed_files_1 = require("../../generators/internal-utils/format-changed-files");
|
|
6
|
+
const json_1 = require("../../generators/utils/json");
|
|
7
|
+
const project_configuration_1 = require("../../generators/utils/project-configuration");
|
|
8
|
+
const path_1 = require("../../utils/path");
|
|
9
|
+
// TODO(v24): remove this migration alongside the runtime fallback it exists to
|
|
10
|
+
// retire (`isLegacyCachedTarget` in `target-normalization.ts`), along with its
|
|
11
|
+
// registration in `packages/nx/migrations.json`.
|
|
12
|
+
/**
|
|
13
|
+
* Target defaults resolve to a single key rather than merging, so an executor
|
|
14
|
+
* key hides the target name key entirely. Before Nx 23 a hidden `cache: true`
|
|
15
|
+
* still took effect, because cacheability was also derived from target *names*
|
|
16
|
+
* via `cacheableOperations`; Nx 23 removed that derivation and those targets
|
|
17
|
+
* silently stopped being cacheable.
|
|
18
|
+
*
|
|
19
|
+
* Write the intent into the executor key so it no longer depends on the
|
|
20
|
+
* deprecated fallback that restores the old behavior at run time.
|
|
21
|
+
*/
|
|
22
|
+
async function update(tree) {
|
|
23
|
+
const nxJson = (0, project_configuration_1.readNxJson)(tree);
|
|
24
|
+
const targetDefaults = nxJson?.targetDefaults;
|
|
25
|
+
if (!targetDefaults) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const projects = (0, project_configuration_1.getProjects)(tree);
|
|
29
|
+
const projectsMap = {};
|
|
30
|
+
// `cache` on an executor key reaches every target that resolves through it,
|
|
31
|
+
// not just the one whose target name key enables caching. Collect them all
|
|
32
|
+
// per key so the decision below can be made for the key as a whole. The
|
|
33
|
+
// collection is a list rather than a map keyed by target name: two projects
|
|
34
|
+
// routinely declare the same target name through the same executor, and only
|
|
35
|
+
// one of them may be continuous.
|
|
36
|
+
const targetsByExecutorKey = new Map();
|
|
37
|
+
const collect = (targetName, target) => {
|
|
38
|
+
// `hasOwnProperty` rather than a lookup: an executor named `__proto__` or
|
|
39
|
+
// `constructor` resolves through the prototype chain to a truthy object, so
|
|
40
|
+
// a plain lookup would collect the target and stamp `Object.prototype`.
|
|
41
|
+
if (!target?.executor ||
|
|
42
|
+
!Object.prototype.hasOwnProperty.call(targetDefaults, target.executor)) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const targets = targetsByExecutorKey.get(target.executor) ?? [];
|
|
46
|
+
targets.push([targetName, target]);
|
|
47
|
+
targetsByExecutorKey.set(target.executor, targets);
|
|
48
|
+
};
|
|
49
|
+
for (const [projectName, project] of projects) {
|
|
50
|
+
projectsMap[projectName] = project;
|
|
51
|
+
for (const [targetName, target] of Object.entries(project.targets ?? {})) {
|
|
52
|
+
collect(targetName, target);
|
|
53
|
+
}
|
|
54
|
+
for (const [targetName, target] of Object.entries(packageJsonTargets(tree, project.root))) {
|
|
55
|
+
collect(targetName, target);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
let changed = false;
|
|
59
|
+
for (const [key, targets] of targetsByExecutorKey) {
|
|
60
|
+
if (!canEnableCache(targetDefaults, key, targets, tree.root, projectsMap)) {
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
catchAllConfig(targetDefaults[key]).cache = true;
|
|
64
|
+
changed = true;
|
|
65
|
+
}
|
|
66
|
+
if (!changed) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
(0, project_configuration_1.updateNxJson)(tree, nxJson);
|
|
70
|
+
await (0, format_changed_files_1.formatChangedFiles)(tree);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Whether `cache: true` can be written onto `key` without changing behavior for
|
|
74
|
+
* any target that resolves through it.
|
|
75
|
+
*
|
|
76
|
+
* The executor key outranks every target name key, so stamping it caches all of
|
|
77
|
+
* `targets` — including any that is continuous, which makes `nx.json` fail graph
|
|
78
|
+
* construction outright. The key is only safe when every target through it
|
|
79
|
+
* independently wants caching and none of them can be continuous. Anything else
|
|
80
|
+
* is left to the runtime fallback, which decides per target after normalization
|
|
81
|
+
* and can therefore see continuity this migration cannot.
|
|
82
|
+
*/
|
|
83
|
+
function canEnableCache(targetDefaults, key, targets, workspaceRoot, projectsMap) {
|
|
84
|
+
// Targets written with `command` are rewritten to `nx:run-commands` and
|
|
85
|
+
// `package.json` scripts to `nx:run-script` before key selection, so neither
|
|
86
|
+
// names the key it resolves through. Plugins also infer continuous targets
|
|
87
|
+
// (`watch-deps`, dev servers) into projects whose config never mentions them.
|
|
88
|
+
// The target list here can never be trusted to be complete for these keys.
|
|
89
|
+
if (key === 'nx:run-commands' || key === 'nx:run-script') {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
// Already decided; never override the user's value. A filtered entry counts
|
|
93
|
+
// as decided because its value can't be evaluated without project context.
|
|
94
|
+
if (declaresAnyCache(targetDefaults[key])) {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
// `continuous` is a valid field on a target default, and this key applies it
|
|
98
|
+
// to every target that resolves through it. Adding `cache` would make each of
|
|
99
|
+
// them both cacheable and continuous, which fails graph construction — so no
|
|
100
|
+
// target list can make this key safe.
|
|
101
|
+
if (declaresAnyContinuous(targetDefaults[key])) {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
// Only an unfiltered entry can be amended. Appending a catch-all to an
|
|
105
|
+
// all-filtered key would make it match targets that previously fell through
|
|
106
|
+
// to the target name key, silently dropping that key's `dependsOn`/`inputs`.
|
|
107
|
+
if (!catchAllConfig(targetDefaults[key])) {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
// Continuity declared by the executor's schema is resolved at graph
|
|
111
|
+
// construction for every target through this key, so one lookup covers them
|
|
112
|
+
// all. For what an executor that cannot be resolved here costs, see
|
|
113
|
+
// {@link executorDeclaresContinuous}.
|
|
114
|
+
if (executorDeclaresContinuous(key, workspaceRoot, projectsMap)) {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
for (const [targetName, target] of targets) {
|
|
118
|
+
if (!declaresCacheTrue(targetDefaults[targetName])) {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
if (target.continuous || isLongRunningTargetName(targetName)) {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Whether the target name key declares `cache: true` on an entry that always
|
|
129
|
+
* applies. Mirrors `declaresCacheTrue` in `target-normalization.ts`: a filtered
|
|
130
|
+
* entry declaring `cache` makes the value unknowable without project context,
|
|
131
|
+
* so nothing is claimed. Among unfiltered entries the last wins.
|
|
132
|
+
*/
|
|
133
|
+
function declaresCacheTrue(value) {
|
|
134
|
+
if (!value) {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
let declared;
|
|
138
|
+
for (const entry of configEntries(value)) {
|
|
139
|
+
if (entry.cache === undefined)
|
|
140
|
+
continue;
|
|
141
|
+
if (entry.filter)
|
|
142
|
+
return false;
|
|
143
|
+
declared = entry.cache;
|
|
144
|
+
}
|
|
145
|
+
return declared === true;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Whether any entry declares `cache`, filtered or not — i.e. whether the value
|
|
149
|
+
* is already decided and must be left alone. Deliberately broader than
|
|
150
|
+
* {@link declaresCacheTrue}: a filtered `cache` blocks here rather than being
|
|
151
|
+
* read past, so the two never disagree about a filtered entry.
|
|
152
|
+
*/
|
|
153
|
+
function declaresAnyCache(value) {
|
|
154
|
+
if (!value) {
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
return configEntries(value).some((entry) => entry.cache !== undefined);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Whether any entry declares `continuous: true`. Filtered entries count: which
|
|
161
|
+
* projects the filter matches is unknowable here, and the only case that
|
|
162
|
+
* matters is the one where it matches.
|
|
163
|
+
*/
|
|
164
|
+
function declaresAnyContinuous(value) {
|
|
165
|
+
if (!value) {
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
return configEntries(value).some((entry) => entry.continuous === true);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* The config blocks of a `targetDefaults` value. Entries that are not config
|
|
172
|
+
* objects are dropped rather than inspected: `nx.json` is hand-edited, and a
|
|
173
|
+
* `null` or scalar entry would otherwise throw while reading `.cache` off it.
|
|
174
|
+
*/
|
|
175
|
+
function configEntries(value) {
|
|
176
|
+
const entries = Array.isArray(value) ? value : [value];
|
|
177
|
+
return entries.filter((entry) => !!entry && typeof entry === 'object');
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* The targets a project's `package.json` contributes to the graph.
|
|
181
|
+
*
|
|
182
|
+
* {@link getProjects} builds a root's configuration from its `project.json`
|
|
183
|
+
* alone whenever one exists, but the package.json plugin still creates the
|
|
184
|
+
* sibling `package.json`'s targets — it accepts any `package.json` that is
|
|
185
|
+
* either in the package manager workspaces or next to a `project.json`
|
|
186
|
+
* (`plugins/package-json/create-nodes.ts`). Those targets resolve through the
|
|
187
|
+
* same executor keys, so they belong in this decision.
|
|
188
|
+
*
|
|
189
|
+
* Targets derived from `scripts` are still not covered; they resolve through
|
|
190
|
+
* `nx:run-script`, which is never stamped for exactly that reason.
|
|
191
|
+
*/
|
|
192
|
+
function packageJsonTargets(tree, projectRoot) {
|
|
193
|
+
const packageJsonPath = (0, path_1.joinPathFragments)(projectRoot, 'package.json');
|
|
194
|
+
if (!tree.exists(packageJsonPath)) {
|
|
195
|
+
return {};
|
|
196
|
+
}
|
|
197
|
+
// A parse failure is left to throw: `readJson` names the offending file,
|
|
198
|
+
// which is the one thing a user can act on. Shapes that parse but aren't the
|
|
199
|
+
// one this reads contribute no targets rather than crashing the run.
|
|
200
|
+
const targets = (0, json_1.readJson)(tree, packageJsonPath)?.nx?.targets;
|
|
201
|
+
if (!targets || typeof targets !== 'object' || Array.isArray(targets)) {
|
|
202
|
+
return {};
|
|
203
|
+
}
|
|
204
|
+
return targets;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* The unfiltered config block of a `targetDefaults` value, or undefined when the
|
|
208
|
+
* array form carries only filtered entries and when the value is not a config
|
|
209
|
+
* object at all. Never creates one — see {@link canEnableCache}.
|
|
210
|
+
*/
|
|
211
|
+
function catchAllConfig(value) {
|
|
212
|
+
// The filter check applies to both spellings: the object and single-element
|
|
213
|
+
// array forms of the same config have to reach the same verdict.
|
|
214
|
+
return configEntries(value).find((entry) => entry.filter === undefined);
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Whether the executor's schema marks its targets continuous, resolved through
|
|
218
|
+
* the same `getExecutorInformation` call `normalizeTarget` makes at graph
|
|
219
|
+
* construction, so the two cannot drift on what continuous means.
|
|
220
|
+
*
|
|
221
|
+
* An executor that cannot be resolved is read as not continuous. That is the
|
|
222
|
+
* same answer `normalizeTarget` gives, but not the same trade: its lookup is
|
|
223
|
+
* repeated on every graph construction, so a failure there corrects itself,
|
|
224
|
+
* whereas this one decides a permanent edit to `nx.json`. An executor that is
|
|
225
|
+
* unresolvable while the migration runs and resolvable afterwards therefore
|
|
226
|
+
* keeps its stamped `cache` while the runtime starts marking its targets
|
|
227
|
+
* continuous — which `normalizeTargets` rejects with a `WorkspaceValidityError`,
|
|
228
|
+
* failing graph construction until `nx.json` is edited by hand.
|
|
229
|
+
*/
|
|
230
|
+
function executorDeclaresContinuous(executor, workspaceRoot, projectsMap) {
|
|
231
|
+
try {
|
|
232
|
+
const [nodeModule, name] = (0, executor_utils_1.parseExecutor)(executor);
|
|
233
|
+
const { schema } = (0, executor_utils_1.getExecutorInformation)(nodeModule, name, workspaceRoot, projectsMap);
|
|
234
|
+
return !!schema.continuous;
|
|
235
|
+
}
|
|
236
|
+
catch {
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Target names the pre-23 `longRunningTask` guard excluded from caching.
|
|
242
|
+
* Mirrors `isLongRunningTarget` in `target-normalization.ts`.
|
|
243
|
+
*/
|
|
244
|
+
function isLongRunningTargetName(targetName) {
|
|
245
|
+
return (targetName.endsWith(':watch') ||
|
|
246
|
+
targetName.endsWith('-watch') ||
|
|
247
|
+
targetName === 'serve' ||
|
|
248
|
+
targetName === 'dev' ||
|
|
249
|
+
targetName === 'start');
|
|
250
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#### Set cache on executor-based target defaults
|
|
2
|
+
|
|
3
|
+
Maintains compatibility with how cacheability was resolved before Nx 23.
|
|
4
|
+
|
|
5
|
+
Target defaults resolve to a single key rather than merging them. When a target matches both a target name key and an executor key, the executor key is the one that applies, and the target name key is not read at all. Earlier versions of Nx also derived cacheability from target names, so `"cache": true` on the target name key still took effect even when an executor key applied. Nx 23 reads cacheability from the resolved target only.
|
|
6
|
+
|
|
7
|
+
This migration copies `cache` onto each executor key that applies to a target whose target name key enables it, so those targets remain cacheable.
|
|
8
|
+
|
|
9
|
+
An executor key applies to every target that resolves through it, so the migration updates a key only when it can establish that caching is right for all of them. It leaves the key unchanged when the key already declares `cache`, when it declares `continuous: true`, when every entry on the key is filtered so none of them always applies, when a target through it is continuous or is a long-running target such as `serve`, `dev`, or `start`, when the executor's own schema marks its targets continuous, or when a target through it has no target name key enabling `cache`. It never updates the `nx:run-commands` or `nx:run-script` keys, because targets written with `command` and targets derived from `package.json` scripts resolve through those keys without naming them.
|
|
10
|
+
|
|
11
|
+
Where the migration makes no change, Nx still decides at run time, per target rather than per key: a target whose target name key enables `cache`, and whose resolved configuration still leaves `cache` undefined, gets it back and is reported as a deprecated fallback. Because that test is applied to the resolved target rather than to the key, it also covers the cases where a key looks decided but is not for this project — an executor key whose entries are all filtered, or whose only `cache` declaration is filtered out here. It equally covers the targets left behind because a sibling target through the same key does not opt in, and the targets reaching the `nx:run-commands` and `nx:run-script` keys. Three cases get no fallback and no warning. A continuous or long-running target, because caching it is invalid. A target whose resolved configuration already sets `cache`. And a target whose target name key was discarded as incompatible, because its entry named an executor the target does not use — before Nx 23 that target was cacheable, since cacheability was matched on target name alone and the entry's `executor` was never read. Restoring it here would mean setting `cache` with no executor key to point the user at and no migration able to retire the behavior, so it is deliberately left alone. Set `cache` on those targets directly.
|
|
12
|
+
|
|
13
|
+
Targets are read from each project's `project.json` and from the `nx.targets` block of its `package.json`. Targets inferred by a plugin, and targets derived from `package.json` scripts, are not visible to the migration — the latter is why the `nx:run-script` key is never updated. A key that looks safe here may still serve an inferred target. Set `cache` on the executor key by hand only after checking that no target reaching it is continuous; Nx rejects a target that is both cacheable and continuous. Nx names both keys in a run-time warning. That warning is emitted during project graph construction, so while the daemon is running it goes to `.nx/workspace-data/d/daemon.log` rather than the terminal; CI runs, where the daemon is disabled, print it normally.
|
|
14
|
+
|
|
15
|
+
#### Sample code changes
|
|
16
|
+
|
|
17
|
+
Given a project with a `build` target that uses the `@nx/angular:webpack-browser` executor:
|
|
18
|
+
|
|
19
|
+
##### Before
|
|
20
|
+
|
|
21
|
+
```json title="nx.json"
|
|
22
|
+
{
|
|
23
|
+
"targetDefaults": {
|
|
24
|
+
"build": {
|
|
25
|
+
"cache": true,
|
|
26
|
+
"dependsOn": ["^build"]
|
|
27
|
+
},
|
|
28
|
+
"@nx/angular:webpack-browser": {
|
|
29
|
+
"inputs": ["production", "^production"]
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
##### After
|
|
36
|
+
|
|
37
|
+
```json title="nx.json"
|
|
38
|
+
{
|
|
39
|
+
"targetDefaults": {
|
|
40
|
+
"build": {
|
|
41
|
+
"cache": true,
|
|
42
|
+
"dependsOn": ["^build"]
|
|
43
|
+
},
|
|
44
|
+
"@nx/angular:webpack-browser": {
|
|
45
|
+
"inputs": ["production", "^production"],
|
|
46
|
+
"cache": true
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
```
|
|
@@ -17,6 +17,10 @@ interface WriterArc {
|
|
|
17
17
|
readonly __brand: unique symbol;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
interface MasterArc {
|
|
21
|
+
readonly __brand: unique symbol;
|
|
22
|
+
}
|
|
23
|
+
|
|
20
24
|
interface HashInstruction {
|
|
21
25
|
readonly __brand: unique symbol;
|
|
22
26
|
}
|
|
@@ -36,7 +40,7 @@ export declare class AppLifeCycle {
|
|
|
36
40
|
endTasks(taskResults: Array<TaskResult>, metadata: object): void
|
|
37
41
|
endCommand(summary?: PerformanceSummaryPayload | undefined | null): void
|
|
38
42
|
__init(doneCallback: (() => unknown)): void
|
|
39
|
-
registerRunningTask(taskId: string,
|
|
43
|
+
registerRunningTask(taskId: string, ptyHandles: ExternalObject<[ParserArc, WriterArc, MasterArc]>): void
|
|
40
44
|
registerRunningTaskWithEmptyParser(taskId: string): void
|
|
41
45
|
appendTaskOutput(taskId: string, output: string, isPtyOutput: boolean): void
|
|
42
46
|
setTaskStatus(taskId: string, status: TaskStatus): void
|
|
@@ -56,7 +60,7 @@ export declare class AppLifeCycle {
|
|
|
56
60
|
}
|
|
57
61
|
|
|
58
62
|
export declare class ChildProcess {
|
|
59
|
-
|
|
63
|
+
getPtyHandles(): ExternalObject<[ParserArc, WriterArc, MasterArc]>
|
|
60
64
|
getPid(): number
|
|
61
65
|
kill(signal?: NodeJS.Signals | number): void
|
|
62
66
|
onExit(callback: (message: string) => void): void
|
|
@@ -326,6 +330,7 @@ export interface EventDimensions {
|
|
|
326
330
|
packageName: string
|
|
327
331
|
packageVersion: string
|
|
328
332
|
duration: string
|
|
333
|
+
sampleRate: string
|
|
329
334
|
taskCount: string
|
|
330
335
|
projectCount: string
|
|
331
336
|
cachedTaskCount: string
|
|
@@ -411,6 +416,16 @@ export declare function getEventDimensions(): EventDimensions
|
|
|
411
416
|
*/
|
|
412
417
|
export declare function getFilesForOutputsBatch(directory: string, entriesBatch: Array<Array<string>>): Array<Array<string>>
|
|
413
418
|
|
|
419
|
+
/**
|
|
420
|
+
* The same list, for JavaScript callers that walk a tree rather than the
|
|
421
|
+
* filesystem - `visitNotIgnoredFiles` - so both sides apply one baseline
|
|
422
|
+
* instead of maintaining a second copy that drifts.
|
|
423
|
+
*
|
|
424
|
+
* The patterns are gitignore-shaped, so they read the same to the `ignore`
|
|
425
|
+
* crate here and the `ignore` npm package there.
|
|
426
|
+
*/
|
|
427
|
+
export declare function getHardcodedIgnorePatterns(): Array<string>
|
|
428
|
+
|
|
414
429
|
/**
|
|
415
430
|
* If `workspace_root` is inside a git worktree, returns the main repo root.
|
|
416
431
|
* Returns `None` when already in the main repo (or not in a git repo at all).
|
|
@@ -487,14 +502,14 @@ export interface HashInputs {
|
|
|
487
502
|
* so the caller can set it as an env var for child processes.
|
|
488
503
|
* Used by CLI and daemon.
|
|
489
504
|
*/
|
|
490
|
-
export declare function initializeTelemetry(connection: ExternalObject<NxDbConnection>, workspaceId: string, userId: string, nxVersion: string, packageManagerName: string, packageManagerVersion: string | undefined | null, nodeVersion: string, osArch: string, osPlatform: string, osRelease: string, isCi: boolean, isNxCloud: boolean): string
|
|
505
|
+
export declare function initializeTelemetry(connection: ExternalObject<NxDbConnection>, workspaceId: string, userId: string | undefined | null, nxVersion: string, packageManagerName: string, packageManagerVersion: string | undefined | null, nodeVersion: string, osArch: string, osPlatform: string, osRelease: string, isCi: boolean, isNxCloud: boolean): string
|
|
491
506
|
|
|
492
507
|
/**
|
|
493
508
|
* Initialize telemetry with a pre-fetched session ID.
|
|
494
509
|
* No DB connection — used by plugin workers that inherit the
|
|
495
510
|
* session ID from their parent process via env var.
|
|
496
511
|
*/
|
|
497
|
-
export declare function initializeTelemetryWithSessionId(sessionId: string, workspaceId: string, userId: string, nxVersion: string, packageManagerName: string, packageManagerVersion: string | undefined | null, nodeVersion: string, osArch: string, osPlatform: string, osRelease: string, isCi: boolean, isNxCloud: boolean): void
|
|
512
|
+
export declare function initializeTelemetryWithSessionId(sessionId: string, workspaceId: string, userId: string | undefined | null, nxVersion: string, packageManagerName: string, packageManagerVersion: string | undefined | null, nodeVersion: string, osArch: string, osPlatform: string, osRelease: string, isCi: boolean, isNxCloud: boolean): void
|
|
498
513
|
|
|
499
514
|
export interface InputsInput {
|
|
500
515
|
input: string
|
|
@@ -557,6 +572,24 @@ export interface Link {
|
|
|
557
572
|
|
|
558
573
|
export declare function logDebug(message: string): void
|
|
559
574
|
|
|
575
|
+
/**
|
|
576
|
+
* Checks which `paths` match the given `globs`, using the same glob engine
|
|
577
|
+
* as the task hasher (`build_glob_set`). Used to statically match
|
|
578
|
+
* `dependentTasksOutputFiles` globs against candidate paths.
|
|
579
|
+
*/
|
|
580
|
+
export declare function matchGlobPaths(globs: Array<string>, paths: Array<string>): Array<boolean>
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* Statically checks which `paths` would be captured by the given output
|
|
584
|
+
* `entries`, without touching the file system. Mirrors `expand_outputs`
|
|
585
|
+
* semantics: entries match themselves and anything nested under them (so a
|
|
586
|
+
* directory entry captures its contents), negated (`!`-prefixed) entries
|
|
587
|
+
* exclude matches from the whole entry set, and a non-empty list with only
|
|
588
|
+
* negated entries matches everything not excluded. An empty list matches
|
|
589
|
+
* nothing.
|
|
590
|
+
*/
|
|
591
|
+
export declare function matchOutputPaths(entries: Array<string>, paths: Array<string>): Array<boolean>
|
|
592
|
+
|
|
560
593
|
/** Combined metadata for groups and processes */
|
|
561
594
|
export interface Metadata {
|
|
562
595
|
/** Group-level metadata */
|