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
package/dist/src/utils/ignore.js
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OXFMT_IGNORE_OPTIONS = void 0;
|
|
3
4
|
exports.getIgnoreObject = getIgnoreObject;
|
|
4
|
-
exports.
|
|
5
|
+
exports.createIgnoreChainResolver = createIgnoreChainResolver;
|
|
6
|
+
exports.isIgnoredByChain = isIgnoredByChain;
|
|
7
|
+
exports.createAncestorAwareIgnoreChecker = createAncestorAwareIgnoreChecker;
|
|
8
|
+
exports.isAlwaysIgnored = isAlwaysIgnored;
|
|
9
|
+
exports.createGitIgnoreChecker = createGitIgnoreChecker;
|
|
10
|
+
exports.createPrettierIgnoreChecker = createPrettierIgnoreChecker;
|
|
11
|
+
exports.createOxfmtIgnoreChecker = createOxfmtIgnoreChecker;
|
|
12
|
+
exports.posixDirname = posixDirname;
|
|
5
13
|
exports.addEntryToGitIgnore = addEntryToGitIgnore;
|
|
6
14
|
const ignore = require("ignore");
|
|
15
|
+
const index_1 = require("../native/index");
|
|
7
16
|
const fileutils_1 = require("./fileutils");
|
|
8
17
|
const workspace_root_1 = require("./workspace-root");
|
|
9
18
|
function getIgnoreObject(root = workspace_root_1.workspaceRoot) {
|
|
@@ -12,18 +21,261 @@ function getIgnoreObject(root = workspace_root_1.workspaceRoot) {
|
|
|
12
21
|
ig.add((0, fileutils_1.readFileIfExisting)(`${root}/.nxignore`));
|
|
13
22
|
return ig;
|
|
14
23
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Resolves the ignore files that apply to a directory: its own and every one
|
|
26
|
+
* above it, up to the workspace root.
|
|
27
|
+
*
|
|
28
|
+
* Ignore files cascade - a `.gitignore` covers its own directory and below, and
|
|
29
|
+
* its patterns are relative to *itself*, not to the workspace root. Reading only
|
|
30
|
+
* the root file, which is what `getIgnoreObject` does, silently misses every
|
|
31
|
+
* nested one.
|
|
32
|
+
*
|
|
33
|
+
* A directory's answer is its own files plus its parent's, so every directory on
|
|
34
|
+
* the way up is memoized rather than only the one asked for: sibling leaves
|
|
35
|
+
* share the whole trunk, and a later walk stops at the first directory already
|
|
36
|
+
* known.
|
|
37
|
+
*
|
|
38
|
+
* `read` decides where the files come from - `tree.read` for a generator, disk
|
|
39
|
+
* for a caller with no tree - and returns an empty string or null when there is
|
|
40
|
+
* no such file. Paths handed to it are workspace-relative POSIX.
|
|
41
|
+
*
|
|
42
|
+
* `merge` decides how the files *within one directory* relate, and the two
|
|
43
|
+
* consumers genuinely need different rules:
|
|
44
|
+
*
|
|
45
|
+
* - `false` is prettier's: one matcher per file, any of them excluding wins, and
|
|
46
|
+
* a negation counts only if none excluded. `createIsIgnoredFunction` builds an
|
|
47
|
+
* ignorer per `--ignore-path` and ORs them, so a `!x` in `.prettierignore`
|
|
48
|
+
* cannot re-include an `x` that `.gitignore` excluded.
|
|
49
|
+
* - `true` is git's and the native walker's: all files in one matcher, so
|
|
50
|
+
* `.nxignore`'s `!x` removes `.gitignore`'s exclusion of `x` outright. It has
|
|
51
|
+
* to be a merge rather than a precedence check between separate matchers,
|
|
52
|
+
* because a lone `!x` in its own matcher reports an opinion on `x/` but *none*
|
|
53
|
+
* on `x/a.ts` (measured), so the exclusion would still reach the children.
|
|
54
|
+
* The merge only removes the exclusion within that one directory - a negation
|
|
55
|
+
* in a nested file still loses to an ancestor's exclusion.
|
|
56
|
+
*
|
|
57
|
+
* When `merge` is true, `filenames` order matters: they go into one matcher in
|
|
58
|
+
* order and the last matching pattern decides, so list them lowest-authority
|
|
59
|
+
* first.
|
|
60
|
+
*/
|
|
61
|
+
function createIgnoreChainResolver(read, filenames, merge) {
|
|
62
|
+
const cache = new Map();
|
|
63
|
+
const resolve = (dir) => {
|
|
64
|
+
const cached = cache.get(dir);
|
|
65
|
+
if (cached) {
|
|
66
|
+
return cached;
|
|
67
|
+
}
|
|
68
|
+
const contents = filenames
|
|
69
|
+
.map((name) => read(dir ? `${dir}/${name}` : name))
|
|
70
|
+
.filter((c) => !!c);
|
|
71
|
+
const matchers = merge
|
|
72
|
+
? contents.length > 0
|
|
73
|
+
? [contents.reduce((m, c) => m.add(c), ignore())]
|
|
74
|
+
: []
|
|
75
|
+
: contents.map((c) => ignore().add(c));
|
|
76
|
+
const inherited = dir === '' ? [] : resolve(posixDirname(dir));
|
|
77
|
+
const chain = matchers.length > 0 ? [{ dir, matchers }, ...inherited] : inherited;
|
|
78
|
+
cache.set(dir, chain);
|
|
79
|
+
return chain;
|
|
80
|
+
};
|
|
81
|
+
return resolve;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* True when the file is ignored, resolving the chain nearest file first.
|
|
85
|
+
*
|
|
86
|
+
* Each matcher is tested against the path relative to its own directory, which
|
|
87
|
+
* is what makes a nested pattern like `/build` mean that directory's `build`
|
|
88
|
+
* rather than the workspace's.
|
|
89
|
+
*
|
|
90
|
+
* Nearest directory with an *opinion* wins, not the first match: a nested
|
|
91
|
+
* `!keep.log` must override the root's `*.log`, which is git's rule for files.
|
|
92
|
+
* A nested negation of a *directory* does not reach its children - see the
|
|
93
|
+
* `merge` note on `createIgnoreChainResolver`.
|
|
94
|
+
*
|
|
95
|
+
* How the files of one directory relate is decided when the chain is built - see
|
|
96
|
+
* that same note. Here they are simply the entry's matchers: any one excluding
|
|
97
|
+
* wins, and a negation counts only if none excluded.
|
|
98
|
+
*
|
|
99
|
+
* Two preconditions, neither enforced here:
|
|
100
|
+
*
|
|
101
|
+
* - `filePath` is workspace-relative POSIX and must sit under every `dir` in the
|
|
102
|
+
* chain, which holds when the chain came from that file's own directory.
|
|
103
|
+
* - No ancestor directory of `filePath` may itself be ignored. git refuses to
|
|
104
|
+
* re-include a file inside an excluded directory, and this does not implement
|
|
105
|
+
* that rule: asked directly about `dist/keep.ts` with a root `dist/` and a
|
|
106
|
+
* nested `dist/.gitignore` holding `!keep.ts`, it answers "not ignored" where
|
|
107
|
+
* git says ignored (measured). A pruning walk like `visitNotIgnoredFiles`
|
|
108
|
+
* satisfies it by never asking about anything under `dist/`; a per-file
|
|
109
|
+
* caller cannot, so it goes through `createAncestorAwareIgnoreChecker`,
|
|
110
|
+
* which checks the ancestors before asking the chain.
|
|
111
|
+
*/
|
|
112
|
+
function isIgnoredByChain(chain, filePath) {
|
|
113
|
+
for (const { dir, matchers } of chain) {
|
|
114
|
+
const relative = dir === '' ? filePath : filePath.slice(dir.length + 1);
|
|
115
|
+
let unignored = false;
|
|
116
|
+
for (const matcher of matchers) {
|
|
117
|
+
const result = matcher.test(relative);
|
|
118
|
+
if (result.ignored) {
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
unignored ||= result.unignored;
|
|
122
|
+
}
|
|
123
|
+
if (unignored) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
21
126
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* The chain's answers plus git's excluded-ancestor rule: nothing inside an
|
|
131
|
+
* ignored directory can be re-included, so a nested negation must not
|
|
132
|
+
* resurrect a file whose ancestor an outer file excluded - the case
|
|
133
|
+
* `isIgnoredByChain` alone gets wrong (see its second precondition). The
|
|
134
|
+
* oxfmt CLI follows the same rule (measured against 0.60.0: a scan skips a
|
|
135
|
+
* nested `!keep.ts` under a root-ignored `dist/`), so every per-file caller -
|
|
136
|
+
* the cascading tree checkers and the disk-backed resolver in
|
|
137
|
+
* `formatters/oxfmt.ts` - goes through here.
|
|
138
|
+
*
|
|
139
|
+
* A directory's own ignore files cannot un-ignore the directory itself, so
|
|
140
|
+
* its verdict comes from its parent's chain - probed with a trailing slash,
|
|
141
|
+
* which is what makes a directory-only pattern like `dist/` match. Verdicts
|
|
142
|
+
* are memoized per directory, so a batch of files shares its ancestor walks.
|
|
143
|
+
*/
|
|
144
|
+
function createAncestorAwareIgnoreChecker(resolve) {
|
|
145
|
+
const ignoredDirs = new Map();
|
|
146
|
+
const isIgnoredDirectory = (dir) => {
|
|
147
|
+
if (dir === '') {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
const cached = ignoredDirs.get(dir);
|
|
151
|
+
if (cached !== undefined) {
|
|
152
|
+
return cached;
|
|
153
|
+
}
|
|
154
|
+
const parent = posixDirname(dir);
|
|
155
|
+
const ignored = isIgnoredDirectory(parent) ||
|
|
156
|
+
isIgnoredByChain(resolve(parent), `${dir}/`);
|
|
157
|
+
ignoredDirs.set(dir, ignored);
|
|
158
|
+
return ignored;
|
|
159
|
+
};
|
|
160
|
+
return {
|
|
161
|
+
isIgnoredFile: (filePath) => {
|
|
162
|
+
const dir = posixDirname(filePath);
|
|
163
|
+
return (isIgnoredDirectory(dir) || isIgnoredByChain(resolve(dir), filePath));
|
|
164
|
+
},
|
|
165
|
+
isIgnoredDirectory,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
let alwaysIgnored;
|
|
169
|
+
/**
|
|
170
|
+
* Directories that should never be walked, whatever the workspace's own ignore
|
|
171
|
+
* files say - `node_modules`, `.git`, the nx caches.
|
|
172
|
+
*
|
|
173
|
+
* The list comes from the native walker rather than a second copy here, so a
|
|
174
|
+
* filesystem walk and a tree walk cannot drift apart.
|
|
175
|
+
*
|
|
176
|
+
* Checked ahead of the cascading chain rather than folded into it: these are not
|
|
177
|
+
* re-includable, and as ordinary patterns a nested negation could resurrect
|
|
178
|
+
* `node_modules`.
|
|
179
|
+
*/
|
|
180
|
+
function isAlwaysIgnored(path) {
|
|
181
|
+
alwaysIgnored ??= ignore().add((0, index_1.getHardcodedIgnorePatterns)());
|
|
182
|
+
return alwaysIgnored.ignores(path);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* What git ignores, which is also what the native walker ignores.
|
|
186
|
+
*
|
|
187
|
+
* `.nxignore` outranks `.gitignore` - `walker.rs` registers it with
|
|
188
|
+
* `add_custom_ignore_filename` - which a merge with `.nxignore` last reproduces.
|
|
189
|
+
* git itself does not read it.
|
|
190
|
+
*
|
|
191
|
+
* Reads from the tree rather than disk because a generator can create or amend
|
|
192
|
+
* an ignore file in the same run, which would leave the on-disk copy stale.
|
|
193
|
+
*/
|
|
194
|
+
function createGitIgnoreChecker(tree) {
|
|
195
|
+
return createTreeIgnoreChecker(tree, {
|
|
196
|
+
filenames: ['.gitignore', '.nxignore'],
|
|
197
|
+
cascade: true,
|
|
198
|
+
merge: true,
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* What prettier ignores: the workspace root only, and one ignorer per
|
|
203
|
+
* `--ignore-path` ORed rather than merged (both measured), so a `!` in
|
|
204
|
+
* `.prettierignore` cannot re-include what `.gitignore` excluded. That is the
|
|
205
|
+
* CLI `nx format:check` shells out to.
|
|
206
|
+
*
|
|
207
|
+
* Not an exact match for that command: `isAlwaysIgnored` is wider than
|
|
208
|
+
* prettier's built-ins, and `format.ts` filters its own patterns through
|
|
209
|
+
* `.nxignore`, which this does not read.
|
|
210
|
+
*
|
|
211
|
+
* Reads from the tree rather than disk, as above.
|
|
212
|
+
*/
|
|
213
|
+
function createPrettierIgnoreChecker(tree) {
|
|
214
|
+
return createTreeIgnoreChecker(tree, {
|
|
215
|
+
filenames: ['.gitignore', '.prettierignore'],
|
|
216
|
+
cascade: false,
|
|
217
|
+
merge: false,
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* What oxfmt ignores: prettier's two files, but resolved from each file's own
|
|
222
|
+
* directory upwards rather than the workspace root - measured against the
|
|
223
|
+
* oxfmt 0.60.0 CLI, which differs from prettier on exactly that axis. Still
|
|
224
|
+
* one matcher per file rather than merged.
|
|
225
|
+
*
|
|
226
|
+
* A config's `ignorePatterns` is not an ignore file and is not read here;
|
|
227
|
+
* `formatFilesWithOxfmt` applies it rooted at that config's directory.
|
|
228
|
+
*/
|
|
229
|
+
function createOxfmtIgnoreChecker(tree) {
|
|
230
|
+
return createTreeIgnoreChecker(tree, exports.OXFMT_IGNORE_OPTIONS);
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Exported, unlike git's and prettier's, because oxfmt has two consumers:
|
|
234
|
+
* this tree-backed checker and the disk-backed resolver in
|
|
235
|
+
* `formatters/oxfmt.ts`. A shared value is the only thing that keeps them
|
|
236
|
+
* agreeing, so do not restate these three anywhere.
|
|
237
|
+
*
|
|
238
|
+
* `satisfies` rather than an annotation keeps the values literal - an
|
|
239
|
+
* annotation widens `cascade` and `merge` to `boolean` (measured in the
|
|
240
|
+
* declaration emit).
|
|
241
|
+
*/
|
|
242
|
+
exports.OXFMT_IGNORE_OPTIONS = {
|
|
243
|
+
filenames: ['.gitignore', '.prettierignore'],
|
|
244
|
+
cascade: true,
|
|
245
|
+
merge: false,
|
|
246
|
+
};
|
|
247
|
+
function createTreeIgnoreChecker(tree, { filenames, cascade, merge }) {
|
|
248
|
+
const resolve = createIgnoreChainResolver((path) => tree.read(path, 'utf-8'), filenames, merge);
|
|
249
|
+
if (cascade) {
|
|
250
|
+
// Cascading resolution and the excluded-ancestor rule travel together:
|
|
251
|
+
// both come from git, and the one cascading tool that is not git - oxfmt -
|
|
252
|
+
// applies both (measured, see `createAncestorAwareIgnoreChecker`).
|
|
253
|
+
const checker = createAncestorAwareIgnoreChecker(resolve);
|
|
254
|
+
return {
|
|
255
|
+
isIgnoredFile: (path) => isAlwaysIgnored(path) || checker.isIgnoredFile(path),
|
|
256
|
+
// The trailing slash is what makes a directory-only pattern like `dist/`
|
|
257
|
+
// match - `ignore` will not match it against the bare `dist`.
|
|
258
|
+
isIgnoredDirectory: (path) => isAlwaysIgnored(`${path}/`) || checker.isIgnoredDirectory(path),
|
|
259
|
+
};
|
|
25
260
|
}
|
|
26
|
-
|
|
261
|
+
// Root-only: the whole chain is the root's, so no ancestor holds ignore
|
|
262
|
+
// files of its own, and within one matcher `ignore` itself refuses to
|
|
263
|
+
// re-include under an excluded directory (measured). Nothing is left for an
|
|
264
|
+
// ancestor walk to add.
|
|
265
|
+
const check = (probe) => isAlwaysIgnored(probe) || isIgnoredByChain(resolve(''), probe);
|
|
266
|
+
return {
|
|
267
|
+
isIgnoredFile: (path) => check(path),
|
|
268
|
+
isIgnoredDirectory: (path) => check(`${path}/`),
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* `path.dirname` for the workspace-relative POSIX paths the chain is keyed by,
|
|
273
|
+
* except that the workspace root is `''` rather than `.` - that is the key
|
|
274
|
+
* `createIgnoreChainResolver` terminates on.
|
|
275
|
+
*/
|
|
276
|
+
function posixDirname(relativePath) {
|
|
277
|
+
const separator = relativePath.lastIndexOf('/');
|
|
278
|
+
return separator === -1 ? '' : relativePath.slice(0, separator);
|
|
27
279
|
}
|
|
28
280
|
/**
|
|
29
281
|
* Adds an entry to a .gitignore file if it's not already covered by existing patterns.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ChildProcess } from 'node:child_process';
|
|
2
|
+
/**
|
|
3
|
+
* Kill `cp` (and its descendants) when this process exits, unless it has
|
|
4
|
+
* already exited on its own.
|
|
5
|
+
*/
|
|
6
|
+
export declare function killChildOnHostExit(cp: ChildProcess): void;
|
|
7
|
+
export declare function killTrackedChildren(): void;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.killChildOnHostExit = killChildOnHostExit;
|
|
4
|
+
exports.killTrackedChildren = killTrackedChildren;
|
|
5
|
+
const native_1 = require("../native");
|
|
6
|
+
// Children spawned by this process that must not outlive it. Plugin workers
|
|
7
|
+
// are torn down with `process.exit`, which leaves spawned build tools (gradle,
|
|
8
|
+
// maven, ...) orphaned and still holding their project locks.
|
|
9
|
+
const trackedChildren = new Set();
|
|
10
|
+
let exitHookRegistered = false;
|
|
11
|
+
/**
|
|
12
|
+
* Kill `cp` (and its descendants) when this process exits, unless it has
|
|
13
|
+
* already exited on its own.
|
|
14
|
+
*/
|
|
15
|
+
function killChildOnHostExit(cp) {
|
|
16
|
+
if (!cp.pid)
|
|
17
|
+
return;
|
|
18
|
+
trackedChildren.add(cp.pid);
|
|
19
|
+
const untrack = () => {
|
|
20
|
+
trackedChildren.delete(cp.pid);
|
|
21
|
+
// Whichever fires first, drop both — otherwise the other stays registered
|
|
22
|
+
// on a child that is already gone.
|
|
23
|
+
cp.off('exit', untrack);
|
|
24
|
+
cp.off('error', untrack);
|
|
25
|
+
};
|
|
26
|
+
cp.once('exit', untrack);
|
|
27
|
+
cp.once('error', untrack);
|
|
28
|
+
if (!exitHookRegistered) {
|
|
29
|
+
exitHookRegistered = true;
|
|
30
|
+
process.once('exit', killTrackedChildren);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function killTrackedChildren() {
|
|
34
|
+
for (const pid of trackedChildren) {
|
|
35
|
+
try {
|
|
36
|
+
// 'exit' handlers must be synchronous, so no graceful variant here.
|
|
37
|
+
(0, native_1.killProcessTree)(pid, 'SIGTERM');
|
|
38
|
+
}
|
|
39
|
+
catch { }
|
|
40
|
+
}
|
|
41
|
+
trackedChildren.clear();
|
|
42
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Target names the pre-23 `longRunningTask` guard excluded from caching. Shared
|
|
3
|
+
* between that guard and the deprecated target-name cache fallback so the two
|
|
4
|
+
* cannot drift apart.
|
|
5
|
+
*
|
|
6
|
+
* The copy in `migrations/update-23-2-0/set-cache-on-executor-target-defaults.ts`
|
|
7
|
+
* deliberately does not use this: a migration's decision has to freeze at the
|
|
8
|
+
* semantics it shipped with.
|
|
9
|
+
*/
|
|
10
|
+
export declare function isLongRunningTargetName(targetName: string): boolean;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isLongRunningTargetName = isLongRunningTargetName;
|
|
4
|
+
/**
|
|
5
|
+
* Target names the pre-23 `longRunningTask` guard excluded from caching. Shared
|
|
6
|
+
* between that guard and the deprecated target-name cache fallback so the two
|
|
7
|
+
* cannot drift apart.
|
|
8
|
+
*
|
|
9
|
+
* The copy in `migrations/update-23-2-0/set-cache-on-executor-target-defaults.ts`
|
|
10
|
+
* deliberately does not use this: a migration's decision has to freeze at the
|
|
11
|
+
* semantics it shipped with.
|
|
12
|
+
*/
|
|
13
|
+
function isLongRunningTargetName(targetName) {
|
|
14
|
+
return (targetName.endsWith(':watch') ||
|
|
15
|
+
targetName.endsWith('-watch') ||
|
|
16
|
+
targetName === 'serve' ||
|
|
17
|
+
targetName === 'dev' ||
|
|
18
|
+
targetName === 'start');
|
|
19
|
+
}
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.readBunPolicy = readBunPolicy;
|
|
4
4
|
exports.pickBunVersion = pickBunVersion;
|
|
5
|
-
const fs_1 = require("fs");
|
|
6
5
|
const path_1 = require("path");
|
|
7
6
|
const semver_1 = require("semver");
|
|
8
|
-
const
|
|
7
|
+
const bunfig_1 = require("../../package-manager-config/bunfig");
|
|
9
8
|
const constants_1 = require("../constants");
|
|
10
9
|
const errors_1 = require("../errors");
|
|
11
10
|
const pick_1 = require("../pick");
|
|
@@ -82,23 +81,20 @@ function readLocalBunInstall(root) {
|
|
|
82
81
|
return readBunInstall((0, path_1.join)(root, 'bunfig.toml'));
|
|
83
82
|
}
|
|
84
83
|
function readGlobalBunInstall() {
|
|
85
|
-
const
|
|
86
|
-
const base = xdg || process.env.HOME;
|
|
84
|
+
const base = (0, bunfig_1.getBunGlobalConfigBase)(process.env);
|
|
87
85
|
if (!base) {
|
|
88
86
|
return {};
|
|
89
87
|
}
|
|
90
88
|
return readBunInstall((0, path_1.join)(base, '.bunfig.toml'));
|
|
91
89
|
}
|
|
92
90
|
function readBunInstall(path) {
|
|
93
|
-
|
|
91
|
+
const parsed = (0, bunfig_1.readBunfigRaw)(path);
|
|
92
|
+
// bun skips a bunfig it cannot read and resolves on, so its settings do not
|
|
93
|
+
// apply. Only a parse failure kills the install.
|
|
94
|
+
if (parsed === null || parsed === 'unreadable') {
|
|
94
95
|
return {};
|
|
95
96
|
}
|
|
96
|
-
|
|
97
|
-
try {
|
|
98
|
-
parsed = (0, smol_toml_1.parse)((0, fs_1.readFileSync)(path, 'utf-8'));
|
|
99
|
-
}
|
|
100
|
-
catch {
|
|
101
|
-
// Unparseable bunfig makes bun's install die; treat as a hard error.
|
|
97
|
+
if (parsed === 'invalid') {
|
|
102
98
|
return 'error';
|
|
103
99
|
}
|
|
104
100
|
const install = parsed.install;
|
|
@@ -8,7 +8,7 @@ const path_1 = require("path");
|
|
|
8
8
|
const semver_1 = require("semver");
|
|
9
9
|
const constants_1 = require("../constants");
|
|
10
10
|
const errors_1 = require("../errors");
|
|
11
|
-
const npmrc_1 = require("
|
|
11
|
+
const npmrc_1 = require("../../package-manager-config/npmrc");
|
|
12
12
|
const pick_1 = require("../pick");
|
|
13
13
|
const RANK_UNKNOWN = 0; // global/builtin/default - not detectable here
|
|
14
14
|
const RANK_USER = 1;
|
|
@@ -116,7 +116,10 @@ function detectSurfaces(root, env) {
|
|
|
116
116
|
}
|
|
117
117
|
function readNpmrcKeys(override, fallback) {
|
|
118
118
|
const present = { minReleaseAge: false, before: false };
|
|
119
|
-
|
|
119
|
+
// npm silently treats an .npmrc it cannot read as absent, so both non-array
|
|
120
|
+
// states scan nothing.
|
|
121
|
+
const entries = (0, npmrc_1.readNpmrcEntries)(override ?? fallback);
|
|
122
|
+
for (const { key } of Array.isArray(entries) ? entries : []) {
|
|
120
123
|
if (key === 'min-release-age') {
|
|
121
124
|
present.minReleaseAge = true;
|
|
122
125
|
}
|
|
@@ -16,7 +16,7 @@ function toArray(value) {
|
|
|
16
16
|
* `dist-tags` carries a hyphen.
|
|
17
17
|
*/
|
|
18
18
|
async function fetchRegistryMetadata(pkg) {
|
|
19
|
-
const raw = await (0, package_manager_1.packageRegistryView)(pkg, '', '--json');
|
|
19
|
+
const raw = await (0, package_manager_1.packageRegistryView)(pkg, '', ['--json']);
|
|
20
20
|
const parsed = JSON.parse(raw);
|
|
21
21
|
const time = parsed.time ?? null;
|
|
22
22
|
if (time) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ensureNxConsoleInstalled = ensureNxConsoleInstalled;
|
|
4
|
-
const
|
|
4
|
+
const prompt_helpers_1 = require("./prompt-helpers");
|
|
5
5
|
const os_1 = require("os");
|
|
6
6
|
const output_1 = require("./output");
|
|
7
7
|
const native_1 = require("../native");
|
|
@@ -50,13 +50,10 @@ async function promptForNxConsoleInstallation() {
|
|
|
50
50
|
'- Explore your workspace visually',
|
|
51
51
|
],
|
|
52
52
|
});
|
|
53
|
-
|
|
54
|
-
type: 'confirm',
|
|
55
|
-
name: 'shouldInstallNxConsole',
|
|
53
|
+
return await (0, prompt_helpers_1.confirmationPrompt)({
|
|
56
54
|
message: 'Install Nx Console? (you can uninstall anytime)',
|
|
57
|
-
|
|
55
|
+
onCancel: () => false,
|
|
58
56
|
});
|
|
59
|
-
return shouldInstallNxConsole;
|
|
60
57
|
}
|
|
61
58
|
catch (error) {
|
|
62
59
|
return false;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stable root for Nx runtime artifacts that need an OS tmp location. On POSIX a
|
|
3
|
+
* literal `/tmp`, not `os.tmpdir()`, which honours `$TMPDIR` — per-user on
|
|
4
|
+
* macOS, rewritten by sandboxes, stripped from the daemon env, so client and
|
|
5
|
+
* daemon would disagree. Windows has no `/tmp`, and `%TMP%` is already per-user
|
|
6
|
+
* and stable, so it keeps `os.tmpdir()`.
|
|
7
|
+
*
|
|
8
|
+
* Consumed by the native binding loader, so keep this file limited to local
|
|
9
|
+
* helpers that themselves use Node builtins only.
|
|
10
|
+
*/
|
|
11
|
+
export declare const NX_TMP_DIR: string;
|
|
12
|
+
/**
|
|
13
|
+
* Owner-only runtime root for the current user. No user segment on Windows —
|
|
14
|
+
* `%TMP%` is already per-account, and the segment would only cost path length.
|
|
15
|
+
*/
|
|
16
|
+
export declare const NX_USER_TMP_DIR: string;
|
|
17
|
+
/** Runtime root under the user's home, used when the shared container cannot be established. */
|
|
18
|
+
export declare const NX_HOME_TMP_DIR: string;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NX_HOME_TMP_DIR = exports.NX_USER_TMP_DIR = exports.NX_TMP_DIR = void 0;
|
|
4
|
+
const node_os_1 = require("node:os");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const owned_private_dir_1 = require("./owned-private-dir");
|
|
7
|
+
/**
|
|
8
|
+
* Stable root for Nx runtime artifacts that need an OS tmp location. On POSIX a
|
|
9
|
+
* literal `/tmp`, not `os.tmpdir()`, which honours `$TMPDIR` — per-user on
|
|
10
|
+
* macOS, rewritten by sandboxes, stripped from the daemon env, so client and
|
|
11
|
+
* daemon would disagree. Windows has no `/tmp`, and `%TMP%` is already per-user
|
|
12
|
+
* and stable, so it keeps `os.tmpdir()`.
|
|
13
|
+
*
|
|
14
|
+
* Consumed by the native binding loader, so keep this file limited to local
|
|
15
|
+
* helpers that themselves use Node builtins only.
|
|
16
|
+
*/
|
|
17
|
+
exports.NX_TMP_DIR = (0, node_os_1.platform)() === 'win32' ? (0, node_path_1.join)((0, node_os_1.tmpdir)(), '.nx') : '/tmp/.nx';
|
|
18
|
+
/**
|
|
19
|
+
* Owner-only runtime root for the current user. No user segment on Windows —
|
|
20
|
+
* `%TMP%` is already per-account, and the segment would only cost path length.
|
|
21
|
+
*/
|
|
22
|
+
exports.NX_USER_TMP_DIR = (0, node_os_1.platform)() === 'win32' ? exports.NX_TMP_DIR : (0, node_path_1.join)(exports.NX_TMP_DIR, (0, owned_private_dir_1.getUserSegment)());
|
|
23
|
+
/** Runtime root under the user's home, used when the shared container cannot be established. */
|
|
24
|
+
exports.NX_HOME_TMP_DIR = resolveHomeTmpDir();
|
|
25
|
+
/**
|
|
26
|
+
* Absolute, not merely non-empty: a relative `$HOME` would make `join` return
|
|
27
|
+
* `.nx`, putting sockets under the cwd and aiming `removeSocketDir`'s recursive
|
|
28
|
+
* delete at it. A rootless container has no `$HOME` and no passwd entry, so
|
|
29
|
+
* `homedir()` throws or returns empty — caught here because this runs at module
|
|
30
|
+
* scope and the native binding loader imports this file.
|
|
31
|
+
*/
|
|
32
|
+
function resolveHomeTmpDir() {
|
|
33
|
+
try {
|
|
34
|
+
const home = (0, node_os_1.homedir)();
|
|
35
|
+
return home && (0, node_path_1.isAbsolute)(home) ? (0, node_path_1.join)(home, '.nx') : undefined;
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
}
|