@visulima/task-runner 1.0.0-alpha.11 → 1.0.0-alpha.12
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 +6 -0
- package/dist/index.d.ts +73 -1
- package/dist/index.js +1 -1
- package/dist/packem_shared/{TaskOrchestrator-C-I6WsBx.js → TaskOrchestrator-BfxyRQGb.js} +1 -1
- package/dist/packem_shared/computeTaskHash-Xxd8v-X3.js +1 -0
- package/dist/packem_shared/defaultTaskRunner-dptuKcps.js +2 -0
- package/dist/packem_shared/runConcurrently-DYbMGyGv.js +1 -0
- package/dist/packem_shared/withRestart-DKtEGsQA.js +1 -0
- package/package.json +9 -9
- package/dist/packem_shared/computeTaskHash-DtCdMJFf.js +0 -1
- package/dist/packem_shared/defaultTaskRunner-CARb5zK7.js +0 -2
- package/dist/packem_shared/runConcurrently-CxyC5yGT.js +0 -1
- package/dist/packem_shared/withRestart-CWO6BKv_.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## @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
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* **task-runner:** add onRetry + onFingerprint hooks ([7e9dadf](https://github.com/visulima/visulima/commit/7e9dadfbe7101fd9b2878eb881d16c3ff5d766ac))
|
|
6
|
+
|
|
1
7
|
## @visulima/task-runner [1.0.0-alpha.11](https://github.com/visulima/visulima/compare/@visulima/task-runner@1.0.0-alpha.10...@visulima/task-runner@1.0.0-alpha.11) (2026-05-10)
|
|
2
8
|
|
|
3
9
|
### Features
|
package/dist/index.d.ts
CHANGED
|
@@ -1132,6 +1132,21 @@ interface TaskRunnerOptions {
|
|
|
1132
1132
|
* @default false
|
|
1133
1133
|
*/
|
|
1134
1134
|
namespaceByGlobalEnv?: boolean;
|
|
1135
|
+
/**
|
|
1136
|
+
* Plugin extension point invoked during task fingerprinting. Fires
|
|
1137
|
+
* once per task after the built-in inputs (filesets, runtime, env)
|
|
1138
|
+
* have been gathered and before the hash is sealed. Contributions
|
|
1139
|
+
* made through the supplied {@link FingerprintContributor} are mixed
|
|
1140
|
+
* deterministically into the final hash.
|
|
1141
|
+
*
|
|
1142
|
+
* Throwing aborts fingerprinting for that task — the task fails
|
|
1143
|
+
* before any cache lookup runs, so a buggy plugin can't silently
|
|
1144
|
+
* corrupt cache state.
|
|
1145
|
+
*
|
|
1146
|
+
* Wired by `vis` to bridge into the `task:fingerprint` hook;
|
|
1147
|
+
* standalone task-runner consumers can pass a callback directly.
|
|
1148
|
+
*/
|
|
1149
|
+
onFingerprint?: FingerprintHook;
|
|
1135
1150
|
/** Maximum number of parallel tasks */
|
|
1136
1151
|
parallel?: number | boolean;
|
|
1137
1152
|
/**
|
|
@@ -1171,6 +1186,34 @@ interface TaskRunnerOptions {
|
|
|
1171
1186
|
untrackedEnvVars?: string[];
|
|
1172
1187
|
}
|
|
1173
1188
|
/**
|
|
1189
|
+
* Handle handed to plugin fingerprint hooks. Plugins call
|
|
1190
|
+
* `contribute(key, value)` to mix extra strings into the task hash —
|
|
1191
|
+
* the hasher merges contributions into a deterministic, sorted bucket
|
|
1192
|
+
* so registration order doesn't change the resulting hash.
|
|
1193
|
+
*
|
|
1194
|
+
* Re-contributing the same key overwrites the previous value (last
|
|
1195
|
+
* write wins). Plugins that need isolation should namespace their
|
|
1196
|
+
* keys (e.g. `my-plugin:setting`).
|
|
1197
|
+
*/
|
|
1198
|
+
interface FingerprintContributor {
|
|
1199
|
+
/**
|
|
1200
|
+
* Mix `value` into the task fingerprint under `key`. Both are
|
|
1201
|
+
* arbitrary strings; the hasher runs them through xxh3 alongside
|
|
1202
|
+
* the built-in inputs.
|
|
1203
|
+
*/
|
|
1204
|
+
contribute: (key: string, value: string) => void;
|
|
1205
|
+
}
|
|
1206
|
+
/**
|
|
1207
|
+
* Plugin callback fired during fingerprint construction, after all
|
|
1208
|
+
* built-in inputs (filesets, runtime, env) have been gathered and
|
|
1209
|
+
* before the final hash is sealed. Contributions made via the supplied
|
|
1210
|
+
* {@link FingerprintContributor} are mixed into the hash.
|
|
1211
|
+
*
|
|
1212
|
+
* Throwing aborts hashing for that task — the task fails before any
|
|
1213
|
+
* cache lookup, so a buggy plugin doesn't quietly corrupt cache state.
|
|
1214
|
+
*/
|
|
1215
|
+
type FingerprintHook = (task: Task, contributor: FingerprintContributor) => Promise<void> | void;
|
|
1216
|
+
/**
|
|
1174
1217
|
* Options for executing a task.
|
|
1175
1218
|
*/
|
|
1176
1219
|
interface TaskExecutionOptions {
|
|
@@ -1272,6 +1315,13 @@ interface ConcurrentRunnerOptions {
|
|
|
1272
1315
|
restart?: {
|
|
1273
1316
|
/** Delay between restarts in ms. "exponential" for 2^attempt * 1000ms. */
|
|
1274
1317
|
delay?: number | "exponential";
|
|
1318
|
+
/**
|
|
1319
|
+
* Optional pre-restart callback. Fires once per scheduled retry,
|
|
1320
|
+
* after the failed attempt is detected and before the restart
|
|
1321
|
+
* delay sleeps. `attempt` is 1-indexed and counts the retry that's
|
|
1322
|
+
* about to start. Throwing aborts the entire restart batch.
|
|
1323
|
+
*/
|
|
1324
|
+
onRetry?: (attempt: number, commandIndex: number, prevExitCode: number) => Promise<void> | void;
|
|
1275
1325
|
/** Maximum restart attempts per command. 0 = no restarts. -1 = infinite. */
|
|
1276
1326
|
tries: number;
|
|
1277
1327
|
};
|
|
@@ -2288,6 +2338,22 @@ declare const logTimings: (closeEvents: ConcurrentCloseEvent[], output?: NodeJS.
|
|
|
2288
2338
|
interface RestartOptions {
|
|
2289
2339
|
/** Delay between restarts in milliseconds. "exponential" for 2^attempt * 1000ms. */
|
|
2290
2340
|
delay: number | "exponential";
|
|
2341
|
+
/**
|
|
2342
|
+
* Optional pre-restart callback. Fires once per scheduled retry,
|
|
2343
|
+
* **after** the failed attempt is detected and **before** the restart
|
|
2344
|
+
* delay sleeps — giving callers a chance to log, emit metrics, or
|
|
2345
|
+
* abort the retry by throwing.
|
|
2346
|
+
*
|
|
2347
|
+
* `attempt` is 1-indexed and counts the retry that's about to start
|
|
2348
|
+
* (the original failed run was attempt 0). `commandIndex` matches
|
|
2349
|
+
* the position of the failing command in the input array.
|
|
2350
|
+
*
|
|
2351
|
+
* Throwing aborts the entire `withRestart` batch — the rejection
|
|
2352
|
+
* surfaces from `runConcurrently` to the caller, mirroring the
|
|
2353
|
+
* existing error path. Use this to gate retries on external state
|
|
2354
|
+
* (budget exhaustion, circuit breakers).
|
|
2355
|
+
*/
|
|
2356
|
+
onRetry?: (attempt: number, commandIndex: number, prevExitCode: number) => Promise<void> | void;
|
|
2291
2357
|
/** Maximum number of restart attempts per command. 0 = no restarts. -1 = infinite. */
|
|
2292
2358
|
tries: number;
|
|
2293
2359
|
}
|
|
@@ -2906,6 +2972,12 @@ interface TaskHasherOptions {
|
|
|
2906
2972
|
incrementalHasher?: IncrementalFileHasher;
|
|
2907
2973
|
/** Named input definitions */
|
|
2908
2974
|
namedInputs?: NamedInputs;
|
|
2975
|
+
/**
|
|
2976
|
+
* Plugin hook fired during fingerprint construction. See
|
|
2977
|
+
* {@link FingerprintHook} for the contract — throwing aborts
|
|
2978
|
+
* hashing for the offending task.
|
|
2979
|
+
*/
|
|
2980
|
+
onFingerprint?: FingerprintHook;
|
|
2909
2981
|
/** Project configurations keyed by project name */
|
|
2910
2982
|
projects: Record<string, ProjectConfiguration>;
|
|
2911
2983
|
/**
|
|
@@ -3197,4 +3269,4 @@ declare const isLinkedWorktree: (workspaceRoot: string) => boolean;
|
|
|
3197
3269
|
* recreating a fixture at the same path would otherwise leak stale results.
|
|
3198
3270
|
*/
|
|
3199
3271
|
declare const resetWorktreeCache: () => void;
|
|
3200
|
-
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, 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 };
|
|
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 };
|
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-XhD7mg7G.js";import{actionDigestForTaskHash as l,containsByTaskHash as x,retrieveByTaskHash as h,storeByTaskHash as d}from"./packem_shared/actionDigestForTaskHash-BOL4fZ9v.js";import{HttpRemoteCache as u}from"./packem_shared/HttpRemoteCache-Ch-_9ejF.js";import{ReapiRemoteCache as C}from"./packem_shared/ReapiRemoteCache-B3uQuVqP.js";import{Cache as y,DEFAULT_CACHE_DIRECTORY_NAME as R,formatCacheSize as F,parseCacheSize as v}from"./packem_shared/Cache-C540ZPYk.js";import{digestBuffer as S,digestFile as I}from"./packem_shared/digestBuffer-g11aCaDx.js";import{V2_AC as b,V2_CAS as P,V2_INDEX as E,V2_ROOT as H,V2_TMP as A,acEntryPath as w,casBlobPath as D,taskHashIndexPath as _}from"./packem_shared/V2_ROOT-injxWBrl.js";import{containsBlob as M,fetchBlobToFile as N,putBlobFromBytes as O,putBlobFromFile as U,touchBlob as V,verifyBlob as W}from"./packem_shared/containsBlob-DBWgvkM_.js";import{toChromeTrace as z,writeChromeTrace as Y}from"./packem_shared/toChromeTrace-DxN5NQIU.js";import{parseCommands as J}from"./packem_shared/parseCommands-b1K2vIxj.js";import{runConcurrently as Q}from"./packem_shared/runConcurrently-
|
|
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-XhD7mg7G.js";import{actionDigestForTaskHash as l,containsByTaskHash as x,retrieveByTaskHash as h,storeByTaskHash as d}from"./packem_shared/actionDigestForTaskHash-BOL4fZ9v.js";import{HttpRemoteCache as u}from"./packem_shared/HttpRemoteCache-Ch-_9ejF.js";import{ReapiRemoteCache as C}from"./packem_shared/ReapiRemoteCache-B3uQuVqP.js";import{Cache as y,DEFAULT_CACHE_DIRECTORY_NAME as R,formatCacheSize as F,parseCacheSize as v}from"./packem_shared/Cache-C540ZPYk.js";import{digestBuffer as S,digestFile as I}from"./packem_shared/digestBuffer-g11aCaDx.js";import{V2_AC as b,V2_CAS as P,V2_INDEX as E,V2_ROOT as H,V2_TMP as A,acEntryPath as w,casBlobPath as D,taskHashIndexPath as _}from"./packem_shared/V2_ROOT-injxWBrl.js";import{containsBlob as M,fetchBlobToFile as N,putBlobFromBytes as O,putBlobFromFile as U,touchBlob as V,verifyBlob as W}from"./packem_shared/containsBlob-DBWgvkM_.js";import{toChromeTrace as z,writeChromeTrace as Y}from"./packem_shared/toChromeTrace-DxN5NQIU.js";import{parseCommands as J}from"./packem_shared/parseCommands-b1K2vIxj.js";import{runConcurrently as Q}from"./packem_shared/runConcurrently-DYbMGyGv.js";import{runConcurrentFallback as Z}from"./packem_shared/runConcurrentFallback-Dpqxuyv-.js";import{defaultTaskRunner as ee}from"./packem_shared/defaultTaskRunner-dptuKcps.js";import{detectScriptShell as oe}from"./packem_shared/detectScriptShell-CaTDk5cW.js";import{FileAccessTracker as ae,generatePreloadScript as se}from"./packem_shared/FileAccessTracker-DSNf03JW.js";import{FingerprintManager as ne}from"./packem_shared/FingerprintManager-CYW2EwLc.js";import{detectFrameworks as ie,getFrameworkEnvVariables as fe,inferFrameworkEnvPatterns as ce}from"./packem_shared/detectFrameworks-WVZJOPgN.js";import{projectGraphToDot as xe,toGraphAscii as he,toGraphHtml as de,toGraphJson as ke,toGraphvizDot as ue}from"./packem_shared/projectGraphToDot-FN6oHDGH.js";import{IncrementalFileHasher as Ce}from"./packem_shared/IncrementalFileHasher-CdLXVB5F.js";import{CompositeLifeCycle as ye,ConsoleLifeCycle as Re,EmptyLifeCycle as Fe}from"./packem_shared/CompositeLifeCycle-D0zWvAXJ.js";import{LockfileHasher as Be,extractPackageName as Se,parseNpmLockfile as Ie,parsePnpmLockfile as Le,parseYarnLockfile as be}from"./packem_shared/extractPackageName-BeL6Gc3a.js";import{LogReporter as Ee,createLogReporter as He}from"./packem_shared/LogReporter-BUPWiXAq.js";import{isNativeAvailable as we,loadNativeBindings as De}from"./packem_shared/isNativeAvailable-BOavFPX1.js";import{resolveOutputs as Ge}from"./packem_shared/resolveOutputs-BBjdaraf.js";import{INPUT_URI_SCHEMES as Ne,InvalidInputUriError as Oe,looksLikeInputUri as Ue,parseInputUri as Ve}from"./packem_shared/INPUT_URI_SCHEMES-Csrd0tlg.js";import{enforceProjectConstraints as je}from"./packem_shared/enforceProjectConstraints-dNc1SwRi.js";import{generateRunSummary as Ye,getLastRunSummaryPath as qe,readLastRunSummary as Je,writeLastRunSummary as Ke,writeRunSummary as Qe}from"./packem_shared/generateRunSummary-DXhnX83W.js";import{createTaskGraph as Ze,getTaskId as $e,parseTaskId as er}from"./packem_shared/createTaskGraph-CEYYI-DL.js";import{findCycle as or,findCycles as tr,getDependentTasks as ar,getLeafTasks as sr,getTransitiveDependencies as pr,makeAcyclic as nr,reverseTaskGraph as mr,walkTaskGraph as ir}from"./packem_shared/findCycle-BY8-jmzB.js";import{InProcessTaskHasher as cr,computeTaskHash as lr}from"./packem_shared/computeTaskHash-Xxd8v-X3.js";import{TaskOrchestrator as hr}from"./packem_shared/TaskOrchestrator-BfxyRQGb.js";import{TaskScheduler as kr,parsePartition as ur}from"./packem_shared/parsePartition-uzPNgtPp.js";import{TerminalBuffer as Cr}from"./packem_shared/TerminalBuffer-BtZy7TpT.js";import{TrackedTaskExecutor as yr}from"./packem_shared/TrackedTaskExecutor-D3-LNT_d.js";import{d as Fr,j as vr,T as Br,b as Sr,E as Ir,v as Lr,h as br,O as Pr}from"./packem_shared/utils-BH2W5Wml.js";import{evaluateWhen as Hr,explainWhen as Ar,getCurrentBranch as wr,resetBranchCache as Dr}from"./packem_shared/getCurrentBranch-D-qoZByx.js";import{getMainWorktreeRoot as Gr,isLinkedWorktree as Mr,resetWorktreeCache as Nr}from"./packem_shared/getMainWorktreeRoot-DRN_i8jA.js";import{createInputHandler as Ur}from"./packem_shared/createInputHandler-CkDCpPYy.js";import{expandArguments as Wr}from"./packem_shared/expandArguments-4mab7-Ds.js";import{expandShortcut as zr}from"./packem_shared/expandShortcut-BErNHNXZ.js";import{expandTokens as qr,expandTokensInString as Jr}from"./packem_shared/expandTokensInString-Cyx0qSFA.js";import{expandWildcard as Qr}from"./packem_shared/expandWildcard-DE0dOOZF.js";import{formatTimingTable as Zr,logTimings as $r}from"./packem_shared/formatTimingTable-CP3rsDwf.js";import{runTeardown as ro}from"./packem_shared/runTeardown-DBBpBAyb.js";import{stripQuotes as to}from"./packem_shared/stripQuotes-jkZb0CL9.js";import{withRestart as so}from"./packem_shared/withRestart-DKtEGsQA.js";export{y as Cache,ye as CompositeLifeCycle,Re as ConsoleLifeCycle,R as DEFAULT_CACHE_DIRECTORY_NAME,Fe as EmptyLifeCycle,ae as FileAccessTracker,ne as FingerprintManager,u as HttpRemoteCache,Ne as INPUT_URI_SCHEMES,cr as InProcessTaskHasher,Ce as IncrementalFileHasher,Oe as InvalidInputUriError,Be as LockfileHasher,Ee as LogReporter,C as ReapiRemoteCache,hr as TaskOrchestrator,kr as TaskScheduler,Cr as TerminalBuffer,yr as TrackedTaskExecutor,b as V2_AC,P as V2_CAS,E as V2_INDEX,H as V2_ROOT,A as V2_TMP,w as acEntryPath,l as actionDigestForTaskHash,o as buildForwardDependencyMap,t as buildReverseDependencyMap,D as casBlobPath,Fr as collectFiles,lr as computeTaskHash,M as containsBlob,x as containsByTaskHash,vr as createFailureResult,Ur as createInputHandler,He as createLogReporter,i as createRemoteCacheBackend,Ze as createTaskGraph,ee as defaultTaskRunner,ie as detectFrameworks,oe as detectScriptShell,S as digestBuffer,I as digestFile,je as enforceProjectConstraints,Hr as evaluateWhen,a as expandAffected,Wr as expandArguments,zr as expandShortcut,qr as expandTokens,Jr as expandTokensInString,Qr as expandWildcard,Ar as explainWhen,Se as extractPackageName,N as fetchBlobToFile,s as filterAffectedTasks,or as findCycle,tr as findCycles,F as formatCacheSize,Zr as formatTimingTable,se as generatePreloadScript,Ye as generateRunSummary,p as getAffectedProjects,n as getChangedFiles,wr as getCurrentBranch,ar as getDependentTasks,fe as getFrameworkEnvVariables,qe as getLastRunSummaryPath,sr as getLeafTasks,Gr as getMainWorktreeRoot,$e as getTaskId,pr as getTransitiveDependencies,Br as hashFile,Sr as hashStrings,ce as inferFrameworkEnvPatterns,Mr as isLinkedWorktree,we as isNativeAvailable,De as loadNativeBindings,$r as logTimings,Ue as looksLikeInputUri,nr as makeAcyclic,v as parseCacheSize,J as parseCommands,Ve as parseInputUri,Ie as parseNpmLockfile,ur as parsePartition,Le as parsePnpmLockfile,er as parseTaskId,be as parseYarnLockfile,xe as projectGraphToDot,O as putBlobFromBytes,U as putBlobFromFile,Je as readLastRunSummary,Ir as readPackageDeps,Dr as resetBranchCache,Nr as resetWorktreeCache,f as resolveCacheMode,Ge as resolveOutputs,Lr as resolveTaskCwd,h as retrieveByTaskHash,mr as reverseTaskGraph,Z as runConcurrentFallback,Q as runConcurrently,ro as runTeardown,br as sortObjectKeys,d as storeByTaskHash,to as stripQuotes,_ as taskHashIndexPath,z as toChromeTrace,he as toGraphAscii,de as toGraphHtml,ke as toGraphJson,ue as toGraphvizDot,V as touchBlob,Pr as uniqueId,W as verifyBlob,ir as walkTaskGraph,so as withRestart,Y as writeChromeTrace,Ke as writeLastRunSummary,Qe as writeRunSummary};
|
|
@@ -1,2 +1,2 @@
|
|
|
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-
|
|
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
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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var H=Object.defineProperty;var k=(e,t)=>H(e,"name",{value:t,configurable:!0});import{createRequire as M}from"node:module";import{b as l,h as N,f as I,d as z,X as $}from"./utils-BH2W5Wml.js";import{join as b,resolve as w,relative as C}from"@visulima/path";import{getFrameworkEnvVariables as V}from"./detectFrameworks-WVZJOPgN.js";import{LockfileHasher as B}from"./extractPackageName-BeL6Gc3a.js";import{loadNativeBindings as J}from"./isNativeAvailable-BOavFPX1.js";import{looksLikeInputUri as L,parseInputUri as U}from"./INPUT_URI_SCHEMES-Csrd0tlg.js";const W=M(import.meta.url),d=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,F=k(e=>{if(typeof d<"u"&&d.versions&&d.versions.node){const[t,o]=d.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return d.getBuiltinModule(e)}return W(e)},"__cjs_getBuiltinModule"),{execFile:q}=F("node:child_process"),{stat:E,readFile:y}=F("node:fs/promises");var X=Object.defineProperty,h=k((e,t)=>X(e,"name",{value:t,configurable:!0}),"l");const Z=["package-lock.json","pnpm-lock.yaml","yarn.lock","tsconfig.base.json","tsconfig.json",".env"],A=new Set([".git",".task-runner",".task-runner-cache",".vis","coverage","dist","node_modules"]),G=new Set(["package-lock.json","pnpm-lock.yaml","yarn.lock"]);let S;const x=h(()=>(S===void 0&&(S=J()),S),"getNativeBindings"),R=h((e,t,o)=>{for(const s of Object.keys(t).toSorted())o?e.update(`${o}${s}\0`):e.update(`${s}\0`),e.update(t[s])},"hashSortedEntries"),K=h(e=>{if(e==="node -v"||e==="node --version")return Promise.resolve(process.version);const t=e.split(/\s+/),o=t[0],s=t.slice(1);return new Promise(i=>{q(o,s,{timeout:1e4},(r,c)=>{i(r?`__runtime_error__:${e}`:c.trim())})})},"executeRuntimeCommand"),P=new Map,Q=h(async e=>{let t=P.get(e);return t===void 0&&(t=await K(e),P.set(e,t)),l(e,t)},"hashRuntimeValue"),Y=new Set(["0","!","#","$","*","-","?","@","_"]),tt=h(e=>{const t=new Set,o=/\$(?:\{([^}]+)\}|([A-Z_]\w*))/gi;let s;for(;(s=o.exec(e))!==null;){const i=s[1]??s[2];if(!i)continue;const r=i.split(/[#%:/?+\-=,^]/)[0]?.trim();!r||Y.has(r)||/^\d+$/.test(r)||/^[A-Z_]\w*$/i.test(r)&&t.add(r)}return[...t]},"extractReferencedEnvVars"),T=h(e=>"fileset"in e,"isFileSetInput"),D=h(e=>{if(typeof e=="string")return e;const t=e.base==="workspace"?"{workspaceRoot}":"{projectRoot}";return e.pattern.startsWith("!")?`!${t}/${e.pattern.slice(1)}`:`${t}/${e.pattern}`},"normalizeFileset"),et=h(e=>"runtime"in e,"isRuntimeInput"),st=h(e=>"env"in e,"isEnvironmentInput"),it=h(e=>"externalDependencies"in e,"isExternalDependencyInput");class lt{static{k(this,"tt")}static{h(this,"InProcessTaskHasher")}#t;#e;#a;#c;#u;#l;#f;#s=new Map;#i;#p;#n;#m;#d;#r;#h;#o=void 0;constructor(t){this.#t=t.workspaceRoot,this.#e=t.projects,this.#a=t.namedInputs??{},this.#c=t.targetDefaults??{},this.#u=t.envVars??[],this.#l=t.globalInputs??Z,this.#f=t.globalEnv??[],this.#i=x(),this.#p=t.smartLockfileHashing??!1,this.#n=this.#p?new B(t.workspaceRoot):void 0,this.#m=t.frameworkInference??!1,this.#d=t.autoEnvVars??!1,this.#r=t.incrementalHasher,this.#h=t.onFingerprint}async hashTask(t){const o=this.#k(t),s={},i={},r={},c=await this.#b();c&&(i.__global__=c);const g=this.#w(t),f=this.#j(g,t.target.project);for(const n of g)if(T(n)){const p=await this.#_(t,D(n.fileset),f);for(const[a,u]of Object.entries(p))s[a]=u}else if(et(n))r[n.runtime]=await Q(n.runtime);else if(st(n))r[`env:${n.env}`]=l(n.env,process.env[n.env]??"");else if(it(n)){const p=await Promise.all(n.externalDependencies.map(async a=>[a,await this.#$(a)]));for(const[a,u]of p)i[a]=u}for(const n of this.#u)r[`env:${n}`]=l(n,process.env[n]??"");if(this.#d){const n=this.#y(t);if(n)for(const p of tt(n)){const a=`env:${p}`;r[a]===void 0&&(r[a]=l(p,process.env[p]??""))}}const m=this.#e[t.target.project];if(m){if(this.#n){const n=await this.#n.hashForPackage(b(m.root,"package.json"));n&&(i.__lockfile__=n.hash)}if(this.#m){const n=w(this.#t,m.root,"package.json"),p=await V(n);for(const a of Object.keys(p))r[`framework-env:${a}`]=l(a,process.env[a]??"")}}if(this.#h){const n={},p={contribute:h((a,u)=>{if(typeof a!="string"||a.length===0)throw new TypeError(`task:fingerprint contribute() requires a non-empty string key, got ${typeof a=="string"?"''":typeof a}`);if(typeof u!="string")throw new TypeError(`task:fingerprint contribute(${JSON.stringify(a)}) requires a string value, got ${typeof u}`);n[`plugin:${a}`]=l(a,u)},"contribute")};await this.#h(t,p);for(const[a,u]of Object.entries(n))r[a]=u}return{command:o,implicitDeps:Object.keys(i).length>0?i:void 0,nodes:s,runtime:Object.keys(r).length>0?r:void 0}}#k(t){const o=JSON.stringify(N(t.overrides));if(this.#i)return this.#i.hashCommand(t.target.project,t.target.target,t.target.configuration??void 0,o);const s=I();return s.update(t.target.project),s.update(t.target.target),t.target.configuration&&s.update(t.target.configuration),s.update(o),s.digest()}#y(t){const o=t.overrides.command;if(typeof o=="string")return o;const s=this.#e[t.target.project]?.targets?.[t.target.target]?.command??this.#c[t.target.target]?.command;return typeof s=="string"?s:void 0}#w(t){const o=this.#e[t.target.project]?.targets?.[t.target.target],s=this.#c[t.target.target],i=o?.inputs??s?.inputs;return i?this.#g(i,t.target.project):[{fileset:"{projectRoot}/**/*"}]}#g(t,o){const s=[],i=new Set;for(const r of t)if(typeof r=="string")if(L(r)){const c=U(r);c&&s.push(c)}else if(r.startsWith("{")||r.startsWith("!{"))s.push({fileset:r});else{if(r.startsWith("^"))continue;this.#a[r]&&!i.has(r)?(i.add(r),s.push(...this.#g(this.#a[r],o))):s.push({fileset:r})}else s.push(r);return s}#j(t,o){const s=this.#e[o]?.root??"",i=[];for(const r of t){if(!T(r))continue;const c=D(r.fileset).replace("{projectRoot}",s).replace("{workspaceRoot}",".");c.startsWith("!")&&i.push(c.slice(1).replace(/\/\*\*\/\*$/,"").replace(/\/\*$/,""))}return i}async#_(t,o,s=[]){const i=this.#e[t.target.project]?.root??"",r=o.replace("{projectRoot}",i).replace("{workspaceRoot}",".");if(r.startsWith("!"))return{};const c=w(this.#t,r.replace(/\/\*\*\/\*$/,"").replace(/\/\*$/,"")),g=s.map(n=>w(this.#t,n)),f={},m=h(n=>g.some(p=>n.startsWith(`${p}/`)||n===p),"isExcluded");try{if(this.#i){const p=this.#i.hashFilesInDirectory(c,this.#t),a=this.#r,u=[];for(const{hash:j,path:O}of p){const v=w(this.#t,O);m(v)||(f[O]=j,this.#s.set(v,j),a&&u.push(E(v).then(_=>{_.isFile()&&a.recordSnapshot(v,j,_.mtimeMs,_.size)}).catch(()=>{})))}return u.length>0&&await Promise.all(u),f}const n=(await z(c,A)).map(async p=>{if(m(p))return;const a=await this.#v(p);a&&(f[C(this.#t,p)]=a)});await Promise.all(n)}catch{}return f}async#v(t){const o=this.#s.get(t);if(o)return o;if(this.#r)try{const s=await E(t);if(s.isFile()){const i=this.#r.getSnapshotHash(t,s.mtimeMs,s.size);if(i)return this.#s.set(t,i),i;const r=await y(t),c=$(r);return this.#r.recordSnapshot(t,c,s.mtimeMs,s.size),this.#s.set(t,c),c}}catch{}try{const s=await y(t),i=$(s);return this.#s.set(t,i),i}catch{return}}async#$(t){try{const o=b(this.#t,"node_modules",t,"package.json"),s=await y(o,"utf8"),i=JSON.parse(s);return l(t,i.version??"unknown")}catch{return l(t,"not-installed")}}async#b(){if(this.#o!==void 0)return this.#o;const t=I();let o=!1;const s=await Promise.all(this.#l.filter(i=>!(this.#p&&G.has(i))).map(async i=>{const r=await this.#v(b(this.#t,i));return r?{hash:r,name:i}:void 0}));for(const i of s)i&&(t.update(i.name),t.update(i.hash),o=!0);for(const i of this.#f)t.update(`globalEnv:${i}=${process.env[i]??""}`),o=!0;return this.#o=o?t.digest():"",this.#o||void 0}clearCache(){this.#s.clear(),this.#o=void 0,this.#n?.clearCache()}async rehashFile(t){try{const o=await y(t);return $(o)}catch{return}}}const ft=h(e=>{const t=x();if(t){const s=Object.keys(e.nodes).toSorted().map(c=>[c,e.nodes[c]]),i=e.implicitDeps?Object.keys(e.implicitDeps).toSorted().map(c=>[c,e.implicitDeps[c]]):void 0,r=e.runtime?Object.keys(e.runtime).toSorted().map(c=>[c,e.runtime[c]]):void 0;return t.computeTaskHash({command:e.command,implicit_deps:i,nodes:s,runtime:r})}const o=I();return o.update(e.command),R(o,e.nodes),e.implicitDeps&&R(o,e.implicitDeps),e.runtime&&R(o,e.runtime),o.digest()},"computeTaskHash");export{lt as InProcessTaskHasher,ft as computeTaskHash};
|
|
@@ -0,0 +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-XhD7mg7G.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-BfxyRQGb.js";import{TaskScheduler as G}from"./parsePartition-uzPNgtPp.js";var P=Object.defineProperty,m=k((e,a)=>P(e,"name",{value:a,configurable:!0}),"i");const S=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"),z=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?z(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}=S(n),E=A(a.parallel),C=new G(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 w=Object.defineProperty;var m=(t,e)=>w(t,"name",{value:e,configurable:!0});import{createRequire as k}from"node:module";import{runConcurrentFallback as S}from"./runConcurrentFallback-Dpqxuyv-.js";import{detectScriptShell as x}from"./detectScriptShell-CaTDk5cW.js";import{logTimings as C}from"./formatTimingTable-CP3rsDwf.js";import{withRestart as I}from"./withRestart-DKtEGsQA.js";import{runTeardown as P}from"./runTeardown-DBBpBAyb.js";import{loadNativeBindings as R}from"./isNativeAvailable-BOavFPX1.js";const T=k(import.meta.url),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,v=m(t=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[e,s]=l.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return l.getBuiltinModule(t)}return T(t)},"__cjs_getBuiltinModule"),{spawn:_}=v("node:child_process");var b=Object.defineProperty,n=m((t,e)=>b(t,"name",{value:e,configurable:!0}),"t");const c=new Set;let f=!1;const M=n((t,e)=>{try{process.platform==="win32"?_("taskkill",["/F","/T","/PID",String(t)],{stdio:"ignore"}):process.kill(-t,e)}catch{}},"killTrackedTree"),u=n(t=>{for(const e of c)M(e,t)},"killAllTracked"),j=n(()=>{f||(f=!0,process.setMaxListeners(process.getMaxListeners()+3),process.on("SIGINT",()=>{u("SIGINT")}),process.on("SIGTERM",()=>{u("SIGTERM")}),process.on("exit",()=>{u("SIGTERM")}))},"installSignalHandlersOnce"),E=n(t=>t.map(e=>typeof e=="string"?{command:e}:e),"normalizeCommands"),g=n(async(t,e)=>{const s=e.shellPath??x(),o=R(),d=t.some(i=>i.stdin==="pipe"||i.stdin==="pty")||!!e.onEvent;if(o&&!d){const i={killOthers:e.killOthers,killSignal:e.killSignal,killTimeout:e.killTimeout,maxProcesses:e.maxProcesses,shellPath:s,successCondition:e.successCondition},h=t.map(r=>({command:r.command,cwd:r.cwd,env:r.env,name:r.name,shell:r.shell,stdin:r.stdin}));j();const a=new Map,y=n(r=>{if(r!=null){if(r.kind==="started"&&typeof r.pid=="number"){c.add(r.pid),a.set(r.index,r.pid);return}if(r.kind==="close"||r.kind==="error"){const p=a.get(r.index);p!==void 0&&(c.delete(p),a.delete(r.index))}}},"onLifecycle");try{return await o.runConcurrentBatch(h,i,y)}finally{for(const r of a.values())c.delete(r)}}return S(t,{...e,shellPath:s})},"coreRun"),A=n(async(t,e={})=>{const s=E(t);if(s.length===0)return{closeEvents:[],success:!0};let o;return e.restart&&e.restart.tries!==0?o=await I((d,i)=>g(d,i),s,e,{delay:e.restart.delay??0,onRetry:e.restart.onRetry,tries:e.restart.tries}):o=await g(s,e),e.timings&&C(o.closeEvents),e.teardown&&e.teardown.length>0&&await P({commands:e.teardown,cwd:e.teardownCwd}),o},"runConcurrently");export{A as runConcurrently};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var y=Object.defineProperty;var l=(t,n)=>y(t,"name",{value:n,configurable:!0});var b=Object.defineProperty,d=l((t,n)=>b(t,"name",{value:n,configurable:!0}),"i");const R=d(async(t,n,a,v)=>{const{delay:p,onRetry:m,tries:r}=v;if(r===0)return t(n,a);const x=new Map,c=[],w=a.onEvent;let o=[...n],u=0;for(;o.length>0;){const i=o;o=[];const E=await t(i,{...a,onEvent:d(e=>{w?.(e)},"onEvent")});for(const e of E.closeEvents){if(e.exitCode!==0){const s=x.get(e.index)??{attempts:0,commandIndex:e.index};if(s.attempts++,x.set(e.index,s),r===-1||s.attempts<=r){m&&await m(s.attempts,e.index,e.exitCode??1);const f=p==="exponential"?Math.min(2**(s.attempts-1)*1e3,3e4):p;f>0&&await C(f),o.push(i[e.index]);continue}}c.push(e)}if(u++,u>1e3)break}const h=c.every(i=>i.exitCode===0);return{closeEvents:c,success:h}},"withRestart"),C=d(t=>new Promise(n=>{setTimeout(n,t)}),"sleep");export{R as withRestart};
|
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.12",
|
|
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-
|
|
79
|
-
"@visulima/task-runner-binding-win32-
|
|
80
|
-
"@visulima/task-runner-binding-
|
|
73
|
+
"@visulima/task-runner-binding-darwin-arm64": "1.0.0-alpha.12",
|
|
74
|
+
"@visulima/task-runner-binding-darwin-x64": "1.0.0-alpha.12",
|
|
75
|
+
"@visulima/task-runner-binding-linux-arm64-gnu": "1.0.0-alpha.12",
|
|
76
|
+
"@visulima/task-runner-binding-linux-x64-gnu": "1.0.0-alpha.12",
|
|
77
|
+
"@visulima/task-runner-binding-linux-x64-musl": "1.0.0-alpha.12",
|
|
78
|
+
"@visulima/task-runner-binding-linux-arm64-musl": "1.0.0-alpha.12",
|
|
79
|
+
"@visulima/task-runner-binding-win32-arm64-msvc": "1.0.0-alpha.12",
|
|
80
|
+
"@visulima/task-runner-binding-win32-x64-msvc": "1.0.0-alpha.12"
|
|
81
81
|
},
|
|
82
82
|
"engines": {
|
|
83
83
|
"node": "^22.14.0 || >=24.10.0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var T=Object.defineProperty;var k=(e,t)=>T(e,"name",{value:t,configurable:!0});import{createRequire as M}from"node:module";import{b as u,h as N,f as I,d as V,X as $}from"./utils-BH2W5Wml.js";import{join as b,resolve as y,relative as q}from"@visulima/path";import{getFrameworkEnvVariables as B}from"./detectFrameworks-WVZJOPgN.js";import{LockfileHasher as C}from"./extractPackageName-BeL6Gc3a.js";import{loadNativeBindings as L}from"./isNativeAvailable-BOavFPX1.js";import{looksLikeInputUri as U,parseInputUri as X}from"./INPUT_URI_SCHEMES-Csrd0tlg.js";const W=M(import.meta.url),d=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,E=k(e=>{if(typeof d<"u"&&d.versions&&d.versions.node){const[t,o]=d.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return d.getBuiltinModule(e)}return W(e)},"__cjs_getBuiltinModule"),{execFile:z}=E("node:child_process"),{stat:P,readFile:w}=E("node:fs/promises");var Z=Object.defineProperty,p=k((e,t)=>Z(e,"name",{value:t,configurable:!0}),"u");const A=["package-lock.json","pnpm-lock.yaml","yarn.lock","tsconfig.base.json","tsconfig.json",".env"],J=new Set([".git",".task-runner",".task-runner-cache",".vis","coverage","dist","node_modules"]),G=new Set(["package-lock.json","pnpm-lock.yaml","yarn.lock"]);let R;const H=p(()=>(R===void 0&&(R=L()),R),"getNativeBindings"),S=p((e,t,o)=>{for(const s of Object.keys(t).toSorted())o?e.update(`${o}${s}\0`):e.update(`${s}\0`),e.update(t[s])},"hashSortedEntries"),K=p(e=>{if(e==="node -v"||e==="node --version")return Promise.resolve(process.version);const t=e.split(/\s+/),o=t[0],s=t.slice(1);return new Promise(i=>{z(o,s,{timeout:1e4},(r,a)=>{i(r?`__runtime_error__:${e}`:a.trim())})})},"executeRuntimeCommand"),F=new Map,Q=p(async e=>{let t=F.get(e);return t===void 0&&(t=await K(e),F.set(e,t)),u(e,t)},"hashRuntimeValue"),Y=new Set(["0","!","#","$","*","-","?","@","_"]),tt=p(e=>{const t=new Set,o=/\$(?:\{([^}]+)\}|([A-Z_]\w*))/gi;let s;for(;(s=o.exec(e))!==null;){const i=s[1]??s[2];if(!i)continue;const r=i.split(/[#%:/?+\-=,^]/)[0]?.trim();!r||Y.has(r)||/^\d+$/.test(r)||/^[A-Z_]\w*$/i.test(r)&&t.add(r)}return[...t]},"extractReferencedEnvVars"),O=p(e=>"fileset"in e,"isFileSetInput"),x=p(e=>{if(typeof e=="string")return e;const t=e.base==="workspace"?"{workspaceRoot}":"{projectRoot}";return e.pattern.startsWith("!")?`!${t}/${e.pattern.slice(1)}`:`${t}/${e.pattern}`},"normalizeFileset"),et=p(e=>"runtime"in e,"isRuntimeInput"),st=p(e=>"env"in e,"isEnvironmentInput"),it=p(e=>"externalDependencies"in e,"isExternalDependencyInput");class ut{static{k(this,"tt")}static{p(this,"InProcessTaskHasher")}#t;#e;#a;#c;#p;#l;#u;#s=new Map;#i;#h;#n;#f;#m;#r;#o=void 0;constructor(t){this.#t=t.workspaceRoot,this.#e=t.projects,this.#a=t.namedInputs??{},this.#c=t.targetDefaults??{},this.#p=t.envVars??[],this.#l=t.globalInputs??A,this.#u=t.globalEnv??[],this.#i=H(),this.#h=t.smartLockfileHashing??!1,this.#n=this.#h?new C(t.workspaceRoot):void 0,this.#f=t.frameworkInference??!1,this.#m=t.autoEnvVars??!1,this.#r=t.incrementalHasher}async hashTask(t){const o=this.#v(t),s={},i={},r={},a=await this.#$();a&&(i.__global__=a);const g=this.#w(t),f=this.#y(g,t.target.project);for(const n of g)if(O(n)){const h=await this.#j(t,x(n.fileset),f);for(const[c,l]of Object.entries(h))s[c]=l}else if(et(n))r[n.runtime]=await Q(n.runtime);else if(st(n))r[`env:${n.env}`]=u(n.env,process.env[n.env]??"");else if(it(n)){const h=await Promise.all(n.externalDependencies.map(async c=>[c,await this.#_(c)]));for(const[c,l]of h)i[c]=l}for(const n of this.#p)r[`env:${n}`]=u(n,process.env[n]??"");if(this.#m){const n=this.#k(t);if(n)for(const h of tt(n)){const c=`env:${h}`;r[c]===void 0&&(r[c]=u(h,process.env[h]??""))}}const m=this.#e[t.target.project];if(m){if(this.#n){const n=await this.#n.hashForPackage(b(m.root,"package.json"));n&&(i.__lockfile__=n.hash)}if(this.#f){const n=y(this.#t,m.root,"package.json"),h=await B(n);for(const c of Object.keys(h))r[`framework-env:${c}`]=u(c,process.env[c]??"")}}return{command:o,implicitDeps:Object.keys(i).length>0?i:void 0,nodes:s,runtime:Object.keys(r).length>0?r:void 0}}#v(t){const o=JSON.stringify(N(t.overrides));if(this.#i)return this.#i.hashCommand(t.target.project,t.target.target,t.target.configuration??void 0,o);const s=I();return s.update(t.target.project),s.update(t.target.target),t.target.configuration&&s.update(t.target.configuration),s.update(o),s.digest()}#k(t){const o=t.overrides.command;if(typeof o=="string")return o;const s=this.#e[t.target.project]?.targets?.[t.target.target]?.command??this.#c[t.target.target]?.command;return typeof s=="string"?s:void 0}#w(t){const o=this.#e[t.target.project]?.targets?.[t.target.target],s=this.#c[t.target.target],i=o?.inputs??s?.inputs;return i?this.#d(i,t.target.project):[{fileset:"{projectRoot}/**/*"}]}#d(t,o){const s=[],i=new Set;for(const r of t)if(typeof r=="string")if(U(r)){const a=X(r);a&&s.push(a)}else if(r.startsWith("{")||r.startsWith("!{"))s.push({fileset:r});else{if(r.startsWith("^"))continue;this.#a[r]&&!i.has(r)?(i.add(r),s.push(...this.#d(this.#a[r],o))):s.push({fileset:r})}else s.push(r);return s}#y(t,o){const s=this.#e[o]?.root??"",i=[];for(const r of t){if(!O(r))continue;const a=x(r.fileset).replace("{projectRoot}",s).replace("{workspaceRoot}",".");a.startsWith("!")&&i.push(a.slice(1).replace(/\/\*\*\/\*$/,"").replace(/\/\*$/,""))}return i}async#j(t,o,s=[]){const i=this.#e[t.target.project]?.root??"",r=o.replace("{projectRoot}",i).replace("{workspaceRoot}",".");if(r.startsWith("!"))return{};const a=y(this.#t,r.replace(/\/\*\*\/\*$/,"").replace(/\/\*$/,"")),g=s.map(n=>y(this.#t,n)),f={},m=p(n=>g.some(h=>n.startsWith(`${h}/`)||n===h),"isExcluded");try{if(this.#i){const h=this.#i.hashFilesInDirectory(a,this.#t),c=this.#r,l=[];for(const{hash:j,path:D}of h){const v=y(this.#t,D);m(v)||(f[D]=j,this.#s.set(v,j),c&&l.push(P(v).then(_=>{_.isFile()&&c.recordSnapshot(v,j,_.mtimeMs,_.size)}).catch(()=>{})))}return l.length>0&&await Promise.all(l),f}const n=(await V(a,J)).map(async h=>{if(m(h))return;const c=await this.#g(h);c&&(f[q(this.#t,h)]=c)});await Promise.all(n)}catch{}return f}async#g(t){const o=this.#s.get(t);if(o)return o;if(this.#r)try{const s=await P(t);if(s.isFile()){const i=this.#r.getSnapshotHash(t,s.mtimeMs,s.size);if(i)return this.#s.set(t,i),i;const r=await w(t),a=$(r);return this.#r.recordSnapshot(t,a,s.mtimeMs,s.size),this.#s.set(t,a),a}}catch{}try{const s=await w(t),i=$(s);return this.#s.set(t,i),i}catch{return}}async#_(t){try{const o=b(this.#t,"node_modules",t,"package.json"),s=await w(o,"utf8"),i=JSON.parse(s);return u(t,i.version??"unknown")}catch{return u(t,"not-installed")}}async#$(){if(this.#o!==void 0)return this.#o;const t=I();let o=!1;const s=await Promise.all(this.#l.filter(i=>!(this.#h&&G.has(i))).map(async i=>{const r=await this.#g(b(this.#t,i));return r?{hash:r,name:i}:void 0}));for(const i of s)i&&(t.update(i.name),t.update(i.hash),o=!0);for(const i of this.#u)t.update(`globalEnv:${i}=${process.env[i]??""}`),o=!0;return this.#o=o?t.digest():"",this.#o||void 0}clearCache(){this.#s.clear(),this.#o=void 0,this.#n?.clearCache()}async rehashFile(t){try{const o=await w(t);return $(o)}catch{return}}}const ft=p(e=>{const t=H();if(t){const s=Object.keys(e.nodes).toSorted().map(a=>[a,e.nodes[a]]),i=e.implicitDeps?Object.keys(e.implicitDeps).toSorted().map(a=>[a,e.implicitDeps[a]]):void 0,r=e.runtime?Object.keys(e.runtime).toSorted().map(a=>[a,e.runtime[a]]):void 0;return t.computeTaskHash({command:e.command,implicit_deps:i,nodes:s,runtime:r})}const o=I();return o.update(e.command),S(o,e.nodes),e.implicitDeps&&S(o,e.implicitDeps),e.runtime&&S(o,e.runtime),o.digest()},"computeTaskHash");export{ut as InProcessTaskHasher,ft as computeTaskHash};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var x=Object.defineProperty;var g=(e,a)=>x(e,"name",{value:a,configurable:!0});import{X as D}from"./utils-BH2W5Wml.js";import{createRemoteCacheBackend as I}from"./resolveCacheMode-XhD7mg7G.js";import{Cache as j}from"./Cache-C540ZPYk.js";import{inferFrameworkEnvPatterns as F}from"./detectFrameworks-WVZJOPgN.js";import{IncrementalFileHasher as H}from"./IncrementalFileHasher-CdLXVB5F.js";import{InProcessTaskHasher as O}from"./computeTaskHash-DtCdMJFf.js";import{TaskOrchestrator as V}from"./TaskOrchestrator-C-I6WsBx.js";import{TaskScheduler as G}from"./parsePartition-uzPNgtPp.js";var P=Object.defineProperty,m=g((e,a)=>P(e,"name",{value:a,configurable:!0}),"i");const S=m(e=>{const a=[],o={};for(const[r,s]of Object.entries(e.tasks))s.always?a.push(s):o[r]=s;if(a.length===0)return{alwaysTasks:[],graph:e};const i=new Set(a.map(r=>r.id)),c={};for(const[r,s]of Object.entries(e.dependencies))i.has(r)||(c[r]=s.filter(n=>!i.has(n)));return{alwaysTasks:a,graph:{dependencies:c,roots:e.roots.filter(r=>!i.has(r)),tasks:o}}},"partitionAlwaysTasks"),z=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:s,workspaceRoot:n}=o,v=a.namespaceByGlobalEnv?z(a.globalEnv):void 0,d=new j({cacheDirectory:a.cacheDirectory,cacheNamespace:v,maxCacheAge:a.maxCacheAge,maxCacheSize:a.maxCacheSize,workspaceRoot:n});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:n}):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,projects:p,smartLockfileHashing:a.smartLockfileHashing,targetDefaults:a.targetDefaults,workspaceRoot:n}),{alwaysTasks:y,graph:k}=S(s),E=A(a.parallel),C=new G(k,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?I(a.remoteCache):void 0;let f=a.fingerprintEnvPatterns??[];if(a.frameworkInference&&a.autoFingerprint){const t=await F(n,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:k,taskHasher:w,untrackedEnvVars:a.untrackedEnvVars,workspaceRoot:n});try{const t=await R.run();return l&&await l.save().catch(()=>{}),t}finally{u&&await u.close().catch(()=>{})}},"defaultTaskRunner");export{J as defaultTaskRunner};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var k=Object.defineProperty;var m=(t,e)=>k(t,"name",{value:e,configurable:!0});import{createRequire as y}from"node:module";import{runConcurrentFallback as S}from"./runConcurrentFallback-Dpqxuyv-.js";import{detectScriptShell as x}from"./detectScriptShell-CaTDk5cW.js";import{logTimings as C}from"./formatTimingTable-CP3rsDwf.js";import{withRestart as I}from"./withRestart-CWO6BKv_.js";import{runTeardown as P}from"./runTeardown-DBBpBAyb.js";import{loadNativeBindings as b}from"./isNativeAvailable-BOavFPX1.js";const T=y(import.meta.url),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,v=m(t=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[e,r]=l.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return l.getBuiltinModule(t)}return T(t)},"__cjs_getBuiltinModule"),{spawn:_}=v("node:child_process");var M=Object.defineProperty,n=m((t,e)=>M(t,"name",{value:e,configurable:!0}),"t");const c=new Set;let f=!1;const R=n((t,e)=>{try{process.platform==="win32"?_("taskkill",["/F","/T","/PID",String(t)],{stdio:"ignore"}):process.kill(-t,e)}catch{}},"killTrackedTree"),u=n(t=>{for(const e of c)R(e,t)},"killAllTracked"),j=n(()=>{f||(f=!0,process.setMaxListeners(process.getMaxListeners()+3),process.on("SIGINT",()=>{u("SIGINT")}),process.on("SIGTERM",()=>{u("SIGTERM")}),process.on("exit",()=>{u("SIGTERM")}))},"installSignalHandlersOnce"),E=n(t=>t.map(e=>typeof e=="string"?{command:e}:e),"normalizeCommands"),g=n(async(t,e)=>{const r=e.shellPath??x(),o=b(),d=t.some(i=>i.stdin==="pipe"||i.stdin==="pty")||!!e.onEvent;if(o&&!d){const i={killOthers:e.killOthers,killSignal:e.killSignal,killTimeout:e.killTimeout,maxProcesses:e.maxProcesses,shellPath:r,successCondition:e.successCondition},h=t.map(s=>({command:s.command,cwd:s.cwd,env:s.env,name:s.name,shell:s.shell,stdin:s.stdin}));j();const a=new Map,w=n(s=>{if(s!=null){if(s.kind==="started"&&typeof s.pid=="number"){c.add(s.pid),a.set(s.index,s.pid);return}if(s.kind==="close"||s.kind==="error"){const p=a.get(s.index);p!==void 0&&(c.delete(p),a.delete(s.index))}}},"onLifecycle");try{return await o.runConcurrentBatch(h,i,w)}finally{for(const s of a.values())c.delete(s)}}return S(t,{...e,shellPath:r})},"coreRun"),A=n(async(t,e={})=>{const r=E(t);if(r.length===0)return{closeEvents:[],success:!0};let o;return e.restart&&e.restart.tries!==0?o=await I((d,i)=>g(d,i),r,e,{delay:e.restart.delay??0,tries:e.restart.tries}):o=await g(r,e),e.timings&&C(o.closeEvents),e.teardown&&e.teardown.length>0&&await P({commands:e.teardown,cwd:e.teardownCwd}),o},"runConcurrently");export{A as runConcurrently};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var E=Object.defineProperty;var l=(e,t)=>E(e,"name",{value:t,configurable:!0});var y=Object.defineProperty,d=l((e,t)=>y(e,"name",{value:t,configurable:!0}),"a");const C=d(async(e,t,i,v)=>{const{delay:m,tries:r}=v;if(r===0)return e(t,i);const p=new Map,c=[],x=i.onEvent;let s=[...t],u=0;for(;s.length>0;){const o=s;s=[];const w=await e(o,{...i,onEvent:d(n=>{x?.(n)},"onEvent")});for(const n of w.closeEvents){if(n.exitCode!==0){const a=p.get(n.index)??{attempts:0,commandIndex:n.index};if(a.attempts++,p.set(n.index,a),r===-1||a.attempts<=r){const f=m==="exponential"?Math.min(2**(a.attempts-1)*1e3,3e4):m;f>0&&await b(f),s.push(o[n.index]);continue}}c.push(n)}if(u++,u>1e3)break}const h=c.every(o=>o.exitCode===0);return{closeEvents:c,success:h}},"withRestart"),b=d(e=>new Promise(t=>{setTimeout(t,e)}),"sleep");export{C as withRestart};
|