@visulima/task-runner 1.0.0-alpha.12 → 1.0.0-alpha.13
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/CHANGELOG.md +7 -0
- package/dist/index.d.ts +33 -1
- package/dist/index.js +1 -1
- package/dist/packem_shared/TaskOrchestrator-CXeojk7n.js +2 -0
- package/dist/packem_shared/{defaultTaskRunner-dptuKcps.js → defaultTaskRunner-Byi0zsgh.js} +2 -2
- package/dist/packem_shared/generateRunSummary-beN13GH4.js +1 -0
- package/dist/packem_shared/resolveCacheMode-DXe7i-tj.js +1 -0
- package/package.json +9 -9
- package/dist/packem_shared/TaskOrchestrator-BfxyRQGb.js +0 -2
- package/dist/packem_shared/generateRunSummary-DXhnX83W.js +0 -1
- package/dist/packem_shared/resolveCacheMode-XhD7mg7G.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## @visulima/task-runner [1.0.0-alpha.13](https://github.com/visulima/visulima/compare/@visulima/task-runner@1.0.0-alpha.12...@visulima/task-runner@1.0.0-alpha.13) (2026-05-11)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* **task-runner:** add resolveTurboEnvCompat helper ([a8e73ef](https://github.com/visulima/visulima/commit/a8e73ef324dd8d1bc1f1f471f59f9292f9f01745))
|
|
6
|
+
* **task-runner:** surface retryAttempts on TaskResult and TaskSummary ([f74e278](https://github.com/visulima/visulima/commit/f74e278fc98052398d46a064ad11e1c9956c9cfd))
|
|
7
|
+
|
|
1
8
|
## @visulima/task-runner [1.0.0-alpha.12](https://github.com/visulima/visulima/compare/@visulima/task-runner@1.0.0-alpha.11...@visulima/task-runner@1.0.0-alpha.12) (2026-05-10)
|
|
2
9
|
|
|
3
10
|
### Features
|
package/dist/index.d.ts
CHANGED
|
@@ -627,6 +627,15 @@ interface TaskResult {
|
|
|
627
627
|
*/
|
|
628
628
|
hadWarnings?: boolean;
|
|
629
629
|
/**
|
|
630
|
+
* Number of times the task was restarted by the retry controller
|
|
631
|
+
* before producing this final result. `0` (or undefined) means the
|
|
632
|
+
* task succeeded or failed on its first attempt; `> 0` means the
|
|
633
|
+
* task eventually produced this status after N restarts. Surfaced
|
|
634
|
+
* to lifecycle reporters and the run summary so a "green" build
|
|
635
|
+
* that masked a flake via retries is still visible to the user.
|
|
636
|
+
*/
|
|
637
|
+
retryAttempts?: number;
|
|
638
|
+
/**
|
|
630
639
|
* Set when the task modified one or more of its own tracked input
|
|
631
640
|
* files during execution. Caching is skipped in this case — the
|
|
632
641
|
* fingerprint captured before the run would mismatch the post-run
|
|
@@ -1231,6 +1240,7 @@ interface TaskExecutionOptions {
|
|
|
1231
1240
|
*/
|
|
1232
1241
|
type TaskExecutor = (task: Task, options: TaskExecutionOptions) => Promise<{
|
|
1233
1242
|
code: number;
|
|
1243
|
+
retryAttempts?: number;
|
|
1234
1244
|
terminalOutput: string;
|
|
1235
1245
|
}>;
|
|
1236
1246
|
/**
|
|
@@ -1541,6 +1551,21 @@ declare const resolveCacheMode: (options: {
|
|
|
1541
1551
|
mode?: CacheMode;
|
|
1542
1552
|
}) => CacheMode;
|
|
1543
1553
|
/**
|
|
1554
|
+
* Fill missing HTTP-backend fields from Turborepo's environment
|
|
1555
|
+
* variables so a workspace migrating from Turbo can keep its existing
|
|
1556
|
+
* CI secrets:
|
|
1557
|
+
*
|
|
1558
|
+
* - `TURBO_API` → `url`
|
|
1559
|
+
* - `TURBO_TOKEN` → `token`
|
|
1560
|
+
* - `TURBO_TEAM` → `teamId`
|
|
1561
|
+
*
|
|
1562
|
+
* Explicit values in `input` always win. Returns `undefined` when
|
|
1563
|
+
* neither config nor env supplies a URL, which is the signal callers
|
|
1564
|
+
* use to mean "no remote cache configured." REAPI users are unaffected
|
|
1565
|
+
* — the env vars are Turborepo-shaped and only resolve `http` fields.
|
|
1566
|
+
*/
|
|
1567
|
+
declare const resolveTurboEnvCompat: (input?: Partial<RemoteCacheOptions>, env?: NodeJS.ProcessEnv) => RemoteCacheOptions | undefined;
|
|
1568
|
+
/**
|
|
1544
1569
|
* Construct the configured remote cache backend. Selects between the
|
|
1545
1570
|
* Turborepo-compatible HTTP client and the Bazel REAPI gRPC client
|
|
1546
1571
|
* via `options.backend`.
|
|
@@ -1976,6 +2001,13 @@ interface TaskSummary {
|
|
|
1976
2001
|
hashDetails: TaskHashDetails | undefined;
|
|
1977
2002
|
/** The task's declared outputs (glob patterns, literals, or `{ auto: true }`). */
|
|
1978
2003
|
outputs: OutputSpec[];
|
|
2004
|
+
/**
|
|
2005
|
+
* Number of times the task was restarted before producing this final
|
|
2006
|
+
* exit code. Omitted when the task completed on its first attempt;
|
|
2007
|
+
* `> 0` means the result is post-retry (a "succeeded after N retries"
|
|
2008
|
+
* pass should still register as a flake observation).
|
|
2009
|
+
*/
|
|
2010
|
+
retryAttempts: number | undefined;
|
|
1979
2011
|
/** Start time (ISO 8601) */
|
|
1980
2012
|
startTime: string | undefined;
|
|
1981
2013
|
/** The task target */
|
|
@@ -3269,4 +3301,4 @@ declare const isLinkedWorktree: (workspaceRoot: string) => boolean;
|
|
|
3269
3301
|
* recreating a fixture at the same path would otherwise leak stale results.
|
|
3270
3302
|
*/
|
|
3271
3303
|
declare const resetWorktreeCache: () => void;
|
|
3272
|
-
export { type ActionResult, type AffectedOptions, type AffectedResult, type AffectedScope, type BlobSource, Cache, type CacheMissReason, type CacheMode, type CacheOptions, type CacheRestoreOptions, type CachedResult, type CasDigest, type ChromeTraceEvent, CompositeLifeCycle, type ConcurrencyGroups, type ConcurrentCloseEvent, type ConcurrentCommandConfig, type ConcurrentCommandInput, type ConcurrentRunResult, type ConcurrentRunnerOptions, ConsoleLifeCycle, type ConstraintViolation, type ConstraintsConfig, DEFAULT_CACHE_DIRECTORY_NAME, type DependencyKindRules, type DependencyType, type DetectedFramework, EmptyLifeCycle, type EnvMatcher, type EnvironmentInput, type ExternalDependencyInput, type FileAccess, FileAccessTracker, type FileSetBase, type FileSetInput, type FileSetPattern, type FileSnapshot, type FingerprintContributor, type FingerprintHook, FingerprintManager, type GraphFormat, type GraphJson, type GraphVisualizerOptions, HttpRemoteCache, INPUT_URI_SCHEMES, InProcessTaskHasher, IncrementalFileHasher, type IncrementalHasherOptions, type InputDefinition, type InputHandlerOptions, type InputUriScheme, InvalidInputUriError, type LifeCycleInterface, LockfileHasher, type LogMode, LogReporter, type NamedInputs, type NodePlatform, type OutputSpec, type PackageLockfileHash, type ParseCommandsOptions, type PartitionOptions, type ProcessEvent, type ProjectConfiguration, type ProjectGraph, type ProjectGraphDependency, type ProjectGraphProjectNode, ReapiRemoteCache, type ReapiRemoteCacheOptions, type RemoteCacheBackend, type RemoteCacheCompression, type RemoteCacheOptions, type RemoteCacheSigning, type ResolvedDependency, type RestartOptions, type RunSummary, type RunSummaryPathOptions, type RuntimeInput, type TagRelationships, type TargetConfiguration, type TargetDependencyConfig, type Task, type TaskExecutionOptions, type TaskExecutor, type TaskFingerprint, type TaskGraph, type TaskHashDetails, type TaskHasher, type TaskHasherOptions, TaskOrchestrator, type TaskOrchestratorOptions, type TaskPriority, type TaskResult, type TaskResults, type TaskRunnerContext, type TaskRunnerOptions, TaskScheduler, type TaskStatus, type TaskSummary, type TaskTarget, type TasksRunner, type TeardownOptions, TerminalBuffer, type TokenContext, type TrackedExecutionResult, TrackedTaskExecutor, type TrackingResult, type TypeBoundaries, V2_AC, V2_CAS, V2_INDEX, V2_ROOT, V2_TMP, type WhenCondition, type WhenContext, type WorkspaceConfiguration, acEntryPath, actionDigestForTaskHash, buildForwardDependencyMap, buildReverseDependencyMap, casBlobPath, collectFiles, computeTaskHash, containsBlob, containsByTaskHash, createFailureResult, createInputHandler, createLogReporter, createRemoteCacheBackend, createTaskGraph, defaultTaskRunner, detectFrameworks, detectScriptShell, digestBuffer, digestFile, enforceProjectConstraints, evaluateWhen, expandAffected, expandArguments, expandShortcut, expandTokens, expandTokensInString, expandWildcard, explainWhen, extractPackageName, fetchBlobToFile, filterAffectedTasks, findCycle, findCycles, formatCacheSize, formatTimingTable, generatePreloadScript, generateRunSummary, getAffectedProjects, getChangedFiles, getCurrentBranch, getDependentTasks, getFrameworkEnvVariables, getLastRunSummaryPath, getLeafTasks, getMainWorktreeRoot, getTaskId, getTransitiveDependencies, hashFile, hashStrings, inferFrameworkEnvPatterns, isLinkedWorktree, isNativeAvailable, loadNativeBindings, logTimings, looksLikeInputUri, makeAcyclic, parseCacheSize, parseCommands, parseInputUri, parseNpmLockfile, parsePartition, parsePnpmLockfile, parseTaskId, parseYarnLockfile, projectGraphToDot, putBlobFromBytes, putBlobFromFile, readLastRunSummary, readPackageDeps, resetBranchCache, resetWorktreeCache, resolveCacheMode, resolveOutputs, resolveTaskCwd, retrieveByTaskHash, reverseTaskGraph, runConcurrentFallback, runConcurrently, runTeardown, sortObjectKeys, storeByTaskHash, stripQuotes, taskHashIndexPath, toChromeTrace, toGraphAscii, toGraphHtml, toGraphJson, toGraphvizDot, touchBlob, uniqueId, verifyBlob, walkTaskGraph, withRestart, writeChromeTrace, writeLastRunSummary, writeRunSummary };
|
|
3304
|
+
export { type ActionResult, type AffectedOptions, type AffectedResult, type AffectedScope, type BlobSource, Cache, type CacheMissReason, type CacheMode, type CacheOptions, type CacheRestoreOptions, type CachedResult, type CasDigest, type ChromeTraceEvent, CompositeLifeCycle, type ConcurrencyGroups, type ConcurrentCloseEvent, type ConcurrentCommandConfig, type ConcurrentCommandInput, type ConcurrentRunResult, type ConcurrentRunnerOptions, ConsoleLifeCycle, type ConstraintViolation, type ConstraintsConfig, DEFAULT_CACHE_DIRECTORY_NAME, type DependencyKindRules, type DependencyType, type DetectedFramework, EmptyLifeCycle, type EnvMatcher, type EnvironmentInput, type ExternalDependencyInput, type FileAccess, FileAccessTracker, type FileSetBase, type FileSetInput, type FileSetPattern, type FileSnapshot, type FingerprintContributor, type FingerprintHook, FingerprintManager, type GraphFormat, type GraphJson, type GraphVisualizerOptions, HttpRemoteCache, INPUT_URI_SCHEMES, InProcessTaskHasher, IncrementalFileHasher, type IncrementalHasherOptions, type InputDefinition, type InputHandlerOptions, type InputUriScheme, InvalidInputUriError, type LifeCycleInterface, LockfileHasher, type LogMode, LogReporter, type NamedInputs, type NodePlatform, type OutputSpec, type PackageLockfileHash, type ParseCommandsOptions, type PartitionOptions, type ProcessEvent, type ProjectConfiguration, type ProjectGraph, type ProjectGraphDependency, type ProjectGraphProjectNode, ReapiRemoteCache, type ReapiRemoteCacheOptions, type RemoteCacheBackend, type RemoteCacheCompression, type RemoteCacheOptions, type RemoteCacheSigning, type ResolvedDependency, type RestartOptions, type RunSummary, type RunSummaryPathOptions, type RuntimeInput, type TagRelationships, type TargetConfiguration, type TargetDependencyConfig, type Task, type TaskExecutionOptions, type TaskExecutor, type TaskFingerprint, type TaskGraph, type TaskHashDetails, type TaskHasher, type TaskHasherOptions, TaskOrchestrator, type TaskOrchestratorOptions, type TaskPriority, type TaskResult, type TaskResults, type TaskRunnerContext, type TaskRunnerOptions, TaskScheduler, type TaskStatus, type TaskSummary, type TaskTarget, type TasksRunner, type TeardownOptions, TerminalBuffer, type TokenContext, type TrackedExecutionResult, TrackedTaskExecutor, type TrackingResult, type TypeBoundaries, V2_AC, V2_CAS, V2_INDEX, V2_ROOT, V2_TMP, type WhenCondition, type WhenContext, type WorkspaceConfiguration, acEntryPath, actionDigestForTaskHash, buildForwardDependencyMap, buildReverseDependencyMap, casBlobPath, collectFiles, computeTaskHash, containsBlob, containsByTaskHash, createFailureResult, createInputHandler, createLogReporter, createRemoteCacheBackend, createTaskGraph, defaultTaskRunner, detectFrameworks, detectScriptShell, digestBuffer, digestFile, enforceProjectConstraints, evaluateWhen, expandAffected, expandArguments, expandShortcut, expandTokens, expandTokensInString, expandWildcard, explainWhen, extractPackageName, fetchBlobToFile, filterAffectedTasks, findCycle, findCycles, formatCacheSize, formatTimingTable, generatePreloadScript, generateRunSummary, getAffectedProjects, getChangedFiles, getCurrentBranch, getDependentTasks, getFrameworkEnvVariables, getLastRunSummaryPath, getLeafTasks, getMainWorktreeRoot, getTaskId, getTransitiveDependencies, hashFile, hashStrings, inferFrameworkEnvPatterns, isLinkedWorktree, isNativeAvailable, loadNativeBindings, logTimings, looksLikeInputUri, makeAcyclic, parseCacheSize, parseCommands, parseInputUri, parseNpmLockfile, parsePartition, parsePnpmLockfile, parseTaskId, parseYarnLockfile, projectGraphToDot, putBlobFromBytes, putBlobFromFile, readLastRunSummary, readPackageDeps, resetBranchCache, resetWorktreeCache, resolveCacheMode, resolveOutputs, resolveTaskCwd, resolveTurboEnvCompat, retrieveByTaskHash, reverseTaskGraph, runConcurrentFallback, runConcurrently, runTeardown, sortObjectKeys, storeByTaskHash, stripQuotes, taskHashIndexPath, toChromeTrace, toGraphAscii, toGraphHtml, toGraphJson, toGraphvizDot, touchBlob, uniqueId, verifyBlob, walkTaskGraph, withRestart, writeChromeTrace, writeLastRunSummary, writeRunSummary };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{buildForwardDependencyMap as o,buildReverseDependencyMap as t,expandAffected as a,filterAffectedTasks as s,getAffectedProjects as p,getChangedFiles as n}from"./packem_shared/buildForwardDependencyMap-w1FVPFdv.js";import{createRemoteCacheBackend as i,resolveCacheMode as f}from"./packem_shared/resolveCacheMode-
|
|
1
|
+
import{buildForwardDependencyMap as o,buildReverseDependencyMap as t,expandAffected as a,filterAffectedTasks as s,getAffectedProjects as p,getChangedFiles as n}from"./packem_shared/buildForwardDependencyMap-w1FVPFdv.js";import{createRemoteCacheBackend as i,resolveCacheMode as f,resolveTurboEnvCompat as c}from"./packem_shared/resolveCacheMode-DXe7i-tj.js";import{actionDigestForTaskHash as x,containsByTaskHash as h,retrieveByTaskHash as d,storeByTaskHash as k}from"./packem_shared/actionDigestForTaskHash-BOL4fZ9v.js";import{HttpRemoteCache as T}from"./packem_shared/HttpRemoteCache-Ch-_9ejF.js";import{ReapiRemoteCache as g}from"./packem_shared/ReapiRemoteCache-B3uQuVqP.js";import{Cache as R,DEFAULT_CACHE_DIRECTORY_NAME as v,formatCacheSize as F,parseCacheSize as B}from"./packem_shared/Cache-C540ZPYk.js";import{digestBuffer as b,digestFile as I}from"./packem_shared/digestBuffer-g11aCaDx.js";import{V2_AC as E,V2_CAS as P,V2_INDEX as H,V2_ROOT as A,V2_TMP as w,acEntryPath as D,casBlobPath as _,taskHashIndexPath as G}from"./packem_shared/V2_ROOT-injxWBrl.js";import{containsBlob as N,fetchBlobToFile as O,putBlobFromBytes as U,putBlobFromFile as V,touchBlob as W,verifyBlob as j}from"./packem_shared/containsBlob-DBWgvkM_.js";import{toChromeTrace as Y,writeChromeTrace as q}from"./packem_shared/toChromeTrace-DxN5NQIU.js";import{parseCommands as K}from"./packem_shared/parseCommands-b1K2vIxj.js";import{runConcurrently as X}from"./packem_shared/runConcurrently-DYbMGyGv.js";import{runConcurrentFallback as $}from"./packem_shared/runConcurrentFallback-Dpqxuyv-.js";import{defaultTaskRunner as re}from"./packem_shared/defaultTaskRunner-Byi0zsgh.js";import{detectScriptShell as te}from"./packem_shared/detectScriptShell-CaTDk5cW.js";import{FileAccessTracker as se,generatePreloadScript as pe}from"./packem_shared/FileAccessTracker-DSNf03JW.js";import{FingerprintManager as me}from"./packem_shared/FingerprintManager-CYW2EwLc.js";import{detectFrameworks as fe,getFrameworkEnvVariables as ce,inferFrameworkEnvPatterns as le}from"./packem_shared/detectFrameworks-WVZJOPgN.js";import{projectGraphToDot as he,toGraphAscii as de,toGraphHtml as ke,toGraphJson as ue,toGraphvizDot as Te}from"./packem_shared/projectGraphToDot-FN6oHDGH.js";import{IncrementalFileHasher as ge}from"./packem_shared/IncrementalFileHasher-CdLXVB5F.js";import{CompositeLifeCycle as Re,ConsoleLifeCycle as ve,EmptyLifeCycle as Fe}from"./packem_shared/CompositeLifeCycle-D0zWvAXJ.js";import{LockfileHasher as Se,extractPackageName as be,parseNpmLockfile as Ie,parsePnpmLockfile as Le,parseYarnLockfile as Ee}from"./packem_shared/extractPackageName-BeL6Gc3a.js";import{LogReporter as He,createLogReporter as Ae}from"./packem_shared/LogReporter-BUPWiXAq.js";import{isNativeAvailable as De,loadNativeBindings as _e}from"./packem_shared/isNativeAvailable-BOavFPX1.js";import{resolveOutputs as Me}from"./packem_shared/resolveOutputs-BBjdaraf.js";import{INPUT_URI_SCHEMES as Oe,InvalidInputUriError as Ue,looksLikeInputUri as Ve,parseInputUri as We}from"./packem_shared/INPUT_URI_SCHEMES-Csrd0tlg.js";import{enforceProjectConstraints as ze}from"./packem_shared/enforceProjectConstraints-dNc1SwRi.js";import{generateRunSummary as qe,getLastRunSummaryPath as Je,readLastRunSummary as Ke,writeLastRunSummary as Qe,writeRunSummary as Xe}from"./packem_shared/generateRunSummary-beN13GH4.js";import{createTaskGraph as $e,getTaskId as er,parseTaskId as rr}from"./packem_shared/createTaskGraph-CEYYI-DL.js";import{findCycle as tr,findCycles as ar,getDependentTasks as sr,getLeafTasks as pr,getTransitiveDependencies as nr,makeAcyclic as mr,reverseTaskGraph as ir,walkTaskGraph as fr}from"./packem_shared/findCycle-BY8-jmzB.js";import{InProcessTaskHasher as lr,computeTaskHash as xr}from"./packem_shared/computeTaskHash-Xxd8v-X3.js";import{TaskOrchestrator as dr}from"./packem_shared/TaskOrchestrator-CXeojk7n.js";import{TaskScheduler as ur,parsePartition as Tr}from"./packem_shared/parsePartition-uzPNgtPp.js";import{TerminalBuffer as gr}from"./packem_shared/TerminalBuffer-BtZy7TpT.js";import{TrackedTaskExecutor as Rr}from"./packem_shared/TrackedTaskExecutor-D3-LNT_d.js";import{d as Fr,j as Br,T as Sr,b as br,E as Ir,v as Lr,h as Er,O as Pr}from"./packem_shared/utils-BH2W5Wml.js";import{evaluateWhen as Ar,explainWhen as wr,getCurrentBranch as Dr,resetBranchCache as _r}from"./packem_shared/getCurrentBranch-D-qoZByx.js";import{getMainWorktreeRoot as Mr,isLinkedWorktree as Nr,resetWorktreeCache as Or}from"./packem_shared/getMainWorktreeRoot-DRN_i8jA.js";import{createInputHandler as Vr}from"./packem_shared/createInputHandler-CkDCpPYy.js";import{expandArguments as jr}from"./packem_shared/expandArguments-4mab7-Ds.js";import{expandShortcut as Yr}from"./packem_shared/expandShortcut-BErNHNXZ.js";import{expandTokens as Jr,expandTokensInString as Kr}from"./packem_shared/expandTokensInString-Cyx0qSFA.js";import{expandWildcard as Xr}from"./packem_shared/expandWildcard-DE0dOOZF.js";import{formatTimingTable as $r,logTimings as eo}from"./packem_shared/formatTimingTable-CP3rsDwf.js";import{runTeardown as oo}from"./packem_shared/runTeardown-DBBpBAyb.js";import{stripQuotes as ao}from"./packem_shared/stripQuotes-jkZb0CL9.js";import{withRestart as po}from"./packem_shared/withRestart-DKtEGsQA.js";export{R as Cache,Re as CompositeLifeCycle,ve as ConsoleLifeCycle,v as DEFAULT_CACHE_DIRECTORY_NAME,Fe as EmptyLifeCycle,se as FileAccessTracker,me as FingerprintManager,T as HttpRemoteCache,Oe as INPUT_URI_SCHEMES,lr as InProcessTaskHasher,ge as IncrementalFileHasher,Ue as InvalidInputUriError,Se as LockfileHasher,He as LogReporter,g as ReapiRemoteCache,dr as TaskOrchestrator,ur as TaskScheduler,gr as TerminalBuffer,Rr as TrackedTaskExecutor,E as V2_AC,P as V2_CAS,H as V2_INDEX,A as V2_ROOT,w as V2_TMP,D as acEntryPath,x as actionDigestForTaskHash,o as buildForwardDependencyMap,t as buildReverseDependencyMap,_ as casBlobPath,Fr as collectFiles,xr as computeTaskHash,N as containsBlob,h as containsByTaskHash,Br as createFailureResult,Vr as createInputHandler,Ae as createLogReporter,i as createRemoteCacheBackend,$e as createTaskGraph,re as defaultTaskRunner,fe as detectFrameworks,te as detectScriptShell,b as digestBuffer,I as digestFile,ze as enforceProjectConstraints,Ar as evaluateWhen,a as expandAffected,jr as expandArguments,Yr as expandShortcut,Jr as expandTokens,Kr as expandTokensInString,Xr as expandWildcard,wr as explainWhen,be as extractPackageName,O as fetchBlobToFile,s as filterAffectedTasks,tr as findCycle,ar as findCycles,F as formatCacheSize,$r as formatTimingTable,pe as generatePreloadScript,qe as generateRunSummary,p as getAffectedProjects,n as getChangedFiles,Dr as getCurrentBranch,sr as getDependentTasks,ce as getFrameworkEnvVariables,Je as getLastRunSummaryPath,pr as getLeafTasks,Mr as getMainWorktreeRoot,er as getTaskId,nr as getTransitiveDependencies,Sr as hashFile,br as hashStrings,le as inferFrameworkEnvPatterns,Nr as isLinkedWorktree,De as isNativeAvailable,_e as loadNativeBindings,eo as logTimings,Ve as looksLikeInputUri,mr as makeAcyclic,B as parseCacheSize,K as parseCommands,We as parseInputUri,Ie as parseNpmLockfile,Tr as parsePartition,Le as parsePnpmLockfile,rr as parseTaskId,Ee as parseYarnLockfile,he as projectGraphToDot,U as putBlobFromBytes,V as putBlobFromFile,Ke as readLastRunSummary,Ir as readPackageDeps,_r as resetBranchCache,Or as resetWorktreeCache,f as resolveCacheMode,Me as resolveOutputs,Lr as resolveTaskCwd,c as resolveTurboEnvCompat,d as retrieveByTaskHash,ir as reverseTaskGraph,$ as runConcurrentFallback,X as runConcurrently,oo as runTeardown,Er as sortObjectKeys,k as storeByTaskHash,ao as stripQuotes,G as taskHashIndexPath,Y as toChromeTrace,de as toGraphAscii,ke as toGraphHtml,ue as toGraphJson,Te as toGraphvizDot,W as touchBlob,Pr as uniqueId,j as verifyBlob,fr as walkTaskGraph,po as withRestart,q as writeChromeTrace,Qe as writeLastRunSummary,Xe as writeRunSummary};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var C=Object.defineProperty;var k=(r,t)=>C(r,"name",{value:t,configurable:!0});import{j as w,v as O,f as R}from"./utils-BH2W5Wml.js";import{resolve as j,join as M}from"@visulima/path";import{retrieveByTaskHash as E,storeByTaskHash as F}from"./actionDigestForTaskHash-BOL4fZ9v.js";import{FingerprintManager as H}from"./FingerprintManager-CYW2EwLc.js";import{generateRunSummary as x,writeLastRunSummary as $,writeRunSummary as I}from"./generateRunSummary-beN13GH4.js";import{computeTaskHash as P}from"./computeTaskHash-Xxd8v-X3.js";import{TrackedTaskExecutor as W}from"./TrackedTaskExecutor-D3-LNT_d.js";import{getCurrentBranch as A,evaluateWhen as L,explainWhen as G}from"./getCurrentBranch-D-qoZByx.js";var N=Object.defineProperty,l=k((r,t)=>N(r,"name",{value:t,configurable:!0}),"l");const z=l(r=>{const t=R();t.update(r.commandHash);for(const s of Object.keys(r.fileHashes).toSorted())t.update(s),t.update(r.fileHashes[s]);for(const s of r.missingFiles)t.update(`missing:${s}`);for(const s of Object.keys(r.directoryListings).toSorted())t.update(`dir:${s}`),t.update(JSON.stringify(r.directoryListings[s]));for(const s of Object.keys(r.envHashes).toSorted())t.update(s),t.update(r.envHashes[s]);return t.digest()},"hashFingerprint"),b=l((r,t)=>{if(!r||r.length===0||!t)return!1;for(const s of r)try{if(new RegExp(s).test(t))return!0}catch{}return!1},"detectWarnings"),g=l(()=>{let r;return{promise:new Promise(t=>{r=t}),resolve:r}},"createDeferred");class Z{static{k(this,"z")}static{l(this,"TaskOrchestrator")}#r;#i;#h;#t;#f;#a;#m;#p;#w;#e;#n;#k;#g;#d;#S;#c;#C;#R;#j;#y;#T;#s=new Map;#M;#v;#O;#o=new Map;#u=g();#l=!1;constructor(t){this.#r=t.taskHasher,this.#i=t.cache,this.#h=t.scheduler,this.#t=t.lifeCycle,this.#f=t.taskExecutor,this.#a=t.workspaceRoot,this.#m=t.skipCache??!1,this.#p=t.captureOutput??!0,this.#w=t.autoFingerprint??!1,this.#k=t.fingerprintEnvPatterns??[],this.#g=t.untrackedEnvVars??[],this.#d=t.cacheDiagnostics??!1,this.#S=t.resolveCommand??void 0,this.#c=t.remoteCache??void 0,this.#C=t.onRemoteUploadError??void 0,this.#R=t.dryRun??!1,this.#j=t.summarize??!1,this.#y=t.dataDirectory,this.#T=t.taskGraph??void 0,this.#M=Date.now(),this.#v=t.alwaysTasks??[],this.#O=t.whenContext??{branch:A(t.workspaceRoot)},this.#w?(this.#e=new H(t.workspaceRoot),this.#n=new W(t.workspaceRoot)):(this.#e=void 0,this.#n=void 0)}async run(){this.#t.startCommand?.();const t=l(()=>{this.#l=!0,this.#n?.killAll()},"signalHandler");process.on("SIGINT",t),process.on("SIGTERM",t);try{await this.#x(),this.#v.length>0&&!this.#l&&await this.#H()}finally{process.removeListener("SIGINT",t),process.removeListener("SIGTERM",t),this.#t.endCommand?.()}if(this.#T&&!this.#l){const s=x(this.#s,this.#T,this.#M);await $(s,this.#a,{dataDirectory:this.#y}),this.#j&&await I(s,this.#a,{dataDirectory:this.#y})}return this.#s}async#H(){for(const t of this.#v){this.#t.scheduleTask?.(t),this.#t.startTasks?.([t]);let s;if(this.#E(t))s=this.#F(t);else{const e=Date.now();try{s=await this.#D(t,e)}catch(i){s=w(t,i,e),this.#s.set(t.id,s)}}this.#t.endTasks?.([s]),s.terminalOutput&&this.#t.printTaskTerminalOutput?.(s.task,s.status,s.terminalOutput)}}async#x(){for(;!this.#h.isComplete()&&!this.#l;){const t=this.#h.getNextBatch();if(t.length===0){if(this.#o.size>0){await this.#u.promise,this.#u=g();continue}if(this.#h.remainingCount>0)throw new Error("Deadlock detected: tasks remain but none can be scheduled. This may indicate a circular dependency.");break}for(const s of t)this.#t.scheduleTask?.(s),this.#h.startTask(s.id);this.#t.startTasks?.(t);for(const s of t){const e=(this.#E(s)?Promise.resolve(this.#F(s)):this.#w?this.#I(s):this.#$(s)).catch(i=>{const a=w(s,i,Date.now());return this.#s.set(s.id,a),a}).then(i=>(this.#o.delete(s.id),this.#h.completeTask(s.id),this.#t.endTasks?.([i]),i.terminalOutput&&this.#t.printTaskTerminalOutput?.(i.task,i.status,i.terminalOutput),this.#u.resolve(),i));this.#o.set(s.id,e)}this.#o.size>0&&(await this.#u.promise,this.#u=g())}this.#o.size>0&&await Promise.all(this.#o.values())}async#$(t){const s=Date.now(),e=await this.#r.hashTask(t),i=P(e);if(Object.assign(t,{hash:i,hashDetails:e}),this.#R)return this.#G(t,s);if(!this.#m&&t.cache!==!1){const h=await this.#i.get(i);if(h)return this.#b(t,h,s);if(this.#c&&await E(this.#c,i,this.#i.cacheDirectory)){const n=await this.#i.get(i);if(n){const c=await this.#b(t,n,s);return c.status="remote-cache",c}}}const a=await this.#D(t,s);return a.code===0&&t.cache!==!1&&t.hash&&this.#c&&F(this.#c,t.hash,this.#i.cacheDirectory,this.#C).catch(()=>{}),a}async#I(t){const s=Date.now();if(!this.#m&&t.cache!==!1){const e=await this.#i.getByTaskId(t.id);if(e?.fingerprint&&this.#e){const i=this.#e.validateCommand(e.fingerprint,`${t.target.project}:${t.target.target}`,t.overrides);if(i)this.#d&&this.#t.printCacheMiss?.(t,this.#e.formatMissReasons([i]));else{const a=await this.#e.validate(e.fingerprint);if(!a)return this.#b(t,e,s);this.#d&&this.#t.printCacheMiss?.(t,this.#e.formatMissReasons(a))}}else this.#d&&!e&&this.#t.printCacheMiss?.(t,`Cache miss reasons:
|
|
2
|
+
- No previous fingerprint found (first run)`)}return this.#W(t,s)}async#b(t,s,e){const i=await this.#i.restoreOutputs(s.hash,t.outputs,t.cacheRestore)?"local-cache":"local-cache-kept-existing",a={code:s.code,endTime:Date.now(),startTime:e,status:i,task:t,terminalOutput:s.terminalOutput};return this.#s.set(t.id,a),a}async#D(t,s){try{const{code:e,retryAttempts:i,terminalOutput:a}=await this.#f(t,{captureOutput:this.#p,cwd:O(this.#a,t)}),h=e===0&&b(t.warningPattern,a),n={code:e,endTime:Date.now(),hadWarnings:h||void 0,retryAttempts:i&&i>0?i:void 0,startTime:s,status:e===0?"success":"failure",task:t,terminalOutput:a};this.#s.set(t.id,n);const c=h&&t.cacheOnWarning===!1;if(e===0&&t.cache!==!1&&t.hash&&!c){const p=await this.#P(t);p.length>0?(n.selfModified=!0,this.#t.printSelfModifyingSkip?.(t,p)):await this.#i.put(t.hash,a,t.outputs,e)}return n}catch(e){const i=w(t,e,s);return this.#s.set(t.id,i),i}}async#P(t){const s=t.hashDetails?.nodes;if(!s||typeof this.#r.rehashFile!="function")return[];const e=this.#r.rehashFile.bind(this.#r),i=Object.entries(s);return(await Promise.all(i.map(async([a,h])=>{const n=j(this.#a,a),c=await e(n);return c!==void 0&&c!==h?a:void 0}))).filter(a=>a!==void 0)}async#W(t,s){if(!this.#e)return this.#D(t,s);const e=`${t.target.project}:${t.target.target}`,i=O(this.#a,t);try{let a,h,n,c=0,p=!1,f,y;const T=this.#S?.(t);if(T&&this.#n?.isTrackingSupported&&this.#n){const o=await this.#n.execute(t,{captureOutput:this.#p,cwd:i},T);a=o.code,h=o.terminalOutput,c=o.accesses.length,p=!0,y=o.accesses.filter(u=>u.type==="write").map(u=>u.path),n=await this.#e.createFingerprint(o.accesses,e,t.overrides,process.env,this.#k,this.#g)}else{const o=await this.#f(t,{captureOutput:this.#p,cwd:i});a=o.code,h=o.terminalOutput,f=o.retryAttempts;const u=await this.#r.hashTask(t),d=Object.keys(u.nodes).map(S=>({path:M(this.#a,S),type:"read"}));n=await this.#e.createFingerprint(d,e,t.overrides,process.env,this.#k,this.#g)}const v=a===0&&b(t.warningPattern,h),m={code:a,endTime:Date.now(),hadWarnings:v||void 0,retryAttempts:f&&f>0?f:void 0,startTime:s,status:a===0?"success":"failure",task:t,terminalOutput:h};this.#s.set(t.id,m);const D=v&&t.cacheOnWarning===!1;if(a===0&&t.cache!==!1&&n&&!D){const o=this.#A(n),u=this.#L(n,p,c);if(o.length>0)m.selfModified=!0,this.#t.printSelfModifyingSkip?.(t,o);else if(u)m.emptyFingerprint=!0,this.#t.printEmptyFingerprintWarning?.(t,u);else{const d=z(n);Object.assign(t,{hash:d}),await this.#i.put(d,h,t.outputs,a,n,y),await this.#i.setTaskIndex(t.id,d)}}return m}catch(a){const h=w(t,a,s);return this.#s.set(t.id,h),h}}#A(t){return t.modifiedInputs??[]}#L(t,s,e){return!s||Object.keys(t.fileHashes).length>0||Object.keys(t.directoryListings).length>0||t.missingFiles.length>0?void 0:e===0?"Tracker observed no workspace file accesses — likely a static binary on a platform without strace. Caching skipped.":"Tracker returned accesses but none fell inside the workspace. Caching skipped to avoid false cache hits."}#G(t,s){const e=t.hash?`[hash: ${t.hash.slice(0,12)}...]`:"[no hash]",i={code:0,endTime:Date.now(),startTime:s,status:"skipped",task:t,terminalOutput:`DRY RUN ${e}`};return this.#s.set(t.id,i),i}#E(t){return t.when?!L(t.when,this.#O):!1}#F(t){const s=G(t.when,this.#O),e=Date.now();this.#t.printWhenSkip?.(t,s);const i={code:0,endTime:e,startTime:e,status:"skipped",task:t,terminalOutput:s?`Skipped: ${s}`:"Skipped by when clause"};return this.#s.set(t.id,i),i}}export{Z as TaskOrchestrator};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var x=Object.defineProperty;var k=(e,a)=>x(e,"name",{value:a,configurable:!0});import{X as D}from"./utils-BH2W5Wml.js";import{createRemoteCacheBackend as F}from"./resolveCacheMode-
|
|
2
|
-
`);return D(Buffer.from(a)).slice(0,16)},"computeGlobalEnvNamespace"),A=m(e=>typeof e=="number"?Math.max(1,e):e===!1?1:3,"resolveParallel"),J=m(async(e,a,o)=>{const{lifeCycle:i,projectGraph:c,taskExecutor:r,taskGraph:n,workspaceRoot:s}=o,v=a.namespaceByGlobalEnv?
|
|
1
|
+
var x=Object.defineProperty;var k=(e,a)=>x(e,"name",{value:a,configurable:!0});import{X as D}from"./utils-BH2W5Wml.js";import{createRemoteCacheBackend as F}from"./resolveCacheMode-DXe7i-tj.js";import{Cache as I}from"./Cache-C540ZPYk.js";import{inferFrameworkEnvPatterns as j}from"./detectFrameworks-WVZJOPgN.js";import{IncrementalFileHasher as H}from"./IncrementalFileHasher-CdLXVB5F.js";import{InProcessTaskHasher as O}from"./computeTaskHash-Xxd8v-X3.js";import{TaskOrchestrator as V}from"./TaskOrchestrator-CXeojk7n.js";import{TaskScheduler as z}from"./parsePartition-uzPNgtPp.js";var G=Object.defineProperty,m=k((e,a)=>G(e,"name",{value:a,configurable:!0}),"i");const P=m(e=>{const a=[],o={};for(const[r,n]of Object.entries(e.tasks))n.always?a.push(n):o[r]=n;if(a.length===0)return{alwaysTasks:[],graph:e};const i=new Set(a.map(r=>r.id)),c={};for(const[r,n]of Object.entries(e.dependencies))i.has(r)||(c[r]=n.filter(s=>!i.has(s)));return{alwaysTasks:a,graph:{dependencies:c,roots:e.roots.filter(r=>!i.has(r)),tasks:o}}},"partitionAlwaysTasks"),S=m(e=>{if(!e||e.length===0)return;const a=[...e].sort().map(o=>`${o}=${process.env[o]??""}`).join(`
|
|
2
|
+
`);return D(Buffer.from(a)).slice(0,16)},"computeGlobalEnvNamespace"),A=m(e=>typeof e=="number"?Math.max(1,e):e===!1?1:3,"resolveParallel"),J=m(async(e,a,o)=>{const{lifeCycle:i,projectGraph:c,taskExecutor:r,taskGraph:n,workspaceRoot:s}=o,v=a.namespaceByGlobalEnv?S(a.globalEnv):void 0,d=new I({cacheDirectory:a.cacheDirectory,cacheNamespace:v,maxCacheAge:a.maxCacheAge,maxCacheSize:a.maxCacheSize,workspaceRoot:s});d.removeOldEntries().catch(()=>{});const p={};for(const[t,h]of Object.entries(c.nodes))p[t]=h.data;const l=a.incrementalFileHashing?new H({workspaceRoot:s}):void 0;l&&await l.load();const w=new O({autoEnvVars:a.autoEnvVars,envVars:a.envVars,frameworkInference:a.frameworkInference,globalEnv:a.globalEnv,globalInputs:a.globalInputs,incrementalHasher:l,namedInputs:a.namedInputs,onFingerprint:a.onFingerprint,projects:p,smartLockfileHashing:a.smartLockfileHashing,targetDefaults:a.targetDefaults,workspaceRoot:s}),{alwaysTasks:y,graph:g}=P(n),E=A(a.parallel),C=new z(g,c,E,a.concurrencyGroups),b=m(t=>{const h=c.nodes[t.target.project]?.data.targets?.[t.target.target],T=a.targetDefaults?.[t.target.target];return h?.command??T?.command},"resolveCommand"),u=a.remoteCache?F(a.remoteCache):void 0;let f=a.fingerprintEnvPatterns??[];if(a.frameworkInference&&a.autoFingerprint){const t=await j(s,p);f=[...new Set([...f,...t])]}const R=new V({alwaysTasks:y,autoFingerprint:a.autoFingerprint,cache:d,cacheDiagnostics:a.cacheDiagnostics,captureOutput:!0,dataDirectory:a.dataDirectory,dryRun:a.dryRun,fingerprintEnvPatterns:f,lifeCycle:i,onRemoteUploadError:a.remoteCache?.onUploadError,remoteCache:u,resolveCommand:a.autoFingerprint?b:void 0,scheduler:C,skipCache:a.skipNxCache,summarize:a.summarize,taskExecutor:r,taskGraph:g,taskHasher:w,untrackedEnvVars:a.untrackedEnvVars,workspaceRoot:s});try{const t=await R.run();return l&&await l.save().catch(()=>{}),t}finally{u&&await u.close().catch(()=>{})}},"defaultTaskRunner");export{J as defaultTaskRunner};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var D=Object.defineProperty;var d=(t,e)=>D(t,"name",{value:e,configurable:!0});import{createRequire as R}from"node:module";import{join as m}from"@visulima/path";import{O as j}from"./utils-BH2W5Wml.js";const _=R(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,O=d(t=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[e,r]=u.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return u.getBuiltinModule(t)}return _(t)},"__cjs_getBuiltinModule"),{mkdir:f,writeFile:y,readFile:b}=O("node:fs/promises");var I=Object.defineProperty,i=d((t,e)=>I(t,"name",{value:e,configurable:!0}),"n");const P=i(t=>{switch(t.status){case"local-cache":case"local-cache-kept-existing":return"HIT";case"remote-cache":return"REMOTE_HIT";case"skipped":return"SKIPPED";default:return"MISS"}},"getCacheStatus"),$=i((t,e,r)=>{const s=Date.now(),n=`${new Date(r).toISOString().replaceAll(/[:.]/g,"-")}_${j()}`,o=[];let l=0,g=0,h=0,S=0;for(const[c,a]of t){const w=e.dependencies[c]??[],v={cacheable:a.task.cache!==!1,cacheStatus:P(a),dependencies:w,duration:a.startTime&&a.endTime?a.endTime-a.startTime:void 0,endTime:a.endTime?new Date(a.endTime).toISOString():void 0,exitCode:a.code,hash:a.task.hash,hashDetails:a.task.hashDetails,outputs:a.task.outputs,retryAttempts:a.retryAttempts,startTime:a.startTime?new Date(a.startTime).toISOString():void 0,target:{configuration:a.task.target.configuration,project:a.task.target.project,target:a.task.target.target},taskId:c};switch(o.push(v),a.status){case"failure":{g+=1;break}case"local-cache":case"local-cache-kept-existing":case"remote-cache":{h+=1;break}case"skipped":{S+=1;break}case"success":{l+=1;break}}}const T=o.toSorted((c,a)=>!c.startTime||!a.startTime?0:c.startTime.localeCompare(a.startTime));return{duration:s-r,endTime:new Date(s).toISOString(),environment:{arch:process.arch,nodeVersion:process.version,platform:process.platform},id:n,startTime:new Date(r).toISOString(),stats:{cached:h,failed:g,skipped:S,succeeded:l,total:t.size},taskGraph:{dependencies:e.dependencies,roots:e.roots},tasks:T}},"generateRunSummary"),L=".task-runner",M="last-summary.json",p=i((t,e)=>e&&e.length>0?e:m(t,L),"resolveDataDirectory"),q=i(async(t,e,r={})=>{const s=m(p(e,r.dataDirectory),"runs");await f(s,{recursive:!0});const n=`${t.id}.json`,o=m(s,n);return await y(o,JSON.stringify(t,void 0,2)),o},"writeRunSummary"),k=i((t,e={})=>m(p(t,e.dataDirectory),M),"getLastRunSummaryPath"),C=i(async(t,e,r={})=>{const s=p(e,r.dataDirectory);await f(s,{recursive:!0});const n=k(e,r);return await y(n,JSON.stringify(t,void 0,2)),n},"writeLastRunSummary"),J=i(async(t,e={})=>{try{const r=await b(k(t,e),"utf8");return JSON.parse(r)}catch{return}},"readLastRunSummary");export{$ as generateRunSummary,k as getLastRunSummaryPath,J as readLastRunSummary,C as writeLastRunSummary,q as writeRunSummary};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var c=Object.defineProperty;var a=(e,t)=>c(e,"name",{value:t,configurable:!0});import{HttpRemoteCache as n}from"./HttpRemoteCache-Ch-_9ejF.js";import{ReapiRemoteCache as m}from"./ReapiRemoteCache-B3uQuVqP.js";var d=Object.defineProperty,o=a((e,t)=>d(e,"name",{value:t,configurable:!0}),"a");const p=o(e=>e.mode??"readwrite","resolveCacheMode"),i=o((e,t=process.env)=>{if((e?.backend??"http")!=="http")return e?.url?e:void 0;const r=e?.url??t.TURBO_API;if(r)return{...e,teamId:e?.teamId??t.TURBO_TEAM,token:e?.token??t.TURBO_TOKEN,url:r}},"resolveTurboEnvCompat"),v=o(e=>{const t=p(e),r={...e,mode:t};switch(e.backend??"http"){case"http":return new n(r);case"reapi":return new m(r);default:return new n(r)}},"createRemoteCacheBackend");export{v as createRemoteCacheBackend,p as resolveCacheMode,i as resolveTurboEnvCompat};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/task-runner",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.13",
|
|
4
4
|
"description": "A task runner with caching support for monorepo workspaces",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cache",
|
|
@@ -70,14 +70,14 @@
|
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
72
|
"optionalDependencies": {
|
|
73
|
-
"@visulima/task-runner-binding-darwin-arm64": "1.0.0-alpha.
|
|
74
|
-
"@visulima/task-runner-binding-darwin-x64": "1.0.0-alpha.
|
|
75
|
-
"@visulima/task-runner-binding-linux-arm64-gnu": "1.0.0-alpha.
|
|
76
|
-
"@visulima/task-runner-binding-linux-
|
|
77
|
-
"@visulima/task-runner-binding-linux-x64-
|
|
78
|
-
"@visulima/task-runner-binding-linux-
|
|
79
|
-
"@visulima/task-runner-binding-win32-arm64-msvc": "1.0.0-alpha.
|
|
80
|
-
"@visulima/task-runner-binding-win32-x64-msvc": "1.0.0-alpha.
|
|
73
|
+
"@visulima/task-runner-binding-darwin-arm64": "1.0.0-alpha.13",
|
|
74
|
+
"@visulima/task-runner-binding-darwin-x64": "1.0.0-alpha.13",
|
|
75
|
+
"@visulima/task-runner-binding-linux-arm64-gnu": "1.0.0-alpha.13",
|
|
76
|
+
"@visulima/task-runner-binding-linux-arm64-musl": "1.0.0-alpha.13",
|
|
77
|
+
"@visulima/task-runner-binding-linux-x64-gnu": "1.0.0-alpha.13",
|
|
78
|
+
"@visulima/task-runner-binding-linux-x64-musl": "1.0.0-alpha.13",
|
|
79
|
+
"@visulima/task-runner-binding-win32-arm64-msvc": "1.0.0-alpha.13",
|
|
80
|
+
"@visulima/task-runner-binding-win32-x64-msvc": "1.0.0-alpha.13"
|
|
81
81
|
},
|
|
82
82
|
"engines": {
|
|
83
83
|
"node": "^22.14.0 || >=24.10.0"
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var S=Object.defineProperty;var m=(r,t)=>S(r,"name",{value:t,configurable:!0});import{j as f,v,f as C}from"./utils-BH2W5Wml.js";import{resolve as R,join as M}from"@visulima/path";import{retrieveByTaskHash as j,storeByTaskHash as E}from"./actionDigestForTaskHash-BOL4fZ9v.js";import{FingerprintManager as F}from"./FingerprintManager-CYW2EwLc.js";import{generateRunSummary as H,writeLastRunSummary as $,writeRunSummary as x}from"./generateRunSummary-DXhnX83W.js";import{computeTaskHash as I}from"./computeTaskHash-Xxd8v-X3.js";import{TrackedTaskExecutor as P}from"./TrackedTaskExecutor-D3-LNT_d.js";import{getCurrentBranch as W,evaluateWhen as L,explainWhen as G}from"./getCurrentBranch-D-qoZByx.js";var N=Object.defineProperty,d=m((r,t)=>N(r,"name",{value:t,configurable:!0}),"l");const B=d(r=>{const t=C();t.update(r.commandHash);for(const s of Object.keys(r.fileHashes).toSorted())t.update(s),t.update(r.fileHashes[s]);for(const s of r.missingFiles)t.update(`missing:${s}`);for(const s of Object.keys(r.directoryListings).toSorted())t.update(`dir:${s}`),t.update(JSON.stringify(r.directoryListings[s]));for(const s of Object.keys(r.envHashes).toSorted())t.update(s),t.update(r.envHashes[s]);return t.digest()},"hashFingerprint"),O=d((r,t)=>{if(!r||r.length===0||!t)return!1;for(const s of r)try{if(new RegExp(s).test(t))return!0}catch{}return!1},"detectWarnings"),w=d(()=>{let r;return{promise:new Promise(t=>{r=t}),resolve:r}},"createDeferred");class X{static{m(this,"$")}static{d(this,"TaskOrchestrator")}#r;#i;#h;#t;#f;#a;#m;#p;#w;#e;#n;#k;#g;#d;#S;#c;#C;#R;#M;#y;#T;#s=new Map;#j;#v;#O;#o=new Map;#u=w();#l=!1;constructor(t){this.#r=t.taskHasher,this.#i=t.cache,this.#h=t.scheduler,this.#t=t.lifeCycle,this.#f=t.taskExecutor,this.#a=t.workspaceRoot,this.#m=t.skipCache??!1,this.#p=t.captureOutput??!0,this.#w=t.autoFingerprint??!1,this.#k=t.fingerprintEnvPatterns??[],this.#g=t.untrackedEnvVars??[],this.#d=t.cacheDiagnostics??!1,this.#S=t.resolveCommand??void 0,this.#c=t.remoteCache??void 0,this.#C=t.onRemoteUploadError??void 0,this.#R=t.dryRun??!1,this.#M=t.summarize??!1,this.#y=t.dataDirectory,this.#T=t.taskGraph??void 0,this.#j=Date.now(),this.#v=t.alwaysTasks??[],this.#O=t.whenContext??{branch:W(t.workspaceRoot)},this.#w?(this.#e=new F(t.workspaceRoot),this.#n=new P(t.workspaceRoot)):(this.#e=void 0,this.#n=void 0)}async run(){this.#t.startCommand?.();const t=d(()=>{this.#l=!0,this.#n?.killAll()},"signalHandler");process.on("SIGINT",t),process.on("SIGTERM",t);try{await this.#$(),this.#v.length>0&&!this.#l&&await this.#H()}finally{process.removeListener("SIGINT",t),process.removeListener("SIGTERM",t),this.#t.endCommand?.()}if(this.#T&&!this.#l){const s=H(this.#s,this.#T,this.#j);await $(s,this.#a,{dataDirectory:this.#y}),this.#M&&await x(s,this.#a,{dataDirectory:this.#y})}return this.#s}async#H(){for(const t of this.#v){this.#t.scheduleTask?.(t),this.#t.startTasks?.([t]);let s;if(this.#E(t))s=this.#F(t);else{const e=Date.now();try{s=await this.#b(t,e)}catch(i){s=f(t,i,e),this.#s.set(t.id,s)}}this.#t.endTasks?.([s]),s.terminalOutput&&this.#t.printTaskTerminalOutput?.(s.task,s.status,s.terminalOutput)}}async#$(){for(;!this.#h.isComplete()&&!this.#l;){const t=this.#h.getNextBatch();if(t.length===0){if(this.#o.size>0){await this.#u.promise,this.#u=w();continue}if(this.#h.remainingCount>0)throw new Error("Deadlock detected: tasks remain but none can be scheduled. This may indicate a circular dependency.");break}for(const s of t)this.#t.scheduleTask?.(s),this.#h.startTask(s.id);this.#t.startTasks?.(t);for(const s of t){const e=(this.#E(s)?Promise.resolve(this.#F(s)):this.#w?this.#I(s):this.#x(s)).catch(i=>{const a=f(s,i,Date.now());return this.#s.set(s.id,a),a}).then(i=>(this.#o.delete(s.id),this.#h.completeTask(s.id),this.#t.endTasks?.([i]),i.terminalOutput&&this.#t.printTaskTerminalOutput?.(i.task,i.status,i.terminalOutput),this.#u.resolve(),i));this.#o.set(s.id,e)}this.#o.size>0&&(await this.#u.promise,this.#u=w())}this.#o.size>0&&await Promise.all(this.#o.values())}async#x(t){const s=Date.now(),e=await this.#r.hashTask(t),i=I(e);if(Object.assign(t,{hash:i,hashDetails:e}),this.#R)return this.#N(t,s);if(!this.#m&&t.cache!==!1){const h=await this.#i.get(i);if(h)return this.#D(t,h,s);if(this.#c&&await j(this.#c,i,this.#i.cacheDirectory)){const n=await this.#i.get(i);if(n){const o=await this.#D(t,n,s);return o.status="remote-cache",o}}}const a=await this.#b(t,s);return a.code===0&&t.cache!==!1&&t.hash&&this.#c&&E(this.#c,t.hash,this.#i.cacheDirectory,this.#C).catch(()=>{}),a}async#I(t){const s=Date.now();if(!this.#m&&t.cache!==!1){const e=await this.#i.getByTaskId(t.id);if(e?.fingerprint&&this.#e){const i=this.#e.validateCommand(e.fingerprint,`${t.target.project}:${t.target.target}`,t.overrides);if(i)this.#d&&this.#t.printCacheMiss?.(t,this.#e.formatMissReasons([i]));else{const a=await this.#e.validate(e.fingerprint);if(!a)return this.#D(t,e,s);this.#d&&this.#t.printCacheMiss?.(t,this.#e.formatMissReasons(a))}}else this.#d&&!e&&this.#t.printCacheMiss?.(t,`Cache miss reasons:
|
|
2
|
-
- No previous fingerprint found (first run)`)}return this.#W(t,s)}async#D(t,s,e){const i=await this.#i.restoreOutputs(s.hash,t.outputs,t.cacheRestore)?"local-cache":"local-cache-kept-existing",a={code:s.code,endTime:Date.now(),startTime:e,status:i,task:t,terminalOutput:s.terminalOutput};return this.#s.set(t.id,a),a}async#b(t,s){try{const{code:e,terminalOutput:i}=await this.#f(t,{captureOutput:this.#p,cwd:v(this.#a,t)}),a=e===0&&O(t.warningPattern,i),h={code:e,endTime:Date.now(),hadWarnings:a||void 0,startTime:s,status:e===0?"success":"failure",task:t,terminalOutput:i};this.#s.set(t.id,h);const n=a&&t.cacheOnWarning===!1;if(e===0&&t.cache!==!1&&t.hash&&!n){const o=await this.#P(t);o.length>0?(h.selfModified=!0,this.#t.printSelfModifyingSkip?.(t,o)):await this.#i.put(t.hash,i,t.outputs,e)}return h}catch(e){const i=f(t,e,s);return this.#s.set(t.id,i),i}}async#P(t){const s=t.hashDetails?.nodes;if(!s||typeof this.#r.rehashFile!="function")return[];const e=this.#r.rehashFile.bind(this.#r),i=Object.entries(s);return(await Promise.all(i.map(async([a,h])=>{const n=R(this.#a,a),o=await e(n);return o!==void 0&&o!==h?a:void 0}))).filter(a=>a!==void 0)}async#W(t,s){if(!this.#e)return this.#b(t,s);const e=`${t.target.project}:${t.target.target}`,i=v(this.#a,t);try{let a,h,n,o=0,k=!1,g;const y=this.#S?.(t);if(y&&this.#n?.isTrackingSupported&&this.#n){const c=await this.#n.execute(t,{captureOutput:this.#p,cwd:i},y);a=c.code,h=c.terminalOutput,o=c.accesses.length,k=!0,g=c.accesses.filter(u=>u.type==="write").map(u=>u.path),n=await this.#e.createFingerprint(c.accesses,e,t.overrides,process.env,this.#k,this.#g)}else{const c=await this.#f(t,{captureOutput:this.#p,cwd:i});a=c.code,h=c.terminalOutput;const u=await this.#r.hashTask(t),p=Object.keys(u.nodes).map(b=>({path:M(this.#a,b),type:"read"}));n=await this.#e.createFingerprint(p,e,t.overrides,process.env,this.#k,this.#g)}const T=a===0&&O(t.warningPattern,h),l={code:a,endTime:Date.now(),hadWarnings:T||void 0,startTime:s,status:a===0?"success":"failure",task:t,terminalOutput:h};this.#s.set(t.id,l);const D=T&&t.cacheOnWarning===!1;if(a===0&&t.cache!==!1&&n&&!D){const c=this.#L(n),u=this.#G(n,k,o);if(c.length>0)l.selfModified=!0,this.#t.printSelfModifyingSkip?.(t,c);else if(u)l.emptyFingerprint=!0,this.#t.printEmptyFingerprintWarning?.(t,u);else{const p=B(n);Object.assign(t,{hash:p}),await this.#i.put(p,h,t.outputs,a,n,g),await this.#i.setTaskIndex(t.id,p)}}return l}catch(a){const h=f(t,a,s);return this.#s.set(t.id,h),h}}#L(t){return t.modifiedInputs??[]}#G(t,s,e){return!s||Object.keys(t.fileHashes).length>0||Object.keys(t.directoryListings).length>0||t.missingFiles.length>0?void 0:e===0?"Tracker observed no workspace file accesses — likely a static binary on a platform without strace. Caching skipped.":"Tracker returned accesses but none fell inside the workspace. Caching skipped to avoid false cache hits."}#N(t,s){const e=t.hash?`[hash: ${t.hash.slice(0,12)}...]`:"[no hash]",i={code:0,endTime:Date.now(),startTime:s,status:"skipped",task:t,terminalOutput:`DRY RUN ${e}`};return this.#s.set(t.id,i),i}#E(t){return t.when?!L(t.when,this.#O):!1}#F(t){const s=G(t.when,this.#O),e=Date.now();this.#t.printWhenSkip?.(t,s);const i={code:0,endTime:e,startTime:e,status:"skipped",task:t,terminalOutput:s?`Skipped: ${s}`:"Skipped by when clause"};return this.#s.set(t.id,i),i}}export{X as TaskOrchestrator};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var _=Object.defineProperty;var d=(t,e)=>_(t,"name",{value:e,configurable:!0});import{createRequire as D}from"node:module";import{join as m}from"@visulima/path";import{O as j}from"./utils-BH2W5Wml.js";const R=D(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,O=d(t=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[e,r]=u.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return u.getBuiltinModule(t)}return R(t)},"__cjs_getBuiltinModule"),{mkdir:f,writeFile:y,readFile:b}=O("node:fs/promises");var I=Object.defineProperty,i=d((t,e)=>I(t,"name",{value:e,configurable:!0}),"s");const P=i(t=>{switch(t.status){case"local-cache":case"local-cache-kept-existing":return"HIT";case"remote-cache":return"REMOTE_HIT";case"skipped":return"SKIPPED";default:return"MISS"}},"getCacheStatus"),q=i((t,e,r)=>{const s=Date.now(),n=`${new Date(r).toISOString().replaceAll(/[:.]/g,"-")}_${j()}`,o=[];let p=0,g=0,h=0,S=0;for(const[c,a]of t){const w=e.dependencies[c]??[],v={cacheable:a.task.cache!==!1,cacheStatus:P(a),dependencies:w,duration:a.startTime&&a.endTime?a.endTime-a.startTime:void 0,endTime:a.endTime?new Date(a.endTime).toISOString():void 0,exitCode:a.code,hash:a.task.hash,hashDetails:a.task.hashDetails,outputs:a.task.outputs,startTime:a.startTime?new Date(a.startTime).toISOString():void 0,target:{configuration:a.task.target.configuration,project:a.task.target.project,target:a.task.target.target},taskId:c};switch(o.push(v),a.status){case"failure":{g+=1;break}case"local-cache":case"local-cache-kept-existing":case"remote-cache":{h+=1;break}case"skipped":{S+=1;break}case"success":{p+=1;break}}}const T=o.toSorted((c,a)=>!c.startTime||!a.startTime?0:c.startTime.localeCompare(a.startTime));return{duration:s-r,endTime:new Date(s).toISOString(),environment:{arch:process.arch,nodeVersion:process.version,platform:process.platform},id:n,startTime:new Date(r).toISOString(),stats:{cached:h,failed:g,skipped:S,succeeded:p,total:t.size},taskGraph:{dependencies:e.dependencies,roots:e.roots},tasks:T}},"generateRunSummary"),L=".task-runner",M="last-summary.json",l=i((t,e)=>e&&e.length>0?e:m(t,L),"resolveDataDirectory"),C=i(async(t,e,r={})=>{const s=m(l(e,r.dataDirectory),"runs");await f(s,{recursive:!0});const n=`${t.id}.json`,o=m(s,n);return await y(o,JSON.stringify(t,void 0,2)),o},"writeRunSummary"),k=i((t,e={})=>m(l(t,e.dataDirectory),M),"getLastRunSummaryPath"),J=i(async(t,e,r={})=>{const s=l(e,r.dataDirectory);await f(s,{recursive:!0});const n=k(e,r);return await y(n,JSON.stringify(t,void 0,2)),n},"writeLastRunSummary"),B=i(async(t,e={})=>{try{const r=await b(k(t,e),"utf8");return JSON.parse(r)}catch{return}},"readLastRunSummary");export{q as generateRunSummary,k as getLastRunSummaryPath,B as readLastRunSummary,J as writeLastRunSummary,C as writeRunSummary};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var n=Object.defineProperty;var a=(e,t)=>n(e,"name",{value:t,configurable:!0});import{HttpRemoteCache as o}from"./HttpRemoteCache-Ch-_9ejF.js";import{ReapiRemoteCache as m}from"./ReapiRemoteCache-B3uQuVqP.js";var d=Object.defineProperty,c=a((e,t)=>d(e,"name",{value:t,configurable:!0}),"c");const h=c(e=>e.mode??"readwrite","resolveCacheMode"),u=c(e=>{const t=h(e),r={...e,mode:t};switch(e.backend??"http"){case"http":return new o(r);case"reapi":return new m(r);default:return new o(r)}},"createRemoteCacheBackend");export{u as createRemoteCacheBackend,h as resolveCacheMode};
|