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
|
@@ -12,14 +12,17 @@ exports.lockFileExists = lockFileExists;
|
|
|
12
12
|
exports.getLockFileName = getLockFileName;
|
|
13
13
|
exports.getLockFilePath = getLockFilePath;
|
|
14
14
|
exports.createLockFile = createLockFile;
|
|
15
|
+
exports.generatePrunedDeployOutput = generatePrunedDeployOutput;
|
|
15
16
|
const node_child_process_1 = require("node:child_process");
|
|
16
17
|
const node_fs_1 = require("node:fs");
|
|
17
18
|
const node_path_1 = require("node:path");
|
|
18
19
|
const semver_1 = require("semver");
|
|
19
20
|
const fileutils_1 = require("../../../utils/fileutils");
|
|
20
21
|
const output_1 = require("../../../utils/output");
|
|
22
|
+
const pruned_output_1 = require("./pruned-output");
|
|
21
23
|
const package_manager_1 = require("../../../utils/package-manager");
|
|
22
24
|
const workspace_root_1 = require("../../../utils/workspace-root");
|
|
25
|
+
const get_workspace_packages_from_graph_1 = require("../utils/get-workspace-packages-from-graph");
|
|
23
26
|
const bun_parser_1 = require("./bun-parser");
|
|
24
27
|
const npm_parser_1 = require("./npm-parser");
|
|
25
28
|
const pnpm_parser_1 = require("./pnpm-parser");
|
|
@@ -203,35 +206,73 @@ function getLockFilePath(packageManager) {
|
|
|
203
206
|
/**
|
|
204
207
|
* Create lock file based on the root level lock file and (pruned) package.json
|
|
205
208
|
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
209
|
+
* A pruned pnpm lockfile no longer declares the resolution-time pnpm config it
|
|
210
|
+
* bakes into its snapshots, so the config is dropped from `packageJson` too:
|
|
211
|
+
* pnpm 10 and below validate the manifest against the lockfile and abort a
|
|
212
|
+
* frozen install with ERR_PNPM_LOCKFILE_CONFIG_MISMATCH when the two disagree.
|
|
213
|
+
* An inherited `pnpm.patchedDependencies` goes with it, since the prune scopes
|
|
214
|
+
* the lockfile's patches to the packages that survive it and rewrites their
|
|
215
|
+
* paths onto the output.
|
|
216
|
+
* The manifest is left alone for npm and yarn, which never read that block.
|
|
217
|
+
* Mutating it means callers must write or emit the manifest after this returns.
|
|
218
|
+
*
|
|
219
|
+
* The lockfile alone does not make a complete pnpm output. A workspace
|
|
220
|
+
* declaring build-script approvals, patches or vendored local paths also needs
|
|
221
|
+
* the artifacts `generatePrunedDeployOutput` ships, and this warns when that is
|
|
222
|
+
* the case.
|
|
223
|
+
*
|
|
224
|
+
* On a pruning error the root lockfile is returned as a fail-open fallback,
|
|
225
|
+
* with the manifest left as authored.
|
|
226
|
+
*
|
|
227
|
+
* @deprecated Use `generatePrunedDeployOutput` instead. This will be removed in Nx 25.
|
|
210
228
|
*/
|
|
211
229
|
function createLockFile(packageJson, graph, packageManager = (0, package_manager_1.detectPackageManager)(workspace_root_1.workspaceRoot)) {
|
|
230
|
+
let pruned = true;
|
|
231
|
+
const lockFileContent = buildLockFile(packageJson, graph, packageManager, {
|
|
232
|
+
onPruneFallback: () => {
|
|
233
|
+
pruned = false;
|
|
234
|
+
},
|
|
235
|
+
});
|
|
236
|
+
if (pruned && packageManager === 'pnpm') {
|
|
237
|
+
(0, pruned_output_1.stripPrunedLockfilePnpmConfig)(packageJson);
|
|
238
|
+
(0, pruned_output_1.dropInheritedPnpmPatchedDependencies)(packageJson);
|
|
239
|
+
(0, pruned_output_1.warnIncompletePrunedPnpmOutput)(lockFileContent);
|
|
240
|
+
}
|
|
241
|
+
return lockFileContent;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* `createLockFile` without the manifest reconciliation, for callers that own
|
|
245
|
+
* that step themselves. `options.onPruneFallback` fires just before the
|
|
246
|
+
* root-lockfile fallback is returned, so a caller can skip work that only makes
|
|
247
|
+
* sense for an actually pruned lockfile (e.g. link-closure validation and
|
|
248
|
+
* local-path artifact shipping). Every root-relative read resolves from
|
|
249
|
+
* `options.workspaceRootPath`, so a caller passing one cannot end up with the
|
|
250
|
+
* lockfile read from one root and the catalogs resolved from another.
|
|
251
|
+
*/
|
|
252
|
+
function buildLockFile(packageJson, graph, packageManager = (0, package_manager_1.detectPackageManager)(workspace_root_1.workspaceRoot), options) {
|
|
253
|
+
const workspaceRootPath = options?.workspaceRootPath ?? workspace_root_1.workspaceRoot;
|
|
212
254
|
const normalizedPackageJson = (0, package_json_1.normalizePackageJson)(packageJson);
|
|
213
|
-
const content = (0, node_fs_1.readFileSync)(
|
|
255
|
+
const content = (0, node_fs_1.readFileSync)((0, node_path_1.join)(workspaceRootPath, getLockFileName(packageManager)), 'utf8');
|
|
214
256
|
try {
|
|
257
|
+
if (packageManager === 'bun') {
|
|
258
|
+
output_1.output.log({
|
|
259
|
+
title: "Unable to create bun lock files. Run bun install it's just as quick",
|
|
260
|
+
});
|
|
261
|
+
return '';
|
|
262
|
+
}
|
|
263
|
+
const prunedGraph = (0, project_graph_pruning_1.pruneProjectGraph)(graph, packageJson, workspaceRootPath, packageManager);
|
|
215
264
|
if (packageManager === 'yarn') {
|
|
216
|
-
const prunedGraph = (0, project_graph_pruning_1.pruneProjectGraph)(graph, packageJson);
|
|
217
265
|
return (0, yarn_parser_1.stringifyYarnLockfile)(prunedGraph, content, normalizedPackageJson);
|
|
218
266
|
}
|
|
219
267
|
if (packageManager === 'pnpm') {
|
|
220
|
-
|
|
221
|
-
return (0, pnpm_parser_1.stringifyPnpmLockfile)(prunedGraph, content, normalizedPackageJson, workspace_root_1.workspaceRoot);
|
|
268
|
+
return (0, pnpm_parser_1.stringifyPnpmLockfile)(prunedGraph, content, normalizedPackageJson, workspaceRootPath);
|
|
222
269
|
}
|
|
223
270
|
if (packageManager === 'npm') {
|
|
224
|
-
const prunedGraph = (0, project_graph_pruning_1.pruneProjectGraph)(graph, packageJson);
|
|
225
271
|
return (0, npm_parser_1.stringifyNpmLockfile)(prunedGraph, content, normalizedPackageJson);
|
|
226
272
|
}
|
|
227
|
-
if (packageManager === 'bun') {
|
|
228
|
-
output_1.output.log({
|
|
229
|
-
title: "Unable to create bun lock files. Run bun install it's just as quick",
|
|
230
|
-
});
|
|
231
|
-
return '';
|
|
232
|
-
}
|
|
233
273
|
}
|
|
234
274
|
catch (e) {
|
|
275
|
+
options?.onPruneFallback?.(e);
|
|
235
276
|
if (!isPostInstallProcess()) {
|
|
236
277
|
const additionalInfo = [
|
|
237
278
|
'To prevent the build from breaking we are returning the root lock file.',
|
|
@@ -250,6 +291,142 @@ function createLockFile(packageJson, graph, packageManager = (0, package_manager
|
|
|
250
291
|
return content;
|
|
251
292
|
}
|
|
252
293
|
}
|
|
294
|
+
/**
|
|
295
|
+
* Creates the pruned lockfile for a generate-package-json flow, running the
|
|
296
|
+
* steps such a flow needs around `createLockFile`. For pnpm, the manifest's
|
|
297
|
+
* `file:`/`link:` local-path specifiers are relocated to their shipped location
|
|
298
|
+
* first (pnpm re-resolves them on a non-frozen install, and the lockfile copies
|
|
299
|
+
* the manifest's form), and the local-path dependency closure is validated
|
|
300
|
+
* after pruning so a shipped `link:` target that requires an unresolvable
|
|
301
|
+
* dependency fails the build instead of the deploy. After a successful prune,
|
|
302
|
+
* the manifest's pnpm config block is stripped for every package manager:
|
|
303
|
+
* re-declaring config a pruned pnpm lockfile bakes into its snapshots trips
|
|
304
|
+
* ERR_PNPM_LOCKFILE_CONFIG_MISMATCH, and npm and yarn never read the block at
|
|
305
|
+
* install time, so dropping it does not change their installs. An inherited
|
|
306
|
+
* `pnpm.patchedDependencies` is dropped on both paths, since the sinks below
|
|
307
|
+
* declare the patches the output actually ships.
|
|
308
|
+
*
|
|
309
|
+
* `pruned` is false when the prune failed and the root lockfile was returned on a
|
|
310
|
+
* pruning error: the fallback's importer describes the whole workspace, so the
|
|
311
|
+
* manifest mutations are rolled back (the root lockfile matches the manifest as
|
|
312
|
+
* authored: original local-path specifiers, the rest of the pnpm config kept),
|
|
313
|
+
* the closure validation is skipped, and the remaining install-time pieces must
|
|
314
|
+
* not ship local-path artifacts for it (see `getPrunedPnpmInstallArtifacts`).
|
|
315
|
+
*
|
|
316
|
+
* Mutates `packageJson` (the pnpm-only specifier relocation and the config
|
|
317
|
+
* strip), so write or emit the manifest after calling this. Not for bun, which
|
|
318
|
+
* has no lockfile generation.
|
|
319
|
+
*/
|
|
320
|
+
function createPrunedLockfile(packageJson, graph, projectRoot, workspaceRootPath = workspace_root_1.workspaceRoot, packageManager = (0, package_manager_1.detectPackageManager)(workspaceRootPath)) {
|
|
321
|
+
const originalPackageJson = structuredClone(packageJson);
|
|
322
|
+
if (packageManager === 'pnpm') {
|
|
323
|
+
(0, pruned_output_1.rewritePrunedLocalPathSpecifiers)(packageJson, projectRoot, workspaceRootPath, new Set((0, get_workspace_packages_from_graph_1.getWorkspacePackagesFromGraph)(graph).keys()));
|
|
324
|
+
}
|
|
325
|
+
let pruneError;
|
|
326
|
+
const lockFileContent = buildLockFile(packageJson, graph, packageManager, {
|
|
327
|
+
onPruneFallback: (error) => {
|
|
328
|
+
pruneError = error;
|
|
329
|
+
},
|
|
330
|
+
workspaceRootPath,
|
|
331
|
+
});
|
|
332
|
+
const pruned = pruneError === undefined;
|
|
333
|
+
if (pruned) {
|
|
334
|
+
(0, pruned_output_1.stripPrunedLockfilePnpmConfig)(packageJson);
|
|
335
|
+
if (packageManager === 'pnpm') {
|
|
336
|
+
(0, pruned_output_1.validatePrunedLocalPathClosure)(packageJson, workspaceRootPath, lockFileContent);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
// The root lockfile matches the manifest as authored, so undo the
|
|
341
|
+
// specifier relocation and keep the pnpm config it still declares.
|
|
342
|
+
for (const key of Object.keys(packageJson)) {
|
|
343
|
+
delete packageJson[key];
|
|
344
|
+
}
|
|
345
|
+
Object.assign(packageJson, originalPackageJson);
|
|
346
|
+
// The pruning error output is suppressed under a postinstall, so
|
|
347
|
+
// this is the only signal there naming the cause and what the fallback
|
|
348
|
+
// output is missing.
|
|
349
|
+
const bodyLines = [`The lockfile pruning failed: ${pruneError?.message}`];
|
|
350
|
+
if (packageManager === 'pnpm') {
|
|
351
|
+
bodyLines.push('The emitted package.json keeps its resolution-time pnpm config (`overrides`, `packageExtensions`), its vendored local-path specifiers point at their original workspace locations, and no local-path artifacts are shipped for it.');
|
|
352
|
+
}
|
|
353
|
+
bodyLines.push(packageManager === 'npm'
|
|
354
|
+
? '`npm ci` in the output will fail; run `npm install` instead.'
|
|
355
|
+
: packageManager === 'yarn'
|
|
356
|
+
? 'An immutable install of the output (`--immutable`, or `--frozen-lockfile` on yarn 1) may fail; run an install without immutability instead (yarn 2+ turns it on by default in CI).'
|
|
357
|
+
: 'A `--frozen-lockfile` install of the output will fail; run a regular install instead.');
|
|
358
|
+
output_1.output.warn({
|
|
359
|
+
title: 'The pruned output falls back to the root lockfile',
|
|
360
|
+
bodyLines,
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
(0, pruned_output_1.dropInheritedPnpmPatchedDependencies)(packageJson);
|
|
364
|
+
return { lockFileContent, pruned };
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Generates the standalone deploy output a generate-package-json flow ships
|
|
368
|
+
* alongside its manifest: the pruned lockfile and, for pnpm, the install-time
|
|
369
|
+
* artifacts that lockfile needs (the settings-only pnpm-workspace.yaml, the
|
|
370
|
+
* `pnpm patch` files, and the vendored non-workspace local-path dependencies).
|
|
371
|
+
* `options` carries either an `outputDirectory` to write into or an `emit` sink
|
|
372
|
+
* for a bundler's asset pipeline, never both.
|
|
373
|
+
*
|
|
374
|
+
* Mutates `packageJson` into the form the output must ship (the relocated
|
|
375
|
+
* local-path specifiers, the pnpm config strip, the pnpm <=10 build settings),
|
|
376
|
+
* so write or emit the manifest after this returns.
|
|
377
|
+
*
|
|
378
|
+
* Bun has no lockfile generation, so it warns and ships nothing, leaving the
|
|
379
|
+
* manifest as authored.
|
|
380
|
+
*/
|
|
381
|
+
function generatePrunedDeployOutput(packageJson, graph, projectRoot, options) {
|
|
382
|
+
const workspaceRootPath = options.workspaceRoot ?? workspace_root_1.workspaceRoot;
|
|
383
|
+
const { packageManager } = options;
|
|
384
|
+
if (packageManager === 'bun') {
|
|
385
|
+
output_1.output.warn({
|
|
386
|
+
title: 'Bun lockfile generation is not supported',
|
|
387
|
+
bodyLines: [
|
|
388
|
+
'Only the package.json is generated. Run `bun install` in the output directory if needed.',
|
|
389
|
+
],
|
|
390
|
+
});
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
const { lockFileContent, pruned } = createPrunedLockfile(packageJson, graph, projectRoot, workspaceRootPath, packageManager);
|
|
394
|
+
const artifacts = [
|
|
395
|
+
{ path: getLockFileName(packageManager), content: lockFileContent },
|
|
396
|
+
];
|
|
397
|
+
if (packageManager === 'pnpm') {
|
|
398
|
+
artifacts.push(...(0, pruned_output_1.getPrunedPnpmInstallArtifacts)(workspaceRootPath, lockFileContent, packageJson, { includeLocalPathArtifacts: pruned }));
|
|
399
|
+
}
|
|
400
|
+
// Discriminate on the value, not key presence: options built by spread can
|
|
401
|
+
// carry an explicitly-present `outputDirectory: undefined` beside `emit`.
|
|
402
|
+
if (options.outputDirectory !== undefined) {
|
|
403
|
+
const { outputDirectory } = options;
|
|
404
|
+
// Directory trees flow through here one file at a time, so dedupe the
|
|
405
|
+
// recursive mkdir per destination directory.
|
|
406
|
+
const createdDirs = new Set();
|
|
407
|
+
for (const artifact of artifacts) {
|
|
408
|
+
const destination = (0, node_path_1.join)(outputDirectory, artifact.path);
|
|
409
|
+
const destinationDir = (0, node_path_1.dirname)(destination);
|
|
410
|
+
if (!createdDirs.has(destinationDir)) {
|
|
411
|
+
(0, node_fs_1.mkdirSync)(destinationDir, { recursive: true });
|
|
412
|
+
createdDirs.add(destinationDir);
|
|
413
|
+
}
|
|
414
|
+
if ('sourcePath' in artifact) {
|
|
415
|
+
(0, node_fs_1.copyFileSync)(artifact.sourcePath, destination);
|
|
416
|
+
}
|
|
417
|
+
else {
|
|
418
|
+
(0, node_fs_1.writeFileSync)(destination, artifact.content);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
else {
|
|
423
|
+
for (const artifact of artifacts) {
|
|
424
|
+
options.emit(artifact.path, 'sourcePath' in artifact
|
|
425
|
+
? (0, node_fs_1.readFileSync)(artifact.sourcePath)
|
|
426
|
+
: artifact.content);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}
|
|
253
430
|
// generate body lines for error message
|
|
254
431
|
function errorBodyLines(originalError, additionalInfo = []) {
|
|
255
432
|
return [
|