nx 23.2.0-beta.1 → 23.2.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/bin/init-local.js +3 -5
- package/dist/bin/nx.js +2 -0
- 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.js +5 -11
- package/dist/src/command-line/init/command-object.js +4 -2
- 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 +28 -9
- package/dist/src/command-line/migrate/execute-migration.js +112 -27
- 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 +16 -7
- package/dist/src/command-line/migrate/migrate.d.ts +28 -68
- package/dist/src/command-line/migrate/migrate.js +657 -293
- 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 +18 -0
- 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/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/config/misc-interfaces.d.ts +19 -7
- package/dist/src/config/nx-json.d.ts +4 -2
- 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 +106 -8
- package/dist/src/devkit-internals.js +225 -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/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/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-report.d.ts +12 -0
- package/dist/src/tasks-runner/life-cycles/performance-report.js +62 -3
- 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/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-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/has-nx-js-plugin.d.ts +1 -1
- package/dist/src/utils/has-nx-js-plugin.js +1 -1
- package/dist/src/utils/ignore.d.ts +170 -1
- package/dist/src/utils/ignore.js +263 -11
- package/dist/src/utils/kill-child-on-host-exit.d.ts +7 -0
- package/dist/src/utils/kill-child-on-host-exit.js +42 -0
- 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 +262 -42
- 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
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ChildProcess, ExecFileSyncOptions, SpawnOptions } from 'child_process';
|
|
2
|
+
/**
|
|
3
|
+
* Spawn a binary that may be a Windows `.cmd`/`.bat` shim, without letting its
|
|
4
|
+
* arguments become shell syntax.
|
|
5
|
+
*
|
|
6
|
+
* Off Windows, and for a `.exe`, no shell is involved at all. Where one is —
|
|
7
|
+
* a shim or a bare name — the binary and every argument are quoted for cmd.exe.
|
|
8
|
+
*
|
|
9
|
+
* Not a complete guarantee: cmd.exe expands `%VAR%` in the binary or any
|
|
10
|
+
* argument whether or not it is quoted, so a caller with untrusted arguments
|
|
11
|
+
* inherits that gap (NXC-4798). See the note on `LINE_BREAK` above.
|
|
12
|
+
*
|
|
13
|
+
* @throws on Windows when the binary or an argument contains a line break, or a
|
|
14
|
+
* literal `"` (via `quoteShellArg`). Those are the only refusals — the `%`
|
|
15
|
+
* expansion above is not one of them.
|
|
16
|
+
*/
|
|
17
|
+
export declare function safeSpawn(binary: string, args: readonly string[], options?: Omit<SpawnOptions, 'shell'>): ChildProcess;
|
|
18
|
+
/**
|
|
19
|
+
* Synchronous {@link safeSpawn}, returning the child's stdout.
|
|
20
|
+
*
|
|
21
|
+
* Carries the same Windows caveats: `%VAR%` is expanded quoted or not
|
|
22
|
+
* (NXC-4798), and a line break or literal `"` throws.
|
|
23
|
+
*/
|
|
24
|
+
export declare function safeExecFileSync(binary: string, args: readonly string[], options?: Omit<ExecFileSyncOptions, 'encoding' | 'shell'>): string;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.safeSpawn = safeSpawn;
|
|
4
|
+
exports.safeExecFileSync = safeExecFileSync;
|
|
5
|
+
const child_process_1 = require("child_process");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
const shell_quoting_1 = require("./shell-quoting");
|
|
8
|
+
// Node refuses to launch a Windows `.cmd`/`.bat` shim without a shell
|
|
9
|
+
// (CVE-2024-27980). A bare name takes the shell for the same reason, one step
|
|
10
|
+
// removed: libuv walks PATH and PATHEXT itself, so no shell is needed to *find*
|
|
11
|
+
// the binary — but the walk may land on a `.cmd`/`.bat`, and this cannot know
|
|
12
|
+
// which in advance, so it is deliberately conservative. Everything else,
|
|
13
|
+
// including a `.exe`, spawns directly, so the shell and the quoting below reach
|
|
14
|
+
// only the invocations that cannot do without them.
|
|
15
|
+
//
|
|
16
|
+
// Deliberately a function: a module-level const is fixed at import time, which
|
|
17
|
+
// would make the Windows branch untestable.
|
|
18
|
+
function needsShell(binary) {
|
|
19
|
+
if (process.platform !== 'win32') {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
// win32.extname, not the platform default: this branch only runs on Windows,
|
|
23
|
+
// where `path` is win32 anyway, and pinning it lets a test model the real
|
|
24
|
+
// parse rather than posix's (which reads `C:\ws\my.app\gradlew` as `.app\gradlew`).
|
|
25
|
+
const ext = path_1.win32.extname(binary).toLowerCase();
|
|
26
|
+
return ext === '' || ext === '.cmd' || ext === '.bat';
|
|
27
|
+
}
|
|
28
|
+
// A line break ends the command line whatever the quoting, so nothing can carry
|
|
29
|
+
// one.
|
|
30
|
+
//
|
|
31
|
+
// `%` is deliberately NOT refused, and this is a known gap rather than a safe
|
|
32
|
+
// case. cmd.exe expands `%VAR%` whether or not the value is quoted — see
|
|
33
|
+
// `quoteShellArg`'s own docstring in ./shell-quoting, which says so and pins it
|
|
34
|
+
// with a test — so quoting contains nothing here. It applies to the binary path
|
|
35
|
+
// as much as to the arguments, and an expansion yielding a `"` defeats the
|
|
36
|
+
// literal-quote refusal below, because that inspects the pre-expansion bytes.
|
|
37
|
+
// `bin/nx.ts` loads the workspace's own `.env` before the graph is built, so a
|
|
38
|
+
// repo can set the variable too.
|
|
39
|
+
//
|
|
40
|
+
// Refusing `%` is what an earlier revision did, and it made any workspace under
|
|
41
|
+
// a `%` path — a legal Windows directory name — fail graph construction. The gap
|
|
42
|
+
// is bounded by the argument that bounds this whole class: a repo that can reach
|
|
43
|
+
// here already has `mvnw` / `pom.xml` executing on its behalf. Closing it
|
|
44
|
+
// properly is tracked as NXC-4798.
|
|
45
|
+
const LINE_BREAK = /[\r\n]/;
|
|
46
|
+
/**
|
|
47
|
+
* Spawn a binary that may be a Windows `.cmd`/`.bat` shim, without letting its
|
|
48
|
+
* arguments become shell syntax.
|
|
49
|
+
*
|
|
50
|
+
* Off Windows, and for a `.exe`, no shell is involved at all. Where one is —
|
|
51
|
+
* a shim or a bare name — the binary and every argument are quoted for cmd.exe.
|
|
52
|
+
*
|
|
53
|
+
* Not a complete guarantee: cmd.exe expands `%VAR%` in the binary or any
|
|
54
|
+
* argument whether or not it is quoted, so a caller with untrusted arguments
|
|
55
|
+
* inherits that gap (NXC-4798). See the note on `LINE_BREAK` above.
|
|
56
|
+
*
|
|
57
|
+
* @throws on Windows when the binary or an argument contains a line break, or a
|
|
58
|
+
* literal `"` (via `quoteShellArg`). Those are the only refusals — the `%`
|
|
59
|
+
* expansion above is not one of them.
|
|
60
|
+
*/
|
|
61
|
+
function safeSpawn(binary, args, options = {}) {
|
|
62
|
+
const shell = needsShell(binary);
|
|
63
|
+
return (0, child_process_1.spawn)(quoteBinary(binary, shell), quoteArgs(args, shell), {
|
|
64
|
+
...options,
|
|
65
|
+
windowsHide: true,
|
|
66
|
+
shell,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Synchronous {@link safeSpawn}, returning the child's stdout.
|
|
71
|
+
*
|
|
72
|
+
* Carries the same Windows caveats: `%VAR%` is expanded quoted or not
|
|
73
|
+
* (NXC-4798), and a line break or literal `"` throws.
|
|
74
|
+
*/
|
|
75
|
+
function safeExecFileSync(binary, args, options = {}) {
|
|
76
|
+
const shell = needsShell(binary);
|
|
77
|
+
return (0, child_process_1.execFileSync)(quoteBinary(binary, shell), quoteArgs(args, shell), {
|
|
78
|
+
stdio: 'pipe',
|
|
79
|
+
...options,
|
|
80
|
+
windowsHide: true,
|
|
81
|
+
shell,
|
|
82
|
+
encoding: 'utf-8',
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
// The binary needs quoting too: Node joins it into the same command line, so a
|
|
86
|
+
// path holding a space or an `&` would split there.
|
|
87
|
+
function quoteBinary(binary, shell) {
|
|
88
|
+
if (!shell) {
|
|
89
|
+
return binary;
|
|
90
|
+
}
|
|
91
|
+
return quoteForCmd(binary, `the path ${JSON.stringify(binary)}`);
|
|
92
|
+
}
|
|
93
|
+
function quoteForCmd(value, described, remedy = '') {
|
|
94
|
+
if (LINE_BREAK.test(value)) {
|
|
95
|
+
throw new Error(`Cannot pass ${described} to cmd.exe: a line break inside it would end the command line before cmd.exe reached the rest of it.${remedy}`);
|
|
96
|
+
}
|
|
97
|
+
return (0, shell_quoting_1.quoteShellArg)(value);
|
|
98
|
+
}
|
|
99
|
+
function quoteArgs(args, shell) {
|
|
100
|
+
if (!shell) {
|
|
101
|
+
return [...args];
|
|
102
|
+
}
|
|
103
|
+
return args.map((arg) => quoteForCmd(arg, `the argument ${JSON.stringify(arg)}`, ' Remove it from your Nx configuration and try again.'));
|
|
104
|
+
}
|
|
@@ -8,3 +8,18 @@ export declare function needsShellQuoting(str: string): boolean;
|
|
|
8
8
|
* Check if a string is already wrapped in matching quotes (single or double).
|
|
9
9
|
*/
|
|
10
10
|
export declare function isAlreadyQuoted(str: string): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Quote a string so it survives being interpolated into a shell command line
|
|
13
|
+
* as a single argument.
|
|
14
|
+
*
|
|
15
|
+
* On Windows the safety boundary is one unbroken double-quoted run: it keeps
|
|
16
|
+
* `^`, `&`, `|`, `<` and `>` literal through cmd.exe's parse and a `.cmd`
|
|
17
|
+
* shim's re-parse of `%*`, but not `%`, which cmd.exe expands inside double
|
|
18
|
+
* quotes too.
|
|
19
|
+
*
|
|
20
|
+
* @throws on Windows when the argument contains a double quote, which ends that
|
|
21
|
+
* run, since cmd.exe recognizes no backslash escape. Carrying one means
|
|
22
|
+
* caret-escaping every metacharacter instead, doubled for a `.cmd` shim, which
|
|
23
|
+
* this path does not implement.
|
|
24
|
+
*/
|
|
25
|
+
export declare function quoteShellArg(arg: string): string;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.needsShellQuoting = needsShellQuoting;
|
|
4
4
|
exports.isAlreadyQuoted = isAlreadyQuoted;
|
|
5
|
+
exports.quoteShellArg = quoteShellArg;
|
|
5
6
|
/**
|
|
6
7
|
* Shell metacharacters that have special meaning and require quoting.
|
|
7
8
|
*
|
|
@@ -39,3 +40,37 @@ function isAlreadyQuoted(str) {
|
|
|
39
40
|
((str[0] === "'" && str[str.length - 1] === "'") ||
|
|
40
41
|
(str[0] === '"' && str[str.length - 1] === '"')));
|
|
41
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Quote a string so it survives being interpolated into a shell command line
|
|
45
|
+
* as a single argument.
|
|
46
|
+
*
|
|
47
|
+
* On Windows the safety boundary is one unbroken double-quoted run: it keeps
|
|
48
|
+
* `^`, `&`, `|`, `<` and `>` literal through cmd.exe's parse and a `.cmd`
|
|
49
|
+
* shim's re-parse of `%*`, but not `%`, which cmd.exe expands inside double
|
|
50
|
+
* quotes too.
|
|
51
|
+
*
|
|
52
|
+
* @throws on Windows when the argument contains a double quote, which ends that
|
|
53
|
+
* run, since cmd.exe recognizes no backslash escape. Carrying one means
|
|
54
|
+
* caret-escaping every metacharacter instead, doubled for a `.cmd` shim, which
|
|
55
|
+
* this path does not implement.
|
|
56
|
+
*/
|
|
57
|
+
function quoteShellArg(arg) {
|
|
58
|
+
const isWindows = process.platform === 'win32';
|
|
59
|
+
if (isWindows && arg.includes('"')) {
|
|
60
|
+
throw new Error(`Cannot safely pass ${arg} to cmd.exe as a single argument: a double quote inside it would end the quoting and leave the rest of the argument to be read as commands. Remove the double quote and run the command again.`);
|
|
61
|
+
}
|
|
62
|
+
if (arg === '') {
|
|
63
|
+
// an unquoted empty string would vanish when joined into a command line
|
|
64
|
+
return isWindows ? '""' : "''";
|
|
65
|
+
}
|
|
66
|
+
// `^` is cmd.exe syntax rather than shell syntax, so it earns quoting only
|
|
67
|
+
// where cmd.exe parses the command line.
|
|
68
|
+
if (!needsShellQuoting(arg) && !(isWindows && arg.includes('^'))) {
|
|
69
|
+
return arg;
|
|
70
|
+
}
|
|
71
|
+
return isWindows
|
|
72
|
+
? // MSVCRT reads the backslashes that precede the closing quote as escapes,
|
|
73
|
+
// so they have to be doubled to survive as themselves.
|
|
74
|
+
`"${arg.replace(/(\\+)$/, '$1$1')}"`
|
|
75
|
+
: `'${arg.replace(/'/g, `'\\''`)}'`;
|
|
76
|
+
}
|
|
@@ -12,4 +12,15 @@ export declare function waitForSocketConnection(socketPath: string | (() => stri
|
|
|
12
12
|
signal?: AbortSignal;
|
|
13
13
|
maxAttempts?: number;
|
|
14
14
|
delayMs?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Called with the errno of each failed connect and the path it was made
|
|
17
|
+
* against. Return `true` to stop polling: a permission refusal does not
|
|
18
|
+
* heal by retrying, and without a way out the caller waits the full budget
|
|
19
|
+
* and then cannot say why.
|
|
20
|
+
*
|
|
21
|
+
* The path is passed rather than left to the caller to recompute — with a
|
|
22
|
+
* resolver it can differ per attempt, and the caller that reports the
|
|
23
|
+
* refusal may no longer be able to resolve one at all.
|
|
24
|
+
*/
|
|
25
|
+
onConnectError?: (error: NodeJS.ErrnoException, socketPath: string) => boolean | void;
|
|
15
26
|
}): Promise<Socket | null>;
|
|
@@ -26,9 +26,15 @@ async function waitForSocketConnection(socketPath, options) {
|
|
|
26
26
|
return null;
|
|
27
27
|
const path = typeof socketPath === 'function' ? socketPath() : socketPath;
|
|
28
28
|
if (path) {
|
|
29
|
-
const
|
|
30
|
-
if (socket) {
|
|
31
|
-
return socket;
|
|
29
|
+
const result = await tryConnect(path);
|
|
30
|
+
if (result.socket) {
|
|
31
|
+
return result.socket;
|
|
32
|
+
}
|
|
33
|
+
// The caller may need the errno this attempt produced — a refused
|
|
34
|
+
// connection is reported very differently from a socket that is not
|
|
35
|
+
// there yet, and polling past it only delays the same answer.
|
|
36
|
+
if (result.error && options?.onConnectError?.(result.error, path)) {
|
|
37
|
+
return null;
|
|
32
38
|
}
|
|
33
39
|
}
|
|
34
40
|
attempts++;
|
|
@@ -39,15 +45,15 @@ function tryConnect(socketPath) {
|
|
|
39
45
|
return new Promise((resolve) => {
|
|
40
46
|
try {
|
|
41
47
|
const socket = (0, net_1.connect)(socketPath, () => {
|
|
42
|
-
resolve(socket);
|
|
48
|
+
resolve({ socket });
|
|
43
49
|
});
|
|
44
|
-
socket.once('error', () => {
|
|
50
|
+
socket.once('error', (error) => {
|
|
45
51
|
socket.destroy();
|
|
46
|
-
resolve(
|
|
52
|
+
resolve({ error });
|
|
47
53
|
});
|
|
48
54
|
}
|
|
49
|
-
catch {
|
|
50
|
-
resolve(
|
|
55
|
+
catch (error) {
|
|
56
|
+
resolve({ error: error });
|
|
51
57
|
}
|
|
52
58
|
});
|
|
53
59
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { NxJsonConfiguration } from '../config/nx-json';
|
|
2
|
+
/**
|
|
3
|
+
* The workspace's analytics identity: the Nx Cloud id when the workspace has
|
|
4
|
+
* one (most stable — it survives repo moves and renames), else the repo key.
|
|
5
|
+
* Null when neither is available, in which case nothing is reported.
|
|
6
|
+
*/
|
|
7
|
+
export declare function generateWorkspaceId(root: string, nxJson: NxJsonConfiguration | null): string | null;
|
|
8
|
+
/**
|
|
9
|
+
* Derive the stable, unsalted key identifying this workspace in the
|
|
10
|
+
* repoTelemetry registry: `sha256(<repo identity> + '#' + <workspace path
|
|
11
|
+
* relative to the git root>)`.
|
|
12
|
+
*
|
|
13
|
+
* The repo identity is the normalized `domain/slug` from the git remote
|
|
14
|
+
* (protocol-independent: ssh, https, and token-authenticated URLs of the
|
|
15
|
+
* same repo produce the same key), falling back to the first-commit SHA
|
|
16
|
+
* when no remote exists. Returns null when no identity is derivable — not
|
|
17
|
+
* a git repository, or a shallow clone without a remote.
|
|
18
|
+
*/
|
|
19
|
+
export declare function deriveRepoKey(directory: string): string | null;
|
|
20
|
+
export declare function computeRepoKey(identity: string, relativePath: string): string;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateWorkspaceId = generateWorkspaceId;
|
|
4
|
+
exports.deriveRepoKey = deriveRepoKey;
|
|
5
|
+
exports.computeRepoKey = computeRepoKey;
|
|
6
|
+
const crypto_1 = require("crypto");
|
|
7
|
+
const git_utils_1 = require("./git-utils");
|
|
8
|
+
/**
|
|
9
|
+
* The workspace's analytics identity: the Nx Cloud id when the workspace has
|
|
10
|
+
* one (most stable — it survives repo moves and renames), else the repo key.
|
|
11
|
+
* Null when neither is available, in which case nothing is reported.
|
|
12
|
+
*/
|
|
13
|
+
function generateWorkspaceId(root, nxJson) {
|
|
14
|
+
const nxCloudId = nxJson?.nxCloudId ?? nxJson?.nxCloudAccessToken;
|
|
15
|
+
if (nxCloudId) {
|
|
16
|
+
return nxCloudId;
|
|
17
|
+
}
|
|
18
|
+
return deriveRepoKey(root);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Derive the stable, unsalted key identifying this workspace in the
|
|
22
|
+
* repoTelemetry registry: `sha256(<repo identity> + '#' + <workspace path
|
|
23
|
+
* relative to the git root>)`.
|
|
24
|
+
*
|
|
25
|
+
* The repo identity is the normalized `domain/slug` from the git remote
|
|
26
|
+
* (protocol-independent: ssh, https, and token-authenticated URLs of the
|
|
27
|
+
* same repo produce the same key), falling back to the first-commit SHA
|
|
28
|
+
* when no remote exists. Returns null when no identity is derivable — not
|
|
29
|
+
* a git repository, or a shallow clone without a remote.
|
|
30
|
+
*/
|
|
31
|
+
function deriveRepoKey(directory) {
|
|
32
|
+
const identity = getRepoIdentity(directory);
|
|
33
|
+
if (!identity) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
return computeRepoKey(identity, (0, git_utils_1.getGitRootRelativePath)(directory) ?? '');
|
|
37
|
+
}
|
|
38
|
+
function computeRepoKey(identity, relativePath) {
|
|
39
|
+
return (0, crypto_1.createHash)('sha256')
|
|
40
|
+
.update(`${identity}#${relativePath}`)
|
|
41
|
+
.digest('hex');
|
|
42
|
+
}
|
|
43
|
+
function getRepoIdentity(directory) {
|
|
44
|
+
const remote = (0, git_utils_1.getVcsRemoteInfo)(directory);
|
|
45
|
+
if (remote) {
|
|
46
|
+
// Hosts route case-insensitively and hold one canonical casing, so a
|
|
47
|
+
// hand-typed remote must key the same as the canonical one the claim
|
|
48
|
+
// flow derives from the host's API.
|
|
49
|
+
return `${remote.domain}/${remote.slug}`.toLowerCase().replace(/\/+$/, '');
|
|
50
|
+
}
|
|
51
|
+
// Without a remote the first commit is the only stable identity, and a
|
|
52
|
+
// shallow clone doesn't have a real one.
|
|
53
|
+
return (0, git_utils_1.isShallowRepository)(directory) ? null : (0, git_utils_1.getFirstCommitSha)(directory);
|
|
54
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type JsonWriteOptions } from './fileutils';
|
|
2
2
|
/**
|
|
3
|
-
* Writes a JSON file, formatting with
|
|
4
|
-
* falling back to standard JSON serialization
|
|
3
|
+
* Writes a JSON file, formatting it with whichever formatter the workspace is
|
|
4
|
+
* configured for, and falling back to standard JSON serialization when there
|
|
5
|
+
* is none or it cannot format the file.
|
|
5
6
|
*/
|
|
6
7
|
export declare function writeFormattedJsonFile<T extends object = object>(filePath: string, content: T, options?: JsonWriteOptions): Promise<void>;
|
|
@@ -2,16 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.writeFormattedJsonFile = writeFormattedJsonFile;
|
|
4
4
|
const node_fs_1 = require("node:fs");
|
|
5
|
-
const
|
|
5
|
+
const format_changed_files_1 = require("../generators/internal-utils/format-changed-files");
|
|
6
6
|
const json_1 = require("./json");
|
|
7
7
|
const fileutils_1 = require("./fileutils");
|
|
8
8
|
const workspace_root_1 = require("./workspace-root");
|
|
9
9
|
/**
|
|
10
|
-
* Writes a JSON file, formatting with
|
|
11
|
-
* falling back to standard JSON serialization
|
|
10
|
+
* Writes a JSON file, formatting it with whichever formatter the workspace is
|
|
11
|
+
* configured for, and falling back to standard JSON serialization when there
|
|
12
|
+
* is none or it cannot format the file.
|
|
12
13
|
*/
|
|
13
14
|
async function writeFormattedJsonFile(filePath, content, options) {
|
|
14
|
-
const formattedContent = await (0,
|
|
15
|
+
const formattedContent = await (0, format_changed_files_1.formatFileContents)([{ path: filePath, content: (0, json_1.serializeJson)(content) }], workspace_root_1.workspaceRoot, { silent: true });
|
|
15
16
|
if (formattedContent.has(filePath)) {
|
|
16
17
|
(0, node_fs_1.writeFileSync)(filePath, formattedContent.get(filePath), {
|
|
17
18
|
encoding: 'utf-8',
|
package/migrations.json
CHANGED
|
@@ -184,6 +184,12 @@
|
|
|
184
184
|
"version": "23.0.0-beta.18",
|
|
185
185
|
"description": "Adds .nx/migrate-runs to .gitignore",
|
|
186
186
|
"implementation": "./dist/src/migrations/update-23-0-0/add-migrate-runs-to-git-ignore"
|
|
187
|
+
},
|
|
188
|
+
"23-2-0-set-cache-on-executor-target-defaults": {
|
|
189
|
+
"version": "23.2.0-beta.8",
|
|
190
|
+
"description": "Sets \"cache\" on some executor-based target defaults whose caching was previously enabled by a target name default, maintaining compatibility with how cacheability resolved before Nx 23. Keys the migration cannot decide are left alone and keep working through a deprecated runtime fallback.",
|
|
191
|
+
"implementation": "./dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults",
|
|
192
|
+
"documentation": "./dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.md"
|
|
187
193
|
}
|
|
188
194
|
}
|
|
189
195
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nx",
|
|
3
|
-
"version": "23.2.0-beta.
|
|
3
|
+
"version": "23.2.0-beta.11",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
|
|
@@ -47,6 +47,8 @@
|
|
|
47
47
|
},
|
|
48
48
|
"homepage": "https://nx.dev",
|
|
49
49
|
"dependencies": {
|
|
50
|
+
"@clack/core": "1.4.3",
|
|
51
|
+
"@clack/prompts": "1.7.0",
|
|
50
52
|
"@emnapi/core": "1.4.5",
|
|
51
53
|
"@emnapi/runtime": "1.4.5",
|
|
52
54
|
"@emnapi/wasi-threads": "1.0.4",
|
|
@@ -56,17 +58,17 @@
|
|
|
56
58
|
"@yarnpkg/lockfile": "1.1.0",
|
|
57
59
|
"@zkochan/js-yaml": "0.0.7",
|
|
58
60
|
"agent-base": "6.0.2",
|
|
59
|
-
"ansi-colors": "4.1.3",
|
|
60
61
|
"ansi-regex": "5.0.1",
|
|
61
62
|
"ansi-styles": "4.3.0",
|
|
62
63
|
"argparse": "2.0.1",
|
|
63
64
|
"asynckit": "0.4.0",
|
|
64
|
-
"axios": "1.
|
|
65
|
+
"axios": "1.18.1",
|
|
65
66
|
"balanced-match": "4.0.3",
|
|
66
67
|
"base64-js": "1.5.1",
|
|
67
68
|
"bl": "4.1.0",
|
|
68
|
-
"brace-expansion": "5.0.
|
|
69
|
+
"brace-expansion": "5.0.9",
|
|
69
70
|
"buffer": "5.7.1",
|
|
71
|
+
"bundle-name": "4.1.0",
|
|
70
72
|
"call-bind-apply-helpers": "1.0.2",
|
|
71
73
|
"chalk": "4.1.2",
|
|
72
74
|
"cli-cursor": "3.1.0",
|
|
@@ -77,8 +79,10 @@
|
|
|
77
79
|
"color-name": "1.1.4",
|
|
78
80
|
"combined-stream": "1.0.8",
|
|
79
81
|
"debug": "4.4.3",
|
|
82
|
+
"default-browser": "5.2.1",
|
|
83
|
+
"default-browser-id": "5.0.0",
|
|
80
84
|
"defaults": "1.0.4",
|
|
81
|
-
"define-lazy-prop": "
|
|
85
|
+
"define-lazy-prop": "3.0.0",
|
|
82
86
|
"delayed-stream": "1.0.0",
|
|
83
87
|
"dotenv": "16.4.7",
|
|
84
88
|
"dotenv-expand": "12.0.3",
|
|
@@ -86,13 +90,15 @@
|
|
|
86
90
|
"ejs": "5.0.1",
|
|
87
91
|
"emoji-regex": "8.0.0",
|
|
88
92
|
"end-of-stream": "1.4.5",
|
|
89
|
-
"enquirer": "2.3.6",
|
|
90
93
|
"es-define-property": "1.0.1",
|
|
91
94
|
"es-errors": "1.3.0",
|
|
92
95
|
"es-object-atoms": "1.1.1",
|
|
93
96
|
"es-set-tostringtag": "2.1.0",
|
|
94
97
|
"escalade": "3.2.0",
|
|
95
98
|
"escape-string-regexp": "1.0.5",
|
|
99
|
+
"fast-string-truncated-width": "3.0.3",
|
|
100
|
+
"fast-string-width": "3.0.2",
|
|
101
|
+
"fast-wrap-ansi": "0.2.0",
|
|
96
102
|
"figures": "3.2.0",
|
|
97
103
|
"flat": "5.0.2",
|
|
98
104
|
"follow-redirects": "1.16.0",
|
|
@@ -111,11 +117,12 @@
|
|
|
111
117
|
"ieee754": "1.2.1",
|
|
112
118
|
"ignore": "7.0.5",
|
|
113
119
|
"inherits": "2.0.4",
|
|
114
|
-
"is-docker": "
|
|
120
|
+
"is-docker": "3.0.0",
|
|
115
121
|
"is-fullwidth-code-point": "3.0.0",
|
|
122
|
+
"is-inside-container": "1.0.0",
|
|
116
123
|
"is-interactive": "1.0.0",
|
|
117
124
|
"is-unicode-supported": "0.1.0",
|
|
118
|
-
"is-wsl": "
|
|
125
|
+
"is-wsl": "3.1.0",
|
|
119
126
|
"isexe": "2.0.0",
|
|
120
127
|
"json5": "2.2.3",
|
|
121
128
|
"jsonc-parser": "3.3.1",
|
|
@@ -131,7 +138,7 @@
|
|
|
131
138
|
"npm-run-path": "4.0.1",
|
|
132
139
|
"once": "1.4.0",
|
|
133
140
|
"onetime": "5.1.2",
|
|
134
|
-
"open": "
|
|
141
|
+
"open": "10.1.0",
|
|
135
142
|
"ora": "5.4.1",
|
|
136
143
|
"path-key": "3.1.1",
|
|
137
144
|
"picocolors": "1.1.1",
|
|
@@ -140,9 +147,11 @@
|
|
|
140
147
|
"require-directory": "2.1.1",
|
|
141
148
|
"resolve.exports": "2.0.3",
|
|
142
149
|
"restore-cursor": "3.1.0",
|
|
150
|
+
"run-applescript": "7.0.0",
|
|
143
151
|
"safe-buffer": "5.2.1",
|
|
144
152
|
"semver": "7.8.4",
|
|
145
153
|
"signal-exit": "3.0.7",
|
|
154
|
+
"sisteransi": "1.0.5",
|
|
146
155
|
"smol-toml": "1.6.1",
|
|
147
156
|
"string-width": "4.2.3",
|
|
148
157
|
"string_decoder": "1.3.0",
|
|
@@ -176,16 +185,16 @@
|
|
|
176
185
|
}
|
|
177
186
|
},
|
|
178
187
|
"optionalDependencies": {
|
|
179
|
-
"@nx/nx-darwin-arm64": "23.2.0-beta.
|
|
180
|
-
"@nx/nx-darwin-x64": "23.2.0-beta.
|
|
181
|
-
"@nx/nx-freebsd-x64": "23.2.0-beta.
|
|
182
|
-
"@nx/nx-linux-arm-gnueabihf": "23.2.0-beta.
|
|
183
|
-
"@nx/nx-linux-arm64-gnu": "23.2.0-beta.
|
|
184
|
-
"@nx/nx-linux-arm64-musl": "23.2.0-beta.
|
|
185
|
-
"@nx/nx-linux-x64-gnu": "23.2.0-beta.
|
|
186
|
-
"@nx/nx-linux-x64-musl": "23.2.0-beta.
|
|
187
|
-
"@nx/nx-win32-arm64-msvc": "23.2.0-beta.
|
|
188
|
-
"@nx/nx-win32-x64-msvc": "23.2.0-beta.
|
|
188
|
+
"@nx/nx-darwin-arm64": "23.2.0-beta.11",
|
|
189
|
+
"@nx/nx-darwin-x64": "23.2.0-beta.11",
|
|
190
|
+
"@nx/nx-freebsd-x64": "23.2.0-beta.11",
|
|
191
|
+
"@nx/nx-linux-arm-gnueabihf": "23.2.0-beta.11",
|
|
192
|
+
"@nx/nx-linux-arm64-gnu": "23.2.0-beta.11",
|
|
193
|
+
"@nx/nx-linux-arm64-musl": "23.2.0-beta.11",
|
|
194
|
+
"@nx/nx-linux-x64-gnu": "23.2.0-beta.11",
|
|
195
|
+
"@nx/nx-linux-x64-musl": "23.2.0-beta.11",
|
|
196
|
+
"@nx/nx-win32-arm64-msvc": "23.2.0-beta.11",
|
|
197
|
+
"@nx/nx-win32-x64-msvc": "23.2.0-beta.11"
|
|
189
198
|
},
|
|
190
199
|
"nx-migrations": {
|
|
191
200
|
"migrations": "./migrations.json",
|
|
@@ -213,6 +222,7 @@
|
|
|
213
222
|
"@nx/next",
|
|
214
223
|
"@nx/node",
|
|
215
224
|
"@nx/nuxt",
|
|
225
|
+
"@nx/oxlint",
|
|
216
226
|
"@nx/playwright",
|
|
217
227
|
"@nx/plugin",
|
|
218
228
|
"@nx/react",
|
package/dist/src/generators/internal-utils/format-changed-files-with-prettier-if-available.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { Tree } from '../tree';
|
|
2
|
-
/**
|
|
3
|
-
* Formats all the created or updated files using Prettier
|
|
4
|
-
* @param tree - the file system tree
|
|
5
|
-
*
|
|
6
|
-
* @remarks
|
|
7
|
-
* Set the environment variable `NX_SKIP_FORMAT` to `true` to skip Prettier
|
|
8
|
-
* formatting. This is useful for repositories that use alternative formatters
|
|
9
|
-
* like Biome, dprint, or have custom formatting requirements.
|
|
10
|
-
*/
|
|
11
|
-
export declare function formatChangedFilesWithPrettierIfAvailable(tree: Tree, options?: {
|
|
12
|
-
silent?: boolean;
|
|
13
|
-
}): Promise<void>;
|
|
14
|
-
export declare function formatFilesWithPrettierIfAvailable(files: {
|
|
15
|
-
path: string;
|
|
16
|
-
content: string | Buffer;
|
|
17
|
-
}[], root: string, options?: {
|
|
18
|
-
silent?: boolean;
|
|
19
|
-
}): Promise<Map<string, string>>;
|
package/dist/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatChangedFilesWithPrettierIfAvailable = formatChangedFilesWithPrettierIfAvailable;
|
|
4
|
-
exports.formatFilesWithPrettierIfAvailable = formatFilesWithPrettierIfAvailable;
|
|
5
|
-
const tslib_1 = require("tslib");
|
|
6
|
-
const path = tslib_1.__importStar(require("path"));
|
|
7
|
-
const is_using_prettier_1 = require("../../utils/is-using-prettier");
|
|
8
|
-
const installation_directory_1 = require("../../utils/installation-directory");
|
|
9
|
-
/**
|
|
10
|
-
* Formats all the created or updated files using Prettier
|
|
11
|
-
* @param tree - the file system tree
|
|
12
|
-
*
|
|
13
|
-
* @remarks
|
|
14
|
-
* Set the environment variable `NX_SKIP_FORMAT` to `true` to skip Prettier
|
|
15
|
-
* formatting. This is useful for repositories that use alternative formatters
|
|
16
|
-
* like Biome, dprint, or have custom formatting requirements.
|
|
17
|
-
*/
|
|
18
|
-
async function formatChangedFilesWithPrettierIfAvailable(tree, options) {
|
|
19
|
-
if (process.env.NX_SKIP_FORMAT === 'true') {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
const files = new Set(tree.listChanges().filter((file) => file.type !== 'DELETE'));
|
|
23
|
-
const results = await formatFilesWithPrettierIfAvailable(Array.from(files), tree.root, options);
|
|
24
|
-
for (const [path, content] of results) {
|
|
25
|
-
tree.write(path, content);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
async function formatFilesWithPrettierIfAvailable(files, root, options) {
|
|
29
|
-
const results = new Map();
|
|
30
|
-
// Check here as well for direct callers of this function
|
|
31
|
-
if (process.env.NX_SKIP_FORMAT === 'true') {
|
|
32
|
-
return results;
|
|
33
|
-
}
|
|
34
|
-
let prettier;
|
|
35
|
-
try {
|
|
36
|
-
const prettierPath = require.resolve('prettier', {
|
|
37
|
-
paths: [...(0, installation_directory_1.getNxRequirePaths)(root), __dirname],
|
|
38
|
-
});
|
|
39
|
-
prettier = require(prettierPath);
|
|
40
|
-
/**
|
|
41
|
-
* Even after we discovered prettier in node_modules, we need to be sure that the user is intentionally using prettier
|
|
42
|
-
* before proceeding to format with it.
|
|
43
|
-
*/
|
|
44
|
-
if (!(0, is_using_prettier_1.isUsingPrettier)(root)) {
|
|
45
|
-
return results;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
catch { }
|
|
49
|
-
if (!prettier) {
|
|
50
|
-
return results;
|
|
51
|
-
}
|
|
52
|
-
await Promise.all(Array.from(files).map(async (file) => {
|
|
53
|
-
try {
|
|
54
|
-
const systemPath = path.join(root, file.path);
|
|
55
|
-
let options = {
|
|
56
|
-
filepath: systemPath,
|
|
57
|
-
};
|
|
58
|
-
const resolvedOptions = await prettier.resolveConfig(systemPath, {
|
|
59
|
-
editorconfig: true,
|
|
60
|
-
});
|
|
61
|
-
if (!resolvedOptions) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
options = {
|
|
65
|
-
...options,
|
|
66
|
-
...resolvedOptions,
|
|
67
|
-
};
|
|
68
|
-
const support = await prettier.getFileInfo(systemPath, options);
|
|
69
|
-
if (support.ignored || !support.inferredParser) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
results.set(file.path, await prettier.format(file.content.toString('utf-8'), options));
|
|
73
|
-
}
|
|
74
|
-
catch (e) {
|
|
75
|
-
if (!options?.silent) {
|
|
76
|
-
console.warn(`Could not format ${file.path}. Error: "${e.message}"`);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}));
|
|
80
|
-
return results;
|
|
81
|
-
}
|