@depup/nx 23.2.1-depup.8 → 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 +7 -18
- package/changes.json +9 -53
- 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 +36 -98
- 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
package/dist/src/native/index.js
CHANGED
|
@@ -210,7 +210,7 @@ Module._load = function (request, parent, isMain) {
|
|
|
210
210
|
|
|
211
211
|
const indexModulePath = require.resolve('./native-bindings.js');
|
|
212
212
|
delete require.cache[indexModulePath];
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
module.exports =
|
|
213
|
+
// A direct re-export: node's CommonJS export lexer follows this form, so ESM
|
|
214
|
+
// importers see the named exports. Assigning via a variable hides them.
|
|
215
|
+
module.exports = require('./native-bindings.js');
|
|
216
216
|
Module._load = originalLoad;
|
|
@@ -582,9 +582,11 @@ module.exports.FileLock = nativeBinding.FileLock
|
|
|
582
582
|
module.exports.HashPlanInspector = nativeBinding.HashPlanInspector
|
|
583
583
|
module.exports.HashPlanner = nativeBinding.HashPlanner
|
|
584
584
|
module.exports.HttpRemoteCache = nativeBinding.HttpRemoteCache
|
|
585
|
+
module.exports.IgnoredIndexReader = nativeBinding.IgnoredIndexReader
|
|
585
586
|
module.exports.ImportResult = nativeBinding.ImportResult
|
|
586
587
|
module.exports.NxCache = nativeBinding.NxCache
|
|
587
588
|
module.exports.NxConsolePreferences = nativeBinding.NxConsolePreferences
|
|
589
|
+
module.exports.NxPluginCapabilities = nativeBinding.NxPluginCapabilities
|
|
588
590
|
module.exports.NxTaskHistory = nativeBinding.NxTaskHistory
|
|
589
591
|
module.exports.ProcessMetricsCollector = nativeBinding.ProcessMetricsCollector
|
|
590
592
|
module.exports.RunningTasksService = nativeBinding.RunningTasksService
|
|
@@ -592,8 +594,10 @@ module.exports.RustPseudoTerminal = nativeBinding.RustPseudoTerminal
|
|
|
592
594
|
module.exports.TaskDetails = nativeBinding.TaskDetails
|
|
593
595
|
module.exports.TaskHasher = nativeBinding.TaskHasher
|
|
594
596
|
module.exports.TaskInvocationTracker = nativeBinding.TaskInvocationTracker
|
|
595
|
-
module.exports.
|
|
597
|
+
module.exports.UltracacheConfigurations = nativeBinding.UltracacheConfigurations
|
|
598
|
+
module.exports.UltracacheConfigurationStore = nativeBinding.UltracacheConfigurationStore
|
|
596
599
|
module.exports.WorkspaceContext = nativeBinding.WorkspaceContext
|
|
600
|
+
module.exports.affectedTasks = nativeBinding.affectedTasks
|
|
597
601
|
module.exports.BatchStatus = nativeBinding.BatchStatus
|
|
598
602
|
module.exports.canInstallNxConsole = nativeBinding.canInstallNxConsole
|
|
599
603
|
module.exports.canInstallNxConsoleForEditor = nativeBinding.canInstallNxConsoleForEditor
|
|
@@ -601,7 +605,10 @@ module.exports.closeDbConnection = nativeBinding.closeDbConnection
|
|
|
601
605
|
module.exports.connectToNxDb = nativeBinding.connectToNxDb
|
|
602
606
|
module.exports.copy = nativeBinding.copy
|
|
603
607
|
module.exports.detectAiAgent = nativeBinding.detectAiAgent
|
|
608
|
+
module.exports.diffJson = nativeBinding.diffJson
|
|
609
|
+
module.exports.directlyTouchedProjects = nativeBinding.directlyTouchedProjects
|
|
604
610
|
module.exports.EventType = nativeBinding.EventType
|
|
611
|
+
module.exports.expandFilesInput = nativeBinding.expandFilesInput
|
|
605
612
|
module.exports.expandOutputs = nativeBinding.expandOutputs
|
|
606
613
|
module.exports.findImports = nativeBinding.findImports
|
|
607
614
|
module.exports.flushTelemetry = nativeBinding.flushTelemetry
|
|
@@ -613,6 +620,8 @@ module.exports.getFilesForOutputsBatch = nativeBinding.getFilesForOutputsBatch
|
|
|
613
620
|
module.exports.getHardcodedIgnorePatterns = nativeBinding.getHardcodedIgnorePatterns
|
|
614
621
|
module.exports.getMainWorktreeRoot = nativeBinding.getMainWorktreeRoot
|
|
615
622
|
module.exports.getTransformableOutputs = nativeBinding.getTransformableOutputs
|
|
623
|
+
module.exports.getUltracacheDeferredTaskIds = nativeBinding.getUltracacheDeferredTaskIds
|
|
624
|
+
module.exports.getUltracacheReport = nativeBinding.getUltracacheReport
|
|
616
625
|
module.exports.GroupType = nativeBinding.GroupType
|
|
617
626
|
module.exports.hashArray = nativeBinding.hashArray
|
|
618
627
|
module.exports.hashFile = nativeBinding.hashFile
|
|
@@ -625,6 +634,7 @@ module.exports.isAiAgent = nativeBinding.isAiAgent
|
|
|
625
634
|
module.exports.isEditorInstalled = nativeBinding.isEditorInstalled
|
|
626
635
|
module.exports.killProcessTree = nativeBinding.killProcessTree
|
|
627
636
|
module.exports.killProcessTreeGraceful = nativeBinding.killProcessTreeGraceful
|
|
637
|
+
module.exports.locateTouchedProjects = nativeBinding.locateTouchedProjects
|
|
628
638
|
module.exports.logDebug = nativeBinding.logDebug
|
|
629
639
|
module.exports.matchGlobPaths = nativeBinding.matchGlobPaths
|
|
630
640
|
module.exports.matchOutputPaths = nativeBinding.matchOutputPaths
|
|
@@ -633,10 +643,12 @@ module.exports.remove = nativeBinding.remove
|
|
|
633
643
|
module.exports.restoreTerminal = nativeBinding.restoreTerminal
|
|
634
644
|
module.exports.RunMode = nativeBinding.RunMode
|
|
635
645
|
module.exports.SupportedEditor = nativeBinding.SupportedEditor
|
|
646
|
+
module.exports.sweepBatchOutputs = nativeBinding.sweepBatchOutputs
|
|
636
647
|
module.exports.TaskStatus = nativeBinding.TaskStatus
|
|
637
648
|
module.exports.testOnlyTransferFileMap = nativeBinding.testOnlyTransferFileMap
|
|
638
649
|
module.exports.trackEvent = nativeBinding.trackEvent
|
|
639
650
|
module.exports.trackPageView = nativeBinding.trackPageView
|
|
640
651
|
module.exports.transferProjectGraph = nativeBinding.transferProjectGraph
|
|
652
|
+
module.exports.UltracacheMode = nativeBinding.UltracacheMode
|
|
641
653
|
module.exports.validateOutputs = nativeBinding.validateOutputs
|
|
642
654
|
module.exports.WorkspaceErrors = nativeBinding.WorkspaceErrors
|
|
Binary file
|
|
Binary file
|
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
import { ProjectGraph } from '../config/project-graph';
|
|
2
|
-
import { ProjectGraph as RustProjectGraph } from './index';
|
|
3
|
-
|
|
2
|
+
import { ExternalObject, ProjectGraph as RustProjectGraph } from './index';
|
|
3
|
+
/** The graph copied into Rust, once per graph. */
|
|
4
|
+
export declare function transformProjectGraphForRust(graph: ProjectGraph): ExternalObject<RustProjectGraph>;
|
|
5
|
+
/**
|
|
6
|
+
* Only what the touched-project locators read: project roots, named inputs and
|
|
7
|
+
* target inputs. Copying target options and every edge costs several times
|
|
8
|
+
* what the locators themselves do on a large workspace.
|
|
9
|
+
*/
|
|
10
|
+
export declare function transformProjectGraphForLocators(graph: ProjectGraph): ExternalObject<RustProjectGraph>;
|
|
11
|
+
/** The graph in Rust's shape, still a JS object. Uncached, so safe to edit. */
|
|
12
|
+
export declare function toRustProjectGraph(graph: ProjectGraph): RustProjectGraph;
|
|
@@ -1,7 +1,52 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.transformProjectGraphForRust = transformProjectGraphForRust;
|
|
4
|
+
exports.transformProjectGraphForLocators = transformProjectGraphForLocators;
|
|
5
|
+
exports.toRustProjectGraph = toRustProjectGraph;
|
|
6
|
+
const index_1 = require("./index");
|
|
7
|
+
/**
|
|
8
|
+
* Keyed by graph identity, but weak so a replaced graph is collectable. A run's
|
|
9
|
+
* hasher reuses what affected's planner already copied.
|
|
10
|
+
*/
|
|
11
|
+
const transferred = new WeakMap();
|
|
12
|
+
/** The graph copied into Rust, once per graph. */
|
|
4
13
|
function transformProjectGraphForRust(graph) {
|
|
14
|
+
let ref = transferred.get(graph);
|
|
15
|
+
if (!ref) {
|
|
16
|
+
ref = (0, index_1.transferProjectGraph)(toRustProjectGraph(graph));
|
|
17
|
+
transferred.set(graph, ref);
|
|
18
|
+
}
|
|
19
|
+
return ref;
|
|
20
|
+
}
|
|
21
|
+
/** Per graph like `transferred`: `nx release` runs the locators once per commit. */
|
|
22
|
+
const transferredForLocators = new WeakMap();
|
|
23
|
+
/**
|
|
24
|
+
* Only what the touched-project locators read: project roots, named inputs and
|
|
25
|
+
* target inputs. Copying target options and every edge costs several times
|
|
26
|
+
* what the locators themselves do on a large workspace.
|
|
27
|
+
*/
|
|
28
|
+
function transformProjectGraphForLocators(graph) {
|
|
29
|
+
let ref = transferredForLocators.get(graph);
|
|
30
|
+
if (!ref) {
|
|
31
|
+
const nodes = {};
|
|
32
|
+
for (const [name, node] of Object.entries(graph.nodes)) {
|
|
33
|
+
const targets = {};
|
|
34
|
+
for (const [target, config] of Object.entries(node.data.targets ?? {})) {
|
|
35
|
+
targets[target] = { inputs: config.inputs };
|
|
36
|
+
}
|
|
37
|
+
nodes[name] = {
|
|
38
|
+
root: node.data.root,
|
|
39
|
+
namedInputs: node.data.namedInputs,
|
|
40
|
+
targets,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
ref = (0, index_1.transferProjectGraph)({ nodes, externalNodes: {}, dependencies: {} });
|
|
44
|
+
transferredForLocators.set(graph, ref);
|
|
45
|
+
}
|
|
46
|
+
return ref;
|
|
47
|
+
}
|
|
48
|
+
/** The graph in Rust's shape, still a JS object. Uncached, so safe to edit. */
|
|
49
|
+
function toRustProjectGraph(graph) {
|
|
5
50
|
const dependencies = {};
|
|
6
51
|
const nodes = {};
|
|
7
52
|
const externalNodes = {};
|
|
@@ -32,6 +77,7 @@ function transformProjectGraphForRust(graph) {
|
|
|
32
77
|
}
|
|
33
78
|
for (const [projectName, externalNode] of Object.entries(graph.externalNodes ?? {})) {
|
|
34
79
|
externalNodes[projectName] = {
|
|
80
|
+
type: externalNode.type,
|
|
35
81
|
packageName: externalNode.data.packageName,
|
|
36
82
|
hash: externalNode.data.hash,
|
|
37
83
|
version: externalNode.data.version,
|
|
@@ -11,6 +11,7 @@ const url_shorten_1 = require("../../utilities/url-shorten");
|
|
|
11
11
|
const get_cloud_options_1 = require("../../utilities/get-cloud-options");
|
|
12
12
|
const path_1 = require("path");
|
|
13
13
|
const git_utils_1 = require("../../../utils/git-utils");
|
|
14
|
+
const http_client_1 = require("../../../utils/http-client");
|
|
14
15
|
function printCloudConnectionDisabledMessage() {
|
|
15
16
|
output_1.output.error({
|
|
16
17
|
title: `Connections to Nx Cloud are disabled for this workspace`,
|
|
@@ -46,10 +47,13 @@ function getNxInitDate() {
|
|
|
46
47
|
}
|
|
47
48
|
async function createNxCloudWorkspaceV1(workspaceName, installationSource, nxInitDate) {
|
|
48
49
|
const apiUrl = (0, get_cloud_options_1.getCloudUrl)();
|
|
49
|
-
const response = await
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
const response = await (0, http_client_1.httpRequest)(`${apiUrl}/nx-cloud/create-org-and-workspace`, {
|
|
51
|
+
method: 'POST',
|
|
52
|
+
data: {
|
|
53
|
+
workspaceName,
|
|
54
|
+
installationSource,
|
|
55
|
+
nxInitDate,
|
|
56
|
+
},
|
|
53
57
|
});
|
|
54
58
|
if (response.data.message) {
|
|
55
59
|
throw new Error(response.data.message);
|
|
@@ -58,10 +62,13 @@ async function createNxCloudWorkspaceV1(workspaceName, installationSource, nxIni
|
|
|
58
62
|
}
|
|
59
63
|
async function createNxCloudWorkspaceV2(workspaceName, installationSource, nxInitDate) {
|
|
60
64
|
const apiUrl = (0, get_cloud_options_1.getCloudUrl)();
|
|
61
|
-
const response = await
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
const response = await (0, http_client_1.httpRequest)(`${apiUrl}/nx-cloud/v2/create-org-and-workspace`, {
|
|
66
|
+
method: 'POST',
|
|
67
|
+
data: {
|
|
68
|
+
workspaceName,
|
|
69
|
+
installationSource,
|
|
70
|
+
nxInitDate,
|
|
71
|
+
},
|
|
65
72
|
});
|
|
66
73
|
if (response.data.message) {
|
|
67
74
|
throw new Error(response.data.message);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CloudTaskRunnerOptions } from './nx-cloud-tasks-runner-shell';
|
|
2
|
+
import type { ReadUltracacheConfigurationsOptions, ReadUltracacheConfigurationsResult } from '../ultracache/fetch';
|
|
2
3
|
import { TasksRunner } from '../tasks-runner/tasks-runner';
|
|
3
4
|
import { RemoteCacheV2 } from '../tasks-runner/default-tasks-runner';
|
|
4
5
|
export declare class NxCloudEnterpriseOutdatedError extends Error {
|
|
@@ -12,6 +13,8 @@ export interface NxCloudClient {
|
|
|
12
13
|
commands: Record<string, () => Promise<void>>;
|
|
13
14
|
nxCloudTasksRunner: TasksRunner<CloudTaskRunnerOptions>;
|
|
14
15
|
getRemoteCache: () => RemoteCacheV2;
|
|
16
|
+
/** Clients that expose Ultracache configurations; see `fetchUltracacheConfigurations`. */
|
|
17
|
+
readUltracacheConfigurations?: (options: ReadUltracacheConfigurationsOptions) => Promise<ReadUltracacheConfigurationsResult | null>;
|
|
15
18
|
}
|
|
16
19
|
export declare function verifyOrUpdateNxCloudClient(options?: {
|
|
17
20
|
url?: string;
|
|
@@ -6,9 +6,11 @@ exports.getBundleInstallDefaultLocation = getBundleInstallDefaultLocation;
|
|
|
6
6
|
const tslib_1 = require("tslib");
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
8
|
const zlib_1 = require("zlib");
|
|
9
|
+
const stream_1 = require("stream");
|
|
9
10
|
const path_1 = require("path");
|
|
10
11
|
const os_1 = require("os");
|
|
11
|
-
const
|
|
12
|
+
const nx_cloud_http_client_1 = require("./utilities/nx-cloud-http-client");
|
|
13
|
+
const http_client_1 = require("../utils/http-client");
|
|
12
14
|
const debug_logger_1 = require("./debug-logger");
|
|
13
15
|
const tar = tslib_1.__importStar(require("tar-stream"));
|
|
14
16
|
const cache_directory_1 = require("../utils/cache-directory");
|
|
@@ -32,14 +34,14 @@ async function verifyOrUpdateNxCloudClient(options) {
|
|
|
32
34
|
const currentBundle = getLatestInstalledRunnerBundle();
|
|
33
35
|
const apiUrl = process.env.NX_CLOUD_API || options?.url || 'https://cloud.nx.app';
|
|
34
36
|
if (shouldVerifyInstalledRunnerBundle(currentBundle)) {
|
|
35
|
-
const
|
|
37
|
+
const httpClient = (0, nx_cloud_http_client_1.createApiHttpClient)(options);
|
|
36
38
|
let verifyBundleResponse;
|
|
37
39
|
try {
|
|
38
|
-
verifyBundleResponse = await verifyCurrentBundle(
|
|
40
|
+
verifyBundleResponse = await verifyCurrentBundle(httpClient, currentBundle);
|
|
39
41
|
}
|
|
40
42
|
catch (e) {
|
|
41
43
|
// Enterprise image compatibility, to be removed
|
|
42
|
-
if (e
|
|
44
|
+
if (e instanceof http_client_1.HttpError && e.status === 404 && apiUrl) {
|
|
43
45
|
throw new NxCloudEnterpriseOutdatedError(apiUrl);
|
|
44
46
|
}
|
|
45
47
|
(0, debug_logger_1.debugLog)('Could not verify bundle. Resetting validation timer and using previously installed or default runner. Error: ', e);
|
|
@@ -72,7 +74,7 @@ async function verifyOrUpdateNxCloudClient(options) {
|
|
|
72
74
|
if (version === 'NX_ENTERPRISE_OUTDATED_IMAGE') {
|
|
73
75
|
throw new NxCloudEnterpriseOutdatedError(apiUrl);
|
|
74
76
|
}
|
|
75
|
-
const fullPath = await downloadAndExtractClientBundle(
|
|
77
|
+
const fullPath = await downloadAndExtractClientBundle(httpClient, runnerBundleInstallDirectory, version, url);
|
|
76
78
|
(0, debug_logger_1.debugLog)('Done: ', fullPath);
|
|
77
79
|
const nxCloudClient = require(fullPath);
|
|
78
80
|
if (nxCloudClient.commands === undefined) {
|
|
@@ -157,8 +159,8 @@ function shouldVerifyInstalledRunnerBundle(currentBundle) {
|
|
|
157
159
|
}
|
|
158
160
|
return true;
|
|
159
161
|
}
|
|
160
|
-
async function verifyCurrentBundle(
|
|
161
|
-
return
|
|
162
|
+
async function verifyCurrentBundle(httpClient, currentBundle) {
|
|
163
|
+
return httpClient.get('/nx-cloud/client/verify', {
|
|
162
164
|
params: currentBundle
|
|
163
165
|
? {
|
|
164
166
|
version: currentBundle.version,
|
|
@@ -209,10 +211,10 @@ function hashDirectory(dir) {
|
|
|
209
211
|
const combinedHashes = hashes.sort().join('');
|
|
210
212
|
return (0, crypto_1.createHash)('sha256').update(combinedHashes).digest('hex');
|
|
211
213
|
}
|
|
212
|
-
async function downloadAndExtractClientBundle(
|
|
214
|
+
async function downloadAndExtractClientBundle(httpClient, runnerBundleInstallDirectory, version, url) {
|
|
213
215
|
let resp;
|
|
214
216
|
try {
|
|
215
|
-
resp = await
|
|
217
|
+
resp = await httpClient.get(url, {
|
|
216
218
|
responseType: 'stream',
|
|
217
219
|
});
|
|
218
220
|
}
|
|
@@ -238,6 +240,8 @@ async function downloadAndExtractClientBundle(axios, runnerBundleInstallDirector
|
|
|
238
240
|
else if (headers.type === 'file') {
|
|
239
241
|
const outputFilePath = (0, path_1.join)(bundleExtractLocation, headers.name);
|
|
240
242
|
const writeStream = (0, fs_1.createWriteStream)(outputFilePath);
|
|
243
|
+
// Surface disk errors through the pipeline instead of crashing
|
|
244
|
+
writeStream.on('error', (e) => extract.destroy(e));
|
|
241
245
|
stream.pipe(writeStream);
|
|
242
246
|
// Continue the tar stream after the write stream closes
|
|
243
247
|
writeStream.on('close', () => {
|
|
@@ -246,15 +250,17 @@ async function downloadAndExtractClientBundle(axios, runnerBundleInstallDirector
|
|
|
246
250
|
stream.resume();
|
|
247
251
|
}
|
|
248
252
|
});
|
|
249
|
-
extract.on('error', (e) => {
|
|
250
|
-
rej(e);
|
|
251
|
-
});
|
|
252
253
|
extract.on('finish', function () {
|
|
253
254
|
removeOldClientBundles(version);
|
|
254
255
|
writeBundleVerificationLock();
|
|
255
256
|
res(bundleExtractLocation);
|
|
256
257
|
});
|
|
257
|
-
|
|
258
|
+
// pipeline propagates download/gunzip errors that .pipe() would leave
|
|
259
|
+
// uncaught
|
|
260
|
+
(0, stream_1.pipeline)(resp.data, (0, zlib_1.createGunzip)(), extract, (e) => {
|
|
261
|
+
if (e)
|
|
262
|
+
rej(e);
|
|
263
|
+
});
|
|
258
264
|
});
|
|
259
265
|
}
|
|
260
266
|
function removeOldClientBundles(currentInstallVersion) {
|
|
@@ -5,6 +5,6 @@ export declare class UnknownCommandError extends Error {
|
|
|
5
5
|
constructor(command: string, availableCommands: string[]);
|
|
6
6
|
}
|
|
7
7
|
export declare function getCloudClient(options: CloudTaskRunnerOptions): Promise<{
|
|
8
|
-
invoke: (command: string, exit?: boolean) => void
|
|
8
|
+
invoke: (command: string, exit?: boolean) => Promise<void>;
|
|
9
9
|
availableCommands: string[];
|
|
10
10
|
}>;
|
|
@@ -19,7 +19,7 @@ async function getCloudClient(options) {
|
|
|
19
19
|
return {
|
|
20
20
|
invoke: (command, exit = true) => {
|
|
21
21
|
if (command in nxCloudClient.commands) {
|
|
22
|
-
nxCloudClient.commands[command]()
|
|
22
|
+
return nxCloudClient.commands[command]()
|
|
23
23
|
.then(() => {
|
|
24
24
|
if (exit) {
|
|
25
25
|
process.exit(0);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isWorkspaceClaimed = isWorkspaceClaimed;
|
|
4
4
|
const get_cloud_options_1 = require("./get-cloud-options");
|
|
5
|
+
const http_client_1 = require("../../utils/http-client");
|
|
5
6
|
async function isWorkspaceClaimed(accessToken) {
|
|
6
7
|
if (!accessToken)
|
|
7
8
|
return false;
|
|
@@ -10,7 +11,7 @@ async function isWorkspaceClaimed(accessToken) {
|
|
|
10
11
|
const requestData = (0, get_cloud_options_1.isNxCloudId)(accessToken)
|
|
11
12
|
? { nxCloudId: accessToken }
|
|
12
13
|
: { nxCloudAccessToken: accessToken };
|
|
13
|
-
const response = await
|
|
14
|
+
const response = await (0, http_client_1.httpRequest)(`${apiUrl}/nx-cloud/is-workspace-claimed`, { method: 'POST', data: requestData });
|
|
14
15
|
if (response.data.message) {
|
|
15
16
|
return false;
|
|
16
17
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createApiHttpClient = createApiHttpClient;
|
|
4
|
+
const http_client_1 = require("../../utils/http-client");
|
|
5
|
+
const environment_1 = require("./environment");
|
|
6
|
+
function createApiHttpClient(options) {
|
|
7
|
+
if (options?.customProxyConfigPath) {
|
|
8
|
+
const { logger } = require('../../utils/logger');
|
|
9
|
+
// The client bundle still reads this file for its own requests
|
|
10
|
+
logger.warn('customProxyConfigPath is not used for downloading the Nx Cloud client. Set HTTP_PROXY/HTTPS_PROXY/NO_PROXY (and NODE_EXTRA_CA_CERTS for custom certificates) instead.');
|
|
11
|
+
}
|
|
12
|
+
return (0, http_client_1.createHttpClient)({
|
|
13
|
+
baseURL: process.env.NX_CLOUD_API || options?.url || 'https://cloud.nx.app',
|
|
14
|
+
timeout: environment_1.NX_CLOUD_NO_TIMEOUTS ? environment_1.UNLIMITED_TIMEOUT : 10000,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
@@ -5,10 +5,11 @@ exports.getURLifShortenFailed = getURLifShortenFailed;
|
|
|
5
5
|
const logger_1 = require("../../utils/logger");
|
|
6
6
|
const get_cloud_options_1 = require("./get-cloud-options");
|
|
7
7
|
const git_utils_1 = require("../../utils/git-utils");
|
|
8
|
+
const http_client_1 = require("../../utils/http-client");
|
|
8
9
|
async function createNxCloudOnboardingURL(onboardingSource, accessToken, meta, forceManual = false, forceGithub = false, directory,
|
|
9
10
|
// Aborting tears down the in-flight request; without it a caller that stops
|
|
10
11
|
// waiting (see prefetchRemoteCacheOnboardingUrl) leaves the socket holding
|
|
11
|
-
// the event loop open, since
|
|
12
|
+
// the event loop open, since these requests have no timeout.
|
|
12
13
|
signal) {
|
|
13
14
|
const remoteInfo = (0, git_utils_1.getVcsRemoteInfo)(directory);
|
|
14
15
|
const apiUrl = (0, get_cloud_options_1.getCloudUrl)();
|
|
@@ -26,14 +27,18 @@ signal) {
|
|
|
26
27
|
}
|
|
27
28
|
const source = getSource(onboardingSource);
|
|
28
29
|
try {
|
|
29
|
-
const response = await
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
const response = await (0, http_client_1.httpRequest)(`${apiUrl}/nx-cloud/onboarding`, {
|
|
31
|
+
method: 'POST',
|
|
32
|
+
data: {
|
|
33
|
+
type: usesGithub ? 'GITHUB' : 'MANUAL',
|
|
34
|
+
source,
|
|
35
|
+
accessToken: usesGithub ? null : accessToken,
|
|
36
|
+
selectedRepositoryName: remoteInfo?.slug ?? null,
|
|
37
|
+
repositoryDomain: remoteInfo?.domain ?? null,
|
|
38
|
+
meta,
|
|
39
|
+
},
|
|
40
|
+
signal,
|
|
41
|
+
});
|
|
37
42
|
if (!response?.data || response.data.message) {
|
|
38
43
|
throw new Error(response?.data?.message ?? 'Failed to shorten Nx Cloud URL');
|
|
39
44
|
}
|
|
@@ -69,7 +74,9 @@ function getURLifShortenFailed(usesGithub, githubSlug, apiUrl, source, accessTok
|
|
|
69
74
|
}
|
|
70
75
|
async function getInstallationSupportsGitHub(apiUrl, signal) {
|
|
71
76
|
try {
|
|
72
|
-
const response = await
|
|
77
|
+
const response = await (0, http_client_1.httpRequest)(`${apiUrl}/nx-cloud/system/features`, {
|
|
78
|
+
signal,
|
|
79
|
+
});
|
|
73
80
|
if (!response?.data || response.data.message) {
|
|
74
81
|
throw new Error(response?.data?.message ?? 'Failed to shorten Nx Cloud URL');
|
|
75
82
|
}
|
|
@@ -18,12 +18,16 @@ const lock_file_1 = require("./lock-file/lock-file");
|
|
|
18
18
|
const build_dependencies_1 = require("./project-graph/build-dependencies/build-dependencies");
|
|
19
19
|
const config_1 = require("./utils/config");
|
|
20
20
|
exports.name = 'nx/js/dependencies-and-lockfile';
|
|
21
|
-
//
|
|
22
|
-
|
|
21
|
+
// An install can rewrite the lockfile between createNodes and
|
|
22
|
+
// createDependencies, so both parse the one createNodes read.
|
|
23
|
+
let cachedLockFile;
|
|
23
24
|
let cachedKeyMap;
|
|
24
25
|
exports.createNodes = [
|
|
25
26
|
(0, globs_1.combineGlobPatterns)(lock_file_1.LOCKFILES),
|
|
26
27
|
(files, _, context) => {
|
|
28
|
+
// A long-lived process must not reuse a lockfile this computation skipped.
|
|
29
|
+
cachedLockFile = undefined;
|
|
30
|
+
cachedKeyMap = undefined;
|
|
27
31
|
return (0, plugins_1.createNodesFromFiles)(internalCreateNodes, files, _, context);
|
|
28
32
|
},
|
|
29
33
|
];
|
|
@@ -42,41 +46,45 @@ function internalCreateNodes(lockFile, _, context) {
|
|
|
42
46
|
? (0, fs_1.readFileSync)(lockFilePath, 'utf-8')
|
|
43
47
|
: (0, bun_parser_1.readBunLockFile)(lockFilePath);
|
|
44
48
|
const lockFileHash = getLockFileHash(lockFileContents);
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
cachedKeyMap = keyMap;
|
|
49
|
+
cachedLockFile = { packageManager, lockFile, lockFileContents, lockFileHash };
|
|
50
|
+
const cached = readCache(externalNodesCache, lockFileHash);
|
|
51
|
+
if (cached) {
|
|
52
|
+
cachedKeyMap = deserializeKeyMap(cached.keyMap, cached.nodes);
|
|
49
53
|
return {
|
|
50
|
-
externalNodes: nodes,
|
|
54
|
+
externalNodes: cached.nodes,
|
|
51
55
|
};
|
|
52
56
|
}
|
|
53
|
-
const { nodes: externalNodes, keyMap } = (0, lock_file_1.getLockFileNodes)(packageManager, lockFileContents, lockFileHash, context);
|
|
54
|
-
cachedExternalNodes = externalNodes;
|
|
57
|
+
const { nodes: externalNodes, keyMap } = (0, lock_file_1.getLockFileNodes)(packageManager, lockFile, lockFileContents, lockFileHash, context);
|
|
55
58
|
cachedKeyMap = keyMap;
|
|
56
|
-
|
|
59
|
+
writeCache(externalNodesCache, lockFileHash, {
|
|
60
|
+
nodes: externalNodes,
|
|
61
|
+
keyMap: serializeKeyMap(keyMap),
|
|
62
|
+
});
|
|
57
63
|
return {
|
|
58
64
|
externalNodes,
|
|
59
65
|
};
|
|
60
66
|
}
|
|
61
67
|
const createDependencies = (_, ctx) => {
|
|
62
68
|
const pluginConfig = (0, config_1.jsPluginConfig)(ctx.nxJsonConfiguration);
|
|
63
|
-
const packageManager = (0, package_manager_1.detectPackageManager)(workspace_root_1.workspaceRoot);
|
|
64
69
|
let lockfileDependencies = [];
|
|
65
70
|
// lockfile may not exist yet
|
|
66
71
|
if (pluginConfig.analyzeLockfile &&
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
cachedLockFile &&
|
|
73
|
+
(0, lock_file_1.lockFileExists)(cachedLockFile.packageManager)) {
|
|
74
|
+
const { packageManager, lockFile, lockFileContents, lockFileHash } = cachedLockFile;
|
|
75
|
+
// Cached dependencies name their external nodes, and those names also
|
|
76
|
+
// depend on node_modules hoisting.
|
|
77
|
+
const dependenciesHash = (0, file_hasher_1.hashArray)([
|
|
78
|
+
lockFileHash,
|
|
79
|
+
...Object.keys(ctx.externalNodes),
|
|
80
|
+
]);
|
|
81
|
+
const cachedDependencies = readCache(dependenciesCache, dependenciesHash);
|
|
82
|
+
if (cachedDependencies) {
|
|
83
|
+
lockfileDependencies = cachedDependencies;
|
|
76
84
|
}
|
|
77
85
|
else {
|
|
78
|
-
lockfileDependencies = (0, lock_file_1.getLockFileDependencies)(packageManager, lockFileContents, lockFileHash, ctx, cachedKeyMap);
|
|
79
|
-
|
|
86
|
+
lockfileDependencies = (0, lock_file_1.getLockFileDependencies)(packageManager, lockFile, lockFileContents, lockFileHash, ctx, cachedKeyMap);
|
|
87
|
+
writeCache(dependenciesCache, dependenciesHash, lockfileDependencies);
|
|
80
88
|
}
|
|
81
89
|
}
|
|
82
90
|
perf_hooks_1.performance.mark('build typescript dependencies - start');
|
|
@@ -107,7 +115,7 @@ function serializeKeyMap(keyMap) {
|
|
|
107
115
|
}
|
|
108
116
|
return serialized;
|
|
109
117
|
}
|
|
110
|
-
// Deserialize keyMap from JSON format
|
|
118
|
+
// Deserialize keyMap from JSON format
|
|
111
119
|
function deserializeKeyMap(serialized, externalNodes) {
|
|
112
120
|
const keyMap = new Map();
|
|
113
121
|
for (const [key, value] of Object.entries(serialized)) {
|
|
@@ -131,47 +139,24 @@ function deserializeKeyMap(serialized, externalNodes) {
|
|
|
131
139
|
}
|
|
132
140
|
return keyMap;
|
|
133
141
|
}
|
|
134
|
-
function
|
|
142
|
+
function readCache(path, key) {
|
|
135
143
|
try {
|
|
136
|
-
|
|
144
|
+
const cache = JSON.parse((0, fs_1.readFileSync)(path, 'utf-8'));
|
|
145
|
+
return cache.key === key ? cache.data : undefined;
|
|
137
146
|
}
|
|
138
147
|
catch {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
// External nodes cache functions
|
|
143
|
-
function writeExternalNodesCache(hash, nodes, keyMap) {
|
|
144
|
-
const serializedKeyMap = serializeKeyMap(keyMap);
|
|
145
|
-
const cacheData = { nodes, keyMap: serializedKeyMap };
|
|
146
|
-
const content = safeStringify(cacheData);
|
|
147
|
-
if (content === undefined) {
|
|
148
|
-
logger_1.logger.warn(`Failed to serialize external nodes cache. Skipping cache write.`);
|
|
149
|
-
tryRemoveFile(externalNodesCache);
|
|
150
|
-
tryRemoveFile(externalNodesHashFile);
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
(0, plugin_cache_utils_1.safeWriteFileCache)(externalNodesCache, content);
|
|
154
|
-
if ((0, fs_1.existsSync)(externalNodesCache)) {
|
|
155
|
-
(0, plugin_cache_utils_1.safeWriteFileCache)(externalNodesHashFile, hash);
|
|
148
|
+
// Another process can be mid-write, so an unreadable cache is a miss.
|
|
149
|
+
return undefined;
|
|
156
150
|
}
|
|
157
151
|
}
|
|
158
|
-
function
|
|
159
|
-
const
|
|
160
|
-
return { nodes, keyMap: deserializeKeyMap(keyMap, nodes) };
|
|
161
|
-
}
|
|
162
|
-
// Dependencies cache functions
|
|
163
|
-
function writeDependenciesCache(hash, dependencies) {
|
|
164
|
-
const content = safeStringify(dependencies);
|
|
152
|
+
function writeCache(path, key, data) {
|
|
153
|
+
const content = safeStringify({ key, data });
|
|
165
154
|
if (content === undefined) {
|
|
166
|
-
logger_1.logger.warn(`Failed to serialize
|
|
167
|
-
tryRemoveFile(
|
|
168
|
-
tryRemoveFile(dependenciesHashFile);
|
|
155
|
+
logger_1.logger.warn(`Failed to serialize ${path}. Skipping cache write.`);
|
|
156
|
+
tryRemoveFile(path);
|
|
169
157
|
return;
|
|
170
158
|
}
|
|
171
|
-
(0, plugin_cache_utils_1.safeWriteFileCache)(
|
|
172
|
-
if ((0, fs_1.existsSync)(dependenciesCache)) {
|
|
173
|
-
(0, plugin_cache_utils_1.safeWriteFileCache)(dependenciesHashFile, hash);
|
|
174
|
-
}
|
|
159
|
+
(0, plugin_cache_utils_1.safeWriteFileCache)(path, content);
|
|
175
160
|
}
|
|
176
161
|
function safeStringify(data) {
|
|
177
162
|
try {
|
|
@@ -191,11 +176,7 @@ function tryRemoveFile(path) {
|
|
|
191
176
|
// Best effort
|
|
192
177
|
}
|
|
193
178
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
const externalNodesHashFile = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, 'lockfile-nodes.hash');
|
|
199
|
-
const dependenciesHashFile = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, 'lockfile-dependencies.hash');
|
|
200
|
-
const externalNodesCache = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, 'parsed-lock-file.nodes.json');
|
|
201
|
-
const dependenciesCache = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, 'parsed-lock-file.dependencies.json');
|
|
179
|
+
// Each cache file holds its key, so key and data come from one write.
|
|
180
|
+
// Older Nx versions read other names with a hash file; keep these distinct.
|
|
181
|
+
const externalNodesCache = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, 'lockfile-nodes.json');
|
|
182
|
+
const dependenciesCache = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, 'lockfile-dependencies.json');
|
|
@@ -10,9 +10,9 @@ import { PackageManager } from '../../../utils/package-manager';
|
|
|
10
10
|
export declare const LOCKFILES: string[];
|
|
11
11
|
export declare const AUTO_AFFECTED_LOCK_FILES: readonly ["yarn.lock", "package-lock.json", "pnpm-lock.yaml", "pnpm-lock.yml", "bun.lockb", "bun.lock"];
|
|
12
12
|
/**
|
|
13
|
-
* Parses
|
|
13
|
+
* Parses the lockfile into external nodes, plus the keyMap that getLockFileDependencies reads.
|
|
14
14
|
*/
|
|
15
|
-
export declare function getLockFileNodes(packageManager: PackageManager, contents: string, lockFileHash: string, context: CreateNodesContext): {
|
|
15
|
+
export declare function getLockFileNodes(packageManager: PackageManager, lockFile: string, contents: string, lockFileHash: string, context: CreateNodesContext): {
|
|
16
16
|
nodes: Record<string, ProjectGraphExternalNode>;
|
|
17
17
|
keyMap: Map<string, any>;
|
|
18
18
|
};
|
|
@@ -21,9 +21,9 @@ export declare function getLockFileNodesForName(lockFile: string, contents: stri
|
|
|
21
21
|
keyMap: Map<string, any>;
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
24
|
-
* Parses
|
|
24
|
+
* Parses the lockfile into dependencies between external nodes.
|
|
25
25
|
*/
|
|
26
|
-
export declare function getLockFileDependencies(packageManager: PackageManager, contents: string, lockFileHash: string, context: CreateDependenciesContext, keyMap: Map<string, any>): RawProjectGraphDependency[];
|
|
26
|
+
export declare function getLockFileDependencies(packageManager: PackageManager, lockFile: string, contents: string, lockFileHash: string, context: CreateDependenciesContext, keyMap: Map<string, any>): RawProjectGraphDependency[];
|
|
27
27
|
export declare function lockFileExists(packageManager: PackageManager): boolean;
|
|
28
28
|
/**
|
|
29
29
|
* Returns lock file name based on the detected package manager in the root
|