@ohos-ports/nx 23.3.0-beta.3 → 24.0.2-beta.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 +3 -6
- package/dist/bin/nx.js +2 -2
- package/dist/bin/post-install.js +5 -3
- package/dist/nx-cloud-internals.d.ts +1 -0
- package/dist/nx-cloud-internals.js +7 -1
- package/dist/src/adapter/ngcli-adapter.js +2 -2
- package/dist/src/ai/clone-ai-config-repo.js +49 -12
- package/dist/src/command-line/add/add.d.ts +2 -0
- package/dist/src/command-line/add/add.js +24 -6
- package/dist/src/command-line/affected/affected.js +2 -2
- package/dist/src/command-line/configure-ai-agents/configure-ai-agents.js +1 -13
- package/dist/src/command-line/graph/graph.js +38 -10
- package/dist/src/command-line/init/command-object.js +0 -12
- package/dist/src/command-line/init/implementation/add-nx-to-nest.js +21 -62
- package/dist/src/command-line/init/init-v2.js +1 -3
- package/dist/src/command-line/migrate/agentic/close-agent-session.d.ts +1 -1
- package/dist/src/command-line/migrate/agentic/close-agent-session.js +4 -3
- package/dist/src/command-line/migrate/agentic/definitions.d.ts +1 -3
- package/dist/src/command-line/migrate/agentic/definitions.js +5 -97
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +7 -45
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +9 -51
- package/dist/src/command-line/migrate/agentic/handoff.d.ts +1 -43
- package/dist/src/command-line/migrate/agentic/handoff.js +3 -119
- package/dist/src/command-line/migrate/agentic/instruction-files.d.ts +0 -21
- package/dist/src/command-line/migrate/agentic/instruction-files.js +6 -27
- package/dist/src/command-line/migrate/agentic/master/run-master-session.d.ts +19 -1
- package/dist/src/command-line/migrate/agentic/master/run-master-session.js +88 -49
- package/dist/src/command-line/migrate/agentic/master/spawn-master.d.ts +1 -0
- package/dist/src/command-line/migrate/agentic/master/spawn-master.js +86 -24
- package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.d.ts +2 -2
- package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.js +2 -2
- package/dist/src/command-line/migrate/agentic/prompts/fragments.d.ts +1 -12
- package/dist/src/command-line/migrate/agentic/prompts/fragments.js +8 -17
- package/dist/src/command-line/migrate/agentic/prompts/shared-rendering.d.ts +0 -15
- package/dist/src/command-line/migrate/agentic/prompts/shared-rendering.js +3 -100
- package/dist/src/command-line/migrate/agentic/select.d.ts +12 -6
- package/dist/src/command-line/migrate/agentic/select.js +38 -8
- package/dist/src/command-line/migrate/agentic/types.d.ts +9 -68
- package/dist/src/command-line/migrate/agentic/types.js +6 -8
- package/dist/src/command-line/migrate/command-object.js +6 -10
- package/dist/src/command-line/migrate/execute-migration.d.ts +6 -6
- package/dist/src/command-line/migrate/execute-migration.js +25 -15
- package/dist/src/command-line/migrate/migrate-analytics.d.ts +18 -1
- package/dist/src/command-line/migrate/migrate-analytics.js +38 -0
- package/dist/src/command-line/migrate/migrate-commits.d.ts +29 -17
- package/dist/src/command-line/migrate/migrate-commits.js +86 -32
- package/dist/src/command-line/migrate/migrate-config.d.ts +6 -6
- package/dist/src/command-line/migrate/migrate-config.js +12 -6
- package/dist/src/command-line/migrate/migrate-output.d.ts +1 -6
- package/dist/src/command-line/migrate/migrate-output.js +1 -10
- package/dist/src/command-line/migrate/migrate.d.ts +6 -30
- package/dist/src/command-line/migrate/migrate.js +257 -255
- package/dist/src/command-line/migrate/resolve-package-version.d.ts +2 -4
- package/dist/src/command-line/migrate/resolve-package-version.js +2 -35
- package/dist/src/command-line/migrate/run/agent-output.d.ts +2 -0
- package/dist/src/command-line/migrate/run/agent-output.js +9 -0
- package/dist/src/command-line/migrate/run/broker.d.ts +14 -5
- package/dist/src/command-line/migrate/run/broker.js +69 -21
- package/dist/src/command-line/migrate/run/clean-retry.js +4 -2
- package/dist/src/command-line/migrate/run/existing-run-report.d.ts +1 -1
- package/dist/src/command-line/migrate/run/existing-run-report.js +7 -5
- package/dist/src/command-line/migrate/run/give-up.d.ts +4 -3
- package/dist/src/command-line/migrate/run/give-up.js +8 -5
- package/dist/src/command-line/migrate/run/index.d.ts +7 -5
- package/dist/src/command-line/migrate/run/index.js +16 -1
- package/dist/src/command-line/migrate/run/issues.js +7 -2
- package/dist/src/command-line/migrate/run/orchestrator.d.ts +61 -4
- package/dist/src/command-line/migrate/run/orchestrator.js +397 -133
- package/dist/src/command-line/migrate/run/run-state.d.ts +17 -1
- package/dist/src/command-line/migrate/run/run-state.js +41 -2
- package/dist/src/command-line/migrate/run/runbook.d.ts +1 -0
- package/dist/src/command-line/migrate/run/runbook.js +115 -18
- package/dist/src/command-line/migrate/run/state-lock.d.ts +29 -4
- package/dist/src/command-line/migrate/run/state-lock.js +102 -10
- package/dist/src/command-line/migrate/run/state-machine.js +4 -1
- package/dist/src/command-line/migrate/run/util.d.ts +7 -2
- package/dist/src/command-line/migrate/run/util.js +30 -3
- package/dist/src/command-line/migrate/run/worker.d.ts +1 -1
- package/dist/src/command-line/migrate/run/worker.js +252 -250
- package/dist/src/command-line/migrate/sort-migrations.d.ts +1 -7
- package/dist/src/command-line/migrate/sort-migrations.js +1 -12
- package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +17 -12
- package/dist/src/command-line/release/changelog.js +9 -6
- package/dist/src/command-line/release/config/config.d.ts +1 -0
- package/dist/src/command-line/release/config/config.js +48 -9
- package/dist/src/command-line/release/release.js +2 -2
- package/dist/src/command-line/release/utils/git.js +8 -7
- package/dist/src/command-line/release/utils/interpolate-release-config.d.ts +6 -0
- package/dist/src/command-line/release/utils/interpolate-release-config.js +39 -0
- package/dist/src/command-line/release/utils/release-graph.d.ts +5 -0
- package/dist/src/command-line/release/utils/release-graph.js +1 -0
- package/dist/src/command-line/release/utils/remote-release-clients/github.js +5 -6
- package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +5 -6
- package/dist/src/command-line/release/utils/resolve-changelog-renderer.js +2 -2
- package/dist/src/command-line/release/utils/shared.js +10 -10
- package/dist/src/command-line/release/utils/version-plan-utils.d.ts +3 -12
- package/dist/src/command-line/release/utils/version-plan-utils.js +33 -55
- package/dist/src/command-line/release/version/version-actions.js +2 -1
- package/dist/src/command-line/release/version.js +5 -2
- package/dist/src/command-line/repair/repair.js +1 -1
- package/dist/src/command-line/report/report.js +1 -1
- package/dist/src/command-line/reset/reset.js +58 -62
- package/dist/src/command-line/run/executor-utils.js +1 -0
- package/dist/src/command-line/run/run-one.d.ts +20 -1
- package/dist/src/command-line/run/run-one.js +153 -5
- package/dist/src/command-line/run/run.js +2 -1
- package/dist/src/command-line/show/projects.js +5 -3
- package/dist/src/command-line/show/show-target/info.d.ts +10 -1
- package/dist/src/command-line/show/show-target/info.js +100 -15
- package/dist/src/command-line/show/show-target/inputs.js +10 -2
- package/dist/src/command-line/show/show-target/utils.js +1 -0
- package/dist/src/command-line/watch/command-object.js +3 -22
- package/dist/src/command-line/watch/watch.d.ts +0 -7
- package/dist/src/command-line/watch/watch.js +1 -1
- package/dist/src/command-line/yargs-utils/shared-options.js +1 -1
- package/dist/src/config/misc-interfaces.d.ts +18 -0
- package/dist/src/config/nx-json.d.ts +22 -11
- package/dist/src/config/task-graph.d.ts +1 -1
- package/dist/src/config/workspace-json-project-json.d.ts +88 -0
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/core/graph/runtime.js +1 -1
- package/dist/src/core/graph/styles.css +1 -1
- package/dist/src/core/graph/styles.js +1 -1
- package/dist/src/daemon/client/client.d.ts +15 -0
- package/dist/src/daemon/client/client.js +181 -71
- package/dist/src/daemon/client/daemon-socket-messenger.d.ts +1 -1
- package/dist/src/daemon/client/daemon-socket-messenger.js +2 -2
- package/dist/src/daemon/server/client-socket-context.js +1 -1
- package/dist/src/daemon/server/handle-configure-ai-agents.js +2 -2
- package/dist/src/daemon/server/handle-process-in-background.js +21 -9
- package/dist/src/daemon/server/handle-select-affected-tasks.d.ts +2 -1
- package/dist/src/daemon/server/handle-select-affected-tasks.js +21 -13
- package/dist/src/daemon/server/native-js-loader.d.ts +1 -0
- package/dist/src/daemon/server/native-js-loader.js +21 -0
- package/dist/src/daemon/server/nx-console-operations.js +2 -2
- package/dist/src/daemon/server/project-graph-incremental-recomputation.js +4 -8
- package/dist/src/daemon/server/server.d.ts +2 -1
- package/dist/src/daemon/server/server.js +17 -4
- package/dist/src/daemon/server/shutdown-utils.js +1 -4
- package/dist/src/daemon/server/start.d.ts +1 -0
- package/dist/src/daemon/server/start.js +2 -0
- package/dist/src/daemon/socket-utils.d.ts +11 -9
- package/dist/src/daemon/socket-utils.js +31 -61
- package/dist/src/daemon/tmp-dir.d.ts +19 -14
- package/dist/src/daemon/tmp-dir.js +142 -354
- package/dist/src/devkit-exports.d.ts +9 -1
- package/dist/src/devkit-exports.js +12 -1
- package/dist/src/devkit-internals.d.ts +6 -5
- package/dist/src/devkit-internals.js +13 -4
- package/dist/src/executors/run-commands/run-commands.impl.d.ts +4 -2
- package/dist/src/executors/run-commands/run-commands.impl.js +53 -27
- package/dist/src/executors/run-commands/running-tasks.d.ts +13 -4
- package/dist/src/executors/run-commands/running-tasks.js +148 -95
- package/dist/src/executors/run-commands/schema.json +1 -1
- package/dist/src/hasher/check-task-files.js +5 -8
- package/dist/src/hasher/file-hasher.js +9 -7
- package/dist/src/hasher/hash-task.js +4 -0
- package/dist/src/hasher/native-task-hasher-impl.js +3 -1
- package/dist/src/hasher/task-hasher.d.ts +2 -0
- package/dist/src/hasher/task-hasher.js +4 -1
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.d.ts +1 -2
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.js +6 -11
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.md +2 -2
- package/dist/src/migrations/update-24-0-0/enable-legacy-affected.d.ts +4 -0
- package/dist/src/migrations/update-24-0-0/enable-legacy-affected.js +15 -0
- package/dist/src/migrations/update-24-0-0/enable-legacy-affected.md +30 -0
- package/dist/src/migrations/update-24-0-0/find-custom-hashers.d.ts +3 -0
- package/dist/src/migrations/update-24-0-0/find-custom-hashers.js +100 -0
- package/dist/src/migrations/update-24-0-0/find-custom-hashers.md +63 -0
- package/dist/src/migrations/update-24-0-0/move-custom-hashers-to-inputs.md +146 -0
- package/dist/src/migrations/update-24-0-0/rename-ultracache-ignore-options.d.ts +3 -0
- package/dist/src/migrations/update-24-0-0/rename-ultracache-ignore-options.js +130 -0
- package/dist/src/migrations/update-24-0-0/rename-ultracache-ignore-options.md +62 -0
- package/dist/src/native/assert-supported-platform.js +1 -1
- package/dist/src/native/index.d.ts +238 -18
- package/dist/src/native/index.js +6 -1
- package/dist/src/native/native-bindings.js +15 -6
- package/dist/src/native/nx.openharmony-arm64.node +0 -0
- package/dist/src/native/nx.wasi-browser.js +1 -0
- package/dist/src/native/nx.wasi.cjs +1 -0
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/nx-cloud/update-manager.d.ts +14 -0
- package/dist/src/nx-cloud/update-manager.js +237 -50
- package/dist/src/plugins/js/lock-file/pnpm-parser.js +3 -4
- package/dist/src/plugins/js/lock-file/pruned-output.d.ts +2 -2
- package/dist/src/plugins/js/lock-file/pruned-output.js +4 -4
- package/dist/src/plugins/js/utils/register.js +9 -4
- package/dist/src/project-graph/affected/affected-tasks.d.ts +9 -6
- package/dist/src/project-graph/affected/affected-tasks.js +31 -7
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +7 -0
- package/dist/src/project-graph/plugins/loaded-nx-plugin.js +49 -6
- package/dist/src/project-graph/utils/project-configuration/target-merging.js +1 -1
- package/dist/src/project-graph/utils/project-configuration/target-normalization.js +12 -133
- package/dist/src/project-graph/utils/project-configuration-utils.js +2 -2
- package/dist/src/project-graph/utils/retrieve-workspace-files.js +27 -6
- package/dist/src/tasks-runner/create-task-graph.d.ts +8 -7
- package/dist/src/tasks-runner/create-task-graph.js +50 -27
- package/dist/src/tasks-runner/default-tasks-runner.js +1 -1
- package/dist/src/tasks-runner/init-tasks-runner.js +116 -59
- package/dist/src/tasks-runner/life-cycle.d.ts +4 -1
- package/dist/src/tasks-runner/life-cycle.js +7 -0
- package/dist/src/tasks-runner/life-cycles/performance-analysis.d.ts +5 -2
- package/dist/src/tasks-runner/life-cycles/performance-analysis.js +13 -7
- package/dist/src/tasks-runner/life-cycles/performance-life-cycle.d.ts +4 -3
- package/dist/src/tasks-runner/life-cycles/performance-life-cycle.js +9 -2
- package/dist/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +5 -2
- package/dist/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.js +4 -1
- package/dist/src/tasks-runner/life-cycles/summary-terminal-output-life-cycle.js +5 -1
- package/dist/src/tasks-runner/pseudo-ipc.d.ts +1 -0
- package/dist/src/tasks-runner/pseudo-ipc.js +4 -0
- package/dist/src/tasks-runner/pseudo-terminal.d.ts +1 -1
- package/dist/src/tasks-runner/pseudo-terminal.js +2 -2
- package/dist/src/tasks-runner/readiness/executor-ready-signal.d.ts +7 -0
- package/dist/src/tasks-runner/readiness/executor-ready-signal.js +43 -0
- package/dist/src/tasks-runner/readiness/probes.d.ts +14 -0
- package/dist/src/tasks-runner/readiness/probes.js +101 -0
- package/dist/src/tasks-runner/readiness/ready-signal-server.d.ts +18 -0
- package/dist/src/tasks-runner/readiness/ready-signal-server.js +72 -0
- package/dist/src/tasks-runner/readiness/ready-signal.d.ts +33 -0
- package/dist/src/tasks-runner/readiness/ready-signal.js +92 -0
- package/dist/src/tasks-runner/readiness/ready-when.d.ts +84 -0
- package/dist/src/tasks-runner/readiness/ready-when.js +371 -0
- package/dist/src/tasks-runner/readiness/startup-host.d.ts +1 -0
- package/dist/src/tasks-runner/readiness/startup-host.js +32 -0
- package/dist/src/tasks-runner/run-command.d.ts +6 -2
- package/dist/src/tasks-runner/run-command.js +21 -31
- package/dist/src/tasks-runner/run-outcome.d.ts +16 -0
- package/dist/src/tasks-runner/run-outcome.js +39 -0
- package/dist/src/tasks-runner/running-tasks/batch-process.js +6 -0
- package/dist/src/tasks-runner/running-tasks/node-child-process.js +5 -4
- package/dist/src/tasks-runner/running-tasks/running-task.d.ts +1 -1
- package/dist/src/tasks-runner/task-env.d.ts +10 -0
- package/dist/src/tasks-runner/task-env.js +37 -5
- package/dist/src/tasks-runner/task-graph-utils.d.ts +9 -6
- package/dist/src/tasks-runner/task-graph-utils.js +17 -12
- package/dist/src/tasks-runner/task-orchestrator.d.ts +62 -18
- package/dist/src/tasks-runner/task-orchestrator.js +750 -150
- package/dist/src/tasks-runner/tasks-runner.d.ts +1 -1
- package/dist/src/tasks-runner/tasks-schedule.d.ts +18 -1
- package/dist/src/tasks-runner/tasks-schedule.js +63 -6
- package/dist/src/tasks-runner/tokens.d.ts +54 -0
- package/dist/src/tasks-runner/tokens.js +161 -0
- package/dist/src/tasks-runner/utils.d.ts +35 -6
- package/dist/src/tasks-runner/utils.js +149 -68
- package/dist/src/ultracache/ci-status.d.ts +24 -0
- package/dist/src/ultracache/ci-status.js +87 -0
- package/dist/src/ultracache/config.d.ts +3 -3
- package/dist/src/ultracache/config.js +4 -4
- package/dist/src/ultracache/fetch.d.ts +2 -0
- package/dist/src/ultracache/fetch.js +1 -0
- package/dist/src/ultracache/overrides.js +4 -0
- package/dist/src/utils/acknowledge-build-scripts.d.ts +34 -1
- package/dist/src/utils/acknowledge-build-scripts.js +171 -32
- package/dist/src/utils/child-process.js +2 -1
- package/dist/src/utils/find-matching-projects.js +9 -6
- package/dist/src/utils/git-utils.d.ts +12 -5
- package/dist/src/utils/git-utils.js +69 -11
- package/dist/src/utils/long-running-target.d.ts +1 -3
- package/dist/src/utils/long-running-target.js +1 -3
- package/dist/src/utils/nx-package-group.js +1 -1
- package/dist/src/utils/output.d.ts +4 -3
- package/dist/src/utils/output.js +4 -3
- package/dist/src/utils/owned-private-dir.d.ts +1 -17
- package/dist/src/utils/owned-private-dir.js +10 -62
- package/dist/src/utils/package-json.js +1 -1
- package/dist/src/utils/package-manager.d.ts +8 -0
- package/dist/src/utils/package-manager.js +65 -8
- package/dist/src/utils/perf-hooks.d.ts +1 -0
- package/dist/src/utils/plugins/core-plugins.js +5 -1
- package/dist/src/utils/progress-topics.d.ts +1 -0
- package/dist/src/utils/progress-topics.js +1 -0
- package/dist/src/utils/safe-spawn.js +1 -5
- package/dist/src/utils/shell-quoting.d.ts +8 -1
- package/dist/src/utils/shell-quoting.js +12 -1
- package/dist/src/utils/spawn-without-terminal.d.ts +27 -0
- package/dist/src/utils/spawn-without-terminal.js +110 -0
- package/dist/src/utils/string-similarity.d.ts +38 -0
- package/dist/src/utils/string-similarity.js +108 -0
- package/dist/src/utils/versions.js +1 -1
- package/migrations.json +20 -6
- package/package.json +15 -24
- package/schemas/migrations-schema.json +11 -0
- package/schemas/nx-schema.json +133 -11
- package/schemas/project-schema.json +114 -4
- package/dist/src/command-line/migrate/agentic/prompts/generic-validation.d.ts +0 -56
- package/dist/src/command-line/migrate/agentic/prompts/generic-validation.js +0 -67
- package/dist/src/command-line/migrate/agentic/prompts/hybrid-prompt-migration.d.ts +0 -49
- package/dist/src/command-line/migrate/agentic/prompts/hybrid-prompt-migration.js +0 -53
- package/dist/src/command-line/migrate/agentic/prompts/prompt-migration.d.ts +0 -26
- package/dist/src/command-line/migrate/agentic/prompts/prompt-migration.js +0 -27
- package/dist/src/command-line/migrate/agentic/prompts/system-prompt.d.ts +0 -70
- package/dist/src/command-line/migrate/agentic/prompts/system-prompt.js +0 -113
- package/dist/src/command-line/migrate/agentic/run-step.d.ts +0 -68
- package/dist/src/command-line/migrate/agentic/run-step.js +0 -148
- package/dist/src/command-line/migrate/agentic/runner.d.ts +0 -21
- package/dist/src/command-line/migrate/agentic/runner.js +0 -262
- package/dist/src/migrations/update-23-0-0/consolidate-release-tag-config.d.ts +0 -9
- package/dist/src/migrations/update-23-0-0/consolidate-release-tag-config.js +0 -18
- package/dist/src/tasks-runner/legacy-depends-on-warning.d.ts +0 -18
- package/dist/src/tasks-runner/legacy-depends-on-warning.js +0 -109
|
@@ -11,12 +11,14 @@ exports.normalizeTargetDependencyWithStringProjects = normalizeTargetDependencyW
|
|
|
11
11
|
exports.validateOutputs = validateOutputs;
|
|
12
12
|
exports.transformLegacyOutputs = transformLegacyOutputs;
|
|
13
13
|
exports.getOutputsForTargetAndConfiguration = getOutputsForTargetAndConfiguration;
|
|
14
|
+
exports.interpolateOutput = interpolateOutput;
|
|
14
15
|
exports.interpolate = interpolate;
|
|
15
16
|
exports.getTargetConfigurationForTask = getTargetConfigurationForTask;
|
|
16
17
|
exports.getExecutorNameForTask = getExecutorNameForTask;
|
|
17
18
|
exports.expandInitiatingTasksThroughNoop = expandInitiatingTasksThroughNoop;
|
|
18
19
|
exports.getExecutorForTask = getExecutorForTask;
|
|
19
20
|
exports.getCustomHasher = getCustomHasher;
|
|
21
|
+
exports.resetCustomHasherDeprecationWarnings = resetCustomHasherDeprecationWarnings;
|
|
20
22
|
exports.pruneToSelectedTasks = pruneToSelectedTasks;
|
|
21
23
|
exports.removeTasksFromTaskGraph = removeTasksFromTaskGraph;
|
|
22
24
|
exports.calculateReverseDeps = calculateReverseDeps;
|
|
@@ -28,37 +30,36 @@ exports.shouldStreamOutput = shouldStreamOutput;
|
|
|
28
30
|
exports.isCacheableTask = isCacheableTask;
|
|
29
31
|
exports.unparse = unparse;
|
|
30
32
|
exports.createTaskId = createTaskId;
|
|
33
|
+
exports.hashTaskOverrides = hashTaskOverrides;
|
|
31
34
|
const minimatch_1 = require("minimatch");
|
|
32
35
|
const node_path_1 = require("node:path");
|
|
33
36
|
const posix_1 = require("node:path/posix");
|
|
34
37
|
const executor_utils_1 = require("../command-line/run/executor-utils");
|
|
38
|
+
const file_hasher_1 = require("../hasher/file-hasher");
|
|
35
39
|
const native_1 = require("../native");
|
|
36
40
|
const fileutils_1 = require("../utils/fileutils");
|
|
37
41
|
const find_matching_projects_1 = require("../utils/find-matching-projects");
|
|
38
|
-
const legacy_depends_on_warning_1 = require("./legacy-depends-on-warning");
|
|
39
42
|
const globs_1 = require("../utils/globs");
|
|
40
43
|
const long_running_target_1 = require("../utils/long-running-target");
|
|
44
|
+
const output_1 = require("../utils/output");
|
|
41
45
|
const path_1 = require("../utils/path");
|
|
42
46
|
const serialize_overrides_into_command_line_1 = require("../utils/serialize-overrides-into-command-line");
|
|
43
47
|
const split_target_1 = require("../utils/split-target");
|
|
44
48
|
const workspace_root_1 = require("../utils/workspace-root");
|
|
45
49
|
const is_tui_enabled_1 = require("./is-tui-enabled");
|
|
50
|
+
const tokens_1 = require("./tokens");
|
|
46
51
|
function getDependencyConfigs({ project, target }, extraTargetDependencies, projectGraph, allTargetNames) {
|
|
47
|
-
|
|
48
|
-
const dependencyConfigs = (projectGraph.nodes[project].data?.targets[target]?.dependsOn ??
|
|
52
|
+
return (projectGraph.nodes[project].data?.targets[target]?.dependsOn ??
|
|
49
53
|
// This is passed into `run-command` from programmatic invocations
|
|
50
54
|
extraTargetDependencies[target] ??
|
|
51
|
-
[]).flatMap((config
|
|
52
|
-
if (legacyViolations.length) {
|
|
53
|
-
(0, legacy_depends_on_warning_1.flushLegacyDependsOnViolations)(project, target, legacyViolations, projectGraph.nodes[project]?.data?.root);
|
|
54
|
-
}
|
|
55
|
-
return dependencyConfigs;
|
|
55
|
+
[]).flatMap((config) => normalizeDependencyConfigDefinition(config, project, projectGraph, allTargetNames));
|
|
56
56
|
}
|
|
57
|
-
function normalizeDependencyConfigDefinition(definition, currentProject, graph, allTargetNames
|
|
58
|
-
return expandWildcardTargetConfiguration(normalizeDependencyConfigProjects(expandDependencyConfigSyntaxSugar(definition, graph, currentProject), currentProject, graph
|
|
57
|
+
function normalizeDependencyConfigDefinition(definition, currentProject, graph, allTargetNames) {
|
|
58
|
+
return expandWildcardTargetConfiguration(normalizeDependencyConfigProjects(expandDependencyConfigSyntaxSugar(definition, graph, currentProject), currentProject, graph), allTargetNames);
|
|
59
59
|
}
|
|
60
|
-
function normalizeDependencyConfigProjects(dependencyConfig, currentProject, graph
|
|
61
|
-
|
|
60
|
+
function normalizeDependencyConfigProjects(dependencyConfig, currentProject, graph) {
|
|
61
|
+
assertNotLegacyProjectsString(dependencyConfig, currentProject, graph);
|
|
62
|
+
const noStringConfig = normalizeTargetDependencyWithStringProjects(dependencyConfig);
|
|
62
63
|
if (noStringConfig.projects) {
|
|
63
64
|
dependencyConfig.projects = (0, find_matching_projects_1.findMatchingProjects)(noStringConfig.projects, graph.nodes);
|
|
64
65
|
}
|
|
@@ -67,6 +68,13 @@ function normalizeDependencyConfigProjects(dependencyConfig, currentProject, gra
|
|
|
67
68
|
}
|
|
68
69
|
return dependencyConfig;
|
|
69
70
|
}
|
|
71
|
+
function assertNotLegacyProjectsString(dependencyConfig, currentProject, graph) {
|
|
72
|
+
const projects = dependencyConfig.projects;
|
|
73
|
+
if ((projects === 'self' || projects === 'dependencies') &&
|
|
74
|
+
!graph.nodes[projects]) {
|
|
75
|
+
throw new Error(`${currentProject} has a dependsOn entry using projects: '${projects}', which is no longer supported: ${JSON.stringify(dependencyConfig)}\nPlease run "nx repair" to repair your configuration`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
70
78
|
function expandDependencyConfigSyntaxSugar(dependencyConfigString, graph, currentProject) {
|
|
71
79
|
if (typeof dependencyConfigString !== 'string') {
|
|
72
80
|
return dependencyConfigString;
|
|
@@ -133,23 +141,9 @@ function readProjectAndTargetFromTargetString(targetString, projects, currentPro
|
|
|
133
141
|
function getOutputs(p, target, overrides) {
|
|
134
142
|
return getOutputsForTargetAndConfiguration(target, overrides, p[target.project]);
|
|
135
143
|
}
|
|
136
|
-
function normalizeTargetDependencyWithStringProjects(dependencyConfig
|
|
144
|
+
function normalizeTargetDependencyWithStringProjects(dependencyConfig) {
|
|
137
145
|
if (typeof dependencyConfig.projects === 'string') {
|
|
138
|
-
|
|
139
|
-
// The v16 `update-depends-on-to-tokens` migration already rewrites
|
|
140
|
-
// these to the modern shape, and `nx repair` will re-run it on demand.
|
|
141
|
-
if (dependencyConfig.projects === 'self') {
|
|
142
|
-
(0, legacy_depends_on_warning_1.warnLegacyDependsOnMagicString)(currentProject, dependencyConfig, location);
|
|
143
|
-
delete dependencyConfig.projects;
|
|
144
|
-
}
|
|
145
|
-
else if (dependencyConfig.projects === 'dependencies') {
|
|
146
|
-
(0, legacy_depends_on_warning_1.warnLegacyDependsOnMagicString)(currentProject, dependencyConfig, location);
|
|
147
|
-
dependencyConfig.dependencies = true;
|
|
148
|
-
delete dependencyConfig.projects;
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
dependencyConfig.projects = [dependencyConfig.projects];
|
|
152
|
-
}
|
|
146
|
+
dependencyConfig.projects = [dependencyConfig.projects];
|
|
153
147
|
}
|
|
154
148
|
return dependencyConfig;
|
|
155
149
|
}
|
|
@@ -222,18 +216,10 @@ function getOutputsForTargetAndConfiguration(taskTargetOrTask, overridesOrNode,
|
|
|
222
216
|
validateOutputs(targetConfiguration.outputs);
|
|
223
217
|
const result = new Set();
|
|
224
218
|
for (const output of targetConfiguration.outputs) {
|
|
225
|
-
|
|
226
|
-
// `{workspaceRoot}` still sits where interpolate requires it.
|
|
227
|
-
const isNegated = output.startsWith('!');
|
|
228
|
-
const interpolatedOutput = interpolate(isNegated ? output.substring(1) : output, {
|
|
229
|
-
projectRoot: node.data.root,
|
|
230
|
-
projectName: node.name,
|
|
231
|
-
project: { ...node.data, name: node.name }, // this is legacy
|
|
232
|
-
options,
|
|
233
|
-
});
|
|
219
|
+
const interpolatedOutput = interpolateOutput(output, node, options);
|
|
234
220
|
if (!!interpolatedOutput &&
|
|
235
221
|
!interpolatedOutput.match(/{(projectRoot|workspaceRoot|(options.*))}/)) {
|
|
236
|
-
result.add(
|
|
222
|
+
result.add(output.startsWith('!') ? `!${interpolatedOutput}` : interpolatedOutput);
|
|
237
223
|
}
|
|
238
224
|
}
|
|
239
225
|
return Array.from(result);
|
|
@@ -257,37 +243,89 @@ function getOutputsForTargetAndConfiguration(taskTargetOrTask, overridesOrNode,
|
|
|
257
243
|
}
|
|
258
244
|
}
|
|
259
245
|
/**
|
|
260
|
-
*
|
|
261
|
-
*
|
|
246
|
+
* Resolves the tokens in a configured output, without its leading `!`. A token
|
|
247
|
+
* with no value stays as written.
|
|
248
|
+
*/
|
|
249
|
+
function interpolateOutput(output, node, options) {
|
|
250
|
+
// A leading `!` is negation, not part of the path: strip it so
|
|
251
|
+
// `{workspaceRoot}` still sits where interpolate requires it.
|
|
252
|
+
return interpolate(output.startsWith('!') ? output.substring(1) : output, {
|
|
253
|
+
projectRoot: node.data.root,
|
|
254
|
+
projectName: node.name,
|
|
255
|
+
project: { ...node.data, name: node.name }, // this is legacy
|
|
256
|
+
options,
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Resolves Nx tokens in a path, where each token names a key of `data`
|
|
261
|
+
* (`{projectRoot}/dist`, `{options.outputPath ?? dist/{projectRoot}}`).
|
|
262
|
+
* Paths starting with `/` are returned as written. A token with no value
|
|
263
|
+
* stays as written. `env.` is text, unless `envNotAllowed` is given: then it
|
|
264
|
+
* throws with that message.
|
|
262
265
|
*/
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
266
|
+
function interpolate(template, data, options) {
|
|
267
|
+
if (!/{[\s\S]+?}/.test(template)) {
|
|
268
|
+
return template;
|
|
269
|
+
}
|
|
270
|
+
const scope = {
|
|
271
|
+
isToken: (name) => name === 'env' || Object.hasOwn(data, name),
|
|
272
|
+
read: (name, path) => (0, tokens_1.readPath)(data[name], path),
|
|
273
|
+
env: options?.envNotAllowed
|
|
274
|
+
? { reject: () => new Error(options.envNotAllowed(template)) }
|
|
275
|
+
: undefined,
|
|
276
|
+
noValue: (token) => token,
|
|
277
|
+
};
|
|
278
|
+
if (template.startsWith('/')) {
|
|
279
|
+
if (options?.envNotAllowed) {
|
|
280
|
+
(0, tokens_1.parseTokens)(template, scope);
|
|
281
|
+
}
|
|
267
282
|
return template;
|
|
268
283
|
}
|
|
269
|
-
|
|
284
|
+
const nodes = (0, tokens_1.parseTokens)(template, scope);
|
|
285
|
+
if (!isWorkspaceRootOnlyAtStart(nodes, true)) {
|
|
270
286
|
throw new Error(`Output '${template}' is invalid. {workspaceRoot} can only be used at the beginning of the expression.`);
|
|
271
287
|
}
|
|
272
|
-
|
|
273
|
-
|
|
288
|
+
return joinSegments(nodes, data, scope).replace('{workspaceRoot}/', '');
|
|
289
|
+
}
|
|
290
|
+
// A fallback's literal only ever replaces its whole token, so a token at the
|
|
291
|
+
// start can fall back to `{workspaceRoot}/...`
|
|
292
|
+
function isWorkspaceRootOnlyAtStart(nodes, atStart) {
|
|
293
|
+
return nodes.every((node, i) => {
|
|
294
|
+
const nodeAtStart = atStart && i === 0;
|
|
295
|
+
if (node.kind === 'text') {
|
|
296
|
+
return !node.text.includes('{workspaceRoot}', nodeAtStart ? 1 : 0);
|
|
297
|
+
}
|
|
298
|
+
return node.parts.every((part) => part.kind === 'literal'
|
|
299
|
+
? isWorkspaceRootOnlyAtStart(part.nodes, nodeAtStart)
|
|
300
|
+
: part.name !== 'workspaceRoot' || nodeAtStart);
|
|
301
|
+
});
|
|
274
302
|
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
303
|
+
// Joining the `/`-separated segments normalizes a root project's
|
|
304
|
+
// `{projectRoot}` away, wherever it sits
|
|
305
|
+
function joinSegments(nodes, data, scope) {
|
|
306
|
+
const segments = [''];
|
|
307
|
+
const append = (nodes, isLiteral) => {
|
|
308
|
+
for (const [i, node] of nodes.entries()) {
|
|
309
|
+
if (node.kind === 'text') {
|
|
310
|
+
// A literal keeps its leading `/` on the segment, as an option value
|
|
311
|
+
// does, so an absolute fallback stays absolute
|
|
312
|
+
const root = isLiteral && i === 0 && node.text.startsWith('/') ? '/' : '';
|
|
313
|
+
const [first, ...rest] = node.text.substring(root.length).split('/');
|
|
314
|
+
segments[segments.length - 1] += root + first;
|
|
315
|
+
segments.push(...rest);
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
// Resolved before indexing `segments`: a fallback literal appends to it
|
|
319
|
+
const value = data.projectRoot == '.' && node.raw === '{projectRoot}'
|
|
320
|
+
? ''
|
|
321
|
+
: (0, tokens_1.resolveToken)(node, scope, (literal) => append(literal, true));
|
|
322
|
+
segments[segments.length - 1] += value;
|
|
286
323
|
}
|
|
287
|
-
value = value[path[idx]];
|
|
288
324
|
}
|
|
289
|
-
return
|
|
290
|
-
}
|
|
325
|
+
return '';
|
|
326
|
+
};
|
|
327
|
+
append(nodes, false);
|
|
328
|
+
return (0, posix_1.join)(...segments);
|
|
291
329
|
}
|
|
292
330
|
function getTargetConfigurationForTask(task, projectGraph) {
|
|
293
331
|
const node = projectGraph.nodes[task.target.project];
|
|
@@ -324,10 +362,10 @@ function expandInitiatingTasksThroughNoop(initiatingTasks, taskGraph, projectGra
|
|
|
324
362
|
continue;
|
|
325
363
|
if (getExecutorNameForTask(task, projectGraph) === 'nx:noop') {
|
|
326
364
|
for (const dep of taskGraph.dependencies[taskId] ?? []) {
|
|
327
|
-
queue.push(dep);
|
|
365
|
+
queue.push(dep.id);
|
|
328
366
|
}
|
|
329
367
|
for (const dep of taskGraph.continuousDependencies[taskId] ?? []) {
|
|
330
|
-
queue.push(dep);
|
|
368
|
+
queue.push(dep.id);
|
|
331
369
|
}
|
|
332
370
|
}
|
|
333
371
|
else {
|
|
@@ -341,9 +379,33 @@ function getExecutorForTask(task, projects) {
|
|
|
341
379
|
const [nodeModule, executorName] = (0, executor_utils_1.parseExecutor)(executor);
|
|
342
380
|
return (0, executor_utils_1.getExecutorInformation)(nodeModule, executorName, workspace_root_1.workspaceRoot, projects);
|
|
343
381
|
}
|
|
382
|
+
// TODO(v25): remove custom hasher support.
|
|
344
383
|
function getCustomHasher(task, projects) {
|
|
345
384
|
const factory = getExecutorForTask(task, projects).hasherFactory;
|
|
346
|
-
|
|
385
|
+
if (!factory) {
|
|
386
|
+
return null;
|
|
387
|
+
}
|
|
388
|
+
warnCustomHasherDeprecation(projects[task.target.project].targets[task.target.target].executor);
|
|
389
|
+
return factory();
|
|
390
|
+
}
|
|
391
|
+
const customHasherDeprecationWarned = new Set();
|
|
392
|
+
function warnCustomHasherDeprecation(executor) {
|
|
393
|
+
if (customHasherDeprecationWarned.has(executor)) {
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
customHasherDeprecationWarned.add(executor);
|
|
397
|
+
output_1.output.warn({
|
|
398
|
+
title: `The "${executor}" executor uses a custom hasher, which is deprecated and will be removed in Nx 25.`,
|
|
399
|
+
bodyLines: [
|
|
400
|
+
'Replace the custom hasher with target inputs, following the migration guide:',
|
|
401
|
+
'https://nx.dev/docs/kb/local-executors#replace-a-custom-hasher-with-inputs',
|
|
402
|
+
'If the executor comes from a third-party plugin, report this to its maintainers.',
|
|
403
|
+
],
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
/** Test-only: forget which executors have been warned about. */
|
|
407
|
+
function resetCustomHasherDeprecationWarnings() {
|
|
408
|
+
customHasherDeprecationWarned.clear();
|
|
347
409
|
}
|
|
348
410
|
/**
|
|
349
411
|
* `taskGraph` pruned to `required`, which must already hold its dependencies.
|
|
@@ -370,8 +432,8 @@ function removeIdsFromTaskGraph(graph, ids, mapWithIds) {
|
|
|
370
432
|
for (let id of Object.keys(mapWithIds)) {
|
|
371
433
|
if (!removedSet.has(id)) {
|
|
372
434
|
filteredMapWithIds[id] = mapWithIds[id];
|
|
373
|
-
dependencies[id] = graph.dependencies[id].filter((
|
|
374
|
-
continuousDependencies[id] = graph.continuousDependencies[id].filter((
|
|
435
|
+
dependencies[id] = graph.dependencies[id].filter((dep) => !removedSet.has(dep.id));
|
|
436
|
+
continuousDependencies[id] = graph.continuousDependencies[id].filter((dep) => !removedSet.has(dep.id));
|
|
375
437
|
}
|
|
376
438
|
}
|
|
377
439
|
return {
|
|
@@ -388,12 +450,12 @@ function calculateReverseDeps(taskGraph) {
|
|
|
388
450
|
});
|
|
389
451
|
Object.keys(taskGraph.dependencies).forEach((taskId) => {
|
|
390
452
|
taskGraph.dependencies[taskId].forEach((d) => {
|
|
391
|
-
reverseTaskDeps[d].push(taskId);
|
|
453
|
+
reverseTaskDeps[d.id].push(taskId);
|
|
392
454
|
});
|
|
393
455
|
});
|
|
394
456
|
Object.keys(taskGraph.continuousDependencies).forEach((taskId) => {
|
|
395
457
|
taskGraph.continuousDependencies[taskId].forEach((d) => {
|
|
396
|
-
reverseTaskDeps[d].push(taskId);
|
|
458
|
+
reverseTaskDeps[d.id].push(taskId);
|
|
397
459
|
});
|
|
398
460
|
});
|
|
399
461
|
return reverseTaskDeps;
|
|
@@ -457,3 +519,22 @@ function createTaskId(project, target, configuration) {
|
|
|
457
519
|
}
|
|
458
520
|
return id;
|
|
459
521
|
}
|
|
522
|
+
/**
|
|
523
|
+
* Distinguishes two invocations of the same task for the recursive invocation
|
|
524
|
+
* detector. The task id alone would report `nx run app:build --flag` invoked
|
|
525
|
+
* from within `app:build` as a loop, so the detector pairs the id with this
|
|
526
|
+
* hash and only treats an exact repeat as an immediate loop.
|
|
527
|
+
*
|
|
528
|
+
* The hash cannot decide recursion on its own. Arguments that accumulate
|
|
529
|
+
* through forwarding (`app:build` -> `app:build hello` -> `app:build hello
|
|
530
|
+
* hello`) hash differently on every hop, so the tracker also bounds how many
|
|
531
|
+
* ancestors may be running one task id.
|
|
532
|
+
*
|
|
533
|
+
* `__overrides_unparsed__` is dropped, matching how the task hasher treats it:
|
|
534
|
+
* it restates the other keys as raw argv, down to flag order and spelling.
|
|
535
|
+
*/
|
|
536
|
+
function hashTaskOverrides(task) {
|
|
537
|
+
const overrides = { ...task.overrides };
|
|
538
|
+
delete overrides['__overrides_unparsed__'];
|
|
539
|
+
return (0, file_hasher_1.hashObject)(overrides);
|
|
540
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { NxJsonConfiguration } from '../config/nx-json';
|
|
2
|
+
import type { InputDefinition, TargetConfiguration } from '../config/workspace-json-project-json';
|
|
3
|
+
export declare const ULTRACACHE_DOCS_URL = "https://nx.dev/docs/reference/project-configuration#ultracache";
|
|
4
|
+
/**
|
|
5
|
+
* "Learn more" as an OSC 8 link where the terminal supports one, styled like
|
|
6
|
+
* the TUI's links (underline + cyan, see `tui/components/link.rs`); else the dimmed URL.
|
|
7
|
+
*/
|
|
8
|
+
export declare function ultracacheDocsLink(): string;
|
|
9
|
+
/**
|
|
10
|
+
* Whether Nx Cloud's workspace setting has CI hash tasks from their Ultracache
|
|
11
|
+
* configs. `false` whenever Nx Cloud cannot say. Asked once per process.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isUltracacheOnInCI(nxJson: NxJsonConfiguration): Promise<boolean>;
|
|
14
|
+
/** For specs. */
|
|
15
|
+
export declare function resetUltracacheStatus(): void;
|
|
16
|
+
export type UltracacheModeInCI = 'on' | 'warn' | 'error' | 'off';
|
|
17
|
+
/**
|
|
18
|
+
* How CI treats this target's tasks when the workspace is On; `undefined` when
|
|
19
|
+
* Ultracache doesn't apply. Mirrors the eligibility walk in `ultracache_eligibility.rs`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function ultracacheModeInCI(target: TargetConfiguration, customHasher: boolean): UltracacheModeInCI | undefined;
|
|
22
|
+
export declare function hasAlwaysInput(inputs: readonly (InputDefinition | string)[] | undefined): boolean;
|
|
23
|
+
/** The notice `nx show` prints after `Ultracache:` for a target in `mode`. */
|
|
24
|
+
export declare function ultracacheInCINotice(mode: UltracacheModeInCI, alwaysInputs: boolean): string;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ULTRACACHE_DOCS_URL = void 0;
|
|
4
|
+
exports.ultracacheDocsLink = ultracacheDocsLink;
|
|
5
|
+
exports.isUltracacheOnInCI = isUltracacheOnInCI;
|
|
6
|
+
exports.resetUltracacheStatus = resetUltracacheStatus;
|
|
7
|
+
exports.ultracacheModeInCI = ultracacheModeInCI;
|
|
8
|
+
exports.hasAlwaysInput = hasAlwaysInput;
|
|
9
|
+
exports.ultracacheInCINotice = ultracacheInCINotice;
|
|
10
|
+
const get_cloud_options_1 = require("../nx-cloud/utilities/get-cloud-options");
|
|
11
|
+
const nx_cloud_utils_1 = require("../utils/nx-cloud-utils");
|
|
12
|
+
const terminal_link_1 = require("../utils/terminal-link");
|
|
13
|
+
const fetch_1 = require("./fetch");
|
|
14
|
+
const STATUS_TIMEOUT_MS = 2_000;
|
|
15
|
+
exports.ULTRACACHE_DOCS_URL = 'https://nx.dev/docs/reference/project-configuration#ultracache';
|
|
16
|
+
/**
|
|
17
|
+
* "Learn more" as an OSC 8 link where the terminal supports one, styled like
|
|
18
|
+
* the TUI's links (underline + cyan, see `tui/components/link.rs`); else the dimmed URL.
|
|
19
|
+
*/
|
|
20
|
+
function ultracacheDocsLink() {
|
|
21
|
+
const pc = require('picocolors');
|
|
22
|
+
return (0, terminal_link_1.supportsHyperlinks)()
|
|
23
|
+
? (0, terminal_link_1.terminalLink)(pc.cyan(pc.underline('Learn more')), exports.ULTRACACHE_DOCS_URL)
|
|
24
|
+
: pc.dim(exports.ULTRACACHE_DOCS_URL);
|
|
25
|
+
}
|
|
26
|
+
let status;
|
|
27
|
+
/**
|
|
28
|
+
* Whether Nx Cloud's workspace setting has CI hash tasks from their Ultracache
|
|
29
|
+
* configs. `false` whenever Nx Cloud cannot say. Asked once per process.
|
|
30
|
+
*/
|
|
31
|
+
function isUltracacheOnInCI(nxJson) {
|
|
32
|
+
status ??= readUltracacheStatus(nxJson);
|
|
33
|
+
return status;
|
|
34
|
+
}
|
|
35
|
+
/** For specs. */
|
|
36
|
+
function resetUltracacheStatus() {
|
|
37
|
+
status = undefined;
|
|
38
|
+
}
|
|
39
|
+
async function readUltracacheStatus(nxJson) {
|
|
40
|
+
if (!(0, nx_cloud_utils_1.isNxCloudUsed)(nxJson)) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
const nxCloudOptions = (0, get_cloud_options_1.getCloudOptions)();
|
|
45
|
+
const client = await (0, fetch_1.loadCloudClient)(nxCloudOptions);
|
|
46
|
+
if (typeof client?.readUltracacheStatus !== 'function') {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
const { enabled } = await client.readUltracacheStatus({
|
|
50
|
+
nxCloudOptions,
|
|
51
|
+
timeoutMs: STATUS_TIMEOUT_MS,
|
|
52
|
+
});
|
|
53
|
+
return enabled === true;
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* How CI treats this target's tasks when the workspace is On; `undefined` when
|
|
61
|
+
* Ultracache doesn't apply. Mirrors the eligibility walk in `ultracache_eligibility.rs`.
|
|
62
|
+
*/
|
|
63
|
+
function ultracacheModeInCI(target, customHasher) {
|
|
64
|
+
if (target.cache !== true || target.continuous || customHasher) {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
return target.ultracache?.mode ?? 'on';
|
|
68
|
+
}
|
|
69
|
+
function hasAlwaysInput(inputs) {
|
|
70
|
+
return !!inputs?.some((i) => typeof i === 'object' && 'always' in i && i.always);
|
|
71
|
+
}
|
|
72
|
+
/** The notice `nx show` prints after `Ultracache:` for a target in `mode`. */
|
|
73
|
+
function ultracacheInCINotice(mode, alwaysInputs) {
|
|
74
|
+
switch (mode) {
|
|
75
|
+
case 'on':
|
|
76
|
+
return [
|
|
77
|
+
'In CI, file inputs are replaced by the files this task read during previous runs.',
|
|
78
|
+
...(alwaysInputs ? ['`always` inputs still count.'] : []),
|
|
79
|
+
].join(' ');
|
|
80
|
+
case 'warn':
|
|
81
|
+
return 'In CI, Nx Cloud warns if this task reads files outside its hash or writes files outside its outputs.';
|
|
82
|
+
case 'error':
|
|
83
|
+
return 'In CI, Nx Cloud fails the run if this task reads files outside its hash or writes files outside its outputs.';
|
|
84
|
+
case 'off':
|
|
85
|
+
return 'In CI, this task is not recorded.';
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -12,9 +12,9 @@ export interface UltracacheEnv {
|
|
|
12
12
|
hasNxCloudToken?: boolean;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* `env` defaults to this process's.
|
|
15
|
+
* On for CI runs in a workspace that uses Nx Cloud, since there is nothing to
|
|
16
|
+
* fetch from otherwise. Nx Cloud's workspace setting decides whether the fetch
|
|
17
|
+
* returns any; `NX_CLOUD_USE_ULTRACACHE=false` skips it. `env` defaults to this process's.
|
|
18
18
|
*/
|
|
19
19
|
export declare function isUltracacheConfigurationFetchEnabled(nxJson: NxJsonConfiguration, runnerOptions?: UltracacheCloudOptions, env?: UltracacheEnv): boolean;
|
|
20
20
|
/** The subset of this run's environment the decision reads. */
|
|
@@ -5,15 +5,15 @@ exports.ultracacheEnv = ultracacheEnv;
|
|
|
5
5
|
const is_ci_1 = require("../utils/is-ci");
|
|
6
6
|
const nx_cloud_utils_1 = require("../utils/nx-cloud-utils");
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* `env` defaults to this process's.
|
|
8
|
+
* On for CI runs in a workspace that uses Nx Cloud, since there is nothing to
|
|
9
|
+
* fetch from otherwise. Nx Cloud's workspace setting decides whether the fetch
|
|
10
|
+
* returns any; `NX_CLOUD_USE_ULTRACACHE=false` skips it. `env` defaults to this process's.
|
|
11
11
|
*/
|
|
12
12
|
function isUltracacheConfigurationFetchEnabled(nxJson, runnerOptions = {}, env = ultracacheEnv()) {
|
|
13
13
|
if (env.NX_NO_CLOUD === 'true' ||
|
|
14
14
|
nxJson.neverConnectToCloud ||
|
|
15
15
|
runnerOptions.cloud === false ||
|
|
16
|
-
env.NX_CLOUD_USE_ULTRACACHE
|
|
16
|
+
env.NX_CLOUD_USE_ULTRACACHE === 'false' ||
|
|
17
17
|
!(0, is_ci_1.isCI)()) {
|
|
18
18
|
return false;
|
|
19
19
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type NxCloudClient } from '../nx-cloud/update-manager';
|
|
1
2
|
import type { UltracacheCloudOptions } from './config';
|
|
2
3
|
/** The Nx Cloud client's `readUltracacheConfigurations` contract, as far as nx uses it. */
|
|
3
4
|
export interface ReadUltracacheConfigurationsOptions {
|
|
@@ -19,3 +20,4 @@ export interface ReadUltracacheConfigurationsResult {
|
|
|
19
20
|
* `NO_CONFIGURATIONS`.
|
|
20
21
|
*/
|
|
21
22
|
export declare function fetchUltracacheConfigurations(runnerOptions: UltracacheCloudOptions): Promise<ReadUltracacheConfigurationsResult>;
|
|
23
|
+
export declare function loadCloudClient(runnerOptions: UltracacheCloudOptions): Promise<NxCloudClient | undefined>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fetchUltracacheConfigurations = fetchUltracacheConfigurations;
|
|
4
|
+
exports.loadCloudClient = loadCloudClient;
|
|
4
5
|
const resolution_helpers_1 = require("../nx-cloud/resolution-helpers");
|
|
5
6
|
const update_manager_1 = require("../nx-cloud/update-manager");
|
|
6
7
|
const workspace_root_1 = require("../utils/workspace-root");
|
|
@@ -19,6 +19,7 @@ function customHasherTaskIds(projectGraph, taskGraph) {
|
|
|
19
19
|
return memoized;
|
|
20
20
|
}
|
|
21
21
|
const projects = (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph).projects;
|
|
22
|
+
// TODO(v25): remove custom hasher support.
|
|
22
23
|
const ids = Object.values(taskGraph.tasks)
|
|
23
24
|
.filter((task) => {
|
|
24
25
|
try {
|
|
@@ -48,6 +49,9 @@ function getUltracacheSettings(taskGraph) {
|
|
|
48
49
|
function ultracacheEligibilityOptions(projectGraph, taskGraph) {
|
|
49
50
|
return {
|
|
50
51
|
customHasherTaskIds: customHasherTaskIds(projectGraph, taskGraph),
|
|
52
|
+
continuousTaskIds: Object.values(taskGraph.tasks)
|
|
53
|
+
.filter((task) => task.continuous)
|
|
54
|
+
.map((task) => task.id),
|
|
51
55
|
};
|
|
52
56
|
}
|
|
53
57
|
/**
|
|
@@ -9,5 +9,38 @@ import type { PackageManager } from './package-manager';
|
|
|
9
9
|
* that introduces such a dependency records the decision up front. Other
|
|
10
10
|
* package managers run build scripts unconditionally, so this is a no-op for
|
|
11
11
|
* them.
|
|
12
|
+
*
|
|
13
|
+
* @param treeOrRoot The workspace tree, or its root on disk.
|
|
14
|
+
* @param packageManager The workspace package manager.
|
|
15
|
+
* @param entries Package name to decision: `true` runs the package's build
|
|
16
|
+
* scripts, `false` skips them. Entries the user already decided are kept.
|
|
17
|
+
* @param directory Workspace root relative to the tree root, for generators
|
|
18
|
+
* that scaffold a workspace into a subdirectory.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* acknowledgeBuildScripts(tree, detectPackageManager(tree.root), {
|
|
23
|
+
* esbuild: false,
|
|
24
|
+
* cypress: true,
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function acknowledgeBuildScripts(treeOrRoot: Tree | string, packageManager: PackageManager, entries: Record<string, boolean>, directory?: string): void;
|
|
29
|
+
/**
|
|
30
|
+
* Records the build-script decisions a package declares for its own
|
|
31
|
+
* dependency tree, so the install that first pulls the package in can stay
|
|
32
|
+
* strict. A package declares them in the `pnpm.allowBuilds` field of its
|
|
33
|
+
* package.json, the same shape pnpm reads from a workspace root; pnpm ignores
|
|
34
|
+
* the field on dependencies, so it is read from the registry here.
|
|
35
|
+
*
|
|
36
|
+
* A declared `false` is recorded as is: it only skips a script. A declared
|
|
37
|
+
* `true` would let a publisher authorize code execution in the workspace, so
|
|
38
|
+
* it is a request: in a terminal the owner picks which to allow, elsewhere
|
|
39
|
+
* every request is recorded as `false`. Decisions the owner already recorded
|
|
40
|
+
* are kept either way, and everything recorded is printed.
|
|
41
|
+
*
|
|
42
|
+
* Resolves to whether the package declared any decision. Nothing is recorded
|
|
43
|
+
* for package managers other than pnpm, pnpm < 11, packages that declare
|
|
44
|
+
* nothing, and specs the registry cannot answer, such as a tarball path.
|
|
12
45
|
*/
|
|
13
|
-
export declare function
|
|
46
|
+
export declare function acknowledgeDeclaredBuildScripts(treeOrRoot: Tree | string, packageManager: PackageManager, packageName: string, version: string, directory?: string): Promise<boolean>;
|