@depup/nx 23.2.1-depup.7 → 23.3.0-depup.0
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 +8 -19
- package/changes.json +10 -54
- package/dist/bin/init-local.js +7 -1
- package/dist/nx-cloud-internals.d.ts +1 -0
- package/dist/nx-cloud-internals.js +9 -0
- package/dist/plugins/package-json.js +1 -1
- package/dist/src/command-line/add/add.js +5 -1
- package/dist/src/command-line/affected/affected.js +70 -9
- package/dist/src/command-line/affected/command-object.js +1 -1
- package/dist/src/command-line/format/format.js +2 -18
- package/dist/src/command-line/graph/graph.d.ts +31 -0
- package/dist/src/command-line/graph/graph.js +113 -20
- package/dist/src/command-line/init/implementation/add-nx-to-monorepo.js +0 -3
- package/dist/src/command-line/init/implementation/add-nx-to-nest.js +0 -3
- package/dist/src/command-line/init/implementation/add-nx-to-npm-repo.js +0 -3
- package/dist/src/command-line/init/implementation/angular/index.js +0 -3
- package/dist/src/command-line/init/implementation/angular/legacy-angular-versions.js +0 -3
- package/dist/src/command-line/init/implementation/format.js +2 -3
- package/dist/src/command-line/init/implementation/utils.d.ts +0 -1
- package/dist/src/command-line/init/implementation/utils.js +6 -9
- package/dist/src/command-line/init/init-v2.js +0 -3
- package/dist/src/command-line/migrate/agentic/capture-generator-output.d.ts +25 -0
- package/dist/src/command-line/migrate/agentic/capture-generator-output.js +121 -5
- package/dist/src/command-line/migrate/agentic/close-agent-session.d.ts +21 -0
- package/dist/src/command-line/migrate/agentic/close-agent-session.js +126 -0
- package/dist/src/command-line/migrate/agentic/definitions.d.ts +24 -0
- package/dist/src/command-line/migrate/agentic/definitions.js +79 -20
- package/dist/src/command-line/migrate/agentic/format-command.d.ts +14 -0
- package/dist/src/command-line/migrate/agentic/format-command.js +44 -0
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +3 -3
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +3 -3
- package/dist/src/command-line/migrate/agentic/handoff.d.ts +50 -17
- package/dist/src/command-line/migrate/agentic/handoff.js +166 -24
- package/dist/src/command-line/migrate/agentic/instruction-files.d.ts +23 -0
- package/dist/src/command-line/migrate/agentic/instruction-files.js +41 -0
- package/dist/src/command-line/migrate/agentic/master/invocations.d.ts +12 -0
- package/dist/src/command-line/migrate/agentic/master/invocations.js +54 -0
- package/dist/src/command-line/migrate/agentic/master/run-master-session.d.ts +16 -0
- package/dist/src/command-line/migrate/agentic/master/run-master-session.js +175 -0
- package/dist/src/command-line/migrate/agentic/master/spawn-master.d.ts +31 -0
- package/dist/src/command-line/migrate/agentic/master/spawn-master.js +222 -0
- package/dist/src/command-line/migrate/agentic/prompts/final-validation.d.ts +13 -0
- package/dist/src/command-line/migrate/agentic/prompts/final-validation.js +41 -0
- package/dist/src/command-line/migrate/agentic/prompts/fragments.d.ts +17 -0
- package/dist/src/command-line/migrate/agentic/prompts/fragments.js +90 -0
- package/dist/src/command-line/migrate/agentic/prompts/generic-validation.js +4 -3
- package/dist/src/command-line/migrate/agentic/prompts/system-prompt.d.ts +25 -1
- package/dist/src/command-line/migrate/agentic/prompts/system-prompt.js +57 -34
- package/dist/src/command-line/migrate/agentic/run-step.js +28 -4
- package/dist/src/command-line/migrate/agentic/runner.d.ts +3 -15
- package/dist/src/command-line/migrate/agentic/runner.js +57 -239
- package/dist/src/command-line/migrate/agentic/terminal-repair.d.ts +1 -0
- package/dist/src/command-line/migrate/agentic/terminal-repair.js +27 -0
- package/dist/src/command-line/migrate/agentic/types.d.ts +23 -8
- package/dist/src/command-line/migrate/agentic/types.js +10 -7
- package/dist/src/command-line/migrate/agentic/windows-cmd.d.ts +33 -0
- package/dist/src/command-line/migrate/agentic/windows-cmd.js +88 -0
- package/dist/src/command-line/migrate/command-object.d.ts +2 -0
- package/dist/src/command-line/migrate/command-object.js +11 -1
- package/dist/src/command-line/migrate/deferred-output.d.ts +44 -0
- package/dist/src/command-line/migrate/deferred-output.js +92 -0
- package/dist/src/command-line/migrate/execute-migration.d.ts +9 -3
- package/dist/src/command-line/migrate/execute-migration.js +53 -16
- package/dist/src/command-line/migrate/migrate-analytics.d.ts +34 -9
- package/dist/src/command-line/migrate/migrate-analytics.js +71 -10
- package/dist/src/command-line/migrate/migrate-commits.d.ts +5 -4
- package/dist/src/command-line/migrate/migrate-commits.js +16 -6
- package/dist/src/command-line/migrate/migrate-config.d.ts +5 -2
- package/dist/src/command-line/migrate/migrate-config.js +19 -11
- package/dist/src/command-line/migrate/migrate-output.d.ts +3 -7
- package/dist/src/command-line/migrate/migrate-output.js +3 -7
- package/dist/src/command-line/migrate/migrate.d.ts +3 -0
- package/dist/src/command-line/migrate/migrate.js +183 -46
- package/dist/src/command-line/migrate/resolve-package-version.js +2 -19
- package/dist/src/command-line/migrate/run/agent-output.d.ts +11 -0
- package/dist/src/command-line/migrate/run/agent-output.js +21 -2
- package/dist/src/command-line/migrate/run/agent-work-payload.d.ts +37 -0
- package/dist/src/command-line/migrate/run/agent-work-payload.js +156 -0
- package/dist/src/command-line/migrate/run/atomic-write.d.ts +8 -0
- package/dist/src/command-line/migrate/run/atomic-write.js +17 -0
- package/dist/src/command-line/migrate/run/broker.d.ts +150 -0
- package/dist/src/command-line/migrate/run/broker.js +568 -0
- package/dist/src/command-line/migrate/run/clean-retry.d.ts +12 -0
- package/dist/src/command-line/migrate/run/clean-retry.js +99 -0
- package/dist/src/command-line/migrate/run/existing-run-report.d.ts +55 -0
- package/dist/src/command-line/migrate/run/existing-run-report.js +227 -0
- package/dist/src/command-line/migrate/run/give-up.d.ts +41 -0
- package/dist/src/command-line/migrate/run/give-up.js +148 -0
- package/dist/src/command-line/migrate/run/index.d.ts +9 -6
- package/dist/src/command-line/migrate/run/index.js +21 -2
- package/dist/src/command-line/migrate/run/issues.d.ts +127 -0
- package/dist/src/command-line/migrate/run/issues.js +1121 -0
- package/dist/src/command-line/migrate/run/orchestrator.d.ts +59 -1
- package/dist/src/command-line/migrate/run/orchestrator.js +1529 -457
- package/dist/src/command-line/migrate/run/run-id.d.ts +0 -8
- package/dist/src/command-line/migrate/run/run-id.js +0 -30
- package/dist/src/command-line/migrate/run/run-state.d.ts +77 -17
- package/dist/src/command-line/migrate/run/run-state.js +263 -32
- package/dist/src/command-line/migrate/run/runbook.d.ts +18 -0
- package/dist/src/command-line/migrate/run/runbook.js +118 -0
- package/dist/src/command-line/migrate/run/state-lock.d.ts +33 -2
- package/dist/src/command-line/migrate/run/state-lock.js +128 -2
- package/dist/src/command-line/migrate/run/state-machine.d.ts +50 -1
- package/dist/src/command-line/migrate/run/state-machine.js +339 -26
- package/dist/src/command-line/migrate/run/util.d.ts +3 -1
- package/dist/src/command-line/migrate/run/util.js +24 -3
- package/dist/src/command-line/migrate/run/worker.js +290 -129
- package/dist/src/command-line/migrate/step-actions.d.ts +1 -1
- package/dist/src/command-line/migrate/step-actions.js +7 -1
- package/dist/src/command-line/migrate/text.d.ts +6 -0
- package/dist/src/command-line/migrate/text.js +25 -0
- package/dist/src/command-line/migrate/version-skew-guard.js +2 -0
- package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +5 -11
- package/dist/src/command-line/release/publish.js +11 -8
- package/dist/src/command-line/release/utils/get-touched-projects-for-group.js +3 -3
- package/dist/src/command-line/release/utils/release-graph.js +1 -1
- package/dist/src/command-line/release/utils/remote-release-clients/github.js +5 -8
- package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +3 -3
- package/dist/src/command-line/release/utils/remote-release-clients/remote-release-client.d.ts +4 -2
- package/dist/src/command-line/release/utils/remote-release-clients/remote-release-client.js +37 -3
- package/dist/src/command-line/release/version/version-actions.d.ts +3 -0
- package/dist/src/command-line/reset/reset.js +10 -4
- package/dist/src/command-line/run/run-one.js +5 -1
- package/dist/src/command-line/run-many/run-many.js +6 -12
- package/dist/src/command-line/show/command-object.js +1 -1
- package/dist/src/command-line/show/projects.js +52 -1
- package/dist/src/command-line/yargs-utils/shared-options.d.ts +5 -1
- package/dist/src/command-line/yargs-utils/shared-options.js +38 -4
- package/dist/src/config/task-graph.d.ts +1 -1
- package/dist/src/config/workspace-json-project-json.d.ts +23 -1
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/core/graph/runtime.js +1 -1
- package/dist/src/core/graph/styles.js +1 -1
- package/dist/src/daemon/client/client.d.ts +14 -8
- package/dist/src/daemon/client/client.js +41 -12
- package/dist/src/daemon/message-types/get-plugin-capabilities.d.ts +5 -0
- package/dist/src/daemon/message-types/get-plugin-capabilities.js +11 -0
- package/dist/src/daemon/message-types/run-tasks-execution-hooks.d.ts +3 -2
- package/dist/src/daemon/message-types/select-affected-tasks.d.ts +21 -0
- package/dist/src/daemon/message-types/select-affected-tasks.js +11 -0
- package/dist/src/daemon/message-types/ultracache-configuration-version.d.ts +8 -0
- package/dist/src/daemon/message-types/ultracache-configuration-version.js +2 -0
- package/dist/src/daemon/server/dotenv-graph-changes.d.ts +1 -1
- package/dist/src/daemon/server/dotenv-graph-changes.js +2 -2
- package/dist/src/daemon/server/handle-get-plugin-capabilities.d.ts +2 -0
- package/dist/src/daemon/server/handle-get-plugin-capabilities.js +13 -0
- package/dist/src/daemon/server/handle-hash-tasks.d.ts +10 -2
- package/dist/src/daemon/server/handle-hash-tasks.js +18 -3
- package/dist/src/daemon/server/handle-select-affected-tasks.d.ts +3 -0
- package/dist/src/daemon/server/handle-select-affected-tasks.js +26 -0
- package/dist/src/daemon/server/handle-tasks-execution-hooks.d.ts +3 -2
- package/dist/src/daemon/server/{handle-outputs-changes.d.ts → handle-watch-events.d.ts} +4 -4
- package/dist/src/daemon/server/{handle-outputs-changes.js → handle-watch-events.js} +36 -37
- package/dist/src/daemon/server/outputs-tracking.d.ts +7 -19
- package/dist/src/daemon/server/outputs-tracking.js +7 -107
- package/dist/src/daemon/server/planning-context.d.ts +8 -0
- package/dist/src/daemon/server/planning-context.js +18 -0
- package/dist/src/daemon/server/project-graph-incremental-recomputation.d.ts +22 -7
- package/dist/src/daemon/server/project-graph-incremental-recomputation.js +104 -74
- package/dist/src/daemon/server/restart-checks.d.ts +22 -0
- package/dist/src/daemon/server/restart-checks.js +77 -0
- package/dist/src/daemon/server/server.d.ts +1 -0
- package/dist/src/daemon/server/server.js +54 -30
- package/dist/src/daemon/server/shutdown-utils.d.ts +0 -5
- package/dist/src/daemon/server/shutdown-utils.js +3 -26
- package/dist/src/daemon/server/ultracache-configuration-state.d.ts +7 -0
- package/dist/src/daemon/server/ultracache-configuration-state.js +36 -0
- package/dist/src/devkit-internals.d.ts +3 -1
- package/dist/src/devkit-internals.js +8 -3
- package/dist/src/executors/run-commands/run-commands.impl.d.ts +2 -1
- package/dist/src/executors/run-commands/run-commands.impl.js +19 -5
- package/dist/src/executors/run-commands/running-tasks.d.ts +5 -4
- package/dist/src/executors/run-commands/running-tasks.js +13 -13
- package/dist/src/hasher/create-task-hasher.d.ts +8 -1
- package/dist/src/hasher/create-task-hasher.js +13 -3
- package/dist/src/hasher/hash-plan-inspector.js +2 -2
- package/dist/src/hasher/hash-task.d.ts +2 -2
- package/dist/src/hasher/hash-task.js +28 -17
- package/dist/src/hasher/native-task-hasher-impl.d.ts +20 -4
- package/dist/src/hasher/native-task-hasher-impl.js +75 -9
- package/dist/src/hasher/task-hasher.d.ts +24 -7
- package/dist/src/hasher/task-hasher.js +27 -8
- package/dist/src/hasher/task-planning-context.d.ts +13 -0
- package/dist/src/hasher/task-planning-context.js +12 -0
- package/dist/src/native/index.d.ts +582 -21
- package/dist/src/native/index.js +3 -3
- package/dist/src/native/native-bindings.js +13 -1
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/native/transform-objects.d.ts +11 -2
- package/dist/src/native/transform-objects.js +46 -0
- package/dist/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +15 -8
- package/dist/src/nx-cloud/update-manager.d.ts +3 -0
- package/dist/src/nx-cloud/update-manager.js +19 -13
- package/dist/src/nx-cloud/utilities/client.d.ts +1 -1
- package/dist/src/nx-cloud/utilities/client.js +1 -1
- package/dist/src/nx-cloud/utilities/is-workspace-claimed.js +2 -1
- package/dist/src/nx-cloud/utilities/nx-cloud-http-client.d.ts +5 -0
- package/dist/src/nx-cloud/utilities/nx-cloud-http-client.js +16 -0
- package/dist/src/nx-cloud/utilities/url-shorten.js +17 -10
- package/dist/src/plugins/js/index.js +45 -64
- package/dist/src/plugins/js/lock-file/lock-file.d.ts +4 -4
- package/dist/src/plugins/js/lock-file/lock-file.js +6 -7
- package/dist/src/plugins/js/lock-file/pnpm-parser.js +1 -1
- package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.d.ts +2 -0
- package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.js +22 -0
- package/dist/src/plugins/js/project-graph/affected/lock-file-changes.d.ts +10 -2
- package/dist/src/plugins/js/project-graph/affected/lock-file-changes.js +51 -29
- package/dist/src/plugins/js/project-graph/affected/npm-packages.d.ts +10 -2
- package/dist/src/plugins/js/project-graph/affected/npm-packages.js +32 -11
- package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +22 -18
- package/dist/src/plugins/js/utils/register.js +13 -4
- package/dist/src/plugins/package-json/create-nodes.d.ts +2 -2
- package/dist/src/plugins/package-json/create-nodes.js +13 -13
- package/dist/src/project-graph/affected/affected-project-graph-models.d.ts +14 -0
- package/dist/src/project-graph/affected/affected-project-graph.js +5 -18
- package/dist/src/project-graph/affected/affected-projects.d.ts +7 -0
- package/dist/src/project-graph/affected/affected-projects.js +42 -0
- package/dist/src/project-graph/affected/affected-reasons.d.ts +116 -0
- package/dist/src/project-graph/affected/affected-reasons.js +459 -0
- package/dist/src/project-graph/affected/affected-tasks.d.ts +103 -0
- package/dist/src/project-graph/affected/affected-tasks.js +386 -0
- package/dist/src/project-graph/affected/print-explanation.d.ts +11 -0
- package/dist/src/project-graph/affected/print-explanation.js +44 -0
- package/dist/src/project-graph/error-types.d.ts +5 -0
- package/dist/src/project-graph/error-types.js +44 -5
- package/dist/src/project-graph/file-utils.d.ts +2 -0
- package/dist/src/project-graph/file-utils.js +12 -3
- package/dist/src/project-graph/nx-deps-cache.d.ts +5 -2
- package/dist/src/project-graph/nx-deps-cache.js +4 -4
- package/dist/src/project-graph/plugins/get-plugins.d.ts +3 -1
- package/dist/src/project-graph/plugins/get-plugins.js +60 -82
- package/dist/src/project-graph/plugins/in-process-loader.d.ts +1 -1
- package/dist/src/project-graph/plugins/in-process-loader.js +1 -4
- package/dist/src/project-graph/plugins/isolation/index.d.ts +1 -1
- package/dist/src/project-graph/plugins/isolation/index.js +3 -1
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.d.ts +8 -0
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +42 -6
- package/dist/src/project-graph/plugins/isolation/load-isolated-plugin.d.ts +10 -1
- package/dist/src/project-graph/plugins/isolation/load-isolated-plugin.js +67 -17
- package/dist/src/project-graph/plugins/isolation/messaging.d.ts +3 -2
- package/dist/src/project-graph/plugins/isolation/plugin-worker.js +5 -1
- package/dist/src/project-graph/plugins/loaded-nx-plugin.d.ts +5 -2
- package/dist/src/project-graph/plugins/loaded-nx-plugin.js +14 -1
- package/dist/src/project-graph/plugins/nx-plugin-capabilities.d.ts +6 -0
- package/dist/src/project-graph/plugins/nx-plugin-capabilities.js +28 -0
- package/dist/src/project-graph/plugins/task-results-stub.d.ts +50 -0
- package/dist/src/project-graph/plugins/task-results-stub.js +111 -0
- package/dist/src/project-graph/plugins/tasks-execution-hooks.d.ts +3 -2
- package/dist/src/project-graph/plugins/tasks-execution-hooks.js +14 -1
- package/dist/src/project-graph/project-graph.js +43 -42
- package/dist/src/project-graph/utils/project-configuration/target-merging.js +67 -0
- package/dist/src/project-graph/utils/project-configuration/target-normalization.js +83 -0
- package/dist/src/project-graph/utils/project-configuration/utils.d.ts +1 -0
- package/dist/src/project-graph/utils/project-configuration/utils.js +1 -0
- package/dist/src/tasks-runner/batch/run-batch.js +15 -0
- package/dist/src/tasks-runner/cache.d.ts +37 -2
- package/dist/src/tasks-runner/cache.js +42 -1
- package/dist/src/tasks-runner/create-task-graph.d.ts +24 -1
- package/dist/src/tasks-runner/create-task-graph.js +57 -2
- package/dist/src/tasks-runner/default-tasks-runner.js +1 -1
- package/dist/src/tasks-runner/forked-process-task-runner.d.ts +1 -1
- package/dist/src/tasks-runner/forked-process-task-runner.js +11 -10
- package/dist/src/tasks-runner/init-tasks-runner.d.ts +7 -2
- package/dist/src/tasks-runner/init-tasks-runner.js +15 -7
- package/dist/src/tasks-runner/is-tui-enabled.js +4 -3
- package/dist/src/tasks-runner/life-cycle.d.ts +7 -0
- package/dist/src/tasks-runner/life-cycle.js +7 -0
- package/dist/src/tasks-runner/life-cycles/summary-terminal-output-life-cycle.d.ts +35 -0
- package/dist/src/tasks-runner/life-cycles/summary-terminal-output-life-cycle.js +146 -0
- package/dist/src/tasks-runner/prune-task-graph.d.ts +17 -0
- package/dist/src/tasks-runner/prune-task-graph.js +45 -0
- package/dist/src/tasks-runner/run-command.d.ts +41 -5
- package/dist/src/tasks-runner/run-command.js +98 -22
- package/dist/src/tasks-runner/running-tasks/batch-process.d.ts +93 -19
- package/dist/src/tasks-runner/running-tasks/batch-process.js +184 -88
- package/dist/src/tasks-runner/task-io-service.d.ts +11 -3
- package/dist/src/tasks-runner/task-io-service.js +14 -5
- package/dist/src/tasks-runner/task-orchestrator.d.ts +71 -4
- package/dist/src/tasks-runner/task-orchestrator.js +266 -66
- package/dist/src/tasks-runner/tasks-runner.d.ts +2 -0
- package/dist/src/tasks-runner/terminal-output-path.d.ts +11 -0
- package/dist/src/tasks-runner/terminal-output-path.js +18 -0
- package/dist/src/tasks-runner/utils.d.ts +5 -0
- package/dist/src/tasks-runner/utils.js +14 -2
- package/dist/src/ultracache/config.d.ts +21 -0
- package/dist/src/ultracache/config.js +29 -0
- package/dist/src/ultracache/fetch.d.ts +21 -0
- package/dist/src/ultracache/fetch.js +43 -0
- package/dist/src/ultracache/overrides.d.ts +17 -0
- package/dist/src/ultracache/overrides.js +61 -0
- package/dist/src/ultracache/report.d.ts +13 -0
- package/dist/src/ultracache/report.js +62 -0
- package/dist/src/ultracache/store.d.ts +41 -0
- package/dist/src/ultracache/store.js +158 -0
- package/dist/src/utils/ab-testing.d.ts +4 -1
- package/dist/src/utils/ab-testing.js +22 -19
- package/dist/src/utils/chunkify.d.ts +1 -7
- package/dist/src/utils/chunkify.js +2 -8
- package/dist/src/utils/command-line-utils.d.ts +20 -0
- package/dist/src/utils/command-line-utils.js +10 -3
- package/dist/src/utils/create-cli-options.d.ts +6 -0
- package/dist/src/utils/create-cli-options.js +29 -0
- package/dist/src/utils/db-connection.d.ts +2 -0
- package/dist/src/utils/db-connection.js +2 -0
- package/dist/src/utils/formatters/index.d.ts +6 -0
- package/dist/src/utils/formatters/index.js +5 -0
- package/dist/src/utils/formatters/prettier.d.ts +0 -8
- package/dist/src/utils/formatters/prettier.js +4 -26
- package/dist/src/utils/git-utils.d.ts +19 -0
- package/dist/src/utils/git-utils.js +97 -39
- package/dist/src/utils/handle-errors.js +5 -43
- package/dist/src/utils/http-client.d.ts +27 -0
- package/dist/src/utils/http-client.js +193 -0
- package/dist/src/utils/installed-nx-version.js +2 -48
- package/dist/src/utils/json-diff.d.ts +4 -2
- package/dist/src/utils/json-diff.js +6 -94
- package/dist/src/utils/min-release-age/packument.js +1 -1
- package/dist/src/utils/nx-cloud-utils.d.ts +2 -0
- package/dist/src/utils/nx-cloud-utils.js +6 -1
- package/dist/src/utils/output.d.ts +22 -3
- package/dist/src/utils/output.js +28 -5
- package/dist/src/utils/package-json.d.ts +25 -0
- package/dist/src/utils/package-json.js +49 -6
- package/dist/src/utils/package-manager.d.ts +6 -0
- package/dist/src/utils/package-manager.js +10 -0
- package/dist/src/utils/plugins/plugin-capabilities.js +7 -2
- package/dist/src/utils/project-graph-utils.d.ts +2 -0
- package/dist/src/utils/project-graph-utils.js +12 -0
- package/dist/src/utils/provenance.js +20 -4
- package/dist/src/utils/serialize-overrides-into-command-line.js +2 -4
- package/dist/src/utils/workspace-context.d.ts +51 -3
- package/dist/src/utils/workspace-context.js +174 -10
- package/package.json +38 -100
- package/schemas/nx-schema.json +38 -0
- package/schemas/project-schema.json +35 -0
- package/dist/src/daemon/server/file-watching/route-workspace-changes.d.ts +0 -9
- package/dist/src/daemon/server/file-watching/route-workspace-changes.js +0 -76
- package/dist/src/daemon/server/watcher.d.ts +0 -18
- package/dist/src/daemon/server/watcher.js +0 -126
- package/dist/src/nx-cloud/utilities/axios.d.ts +0 -4
- package/dist/src/nx-cloud/utilities/axios.js +0 -17
- package/dist/src/project-graph/affected/locators/project-glob-changes.d.ts +0 -2
- package/dist/src/project-graph/affected/locators/project-glob-changes.js +0 -47
- package/dist/src/project-graph/affected/locators/workspace-json-changes.d.ts +0 -4
- package/dist/src/project-graph/affected/locators/workspace-json-changes.js +0 -47
- package/dist/src/project-graph/affected/locators/workspace-projects.d.ts +0 -3
- package/dist/src/project-graph/affected/locators/workspace-projects.js +0 -74
- package/dist/src/utils/collapse-expanded-outputs.d.ts +0 -10
- package/dist/src/utils/collapse-expanded-outputs.js +0 -72
|
@@ -130,6 +130,12 @@ export declare function getWorkspaceRegistryUrlForDisplay(pkg: string): string |
|
|
|
130
130
|
export declare function packageRegistryView(pkg: string, version: string, args: string[], options?: {
|
|
131
131
|
forceNpm?: boolean;
|
|
132
132
|
}): Promise<string>;
|
|
133
|
+
/**
|
|
134
|
+
* Parses `npm view --json` output. npm 12 wraps the result in an array even
|
|
135
|
+
* when a single version matches; npm <= 11 and pnpm print the bare value. A
|
|
136
|
+
* multi-version match (range spec) stays an array.
|
|
137
|
+
*/
|
|
138
|
+
export declare function parseRegistryViewJson<T = unknown>(raw: string): T;
|
|
133
139
|
/**
|
|
134
140
|
* Only `npm pack` supports downloading a tarball of a specified remote
|
|
135
141
|
* package. `yarn` packs the active workspace, `pnpm pack` only packs
|
|
@@ -15,6 +15,7 @@ exports.resolvePackageVersionUsingRegistry = resolvePackageVersionUsingRegistry;
|
|
|
15
15
|
exports.resolvePackageVersionUsingInstallation = resolvePackageVersionUsingInstallation;
|
|
16
16
|
exports.getWorkspaceRegistryUrlForDisplay = getWorkspaceRegistryUrlForDisplay;
|
|
17
17
|
exports.packageRegistryView = packageRegistryView;
|
|
18
|
+
exports.parseRegistryViewJson = parseRegistryViewJson;
|
|
18
19
|
exports.packageRegistryPack = packageRegistryPack;
|
|
19
20
|
exports.clearPackageManagerVersionCache = clearPackageManagerVersionCache;
|
|
20
21
|
exports.getPackageWorkspaces = getPackageWorkspaces;
|
|
@@ -705,6 +706,15 @@ options) {
|
|
|
705
706
|
throw redactErrorCause(e);
|
|
706
707
|
}
|
|
707
708
|
}
|
|
709
|
+
/**
|
|
710
|
+
* Parses `npm view --json` output. npm 12 wraps the result in an array even
|
|
711
|
+
* when a single version matches; npm <= 11 and pnpm print the bare value. A
|
|
712
|
+
* multi-version match (range spec) stays an array.
|
|
713
|
+
*/
|
|
714
|
+
function parseRegistryViewJson(raw) {
|
|
715
|
+
const parsed = JSON.parse(raw);
|
|
716
|
+
return Array.isArray(parsed) && parsed.length === 1 ? parsed[0] : parsed;
|
|
717
|
+
}
|
|
708
718
|
/**
|
|
709
719
|
* Only `npm pack` supports downloading a tarball of a specified remote
|
|
710
720
|
* package. `yarn` packs the active workspace, `pnpm pack` only packs
|
|
@@ -63,12 +63,17 @@ async function tryGetModule(packageJson, workspaceRoot) {
|
|
|
63
63
|
packageJson['nx-migrations'] ??
|
|
64
64
|
packageJson['schematics'] ??
|
|
65
65
|
packageJson['builders']) {
|
|
66
|
-
|
|
67
|
-
return await pluginPromise;
|
|
66
|
+
return await (0, in_process_loader_1.loadNxPlugin)(packageJson.name, workspaceRoot);
|
|
68
67
|
}
|
|
69
68
|
else {
|
|
70
69
|
return {
|
|
71
70
|
name: packageJson.name,
|
|
71
|
+
capabilities: () => ({
|
|
72
|
+
hasCreateDependencies: false,
|
|
73
|
+
hasCreateMetadata: false,
|
|
74
|
+
hasPreTasksExecution: false,
|
|
75
|
+
hasPostTasksExecution: false,
|
|
76
|
+
}),
|
|
72
77
|
};
|
|
73
78
|
}
|
|
74
79
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ProjectGraph, ProjectGraphProjectNode } from '../config/project-graph';
|
|
2
2
|
import type { ProjectConfiguration } from '../config/workspace-json-project-json';
|
|
3
3
|
export declare function projectHasTarget(project: ProjectGraphProjectNode, target: string): boolean;
|
|
4
|
+
/** The projects that define at least one of `targets`. */
|
|
5
|
+
export declare function runnableForTarget(projects: Record<string, ProjectGraphProjectNode>, targets: string[]): Set<string>;
|
|
4
6
|
export declare function projectHasTargetAndConfiguration(project: ProjectGraphProjectNode, target: string, configuration: string): any;
|
|
5
7
|
export declare function getSourceDirOfDependentProjects(projectName: string, projectGraph?: ProjectGraph): [
|
|
6
8
|
projectDirs: string[],
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.projectHasTarget = projectHasTarget;
|
|
4
|
+
exports.runnableForTarget = runnableForTarget;
|
|
4
5
|
exports.projectHasTargetAndConfiguration = projectHasTargetAndConfiguration;
|
|
5
6
|
exports.getSourceDirOfDependentProjects = getSourceDirOfDependentProjects;
|
|
6
7
|
exports.findAllProjectNodeDependencies = findAllProjectNodeDependencies;
|
|
@@ -13,6 +14,17 @@ function projectHasTarget(project, target) {
|
|
|
13
14
|
project.data.targets &&
|
|
14
15
|
project.data.targets[target]);
|
|
15
16
|
}
|
|
17
|
+
/** The projects that define at least one of `targets`. */
|
|
18
|
+
function runnableForTarget(projects, targets) {
|
|
19
|
+
const runnable = new Set();
|
|
20
|
+
for (const projectName in projects) {
|
|
21
|
+
const project = projects[projectName];
|
|
22
|
+
if (targets.some((target) => projectHasTarget(project, target))) {
|
|
23
|
+
runnable.add(projectName);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return runnable;
|
|
27
|
+
}
|
|
16
28
|
function projectHasTargetAndConfiguration(project, target, configuration) {
|
|
17
29
|
return (projectHasTarget(project, target) &&
|
|
18
30
|
project.data.targets[target].configurations &&
|
|
@@ -13,6 +13,15 @@ const package_manager_1 = require("./package-manager");
|
|
|
13
13
|
*
|
|
14
14
|
* Will throw if the package does not have valid provenance.
|
|
15
15
|
*/
|
|
16
|
+
/**
|
|
17
|
+
* A build the publish workflow cuts from master rather than from a tag:
|
|
18
|
+
* `23.3.0-pr.36841.f66e88b` from a pull request, `23.2.0-canary.20260908-89f02c1`
|
|
19
|
+
* from the nightly. Each segment is matched with its leading digits so an
|
|
20
|
+
* ordinary prerelease like `1.0.0-preview.1` does not qualify.
|
|
21
|
+
*/
|
|
22
|
+
function isPublishedFromMaster(version) {
|
|
23
|
+
return /-pr\.\d+\./.test(version) || /-canary\.\d/.test(version);
|
|
24
|
+
}
|
|
16
25
|
async function ensurePackageHasProvenance(packageName, packageVersion) {
|
|
17
26
|
// this is used for locally released versions without provenance
|
|
18
27
|
// do not set this for other reasons or you might be exposed to security risks
|
|
@@ -25,8 +34,8 @@ async function ensurePackageHasProvenance(packageName, packageVersion) {
|
|
|
25
34
|
'--silent',
|
|
26
35
|
]);
|
|
27
36
|
const parsed = JSON.parse(result);
|
|
28
|
-
// `npm view <pkg>@<spec> --json` returns a bare object on npm <= 11
|
|
29
|
-
// array on npm 12
|
|
37
|
+
// `npm view <pkg>@<spec> --json` returns a bare object on npm <= 11 and
|
|
38
|
+
// pnpm but an array on npm 12, even for a single resolved version. A version
|
|
30
39
|
// range matches several versions and the registry lists all of them
|
|
31
40
|
// (including deprecated ones the installer skips), so we cannot tell which
|
|
32
41
|
// one will actually be installed; refuse rather than verify the wrong
|
|
@@ -57,8 +66,15 @@ async function ensurePackageHasProvenance(packageName, packageVersion) {
|
|
|
57
66
|
if (workflowParameters.path !== '.github/workflows/publish.yml') {
|
|
58
67
|
throw new ProvenanceError(packageName, packageVersion, 'Publishing workflow does not match .github/workflows/publish.yml');
|
|
59
68
|
}
|
|
60
|
-
|
|
61
|
-
|
|
69
|
+
// PR and canary releases are published by this same workflow running on
|
|
70
|
+
// master, so a tag for them does not exist and never will. Repository,
|
|
71
|
+
// workflow path and the artifact digest are still checked, so this only
|
|
72
|
+
// widens which ref of nrwl/nx is allowed to have built it.
|
|
73
|
+
const allowedRefs = isPublishedFromMaster(npmViewResult.version)
|
|
74
|
+
? [`refs/tags/${npmViewResult.version}`, 'refs/heads/master']
|
|
75
|
+
: [`refs/tags/${npmViewResult.version}`];
|
|
76
|
+
if (!allowedRefs.includes(workflowParameters.ref)) {
|
|
77
|
+
throw new ProvenanceError(packageName, packageVersion, `Version ref does not match ${allowedRefs.join(' or ')}`);
|
|
62
78
|
}
|
|
63
79
|
// verify that provenance was generated from the exact same artifact as the one we are installing
|
|
64
80
|
const distSha = Buffer.from(npmViewResult.dist.integrity.replace('sha512-', ''), 'base64').toString('hex');
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.serializeOverridesIntoCommandLine = serializeOverridesIntoCommandLine;
|
|
4
|
-
const flat_1 = require("flat");
|
|
5
4
|
const shell_quoting_1 = require("./shell-quoting");
|
|
6
5
|
function serializeOverridesIntoCommandLine(options) {
|
|
7
6
|
const unparsed = options._ ? [...options._] : [];
|
|
@@ -24,9 +23,8 @@ function serializeOption(key, value, unparsed) {
|
|
|
24
23
|
value.forEach((item) => serializeOption(key, item, unparsed));
|
|
25
24
|
}
|
|
26
25
|
else if (Object.prototype.toString.call(value) === '[object Object]') {
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
serializeOption(`${key}.${flattenedKey}`, flattened[flattenedKey], unparsed);
|
|
26
|
+
for (const nestedKey of Object.keys(value)) {
|
|
27
|
+
serializeOption(`${key}.${nestedKey}`, value[nestedKey], unparsed);
|
|
30
28
|
}
|
|
31
29
|
}
|
|
32
30
|
else if (typeof value === 'string' &&
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import type { NxWorkspaceFilesExternals } from '../native';
|
|
2
|
-
|
|
1
|
+
import type { ChangeBatch, NxWorkspaceFilesExternals, TaskOutputs, WorkspaceContext, WorkspaceContextOptions } from '../native';
|
|
2
|
+
/** The shapes the native watch calls back with, taken from the binding. A
|
|
3
|
+
* failure arrives as an Error with no batch or events, so both are nullable. */
|
|
4
|
+
export type WorkspaceChangesListener = Parameters<WorkspaceContext['onChanges']>[0];
|
|
5
|
+
export type WatchEventsListener = Parameters<WorkspaceContext['onWatchEvents']>[0];
|
|
6
|
+
export declare function setupWorkspaceContext(workspaceRoot: string, options?: WorkspaceContextOptions): void;
|
|
3
7
|
export declare function getNxWorkspaceFilesFromContext(workspaceRoot: string, projectRootMap: Record<string, string>, useDaemonProcess?: boolean): Promise<import("../native").NxWorkspaceFiles>;
|
|
4
8
|
/**
|
|
5
9
|
* Sync method to get files matching globs from workspace context.
|
|
@@ -14,8 +18,52 @@ export declare function multiGlobWithWorkspaceContext(workspaceRoot: string, glo
|
|
|
14
18
|
export declare function hashWithWorkspaceContext(workspaceRoot: string, globs: string[], exclude?: string[]): Promise<string>;
|
|
15
19
|
export declare function hashMultiGlobWithWorkspaceContext(workspaceRoot: string, globGroups: string[][]): Promise<string[]>;
|
|
16
20
|
export declare function updateContextWithChangedFiles(workspaceRoot: string, createdFiles: string[], updatedFiles: string[], deletedFiles: string[]): Promise<void>;
|
|
17
|
-
|
|
21
|
+
/**
|
|
22
|
+
* The subset of `paths` the workspace file map holds: what the watch tracks,
|
|
23
|
+
* with the ignore rules applied.
|
|
24
|
+
*/
|
|
25
|
+
export declare function trackedFilesInContext(workspaceRoot: string, paths: string[]): string[];
|
|
26
|
+
/** Remembers each task's outputs, as given or else as they are on disk now. */
|
|
27
|
+
export declare function recordOutputsInContext(workspaceRoot: string, entries: TaskOutputs[]): void;
|
|
28
|
+
/** Whether each task's outputs are still as last recorded for its hash. */
|
|
29
|
+
export declare function outputsUnchangedInContext(workspaceRoot: string, entries: TaskOutputs[]): boolean[];
|
|
30
|
+
export declare function updateFilesInContext(workspaceRoot: string, updatedFiles: string[], deletedFiles: string[]): ChangeBatch;
|
|
18
31
|
export declare function getAllFileDataInContext(workspaceRoot: string): Promise<import("../native").FileData[]>;
|
|
32
|
+
/**
|
|
33
|
+
* Listens for the changes a watching context applies: each change reaches the
|
|
34
|
+
* listeners once, here or in `settleWorkspaceContext`, whichever takes it
|
|
35
|
+
* first. Any number of listeners may listen. Returns a function that stops
|
|
36
|
+
* this one.
|
|
37
|
+
*/
|
|
38
|
+
export declare function subscribeToWorkspaceChanges(workspaceRoot: string, listener: WorkspaceChangesListener): () => void;
|
|
39
|
+
/**
|
|
40
|
+
* Applies every change the watcher has delivered, waiting out the kernel hop,
|
|
41
|
+
* and takes every change applied and not yet handed out. Empty when the
|
|
42
|
+
* context is not watching.
|
|
43
|
+
*/
|
|
44
|
+
export declare function settleWorkspaceContext(workspaceRoot: string): ChangeBatch;
|
|
45
|
+
/**
|
|
46
|
+
* Takes every change applied and not yet handed out, without waiting for the
|
|
47
|
+
* watcher: for a caller that has just applied changes itself.
|
|
48
|
+
*/
|
|
49
|
+
export declare function takeAppliedWorkspaceChanges(workspaceRoot: string): ChangeBatch;
|
|
50
|
+
export declare function isWatchingWorkspaceContext(): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Listens for every event the context's watch delivers, including writes
|
|
53
|
+
* under ignored directories and the `rescan` marker. Any number of listeners
|
|
54
|
+
* may listen. Returns a function that stops this one.
|
|
55
|
+
*/
|
|
56
|
+
export declare function subscribeToWatchEvents(workspaceRoot: string, listener: WatchEventsListener): () => void;
|
|
57
|
+
/** Whether a batch carries no change at all. */
|
|
58
|
+
export declare function isEmptyBatch(batch: ChangeBatch): boolean;
|
|
59
|
+
export declare function stopWatchingWorkspaceContext(): void;
|
|
19
60
|
export declare function getFilesInDirectoryUsingContext(workspaceRoot: string, dir: string): Promise<string[]>;
|
|
20
61
|
export declare function updateProjectFiles(projectRootMappings: Record<string, string>, rustReferences: NxWorkspaceFilesExternals, updatedFiles: Record<string, string>, deletedFiles: string[]): import("../native").UpdatedWorkspaceFiles;
|
|
62
|
+
/**
|
|
63
|
+
* Re-walks the host's files so the archive its plugin workers load includes
|
|
64
|
+
* writes made since the last walk, such as a migration flushing to disk. The
|
|
65
|
+
* walk is selective and shared through the files lock; one still running is
|
|
66
|
+
* reused rather than repeated.
|
|
67
|
+
*/
|
|
68
|
+
export declare function refreshWorkspaceContext(workspaceRoot: string): void;
|
|
21
69
|
export declare function resetWorkspaceContext(): void;
|
|
@@ -8,10 +8,21 @@ exports.multiGlobWithWorkspaceContext = multiGlobWithWorkspaceContext;
|
|
|
8
8
|
exports.hashWithWorkspaceContext = hashWithWorkspaceContext;
|
|
9
9
|
exports.hashMultiGlobWithWorkspaceContext = hashMultiGlobWithWorkspaceContext;
|
|
10
10
|
exports.updateContextWithChangedFiles = updateContextWithChangedFiles;
|
|
11
|
+
exports.trackedFilesInContext = trackedFilesInContext;
|
|
12
|
+
exports.recordOutputsInContext = recordOutputsInContext;
|
|
13
|
+
exports.outputsUnchangedInContext = outputsUnchangedInContext;
|
|
11
14
|
exports.updateFilesInContext = updateFilesInContext;
|
|
12
15
|
exports.getAllFileDataInContext = getAllFileDataInContext;
|
|
16
|
+
exports.subscribeToWorkspaceChanges = subscribeToWorkspaceChanges;
|
|
17
|
+
exports.settleWorkspaceContext = settleWorkspaceContext;
|
|
18
|
+
exports.takeAppliedWorkspaceChanges = takeAppliedWorkspaceChanges;
|
|
19
|
+
exports.isWatchingWorkspaceContext = isWatchingWorkspaceContext;
|
|
20
|
+
exports.subscribeToWatchEvents = subscribeToWatchEvents;
|
|
21
|
+
exports.isEmptyBatch = isEmptyBatch;
|
|
22
|
+
exports.stopWatchingWorkspaceContext = stopWatchingWorkspaceContext;
|
|
13
23
|
exports.getFilesInDirectoryUsingContext = getFilesInDirectoryUsingContext;
|
|
14
24
|
exports.updateProjectFiles = updateProjectFiles;
|
|
25
|
+
exports.refreshWorkspaceContext = refreshWorkspaceContext;
|
|
15
26
|
exports.resetWorkspaceContext = resetWorkspaceContext;
|
|
16
27
|
const perf_hooks_1 = require("perf_hooks");
|
|
17
28
|
const cache_directory_1 = require("./cache-directory");
|
|
@@ -19,16 +30,36 @@ const is_on_daemon_1 = require("../daemon/is-on-daemon");
|
|
|
19
30
|
const client_1 = require("../daemon/client/client");
|
|
20
31
|
const handle_import_1 = require("./handle-import");
|
|
21
32
|
let workspaceContext;
|
|
22
|
-
|
|
33
|
+
let filesReady;
|
|
34
|
+
// Survive a reset: the daemon tears its context down and lets the next read
|
|
35
|
+
// recreate it, and that context must watch and report like the one before.
|
|
36
|
+
let contextOptions;
|
|
37
|
+
let contextRoot;
|
|
38
|
+
let contextGeneration = 0;
|
|
39
|
+
const changeListeners = new Set();
|
|
40
|
+
const eventListeners = new Set();
|
|
41
|
+
function setupWorkspaceContext(workspaceRoot, options) {
|
|
23
42
|
const { WorkspaceContext } = require('../native');
|
|
24
43
|
perf_hooks_1.performance.mark('workspace-context');
|
|
25
|
-
|
|
44
|
+
const cacheDir = (0, cache_directory_1.workspaceDataDirectoryForWorkspace)(workspaceRoot);
|
|
45
|
+
// A plugin worker is only asked for files after its host finished walking
|
|
46
|
+
// and wrote the archive, so it loads that rather than walking again.
|
|
47
|
+
workspaceContext = global.NX_PLUGIN_WORKER
|
|
48
|
+
? WorkspaceContext.fromArchive(workspaceRoot, cacheDir, options)
|
|
49
|
+
: new WorkspaceContext(workspaceRoot, cacheDir, options);
|
|
50
|
+
contextOptions = options;
|
|
51
|
+
contextRoot = workspaceRoot;
|
|
52
|
+
contextGeneration++;
|
|
53
|
+
filesReady = undefined;
|
|
54
|
+
if (options?.watch) {
|
|
55
|
+
attachSubscribers();
|
|
56
|
+
}
|
|
26
57
|
perf_hooks_1.performance.mark('workspace-context:end');
|
|
27
58
|
perf_hooks_1.performance.measure('workspace context init', 'workspace-context', 'workspace-context:end');
|
|
28
59
|
}
|
|
29
60
|
async function getNxWorkspaceFilesFromContext(workspaceRoot, projectRootMap, useDaemonProcess = true) {
|
|
30
61
|
if (!useDaemonProcess || (0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {
|
|
31
|
-
|
|
62
|
+
await ensureFilesReady(workspaceRoot);
|
|
32
63
|
return workspaceContext.getWorkspaceFiles(projectRootMap);
|
|
33
64
|
}
|
|
34
65
|
return client_1.daemonClient.getWorkspaceFiles(projectRootMap);
|
|
@@ -46,7 +77,7 @@ function globWithWorkspaceContextSync(workspaceRoot, globs, exclude) {
|
|
|
46
77
|
}
|
|
47
78
|
async function globWithWorkspaceContext(workspaceRoot, globs, exclude) {
|
|
48
79
|
if (workspaceRoot === '/virtual' || (0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {
|
|
49
|
-
|
|
80
|
+
await ensureFilesReady(workspaceRoot);
|
|
50
81
|
return workspaceContext.glob(globs, exclude);
|
|
51
82
|
}
|
|
52
83
|
else {
|
|
@@ -55,21 +86,21 @@ async function globWithWorkspaceContext(workspaceRoot, globs, exclude) {
|
|
|
55
86
|
}
|
|
56
87
|
async function multiGlobWithWorkspaceContext(workspaceRoot, globs, exclude) {
|
|
57
88
|
if (workspaceRoot === '/virtual' || (0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {
|
|
58
|
-
|
|
89
|
+
await ensureFilesReady(workspaceRoot);
|
|
59
90
|
return workspaceContext.multiGlob(globs, exclude);
|
|
60
91
|
}
|
|
61
92
|
return client_1.daemonClient.multiGlob(globs, exclude);
|
|
62
93
|
}
|
|
63
94
|
async function hashWithWorkspaceContext(workspaceRoot, globs, exclude) {
|
|
64
95
|
if ((0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {
|
|
65
|
-
|
|
96
|
+
await ensureFilesReady(workspaceRoot);
|
|
66
97
|
return workspaceContext.hashFilesMatchingGlob(globs, exclude);
|
|
67
98
|
}
|
|
68
99
|
return client_1.daemonClient.hashGlob(globs, exclude);
|
|
69
100
|
}
|
|
70
101
|
async function hashMultiGlobWithWorkspaceContext(workspaceRoot, globGroups) {
|
|
71
102
|
if ((0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {
|
|
72
|
-
|
|
103
|
+
await ensureFilesReady(workspaceRoot);
|
|
73
104
|
return workspaceContext.hashFilesMatchingGlobs(globGroups);
|
|
74
105
|
}
|
|
75
106
|
return client_1.daemonClient.hashMultiGlob(globGroups);
|
|
@@ -89,20 +120,116 @@ async function updateContextWithChangedFiles(workspaceRoot, createdFiles, update
|
|
|
89
120
|
await client_1.daemonClient.updateWorkspaceContext(createdFiles, updatedFiles, deletedFiles);
|
|
90
121
|
}
|
|
91
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* The subset of `paths` the workspace file map holds: what the watch tracks,
|
|
125
|
+
* with the ignore rules applied.
|
|
126
|
+
*/
|
|
127
|
+
function trackedFilesInContext(workspaceRoot, paths) {
|
|
128
|
+
ensureContextAvailable(workspaceRoot);
|
|
129
|
+
return workspaceContext?.trackedFiles(paths) ?? [];
|
|
130
|
+
}
|
|
131
|
+
/** Remembers each task's outputs, as given or else as they are on disk now. */
|
|
132
|
+
function recordOutputsInContext(workspaceRoot, entries) {
|
|
133
|
+
ensureContextAvailable(workspaceRoot);
|
|
134
|
+
workspaceContext?.recordOutputs(entries);
|
|
135
|
+
}
|
|
136
|
+
/** Whether each task's outputs are still as last recorded for its hash. */
|
|
137
|
+
function outputsUnchangedInContext(workspaceRoot, entries) {
|
|
138
|
+
ensureContextAvailable(workspaceRoot);
|
|
139
|
+
return (workspaceContext?.outputsUnchanged(entries) ?? entries.map(() => false));
|
|
140
|
+
}
|
|
92
141
|
function updateFilesInContext(workspaceRoot, updatedFiles, deletedFiles) {
|
|
93
142
|
ensureContextAvailable(workspaceRoot);
|
|
94
143
|
return workspaceContext?.incrementalUpdate(updatedFiles, deletedFiles);
|
|
95
144
|
}
|
|
96
145
|
async function getAllFileDataInContext(workspaceRoot) {
|
|
97
146
|
if ((0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {
|
|
98
|
-
|
|
147
|
+
await ensureFilesReady(workspaceRoot);
|
|
99
148
|
return workspaceContext.allFileData();
|
|
100
149
|
}
|
|
101
150
|
return client_1.daemonClient.getWorkspaceContextFileData();
|
|
102
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* Listens for the changes a watching context applies: each change reaches the
|
|
154
|
+
* listeners once, here or in `settleWorkspaceContext`, whichever takes it
|
|
155
|
+
* first. Any number of listeners may listen. Returns a function that stops
|
|
156
|
+
* this one.
|
|
157
|
+
*/
|
|
158
|
+
function subscribeToWorkspaceChanges(workspaceRoot, listener) {
|
|
159
|
+
changeListeners.add(listener);
|
|
160
|
+
ensureContextAvailable(workspaceRoot);
|
|
161
|
+
attachSubscribers();
|
|
162
|
+
return () => changeListeners.delete(listener);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Applies every change the watcher has delivered, waiting out the kernel hop,
|
|
166
|
+
* and takes every change applied and not yet handed out. Empty when the
|
|
167
|
+
* context is not watching.
|
|
168
|
+
*/
|
|
169
|
+
function settleWorkspaceContext(workspaceRoot) {
|
|
170
|
+
ensureContextAvailable(workspaceRoot);
|
|
171
|
+
return workspaceContext.settle();
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Takes every change applied and not yet handed out, without waiting for the
|
|
175
|
+
* watcher: for a caller that has just applied changes itself.
|
|
176
|
+
*/
|
|
177
|
+
function takeAppliedWorkspaceChanges(workspaceRoot) {
|
|
178
|
+
ensureContextAvailable(workspaceRoot);
|
|
179
|
+
return workspaceContext.takeAppliedChanges();
|
|
180
|
+
}
|
|
181
|
+
function isWatchingWorkspaceContext() {
|
|
182
|
+
return !!contextOptions?.watch;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Listens for every event the context's watch delivers, including writes
|
|
186
|
+
* under ignored directories and the `rescan` marker. Any number of listeners
|
|
187
|
+
* may listen. Returns a function that stops this one.
|
|
188
|
+
*/
|
|
189
|
+
function subscribeToWatchEvents(workspaceRoot, listener) {
|
|
190
|
+
eventListeners.add(listener);
|
|
191
|
+
ensureContextAvailable(workspaceRoot);
|
|
192
|
+
attachSubscribers();
|
|
193
|
+
return () => eventListeners.delete(listener);
|
|
194
|
+
}
|
|
195
|
+
/** Whether a batch carries no change at all. */
|
|
196
|
+
function isEmptyBatch(batch) {
|
|
197
|
+
return (batch.createdFiles.length === 0 &&
|
|
198
|
+
batch.updatedFiles.length === 0 &&
|
|
199
|
+
batch.deletedFiles.length === 0);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* The native context takes one subscriber per stream; it fans out here. A
|
|
203
|
+
* delivery a replaced context had already queued does not reach listeners as
|
|
204
|
+
* if it came from the current one.
|
|
205
|
+
*/
|
|
206
|
+
function attachSubscribers() {
|
|
207
|
+
if (!workspaceContext || !contextOptions?.watch)
|
|
208
|
+
return;
|
|
209
|
+
const generation = contextGeneration;
|
|
210
|
+
const current = () => generation === contextGeneration;
|
|
211
|
+
workspaceContext.onChanges((err, batch) => {
|
|
212
|
+
if (!current() || (!err && (!batch || isEmptyBatch(batch))))
|
|
213
|
+
return;
|
|
214
|
+
for (const listener of changeListeners)
|
|
215
|
+
listener(err, batch);
|
|
216
|
+
});
|
|
217
|
+
workspaceContext.onWatchEvents((err, events) => {
|
|
218
|
+
if (!current())
|
|
219
|
+
return;
|
|
220
|
+
for (const listener of eventListeners)
|
|
221
|
+
listener(err, events);
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
function stopWatchingWorkspaceContext() {
|
|
225
|
+
changeListeners.clear();
|
|
226
|
+
eventListeners.clear();
|
|
227
|
+
contextOptions = undefined;
|
|
228
|
+
workspaceContext?.stopWatching();
|
|
229
|
+
}
|
|
103
230
|
async function getFilesInDirectoryUsingContext(workspaceRoot, dir) {
|
|
104
231
|
if ((0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {
|
|
105
|
-
|
|
232
|
+
await ensureFilesReady(workspaceRoot);
|
|
106
233
|
return workspaceContext.getFilesInDirectory(dir);
|
|
107
234
|
}
|
|
108
235
|
return client_1.daemonClient.getFilesInDirectory(dir);
|
|
@@ -110,11 +237,48 @@ async function getFilesInDirectoryUsingContext(workspaceRoot, dir) {
|
|
|
110
237
|
function updateProjectFiles(projectRootMappings, rustReferences, updatedFiles, deletedFiles) {
|
|
111
238
|
return workspaceContext?.updateProjectFiles(projectRootMappings, rustReferences.projectFiles, rustReferences.globalFiles, updatedFiles, deletedFiles);
|
|
112
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* Waits for the walk behind the context without holding the event loop. The
|
|
242
|
+
* native readers block the calling thread until the files exist, so the async
|
|
243
|
+
* entry points await this first; a plugin host is then never frozen while a
|
|
244
|
+
* worker is connecting to it.
|
|
245
|
+
*/
|
|
246
|
+
async function ensureFilesReady(workspaceRoot) {
|
|
247
|
+
ensureContextAvailable(workspaceRoot);
|
|
248
|
+
// A binding without `ready` (an older native build, a mocked one) reads
|
|
249
|
+
// synchronously as before.
|
|
250
|
+
filesReady ??= workspaceContext.ready?.() ?? Promise.resolve();
|
|
251
|
+
await filesReady;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Re-walks the host's files so the archive its plugin workers load includes
|
|
255
|
+
* writes made since the last walk, such as a migration flushing to disk. The
|
|
256
|
+
* walk is selective and shared through the files lock; one still running is
|
|
257
|
+
* reused rather than repeated.
|
|
258
|
+
*/
|
|
259
|
+
function refreshWorkspaceContext(workspaceRoot) {
|
|
260
|
+
if (workspaceRoot === '/virtual' || (0, is_on_daemon_1.isOnDaemon)() || client_1.daemonClient.enabled()) {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
if (workspaceContext?.workspaceRoot !== workspaceRoot) {
|
|
264
|
+
setupWorkspaceContext(workspaceRoot);
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
workspaceContext.refresh();
|
|
268
|
+
filesReady = undefined;
|
|
269
|
+
}
|
|
113
270
|
function ensureContextAvailable(workspaceRoot) {
|
|
114
271
|
if (!workspaceContext || workspaceContext?.workspaceRoot !== workspaceRoot) {
|
|
115
|
-
setupWorkspaceContext(workspaceRoot);
|
|
272
|
+
setupWorkspaceContext(workspaceRoot, contextOptions);
|
|
116
273
|
}
|
|
117
274
|
}
|
|
118
275
|
function resetWorkspaceContext() {
|
|
276
|
+
workspaceContext?.stopWatching?.();
|
|
119
277
|
workspaceContext = undefined;
|
|
278
|
+
filesReady = undefined;
|
|
279
|
+
// A watching context is the daemon's only watch; left for the next read to
|
|
280
|
+
// re-create, output and dotenv events in between would be lost.
|
|
281
|
+
if (contextOptions?.watch && contextRoot) {
|
|
282
|
+
setupWorkspaceContext(contextRoot, contextOptions);
|
|
283
|
+
}
|
|
120
284
|
}
|