@ohos-npm-ports/nx 23.1.1-beta.1
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/LICENSE +22 -0
- package/README.md +65 -0
- package/dist/bin/init-local.d.ts +8 -0
- package/dist/bin/init-local.js +188 -0
- package/dist/bin/nx-cloud.d.ts +3 -0
- package/dist/bin/nx-cloud.js +47 -0
- package/dist/bin/nx.d.ts +3 -0
- package/dist/bin/nx.js +340 -0
- package/dist/bin/post-install.d.ts +1 -0
- package/dist/bin/post-install.js +52 -0
- package/dist/bin/run-executor.d.ts +1 -0
- package/dist/bin/run-executor.js +66 -0
- package/dist/plugins/package-json.d.ts +4 -0
- package/dist/plugins/package-json.js +40 -0
- package/dist/presets/core.json +1 -0
- package/dist/presets/npm.json +7 -0
- package/dist/release/changelog-renderer/index.d.ts +110 -0
- package/dist/release/changelog-renderer/index.js +382 -0
- package/dist/release/index.d.ts +4 -0
- package/dist/release/index.js +13 -0
- package/dist/src/adapter/angular-json.d.ts +10 -0
- package/dist/src/adapter/angular-json.js +129 -0
- package/dist/src/adapter/compat.d.ts +2 -0
- package/dist/src/adapter/compat.js +154 -0
- package/dist/src/adapter/ngcli-adapter.d.ts +105 -0
- package/dist/src/adapter/ngcli-adapter.js +1024 -0
- package/dist/src/adapter/rxjs-for-await.d.ts +109 -0
- package/dist/src/adapter/rxjs-for-await.js +362 -0
- package/dist/src/ai/clone-ai-config-repo.d.ts +11 -0
- package/dist/src/ai/clone-ai-config-repo.js +155 -0
- package/dist/src/ai/configure-ai-agents-disclaimer.d.ts +5 -0
- package/dist/src/ai/configure-ai-agents-disclaimer.js +31 -0
- package/dist/src/ai/constants.d.ts +31 -0
- package/dist/src/ai/constants.js +76 -0
- package/dist/src/ai/detect-ai-agent.d.ts +2 -0
- package/dist/src/ai/detect-ai-agent.js +12 -0
- package/dist/src/ai/set-up-ai-agents/get-agent-rules.d.ts +5 -0
- package/dist/src/ai/set-up-ai-agents/get-agent-rules.js +26 -0
- package/dist/src/ai/set-up-ai-agents/schema.d.ts +11 -0
- package/dist/src/ai/set-up-ai-agents/schema.json +34 -0
- package/dist/src/ai/set-up-ai-agents/set-up-ai-agents.d.ts +10 -0
- package/dist/src/ai/set-up-ai-agents/set-up-ai-agents.js +530 -0
- package/dist/src/ai/utils.d.ts +20 -0
- package/dist/src/ai/utils.js +217 -0
- package/dist/src/analytics/analytics.d.ts +16 -0
- package/dist/src/analytics/analytics.js +248 -0
- package/dist/src/analytics/index.d.ts +1 -0
- package/dist/src/analytics/index.js +12 -0
- package/dist/src/command-line/add/add.d.ts +3 -0
- package/dist/src/command-line/add/add.js +133 -0
- package/dist/src/command-line/add/command-object.d.ts +8 -0
- package/dist/src/command-line/add/command-object.js +28 -0
- package/dist/src/command-line/add/completion.d.ts +1 -0
- package/dist/src/command-line/add/completion.js +15 -0
- package/dist/src/command-line/affected/affected.d.ts +10 -0
- package/dist/src/command-line/affected/affected.js +89 -0
- package/dist/src/command-line/affected/command-object.d.ts +6 -0
- package/dist/src/command-line/affected/command-object.js +83 -0
- package/dist/src/command-line/affected/completion.d.ts +1 -0
- package/dist/src/command-line/affected/completion.js +15 -0
- package/dist/src/command-line/ai/ai-output.d.ts +46 -0
- package/dist/src/command-line/ai/ai-output.js +86 -0
- package/dist/src/command-line/completion/argv-layout.d.ts +6 -0
- package/dist/src/command-line/completion/argv-layout.js +19 -0
- package/dist/src/command-line/completion/command-completions.d.ts +19 -0
- package/dist/src/command-line/completion/command-completions.js +120 -0
- package/dist/src/command-line/completion/command-handlers.d.ts +30 -0
- package/dist/src/command-line/completion/command-handlers.js +69 -0
- package/dist/src/command-line/completion/command-object.d.ts +10 -0
- package/dist/src/command-line/completion/command-object.js +107 -0
- package/dist/src/command-line/completion/completion-providers.d.ts +21 -0
- package/dist/src/command-line/completion/completion-providers.js +194 -0
- package/dist/src/command-line/completion/infix-targets.d.ts +1 -0
- package/dist/src/command-line/completion/infix-targets.js +48 -0
- package/dist/src/command-line/completion/metadata.d.ts +22 -0
- package/dist/src/command-line/completion/metadata.js +71 -0
- package/dist/src/command-line/completion/registrations.d.ts +9 -0
- package/dist/src/command-line/completion/registrations.js +16 -0
- package/dist/src/command-line/completion/scripts/bash.sh +51 -0
- package/dist/src/command-line/completion/scripts/fish.fish +47 -0
- package/dist/src/command-line/completion/scripts/powershell.ps1 +52 -0
- package/dist/src/command-line/completion/scripts/zsh.zsh +69 -0
- package/dist/src/command-line/completion/scripts.d.ts +18 -0
- package/dist/src/command-line/completion/scripts.js +140 -0
- package/dist/src/command-line/completion/trigger.d.ts +3 -0
- package/dist/src/command-line/completion/trigger.js +21 -0
- package/dist/src/command-line/completion/value-completions.d.ts +3 -0
- package/dist/src/command-line/completion/value-completions.js +21 -0
- package/dist/src/command-line/configure-ai-agents/command-object.d.ts +8 -0
- package/dist/src/command-line/configure-ai-agents/command-object.js +59 -0
- package/dist/src/command-line/configure-ai-agents/configure-ai-agents.d.ts +3 -0
- package/dist/src/command-line/configure-ai-agents/configure-ai-agents.js +425 -0
- package/dist/src/command-line/daemon/command-object.d.ts +1 -0
- package/dist/src/command-line/daemon/command-object.js +29 -0
- package/dist/src/command-line/daemon/daemon.d.ts +2 -0
- package/dist/src/command-line/daemon/daemon.js +31 -0
- package/dist/src/command-line/deprecated/command-objects.d.ts +9 -0
- package/dist/src/command-line/deprecated/command-objects.js +48 -0
- package/dist/src/command-line/examples.d.ts +12 -0
- package/dist/src/command-line/examples.js +403 -0
- package/dist/src/command-line/exec/command-object.d.ts +2 -0
- package/dist/src/command-line/exec/command-object.js +20 -0
- package/dist/src/command-line/exec/exec.d.ts +1 -0
- package/dist/src/command-line/exec/exec.js +143 -0
- package/dist/src/command-line/format/command-object.d.ts +3 -0
- package/dist/src/command-line/format/command-object.js +58 -0
- package/dist/src/command-line/format/format.d.ts +2 -0
- package/dist/src/command-line/format/format.js +233 -0
- package/dist/src/command-line/generate/command-object.d.ts +2 -0
- package/dist/src/command-line/generate/command-object.js +67 -0
- package/dist/src/command-line/generate/completion.d.ts +1 -0
- package/dist/src/command-line/generate/completion.js +9 -0
- package/dist/src/command-line/generate/generate.d.ts +21 -0
- package/dist/src/command-line/generate/generate.js +281 -0
- package/dist/src/command-line/generate/generator-utils.d.ts +18 -0
- package/dist/src/command-line/generate/generator-utils.js +91 -0
- package/dist/src/command-line/graph/command-object.d.ts +3 -0
- package/dist/src/command-line/graph/command-object.js +76 -0
- package/dist/src/command-line/graph/completion.d.ts +1 -0
- package/dist/src/command-line/graph/completion.js +13 -0
- package/dist/src/command-line/graph/graph.d.ts +70 -0
- package/dist/src/command-line/graph/graph.js +987 -0
- package/dist/src/command-line/import/command-object.d.ts +2 -0
- package/dist/src/command-line/import/command-object.js +63 -0
- package/dist/src/command-line/import/import.d.ts +26 -0
- package/dist/src/command-line/import/import.js +600 -0
- package/dist/src/command-line/import/utils/ai-output.d.ts +93 -0
- package/dist/src/command-line/import/utils/ai-output.js +209 -0
- package/dist/src/command-line/import/utils/merge-remote-source.d.ts +2 -0
- package/dist/src/command-line/import/utils/merge-remote-source.js +14 -0
- package/dist/src/command-line/import/utils/prepare-source-repo.d.ts +2 -0
- package/dist/src/command-line/import/utils/prepare-source-repo.js +27 -0
- package/dist/src/command-line/index.d.ts +22 -0
- package/dist/src/command-line/index.js +26 -0
- package/dist/src/command-line/init/ai-agent-prompts.d.ts +2 -0
- package/dist/src/command-line/init/ai-agent-prompts.js +36 -0
- package/dist/src/command-line/init/command-object.d.ts +2 -0
- package/dist/src/command-line/init/command-object.js +116 -0
- package/dist/src/command-line/init/configure-plugins.d.ts +34 -0
- package/dist/src/command-line/init/configure-plugins.js +211 -0
- package/dist/src/command-line/init/implementation/add-nx-to-monorepo.d.ts +6 -0
- package/dist/src/command-line/init/implementation/add-nx-to-monorepo.js +142 -0
- package/dist/src/command-line/init/implementation/add-nx-to-nest.d.ts +5 -0
- package/dist/src/command-line/init/implementation/add-nx-to-nest.js +357 -0
- package/dist/src/command-line/init/implementation/add-nx-to-npm-repo.d.ts +6 -0
- package/dist/src/command-line/init/implementation/add-nx-to-npm-repo.js +83 -0
- package/dist/src/command-line/init/implementation/add-nx-to-turborepo.d.ts +4 -0
- package/dist/src/command-line/init/implementation/add-nx-to-turborepo.js +51 -0
- package/dist/src/command-line/init/implementation/angular/index.d.ts +2 -0
- package/dist/src/command-line/init/implementation/angular/index.js +135 -0
- package/dist/src/command-line/init/implementation/angular/integrated-workspace.d.ts +1 -0
- package/dist/src/command-line/init/implementation/angular/integrated-workspace.js +9 -0
- package/dist/src/command-line/init/implementation/angular/legacy-angular-versions.d.ts +2 -0
- package/dist/src/command-line/init/implementation/angular/legacy-angular-versions.js +153 -0
- package/dist/src/command-line/init/implementation/angular/standalone-workspace.d.ts +1 -0
- package/dist/src/command-line/init/implementation/angular/standalone-workspace.js +198 -0
- package/dist/src/command-line/init/implementation/angular/types.d.ts +20 -0
- package/dist/src/command-line/init/implementation/angular/types.js +2 -0
- package/dist/src/command-line/init/implementation/check-compatible-with-plugins.d.ts +15 -0
- package/dist/src/command-line/init/implementation/check-compatible-with-plugins.js +134 -0
- package/dist/src/command-line/init/implementation/deduce-default-base.d.ts +1 -0
- package/dist/src/command-line/init/implementation/deduce-default-base.js +53 -0
- package/dist/src/command-line/init/implementation/dot-nx/add-nx-scripts.d.ts +11 -0
- package/dist/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +146 -0
- package/dist/src/command-line/init/implementation/dot-nx/nxw.d.ts +1 -0
- package/dist/src/command-line/init/implementation/dot-nx/nxw.js +123 -0
- package/dist/src/command-line/init/implementation/utils.d.ts +35 -0
- package/dist/src/command-line/init/implementation/utils.js +422 -0
- package/dist/src/command-line/init/init-v1.d.ts +8 -0
- package/dist/src/command-line/init/init-v1.js +104 -0
- package/dist/src/command-line/init/init-v2.d.ts +23 -0
- package/dist/src/command-line/init/init-v2.js +612 -0
- package/dist/src/command-line/init/utils/ai-output.d.ts +72 -0
- package/dist/src/command-line/init/utils/ai-output.js +180 -0
- package/dist/src/command-line/list/command-object.d.ts +2 -0
- package/dist/src/command-line/list/command-object.js +21 -0
- package/dist/src/command-line/list/list.d.ts +15 -0
- package/dist/src/command-line/list/list.js +48 -0
- package/dist/src/command-line/mcp/command-object.d.ts +2 -0
- package/dist/src/command-line/mcp/command-object.js +29 -0
- package/dist/src/command-line/mcp/mcp.d.ts +2 -0
- package/dist/src/command-line/mcp/mcp.js +60 -0
- package/dist/src/command-line/migrate/agentic/capture-generator-output.d.ts +22 -0
- package/dist/src/command-line/migrate/agentic/capture-generator-output.js +100 -0
- package/dist/src/command-line/migrate/agentic/cli-args.d.ts +12 -0
- package/dist/src/command-line/migrate/agentic/cli-args.js +38 -0
- package/dist/src/command-line/migrate/agentic/definitions.d.ts +6 -0
- package/dist/src/command-line/migrate/agentic/definitions.js +121 -0
- package/dist/src/command-line/migrate/agentic/detect-installed.d.ts +10 -0
- package/dist/src/command-line/migrate/agentic/detect-installed.js +68 -0
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +46 -0
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +87 -0
- package/dist/src/command-line/migrate/agentic/handoff.d.ts +69 -0
- package/dist/src/command-line/migrate/agentic/handoff.js +190 -0
- package/dist/src/command-line/migrate/agentic/inception.d.ts +9 -0
- package/dist/src/command-line/migrate/agentic/inception.js +15 -0
- package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.d.ts +22 -0
- package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.js +50 -0
- package/dist/src/command-line/migrate/agentic/prompts/generic-validation.d.ts +56 -0
- package/dist/src/command-line/migrate/agentic/prompts/generic-validation.js +66 -0
- package/dist/src/command-line/migrate/agentic/prompts/hybrid-prompt-migration.d.ts +49 -0
- package/dist/src/command-line/migrate/agentic/prompts/hybrid-prompt-migration.js +53 -0
- package/dist/src/command-line/migrate/agentic/prompts/prompt-migration.d.ts +26 -0
- package/dist/src/command-line/migrate/agentic/prompts/prompt-migration.js +27 -0
- package/dist/src/command-line/migrate/agentic/prompts/shared-rendering.d.ts +19 -0
- package/dist/src/command-line/migrate/agentic/prompts/shared-rendering.js +145 -0
- package/dist/src/command-line/migrate/agentic/prompts/system-prompt.d.ts +46 -0
- package/dist/src/command-line/migrate/agentic/prompts/system-prompt.js +90 -0
- package/dist/src/command-line/migrate/agentic/run-step.d.ts +58 -0
- package/dist/src/command-line/migrate/agentic/run-step.js +123 -0
- package/dist/src/command-line/migrate/agentic/runner.d.ts +33 -0
- package/dist/src/command-line/migrate/agentic/runner.js +444 -0
- package/dist/src/command-line/migrate/agentic/select.d.ts +16 -0
- package/dist/src/command-line/migrate/agentic/select.js +253 -0
- package/dist/src/command-line/migrate/agentic/types.d.ts +102 -0
- package/dist/src/command-line/migrate/agentic/types.js +2 -0
- package/dist/src/command-line/migrate/command-object.d.ts +47 -0
- package/dist/src/command-line/migrate/command-object.js +134 -0
- package/dist/src/command-line/migrate/execute-migration.d.ts +72 -0
- package/dist/src/command-line/migrate/execute-migration.js +389 -0
- package/dist/src/command-line/migrate/migrate-analytics.d.ts +71 -0
- package/dist/src/command-line/migrate/migrate-analytics.js +253 -0
- package/dist/src/command-line/migrate/migrate-commits.d.ts +50 -0
- package/dist/src/command-line/migrate/migrate-commits.js +102 -0
- package/dist/src/command-line/migrate/migrate-config.d.ts +28 -0
- package/dist/src/command-line/migrate/migrate-config.js +104 -0
- package/dist/src/command-line/migrate/migrate-output.d.ts +180 -0
- package/dist/src/command-line/migrate/migrate-output.js +258 -0
- package/dist/src/command-line/migrate/migrate-ui-api.d.ts +88 -0
- package/dist/src/command-line/migrate/migrate-ui-api.js +428 -0
- package/dist/src/command-line/migrate/migrate.d.ts +269 -0
- package/dist/src/command-line/migrate/migrate.js +2417 -0
- package/dist/src/command-line/migrate/migration-shape.d.ts +8 -0
- package/dist/src/command-line/migrate/migration-shape.js +13 -0
- package/dist/src/command-line/migrate/multi-major.d.ts +37 -0
- package/dist/src/command-line/migrate/multi-major.js +218 -0
- package/dist/src/command-line/migrate/prompt-files.d.ts +31 -0
- package/dist/src/command-line/migrate/prompt-files.js +141 -0
- package/dist/src/command-line/migrate/resolve-package-version.d.ts +24 -0
- package/dist/src/command-line/migrate/resolve-package-version.js +249 -0
- package/dist/src/command-line/migrate/run-migration-process.js +109 -0
- package/dist/src/command-line/migrate/safe-prompt.d.ts +33 -0
- package/dist/src/command-line/migrate/safe-prompt.js +58 -0
- package/dist/src/command-line/migrate/update-filters.d.ts +11 -0
- package/dist/src/command-line/migrate/update-filters.js +45 -0
- package/dist/src/command-line/migrate/version-utils.d.ts +5 -0
- package/dist/src/command-line/migrate/version-utils.js +52 -0
- package/dist/src/command-line/new/command-object.d.ts +2 -0
- package/dist/src/command-line/new/command-object.js +26 -0
- package/dist/src/command-line/new/new.d.ts +3 -0
- package/dist/src/command-line/new/new.js +30 -0
- package/dist/src/command-line/nx-cloud/apply-locally/apply-locally.d.ts +4 -0
- package/dist/src/command-line/nx-cloud/apply-locally/apply-locally.js +13 -0
- package/dist/src/command-line/nx-cloud/apply-locally/command-object.d.ts +2 -0
- package/dist/src/command-line/nx-cloud/apply-locally/command-object.js +16 -0
- package/dist/src/command-line/nx-cloud/complete-run/command-object.d.ts +2 -0
- package/dist/src/command-line/nx-cloud/complete-run/command-object.js +17 -0
- package/dist/src/command-line/nx-cloud/complete-run/stop-all-agents.d.ts +4 -0
- package/dist/src/command-line/nx-cloud/complete-run/stop-all-agents.js +13 -0
- package/dist/src/command-line/nx-cloud/connect/command-object.d.ts +3 -0
- package/dist/src/command-line/nx-cloud/connect/command-object.js +28 -0
- package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.d.ts +13 -0
- package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +270 -0
- package/dist/src/command-line/nx-cloud/connect/view-logs.d.ts +1 -0
- package/dist/src/command-line/nx-cloud/connect/view-logs.js +55 -0
- package/dist/src/command-line/nx-cloud/download-cloud-client/command-object.d.ts +2 -0
- package/dist/src/command-line/nx-cloud/download-cloud-client/command-object.js +13 -0
- package/dist/src/command-line/nx-cloud/download-cloud-client/download-cloud-client.d.ts +4 -0
- package/dist/src/command-line/nx-cloud/download-cloud-client/download-cloud-client.js +32 -0
- package/dist/src/command-line/nx-cloud/fix-ci/command-object.d.ts +2 -0
- package/dist/src/command-line/nx-cloud/fix-ci/command-object.js +16 -0
- package/dist/src/command-line/nx-cloud/fix-ci/fix-ci.d.ts +4 -0
- package/dist/src/command-line/nx-cloud/fix-ci/fix-ci.js +13 -0
- package/dist/src/command-line/nx-cloud/login/command-object.d.ts +2 -0
- package/dist/src/command-line/nx-cloud/login/command-object.js +20 -0
- package/dist/src/command-line/nx-cloud/login/login.d.ts +5 -0
- package/dist/src/command-line/nx-cloud/login/login.js +10 -0
- package/dist/src/command-line/nx-cloud/logout/command-object.d.ts +2 -0
- package/dist/src/command-line/nx-cloud/logout/command-object.js +16 -0
- package/dist/src/command-line/nx-cloud/logout/logout.d.ts +4 -0
- package/dist/src/command-line/nx-cloud/logout/logout.js +7 -0
- package/dist/src/command-line/nx-cloud/record/command-object.d.ts +2 -0
- package/dist/src/command-line/nx-cloud/record/command-object.js +19 -0
- package/dist/src/command-line/nx-cloud/record/record.d.ts +5 -0
- package/dist/src/command-line/nx-cloud/record/record.js +33 -0
- package/dist/src/command-line/nx-cloud/start-agent/command-object.d.ts +2 -0
- package/dist/src/command-line/nx-cloud/start-agent/command-object.js +16 -0
- package/dist/src/command-line/nx-cloud/start-agent/start-agent.d.ts +4 -0
- package/dist/src/command-line/nx-cloud/start-agent/start-agent.js +13 -0
- package/dist/src/command-line/nx-cloud/start-ci-run/command-object.d.ts +2 -0
- package/dist/src/command-line/nx-cloud/start-ci-run/command-object.js +16 -0
- package/dist/src/command-line/nx-cloud/start-ci-run/start-ci-run.d.ts +4 -0
- package/dist/src/command-line/nx-cloud/start-ci-run/start-ci-run.js +13 -0
- package/dist/src/command-line/nx-cloud/utils.d.ts +2 -0
- package/dist/src/command-line/nx-cloud/utils.js +34 -0
- package/dist/src/command-line/nx-commands.d.ts +10 -0
- package/dist/src/command-line/nx-commands.js +181 -0
- package/dist/src/command-line/register/command-object.d.ts +6 -0
- package/dist/src/command-line/register/command-object.js +27 -0
- package/dist/src/command-line/register/register.d.ts +2 -0
- package/dist/src/command-line/register/register.js +9 -0
- package/dist/src/command-line/release/changelog/commit-utils.d.ts +13 -0
- package/dist/src/command-line/release/changelog/commit-utils.js +63 -0
- package/dist/src/command-line/release/changelog/version-plan-filtering.d.ts +43 -0
- package/dist/src/command-line/release/changelog/version-plan-filtering.js +156 -0
- package/dist/src/command-line/release/changelog/version-plan-utils.d.ts +31 -0
- package/dist/src/command-line/release/changelog/version-plan-utils.js +92 -0
- package/dist/src/command-line/release/changelog.d.ts +28 -0
- package/dist/src/command-line/release/changelog.js +911 -0
- package/dist/src/command-line/release/command-object.d.ts +96 -0
- package/dist/src/command-line/release/command-object.js +342 -0
- package/dist/src/command-line/release/config/config.d.ts +70 -0
- package/dist/src/command-line/release/config/config.js +1204 -0
- package/dist/src/command-line/release/config/conventional-commits.d.ts +2 -0
- package/dist/src/command-line/release/config/conventional-commits.js +106 -0
- package/dist/src/command-line/release/config/deep-merge-json.d.ts +1 -0
- package/dist/src/command-line/release/config/deep-merge-json.js +28 -0
- package/dist/src/command-line/release/config/filter-release-groups.d.ts +23 -0
- package/dist/src/command-line/release/config/filter-release-groups.js +157 -0
- package/dist/src/command-line/release/config/use-legacy-versioning.d.ts +2 -0
- package/dist/src/command-line/release/config/use-legacy-versioning.js +8 -0
- package/dist/src/command-line/release/config/version-plans.d.ts +42 -0
- package/dist/src/command-line/release/config/version-plans.js +278 -0
- package/dist/src/command-line/release/index.d.ts +49 -0
- package/dist/src/command-line/release/index.js +49 -0
- package/dist/src/command-line/release/plan-check.d.ts +4 -0
- package/dist/src/command-line/release/plan-check.js +170 -0
- package/dist/src/command-line/release/plan.d.ts +4 -0
- package/dist/src/command-line/release/plan.js +261 -0
- package/dist/src/command-line/release/publish.d.ts +9 -0
- package/dist/src/command-line/release/publish.js +290 -0
- package/dist/src/command-line/release/release.d.ts +5 -0
- package/dist/src/command-line/release/release.js +310 -0
- package/dist/src/command-line/release/utils/diff.d.ts +21 -0
- package/dist/src/command-line/release/utils/diff.js +168 -0
- package/dist/src/command-line/release/utils/exec-command.d.ts +1 -0
- package/dist/src/command-line/release/utils/exec-command.js +34 -0
- package/dist/src/command-line/release/utils/generate-version-plan-content.d.ts +1 -0
- package/dist/src/command-line/release/utils/generate-version-plan-content.js +20 -0
- package/dist/src/command-line/release/utils/get-touched-projects-for-group.d.ts +7 -0
- package/dist/src/command-line/release/utils/get-touched-projects-for-group.js +78 -0
- package/dist/src/command-line/release/utils/git.d.ts +126 -0
- package/dist/src/command-line/release/utils/git.js +597 -0
- package/dist/src/command-line/release/utils/launch-editor.d.ts +1 -0
- package/dist/src/command-line/release/utils/launch-editor.js +46 -0
- package/dist/src/command-line/release/utils/markdown.d.ts +6 -0
- package/dist/src/command-line/release/utils/markdown.js +28 -0
- package/dist/src/command-line/release/utils/print-changes.d.ts +6 -0
- package/dist/src/command-line/release/utils/print-changes.js +63 -0
- package/dist/src/command-line/release/utils/print-config.d.ts +7 -0
- package/dist/src/command-line/release/utils/print-config.js +36 -0
- package/dist/src/command-line/release/utils/release-graph.d.ts +230 -0
- package/dist/src/command-line/release/utils/release-graph.js +709 -0
- package/dist/src/command-line/release/utils/remote-release-clients/extract-repo-slug.d.ts +9 -0
- package/dist/src/command-line/release/utils/remote-release-clients/extract-repo-slug.js +61 -0
- package/dist/src/command-line/release/utils/remote-release-clients/github.d.ts +58 -0
- package/dist/src/command-line/release/utils/remote-release-clients/github.js +342 -0
- package/dist/src/command-line/release/utils/remote-release-clients/gitlab.d.ts +62 -0
- package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +268 -0
- package/dist/src/command-line/release/utils/remote-release-clients/remote-release-client.d.ts +111 -0
- package/dist/src/command-line/release/utils/remote-release-clients/remote-release-client.js +138 -0
- package/dist/src/command-line/release/utils/repository-git-tags.d.ts +25 -0
- package/dist/src/command-line/release/utils/repository-git-tags.js +125 -0
- package/dist/src/command-line/release/utils/resolve-changelog-renderer.d.ts +2 -0
- package/dist/src/command-line/release/utils/resolve-changelog-renderer.js +22 -0
- package/dist/src/command-line/release/utils/resolve-nx-json-error-message.d.ts +1 -0
- package/dist/src/command-line/release/utils/resolve-nx-json-error-message.js +53 -0
- package/dist/src/command-line/release/utils/resolve-semver-specifier.d.ts +7 -0
- package/dist/src/command-line/release/utils/resolve-semver-specifier.js +63 -0
- package/dist/src/command-line/release/utils/semver.d.ts +26 -0
- package/dist/src/command-line/release/utils/semver.js +111 -0
- package/dist/src/command-line/release/utils/shared-legacy.d.ts +25 -0
- package/dist/src/command-line/release/utils/shared-legacy.js +2 -0
- package/dist/src/command-line/release/utils/shared.d.ts +64 -0
- package/dist/src/command-line/release/utils/shared.js +379 -0
- package/dist/src/command-line/release/utils/version-plan-utils.d.ts +40 -0
- package/dist/src/command-line/release/utils/version-plan-utils.js +111 -0
- package/dist/src/command-line/release/version/derive-specifier-from-conventional-commits.d.ts +8 -0
- package/dist/src/command-line/release/version/derive-specifier-from-conventional-commits.js +61 -0
- package/dist/src/command-line/release/version/deriver-specifier-from-version-plans.d.ts +8 -0
- package/dist/src/command-line/release/version/deriver-specifier-from-version-plans.js +59 -0
- package/dist/src/command-line/release/version/project-logger.d.ts +8 -0
- package/dist/src/command-line/release/version/project-logger.js +47 -0
- package/dist/src/command-line/release/version/release-group-processor.d.ts +115 -0
- package/dist/src/command-line/release/version/release-group-processor.js +632 -0
- package/dist/src/command-line/release/version/resolve-current-version.d.ts +32 -0
- package/dist/src/command-line/release/version/resolve-current-version.js +243 -0
- package/dist/src/command-line/release/version/topological-sort.d.ts +9 -0
- package/dist/src/command-line/release/version/topological-sort.js +41 -0
- package/dist/src/command-line/release/version/version-actions.d.ts +199 -0
- package/dist/src/command-line/release/version/version-actions.js +247 -0
- package/dist/src/command-line/release/version.d.ts +28 -0
- package/dist/src/command-line/release/version.js +378 -0
- package/dist/src/command-line/repair/command-object.d.ts +2 -0
- package/dist/src/command-line/repair/command-object.js +21 -0
- package/dist/src/command-line/repair/repair.d.ts +3 -0
- package/dist/src/command-line/repair/repair.js +41 -0
- package/dist/src/command-line/report/command-object.d.ts +2 -0
- package/dist/src/command-line/report/command-object.js +12 -0
- package/dist/src/command-line/report/report.d.ts +71 -0
- package/dist/src/command-line/report/report.js +405 -0
- package/dist/src/command-line/reset/command-object.d.ts +8 -0
- package/dist/src/command-line/reset/command-object.js +27 -0
- package/dist/src/command-line/reset/reset.d.ts +2 -0
- package/dist/src/command-line/reset/reset.js +178 -0
- package/dist/src/command-line/run/command-object.d.ts +6 -0
- package/dist/src/command-line/run/command-object.js +43 -0
- package/dist/src/command-line/run/completion.d.ts +1 -0
- package/dist/src/command-line/run/completion.js +7 -0
- package/dist/src/command-line/run/executor-utils.d.ts +12 -0
- package/dist/src/command-line/run/executor-utils.js +96 -0
- package/dist/src/command-line/run/run-one.d.ts +17 -0
- package/dist/src/command-line/run/run-one.js +154 -0
- package/dist/src/command-line/run/run.d.ts +51 -0
- package/dist/src/command-line/run/run.js +179 -0
- package/dist/src/command-line/run-many/command-object.d.ts +2 -0
- package/dist/src/command-line/run-many/command-object.js +18 -0
- package/dist/src/command-line/run-many/completion.d.ts +1 -0
- package/dist/src/command-line/run-many/completion.js +13 -0
- package/dist/src/command-line/run-many/run-many.d.ts +10 -0
- package/dist/src/command-line/run-many/run-many.js +89 -0
- package/dist/src/command-line/show/command-object.d.ts +40 -0
- package/dist/src/command-line/show/command-object.js +237 -0
- package/dist/src/command-line/show/completion.d.ts +1 -0
- package/dist/src/command-line/show/completion.js +27 -0
- package/dist/src/command-line/show/project.d.ts +2 -0
- package/dist/src/command-line/show/project.js +103 -0
- package/dist/src/command-line/show/projects.d.ts +2 -0
- package/dist/src/command-line/show/projects.js +80 -0
- package/dist/src/command-line/show/show-target/index.d.ts +3 -0
- package/dist/src/command-line/show/show-target/index.js +9 -0
- package/dist/src/command-line/show/show-target/info.d.ts +28 -0
- package/dist/src/command-line/show/show-target/info.js +389 -0
- package/dist/src/command-line/show/show-target/inputs.d.ts +2 -0
- package/dist/src/command-line/show/show-target/inputs.js +83 -0
- package/dist/src/command-line/show/show-target/outputs.d.ts +2 -0
- package/dist/src/command-line/show/show-target/outputs.js +70 -0
- package/dist/src/command-line/show/show-target/utils.d.ts +54 -0
- package/dist/src/command-line/show/show-target/utils.js +265 -0
- package/dist/src/command-line/sync/command-object.d.ts +6 -0
- package/dist/src/command-line/sync/command-object.js +21 -0
- package/dist/src/command-line/sync/sync.d.ts +6 -0
- package/dist/src/command-line/sync/sync.js +120 -0
- package/dist/src/command-line/watch/command-object.d.ts +2 -0
- package/dist/src/command-line/watch/command-object.js +91 -0
- package/dist/src/command-line/watch/completion.d.ts +1 -0
- package/dist/src/command-line/watch/completion.js +10 -0
- package/dist/src/command-line/watch/watch.d.ts +31 -0
- package/dist/src/command-line/watch/watch.js +198 -0
- package/dist/src/command-line/yargs-utils/arguments-of.d.ts +11 -0
- package/dist/src/command-line/yargs-utils/arguments-of.js +9 -0
- package/dist/src/command-line/yargs-utils/documentation.d.ts +2 -0
- package/dist/src/command-line/yargs-utils/documentation.js +12 -0
- package/dist/src/command-line/yargs-utils/shared-options.d.ts +61 -0
- package/dist/src/command-line/yargs-utils/shared-options.js +395 -0
- package/dist/src/commands-runner/command-graph.d.ts +13 -0
- package/dist/src/commands-runner/command-graph.js +2 -0
- package/dist/src/commands-runner/create-command-graph.d.ts +4 -0
- package/dist/src/commands-runner/create-command-graph.js +72 -0
- package/dist/src/commands-runner/get-command-projects.d.ts +3 -0
- package/dist/src/commands-runner/get-command-projects.js +33 -0
- package/dist/src/config/calculate-default-project-name.d.ts +4 -0
- package/dist/src/config/calculate-default-project-name.js +41 -0
- package/dist/src/config/configuration.d.ts +8 -0
- package/dist/src/config/configuration.js +17 -0
- package/dist/src/config/misc-interfaces.d.ts +254 -0
- package/dist/src/config/misc-interfaces.js +2 -0
- package/dist/src/config/nx-json.d.ts +963 -0
- package/dist/src/config/nx-json.js +40 -0
- package/dist/src/config/project-graph.d.ts +137 -0
- package/dist/src/config/project-graph.js +45 -0
- package/dist/src/config/schema-utils.d.ts +37 -0
- package/dist/src/config/schema-utils.js +199 -0
- package/dist/src/config/task-graph.d.ts +6 -0
- package/dist/src/config/task-graph.js +2 -0
- package/dist/src/config/to-project-name.d.ts +5 -0
- package/dist/src/config/to-project-name.js +12 -0
- package/dist/src/config/workspace-json-project-json.d.ts +273 -0
- package/dist/src/config/workspace-json-project-json.js +2 -0
- package/dist/src/core/graph/environment.js +1 -0
- package/dist/src/core/graph/favicon.ico +0 -0
- package/dist/src/core/graph/index.html +32 -0
- package/dist/src/core/graph/main.js +1 -0
- package/dist/src/core/graph/runtime.js +1 -0
- package/dist/src/core/graph/styles.css +2 -0
- package/dist/src/core/graph/styles.js +1 -0
- package/dist/src/daemon/cache.d.ts +10 -0
- package/dist/src/daemon/cache.js +58 -0
- package/dist/src/daemon/client/client.d.ts +115 -0
- package/dist/src/daemon/client/client.js +1046 -0
- package/dist/src/daemon/client/daemon-environment.d.ts +12 -0
- package/dist/src/daemon/client/daemon-environment.js +170 -0
- package/dist/src/daemon/client/daemon-socket-messenger.d.ts +12 -0
- package/dist/src/daemon/client/daemon-socket-messenger.js +54 -0
- package/dist/src/daemon/is-nx-version-mismatch.d.ts +1 -0
- package/dist/src/daemon/is-nx-version-mismatch.js +8 -0
- package/dist/src/daemon/is-on-daemon.d.ts +1 -0
- package/dist/src/daemon/is-on-daemon.js +6 -0
- package/dist/src/daemon/is-v8-serializer-enabled.d.ts +5 -0
- package/dist/src/daemon/is-v8-serializer-enabled.js +10 -0
- package/dist/src/daemon/logger.d.ts +39 -0
- package/dist/src/daemon/logger.js +80 -0
- package/dist/src/daemon/message-types/configure-ai-agents.d.ts +20 -0
- package/dist/src/daemon/message-types/configure-ai-agents.js +19 -0
- package/dist/src/daemon/message-types/daemon-message.d.ts +6 -0
- package/dist/src/daemon/message-types/daemon-message.js +6 -0
- package/dist/src/daemon/message-types/flush-sync-generator-changes-to-disk.d.ts +6 -0
- package/dist/src/daemon/message-types/flush-sync-generator-changes-to-disk.js +11 -0
- package/dist/src/daemon/message-types/force-shutdown.d.ts +5 -0
- package/dist/src/daemon/message-types/force-shutdown.js +11 -0
- package/dist/src/daemon/message-types/get-context-file-data.d.ts +5 -0
- package/dist/src/daemon/message-types/get-context-file-data.js +11 -0
- package/dist/src/daemon/message-types/get-files-in-directory.d.ts +6 -0
- package/dist/src/daemon/message-types/get-files-in-directory.js +11 -0
- package/dist/src/daemon/message-types/get-nx-workspace-files.d.ts +6 -0
- package/dist/src/daemon/message-types/get-nx-workspace-files.js +11 -0
- package/dist/src/daemon/message-types/get-registered-sync-generators.d.ts +5 -0
- package/dist/src/daemon/message-types/get-registered-sync-generators.js +11 -0
- package/dist/src/daemon/message-types/get-sync-generator-changes.d.ts +6 -0
- package/dist/src/daemon/message-types/get-sync-generator-changes.js +11 -0
- package/dist/src/daemon/message-types/glob.d.ts +14 -0
- package/dist/src/daemon/message-types/glob.js +19 -0
- package/dist/src/daemon/message-types/hash-glob.d.ts +13 -0
- package/dist/src/daemon/message-types/hash-glob.js +19 -0
- package/dist/src/daemon/message-types/nx-console.d.ts +17 -0
- package/dist/src/daemon/message-types/nx-console.js +19 -0
- package/dist/src/daemon/message-types/register-project-graph-listener.d.ts +5 -0
- package/dist/src/daemon/message-types/register-project-graph-listener.js +11 -0
- package/dist/src/daemon/message-types/run-tasks-execution-hooks.d.ts +13 -0
- package/dist/src/daemon/message-types/run-tasks-execution-hooks.js +19 -0
- package/dist/src/daemon/message-types/streaming-messages.d.ts +14 -0
- package/dist/src/daemon/message-types/streaming-messages.js +19 -0
- package/dist/src/daemon/message-types/task-history.d.ts +19 -0
- package/dist/src/daemon/message-types/task-history.js +27 -0
- package/dist/src/daemon/message-types/update-workspace-context.d.ts +8 -0
- package/dist/src/daemon/message-types/update-workspace-context.js +11 -0
- package/dist/src/daemon/server/client-socket-context.d.ts +23 -0
- package/dist/src/daemon/server/client-socket-context.js +89 -0
- package/dist/src/daemon/server/file-watching/changed-projects.d.ts +10 -0
- package/dist/src/daemon/server/file-watching/changed-projects.js +53 -0
- package/dist/src/daemon/server/file-watching/file-change-events.d.ts +7 -0
- package/dist/src/daemon/server/file-watching/file-change-events.js +19 -0
- package/dist/src/daemon/server/file-watching/file-watcher-sockets.d.ts +12 -0
- package/dist/src/daemon/server/file-watching/file-watcher-sockets.js +66 -0
- package/dist/src/daemon/server/file-watching/route-workspace-changes.d.ts +9 -0
- package/dist/src/daemon/server/file-watching/route-workspace-changes.js +76 -0
- package/dist/src/daemon/server/handle-configure-ai-agents.d.ts +3 -0
- package/dist/src/daemon/server/handle-configure-ai-agents.js +101 -0
- package/dist/src/daemon/server/handle-context-file-data.d.ts +2 -0
- package/dist/src/daemon/server/handle-context-file-data.js +12 -0
- package/dist/src/daemon/server/handle-flush-sync-generator-changes-to-disk.d.ts +2 -0
- package/dist/src/daemon/server/handle-flush-sync-generator-changes-to-disk.js +11 -0
- package/dist/src/daemon/server/handle-force-shutdown.d.ts +5 -0
- package/dist/src/daemon/server/handle-force-shutdown.js +18 -0
- package/dist/src/daemon/server/handle-get-files-in-directory.d.ts +2 -0
- package/dist/src/daemon/server/handle-get-files-in-directory.js +12 -0
- package/dist/src/daemon/server/handle-get-registered-sync-generators.d.ts +2 -0
- package/dist/src/daemon/server/handle-get-registered-sync-generators.js +11 -0
- package/dist/src/daemon/server/handle-get-sync-generator-changes.d.ts +2 -0
- package/dist/src/daemon/server/handle-get-sync-generator-changes.js +20 -0
- package/dist/src/daemon/server/handle-glob.d.ts +3 -0
- package/dist/src/daemon/server/handle-glob.js +20 -0
- package/dist/src/daemon/server/handle-hash-glob.d.ts +3 -0
- package/dist/src/daemon/server/handle-hash-glob.js +20 -0
- package/dist/src/daemon/server/handle-hash-tasks.d.ts +12 -0
- package/dist/src/daemon/server/handle-hash-tasks.js +28 -0
- package/dist/src/daemon/server/handle-nx-console.d.ts +3 -0
- package/dist/src/daemon/server/handle-nx-console.js +54 -0
- package/dist/src/daemon/server/handle-nx-workspace-files.d.ts +2 -0
- package/dist/src/daemon/server/handle-nx-workspace-files.js +12 -0
- package/dist/src/daemon/server/handle-outputs-tracking.d.ts +15 -0
- package/dist/src/daemon/server/handle-outputs-tracking.js +35 -0
- package/dist/src/daemon/server/handle-process-in-background.d.ts +6 -0
- package/dist/src/daemon/server/handle-process-in-background.js +32 -0
- package/dist/src/daemon/server/handle-request-project-graph.d.ts +3 -0
- package/dist/src/daemon/server/handle-request-project-graph.js +36 -0
- package/dist/src/daemon/server/handle-request-shutdown.d.ts +5 -0
- package/dist/src/daemon/server/handle-request-shutdown.js +27 -0
- package/dist/src/daemon/server/handle-task-history.d.ts +13 -0
- package/dist/src/daemon/server/handle-task-history.js +30 -0
- package/dist/src/daemon/server/handle-tasks-execution-hooks.d.ts +19 -0
- package/dist/src/daemon/server/handle-tasks-execution-hooks.js +35 -0
- package/dist/src/daemon/server/handle-update-workspace-context.d.ts +2 -0
- package/dist/src/daemon/server/handle-update-workspace-context.js +11 -0
- package/dist/src/daemon/server/latest-nx.d.ts +10 -0
- package/dist/src/daemon/server/latest-nx.js +53 -0
- package/dist/src/daemon/server/nx-console-operations.d.ts +26 -0
- package/dist/src/daemon/server/nx-console-operations.js +97 -0
- package/dist/src/daemon/server/outputs-tracking.d.ts +23 -0
- package/dist/src/daemon/server/outputs-tracking.js +120 -0
- package/dist/src/daemon/server/project-graph-incremental-recomputation.d.ts +26 -0
- package/dist/src/daemon/server/project-graph-incremental-recomputation.js +507 -0
- package/dist/src/daemon/server/project-graph-listener-sockets.d.ts +7 -0
- package/dist/src/daemon/server/project-graph-listener-sockets.js +25 -0
- package/dist/src/daemon/server/server.d.ts +10 -0
- package/dist/src/daemon/server/server.js +477 -0
- package/dist/src/daemon/server/shutdown-utils.d.ts +18 -0
- package/dist/src/daemon/server/shutdown-utils.js +152 -0
- package/dist/src/daemon/server/start.d.ts +1 -0
- package/dist/src/daemon/server/start.js +20 -0
- package/dist/src/daemon/server/sync-generators.d.ts +14 -0
- package/dist/src/daemon/server/sync-generators.js +368 -0
- package/dist/src/daemon/server/watcher.d.ts +18 -0
- package/dist/src/daemon/server/watcher.js +126 -0
- package/dist/src/daemon/socket-utils.d.ts +23 -0
- package/dist/src/daemon/socket-utils.js +96 -0
- package/dist/src/daemon/tmp-dir.d.ts +12 -0
- package/dist/src/daemon/tmp-dir.js +71 -0
- package/dist/src/devkit-exports.d.ts +139 -0
- package/dist/src/devkit-exports.js +143 -0
- package/dist/src/devkit-internals.d.ts +43 -0
- package/dist/src/devkit-internals.js +101 -0
- package/dist/src/devkit-testing-exports.d.ts +2 -0
- package/dist/src/devkit-testing-exports.js +8 -0
- package/dist/src/executors/noop/noop.impl.d.ts +3 -0
- package/dist/src/executors/noop/noop.impl.js +6 -0
- package/dist/src/executors/noop/schema.json +10 -0
- package/dist/src/executors/run-commands/run-commands.impl.d.ts +59 -0
- package/dist/src/executors/run-commands/run-commands.impl.js +301 -0
- package/dist/src/executors/run-commands/running-tasks.d.ts +52 -0
- package/dist/src/executors/run-commands/running-tasks.js +586 -0
- package/dist/src/executors/run-commands/schema.json +198 -0
- package/dist/src/executors/run-script/run-script.impl.d.ts +8 -0
- package/dist/src/executors/run-script/run-script.impl.js +86 -0
- package/dist/src/executors/run-script/schema.json +28 -0
- package/dist/src/executors/utils/convert-nx-executor.d.ts +10 -0
- package/dist/src/executors/utils/convert-nx-executor.js +83 -0
- package/dist/src/generators/internal-utils/format-changed-files-with-prettier-if-available.d.ts +19 -0
- package/dist/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +81 -0
- package/dist/src/generators/testing-utils/create-tree-with-empty-workspace.d.ts +11 -0
- package/dist/src/generators/testing-utils/create-tree-with-empty-workspace.js +52 -0
- package/dist/src/generators/testing-utils/create-tree.d.ts +5 -0
- package/dist/src/generators/testing-utils/create-tree.js +14 -0
- package/dist/src/generators/tree.d.ts +125 -0
- package/dist/src/generators/tree.js +310 -0
- package/dist/src/generators/utils/generate-files.d.ts +44 -0
- package/dist/src/generators/utils/generate-files.js +114 -0
- package/dist/src/generators/utils/glob.d.ts +22 -0
- package/dist/src/generators/utils/glob.js +51 -0
- package/dist/src/generators/utils/json.d.ts +28 -0
- package/dist/src/generators/utils/json.js +48 -0
- package/dist/src/generators/utils/nx-json.d.ts +10 -0
- package/dist/src/generators/utils/nx-json.js +62 -0
- package/dist/src/generators/utils/project-configuration.d.ts +51 -0
- package/dist/src/generators/utils/project-configuration.js +299 -0
- package/dist/src/hasher/check-task-files.d.ts +86 -0
- package/dist/src/hasher/check-task-files.js +378 -0
- package/dist/src/hasher/create-task-hasher.d.ts +4 -0
- package/dist/src/hasher/create-task-hasher.js +15 -0
- package/dist/src/hasher/file-hasher.d.ts +3 -0
- package/dist/src/hasher/file-hasher.js +23 -0
- package/dist/src/hasher/hash-plan-inspector.d.ts +33 -0
- package/dist/src/hasher/hash-plan-inspector.js +70 -0
- package/dist/src/hasher/hash-task.d.ts +17 -0
- package/dist/src/hasher/hash-task.js +191 -0
- package/dist/src/hasher/native-task-hasher-impl.d.ts +18 -0
- package/dist/src/hasher/native-task-hasher-impl.js +38 -0
- package/dist/src/hasher/task-hasher.d.ts +160 -0
- package/dist/src/hasher/task-hasher.js +301 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +2 -0
- package/dist/src/migrations/update-15-0-0/prefix-outputs.d.ts +2 -0
- package/dist/src/migrations/update-15-0-0/prefix-outputs.js +54 -0
- package/dist/src/migrations/update-16-0-0/remove-nrwl-cli.d.ts +2 -0
- package/dist/src/migrations/update-16-0-0/remove-nrwl-cli.js +16 -0
- package/dist/src/migrations/update-16-0-0/update-depends-on-to-tokens.d.ts +2 -0
- package/dist/src/migrations/update-16-0-0/update-depends-on-to-tokens.js +82 -0
- package/dist/src/migrations/update-16-0-0/update-nx-cloud-runner.d.ts +2 -0
- package/dist/src/migrations/update-16-0-0/update-nx-cloud-runner.js +29 -0
- package/dist/src/migrations/update-16-2-0/remove-run-commands-output-path.d.ts +2 -0
- package/dist/src/migrations/update-16-2-0/remove-run-commands-output-path.js +50 -0
- package/dist/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.d.ts +12 -0
- package/dist/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.js +67 -0
- package/dist/src/migrations/update-17-0-0/move-cache-directory.d.ts +2 -0
- package/dist/src/migrations/update-17-0-0/move-cache-directory.js +35 -0
- package/dist/src/migrations/update-17-0-0/move-cache-directory.md +31 -0
- package/dist/src/migrations/update-17-0-0/rm-default-collection-npm-scope.d.ts +2 -0
- package/dist/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +72 -0
- package/dist/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.d.ts +2 -0
- package/dist/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +126 -0
- package/dist/src/migrations/update-17-2-0/move-default-base.d.ts +5 -0
- package/dist/src/migrations/update-17-2-0/move-default-base.js +20 -0
- package/dist/src/migrations/update-17-3-0/update-nxw.d.ts +2 -0
- package/dist/src/migrations/update-17-3-0/update-nxw.js +7 -0
- package/dist/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.d.ts +2 -0
- package/dist/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +11 -0
- package/dist/src/migrations/update-19-2-0/move-workspace-data-directory.d.ts +4 -0
- package/dist/src/migrations/update-19-2-0/move-workspace-data-directory.js +33 -0
- package/dist/src/migrations/update-19-2-4/set-project-name.d.ts +2 -0
- package/dist/src/migrations/update-19-2-4/set-project-name.js +34 -0
- package/dist/src/migrations/update-20-0-0/move-use-daemon-process.d.ts +2 -0
- package/dist/src/migrations/update-20-0-0/move-use-daemon-process.js +25 -0
- package/dist/src/migrations/update-20-0-0/move-use-daemon-process.md +27 -0
- package/dist/src/migrations/update-20-0-1/use-legacy-cache.d.ts +2 -0
- package/dist/src/migrations/update-20-0-1/use-legacy-cache.js +20 -0
- package/dist/src/migrations/update-20-0-1/use-legacy-cache.md +24 -0
- package/dist/src/migrations/update-21-0-0/release-changelog-config-changes.d.ts +2 -0
- package/dist/src/migrations/update-21-0-0/release-changelog-config-changes.js +38 -0
- package/dist/src/migrations/update-21-0-0/release-changelog-config-changes.md +49 -0
- package/dist/src/migrations/update-21-0-0/release-version-config-changes.d.ts +2 -0
- package/dist/src/migrations/update-21-0-0/release-version-config-changes.js +101 -0
- package/dist/src/migrations/update-21-0-0/release-version-config-changes.md +54 -0
- package/dist/src/migrations/update-21-0-0/remove-custom-tasks-runner.d.ts +2 -0
- package/dist/src/migrations/update-21-0-0/remove-custom-tasks-runner.js +38 -0
- package/dist/src/migrations/update-21-0-0/remove-custom-tasks-runner.md +28 -0
- package/dist/src/migrations/update-21-0-0/remove-legacy-cache.d.ts +2 -0
- package/dist/src/migrations/update-21-0-0/remove-legacy-cache.js +17 -0
- package/dist/src/migrations/update-21-0-0/remove-legacy-cache.md +22 -0
- package/dist/src/migrations/update-22-0-0/consolidate-release-tag-config.d.ts +2 -0
- package/dist/src/migrations/update-22-0-0/consolidate-release-tag-config.js +100 -0
- package/dist/src/migrations/update-22-0-0/release-version-config-changes.d.ts +2 -0
- package/dist/src/migrations/update-22-0-0/release-version-config-changes.js +101 -0
- package/dist/src/migrations/update-22-1-0/update-nx-wrapper.d.ts +2 -0
- package/dist/src/migrations/update-22-1-0/update-nx-wrapper.js +7 -0
- package/dist/src/migrations/update-22-2-0/add-self-healing-to-gitignore.d.ts +2 -0
- package/dist/src/migrations/update-22-2-0/add-self-healing-to-gitignore.js +19 -0
- package/dist/src/migrations/update-22-2-0/add-self-healing-to-gitignore.md +11 -0
- package/dist/src/migrations/update-22-6-0/add-claude-settings-local-to-git-ignore.d.ts +2 -0
- package/dist/src/migrations/update-22-6-0/add-claude-settings-local-to-git-ignore.js +16 -0
- package/dist/src/migrations/update-22-6-0/add-claude-worktrees-to-git-ignore.d.ts +2 -0
- package/dist/src/migrations/update-22-6-0/add-claude-worktrees-to-git-ignore.js +16 -0
- package/dist/src/migrations/update-22-6-0/enable-analytics-prompt.d.ts +2 -0
- package/dist/src/migrations/update-22-6-0/enable-analytics-prompt.js +23 -0
- package/dist/src/migrations/update-22-7-0/add-polygraph-to-git-ignore.d.ts +2 -0
- package/dist/src/migrations/update-22-7-0/add-polygraph-to-git-ignore.js +16 -0
- package/dist/src/migrations/update-23-0-0/add-migrate-runs-to-git-ignore.d.ts +2 -0
- package/dist/src/migrations/update-23-0-0/add-migrate-runs-to-git-ignore.js +16 -0
- package/dist/src/migrations/update-23-0-0/consolidate-release-tag-config.d.ts +9 -0
- package/dist/src/migrations/update-23-0-0/consolidate-release-tag-config.js +18 -0
- package/dist/src/migrations/utils/target-defaults.d.ts +28 -0
- package/dist/src/migrations/utils/target-defaults.js +46 -0
- package/dist/src/native/assert-supported-platform.d.ts +1 -0
- package/dist/src/native/assert-supported-platform.js +39 -0
- package/dist/src/native/browser.js +1 -0
- package/dist/src/native/index.d.ts +844 -0
- package/dist/src/native/index.js +173 -0
- package/dist/src/native/native-bindings.js +641 -0
- package/dist/src/native/native-file-cache-location.d.ts +1 -0
- package/dist/src/native/native-file-cache-location.js +23 -0
- package/dist/src/native/nx.openharmony-arm64.node +0 -0
- package/dist/src/native/nx.wasi-browser.js +131 -0
- package/dist/src/native/nx.wasi.cjs +161 -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/native/transform-objects.d.ts +3 -0
- package/dist/src/native/transform-objects.js +51 -0
- package/dist/src/native/wasi-worker-browser.mjs +30 -0
- package/dist/src/native/wasi-worker.mjs +63 -0
- package/dist/src/nx-cloud/debug-logger.d.ts +1 -0
- package/dist/src/nx-cloud/debug-logger.js +8 -0
- package/dist/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.d.ts +14 -0
- package/dist/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +159 -0
- package/dist/src/nx-cloud/generators/connect-to-nx-cloud/schema.json +41 -0
- package/dist/src/nx-cloud/models/onboarding-status.d.ts +1 -0
- package/dist/src/nx-cloud/models/onboarding-status.js +2 -0
- package/dist/src/nx-cloud/nx-cloud-tasks-runner-shell.d.ts +16 -0
- package/dist/src/nx-cloud/nx-cloud-tasks-runner-shell.js +41 -0
- package/dist/src/nx-cloud/resolution-helpers.d.ts +1 -0
- package/dist/src/nx-cloud/resolution-helpers.js +19 -0
- package/dist/src/nx-cloud/update-manager.d.ts +23 -0
- package/dist/src/nx-cloud/update-manager.js +267 -0
- package/dist/src/nx-cloud/utilities/axios.d.ts +4 -0
- package/dist/src/nx-cloud/utilities/axios.js +17 -0
- package/dist/src/nx-cloud/utilities/client.d.ts +10 -0
- package/dist/src/nx-cloud/utilities/client.js +42 -0
- package/dist/src/nx-cloud/utilities/environment.d.ts +3 -0
- package/dist/src/nx-cloud/utilities/environment.js +48 -0
- package/dist/src/nx-cloud/utilities/get-cloud-options.d.ts +5 -0
- package/dist/src/nx-cloud/utilities/get-cloud-options.js +23 -0
- package/dist/src/nx-cloud/utilities/is-workspace-claimed.d.ts +1 -0
- package/dist/src/nx-cloud/utilities/is-workspace-claimed.js +25 -0
- package/dist/src/nx-cloud/utilities/onboarding.d.ts +5 -0
- package/dist/src/nx-cloud/utilities/onboarding.js +28 -0
- package/dist/src/nx-cloud/utilities/url-shorten.d.ts +5 -0
- package/dist/src/nx-cloud/utilities/url-shorten.js +84 -0
- package/dist/src/plugins/js/hasher/hasher.d.ts +5 -0
- package/dist/src/plugins/js/hasher/hasher.js +51 -0
- package/dist/src/plugins/js/index.d.ts +4 -0
- package/dist/src/plugins/js/index.js +201 -0
- package/dist/src/plugins/js/lock-file/bun-parser.d.ts +14 -0
- package/dist/src/plugins/js/lock-file/bun-parser.js +959 -0
- package/dist/src/plugins/js/lock-file/lock-file.d.ts +43 -0
- package/dist/src/plugins/js/lock-file/lock-file.js +265 -0
- package/dist/src/plugins/js/lock-file/npm-parser.d.ts +10 -0
- package/dist/src/plugins/js/lock-file/npm-parser.js +588 -0
- package/dist/src/plugins/js/lock-file/pnpm-parser.d.ts +10 -0
- package/dist/src/plugins/js/lock-file/pnpm-parser.js +693 -0
- package/dist/src/plugins/js/lock-file/project-graph-pruning.d.ts +11 -0
- package/dist/src/plugins/js/lock-file/project-graph-pruning.js +210 -0
- package/dist/src/plugins/js/lock-file/utils/package-json.d.ts +10 -0
- package/dist/src/plugins/js/lock-file/utils/package-json.js +38 -0
- package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.d.ts +20 -0
- package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.js +874 -0
- package/dist/src/plugins/js/lock-file/yarn-parser.d.ts +10 -0
- package/dist/src/plugins/js/lock-file/yarn-parser.js +536 -0
- package/dist/src/plugins/js/package-json/create-package-json.d.ts +29 -0
- package/dist/src/plugins/js/package-json/create-package-json.js +312 -0
- package/dist/src/plugins/js/project-graph/affected/lock-file-changes.d.ts +3 -0
- package/dist/src/plugins/js/project-graph/affected/lock-file-changes.js +150 -0
- package/dist/src/plugins/js/project-graph/affected/npm-packages.d.ts +4 -0
- package/dist/src/plugins/js/project-graph/affected/npm-packages.js +93 -0
- package/dist/src/plugins/js/project-graph/affected/touched-projects.d.ts +2 -0
- package/dist/src/plugins/js/project-graph/affected/touched-projects.js +18 -0
- package/dist/src/plugins/js/project-graph/affected/tsconfig-json-changes.d.ts +4 -0
- package/dist/src/plugins/js/project-graph/affected/tsconfig-json-changes.js +63 -0
- package/dist/src/plugins/js/project-graph/build-dependencies/build-dependencies.d.ts +6 -0
- package/dist/src/plugins/js/project-graph/build-dependencies/build-dependencies.js +45 -0
- package/dist/src/plugins/js/project-graph/build-dependencies/explicit-package-json-dependencies.d.ts +4 -0
- package/dist/src/plugins/js/project-graph/build-dependencies/explicit-package-json-dependencies.js +88 -0
- package/dist/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.d.ts +4 -0
- package/dist/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.js +75 -0
- package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.d.ts +81 -0
- package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +462 -0
- package/dist/src/plugins/js/project-graph/build-nodes/build-npm-package-nodes.d.ts +2 -0
- package/dist/src/plugins/js/project-graph/build-nodes/build-npm-package-nodes.js +31 -0
- package/dist/src/plugins/js/utils/config.d.ts +2 -0
- package/dist/src/plugins/js/utils/config.js +61 -0
- package/dist/src/plugins/js/utils/get-workspace-packages-from-graph.d.ts +2 -0
- package/dist/src/plugins/js/utils/get-workspace-packages-from-graph.js +13 -0
- package/dist/src/plugins/js/utils/packages.d.ts +8 -0
- package/dist/src/plugins/js/utils/packages.js +91 -0
- package/dist/src/plugins/js/utils/register.d.ts +339 -0
- package/dist/src/plugins/js/utils/register.js +1236 -0
- package/dist/src/plugins/js/utils/resolve-relative-to-dir.d.ts +5 -0
- package/dist/src/plugins/js/utils/resolve-relative-to-dir.js +17 -0
- package/dist/src/plugins/js/utils/typescript.d.ts +32 -0
- package/dist/src/plugins/js/utils/typescript.js +157 -0
- package/dist/src/plugins/js/versions.d.ts +1 -0
- package/dist/src/plugins/js/versions.js +4 -0
- package/dist/src/plugins/package-json/create-nodes.d.ts +28 -0
- package/dist/src/plugins/package-json/create-nodes.js +243 -0
- package/dist/src/plugins/package-json/index.d.ts +2 -0
- package/dist/src/plugins/package-json/index.js +6 -0
- package/dist/src/plugins/project-json/build-nodes/project-json.d.ts +5 -0
- package/dist/src/plugins/project-json/build-nodes/project-json.js +33 -0
- package/dist/src/project-graph/affected/affected-project-graph-models.d.ts +11 -0
- package/dist/src/project-graph/affected/affected-project-graph-models.js +2 -0
- package/dist/src/project-graph/affected/affected-project-graph.d.ts +4 -0
- package/dist/src/project-graph/affected/affected-project-graph.js +90 -0
- package/dist/src/project-graph/affected/locators/project-glob-changes.d.ts +2 -0
- package/dist/src/project-graph/affected/locators/project-glob-changes.js +44 -0
- package/dist/src/project-graph/affected/locators/workspace-json-changes.d.ts +4 -0
- package/dist/src/project-graph/affected/locators/workspace-json-changes.js +47 -0
- package/dist/src/project-graph/affected/locators/workspace-projects.d.ts +3 -0
- package/dist/src/project-graph/affected/locators/workspace-projects.js +74 -0
- package/dist/src/project-graph/build-project-graph.d.ts +26 -0
- package/dist/src/project-graph/build-project-graph.js +309 -0
- package/dist/src/project-graph/error-types.d.ts +140 -0
- package/dist/src/project-graph/error-types.js +459 -0
- package/dist/src/project-graph/file-map-utils.d.ts +18 -0
- package/dist/src/project-graph/file-map-utils.js +61 -0
- package/dist/src/project-graph/file-utils.d.ts +31 -0
- package/dist/src/project-graph/file-utils.js +187 -0
- package/dist/src/project-graph/nx-deps-cache.d.ts +62 -0
- package/dist/src/project-graph/nx-deps-cache.js +345 -0
- package/dist/src/project-graph/operators.d.ts +11 -0
- package/dist/src/project-graph/operators.js +70 -0
- package/dist/src/project-graph/plugins/get-plugins.d.ts +25 -0
- package/dist/src/project-graph/plugins/get-plugins.js +296 -0
- package/dist/src/project-graph/plugins/in-process-loader.d.ts +10 -0
- package/dist/src/project-graph/plugins/in-process-loader.js +61 -0
- package/dist/src/project-graph/plugins/index.d.ts +4 -0
- package/dist/src/project-graph/plugins/index.js +12 -0
- package/dist/src/project-graph/plugins/isolation/enabled.d.ts +1 -0
- package/dist/src/project-graph/plugins/isolation/enabled.js +22 -0
- package/dist/src/project-graph/plugins/isolation/index.d.ts +1 -0
- package/dist/src/project-graph/plugins/isolation/index.js +5 -0
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.d.ts +62 -0
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +478 -0
- package/dist/src/project-graph/plugins/isolation/load-isolated-plugin.d.ts +3 -0
- package/dist/src/project-graph/plugins/isolation/load-isolated-plugin.js +24 -0
- package/dist/src/project-graph/plugins/isolation/message-types.d.ts +59 -0
- package/dist/src/project-graph/plugins/isolation/message-types.js +9 -0
- package/dist/src/project-graph/plugins/isolation/messaging.d.ts +142 -0
- package/dist/src/project-graph/plugins/isolation/messaging.js +86 -0
- package/dist/src/project-graph/plugins/isolation/plugin-lifecycle-manager.d.ts +82 -0
- package/dist/src/project-graph/plugins/isolation/plugin-lifecycle-manager.js +188 -0
- package/dist/src/project-graph/plugins/isolation/plugin-worker.d.ts +2 -0
- package/dist/src/project-graph/plugins/isolation/plugin-worker.js +150 -0
- package/dist/src/project-graph/plugins/isolation/worker-streaming.d.ts +14 -0
- package/dist/src/project-graph/plugins/isolation/worker-streaming.js +39 -0
- package/dist/src/project-graph/plugins/load-resolved-plugin.d.ts +3 -0
- package/dist/src/project-graph/plugins/load-resolved-plugin.js +24 -0
- package/dist/src/project-graph/plugins/loaded-nx-plugin.d.ts +41 -0
- package/dist/src/project-graph/plugins/loaded-nx-plugin.js +104 -0
- package/dist/src/project-graph/plugins/public-api.d.ts +139 -0
- package/dist/src/project-graph/plugins/public-api.js +4 -0
- package/dist/src/project-graph/plugins/resolve-plugin.d.ts +25 -0
- package/dist/src/project-graph/plugins/resolve-plugin.js +277 -0
- package/dist/src/project-graph/plugins/tasks-execution-hooks.d.ts +3 -0
- package/dist/src/project-graph/plugins/tasks-execution-hooks.js +67 -0
- package/dist/src/project-graph/plugins/transpiler.d.ts +20 -0
- package/dist/src/project-graph/plugins/transpiler.js +99 -0
- package/dist/src/project-graph/plugins/utils.d.ts +4 -0
- package/dist/src/project-graph/plugins/utils.js +32 -0
- package/dist/src/project-graph/project-graph-builder.d.ts +133 -0
- package/dist/src/project-graph/project-graph-builder.js +395 -0
- package/dist/src/project-graph/project-graph.d.ts +54 -0
- package/dist/src/project-graph/project-graph.js +415 -0
- package/dist/src/project-graph/utils/build-all-workspace-files.d.ts +2 -0
- package/dist/src/project-graph/utils/build-all-workspace-files.js +14 -0
- package/dist/src/project-graph/utils/find-project-for-path.d.ts +20 -0
- package/dist/src/project-graph/utils/find-project-for-path.js +55 -0
- package/dist/src/project-graph/utils/implicit-project-dependencies.d.ts +3 -0
- package/dist/src/project-graph/utils/implicit-project-dependencies.js +18 -0
- package/dist/src/project-graph/utils/normalize-project-nodes.d.ts +6 -0
- package/dist/src/project-graph/utils/normalize-project-nodes.js +117 -0
- package/dist/src/project-graph/utils/project-configuration/name-substitution-manager.d.ts +48 -0
- package/dist/src/project-graph/utils/project-configuration/name-substitution-manager.js +270 -0
- package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.d.ts +42 -0
- package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.js +284 -0
- package/dist/src/project-graph/utils/project-configuration/source-maps.d.ts +34 -0
- package/dist/src/project-graph/utils/project-configuration/source-maps.js +85 -0
- package/dist/src/project-graph/utils/project-configuration/target-defaults.d.ts +50 -0
- package/dist/src/project-graph/utils/project-configuration/target-defaults.js +440 -0
- package/dist/src/project-graph/utils/project-configuration/target-merging.d.ts +32 -0
- package/dist/src/project-graph/utils/project-configuration/target-merging.js +507 -0
- package/dist/src/project-graph/utils/project-configuration/target-normalization.d.ts +12 -0
- package/dist/src/project-graph/utils/project-configuration/target-normalization.js +183 -0
- package/dist/src/project-graph/utils/project-configuration/utils.d.ts +38 -0
- package/dist/src/project-graph/utils/project-configuration/utils.js +215 -0
- package/dist/src/project-graph/utils/project-configuration-utils.d.ts +86 -0
- package/dist/src/project-graph/utils/project-configuration-utils.js +325 -0
- package/dist/src/project-graph/utils/retrieve-workspace-files.d.ts +35 -0
- package/dist/src/project-graph/utils/retrieve-workspace-files.js +110 -0
- package/dist/src/tasks-runner/batch/batch-messages.d.ts +35 -0
- package/dist/src/tasks-runner/batch/batch-messages.js +9 -0
- package/dist/src/tasks-runner/batch/run-batch.d.ts +1 -0
- package/dist/src/tasks-runner/batch/run-batch.js +78 -0
- package/dist/src/tasks-runner/cache.d.ts +94 -0
- package/dist/src/tasks-runner/cache.js +604 -0
- package/dist/src/tasks-runner/create-task-graph.d.ts +41 -0
- package/dist/src/tasks-runner/create-task-graph.js +305 -0
- package/dist/src/tasks-runner/default-tasks-runner.d.ts +25 -0
- package/dist/src/tasks-runner/default-tasks-runner.js +74 -0
- package/dist/src/tasks-runner/fork.d.ts +1 -0
- package/dist/src/tasks-runner/fork.js +73 -0
- package/dist/src/tasks-runner/forked-process-task-runner.d.ts +42 -0
- package/dist/src/tasks-runner/forked-process-task-runner.js +299 -0
- package/dist/src/tasks-runner/init-tasks-runner.d.ts +7 -0
- package/dist/src/tasks-runner/init-tasks-runner.js +86 -0
- package/dist/src/tasks-runner/is-tui-enabled.d.ts +18 -0
- package/dist/src/tasks-runner/is-tui-enabled.js +91 -0
- package/dist/src/tasks-runner/legacy-depends-on-warning.d.ts +18 -0
- package/dist/src/tasks-runner/legacy-depends-on-warning.js +109 -0
- package/dist/src/tasks-runner/life-cycle.d.ts +86 -0
- package/dist/src/tasks-runner/life-cycle.js +148 -0
- package/dist/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.d.ts +25 -0
- package/dist/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +366 -0
- package/dist/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.d.ts +24 -0
- package/dist/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.js +238 -0
- package/dist/src/tasks-runner/life-cycles/empty-terminal-output-life-cycle.d.ts +5 -0
- package/dist/src/tasks-runner/life-cycles/empty-terminal-output-life-cycle.js +16 -0
- package/dist/src/tasks-runner/life-cycles/formatting-utils.d.ts +3 -0
- package/dist/src/tasks-runner/life-cycles/formatting-utils.js +55 -0
- package/dist/src/tasks-runner/life-cycles/invoke-runner-terminal-output-life-cycle.d.ts +13 -0
- package/dist/src/tasks-runner/life-cycles/invoke-runner-terminal-output-life-cycle.js +67 -0
- package/dist/src/tasks-runner/life-cycles/performance-analysis.d.ts +173 -0
- package/dist/src/tasks-runner/life-cycles/performance-analysis.js +508 -0
- package/dist/src/tasks-runner/life-cycles/performance-life-cycle.d.ts +59 -0
- package/dist/src/tasks-runner/life-cycles/performance-life-cycle.js +193 -0
- package/dist/src/tasks-runner/life-cycles/performance-report.d.ts +65 -0
- package/dist/src/tasks-runner/life-cycles/performance-report.js +369 -0
- package/dist/src/tasks-runner/life-cycles/pretty-time.d.ts +4 -0
- package/dist/src/tasks-runner/life-cycles/pretty-time.js +73 -0
- package/dist/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.d.ts +29 -0
- package/dist/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +109 -0
- package/dist/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.d.ts +28 -0
- package/dist/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.js +97 -0
- package/dist/src/tasks-runner/life-cycles/store-run-information-life-cycle.d.ts +17 -0
- package/dist/src/tasks-runner/life-cycles/store-run-information-life-cycle.js +87 -0
- package/dist/src/tasks-runner/life-cycles/task-history-life-cycle-old.d.ts +11 -0
- package/dist/src/tasks-runner/life-cycles/task-history-life-cycle-old.js +91 -0
- package/dist/src/tasks-runner/life-cycles/task-history-life-cycle.d.ts +16 -0
- package/dist/src/tasks-runner/life-cycles/task-history-life-cycle.js +112 -0
- package/dist/src/tasks-runner/life-cycles/task-profiling-life-cycle.d.ts +14 -0
- package/dist/src/tasks-runner/life-cycles/task-profiling-life-cycle.js +73 -0
- package/dist/src/tasks-runner/life-cycles/task-results-life-cycle.d.ts +6 -0
- package/dist/src/tasks-runner/life-cycles/task-results-life-cycle.js +17 -0
- package/dist/src/tasks-runner/life-cycles/task-telemetry-life-cycle.d.ts +9 -0
- package/dist/src/tasks-runner/life-cycles/task-telemetry-life-cycle.js +42 -0
- package/dist/src/tasks-runner/life-cycles/task-timings-life-cycle.d.ts +8 -0
- package/dist/src/tasks-runner/life-cycles/task-timings-life-cycle.js +39 -0
- package/dist/src/tasks-runner/life-cycles/tui-summary-life-cycle.d.ts +19 -0
- package/dist/src/tasks-runner/life-cycles/tui-summary-life-cycle.js +339 -0
- package/dist/src/tasks-runner/life-cycles/view-logs-utils.d.ts +1 -0
- package/dist/src/tasks-runner/life-cycles/view-logs-utils.js +15 -0
- package/dist/src/tasks-runner/process-metrics-service.d.ts +53 -0
- package/dist/src/tasks-runner/process-metrics-service.js +161 -0
- package/dist/src/tasks-runner/pseudo-ipc.d.ts +48 -0
- package/dist/src/tasks-runner/pseudo-ipc.js +156 -0
- package/dist/src/tasks-runner/pseudo-terminal.d.ts +58 -0
- package/dist/src/tasks-runner/pseudo-terminal.js +197 -0
- package/dist/src/tasks-runner/remove-old-cache-records.d.ts +1 -0
- package/dist/src/tasks-runner/remove-old-cache-records.js +60 -0
- package/dist/src/tasks-runner/run-command.d.ts +42 -0
- package/dist/src/tasks-runner/run-command.js +902 -0
- package/dist/src/tasks-runner/running-tasks/batch-process.d.ts +19 -0
- package/dist/src/tasks-runner/running-tasks/batch-process.js +110 -0
- package/dist/src/tasks-runner/running-tasks/node-child-process.d.ts +40 -0
- package/dist/src/tasks-runner/running-tasks/node-child-process.js +175 -0
- package/dist/src/tasks-runner/running-tasks/noop-child-process.d.ts +16 -0
- package/dist/src/tasks-runner/running-tasks/noop-child-process.js +22 -0
- package/dist/src/tasks-runner/running-tasks/output-prefix.d.ts +13 -0
- package/dist/src/tasks-runner/running-tasks/output-prefix.js +63 -0
- package/dist/src/tasks-runner/running-tasks/running-task.d.ts +11 -0
- package/dist/src/tasks-runner/running-tasks/running-task.js +6 -0
- package/dist/src/tasks-runner/running-tasks/shared-running-task.d.ts +14 -0
- package/dist/src/tasks-runner/running-tasks/shared-running-task.js +30 -0
- package/dist/src/tasks-runner/task-env-paths.d.ts +1 -0
- package/dist/src/tasks-runner/task-env-paths.js +45 -0
- package/dist/src/tasks-runner/task-env.d.ts +31 -0
- package/dist/src/tasks-runner/task-env.js +195 -0
- package/dist/src/tasks-runner/task-graph-utils.d.ts +30 -0
- package/dist/src/tasks-runner/task-graph-utils.js +225 -0
- package/dist/src/tasks-runner/task-io-service.d.ts +96 -0
- package/dist/src/tasks-runner/task-io-service.js +122 -0
- package/dist/src/tasks-runner/task-orchestrator.d.ts +192 -0
- package/dist/src/tasks-runner/task-orchestrator.js +1370 -0
- package/dist/src/tasks-runner/tasks-runner.d.ts +24 -0
- package/dist/src/tasks-runner/tasks-runner.js +2 -0
- package/dist/src/tasks-runner/tasks-schedule.d.ts +48 -0
- package/dist/src/tasks-runner/tasks-schedule.js +258 -0
- package/dist/src/tasks-runner/utils.d.ts +61 -0
- package/dist/src/tasks-runner/utils.js +451 -0
- package/dist/src/utils/ab-testing.d.ts +59 -0
- package/dist/src/utils/ab-testing.js +142 -0
- package/dist/src/utils/acknowledge-build-scripts.d.ts +13 -0
- package/dist/src/utils/acknowledge-build-scripts.js +102 -0
- package/dist/src/utils/all-file-data.d.ts +2 -0
- package/dist/src/utils/all-file-data.js +8 -0
- package/dist/src/utils/analytics-prompt.d.ts +9 -0
- package/dist/src/utils/analytics-prompt.js +84 -0
- package/dist/src/utils/assert-workspace-validity.d.ts +3 -0
- package/dist/src/utils/assert-workspace-validity.js +85 -0
- package/dist/src/utils/async-iterator.d.ts +2 -0
- package/dist/src/utils/async-iterator.js +18 -0
- package/dist/src/utils/binary-extensions.d.ts +1 -0
- package/dist/src/utils/binary-extensions.js +279 -0
- package/dist/src/utils/cache-directory.d.ts +9 -0
- package/dist/src/utils/cache-directory.js +86 -0
- package/dist/src/utils/call-sites.d.ts +14 -0
- package/dist/src/utils/call-sites.js +28 -0
- package/dist/src/utils/catalog/index.d.ts +22 -0
- package/dist/src/utils/catalog/index.js +87 -0
- package/dist/src/utils/catalog/manager-factory.d.ts +5 -0
- package/dist/src/utils/catalog/manager-factory.js +20 -0
- package/dist/src/utils/catalog/manager-utils.d.ts +8 -0
- package/dist/src/utils/catalog/manager-utils.js +232 -0
- package/dist/src/utils/catalog/manager.d.ts +40 -0
- package/dist/src/utils/catalog/manager.js +13 -0
- package/dist/src/utils/catalog/pnpm-manager.d.ts +22 -0
- package/dist/src/utils/catalog/pnpm-manager.js +139 -0
- package/dist/src/utils/catalog/types.d.ts +11 -0
- package/dist/src/utils/catalog/types.js +2 -0
- package/dist/src/utils/catalog/yarn-manager.d.ts +22 -0
- package/dist/src/utils/catalog/yarn-manager.js +139 -0
- package/dist/src/utils/child-process.d.ts +22 -0
- package/dist/src/utils/child-process.js +91 -0
- package/dist/src/utils/chunkify.d.ts +11 -0
- package/dist/src/utils/chunkify.js +44 -0
- package/dist/src/utils/code-frames.d.ts +14 -0
- package/dist/src/utils/code-frames.js +116 -0
- package/dist/src/utils/collapse-expanded-outputs.d.ts +10 -0
- package/dist/src/utils/collapse-expanded-outputs.js +72 -0
- package/dist/src/utils/command-line-utils.d.ts +57 -0
- package/dist/src/utils/command-line-utils.js +259 -0
- package/dist/src/utils/compile-cache.d.ts +24 -0
- package/dist/src/utils/compile-cache.js +49 -0
- package/dist/src/utils/consume-messages-from-socket.d.ts +9 -0
- package/dist/src/utils/consume-messages-from-socket.js +56 -0
- package/dist/src/utils/db-connection.d.ts +14 -0
- package/dist/src/utils/db-connection.js +64 -0
- package/dist/src/utils/default-base.d.ts +1 -0
- package/dist/src/utils/default-base.js +17 -0
- package/dist/src/utils/delayed-spinner.d.ts +51 -0
- package/dist/src/utils/delayed-spinner.js +88 -0
- package/dist/src/utils/dotenv.d.ts +7 -0
- package/dist/src/utils/dotenv.js +19 -0
- package/dist/src/utils/enable-compile-cache.d.ts +1 -0
- package/dist/src/utils/enable-compile-cache.js +7 -0
- package/dist/src/utils/exit-codes.d.ts +15 -0
- package/dist/src/utils/exit-codes.js +75 -0
- package/dist/src/utils/fileutils.d.ts +67 -0
- package/dist/src/utils/fileutils.js +112 -0
- package/dist/src/utils/find-matching-projects.d.ts +18 -0
- package/dist/src/utils/find-matching-projects.js +222 -0
- package/dist/src/utils/find-workspace-root.d.ts +11 -0
- package/dist/src/utils/find-workspace-root.js +33 -0
- package/dist/src/utils/get-package-name-from-import-path.d.ts +1 -0
- package/dist/src/utils/get-package-name-from-import-path.js +17 -0
- package/dist/src/utils/git-revision.d.ts +12 -0
- package/dist/src/utils/git-revision.js +25 -0
- package/dist/src/utils/git-utils.d.ts +70 -0
- package/dist/src/utils/git-utils.index-filter.d.ts +1 -0
- package/dist/src/utils/git-utils.index-filter.js +23 -0
- package/dist/src/utils/git-utils.js +530 -0
- package/dist/src/utils/git-utils.tree-filter.d.ts +1 -0
- package/dist/src/utils/git-utils.tree-filter.js +47 -0
- package/dist/src/utils/globs.d.ts +3 -0
- package/dist/src/utils/globs.js +18 -0
- package/dist/src/utils/handle-errors.d.ts +1 -0
- package/dist/src/utils/handle-errors.js +91 -0
- package/dist/src/utils/handle-import.d.ts +15 -0
- package/dist/src/utils/handle-import.js +86 -0
- package/dist/src/utils/has-nx-js-plugin.d.ts +9 -0
- package/dist/src/utils/has-nx-js-plugin.js +24 -0
- package/dist/src/utils/ignore.d.ts +9 -0
- package/dist/src/utils/ignore.js +42 -0
- package/dist/src/utils/installation-directory.d.ts +2 -0
- package/dist/src/utils/installation-directory.js +12 -0
- package/dist/src/utils/installed-nx-version.d.ts +23 -0
- package/dist/src/utils/installed-nx-version.js +113 -0
- package/dist/src/utils/is-ci.d.ts +1 -0
- package/dist/src/utils/is-ci.js +26 -0
- package/dist/src/utils/is-sandbox.d.ts +1 -0
- package/dist/src/utils/is-sandbox.js +11 -0
- package/dist/src/utils/is-using-prettier.d.ts +3 -0
- package/dist/src/utils/is-using-prettier.js +62 -0
- package/dist/src/utils/json-diff.d.ts +18 -0
- package/dist/src/utils/json-diff.js +112 -0
- package/dist/src/utils/json.d.ts +44 -0
- package/dist/src/utils/json.js +62 -0
- package/dist/src/utils/legacy-task-history.d.ts +8 -0
- package/dist/src/utils/legacy-task-history.js +87 -0
- package/dist/src/utils/logger.d.ts +23 -0
- package/dist/src/utils/logger.js +74 -0
- package/dist/src/utils/machine-id-cache.d.ts +5 -0
- package/dist/src/utils/machine-id-cache.js +93 -0
- package/dist/src/utils/min-release-age/behavior/bun.d.ts +30 -0
- package/dist/src/utils/min-release-age/behavior/bun.js +278 -0
- package/dist/src/utils/min-release-age/behavior/npm.d.ts +21 -0
- package/dist/src/utils/min-release-age/behavior/npm.js +293 -0
- package/dist/src/utils/min-release-age/behavior/pnpm.d.ts +23 -0
- package/dist/src/utils/min-release-age/behavior/pnpm.js +527 -0
- package/dist/src/utils/min-release-age/behavior/yarn.d.ts +22 -0
- package/dist/src/utils/min-release-age/behavior/yarn.js +314 -0
- package/dist/src/utils/min-release-age/constants.d.ts +3 -0
- package/dist/src/utils/min-release-age/constants.js +8 -0
- package/dist/src/utils/min-release-age/errors.d.ts +28 -0
- package/dist/src/utils/min-release-age/errors.js +22 -0
- package/dist/src/utils/min-release-age/npmrc.d.ts +15 -0
- package/dist/src/utils/min-release-age/npmrc.js +45 -0
- package/dist/src/utils/min-release-age/packument.d.ts +13 -0
- package/dist/src/utils/min-release-age/packument.js +34 -0
- package/dist/src/utils/min-release-age/pick.d.ts +72 -0
- package/dist/src/utils/min-release-age/pick.js +206 -0
- package/dist/src/utils/min-release-age/pnpm-exclude-writer.d.ts +12 -0
- package/dist/src/utils/min-release-age/pnpm-exclude-writer.js +58 -0
- package/dist/src/utils/min-release-age/policy.d.ts +38 -0
- package/dist/src/utils/min-release-age/policy.js +59 -0
- package/dist/src/utils/min-release-age/resolve.d.ts +8 -0
- package/dist/src/utils/min-release-age/resolve.js +14 -0
- package/dist/src/utils/nx-cloud-utils.d.ts +4 -0
- package/dist/src/utils/nx-cloud-utils.js +28 -0
- package/dist/src/utils/nx-console-prompt.d.ts +1 -0
- package/dist/src/utils/nx-console-prompt.js +64 -0
- package/dist/src/utils/nx-key.d.ts +6 -0
- package/dist/src/utils/nx-key.js +50 -0
- package/dist/src/utils/nx-package-group.d.ts +8 -0
- package/dist/src/utils/nx-package-group.js +15 -0
- package/dist/src/utils/object-sort.d.ts +1 -0
- package/dist/src/utils/object-sort.js +9 -0
- package/dist/src/utils/output.d.ts +79 -0
- package/dist/src/utils/output.js +264 -0
- package/dist/src/utils/package-json.d.ts +229 -0
- package/dist/src/utils/package-json.js +387 -0
- package/dist/src/utils/package-manager.d.ts +142 -0
- package/dist/src/utils/package-manager.js +643 -0
- package/dist/src/utils/params.d.ts +140 -0
- package/dist/src/utils/params.js +710 -0
- package/dist/src/utils/path.d.ts +19 -0
- package/dist/src/utils/path.js +38 -0
- package/dist/src/utils/perf-hooks.d.ts +19 -0
- package/dist/src/utils/perf-logging.d.ts +1 -0
- package/dist/src/utils/perf-logging.js +46 -0
- package/dist/src/utils/plugin-cache-utils.d.ts +82 -0
- package/dist/src/utils/plugin-cache-utils.js +212 -0
- package/dist/src/utils/plugin-progress-text.d.ts +1 -0
- package/dist/src/utils/plugin-progress-text.js +15 -0
- package/dist/src/utils/plugins/atomizer-utils.d.ts +11 -0
- package/dist/src/utils/plugins/atomizer-utils.js +23 -0
- package/dist/src/utils/plugins/core-plugins.d.ts +6 -0
- package/dist/src/utils/plugins/core-plugins.js +113 -0
- package/dist/src/utils/plugins/index.d.ts +5 -0
- package/dist/src/utils/plugins/index.js +15 -0
- package/dist/src/utils/plugins/installed-plugins.d.ts +5 -0
- package/dist/src/utils/plugins/installed-plugins.js +76 -0
- package/dist/src/utils/plugins/local-plugins.d.ts +22 -0
- package/dist/src/utils/plugins/local-plugins.js +60 -0
- package/dist/src/utils/plugins/output.d.ts +34 -0
- package/dist/src/utils/plugins/output.js +201 -0
- package/dist/src/utils/plugins/plugin-capabilities.d.ts +15 -0
- package/dist/src/utils/plugins/plugin-capabilities.js +78 -0
- package/dist/src/utils/pnpm-workspace.d.ts +8 -0
- package/dist/src/utils/pnpm-workspace.js +2 -0
- package/dist/src/utils/print-help.d.ts +11 -0
- package/dist/src/utils/print-help.js +259 -0
- package/dist/src/utils/progress-topics.d.ts +19 -0
- package/dist/src/utils/progress-topics.js +21 -0
- package/dist/src/utils/project-graph-utils.d.ts +18 -0
- package/dist/src/utils/project-graph-utils.js +78 -0
- package/dist/src/utils/promised-based-queue.d.ts +6 -0
- package/dist/src/utils/promised-based-queue.js +43 -0
- package/dist/src/utils/provenance.d.ts +47 -0
- package/dist/src/utils/provenance.js +115 -0
- package/dist/src/utils/require-nx-key.d.ts +1 -0
- package/dist/src/utils/require-nx-key.js +23 -0
- package/dist/src/utils/serializable-error.d.ts +4 -0
- package/dist/src/utils/serializable-error.js +33 -0
- package/dist/src/utils/serialize-overrides-into-command-line.d.ts +3 -0
- package/dist/src/utils/serialize-overrides-into-command-line.js +41 -0
- package/dist/src/utils/serialize-target.d.ts +1 -0
- package/dist/src/utils/serialize-target.js +6 -0
- package/dist/src/utils/shell-quoting.d.ts +10 -0
- package/dist/src/utils/shell-quoting.js +41 -0
- package/dist/src/utils/spinner.d.ts +24 -0
- package/dist/src/utils/spinner.js +77 -0
- package/dist/src/utils/split-target.d.ts +15 -0
- package/dist/src/utils/split-target.js +239 -0
- package/dist/src/utils/strip-indents.d.ts +14 -0
- package/dist/src/utils/strip-indents.js +23 -0
- package/dist/src/utils/sync-generators.d.ts +66 -0
- package/dist/src/utils/sync-generators.js +355 -0
- package/dist/src/utils/tar.d.ts +8 -0
- package/dist/src/utils/tar.js +44 -0
- package/dist/src/utils/task-history.d.ts +17 -0
- package/dist/src/utils/task-history.js +51 -0
- package/dist/src/utils/terminal-link.d.ts +20 -0
- package/dist/src/utils/terminal-link.js +85 -0
- package/dist/src/utils/update-nxw.d.ts +2 -0
- package/dist/src/utils/update-nxw.js +22 -0
- package/dist/src/utils/versions.d.ts +1 -0
- package/dist/src/utils/versions.js +4 -0
- package/dist/src/utils/wait-for-socket-connection.d.ts +15 -0
- package/dist/src/utils/wait-for-socket-connection.js +53 -0
- package/dist/src/utils/workspace-context.d.ts +21 -0
- package/dist/src/utils/workspace-context.js +120 -0
- package/dist/src/utils/workspace-id.d.ts +20 -0
- package/dist/src/utils/workspace-id.js +54 -0
- package/dist/src/utils/workspace-root.d.ts +6 -0
- package/dist/src/utils/workspace-root.js +40 -0
- package/dist/src/utils/write-formatted-json-file.d.ts +6 -0
- package/dist/src/utils/write-formatted-json-file.js +23 -0
- package/dist/src/utils/yarn-syml/index.d.ts +23 -0
- package/dist/src/utils/yarn-syml/index.js +151 -0
- package/dist/src/utils/yarn-syml/syml-grammar.js +1911 -0
- package/dist/tasks-runners/default.d.ts +1 -0
- package/dist/tasks-runners/default.js +5 -0
- package/executors.json +19 -0
- package/generators.json +16 -0
- package/migrations.json +189 -0
- package/package.json +542 -0
- package/schemas/migrations-schema.json +186 -0
- package/schemas/nx-schema.json +1615 -0
- package/schemas/project-schema.json +426 -0
- package/schemas/workspace-schema.json +185 -0
|
@@ -0,0 +1,1370 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TaskOrchestrator = void 0;
|
|
4
|
+
exports.getThreadPoolSize = getThreadPoolSize;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const events_1 = require("events");
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const perf_hooks_1 = require("perf_hooks");
|
|
10
|
+
const pc = tslib_1.__importStar(require("picocolors"));
|
|
11
|
+
const project_graph_1 = require("../project-graph/project-graph");
|
|
12
|
+
const run_commands_impl_1 = require("../executors/run-commands/run-commands.impl");
|
|
13
|
+
const hash_task_1 = require("../hasher/hash-task");
|
|
14
|
+
const task_graph_utils_1 = require("./task-graph-utils");
|
|
15
|
+
const task_hasher_1 = require("../hasher/task-hasher");
|
|
16
|
+
const native_1 = require("../native");
|
|
17
|
+
const db_connection_1 = require("../utils/db-connection");
|
|
18
|
+
const exit_codes_1 = require("../utils/exit-codes");
|
|
19
|
+
const output_1 = require("../utils/output");
|
|
20
|
+
const params_1 = require("../utils/params");
|
|
21
|
+
const workspace_root_1 = require("../utils/workspace-root");
|
|
22
|
+
const cache_1 = require("./cache");
|
|
23
|
+
const forked_process_task_runner_1 = require("./forked-process-task-runner");
|
|
24
|
+
const is_tui_enabled_1 = require("./is-tui-enabled");
|
|
25
|
+
const pseudo_terminal_1 = require("./pseudo-terminal");
|
|
26
|
+
const noop_child_process_1 = require("./running-tasks/noop-child-process");
|
|
27
|
+
const output_prefix_1 = require("./running-tasks/output-prefix");
|
|
28
|
+
const shared_running_task_1 = require("./running-tasks/shared-running-task");
|
|
29
|
+
const task_env_1 = require("./task-env");
|
|
30
|
+
const tasks_schedule_1 = require("./tasks-schedule");
|
|
31
|
+
const utils_1 = require("./utils");
|
|
32
|
+
/**
|
|
33
|
+
* Resolve a batch executor's per-task result to a TaskStatus. Prefers an
|
|
34
|
+
* explicit `status` from the executor; falls back to the `success` boolean
|
|
35
|
+
* for executors that pre-date the `status` field.
|
|
36
|
+
*/
|
|
37
|
+
function resolveBatchTaskStatus(result) {
|
|
38
|
+
return result.status ?? (result.success ? 'success' : 'failure');
|
|
39
|
+
}
|
|
40
|
+
class TaskOrchestrator {
|
|
41
|
+
// endregion internal state
|
|
42
|
+
constructor(hasher, initiatingProject, initiatingTasks, projectGraph, taskGraph, nxJson, options, bail, daemon, outputStyle, fullTaskGraph = taskGraph) {
|
|
43
|
+
this.hasher = hasher;
|
|
44
|
+
this.initiatingProject = initiatingProject;
|
|
45
|
+
this.initiatingTasks = initiatingTasks;
|
|
46
|
+
this.projectGraph = projectGraph;
|
|
47
|
+
this.taskGraph = taskGraph;
|
|
48
|
+
this.nxJson = nxJson;
|
|
49
|
+
this.options = options;
|
|
50
|
+
this.bail = bail;
|
|
51
|
+
this.daemon = daemon;
|
|
52
|
+
this.outputStyle = outputStyle;
|
|
53
|
+
this.fullTaskGraph = fullTaskGraph;
|
|
54
|
+
this.taskDetails = (0, hash_task_1.getTaskDetails)();
|
|
55
|
+
this.cache = (0, cache_1.getCache)(this.options);
|
|
56
|
+
this.tuiEnabled = (0, is_tui_enabled_1.isTuiEnabled)();
|
|
57
|
+
// Derived from projectGraph once — passed to getExecutorForTask /
|
|
58
|
+
// getCustomHasher so they don't have to re-walk the graph per call.
|
|
59
|
+
this.projects = (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(this.projectGraph).projects;
|
|
60
|
+
this.forkedProcessTaskRunner = new forked_process_task_runner_1.ForkedProcessTaskRunner(this.options, this.tuiEnabled);
|
|
61
|
+
this.runningTasksService = !native_1.IS_WASM
|
|
62
|
+
? new native_1.RunningTasksService((0, db_connection_1.getLocalDbConnection)())
|
|
63
|
+
: null;
|
|
64
|
+
this.taskInvocationTracker = !native_1.IS_WASM
|
|
65
|
+
? new native_1.TaskInvocationTracker((0, db_connection_1.getLocalDbConnection)(), Number(process.env.NX_INVOCATION_ROOT_PID ?? process.pid))
|
|
66
|
+
: null;
|
|
67
|
+
// Tracks tasks registered by THIS process so that recursive code paths
|
|
68
|
+
// (e.g. applyFromCacheOrRunBatch looping on incomplete batches) don't
|
|
69
|
+
// re-register and trip the DB uniqueness constraint.
|
|
70
|
+
this.registeredInvocations = new Set();
|
|
71
|
+
this.tasksSchedule = new tasks_schedule_1.TasksSchedule(this.projectGraph, this.projects, this.taskGraph, this.options);
|
|
72
|
+
// region internal state
|
|
73
|
+
this.batchEnv = (0, task_env_1.getEnvVariablesForBatchProcess)(this.options.skipNxCache, this.options.captureStderr);
|
|
74
|
+
this.reverseTaskDeps = (0, utils_1.calculateReverseDeps)(this.taskGraph);
|
|
75
|
+
// `nx:noop` initiating tasks exit instantly via the fast-path in
|
|
76
|
+
// `spawnProcess`. If we treat the noop itself as the keep-alive anchor for
|
|
77
|
+
// its continuous dependencies, `cleanUpUnneededContinuousTasks` kills those
|
|
78
|
+
// children the moment the noop finishes. Expand through noops so the
|
|
79
|
+
// underlying real tasks become the anchors.
|
|
80
|
+
this.initializingTaskIds = (0, utils_1.expandInitiatingTasksThroughNoop)(this.initiatingTasks, this.taskGraph, this.projectGraph);
|
|
81
|
+
this.processedTasks = new Map();
|
|
82
|
+
// Hashes confirmed absent from the cache this run. A confirmed miss can
|
|
83
|
+
// only become a hit when the task itself runs — and then it leaves the
|
|
84
|
+
// schedule — so a missed hash never needs re-querying. Without this, a
|
|
85
|
+
// miss waiting for a worker slot is re-queried (including the remote
|
|
86
|
+
// retrieval) on every coordinator cycle.
|
|
87
|
+
this.cacheMissedHashes = new Set();
|
|
88
|
+
this.completedTasks = new Map();
|
|
89
|
+
this.waitingForTasks = [];
|
|
90
|
+
this.pendingDiscreteWorkers = new Set();
|
|
91
|
+
this.groups = [];
|
|
92
|
+
this.continuousTasksStarted = 0;
|
|
93
|
+
this.bailed = false;
|
|
94
|
+
this.resolveStopPromise = null;
|
|
95
|
+
this.stopRequested = false;
|
|
96
|
+
this.runningContinuousTasks = new Map();
|
|
97
|
+
this.runningRunCommandsTasks = new Map();
|
|
98
|
+
this.runningDiscreteTasks = new Map();
|
|
99
|
+
this.discreteTaskExitHandled = new Map();
|
|
100
|
+
this.continuousTaskExitHandled = new Map();
|
|
101
|
+
this.cleanupPromise = null;
|
|
102
|
+
}
|
|
103
|
+
async init() {
|
|
104
|
+
this.setupSignalHandlers();
|
|
105
|
+
this.taskInvocationTracker?.cleanupStale();
|
|
106
|
+
// Init the ForkedProcessTaskRunner, TasksSchedule, and Cache
|
|
107
|
+
await Promise.all([
|
|
108
|
+
this.forkedProcessTaskRunner.init(),
|
|
109
|
+
this.tasksSchedule.init().then(() => {
|
|
110
|
+
return this.tasksSchedule.scheduleNextTasks();
|
|
111
|
+
}),
|
|
112
|
+
'init' in this.cache ? this.cache.init() : null,
|
|
113
|
+
]);
|
|
114
|
+
// Pass estimated timings to TUI after TasksSchedule is initialized
|
|
115
|
+
if (this.tuiEnabled) {
|
|
116
|
+
const estimatedTimings = this.tasksSchedule.getEstimatedTaskTimings();
|
|
117
|
+
this.options.lifeCycle.setEstimatedTaskTimings(estimatedTimings);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
async run() {
|
|
121
|
+
await this.init();
|
|
122
|
+
perf_hooks_1.performance.mark('task-execution:start');
|
|
123
|
+
const { discrete, continuous, total } = getThreadPoolSize(this.options, this.taskGraph);
|
|
124
|
+
process.stdout.setMaxListeners(total + events_1.defaultMaxListeners);
|
|
125
|
+
process.stderr.setMaxListeners(total + events_1.defaultMaxListeners);
|
|
126
|
+
process.setMaxListeners(total + events_1.defaultMaxListeners);
|
|
127
|
+
const doNotSkipCache = this.options.skipNxCache === false ||
|
|
128
|
+
this.options.skipNxCache === undefined;
|
|
129
|
+
// Start continuous task loops (these run independently)
|
|
130
|
+
const continuousLoops = [];
|
|
131
|
+
for (let i = 0; i < continuous; ++i) {
|
|
132
|
+
continuousLoops.push(this.executeContinuousTaskLoop(continuous));
|
|
133
|
+
}
|
|
134
|
+
// Set up forced shutdown handler
|
|
135
|
+
const shutdownPromise = this.tuiEnabled
|
|
136
|
+
? new Promise((resolve) => {
|
|
137
|
+
this.options.lifeCycle.registerForcedShutdownCallback(() => {
|
|
138
|
+
this.stopRequested = true;
|
|
139
|
+
resolve(undefined);
|
|
140
|
+
});
|
|
141
|
+
})
|
|
142
|
+
: new Promise((resolve) => {
|
|
143
|
+
this.resolveStopPromise = resolve;
|
|
144
|
+
});
|
|
145
|
+
const coordinatorLoop = this.executeCoordinatorLoop(doNotSkipCache, discrete);
|
|
146
|
+
await Promise.race([
|
|
147
|
+
Promise.all([coordinatorLoop, ...continuousLoops]),
|
|
148
|
+
shutdownPromise,
|
|
149
|
+
]);
|
|
150
|
+
perf_hooks_1.performance.mark('task-execution:end');
|
|
151
|
+
perf_hooks_1.performance.measure('task-execution', 'task-execution:start', 'task-execution:end');
|
|
152
|
+
if (!this.stopRequested) {
|
|
153
|
+
this.cache.removeOldCacheRecords();
|
|
154
|
+
}
|
|
155
|
+
await this.cleanup();
|
|
156
|
+
// Public API (defaultTasksRunner) returns a plain object keyed by
|
|
157
|
+
// task id. Internal state is a Map for faster lookup.
|
|
158
|
+
return Object.fromEntries(this.completedTasks);
|
|
159
|
+
}
|
|
160
|
+
nextBatch() {
|
|
161
|
+
return this.tasksSchedule.nextBatch();
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Coordinator loop. All batch operations (hashing, cache resolution)
|
|
165
|
+
* happen on this single thread — no races. Cache misses are dispatched
|
|
166
|
+
* as fire-and-forget workers. Workers signal completion via
|
|
167
|
+
* scheduleNextTasksAndReleaseThreads which wakes all waiting loops.
|
|
168
|
+
*
|
|
169
|
+
* Safety: the dispatch phase (step 5) is fully synchronous — no
|
|
170
|
+
* worker can run during it. So all tasks picked up by nextTask()
|
|
171
|
+
* are guaranteed to be in processedTasks from step 1.
|
|
172
|
+
*/
|
|
173
|
+
async executeCoordinatorLoop(doNotSkipCache, parallelism) {
|
|
174
|
+
while (true) {
|
|
175
|
+
if (this.bailed || this.stopRequested)
|
|
176
|
+
break;
|
|
177
|
+
// 1. Hash BEFORE processAll so processTask sees hashes set, and so
|
|
178
|
+
// resolveCachedTasksBulk can look them up in the cache. Each task
|
|
179
|
+
// is hashed with its own task-specific env (project/target .env
|
|
180
|
+
// files, custom hasher env reads) — the shared batchEnv would
|
|
181
|
+
// compute a different cache key than the single-task path and
|
|
182
|
+
// risk stale cache reuse after env changes.
|
|
183
|
+
{
|
|
184
|
+
const { scheduledTasks } = this.tasksSchedule.getAllScheduledTasks();
|
|
185
|
+
const unhashed = scheduledTasks
|
|
186
|
+
.map((id) => this.taskGraph.tasks[id])
|
|
187
|
+
.filter((t) => !t.hash &&
|
|
188
|
+
this.taskGraph.dependencies[t.id].every((depId) => this.completedTasks.has(depId)));
|
|
189
|
+
if (unhashed.length > 0) {
|
|
190
|
+
const perTaskEnvs = {};
|
|
191
|
+
for (const task of unhashed) {
|
|
192
|
+
perTaskEnvs[task.id] = (0, task_env_1.getTaskSpecificEnv)(task, this.projectGraph);
|
|
193
|
+
}
|
|
194
|
+
await (0, hash_task_1.hashTasks)(this.hasher, this.projectGraph, this.fullTaskGraph, perTaskEnvs, this.taskDetails, unhashed);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
// 2. Bulk-resolve cache hits before processTask — avoids N
|
|
198
|
+
// lifecycle calls for tasks that will be resolved from cache.
|
|
199
|
+
if (doNotSkipCache) {
|
|
200
|
+
const resolved = await this.resolveCachedTasksBulk();
|
|
201
|
+
if (resolved)
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
// 3. Process remaining scheduled tasks (cache misses + non-cacheable).
|
|
205
|
+
this.processAllScheduledTasks();
|
|
206
|
+
// 4. Handle batch executors
|
|
207
|
+
const batch = this.nextBatch();
|
|
208
|
+
if (batch) {
|
|
209
|
+
const groupId = this.closeGroup();
|
|
210
|
+
await this.applyFromCacheOrRunBatch(doNotSkipCache, batch, groupId);
|
|
211
|
+
this.openGroup(groupId);
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
// 5. Dispatch cache misses as individual workers
|
|
215
|
+
while (this.pendingDiscreteWorkers.size < parallelism) {
|
|
216
|
+
const task = this.tasksSchedule.nextTask((t) => !t.continuous);
|
|
217
|
+
if (!task)
|
|
218
|
+
break;
|
|
219
|
+
const groupId = this.closeGroup();
|
|
220
|
+
this.dispatchDiscreteWorker(doNotSkipCache, task, groupId);
|
|
221
|
+
}
|
|
222
|
+
// 6. Nothing left to dispatch and nothing in flight — done.
|
|
223
|
+
if (!this.tasksSchedule.hasTasks() &&
|
|
224
|
+
this.pendingDiscreteWorkers.size === 0) {
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
// 7. Wait for a worker to finish (woken by scheduleNextTasksAndReleaseThreads)
|
|
228
|
+
await new Promise((res) => this.waitingForTasks.push(res));
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
async executeContinuousTaskLoop(continuousTaskCount) {
|
|
232
|
+
while (true) {
|
|
233
|
+
// completed all the tasks
|
|
234
|
+
if (!this.tasksSchedule.hasTasks() || this.bailed || this.stopRequested) {
|
|
235
|
+
return null;
|
|
236
|
+
}
|
|
237
|
+
this.processAllScheduledTasks();
|
|
238
|
+
const task = this.tasksSchedule.nextTask((t) => t.continuous);
|
|
239
|
+
if (task) {
|
|
240
|
+
// Use a separate groupId space (parallel..parallel+N) so continuous tasks
|
|
241
|
+
// don't consume discrete group slots
|
|
242
|
+
const groupId = this.options.parallel + this.continuousTasksStarted++;
|
|
243
|
+
const runningTask = await this.startContinuousTask(task, groupId);
|
|
244
|
+
if (this.initializingTaskIds.has(task.id)) {
|
|
245
|
+
await this.continuousTaskExitHandled.get(task.id);
|
|
246
|
+
}
|
|
247
|
+
// all continuous tasks have been started, thread can exit
|
|
248
|
+
if (this.continuousTasksStarted >= continuousTaskCount) {
|
|
249
|
+
return null;
|
|
250
|
+
}
|
|
251
|
+
continue;
|
|
252
|
+
}
|
|
253
|
+
// all continuous tasks have been started, thread can exit
|
|
254
|
+
if (this.continuousTasksStarted >= continuousTaskCount) {
|
|
255
|
+
return null;
|
|
256
|
+
}
|
|
257
|
+
// block until some other task completes, then try again
|
|
258
|
+
await new Promise((res) => this.waitingForTasks.push(res));
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
// region Processing Scheduled Tasks
|
|
262
|
+
async processTask(taskId) {
|
|
263
|
+
const task = this.taskGraph.tasks[taskId];
|
|
264
|
+
const taskSpecificEnv = (0, task_env_1.getTaskSpecificEnv)(task, this.projectGraph);
|
|
265
|
+
if (!task.hash) {
|
|
266
|
+
await (0, hash_task_1.hashTask)(this.hasher, this.projectGraph, this.fullTaskGraph, task, taskSpecificEnv, this.taskDetails);
|
|
267
|
+
}
|
|
268
|
+
await this.options.lifeCycle.scheduleTask(task);
|
|
269
|
+
return taskSpecificEnv;
|
|
270
|
+
}
|
|
271
|
+
processAllScheduledTasks() {
|
|
272
|
+
const { scheduledTasks } = this.tasksSchedule.getAllScheduledTasks();
|
|
273
|
+
for (const taskId of scheduledTasks) {
|
|
274
|
+
// Task is already handled or being handled
|
|
275
|
+
if (!this.processedTasks.has(taskId)) {
|
|
276
|
+
this.processedTasks.set(taskId, this.processTask(taskId));
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Registers a task invocation and checks for loops across nested Nx processes.
|
|
282
|
+
* Uses the task_invocations DB table keyed by root PID. registerTask() throws
|
|
283
|
+
* on unique constraint violation when a parent Nx process already registered
|
|
284
|
+
* this task — indicating an infinite loop.
|
|
285
|
+
*/
|
|
286
|
+
detectTaskInvocationLoop(task) {
|
|
287
|
+
if (!this.taskInvocationTracker)
|
|
288
|
+
return;
|
|
289
|
+
if (this.registeredInvocations.has(task.id))
|
|
290
|
+
return;
|
|
291
|
+
try {
|
|
292
|
+
this.taskInvocationTracker.registerTask(process.pid, task.id);
|
|
293
|
+
this.registeredInvocations.add(task.id);
|
|
294
|
+
}
|
|
295
|
+
catch {
|
|
296
|
+
// Unique constraint violation — task already invoked by an ancestor Nx process
|
|
297
|
+
const chain = this.taskInvocationTracker.getInvocationChain();
|
|
298
|
+
const chainDisplay = chain.map((r) => r.taskId).join(' -> ');
|
|
299
|
+
output_1.output.error({
|
|
300
|
+
title: 'Recursive task invocation detected',
|
|
301
|
+
bodyLines: [
|
|
302
|
+
`Nx detected a recursive loop of task invocations:`,
|
|
303
|
+
``,
|
|
304
|
+
` ${chainDisplay} -> ${task.id}`,
|
|
305
|
+
``,
|
|
306
|
+
`Task "${task.id}" was already invoked by a parent Nx process in this chain.`,
|
|
307
|
+
`This typically happens when a task's command (e.g., "nx ${task.target.target} ${task.target.project}")`,
|
|
308
|
+
`triggers a chain of tasks that eventually re-invokes itself.`,
|
|
309
|
+
``,
|
|
310
|
+
`To fix this, review the command configuration for the tasks in the chain above.`,
|
|
311
|
+
],
|
|
312
|
+
});
|
|
313
|
+
process.exit(1);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
// endregion Processing Scheduled Tasks
|
|
317
|
+
// region Applying Cache
|
|
318
|
+
async applyCachedResults(tasks) {
|
|
319
|
+
const cacheableTasks = tasks.filter((t) => t.cache);
|
|
320
|
+
if (cacheableTasks.length === 0)
|
|
321
|
+
return [];
|
|
322
|
+
const cacheHits = await this.fetchCacheHits(cacheableTasks);
|
|
323
|
+
if (cacheHits.length === 0)
|
|
324
|
+
return [];
|
|
325
|
+
return this.finalizeCacheHits(cacheHits);
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Batch cache lookup + filter to successful entries. Handles both
|
|
329
|
+
* local (one rarray SQL call) and remote (parallel HTTP retrievals)
|
|
330
|
+
* inside DbCache.getBatch.
|
|
331
|
+
*/
|
|
332
|
+
async fetchCacheHits(tasks) {
|
|
333
|
+
const tasksToQuery = tasks.filter((t) => t.hash && !this.cacheMissedHashes.has(t.hash));
|
|
334
|
+
if (tasksToQuery.length === 0)
|
|
335
|
+
return [];
|
|
336
|
+
const batchResults = await this.cache.getBatch(tasksToQuery);
|
|
337
|
+
const cacheHits = [];
|
|
338
|
+
for (const task of tasksToQuery) {
|
|
339
|
+
const cachedResult = batchResults.get(task.hash);
|
|
340
|
+
// Replay a cached result only under the same condition it was cached
|
|
341
|
+
// under (shouldCacheTaskResult): successes always, failures only when
|
|
342
|
+
// NX_CACHE_FAILURES is enabled. Otherwise cached failures would be
|
|
343
|
+
// written but never read back.
|
|
344
|
+
if (cachedResult && this.shouldCacheTaskResult(task, cachedResult.code)) {
|
|
345
|
+
cacheHits.push({ task, cachedResult });
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
this.cacheMissedHashes.add(task.hash);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
return cacheHits;
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* For each confirmed cache hit: decide whether to copy outputs from
|
|
355
|
+
* the cache (skipping if the on-disk outputs already match the
|
|
356
|
+
* recorded hash), copy in parallel, derive the task status, print
|
|
357
|
+
* terminal output, and return the assembled results.
|
|
358
|
+
*/
|
|
359
|
+
async finalizeCacheHits(cacheHits) {
|
|
360
|
+
// Batch-check which tasks need outputs copied from cache. Remote
|
|
361
|
+
// cache entries come pre-restored to their output dirs when the
|
|
362
|
+
// db cache is on, so we only check ones that aren't.
|
|
363
|
+
const usingDbCache = (0, cache_1.dbCacheEnabled)();
|
|
364
|
+
const tasksNeedingOutputCheck = cacheHits.filter(({ task, cachedResult }) => task.outputs.length > 0 && (!cachedResult.remote || !usingDbCache));
|
|
365
|
+
const shouldCopyMap = await this.shouldCopyOutputsFromCacheBatch(tasksNeedingOutputCheck.map(({ task }) => ({
|
|
366
|
+
outputs: task.outputs,
|
|
367
|
+
hash: task.hash,
|
|
368
|
+
})));
|
|
369
|
+
// Copy outputs in parallel for tasks that need it.
|
|
370
|
+
await Promise.all(cacheHits.map(async ({ task, cachedResult }) => {
|
|
371
|
+
if (shouldCopyMap.get(task.hash)) {
|
|
372
|
+
await this.cache.copyFilesFromCache(task.hash, cachedResult, task.outputs);
|
|
373
|
+
}
|
|
374
|
+
}));
|
|
375
|
+
// Derive status, print terminal output, build results.
|
|
376
|
+
const results = [];
|
|
377
|
+
for (const { task, cachedResult } of cacheHits) {
|
|
378
|
+
const shouldCopy = shouldCopyMap.get(task.hash) ?? false;
|
|
379
|
+
// A cached failure (only replayed when NX_CACHE_FAILURES is enabled) is
|
|
380
|
+
// reported as a plain failure so exit codes, run summaries, and the TUI
|
|
381
|
+
// treat it as a failed run rather than a successful cache hit. Reporting
|
|
382
|
+
// it as 'failure' also ensures its terminal output is always printed,
|
|
383
|
+
// which the cache statuses suppress for non-initiating projects.
|
|
384
|
+
const status = cachedResult.code !== 0
|
|
385
|
+
? 'failure'
|
|
386
|
+
: cachedResult.remote
|
|
387
|
+
? 'remote-cache'
|
|
388
|
+
: shouldCopy
|
|
389
|
+
? 'local-cache'
|
|
390
|
+
: 'local-cache-kept-existing';
|
|
391
|
+
this.options.lifeCycle.printTaskTerminalOutput(task, status, cachedResult.terminalOutput);
|
|
392
|
+
results.push({
|
|
393
|
+
task,
|
|
394
|
+
code: cachedResult.code,
|
|
395
|
+
status,
|
|
396
|
+
terminalOutput: cachedResult.terminalOutput,
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
return results;
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Coordinator wrapper around {@link resolveCachedTasks}: peeks at
|
|
403
|
+
* scheduledTasks (without removing anything from the schedule),
|
|
404
|
+
* filters to cacheable hashed discrete candidates, and delegates the
|
|
405
|
+
* cache fetch + lifecycle to the public method. Returns true if any
|
|
406
|
+
* tasks were resolved.
|
|
407
|
+
*
|
|
408
|
+
* The coordinator relies on this running unconditionally (when cache
|
|
409
|
+
* is enabled): tasks dispatched in step 5 via runTaskDirectly skip
|
|
410
|
+
* their own cache lookup on the assumption that this has already
|
|
411
|
+
* confirmed them as misses. Excluding cacheMissedHashes preserves that
|
|
412
|
+
* invariant — every dispatched hash was queried exactly once — but
|
|
413
|
+
* don't add other length-based bails.
|
|
414
|
+
*/
|
|
415
|
+
async resolveCachedTasksBulk() {
|
|
416
|
+
const { scheduledTasks } = this.tasksSchedule.getAllScheduledTasks();
|
|
417
|
+
const candidates = [];
|
|
418
|
+
for (const id of scheduledTasks) {
|
|
419
|
+
const task = this.taskGraph.tasks[id];
|
|
420
|
+
if (task.hash &&
|
|
421
|
+
!this.cacheMissedHashes.has(task.hash) &&
|
|
422
|
+
!task.continuous &&
|
|
423
|
+
task.cache) {
|
|
424
|
+
candidates.push(task);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
if (candidates.length === 0)
|
|
428
|
+
return false;
|
|
429
|
+
// postRunSteps → complete() → tasksSchedule.complete() will filter
|
|
430
|
+
// resolved hits out of scheduledTasks before we return, so there's
|
|
431
|
+
// no need to mutate the schedule here.
|
|
432
|
+
const groupId = this.closeGroup();
|
|
433
|
+
try {
|
|
434
|
+
const results = await this.resolveCachedTasks(true, candidates, groupId);
|
|
435
|
+
return results.length > 0;
|
|
436
|
+
}
|
|
437
|
+
finally {
|
|
438
|
+
this.openGroup(groupId);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
// endregion Applying Cache
|
|
442
|
+
// region Batch
|
|
443
|
+
/**
|
|
444
|
+
* Hash all batch tasks and resolve cache hits topologically.
|
|
445
|
+
*
|
|
446
|
+
* Walks the task graph level by level. Every task gets a preliminary hash
|
|
447
|
+
* (so startTasks always has a valid hash for Cloud). Tasks with depsOutputs
|
|
448
|
+
* whose deps weren't cached are ineligible for cache lookup but still
|
|
449
|
+
* receive a preliminary hash — they'll be re-hashed after execution.
|
|
450
|
+
*/
|
|
451
|
+
async applyBatchCachedResults(batch, doNotSkipCache, groupId) {
|
|
452
|
+
const cachedResults = [];
|
|
453
|
+
const needsRehashAfterExecution = new Set();
|
|
454
|
+
const tasks = Object.values(batch.taskGraph.tasks);
|
|
455
|
+
if (!doNotSkipCache) {
|
|
456
|
+
// Cache skipped — just hash so startTasks has valid hashes
|
|
457
|
+
await this.hashBatchTasks(tasks);
|
|
458
|
+
return { cachedResults, needsRehashAfterExecution };
|
|
459
|
+
}
|
|
460
|
+
const nonCachedTaskIds = new Set();
|
|
461
|
+
await (0, task_graph_utils_1.walkTaskGraph)(batch.taskGraph, async (rootTaskIds) => {
|
|
462
|
+
const rootTasks = rootTaskIds.map((id) => batch.taskGraph.tasks[id]);
|
|
463
|
+
await this.hashBatchTasks(rootTasks);
|
|
464
|
+
const eligible = [];
|
|
465
|
+
for (const task of rootTasks) {
|
|
466
|
+
const depIds = batch.taskGraph.dependencies[task.id];
|
|
467
|
+
const hasNonCachedDep = depIds.some((id) => nonCachedTaskIds.has(id));
|
|
468
|
+
if (hasNonCachedDep &&
|
|
469
|
+
(0, task_hasher_1.getInputs)(task, this.projectGraph, this.nxJson).depsOutputs.length > 0) {
|
|
470
|
+
nonCachedTaskIds.add(task.id);
|
|
471
|
+
needsRehashAfterExecution.add(task.id);
|
|
472
|
+
}
|
|
473
|
+
else {
|
|
474
|
+
eligible.push(task);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
if (eligible.length > 0) {
|
|
478
|
+
const cacheResults = await this.applyCachedResults(eligible);
|
|
479
|
+
const cachedIds = new Set(cacheResults.map((r) => r.task.id));
|
|
480
|
+
cachedResults.push(...cacheResults);
|
|
481
|
+
if (cacheResults.length > 0) {
|
|
482
|
+
const cachedTasks = cacheResults.map((r) => r.task);
|
|
483
|
+
await Promise.all(cachedTasks.map((task) => this.options.lifeCycle.scheduleTask(task)));
|
|
484
|
+
await this.preRunSteps(cachedTasks, { groupId });
|
|
485
|
+
// Replayed from the cache — don't write the results back.
|
|
486
|
+
await this.postRunSteps(cacheResults, false, groupId);
|
|
487
|
+
}
|
|
488
|
+
for (const task of eligible) {
|
|
489
|
+
if (!cachedIds.has(task.id)) {
|
|
490
|
+
nonCachedTaskIds.add(task.id);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
});
|
|
495
|
+
return { cachedResults, needsRehashAfterExecution };
|
|
496
|
+
}
|
|
497
|
+
async hashBatchTasks(tasks) {
|
|
498
|
+
// Batch executors run every task in the same forked process, but
|
|
499
|
+
// each task still has its own .env files / custom-hasher env — use
|
|
500
|
+
// task-specific env for hashing so the cache key matches the
|
|
501
|
+
// single-task path.
|
|
502
|
+
const perTaskEnvs = {};
|
|
503
|
+
for (const task of tasks) {
|
|
504
|
+
perTaskEnvs[task.id] = (0, task_env_1.getTaskSpecificEnv)(task, this.projectGraph);
|
|
505
|
+
}
|
|
506
|
+
await (0, hash_task_1.hashTasks)(this.hasher, this.projectGraph, this.fullTaskGraph, perTaskEnvs, this.taskDetails, tasks);
|
|
507
|
+
}
|
|
508
|
+
async applyFromCacheOrRunBatch(doNotSkipCache, batch, groupId) {
|
|
509
|
+
const applyFromCacheOrRunBatchStart = perf_hooks_1.performance.mark('TaskOrchestrator-apply-from-cache-or-run-batch:start');
|
|
510
|
+
const taskEntries = Object.entries(batch.taskGraph.tasks);
|
|
511
|
+
const tasks = taskEntries.map(([, task]) => task);
|
|
512
|
+
this.options.lifeCycle.registerRunningBatch?.(batch.id, {
|
|
513
|
+
executorName: batch.executorName,
|
|
514
|
+
taskIds: Object.keys(batch.taskGraph.tasks),
|
|
515
|
+
});
|
|
516
|
+
const { cachedResults, needsRehashAfterExecution } = await this.applyBatchCachedResults(batch, doNotSkipCache, groupId);
|
|
517
|
+
// Schedule and start non-cached tasks (cached tasks were already
|
|
518
|
+
// started and completed inside applyBatchCachedResults)
|
|
519
|
+
const cachedTaskIds = new Set(cachedResults.map((r) => r.task.id));
|
|
520
|
+
const nonCachedTasks = tasks.filter((t) => !cachedTaskIds.has(t.id));
|
|
521
|
+
if (nonCachedTasks.length > 0) {
|
|
522
|
+
await Promise.all(nonCachedTasks.map((task) => this.options.lifeCycle.scheduleTask(task)));
|
|
523
|
+
await this.preRunSteps(nonCachedTasks, { groupId });
|
|
524
|
+
}
|
|
525
|
+
// Phase 2: Run non-cached tasks, then re-hash depsOutputs tasks
|
|
526
|
+
const taskIdsToSkip = cachedResults.map((r) => r.task.id);
|
|
527
|
+
let batchResults = [];
|
|
528
|
+
if (taskIdsToSkip.length < tasks.length) {
|
|
529
|
+
const runGraph = (0, utils_1.removeTasksFromTaskGraph)(batch.taskGraph, taskIdsToSkip);
|
|
530
|
+
for (const task of Object.values(runGraph.tasks)) {
|
|
531
|
+
this.detectTaskInvocationLoop(task);
|
|
532
|
+
}
|
|
533
|
+
batchResults = await this.runBatch({
|
|
534
|
+
id: batch.id,
|
|
535
|
+
executorName: batch.executorName,
|
|
536
|
+
taskGraph: runGraph,
|
|
537
|
+
}, this.batchEnv, groupId);
|
|
538
|
+
// Re-hash depsOutputs tasks — their dep outputs are now on disk
|
|
539
|
+
const tasksToRehash = batchResults
|
|
540
|
+
.filter((r) => needsRehashAfterExecution.has(r.task.id) &&
|
|
541
|
+
(r.status === 'success' || r.status === 'failure'))
|
|
542
|
+
.map((r) => r.task);
|
|
543
|
+
if (tasksToRehash.length > 0) {
|
|
544
|
+
// hashTasks skips tasks that already have a hash — clear the
|
|
545
|
+
// preliminary hashes so these tasks actually get re-hashed
|
|
546
|
+
for (const task of tasksToRehash) {
|
|
547
|
+
task.hash = undefined;
|
|
548
|
+
task.hashDetails = undefined;
|
|
549
|
+
}
|
|
550
|
+
await this.hashBatchTasks(tasksToRehash);
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
if (batchResults.length > 0) {
|
|
554
|
+
await this.postRunSteps(batchResults, doNotSkipCache, groupId);
|
|
555
|
+
}
|
|
556
|
+
// Update batch status based on all task results
|
|
557
|
+
const hasFailures = taskEntries.some(([taskId]) => {
|
|
558
|
+
const status = this.completedTasks.get(taskId);
|
|
559
|
+
return status === 'failure' || status === 'skipped';
|
|
560
|
+
});
|
|
561
|
+
this.options.lifeCycle.setBatchStatus?.(batch.id, hasFailures ? "Failure" /* BatchStatus.Failure */ : "Success" /* BatchStatus.Success */);
|
|
562
|
+
this.forkedProcessTaskRunner.cleanUpBatchProcesses();
|
|
563
|
+
const tasksCompleted = taskEntries.filter(([taskId]) => this.completedTasks.has(taskId));
|
|
564
|
+
// Batch is still not done, run it again
|
|
565
|
+
if (tasksCompleted.length !== taskEntries.length) {
|
|
566
|
+
await this.applyFromCacheOrRunBatch(doNotSkipCache, {
|
|
567
|
+
id: batch.id,
|
|
568
|
+
executorName: batch.executorName,
|
|
569
|
+
taskGraph: (0, utils_1.removeTasksFromTaskGraph)(batch.taskGraph, tasksCompleted.map(([taskId]) => taskId)),
|
|
570
|
+
}, groupId);
|
|
571
|
+
}
|
|
572
|
+
// Batch is done, mark it as completed
|
|
573
|
+
const applyFromCacheOrRunBatchEnd = perf_hooks_1.performance.mark('TaskOrchestrator-apply-from-cache-or-run-batch:end');
|
|
574
|
+
perf_hooks_1.performance.measure('TaskOrchestrator-apply-from-cache-or-run-batch', applyFromCacheOrRunBatchStart.name, applyFromCacheOrRunBatchEnd.name);
|
|
575
|
+
return [...cachedResults, ...batchResults];
|
|
576
|
+
}
|
|
577
|
+
async runBatch(batch, env, groupId) {
|
|
578
|
+
const runBatchStart = perf_hooks_1.performance.mark('TaskOrchestrator-run-batch:start');
|
|
579
|
+
try {
|
|
580
|
+
const batchProcess = await this.forkedProcessTaskRunner.forkProcessForBatch(batch, this.projectGraph, this.fullTaskGraph, env);
|
|
581
|
+
// Stream output from batch process to the batch
|
|
582
|
+
batchProcess.onOutput((output) => {
|
|
583
|
+
this.options.lifeCycle.appendBatchOutput?.(batch.id, output);
|
|
584
|
+
});
|
|
585
|
+
// Stream task results as they complete
|
|
586
|
+
// Heavy operations (caching, scheduling, complete) happen at batch-end in postRunSteps
|
|
587
|
+
batchProcess.onTaskResults((taskId, result) => {
|
|
588
|
+
const task = this.taskGraph.tasks[taskId];
|
|
589
|
+
const status = resolveBatchTaskStatus(result);
|
|
590
|
+
// Append before print so printTaskTerminalOutput finds the PTY already
|
|
591
|
+
// populated and no-ops; reversing the order writes terminalOutput twice.
|
|
592
|
+
if (result.terminalOutput) {
|
|
593
|
+
this.options.lifeCycle.appendTaskOutput(taskId, result.terminalOutput, false);
|
|
594
|
+
}
|
|
595
|
+
// Skipped tasks didn't run, so they have no terminal output and don't
|
|
596
|
+
// need a per-task PTY — calling printTaskTerminalOutput would otherwise
|
|
597
|
+
// allocate one just to write a cursor-hide escape.
|
|
598
|
+
if (status !== 'skipped') {
|
|
599
|
+
this.options.lifeCycle.printTaskTerminalOutput(task, status, result.terminalOutput ?? '');
|
|
600
|
+
}
|
|
601
|
+
task.startTime = result.startTime;
|
|
602
|
+
task.endTime = result.endTime;
|
|
603
|
+
if (result.startTime && result.endTime) {
|
|
604
|
+
this.options.lifeCycle.setTaskTiming?.(taskId, result.startTime, result.endTime);
|
|
605
|
+
}
|
|
606
|
+
this.options.lifeCycle.setTaskStatus(taskId, (0, native_1.parseTaskStatus)(status));
|
|
607
|
+
});
|
|
608
|
+
const results = await batchProcess.getResults();
|
|
609
|
+
const batchResultEntries = Object.entries(results);
|
|
610
|
+
return batchResultEntries.map(([taskId, result]) => {
|
|
611
|
+
const task = this.taskGraph.tasks[taskId];
|
|
612
|
+
task.startTime = result.startTime;
|
|
613
|
+
task.endTime = result.endTime;
|
|
614
|
+
const status = resolveBatchTaskStatus(result);
|
|
615
|
+
return {
|
|
616
|
+
code: status === 'success' ? 0 : 1,
|
|
617
|
+
task,
|
|
618
|
+
status,
|
|
619
|
+
terminalOutput: result.terminalOutput,
|
|
620
|
+
};
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
catch (e) {
|
|
624
|
+
const isBatchStopping = this.stopRequested;
|
|
625
|
+
return Object.keys(batch.taskGraph.tasks).map((taskId) => {
|
|
626
|
+
const task = this.taskGraph.tasks[taskId];
|
|
627
|
+
if (isBatchStopping) {
|
|
628
|
+
task.endTime = Date.now();
|
|
629
|
+
}
|
|
630
|
+
return {
|
|
631
|
+
task,
|
|
632
|
+
code: 1,
|
|
633
|
+
status: (isBatchStopping ? 'stopped' : 'failure'),
|
|
634
|
+
terminalOutput: isBatchStopping ? '' : (e.stack ?? e.message ?? ''),
|
|
635
|
+
};
|
|
636
|
+
});
|
|
637
|
+
}
|
|
638
|
+
finally {
|
|
639
|
+
const runBatchEnd = perf_hooks_1.performance.mark('TaskOrchestrator-run-batch:end');
|
|
640
|
+
perf_hooks_1.performance.measure('TaskOrchestrator-run-batch', runBatchStart.name, runBatchEnd.name);
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
// endregion Batch
|
|
644
|
+
// region Single Task
|
|
645
|
+
/**
|
|
646
|
+
* Bulk-resolve cache hits for a set of tasks: fetch cached entries,
|
|
647
|
+
* copy outputs as needed, fire lifecycle, and return the TaskResults
|
|
648
|
+
* for the hits. Tasks that aren't in the cache (or aren't cacheable)
|
|
649
|
+
* are silently omitted from the return value — callers are responsible
|
|
650
|
+
* for running those via {@link runTaskDirectly}.
|
|
651
|
+
*
|
|
652
|
+
* Fires scheduleTask lifecycle for hits that haven't been through
|
|
653
|
+
* processAllScheduledTasks yet. That's a coordinator gap-filler and
|
|
654
|
+
* a no-op for callers that pre-process the schedule.
|
|
655
|
+
*
|
|
656
|
+
* The caller provides `groupId` — cache hits share one slot since they
|
|
657
|
+
* don't actually compete for parallelism.
|
|
658
|
+
*/
|
|
659
|
+
async resolveCachedTasks(doNotSkipCache, tasks, groupId) {
|
|
660
|
+
if (!doNotSkipCache || tasks.length === 0)
|
|
661
|
+
return [];
|
|
662
|
+
const cacheableTasks = tasks.filter((t) => t.cache);
|
|
663
|
+
if (cacheableTasks.length === 0)
|
|
664
|
+
return [];
|
|
665
|
+
// Wait for any queued processTask promises to settle so task.hash is
|
|
666
|
+
// populated before cache.getBatch maps it into a Rust String.
|
|
667
|
+
await Promise.all(cacheableTasks.map((t) => this.processedTasks.get(t.id)));
|
|
668
|
+
const cacheHits = await this.fetchCacheHits(cacheableTasks);
|
|
669
|
+
if (cacheHits.length === 0)
|
|
670
|
+
return [];
|
|
671
|
+
// scheduleTask lifecycle for hits the coordinator resolved before
|
|
672
|
+
// processAllScheduledTasks could fire it. No-op for callers that
|
|
673
|
+
// already ran processAllScheduledTasks (every hit is in processedTasks).
|
|
674
|
+
await Promise.all(cacheHits
|
|
675
|
+
.filter(({ task }) => !this.processedTasks.has(task.id))
|
|
676
|
+
.map(({ task }) => this.options.lifeCycle.scheduleTask(task)));
|
|
677
|
+
const hitTasks = cacheHits.map((h) => h.task);
|
|
678
|
+
await this.preRunSteps(hitTasks, { groupId });
|
|
679
|
+
const results = await this.finalizeCacheHits(cacheHits);
|
|
680
|
+
// Replayed from the cache — don't write the results back.
|
|
681
|
+
await this.postRunSteps(results, false, groupId);
|
|
682
|
+
return results;
|
|
683
|
+
}
|
|
684
|
+
/**
|
|
685
|
+
* Fire a discrete-task worker and track it in pendingDiscreteWorkers until
|
|
686
|
+
* it settles. Uses runTaskDirectly (not applyFromCacheOrRun*) because
|
|
687
|
+
* resolveCachedTasksBulk already confirmed this task is a cache miss —
|
|
688
|
+
* another lookup would re-query the DB and (for Nx Cloud users) repeat
|
|
689
|
+
* the remote HTTP retrieval.
|
|
690
|
+
*/
|
|
691
|
+
dispatchDiscreteWorker(doNotSkipCache, task, groupId) {
|
|
692
|
+
const worker = this.runTaskDirectly(doNotSkipCache, task, groupId)
|
|
693
|
+
.catch((e) => this.handleDiscreteWorkerFailure(doNotSkipCache, task, groupId, e))
|
|
694
|
+
.finally(() => {
|
|
695
|
+
this.openGroup(groupId);
|
|
696
|
+
this.pendingDiscreteWorkers.delete(worker);
|
|
697
|
+
// Wake coordinator — the delete above may satisfy the exit condition
|
|
698
|
+
// (pendingDiscreteWorkers.size === 0) that was missed when
|
|
699
|
+
// scheduleNextTasksAndReleaseThreads fired earlier.
|
|
700
|
+
this.waitingForTasks.forEach((f) => f(null));
|
|
701
|
+
this.waitingForTasks.length = 0;
|
|
702
|
+
});
|
|
703
|
+
this.pendingDiscreteWorkers.add(worker);
|
|
704
|
+
}
|
|
705
|
+
/**
|
|
706
|
+
* Route a worker rejection (e.g. remote cache errors) through the normal
|
|
707
|
+
* failure path instead of letting it become an unhandled promise. Guard
|
|
708
|
+
* against double-finalize: completeTasks() populates `completedTasks`,
|
|
709
|
+
* so a rejection arriving after postRunSteps has already finalized the
|
|
710
|
+
* task must not run postRunSteps again.
|
|
711
|
+
*/
|
|
712
|
+
async handleDiscreteWorkerFailure(doNotSkipCache, task, groupId, e) {
|
|
713
|
+
if (this.completedTasks.has(task.id))
|
|
714
|
+
return;
|
|
715
|
+
const terminalOutput = e?.message ?? '';
|
|
716
|
+
this.options.lifeCycle.printTaskTerminalOutput(task, 'failure', terminalOutput);
|
|
717
|
+
await this.postRunSteps([{ task, status: 'failure', terminalOutput }], doNotSkipCache, groupId);
|
|
718
|
+
}
|
|
719
|
+
/**
|
|
720
|
+
* Spawn and wait on a task's child process, unconditionally — no cache
|
|
721
|
+
* lookup. Callers must have already confirmed the task is a cache miss
|
|
722
|
+
* (or disabled caching entirely).
|
|
723
|
+
*/
|
|
724
|
+
async runTaskDirectly(doNotSkipCache, task, groupId) {
|
|
725
|
+
// Wait for task to be processed
|
|
726
|
+
const taskSpecificEnv = await this.processedTasks.get(task.id);
|
|
727
|
+
await this.preRunSteps([task], { groupId });
|
|
728
|
+
const pipeOutput = await this.pipeOutputCapture(task);
|
|
729
|
+
const temporaryOutputPath = this.cache.temporaryOutputPath(task);
|
|
730
|
+
const streamOutput = this.outputStyle === 'static'
|
|
731
|
+
? false
|
|
732
|
+
: (0, utils_1.shouldStreamOutput)(task, this.initiatingProject);
|
|
733
|
+
const env = pipeOutput
|
|
734
|
+
? (0, task_env_1.getEnvVariablesForTask)(task, taskSpecificEnv, (0, task_env_1.getForceColorForChild)(), this.options.skipNxCache, this.options.captureStderr, null, null)
|
|
735
|
+
: (0, task_env_1.getEnvVariablesForTask)(task, taskSpecificEnv, undefined, this.options.skipNxCache, this.options.captureStderr, temporaryOutputPath, streamOutput);
|
|
736
|
+
let resolveDiscreteExit;
|
|
737
|
+
const discreteExitHandled = new Promise((r) => (resolveDiscreteExit = r));
|
|
738
|
+
this.discreteTaskExitHandled.set(task.id, discreteExitHandled);
|
|
739
|
+
this.detectTaskInvocationLoop(task);
|
|
740
|
+
const childProcess = await this.runTask(task, streamOutput, env, temporaryOutputPath, pipeOutput);
|
|
741
|
+
this.runningDiscreteTasks.set(task.id, {
|
|
742
|
+
runningTask: childProcess,
|
|
743
|
+
stopping: false,
|
|
744
|
+
});
|
|
745
|
+
const { code, terminalOutput } = await childProcess.getResults();
|
|
746
|
+
const isStopping = this.runningDiscreteTasks.get(task.id)?.stopping ?? false;
|
|
747
|
+
this.runningDiscreteTasks.delete(task.id);
|
|
748
|
+
const result = {
|
|
749
|
+
task,
|
|
750
|
+
code,
|
|
751
|
+
status: isStopping ? 'stopped' : code === 0 ? 'success' : 'failure',
|
|
752
|
+
terminalOutput,
|
|
753
|
+
};
|
|
754
|
+
try {
|
|
755
|
+
await this.postRunSteps([result], doNotSkipCache, groupId);
|
|
756
|
+
}
|
|
757
|
+
finally {
|
|
758
|
+
this.discreteTaskExitHandled.delete(task.id);
|
|
759
|
+
resolveDiscreteExit();
|
|
760
|
+
}
|
|
761
|
+
return result;
|
|
762
|
+
}
|
|
763
|
+
async runTask(task, streamOutput, env, temporaryOutputPath, pipeOutput) {
|
|
764
|
+
const shouldPrefix = streamOutput &&
|
|
765
|
+
process.env.NX_PREFIX_OUTPUT === 'true' &&
|
|
766
|
+
!this.tuiEnabled;
|
|
767
|
+
const targetConfiguration = (0, utils_1.getTargetConfigurationForTask)(task, this.projectGraph);
|
|
768
|
+
if (process.env.NX_RUN_COMMANDS_DIRECTLY !== 'false' &&
|
|
769
|
+
targetConfiguration.executor === 'nx:run-commands') {
|
|
770
|
+
try {
|
|
771
|
+
const { schema } = (0, utils_1.getExecutorForTask)(task, this.projects);
|
|
772
|
+
const combinedOptions = (0, params_1.combineOptionsForExecutor)(task.overrides, task.target.configuration ?? targetConfiguration.defaultConfiguration, targetConfiguration, schema, task.target.project, (0, path_1.relative)(task.projectRoot ?? workspace_root_1.workspaceRoot, process.cwd()), process.env.NX_VERBOSE_LOGGING === 'true');
|
|
773
|
+
if (combinedOptions.env) {
|
|
774
|
+
env = {
|
|
775
|
+
...env,
|
|
776
|
+
...combinedOptions.env,
|
|
777
|
+
};
|
|
778
|
+
}
|
|
779
|
+
if (streamOutput) {
|
|
780
|
+
const args = (0, utils_1.getPrintableCommandArgsForTask)(task);
|
|
781
|
+
output_1.output.logCommand(args.join(' '));
|
|
782
|
+
}
|
|
783
|
+
const runCommandsOptions = {
|
|
784
|
+
...combinedOptions,
|
|
785
|
+
env,
|
|
786
|
+
usePty: this.tuiEnabled ||
|
|
787
|
+
(!this.tasksSchedule.hasTasks() &&
|
|
788
|
+
this.runningContinuousTasks.size === 0),
|
|
789
|
+
streamOutput: streamOutput && !shouldPrefix,
|
|
790
|
+
};
|
|
791
|
+
const runningTask = await (0, run_commands_impl_1.runCommands)(runCommandsOptions, {
|
|
792
|
+
root: workspace_root_1.workspaceRoot, // only root is needed in runCommands
|
|
793
|
+
}, task.id);
|
|
794
|
+
this.runningRunCommandsTasks.set(task.id, runningTask);
|
|
795
|
+
runningTask.onExit(() => {
|
|
796
|
+
this.runningRunCommandsTasks.delete(task.id);
|
|
797
|
+
});
|
|
798
|
+
if (shouldPrefix) {
|
|
799
|
+
const color = (0, output_prefix_1.getColor)(task.target.project);
|
|
800
|
+
const formattedPrefix = pc.bold(color(`${task.target.project}:`));
|
|
801
|
+
runningTask.onOutput((chunk) => {
|
|
802
|
+
(0, output_prefix_1.writePrefixedLines)(chunk, formattedPrefix);
|
|
803
|
+
});
|
|
804
|
+
}
|
|
805
|
+
else if (this.tuiEnabled) {
|
|
806
|
+
if (runningTask instanceof pseudo_terminal_1.PseudoTtyProcess) {
|
|
807
|
+
// This is an external of a the pseudo terminal where a task is running and can be passed to the TUI
|
|
808
|
+
this.options.lifeCycle.registerRunningTask(task.id, runningTask.getParserAndWriter());
|
|
809
|
+
runningTask.onOutput((output) => {
|
|
810
|
+
this.options.lifeCycle.appendTaskOutput(task.id, output, true);
|
|
811
|
+
});
|
|
812
|
+
}
|
|
813
|
+
else {
|
|
814
|
+
this.options.lifeCycle.registerRunningTaskWithEmptyParser(task.id);
|
|
815
|
+
runningTask.onOutput((output) => {
|
|
816
|
+
this.options.lifeCycle.appendTaskOutput(task.id, output, false);
|
|
817
|
+
});
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
if (!streamOutput && !shouldPrefix) {
|
|
821
|
+
// TODO: shouldn't this be checking if the task is continuous before writing anything to disk or calling printTaskTerminalOutput?
|
|
822
|
+
runningTask.onExit((code, terminalOutput) => {
|
|
823
|
+
this.options.lifeCycle.printTaskTerminalOutput(task, code === 0 ? 'success' : 'failure', terminalOutput);
|
|
824
|
+
(0, fs_1.writeFileSync)(temporaryOutputPath, terminalOutput);
|
|
825
|
+
});
|
|
826
|
+
}
|
|
827
|
+
return runningTask;
|
|
828
|
+
}
|
|
829
|
+
catch (e) {
|
|
830
|
+
if (process.env.NX_VERBOSE_LOGGING === 'true') {
|
|
831
|
+
console.error(e);
|
|
832
|
+
}
|
|
833
|
+
else {
|
|
834
|
+
console.error(e.message);
|
|
835
|
+
}
|
|
836
|
+
const terminalOutput = e.stack ?? e.message ?? '';
|
|
837
|
+
(0, fs_1.writeFileSync)(temporaryOutputPath, terminalOutput);
|
|
838
|
+
return new noop_child_process_1.NoopChildProcess({
|
|
839
|
+
code: 1,
|
|
840
|
+
terminalOutput,
|
|
841
|
+
});
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
else if (targetConfiguration.executor === 'nx:noop') {
|
|
845
|
+
(0, fs_1.writeFileSync)(temporaryOutputPath, '');
|
|
846
|
+
return new noop_child_process_1.NoopChildProcess({
|
|
847
|
+
code: 0,
|
|
848
|
+
terminalOutput: '',
|
|
849
|
+
});
|
|
850
|
+
}
|
|
851
|
+
else {
|
|
852
|
+
// cache prep
|
|
853
|
+
const runningTask = await this.runTaskInForkedProcess(task, env, pipeOutput, temporaryOutputPath, streamOutput);
|
|
854
|
+
if (this.tuiEnabled) {
|
|
855
|
+
if (runningTask instanceof pseudo_terminal_1.PseudoTtyProcess) {
|
|
856
|
+
// This is an external of a the pseudo terminal where a task is running and can be passed to the TUI
|
|
857
|
+
this.options.lifeCycle.registerRunningTask(task.id, runningTask.getParserAndWriter());
|
|
858
|
+
runningTask.onOutput((output) => {
|
|
859
|
+
this.options.lifeCycle.appendTaskOutput(task.id, output, true);
|
|
860
|
+
});
|
|
861
|
+
}
|
|
862
|
+
else if ('onOutput' in runningTask &&
|
|
863
|
+
typeof runningTask.onOutput === 'function') {
|
|
864
|
+
// Register task that can provide progressive output but isn't interactive (e.g., NodeChildProcessWithNonDirectOutput)
|
|
865
|
+
this.options.lifeCycle.registerRunningTaskWithEmptyParser(task.id);
|
|
866
|
+
runningTask.onOutput((output) => {
|
|
867
|
+
this.options.lifeCycle.appendTaskOutput(task.id, output, false);
|
|
868
|
+
});
|
|
869
|
+
}
|
|
870
|
+
else {
|
|
871
|
+
// Fallback for tasks that don't support progressive output
|
|
872
|
+
this.options.lifeCycle.registerRunningTaskWithEmptyParser(task.id);
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
return runningTask;
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
async runTaskInForkedProcess(task, env, pipeOutput, temporaryOutputPath, streamOutput) {
|
|
879
|
+
try {
|
|
880
|
+
const usePtyFork = process.env.NX_NATIVE_COMMAND_RUNNER !== 'false';
|
|
881
|
+
// Disable the pseudo terminal if this is a run-many or when running a continuous task as part of a run-one
|
|
882
|
+
const disablePseudoTerminal = !this.tuiEnabled && (!this.initiatingProject || task.continuous);
|
|
883
|
+
// execution
|
|
884
|
+
const childProcess = usePtyFork
|
|
885
|
+
? await this.forkedProcessTaskRunner.forkProcess(task, {
|
|
886
|
+
temporaryOutputPath,
|
|
887
|
+
streamOutput,
|
|
888
|
+
pipeOutput,
|
|
889
|
+
taskGraph: this.taskGraph,
|
|
890
|
+
env,
|
|
891
|
+
disablePseudoTerminal,
|
|
892
|
+
})
|
|
893
|
+
: await this.forkedProcessTaskRunner.forkProcessLegacy(task, {
|
|
894
|
+
temporaryOutputPath,
|
|
895
|
+
streamOutput,
|
|
896
|
+
pipeOutput,
|
|
897
|
+
taskGraph: this.taskGraph,
|
|
898
|
+
env,
|
|
899
|
+
});
|
|
900
|
+
return childProcess;
|
|
901
|
+
}
|
|
902
|
+
catch (e) {
|
|
903
|
+
if (process.env.NX_VERBOSE_LOGGING === 'true') {
|
|
904
|
+
console.error(e);
|
|
905
|
+
}
|
|
906
|
+
return new noop_child_process_1.NoopChildProcess({
|
|
907
|
+
code: 1,
|
|
908
|
+
terminalOutput: e.stack ?? e.message ?? '',
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
async startContinuousTask(task, groupId) {
|
|
913
|
+
if (this.runningTasksService &&
|
|
914
|
+
this.runningTasksService.getRunningTasks([task.id]).length) {
|
|
915
|
+
await this.preRunSteps([task], { groupId });
|
|
916
|
+
if (this.tuiEnabled) {
|
|
917
|
+
this.options.lifeCycle.setTaskStatus(task.id, 8 /* NativeTaskStatus.Shared */);
|
|
918
|
+
}
|
|
919
|
+
const runningTask = new shared_running_task_1.SharedRunningTask(this.runningTasksService, task.id);
|
|
920
|
+
this.runningContinuousTasks.set(task.id, {
|
|
921
|
+
runningTask,
|
|
922
|
+
groupId,
|
|
923
|
+
ownsRunningTasksService: false,
|
|
924
|
+
});
|
|
925
|
+
this.continuousTaskExitHandled.set(task.id, new Promise((resolve) => {
|
|
926
|
+
runningTask.onExit(async (code) => {
|
|
927
|
+
await this.handleContinuousTaskExit(code, task, groupId, false);
|
|
928
|
+
resolve();
|
|
929
|
+
});
|
|
930
|
+
}));
|
|
931
|
+
// task is already running by another process, we schedule the next tasks
|
|
932
|
+
// and release the threads
|
|
933
|
+
await this.scheduleNextTasksAndReleaseThreads();
|
|
934
|
+
return runningTask;
|
|
935
|
+
}
|
|
936
|
+
const taskSpecificEnv = await this.processedTasks.get(task.id);
|
|
937
|
+
await this.preRunSteps([task], { groupId });
|
|
938
|
+
const pipeOutput = await this.pipeOutputCapture(task);
|
|
939
|
+
// obtain metadata
|
|
940
|
+
const temporaryOutputPath = this.cache.temporaryOutputPath(task);
|
|
941
|
+
const streamOutput = this.outputStyle === 'static'
|
|
942
|
+
? false
|
|
943
|
+
: (0, utils_1.shouldStreamOutput)(task, this.initiatingProject);
|
|
944
|
+
let env = pipeOutput
|
|
945
|
+
? (0, task_env_1.getEnvVariablesForTask)(task, taskSpecificEnv, (0, task_env_1.getForceColorForChild)(), this.options.skipNxCache, this.options.captureStderr, null, null)
|
|
946
|
+
: (0, task_env_1.getEnvVariablesForTask)(task, taskSpecificEnv, undefined, this.options.skipNxCache, this.options.captureStderr, temporaryOutputPath, streamOutput);
|
|
947
|
+
this.detectTaskInvocationLoop(task);
|
|
948
|
+
const childProcess = await this.runTask(task, streamOutput, env, temporaryOutputPath, pipeOutput);
|
|
949
|
+
this.runningTasksService?.addRunningTask(task.id);
|
|
950
|
+
this.runningContinuousTasks.set(task.id, {
|
|
951
|
+
runningTask: childProcess,
|
|
952
|
+
groupId,
|
|
953
|
+
ownsRunningTasksService: true,
|
|
954
|
+
});
|
|
955
|
+
this.continuousTaskExitHandled.set(task.id, new Promise((resolve) => {
|
|
956
|
+
childProcess.onExit(async (code) => {
|
|
957
|
+
await this.handleContinuousTaskExit(code, task, groupId, true);
|
|
958
|
+
resolve();
|
|
959
|
+
});
|
|
960
|
+
}));
|
|
961
|
+
await this.scheduleNextTasksAndReleaseThreads();
|
|
962
|
+
return childProcess;
|
|
963
|
+
}
|
|
964
|
+
// endregion Single Task
|
|
965
|
+
// region Lifecycle
|
|
966
|
+
async preRunSteps(tasks, metadata) {
|
|
967
|
+
const now = Date.now();
|
|
968
|
+
for (const task of tasks) {
|
|
969
|
+
task.startTime = now;
|
|
970
|
+
}
|
|
971
|
+
await this.options.lifeCycle.startTasks(tasks, metadata);
|
|
972
|
+
}
|
|
973
|
+
async postRunSteps(results, shouldCache, groupId) {
|
|
974
|
+
const now = Date.now();
|
|
975
|
+
const tasksToRecord = [];
|
|
976
|
+
for (const { task, status } of results) {
|
|
977
|
+
// Only set endTime as fallback (batch provides timing via result.task)
|
|
978
|
+
task.endTime ??= now;
|
|
979
|
+
// Skip recording for tasks whose outputs already match the cache —
|
|
980
|
+
// the daemon already has the correct hash recorded.
|
|
981
|
+
if (!this.stopRequested &&
|
|
982
|
+
task.outputs.length > 0 &&
|
|
983
|
+
status !== 'local-cache-kept-existing') {
|
|
984
|
+
tasksToRecord.push({ outputs: task.outputs, hash: task.hash });
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
if (tasksToRecord.length > 0) {
|
|
988
|
+
await this.recordOutputsHashBatch(tasksToRecord);
|
|
989
|
+
}
|
|
990
|
+
// Caller decides whether these results should be written to the cache.
|
|
991
|
+
// Cache replays pass false so a replayed failure (reported as 'failure' so
|
|
992
|
+
// it counts as a failed run) isn't re-written to the cache on every replay.
|
|
993
|
+
if (shouldCache && !this.stopRequested) {
|
|
994
|
+
// cache the results
|
|
995
|
+
perf_hooks_1.performance.mark('cache-results-start');
|
|
996
|
+
await Promise.all(results
|
|
997
|
+
.filter(({ status }) => status !== 'local-cache' &&
|
|
998
|
+
status !== 'local-cache-kept-existing' &&
|
|
999
|
+
status !== 'remote-cache' &&
|
|
1000
|
+
status !== 'skipped' &&
|
|
1001
|
+
status !== 'stopped')
|
|
1002
|
+
.map((result) => ({
|
|
1003
|
+
...result,
|
|
1004
|
+
code: result.status === 'local-cache' ||
|
|
1005
|
+
result.status === 'local-cache-kept-existing' ||
|
|
1006
|
+
result.status === 'remote-cache' ||
|
|
1007
|
+
result.status === 'success'
|
|
1008
|
+
? 0
|
|
1009
|
+
: 1,
|
|
1010
|
+
outputs: result.task.outputs,
|
|
1011
|
+
}))
|
|
1012
|
+
.filter(({ task, code }) => this.shouldCacheTaskResult(task, code))
|
|
1013
|
+
.filter(({ terminalOutput, outputs }) => terminalOutput || outputs)
|
|
1014
|
+
.map(async ({ task, code, terminalOutput, outputs }) => this.cache.put(task, terminalOutput, outputs, code)));
|
|
1015
|
+
perf_hooks_1.performance.mark('cache-results-end');
|
|
1016
|
+
perf_hooks_1.performance.measure('cache-results', 'cache-results-start', 'cache-results-end');
|
|
1017
|
+
}
|
|
1018
|
+
await this.complete(results, groupId);
|
|
1019
|
+
await this.scheduleNextTasksAndReleaseThreads();
|
|
1020
|
+
}
|
|
1021
|
+
async scheduleNextTasksAndReleaseThreads() {
|
|
1022
|
+
if (this.stopRequested) {
|
|
1023
|
+
this.waitingForTasks.forEach((f) => f(null));
|
|
1024
|
+
this.waitingForTasks.length = 0;
|
|
1025
|
+
return;
|
|
1026
|
+
}
|
|
1027
|
+
await this.tasksSchedule.scheduleNextTasks();
|
|
1028
|
+
// release blocked threads
|
|
1029
|
+
this.waitingForTasks.forEach((f) => f(null));
|
|
1030
|
+
this.waitingForTasks.length = 0;
|
|
1031
|
+
}
|
|
1032
|
+
async complete(results, groupId) {
|
|
1033
|
+
await this.completeTasks(results, groupId);
|
|
1034
|
+
this.cleanUpUnneededContinuousTasks();
|
|
1035
|
+
}
|
|
1036
|
+
/**
|
|
1037
|
+
* Unified task completion handler for a set of tasks.
|
|
1038
|
+
* - Calls endTasks() lifecycle hook (non-skipped only)
|
|
1039
|
+
* - Marks complete in scheduler
|
|
1040
|
+
* - Sets completedTasks
|
|
1041
|
+
* - Updates TUI status
|
|
1042
|
+
* - Skip dependent tasks
|
|
1043
|
+
*/
|
|
1044
|
+
async completeTasks(results, groupId) {
|
|
1045
|
+
// 1. endTasks FIRST (non-skipped only)
|
|
1046
|
+
const tasksToReport = [];
|
|
1047
|
+
const taskIds = [];
|
|
1048
|
+
for (const { task, status, terminalOutput } of results) {
|
|
1049
|
+
taskIds.push(task.id);
|
|
1050
|
+
if (!this.completedTasks.has(task.id) && status !== 'skipped') {
|
|
1051
|
+
tasksToReport.push({
|
|
1052
|
+
task,
|
|
1053
|
+
status,
|
|
1054
|
+
terminalOutput,
|
|
1055
|
+
code: status === 'success' ||
|
|
1056
|
+
status === 'local-cache' ||
|
|
1057
|
+
status === 'local-cache-kept-existing' ||
|
|
1058
|
+
status === 'remote-cache'
|
|
1059
|
+
? 0
|
|
1060
|
+
: 1,
|
|
1061
|
+
});
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
if (tasksToReport.length > 0) {
|
|
1065
|
+
await this.options.lifeCycle.endTasks(tasksToReport, { groupId });
|
|
1066
|
+
}
|
|
1067
|
+
// 2. Mark complete in scheduler
|
|
1068
|
+
this.tasksSchedule.complete(taskIds);
|
|
1069
|
+
// 3. Set completedTasks + update TUI + collect dependent tasks to skip
|
|
1070
|
+
const dependentTasksToSkip = [];
|
|
1071
|
+
for (const { task, status, displayStatus } of results) {
|
|
1072
|
+
if (this.completedTasks.has(task.id))
|
|
1073
|
+
continue;
|
|
1074
|
+
this.completedTasks.set(task.id, status);
|
|
1075
|
+
this.taskInvocationTracker?.unregisterTask(task.id);
|
|
1076
|
+
this.registeredInvocations.delete(task.id);
|
|
1077
|
+
if (this.tuiEnabled) {
|
|
1078
|
+
this.options.lifeCycle.setTaskStatus(task.id, displayStatus ?? (0, native_1.parseTaskStatus)(status));
|
|
1079
|
+
}
|
|
1080
|
+
if (status === 'failure' ||
|
|
1081
|
+
status === 'skipped' ||
|
|
1082
|
+
status === 'stopped') {
|
|
1083
|
+
if (this.bail) {
|
|
1084
|
+
// mark the execution as bailed which will stop all further execution
|
|
1085
|
+
// only the tasks that are currently running will finish
|
|
1086
|
+
this.bailed = true;
|
|
1087
|
+
}
|
|
1088
|
+
else {
|
|
1089
|
+
// Collect reverse deps to skip
|
|
1090
|
+
for (const depTaskId of this.reverseTaskDeps[task.id]) {
|
|
1091
|
+
const depTask = this.taskGraph.tasks[depTaskId];
|
|
1092
|
+
if (depTask) {
|
|
1093
|
+
// Don't skip tasks that are still running/stopping — their own
|
|
1094
|
+
// exit handler will set the correct terminal status
|
|
1095
|
+
if (this.runningDiscreteTasks.has(depTaskId) ||
|
|
1096
|
+
this.runningContinuousTasks.has(depTaskId)) {
|
|
1097
|
+
continue;
|
|
1098
|
+
}
|
|
1099
|
+
dependentTasksToSkip.push({ task: depTask, status: 'skipped' });
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
// 4. Skip dependent tasks
|
|
1106
|
+
if (dependentTasksToSkip.length > 0) {
|
|
1107
|
+
await this.completeTasks(dependentTasksToSkip, groupId);
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
//endregion Lifecycle
|
|
1111
|
+
// region utils
|
|
1112
|
+
async pipeOutputCapture(task) {
|
|
1113
|
+
try {
|
|
1114
|
+
if (process.env.NX_NATIVE_COMMAND_RUNNER !== 'false') {
|
|
1115
|
+
return true;
|
|
1116
|
+
}
|
|
1117
|
+
// When TUI is enabled, we need to use pipe output capture to support
|
|
1118
|
+
// progressive output streaming via the onOutput callback
|
|
1119
|
+
if (this.tuiEnabled) {
|
|
1120
|
+
return true;
|
|
1121
|
+
}
|
|
1122
|
+
const { schema } = (0, utils_1.getExecutorForTask)(task, this.projects);
|
|
1123
|
+
return (schema.outputCapture === 'pipe' ||
|
|
1124
|
+
process.env.NX_STREAM_OUTPUT === 'true');
|
|
1125
|
+
}
|
|
1126
|
+
catch (e) {
|
|
1127
|
+
return false;
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
shouldCacheTaskResult(task, code) {
|
|
1131
|
+
return (task.cache &&
|
|
1132
|
+
(process.env.NX_CACHE_FAILURES == 'true' ? true : code === 0));
|
|
1133
|
+
}
|
|
1134
|
+
closeGroup() {
|
|
1135
|
+
for (let i = 0; i < this.options.parallel; i++) {
|
|
1136
|
+
if (!this.groups[i]) {
|
|
1137
|
+
this.groups[i] = true;
|
|
1138
|
+
return i;
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
openGroup(id) {
|
|
1143
|
+
this.groups[id] = false;
|
|
1144
|
+
}
|
|
1145
|
+
async shouldCopyOutputsFromCacheBatch(tasks) {
|
|
1146
|
+
const resultMap = new Map();
|
|
1147
|
+
if (tasks.length === 0)
|
|
1148
|
+
return resultMap;
|
|
1149
|
+
if (this.daemon?.enabled()) {
|
|
1150
|
+
const matches = await this.daemon.outputsHashesMatchBatch(tasks);
|
|
1151
|
+
for (let i = 0; i < tasks.length; i++) {
|
|
1152
|
+
resultMap.set(tasks[i].hash, !matches[i]);
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
else {
|
|
1156
|
+
// No daemon → can't verify on-disk outputs, always copy.
|
|
1157
|
+
for (const task of tasks) {
|
|
1158
|
+
resultMap.set(task.hash, true);
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
return resultMap;
|
|
1162
|
+
}
|
|
1163
|
+
async recordOutputsHashBatch(entries) {
|
|
1164
|
+
if (this.daemon?.enabled()) {
|
|
1165
|
+
return this.daemon.recordOutputsHashBatch(entries);
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
// endregion utils
|
|
1169
|
+
async handleContinuousTaskExit(code, task, groupId, ownsRunningTasksService) {
|
|
1170
|
+
// If cleanup already completed this task, nothing left to do
|
|
1171
|
+
if (this.completedTasks.has(task.id)) {
|
|
1172
|
+
return;
|
|
1173
|
+
}
|
|
1174
|
+
const stoppingReason = this.runningContinuousTasks.get(task.id)?.stoppingReason;
|
|
1175
|
+
if (stoppingReason || exit_codes_1.EXPECTED_TERMINATION_SIGNALS.has(code)) {
|
|
1176
|
+
const reason = stoppingReason === 'fulfilled' ? 'fulfilled' : 'interrupted';
|
|
1177
|
+
await this.completeContinuousTask(task, groupId, ownsRunningTasksService, reason);
|
|
1178
|
+
}
|
|
1179
|
+
else if (!this.isContinuousTaskNeeded(task.id)) {
|
|
1180
|
+
// No remaining tasks depend on this — the task was about to be
|
|
1181
|
+
// killed by cleanUpUnneededContinuousTasks anyway.
|
|
1182
|
+
await this.completeContinuousTask(task, groupId, ownsRunningTasksService, 'fulfilled');
|
|
1183
|
+
}
|
|
1184
|
+
else {
|
|
1185
|
+
console.error(`Task "${task.id}" is continuous but exited with code ${code}`);
|
|
1186
|
+
await this.completeContinuousTask(task, groupId, ownsRunningTasksService, 'crashed');
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
isContinuousTaskNeeded(taskId) {
|
|
1190
|
+
return this.tasksSchedule
|
|
1191
|
+
.getIncompleteTasks()
|
|
1192
|
+
.some((t) => this.taskGraph.continuousDependencies[t.id]?.includes(taskId));
|
|
1193
|
+
}
|
|
1194
|
+
async completeContinuousTask(task, groupId, ownsRunningTasksService, reason) {
|
|
1195
|
+
if (this.completedTasks.has(task.id))
|
|
1196
|
+
return;
|
|
1197
|
+
this.runningContinuousTasks.delete(task.id);
|
|
1198
|
+
if (ownsRunningTasksService) {
|
|
1199
|
+
this.runningTasksService?.removeRunningTask(task.id);
|
|
1200
|
+
}
|
|
1201
|
+
task.endTime = Date.now();
|
|
1202
|
+
if (reason === 'fulfilled') {
|
|
1203
|
+
await this.complete([
|
|
1204
|
+
{
|
|
1205
|
+
task,
|
|
1206
|
+
status: 'success',
|
|
1207
|
+
displayStatus: 9 /* NativeTaskStatus.Stopped */,
|
|
1208
|
+
},
|
|
1209
|
+
], groupId);
|
|
1210
|
+
}
|
|
1211
|
+
else if (reason === 'crashed') {
|
|
1212
|
+
await this.complete([{ task, status: 'failure' }], groupId);
|
|
1213
|
+
}
|
|
1214
|
+
else {
|
|
1215
|
+
await this.complete([{ task, status: 'stopped' }], groupId);
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
async cleanup() {
|
|
1219
|
+
if (this.cleanupPromise) {
|
|
1220
|
+
return this.cleanupPromise;
|
|
1221
|
+
}
|
|
1222
|
+
this.cleanupPromise = this.performCleanup();
|
|
1223
|
+
return this.cleanupPromise;
|
|
1224
|
+
}
|
|
1225
|
+
async performCleanup() {
|
|
1226
|
+
// Mark all running tasks for intentional stop
|
|
1227
|
+
const reason = this.stopRequested ? 'interrupted' : 'fulfilled';
|
|
1228
|
+
for (const entry of this.runningContinuousTasks.values()) {
|
|
1229
|
+
entry.stoppingReason = reason;
|
|
1230
|
+
}
|
|
1231
|
+
for (const entry of this.runningDiscreteTasks.values()) {
|
|
1232
|
+
entry.stopping = true;
|
|
1233
|
+
}
|
|
1234
|
+
// Snapshot continuous tasks before clearing the map.
|
|
1235
|
+
// We clear first because complete() -> cleanUpUnneededContinuousTasks()
|
|
1236
|
+
// iterates runningContinuousTasks and would re-kill already-stopping tasks.
|
|
1237
|
+
const continuousSnapshot = Array.from(this.runningContinuousTasks.entries());
|
|
1238
|
+
this.runningContinuousTasks.clear();
|
|
1239
|
+
// Complete continuous tasks directly — don't rely on onExit which may hang
|
|
1240
|
+
// when grandchild processes keep the pty slave fd open.
|
|
1241
|
+
for (const [taskId, { groupId, ownsRunningTasksService },] of continuousSnapshot) {
|
|
1242
|
+
const task = this.taskGraph.tasks[taskId];
|
|
1243
|
+
if (!task)
|
|
1244
|
+
continue;
|
|
1245
|
+
await this.completeContinuousTask(task, groupId, ownsRunningTasksService, reason);
|
|
1246
|
+
}
|
|
1247
|
+
// Kill all processes — await forked runner cleanup for graceful shutdown
|
|
1248
|
+
const forkedCleanup = this.forkedProcessTaskRunner.cleanup();
|
|
1249
|
+
const continuousTaskIds = new Set(continuousSnapshot.map(([id]) => id));
|
|
1250
|
+
await Promise.all([
|
|
1251
|
+
forkedCleanup,
|
|
1252
|
+
...continuousSnapshot.map(async ([taskId, { runningTask }]) => {
|
|
1253
|
+
try {
|
|
1254
|
+
await runningTask.kill();
|
|
1255
|
+
}
|
|
1256
|
+
catch (e) {
|
|
1257
|
+
console.error(`Unable to terminate ${taskId}\nError:`, e);
|
|
1258
|
+
}
|
|
1259
|
+
}),
|
|
1260
|
+
...Array.from(this.runningDiscreteTasks).map(async ([taskId, { runningTask }]) => {
|
|
1261
|
+
try {
|
|
1262
|
+
await runningTask.kill();
|
|
1263
|
+
}
|
|
1264
|
+
catch (e) {
|
|
1265
|
+
console.error(`Unable to terminate ${taskId}\nError:`, e);
|
|
1266
|
+
}
|
|
1267
|
+
}),
|
|
1268
|
+
// Skip tasks already killed via continuousSnapshot to avoid duplicate signals
|
|
1269
|
+
...Array.from(this.runningRunCommandsTasks)
|
|
1270
|
+
.filter(([taskId]) => !continuousTaskIds.has(taskId))
|
|
1271
|
+
.map(async ([taskId, t]) => {
|
|
1272
|
+
try {
|
|
1273
|
+
await t.kill();
|
|
1274
|
+
}
|
|
1275
|
+
catch (e) {
|
|
1276
|
+
console.error(`Unable to terminate ${taskId}\nError:`, e);
|
|
1277
|
+
}
|
|
1278
|
+
}),
|
|
1279
|
+
]);
|
|
1280
|
+
// Discrete exit promises resolve promptly (process kill → getResults →
|
|
1281
|
+
// postRunSteps → resolve). Await them so lifecycle endTasks() completes
|
|
1282
|
+
// before run() returns and endCommand() is called.
|
|
1283
|
+
await Promise.all(this.discreteTaskExitHandled.values());
|
|
1284
|
+
}
|
|
1285
|
+
setupSignalHandlers() {
|
|
1286
|
+
// Use process.on (not once) so the handler stays registered and absorbs
|
|
1287
|
+
// re-raised signals from signal-exit. Without this, signal-exit's handler
|
|
1288
|
+
// sees no remaining listeners after our once-handler auto-removes, and
|
|
1289
|
+
// re-raises the signal — killing the process before async cleanup completes.
|
|
1290
|
+
// The cleanup() idempotency guard (cleanupPromise) prevents double execution.
|
|
1291
|
+
const handleSignal = (signal) => {
|
|
1292
|
+
if (this.stopRequested)
|
|
1293
|
+
return;
|
|
1294
|
+
this.stopRequested = true;
|
|
1295
|
+
if (!this.tuiEnabled) {
|
|
1296
|
+
// Synchronously remove DB entries before async cleanup to prevent
|
|
1297
|
+
// new nx processes from seeing stale "Waiting for ..." messages.
|
|
1298
|
+
for (const [taskId, { ownsRunningTasksService }] of this
|
|
1299
|
+
.runningContinuousTasks) {
|
|
1300
|
+
if (ownsRunningTasksService) {
|
|
1301
|
+
this.runningTasksService?.removeRunningTask(taskId);
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
if (signal === 'SIGINT' && !this.tuiEnabled) {
|
|
1306
|
+
// Silence output — pnpm (and similar wrappers) may exit before nx
|
|
1307
|
+
// finishes cleanup, returning the shell prompt. Any output after
|
|
1308
|
+
// that point would appear after the prompt.
|
|
1309
|
+
const noop = (_chunk, _encoding, callback) => {
|
|
1310
|
+
if (callback)
|
|
1311
|
+
callback();
|
|
1312
|
+
return true;
|
|
1313
|
+
};
|
|
1314
|
+
process.stdout.write = noop;
|
|
1315
|
+
process.stderr.write = noop;
|
|
1316
|
+
}
|
|
1317
|
+
this.cleanup().finally(() => {
|
|
1318
|
+
if (this.resolveStopPromise) {
|
|
1319
|
+
this.resolveStopPromise();
|
|
1320
|
+
}
|
|
1321
|
+
else {
|
|
1322
|
+
process.exit((0, exit_codes_1.signalToCode)(signal));
|
|
1323
|
+
}
|
|
1324
|
+
});
|
|
1325
|
+
};
|
|
1326
|
+
process.on('SIGINT', () => handleSignal('SIGINT'));
|
|
1327
|
+
process.on('SIGTERM', () => handleSignal('SIGTERM'));
|
|
1328
|
+
process.on('SIGHUP', () => handleSignal('SIGHUP'));
|
|
1329
|
+
}
|
|
1330
|
+
cleanUpUnneededContinuousTasks() {
|
|
1331
|
+
const incompleteTasks = this.tasksSchedule.getIncompleteTasks();
|
|
1332
|
+
const neededContinuousTasks = new Set();
|
|
1333
|
+
for (const task of incompleteTasks) {
|
|
1334
|
+
// Keep initiating tasks that are still incomplete
|
|
1335
|
+
if (task.continuous && this.initializingTaskIds.has(task.id)) {
|
|
1336
|
+
neededContinuousTasks.add(task.id);
|
|
1337
|
+
}
|
|
1338
|
+
const continuousDependencies = this.taskGraph.continuousDependencies[task.id];
|
|
1339
|
+
for (const continuousDependency of continuousDependencies) {
|
|
1340
|
+
neededContinuousTasks.add(continuousDependency);
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
for (const [taskId, entry] of this.runningContinuousTasks) {
|
|
1344
|
+
if (!neededContinuousTasks.has(taskId)) {
|
|
1345
|
+
// Mark as intentional kill before calling kill()
|
|
1346
|
+
// onExit will see this and use success/Stopped
|
|
1347
|
+
entry.stoppingReason = 'fulfilled';
|
|
1348
|
+
entry.runningTask.kill();
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
exports.TaskOrchestrator = TaskOrchestrator;
|
|
1354
|
+
function getThreadPoolSize(options, taskGraph) {
|
|
1355
|
+
if (options['parallel'] === 'false' ||
|
|
1356
|
+
options['parallel'] === false) {
|
|
1357
|
+
options['parallel'] = 1;
|
|
1358
|
+
}
|
|
1359
|
+
else if (options['parallel'] === 'true' ||
|
|
1360
|
+
options['parallel'] === true ||
|
|
1361
|
+
options['parallel'] === undefined ||
|
|
1362
|
+
options['parallel'] === '') {
|
|
1363
|
+
options['parallel'] = Number(options['maxParallel'] || 3);
|
|
1364
|
+
}
|
|
1365
|
+
const continuousCount = Object.values(taskGraph.tasks).filter((t) => t.continuous).length;
|
|
1366
|
+
const discrete = options['parallel'];
|
|
1367
|
+
const continuous = continuousCount;
|
|
1368
|
+
const total = discrete + continuous;
|
|
1369
|
+
return { discrete, continuous, total };
|
|
1370
|
+
}
|