nx 23.2.0-beta.0 → 23.2.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/init-local.js +3 -5
- package/dist/bin/nx.js +3 -1
- package/dist/release/changelog-renderer/index.js +4 -5
- package/dist/release/index.d.ts +1 -1
- package/dist/src/adapter/ngcli-adapter.js +60 -1
- package/dist/src/ai/set-up-ai-agents/set-up-ai-agents.js +35 -15
- package/dist/src/analytics/analytics.d.ts +6 -0
- package/dist/src/analytics/analytics.js +16 -10
- package/dist/src/analytics/index.d.ts +1 -1
- package/dist/src/analytics/index.js +2 -1
- package/dist/src/command-line/add/add.js +5 -0
- package/dist/src/command-line/affected/affected.js +1 -0
- package/dist/src/command-line/completion/command-object.js +7 -12
- package/dist/src/command-line/configure-ai-agents/configure-ai-agents.js +19 -25
- package/dist/src/command-line/format/format.js +84 -101
- package/dist/src/command-line/generate/generate.js +35 -35
- package/dist/src/command-line/graph/graph.d.ts +1 -0
- package/dist/src/command-line/graph/graph.js +15 -6
- package/dist/src/command-line/import/import.js +30 -40
- package/dist/src/command-line/init/ai-agent-prompts.d.ts +1 -1
- package/dist/src/command-line/init/ai-agent-prompts.js +12 -17
- package/dist/src/command-line/init/command-object.js +14 -4
- package/dist/src/command-line/init/configure-plugins.js +4 -1
- package/dist/src/command-line/init/implementation/add-nx-to-monorepo.js +12 -32
- package/dist/src/command-line/init/implementation/add-nx-to-nest.js +17 -21
- package/dist/src/command-line/init/implementation/add-nx-to-npm-repo.js +8 -21
- package/dist/src/command-line/init/implementation/add-nx-to-turborepo.js +3 -17
- package/dist/src/command-line/init/implementation/angular/index.js +10 -15
- package/dist/src/command-line/init/implementation/angular/integrated-workspace.js +2 -5
- package/dist/src/command-line/init/implementation/angular/legacy-angular-versions.js +5 -0
- package/dist/src/command-line/init/implementation/angular/standalone-workspace.js +8 -2
- package/dist/src/command-line/init/implementation/check-compatible-with-plugins.js +2 -0
- package/dist/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +9 -1
- package/dist/src/command-line/init/implementation/format.d.ts +18 -0
- package/dist/src/command-line/init/implementation/format.js +114 -0
- package/dist/src/command-line/init/implementation/utils.js +8 -0
- package/dist/src/command-line/init/init-v1.js +15 -18
- package/dist/src/command-line/init/init-v2.js +40 -57
- package/dist/src/command-line/migrate/agentic/definitions.js +36 -9
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +37 -22
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +30 -39
- package/dist/src/command-line/migrate/agentic/handoff.d.ts +7 -7
- package/dist/src/command-line/migrate/agentic/handoff.js +13 -10
- package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.d.ts +7 -12
- package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.js +7 -0
- package/dist/src/command-line/migrate/agentic/run-step.d.ts +10 -0
- package/dist/src/command-line/migrate/agentic/run-step.js +1 -0
- package/dist/src/command-line/migrate/agentic/runner.js +24 -24
- package/dist/src/command-line/migrate/agentic/select.d.ts +10 -2
- package/dist/src/command-line/migrate/agentic/select.js +30 -32
- package/dist/src/command-line/migrate/agentic/types.d.ts +33 -3
- package/dist/src/command-line/migrate/agentic/types.js +35 -0
- package/dist/src/command-line/migrate/command-object.d.ts +6 -0
- package/dist/src/command-line/migrate/command-object.js +19 -1
- package/dist/src/command-line/migrate/execute-migration.d.ts +91 -0
- package/dist/src/command-line/migrate/execute-migration.js +474 -0
- package/dist/src/command-line/migrate/migrate-analytics.d.ts +35 -0
- package/dist/src/command-line/migrate/migrate-analytics.js +64 -0
- package/dist/src/command-line/migrate/migrate-commits.d.ts +38 -8
- package/dist/src/command-line/migrate/migrate-commits.js +130 -15
- package/dist/src/command-line/migrate/migrate-config.d.ts +13 -12
- package/dist/src/command-line/migrate/migrate-config.js +22 -14
- package/dist/src/command-line/migrate/migrate-output.d.ts +45 -7
- package/dist/src/command-line/migrate/migrate-output.js +52 -8
- package/dist/src/command-line/migrate/migrate-ui-api.d.ts +2 -1
- package/dist/src/command-line/migrate/migrate-ui-api.js +33 -19
- package/dist/src/command-line/migrate/migrate.d.ts +29 -113
- package/dist/src/command-line/migrate/migrate.js +666 -664
- package/dist/src/command-line/migrate/migration-shape.d.ts +8 -0
- package/dist/src/command-line/migrate/multi-major.js +7 -10
- package/dist/src/command-line/migrate/resolve-package-version.js +4 -8
- package/dist/src/command-line/migrate/run/agent-output.d.ts +20 -0
- package/dist/src/command-line/migrate/run/agent-output.js +65 -0
- package/dist/src/command-line/migrate/run/index.d.ts +9 -0
- package/dist/src/command-line/migrate/run/index.js +23 -0
- package/dist/src/command-line/migrate/run/orchestrator.d.ts +20 -0
- package/dist/src/command-line/migrate/run/orchestrator.js +1200 -0
- package/dist/src/command-line/migrate/run/run-id.d.ts +16 -0
- package/dist/src/command-line/migrate/run/run-id.js +56 -0
- package/dist/src/command-line/migrate/run/run-state.d.ts +157 -0
- package/dist/src/command-line/migrate/run/run-state.js +438 -0
- package/dist/src/command-line/migrate/run/state-lock.d.ts +25 -0
- package/dist/src/command-line/migrate/run/state-lock.js +76 -0
- package/dist/src/command-line/migrate/run/state-machine.d.ts +84 -0
- package/dist/src/command-line/migrate/run/state-machine.js +315 -0
- package/dist/src/command-line/migrate/run/util.d.ts +59 -0
- package/dist/src/command-line/migrate/run/util.js +148 -0
- package/dist/src/command-line/migrate/run/worker.d.ts +16 -0
- package/dist/src/command-line/migrate/run/worker.js +682 -0
- package/dist/src/command-line/migrate/run-migration-process.js +6 -5
- package/dist/src/command-line/migrate/safe-prompt.d.ts +14 -26
- package/dist/src/command-line/migrate/safe-prompt.js +32 -43
- package/dist/src/command-line/migrate/sort-migrations.d.ts +16 -0
- package/dist/src/command-line/migrate/sort-migrations.js +32 -0
- package/dist/src/command-line/migrate/step-actions.d.ts +5 -0
- package/dist/src/command-line/migrate/step-actions.js +12 -0
- package/dist/src/command-line/migrate/text.d.ts +18 -0
- package/dist/src/command-line/migrate/text.js +26 -0
- package/dist/src/command-line/migrate/version-skew-guard.d.ts +60 -0
- package/dist/src/command-line/migrate/version-skew-guard.js +175 -0
- package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +17 -21
- package/dist/src/command-line/nx-cloud/connect/view-logs.js +2 -0
- package/dist/src/command-line/nx-cloud/start-nx-agents/command-object.d.ts +2 -0
- package/dist/src/command-line/nx-cloud/start-nx-agents/command-object.js +16 -0
- package/dist/src/command-line/nx-cloud/start-nx-agents/start-nx-agents.d.ts +4 -0
- package/dist/src/command-line/nx-cloud/start-nx-agents/start-nx-agents.js +13 -0
- package/dist/src/command-line/nx-commands.js +26 -24
- package/dist/src/command-line/release/changelog.js +11 -17
- package/dist/src/command-line/release/index.d.ts +1 -1
- package/dist/src/command-line/release/plan.js +15 -28
- package/dist/src/command-line/release/publish.js +5 -0
- package/dist/src/command-line/release/release.js +6 -17
- package/dist/src/command-line/release/utils/git.js +1 -1
- package/dist/src/command-line/release/utils/release-graph.d.ts +20 -2
- package/dist/src/command-line/release/utils/release-graph.js +81 -21
- package/dist/src/command-line/release/utils/remote-release-clients/github.js +17 -23
- package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +14 -23
- package/dist/src/command-line/release/utils/resolve-semver-specifier.js +19 -41
- package/dist/src/command-line/release/utils/shared.d.ts +2 -2
- package/dist/src/command-line/release/version/release-group-processor.d.ts +24 -0
- package/dist/src/command-line/release/version/release-group-processor.js +80 -6
- package/dist/src/command-line/release/version/resolve-current-version.js +7 -10
- package/dist/src/command-line/release/version/version-actions.d.ts +27 -2
- package/dist/src/command-line/release/version/version-actions.js +9 -1
- package/dist/src/command-line/release/version.js +10 -6
- package/dist/src/command-line/reset/reset.js +6 -1
- package/dist/src/command-line/run/run-one.js +1 -0
- package/dist/src/command-line/run-many/run-many.js +1 -0
- package/dist/src/command-line/show/show-target/inputs.js +50 -153
- package/dist/src/command-line/show/show-target/outputs.js +48 -173
- package/dist/src/command-line/show/show-target/utils.d.ts +28 -0
- package/dist/src/command-line/show/show-target/utils.js +83 -3
- package/dist/src/command-line/watch/watch.js +13 -0
- package/dist/src/command-line/yargs-utils/shared-options.d.ts +2 -2
- package/dist/src/command-line/yargs-utils/shared-options.js +3 -1
- package/dist/src/commands-runner/create-command-graph.js +5 -0
- package/dist/src/config/misc-interfaces.d.ts +19 -7
- package/dist/src/config/nx-json.d.ts +5 -3
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/core/graph/styles.js +1 -1
- package/dist/src/daemon/client/client.d.ts +52 -1
- package/dist/src/daemon/client/client.js +160 -36
- package/dist/src/daemon/client/daemon-environment.d.ts +17 -0
- package/dist/src/daemon/client/daemon-environment.js +110 -2
- package/dist/src/daemon/client/daemon-socket-messenger.js +4 -0
- package/dist/src/daemon/message-types/daemon-message.d.ts +32 -0
- package/dist/src/daemon/message-types/daemon-message.js +25 -0
- package/dist/src/daemon/server/file-watching/file-watcher-sockets.d.ts +5 -0
- package/dist/src/daemon/server/file-watching/file-watcher-sockets.js +16 -0
- package/dist/src/daemon/server/handle-tasks-execution-hooks.d.ts +1 -1
- package/dist/src/daemon/server/latest-nx.js +5 -2
- package/dist/src/daemon/server/server.js +31 -4
- package/dist/src/daemon/server/shutdown-utils.d.ts +5 -0
- package/dist/src/daemon/server/shutdown-utils.js +11 -4
- package/dist/src/daemon/socket-utils.d.ts +1 -0
- package/dist/src/daemon/socket-utils.js +24 -3
- package/dist/src/daemon/tmp-dir.d.ts +43 -3
- package/dist/src/daemon/tmp-dir.js +437 -15
- package/dist/src/devkit-internals.d.ts +105 -8
- package/dist/src/devkit-internals.js +223 -7
- package/dist/src/executors/run-commands/running-tasks.js +46 -29
- package/dist/src/generators/internal-utils/format-changed-files.d.ts +24 -0
- package/dist/src/generators/internal-utils/format-changed-files.js +163 -0
- package/dist/src/generators/testing-utils/create-tree-with-empty-workspace.d.ts +15 -0
- package/dist/src/generators/testing-utils/create-tree-with-empty-workspace.js +21 -3
- package/dist/src/generators/tree.d.ts +4 -2
- package/dist/src/generators/utils/nx-json.js +13 -3
- package/dist/src/hasher/check-task-files.d.ts +86 -0
- package/dist/src/hasher/check-task-files.js +378 -0
- package/dist/src/migrations/update-15-0-0/prefix-outputs.js +2 -2
- package/dist/src/migrations/update-16-0-0/remove-nrwl-cli.js +2 -2
- package/dist/src/migrations/update-16-0-0/update-depends-on-to-tokens.js +2 -2
- package/dist/src/migrations/update-16-0-0/update-nx-cloud-runner.js +2 -2
- package/dist/src/migrations/update-16-2-0/remove-run-commands-output-path.js +2 -2
- package/dist/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +2 -2
- package/dist/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +2 -2
- package/dist/src/migrations/update-17-2-0/move-default-base.js +2 -2
- package/dist/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +2 -2
- package/dist/src/migrations/update-19-2-4/set-project-name.js +2 -2
- package/dist/src/migrations/update-20-0-0/move-use-daemon-process.js +2 -2
- package/dist/src/migrations/update-20-0-1/use-legacy-cache.js +2 -2
- package/dist/src/migrations/update-21-0-0/release-changelog-config-changes.js +2 -2
- package/dist/src/migrations/update-21-0-0/release-version-config-changes.js +2 -2
- package/dist/src/migrations/update-21-0-0/remove-custom-tasks-runner.js +2 -2
- package/dist/src/migrations/update-21-0-0/remove-legacy-cache.js +2 -2
- package/dist/src/migrations/update-22-0-0/consolidate-release-tag-config.js +2 -2
- package/dist/src/migrations/update-22-0-0/release-version-config-changes.js +2 -2
- package/dist/src/migrations/update-22-2-0/add-self-healing-to-gitignore.js +2 -2
- package/dist/src/migrations/update-22-6-0/add-claude-settings-local-to-git-ignore.js +2 -2
- package/dist/src/migrations/update-22-6-0/add-claude-worktrees-to-git-ignore.js +2 -2
- package/dist/src/migrations/update-22-7-0/add-polygraph-to-git-ignore.js +2 -2
- package/dist/src/migrations/update-23-0-0/add-migrate-runs-to-git-ignore.js +2 -2
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.d.ts +12 -0
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.js +250 -0
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.md +50 -0
- package/dist/src/native/index.d.ts +37 -4
- package/dist/src/native/index.js +71 -28
- package/dist/src/native/native-bindings.js +3 -0
- package/dist/src/native/native-file-cache-location.d.ts +17 -1
- package/dist/src/native/native-file-cache-location.js +86 -12
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +3 -3
- package/dist/src/nx-cloud/utilities/get-cloud-options.js +5 -2
- package/dist/src/nx-cloud/utilities/onboarding.js +5 -2
- package/dist/src/nx-cloud/utilities/url-shorten.d.ts +1 -4
- package/dist/src/nx-cloud/utilities/url-shorten.js +9 -8
- package/dist/src/plugins/js/lock-file/bun-parser.js +43 -10
- package/dist/src/plugins/js/lock-file/lock-file.d.ts +46 -4
- package/dist/src/plugins/js/lock-file/lock-file.js +192 -15
- package/dist/src/plugins/js/lock-file/pnpm-parser.js +420 -64
- package/dist/src/plugins/js/lock-file/project-graph-pruning.d.ts +25 -1
- package/dist/src/plugins/js/lock-file/project-graph-pruning.js +92 -12
- package/dist/src/plugins/js/lock-file/pruned-output.d.ts +330 -0
- package/dist/src/plugins/js/lock-file/pruned-output.js +1441 -0
- package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.d.ts +1 -0
- package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.js +9 -5
- package/dist/src/plugins/js/project-graph/affected/npm-packages.js +51 -20
- package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +14 -4
- package/dist/src/project-graph/affected/affected-project-graph-models.d.ts +1 -1
- package/dist/src/project-graph/affected/affected-project-graph.d.ts +1 -1
- package/dist/src/project-graph/affected/affected-project-graph.js +2 -2
- package/dist/src/project-graph/affected/locators/project-glob-changes.js +5 -2
- package/dist/src/project-graph/build-project-graph.js +7 -1
- package/dist/src/project-graph/error-types.d.ts +12 -1
- package/dist/src/project-graph/error-types.js +27 -2
- package/dist/src/project-graph/file-utils.js +6 -1
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.d.ts +1 -0
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +18 -1
- package/dist/src/project-graph/plugins/isolation/messaging.d.ts +16 -3
- package/dist/src/project-graph/plugins/isolation/messaging.js +3 -0
- package/dist/src/project-graph/plugins/isolation/plugin-worker.js +58 -8
- package/dist/src/project-graph/plugins/loaded-nx-plugin.js +1 -0
- package/dist/src/project-graph/project-graph.js +23 -0
- package/dist/src/project-graph/utils/project-configuration/name-substitution-manager.d.ts +1 -0
- package/dist/src/project-graph/utils/project-configuration/name-substitution-manager.js +16 -2
- package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.d.ts +12 -8
- package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.js +30 -21
- package/dist/src/project-graph/utils/project-configuration/source-maps.d.ts +12 -5
- package/dist/src/project-graph/utils/project-configuration/source-maps.js +21 -7
- package/dist/src/project-graph/utils/project-configuration/target-defaults.d.ts +1 -1
- package/dist/src/project-graph/utils/project-configuration/target-defaults.js +26 -27
- package/dist/src/project-graph/utils/project-configuration/target-merging.js +50 -8
- package/dist/src/project-graph/utils/project-configuration/target-normalization.js +149 -6
- package/dist/src/project-graph/utils/project-configuration/utils.d.ts +15 -0
- package/dist/src/project-graph/utils/project-configuration/utils.js +42 -6
- package/dist/src/project-graph/utils/project-configuration-utils.d.ts +15 -12
- package/dist/src/project-graph/utils/project-configuration-utils.js +79 -99
- package/dist/src/tasks-runner/is-tui-enabled.js +3 -1
- package/dist/src/tasks-runner/life-cycle.d.ts +2 -2
- package/dist/src/tasks-runner/life-cycle.js +2 -2
- package/dist/src/tasks-runner/life-cycles/performance-analysis.d.ts +9 -4
- package/dist/src/tasks-runner/life-cycles/performance-life-cycle.js +5 -4
- package/dist/src/tasks-runner/life-cycles/performance-report.d.ts +28 -8
- package/dist/src/tasks-runner/life-cycles/performance-report.js +117 -30
- package/dist/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.d.ts +26 -1
- package/dist/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +99 -5
- package/dist/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.d.ts +26 -0
- package/dist/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.js +113 -17
- package/dist/src/tasks-runner/pseudo-terminal.d.ts +17 -3
- package/dist/src/tasks-runner/pseudo-terminal.js +22 -10
- package/dist/src/tasks-runner/run-command.js +28 -35
- package/dist/src/tasks-runner/running-tasks/batch-process.d.ts +55 -0
- package/dist/src/tasks-runner/running-tasks/batch-process.js +161 -8
- package/dist/src/tasks-runner/task-env.d.ts +9 -0
- package/dist/src/tasks-runner/task-env.js +31 -4
- package/dist/src/tasks-runner/task-orchestrator.d.ts +72 -1
- package/dist/src/tasks-runner/task-orchestrator.js +182 -18
- package/dist/src/tasks-runner/utils.js +2 -6
- package/dist/src/utils/acknowledge-build-scripts.js +7 -5
- package/dist/src/utils/analytics-enabled.d.ts +7 -0
- package/dist/src/utils/analytics-enabled.js +11 -0
- package/dist/src/utils/analytics-prompt.d.ts +0 -6
- package/dist/src/utils/analytics-prompt.js +4 -58
- package/dist/src/utils/assert-workspace-validity.js +7 -2
- package/dist/src/utils/catalog/bun-manager-utils.d.ts +8 -0
- package/dist/src/utils/catalog/bun-manager-utils.js +174 -0
- package/dist/src/utils/catalog/bun-manager.d.ts +28 -0
- package/dist/src/utils/catalog/bun-manager.js +130 -0
- package/dist/src/utils/catalog/index.d.ts +1 -1
- package/dist/src/utils/catalog/index.js +1 -1
- package/dist/src/utils/catalog/manager-factory.js +3 -0
- package/dist/src/utils/catalog/manager-utils.d.ts +8 -1
- package/dist/src/utils/catalog/manager-utils.js +9 -4
- package/dist/src/utils/catalog/manager.d.ts +13 -1
- package/dist/src/utils/catalog/manager.js +30 -0
- package/dist/src/utils/catalog/pnpm-manager.d.ts +2 -1
- package/dist/src/utils/catalog/pnpm-manager.js +3 -0
- package/dist/src/utils/catalog/types.d.ts +4 -0
- package/dist/src/utils/catalog/yarn-manager.d.ts +6 -2
- package/dist/src/utils/catalog/yarn-manager.js +23 -32
- package/dist/src/utils/child-process.d.ts +31 -1
- package/dist/src/utils/child-process.js +103 -0
- package/dist/src/utils/chunkify.d.ts +7 -1
- package/dist/src/utils/chunkify.js +10 -3
- package/dist/src/utils/command-line-utils.js +30 -20
- package/dist/src/utils/exit-codes.d.ts +9 -0
- package/dist/src/utils/exit-codes.js +19 -0
- package/dist/src/utils/fileutils.d.ts +5 -0
- package/dist/src/utils/fileutils.js +7 -2
- package/dist/src/utils/formatters/index.d.ts +13 -0
- package/dist/src/utils/formatters/index.js +74 -0
- package/dist/src/utils/formatters/oxfmt.d.ts +32 -0
- package/dist/src/utils/formatters/oxfmt.js +764 -0
- package/dist/src/utils/formatters/prettier.d.ts +26 -0
- package/dist/src/utils/formatters/prettier.js +201 -0
- package/dist/src/utils/formatters/shared.d.ts +5 -0
- package/dist/src/utils/formatters/shared.js +8 -0
- package/dist/src/utils/git-revision.d.ts +12 -0
- package/dist/src/utils/git-revision.js +25 -0
- package/dist/src/utils/git-utils.d.ts +48 -2
- package/dist/src/utils/git-utils.js +220 -14
- package/dist/src/utils/git-worktrees.d.ts +30 -0
- package/dist/src/utils/git-worktrees.js +212 -0
- package/dist/src/utils/ignore.d.ts +170 -1
- package/dist/src/utils/ignore.js +263 -11
- package/dist/src/utils/long-running-target.d.ts +10 -0
- package/dist/src/utils/long-running-target.js +19 -0
- package/dist/src/utils/min-release-age/behavior/bun.js +7 -11
- package/dist/src/utils/min-release-age/behavior/npm.js +5 -2
- package/dist/src/utils/min-release-age/packument.js +1 -1
- package/dist/src/utils/nx-console-prompt.js +3 -6
- package/dist/src/utils/nx-tmp-dir.d.ts +18 -0
- package/dist/src/utils/nx-tmp-dir.js +40 -0
- package/dist/src/utils/output.d.ts +153 -0
- package/dist/src/utils/output.js +289 -5
- package/dist/src/utils/owned-private-dir.d.ts +132 -0
- package/dist/src/utils/owned-private-dir.js +323 -0
- package/dist/src/utils/package-json.d.ts +2 -0
- package/dist/src/utils/package-json.js +11 -7
- package/dist/src/utils/package-manager-config/bunfig.d.ts +14 -0
- package/dist/src/utils/package-manager-config/bunfig.js +49 -0
- package/dist/src/utils/package-manager-config/npmrc.d.ts +23 -0
- package/dist/src/utils/package-manager-config/npmrc.js +124 -0
- package/dist/src/utils/package-manager-config/pnpm-config.d.ts +17 -0
- package/dist/src/utils/package-manager-config/pnpm-config.js +60 -0
- package/dist/src/utils/package-manager.d.ts +23 -2
- package/dist/src/utils/package-manager.js +268 -44
- package/dist/src/utils/params.d.ts +7 -1
- package/dist/src/utils/params.js +64 -6
- package/dist/src/utils/plugins/core-plugins.js +4 -0
- package/dist/src/utils/prompt-helpers.d.ts +53 -0
- package/dist/src/utils/prompt-helpers.js +111 -0
- package/dist/src/utils/provenance.js +6 -14
- package/dist/src/utils/registry-config/bun.d.ts +2 -0
- package/dist/src/utils/registry-config/bun.js +257 -0
- package/dist/src/utils/registry-config/index.d.ts +13 -0
- package/dist/src/utils/registry-config/index.js +102 -0
- package/dist/src/utils/registry-config/pnpm.d.ts +2 -0
- package/dist/src/utils/registry-config/pnpm.js +1551 -0
- package/dist/src/utils/registry-config/utils.d.ts +195 -0
- package/dist/src/utils/registry-config/utils.js +496 -0
- package/dist/src/utils/registry-config/yarn-berry.d.ts +2 -0
- package/dist/src/utils/registry-config/yarn-berry.js +612 -0
- package/dist/src/utils/registry-config/yarn-classic.d.ts +2 -0
- package/dist/src/utils/registry-config/yarn-classic.js +1001 -0
- package/dist/src/utils/safe-spawn.d.ts +24 -0
- package/dist/src/utils/safe-spawn.js +104 -0
- package/dist/src/utils/shell-quoting.d.ts +15 -0
- package/dist/src/utils/shell-quoting.js +35 -0
- package/dist/src/utils/wait-for-socket-connection.d.ts +11 -0
- package/dist/src/utils/wait-for-socket-connection.js +14 -8
- package/dist/src/utils/workspace-id.d.ts +20 -0
- package/dist/src/utils/workspace-id.js +54 -0
- package/dist/src/utils/write-formatted-json-file.d.ts +3 -2
- package/dist/src/utils/write-formatted-json-file.js +5 -4
- package/migrations.json +6 -0
- package/package.json +29 -19
- package/dist/src/generators/internal-utils/format-changed-files-with-prettier-if-available.d.ts +0 -19
- package/dist/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +0 -81
- package/dist/src/utils/is-using-prettier.d.ts +0 -3
- package/dist/src/utils/is-using-prettier.js +0 -62
- package/dist/src/utils/min-release-age/npmrc.d.ts +0 -15
- package/dist/src/utils/min-release-age/npmrc.js +0 -45
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Roots of the git linked worktrees that live inside `workspaceRoot`,
|
|
3
|
+
* relative to it and separator-normalized.
|
|
4
|
+
*
|
|
5
|
+
* Reads git's own registry rather than probing the workspace, so it costs one
|
|
6
|
+
* `readdir` plus a small file per worktree. Worktrees outside the workspace
|
|
7
|
+
* are dropped - nothing walks them. Submodules use the same gitfile mechanism
|
|
8
|
+
* but register under `<git-dir>/modules`, so they never appear here.
|
|
9
|
+
*/
|
|
10
|
+
export declare function nestedWorktreeRoots(workspaceRoot: string): string[];
|
|
11
|
+
/**
|
|
12
|
+
* Whether `path` sits inside `root`, comparing whole path segments so that
|
|
13
|
+
* `wt-other` is not read as living inside `wt`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function isInside(path: string, root: string): boolean;
|
|
16
|
+
/** Advice for duplicate project names that come from nested git worktrees. */
|
|
17
|
+
export interface WorktreeConflictAdvice {
|
|
18
|
+
/** Paths to add to `.gitignore`. */
|
|
19
|
+
ignoreTargets: string[];
|
|
20
|
+
/**
|
|
21
|
+
* Whether ignoring them settles every duplicate. When false the caller still
|
|
22
|
+
* owes the reader the ordinary advice for the ones left over.
|
|
23
|
+
*/
|
|
24
|
+
explainsAllConflicts: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* What to tell someone whose duplicate project names come from git worktrees
|
|
28
|
+
* nested in the workspace, or null when none of them do.
|
|
29
|
+
*/
|
|
30
|
+
export declare function analyzeWorktreeConflicts(workspaceRoot: string, conflicts: Map<string, string[]>): WorktreeConflictAdvice | null;
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.nestedWorktreeRoots = nestedWorktreeRoots;
|
|
4
|
+
exports.isInside = isInside;
|
|
5
|
+
exports.analyzeWorktreeConflicts = analyzeWorktreeConflicts;
|
|
6
|
+
const node_fs_1 = require("node:fs");
|
|
7
|
+
const node_path_1 = require("node:path");
|
|
8
|
+
const GITDIR_PREFIX = 'gitdir:';
|
|
9
|
+
function readRecordedPath(file, base) {
|
|
10
|
+
let contents;
|
|
11
|
+
try {
|
|
12
|
+
contents = (0, node_fs_1.readFileSync)(file, 'utf-8').trim();
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
const raw = contents.startsWith(GITDIR_PREFIX)
|
|
18
|
+
? contents.slice(GITDIR_PREFIX.length).trim()
|
|
19
|
+
: contents;
|
|
20
|
+
return raw ? (0, node_path_1.resolve)(base, raw) : null;
|
|
21
|
+
}
|
|
22
|
+
function isDirectory(path) {
|
|
23
|
+
try {
|
|
24
|
+
return (0, node_fs_1.statSync)(path).isDirectory();
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The nearest directory at or above `from` holding a `.git`, or null when
|
|
32
|
+
* there is no repository above it.
|
|
33
|
+
*
|
|
34
|
+
* The workspace root and the repository root are often the same directory, but
|
|
35
|
+
* a workspace nested in a larger repo is ordinary - and its worktrees are
|
|
36
|
+
* registered against the repository, not against the workspace.
|
|
37
|
+
*/
|
|
38
|
+
function findGitRoot(from) {
|
|
39
|
+
let current = (0, node_path_1.resolve)(from);
|
|
40
|
+
while (!(0, node_fs_1.existsSync)((0, node_path_1.join)(current, '.git'))) {
|
|
41
|
+
const parent = (0, node_path_1.dirname)(current);
|
|
42
|
+
if (parent === current) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
current = parent;
|
|
46
|
+
}
|
|
47
|
+
return current;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* `<git-dir>/worktrees`, where git registers every linked worktree of the
|
|
51
|
+
* repository `workspaceRoot` belongs to - found by walking up, since the
|
|
52
|
+
* workspace need not be the repository root. Null when there is no `.git`, or
|
|
53
|
+
* when it is a gitfile that names nothing. The registry itself is not checked -
|
|
54
|
+
* reading it is what tells us whether anything is registered.
|
|
55
|
+
*/
|
|
56
|
+
function worktreeRegistry(workspaceRoot) {
|
|
57
|
+
const gitRoot = findGitRoot(workspaceRoot);
|
|
58
|
+
if (!gitRoot) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
const dotGit = (0, node_path_1.join)(gitRoot, '.git');
|
|
62
|
+
let gitDir;
|
|
63
|
+
try {
|
|
64
|
+
gitDir = (0, node_fs_1.statSync)(dotGit).isDirectory()
|
|
65
|
+
? dotGit
|
|
66
|
+
: readRecordedPath(dotGit, gitRoot);
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
if (!gitDir) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
// Running from inside a linked worktree lands on
|
|
75
|
+
// `<main>/.git/worktrees/<name>`, whose `commondir` names the real git dir.
|
|
76
|
+
// Ignored unless it names a directory that exists. That is a sanity check
|
|
77
|
+
// on a path out of a file we did not write, not a bound on where it may
|
|
78
|
+
// point - it can still name any directory on the machine.
|
|
79
|
+
const commonDir = readRecordedPath((0, node_path_1.join)(gitDir, 'commondir'), gitDir);
|
|
80
|
+
return (0, node_path_1.join)(commonDir && isDirectory(commonDir) ? commonDir : gitDir, 'worktrees');
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Roots of the git linked worktrees that live inside `workspaceRoot`,
|
|
84
|
+
* relative to it and separator-normalized.
|
|
85
|
+
*
|
|
86
|
+
* Reads git's own registry rather than probing the workspace, so it costs one
|
|
87
|
+
* `readdir` plus a small file per worktree. Worktrees outside the workspace
|
|
88
|
+
* are dropped - nothing walks them. Submodules use the same gitfile mechanism
|
|
89
|
+
* but register under `<git-dir>/modules`, so they never appear here.
|
|
90
|
+
*/
|
|
91
|
+
function nestedWorktreeRoots(workspaceRoot) {
|
|
92
|
+
const registry = worktreeRegistry(workspaceRoot);
|
|
93
|
+
if (!registry) {
|
|
94
|
+
return [];
|
|
95
|
+
}
|
|
96
|
+
let entries;
|
|
97
|
+
try {
|
|
98
|
+
entries = (0, node_fs_1.readdirSync)(registry);
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
return [];
|
|
102
|
+
}
|
|
103
|
+
const roots = [];
|
|
104
|
+
for (const entry of entries) {
|
|
105
|
+
// Points at the worktree's own `.git` gitfile, so its parent is the root.
|
|
106
|
+
const gitfile = readRecordedPath((0, node_path_1.join)(registry, entry, 'gitdir'), (0, node_path_1.join)(registry, entry));
|
|
107
|
+
if (!gitfile || !(0, node_fs_1.existsSync)(gitfile)) {
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
const root = (0, node_path_1.relative)(workspaceRoot, (0, node_path_1.dirname)(gitfile));
|
|
111
|
+
// Neither the workspace itself nor anything outside it is a nested
|
|
112
|
+
// worktree Nx would walk into. Compared by whole segments, because `..` is
|
|
113
|
+
// a traversal and `..hidden` is an ordinary directory name; and by
|
|
114
|
+
// absoluteness, because `relative` across Windows drives returns its
|
|
115
|
+
// second argument, which is outside by definition and carries no `..`.
|
|
116
|
+
if (!root || (0, node_path_1.isAbsolute)(root) || root.split(node_path_1.sep)[0] === '..') {
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
roots.push(root.split(node_path_1.sep).join('/'));
|
|
120
|
+
}
|
|
121
|
+
return roots;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Whether `path` sits inside `root`, comparing whole path segments so that
|
|
125
|
+
* `wt-other` is not read as living inside `wt`.
|
|
126
|
+
*/
|
|
127
|
+
function isInside(path, root) {
|
|
128
|
+
return path === root || path.startsWith(`${root}/`);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* What to tell someone whose duplicate project names come from git worktrees
|
|
132
|
+
* nested in the workspace, or null when none of them do.
|
|
133
|
+
*/
|
|
134
|
+
function analyzeWorktreeConflicts(workspaceRoot, conflicts) {
|
|
135
|
+
const worktrees = nestedWorktreeRoots(workspaceRoot);
|
|
136
|
+
if (!worktrees.length) {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
const offending = [];
|
|
140
|
+
let explainsAllConflicts = true;
|
|
141
|
+
for (const roots of conflicts.values()) {
|
|
142
|
+
const fromWorktrees = worktrees.filter((worktree) => roots.some((root) => isInside(root, worktree)));
|
|
143
|
+
// What would still be defined twice once the worktrees are out of the way.
|
|
144
|
+
const remaining = roots.filter((root) => !worktrees.some((worktree) => isInside(root, worktree)));
|
|
145
|
+
// Worth naming whenever a worktree is involved, even if ignoring it
|
|
146
|
+
// doesn't settle the whole conflict.
|
|
147
|
+
for (const worktree of fromWorktrees) {
|
|
148
|
+
if (!offending.includes(worktree)) {
|
|
149
|
+
offending.push(worktree);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if (!fromWorktrees.length || remaining.length > 1) {
|
|
153
|
+
explainsAllConflicts = false;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
if (!offending.length) {
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
ignoreTargets: ignoreTargetsFor(workspaceRoot, offending, worktrees),
|
|
161
|
+
explainsAllConflicts,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* The worktree roots themselves, or the one directory holding them.
|
|
166
|
+
*
|
|
167
|
+
* Collapsing to the directory is only worth anything when it saves lines, and
|
|
168
|
+
* only safe when it holds nothing else. With a single worktree it saves
|
|
169
|
+
* nothing and risks everything: a lone worktree in `apps/` would have us name
|
|
170
|
+
* `apps/`, which holds only that worktree today and is where the reader will
|
|
171
|
+
* put projects tomorrow.
|
|
172
|
+
*/
|
|
173
|
+
function ignoreTargetsFor(workspaceRoot, offending, worktrees) {
|
|
174
|
+
if (offending.length < 2) {
|
|
175
|
+
return offending.map(anchored);
|
|
176
|
+
}
|
|
177
|
+
const parent = commonParent(offending);
|
|
178
|
+
return (parent && holdsOnlyWorktrees(workspaceRoot, parent, worktrees)
|
|
179
|
+
? [parent]
|
|
180
|
+
: offending).map(anchored);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* A gitignore pattern rooted at the workspace rather than matched anywhere.
|
|
184
|
+
*
|
|
185
|
+
* Without the leading slash a single-segment path like `wt1` is a name, not a
|
|
186
|
+
* location - it would ignore every `wt1` at any depth. Applied to all of them
|
|
187
|
+
* so the emitted line reads the same way wherever it came from.
|
|
188
|
+
*/
|
|
189
|
+
function anchored(root) {
|
|
190
|
+
return `/${root}`;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* The directory every one of `roots` sits directly inside, or null when they
|
|
194
|
+
* don't share one - including when it would be the workspace root, which is
|
|
195
|
+
* never something to ignore.
|
|
196
|
+
*/
|
|
197
|
+
function commonParent(roots) {
|
|
198
|
+
const parents = new Set(roots.map((root) => root.split('/').slice(0, -1).join('/')));
|
|
199
|
+
const [parent] = parents;
|
|
200
|
+
return parents.size === 1 && parent ? parent : null;
|
|
201
|
+
}
|
|
202
|
+
function holdsOnlyWorktrees(workspaceRoot, directory, worktrees) {
|
|
203
|
+
let entries;
|
|
204
|
+
try {
|
|
205
|
+
entries = (0, node_fs_1.readdirSync)((0, node_path_1.join)(workspaceRoot, directory));
|
|
206
|
+
}
|
|
207
|
+
catch {
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
210
|
+
return (entries.length > 0 &&
|
|
211
|
+
entries.every((entry) => worktrees.includes(`${directory}/${entry}`)));
|
|
212
|
+
}
|
|
@@ -1,7 +1,176 @@
|
|
|
1
1
|
import ignore = require('ignore');
|
|
2
2
|
import { Tree } from '../generators/tree';
|
|
3
3
|
export declare function getIgnoreObject(root?: string): ReturnType<typeof ignore>;
|
|
4
|
-
|
|
4
|
+
/** One directory's ignore files, and the directory its patterns are rooted at. */
|
|
5
|
+
export type ScopedIgnoreMatcher = {
|
|
6
|
+
/** Workspace-relative POSIX directory, `''` for the workspace root. */
|
|
7
|
+
dir: string;
|
|
8
|
+
/** How they relate is decided at build time - see `merge`. */
|
|
9
|
+
matchers: ReturnType<typeof ignore>[];
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Resolves the ignore files that apply to a directory: its own and every one
|
|
13
|
+
* above it, up to the workspace root.
|
|
14
|
+
*
|
|
15
|
+
* Ignore files cascade - a `.gitignore` covers its own directory and below, and
|
|
16
|
+
* its patterns are relative to *itself*, not to the workspace root. Reading only
|
|
17
|
+
* the root file, which is what `getIgnoreObject` does, silently misses every
|
|
18
|
+
* nested one.
|
|
19
|
+
*
|
|
20
|
+
* A directory's answer is its own files plus its parent's, so every directory on
|
|
21
|
+
* the way up is memoized rather than only the one asked for: sibling leaves
|
|
22
|
+
* share the whole trunk, and a later walk stops at the first directory already
|
|
23
|
+
* known.
|
|
24
|
+
*
|
|
25
|
+
* `read` decides where the files come from - `tree.read` for a generator, disk
|
|
26
|
+
* for a caller with no tree - and returns an empty string or null when there is
|
|
27
|
+
* no such file. Paths handed to it are workspace-relative POSIX.
|
|
28
|
+
*
|
|
29
|
+
* `merge` decides how the files *within one directory* relate, and the two
|
|
30
|
+
* consumers genuinely need different rules:
|
|
31
|
+
*
|
|
32
|
+
* - `false` is prettier's: one matcher per file, any of them excluding wins, and
|
|
33
|
+
* a negation counts only if none excluded. `createIsIgnoredFunction` builds an
|
|
34
|
+
* ignorer per `--ignore-path` and ORs them, so a `!x` in `.prettierignore`
|
|
35
|
+
* cannot re-include an `x` that `.gitignore` excluded.
|
|
36
|
+
* - `true` is git's and the native walker's: all files in one matcher, so
|
|
37
|
+
* `.nxignore`'s `!x` removes `.gitignore`'s exclusion of `x` outright. It has
|
|
38
|
+
* to be a merge rather than a precedence check between separate matchers,
|
|
39
|
+
* because a lone `!x` in its own matcher reports an opinion on `x/` but *none*
|
|
40
|
+
* on `x/a.ts` (measured), so the exclusion would still reach the children.
|
|
41
|
+
* The merge only removes the exclusion within that one directory - a negation
|
|
42
|
+
* in a nested file still loses to an ancestor's exclusion.
|
|
43
|
+
*
|
|
44
|
+
* When `merge` is true, `filenames` order matters: they go into one matcher in
|
|
45
|
+
* order and the last matching pattern decides, so list them lowest-authority
|
|
46
|
+
* first.
|
|
47
|
+
*/
|
|
48
|
+
export declare function createIgnoreChainResolver(read: (path: string) => string | null | undefined, filenames: string[], merge: boolean): (dir: string) => ScopedIgnoreMatcher[];
|
|
49
|
+
/**
|
|
50
|
+
* True when the file is ignored, resolving the chain nearest file first.
|
|
51
|
+
*
|
|
52
|
+
* Each matcher is tested against the path relative to its own directory, which
|
|
53
|
+
* is what makes a nested pattern like `/build` mean that directory's `build`
|
|
54
|
+
* rather than the workspace's.
|
|
55
|
+
*
|
|
56
|
+
* Nearest directory with an *opinion* wins, not the first match: a nested
|
|
57
|
+
* `!keep.log` must override the root's `*.log`, which is git's rule for files.
|
|
58
|
+
* A nested negation of a *directory* does not reach its children - see the
|
|
59
|
+
* `merge` note on `createIgnoreChainResolver`.
|
|
60
|
+
*
|
|
61
|
+
* How the files of one directory relate is decided when the chain is built - see
|
|
62
|
+
* that same note. Here they are simply the entry's matchers: any one excluding
|
|
63
|
+
* wins, and a negation counts only if none excluded.
|
|
64
|
+
*
|
|
65
|
+
* Two preconditions, neither enforced here:
|
|
66
|
+
*
|
|
67
|
+
* - `filePath` is workspace-relative POSIX and must sit under every `dir` in the
|
|
68
|
+
* chain, which holds when the chain came from that file's own directory.
|
|
69
|
+
* - No ancestor directory of `filePath` may itself be ignored. git refuses to
|
|
70
|
+
* re-include a file inside an excluded directory, and this does not implement
|
|
71
|
+
* that rule: asked directly about `dist/keep.ts` with a root `dist/` and a
|
|
72
|
+
* nested `dist/.gitignore` holding `!keep.ts`, it answers "not ignored" where
|
|
73
|
+
* git says ignored (measured). A pruning walk like `visitNotIgnoredFiles`
|
|
74
|
+
* satisfies it by never asking about anything under `dist/`; a per-file
|
|
75
|
+
* caller cannot, so it goes through `createAncestorAwareIgnoreChecker`,
|
|
76
|
+
* which checks the ancestors before asking the chain.
|
|
77
|
+
*/
|
|
78
|
+
export declare function isIgnoredByChain(chain: ScopedIgnoreMatcher[], filePath: string): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* The chain's answers plus git's excluded-ancestor rule: nothing inside an
|
|
81
|
+
* ignored directory can be re-included, so a nested negation must not
|
|
82
|
+
* resurrect a file whose ancestor an outer file excluded - the case
|
|
83
|
+
* `isIgnoredByChain` alone gets wrong (see its second precondition). The
|
|
84
|
+
* oxfmt CLI follows the same rule (measured against 0.60.0: a scan skips a
|
|
85
|
+
* nested `!keep.ts` under a root-ignored `dist/`), so every per-file caller -
|
|
86
|
+
* the cascading tree checkers and the disk-backed resolver in
|
|
87
|
+
* `formatters/oxfmt.ts` - goes through here.
|
|
88
|
+
*
|
|
89
|
+
* A directory's own ignore files cannot un-ignore the directory itself, so
|
|
90
|
+
* its verdict comes from its parent's chain - probed with a trailing slash,
|
|
91
|
+
* which is what makes a directory-only pattern like `dist/` match. Verdicts
|
|
92
|
+
* are memoized per directory, so a batch of files shares its ancestor walks.
|
|
93
|
+
*/
|
|
94
|
+
export declare function createAncestorAwareIgnoreChecker(resolve: (dir: string) => ScopedIgnoreMatcher[]): TreeIgnoreChecker;
|
|
95
|
+
/**
|
|
96
|
+
* Directories that should never be walked, whatever the workspace's own ignore
|
|
97
|
+
* files say - `node_modules`, `.git`, the nx caches.
|
|
98
|
+
*
|
|
99
|
+
* The list comes from the native walker rather than a second copy here, so a
|
|
100
|
+
* filesystem walk and a tree walk cannot drift apart.
|
|
101
|
+
*
|
|
102
|
+
* Checked ahead of the cascading chain rather than folded into it: these are not
|
|
103
|
+
* re-includable, and as ordinary patterns a nested negation could resurrect
|
|
104
|
+
* `node_modules`.
|
|
105
|
+
*/
|
|
106
|
+
export declare function isAlwaysIgnored(path: string): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* A chain's answers as predicates over workspace-relative POSIX paths.
|
|
109
|
+
*
|
|
110
|
+
* Files and directories are asked separately because the answers differ: a
|
|
111
|
+
* pattern is only directory-only if it ends in a slash, and `ignore` will not
|
|
112
|
+
* match `dist/` against the path `dist`. Callers must not have to know that, so
|
|
113
|
+
* the slash is appended inside and never leaves this module.
|
|
114
|
+
*/
|
|
115
|
+
export type TreeIgnoreChecker = {
|
|
116
|
+
isIgnoredFile: (path: string) => boolean;
|
|
117
|
+
isIgnoredDirectory: (path: string) => boolean;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* What git ignores, which is also what the native walker ignores.
|
|
121
|
+
*
|
|
122
|
+
* `.nxignore` outranks `.gitignore` - `walker.rs` registers it with
|
|
123
|
+
* `add_custom_ignore_filename` - which a merge with `.nxignore` last reproduces.
|
|
124
|
+
* git itself does not read it.
|
|
125
|
+
*
|
|
126
|
+
* Reads from the tree rather than disk because a generator can create or amend
|
|
127
|
+
* an ignore file in the same run, which would leave the on-disk copy stale.
|
|
128
|
+
*/
|
|
129
|
+
export declare function createGitIgnoreChecker(tree: Tree): TreeIgnoreChecker;
|
|
130
|
+
/**
|
|
131
|
+
* What prettier ignores: the workspace root only, and one ignorer per
|
|
132
|
+
* `--ignore-path` ORed rather than merged (both measured), so a `!` in
|
|
133
|
+
* `.prettierignore` cannot re-include what `.gitignore` excluded. That is the
|
|
134
|
+
* CLI `nx format:check` shells out to.
|
|
135
|
+
*
|
|
136
|
+
* Not an exact match for that command: `isAlwaysIgnored` is wider than
|
|
137
|
+
* prettier's built-ins, and `format.ts` filters its own patterns through
|
|
138
|
+
* `.nxignore`, which this does not read.
|
|
139
|
+
*
|
|
140
|
+
* Reads from the tree rather than disk, as above.
|
|
141
|
+
*/
|
|
142
|
+
export declare function createPrettierIgnoreChecker(tree: Tree): TreeIgnoreChecker;
|
|
143
|
+
/**
|
|
144
|
+
* What oxfmt ignores: prettier's two files, but resolved from each file's own
|
|
145
|
+
* directory upwards rather than the workspace root - measured against the
|
|
146
|
+
* oxfmt 0.60.0 CLI, which differs from prettier on exactly that axis. Still
|
|
147
|
+
* one matcher per file rather than merged.
|
|
148
|
+
*
|
|
149
|
+
* A config's `ignorePatterns` is not an ignore file and is not read here;
|
|
150
|
+
* `formatFilesWithOxfmt` applies it rooted at that config's directory.
|
|
151
|
+
*/
|
|
152
|
+
export declare function createOxfmtIgnoreChecker(tree: Tree): TreeIgnoreChecker;
|
|
153
|
+
/**
|
|
154
|
+
* Exported, unlike git's and prettier's, because oxfmt has two consumers:
|
|
155
|
+
* this tree-backed checker and the disk-backed resolver in
|
|
156
|
+
* `formatters/oxfmt.ts`. A shared value is the only thing that keeps them
|
|
157
|
+
* agreeing, so do not restate these three anywhere.
|
|
158
|
+
*
|
|
159
|
+
* `satisfies` rather than an annotation keeps the values literal - an
|
|
160
|
+
* annotation widens `cascade` and `merge` to `boolean` (measured in the
|
|
161
|
+
* declaration emit).
|
|
162
|
+
*/
|
|
163
|
+
export declare const OXFMT_IGNORE_OPTIONS: {
|
|
164
|
+
filenames: string[];
|
|
165
|
+
cascade: true;
|
|
166
|
+
merge: false;
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
* `path.dirname` for the workspace-relative POSIX paths the chain is keyed by,
|
|
170
|
+
* except that the workspace root is `''` rather than `.` - that is the key
|
|
171
|
+
* `createIgnoreChainResolver` terminates on.
|
|
172
|
+
*/
|
|
173
|
+
export declare function posixDirname(relativePath: string): string;
|
|
5
174
|
/**
|
|
6
175
|
* Adds an entry to a .gitignore file if it's not already covered by existing patterns.
|
|
7
176
|
* Creates the file if it doesn't exist.
|