@visulima/task-runner 1.0.0-alpha.7 → 1.0.0-alpha.9
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 +48 -0
- package/README.md +3 -1
- package/dist/index.d.ts +3093 -49
- package/dist/index.js +29 -19
- package/dist/packem_chunks/index.js +5593 -0
- package/dist/packem_shared/{Cache-CWaX_c8U.js → Cache-CbhoA268.js} +151 -10
- package/dist/packem_shared/{FileAccessTracker-CQ5Ot7Hd.js → FileAccessTracker-D8zIURPU.js} +1 -1
- package/dist/packem_shared/{FingerprintManager-CV7U4f4f.js → FingerprintManager-78DjwWQ4.js} +1 -1
- package/dist/packem_shared/HttpRemoteCache-BTXUBH7t.js +290 -0
- package/dist/packem_shared/INPUT_URI_SCHEMES-DRm76YI5.js +69 -0
- package/dist/packem_shared/{IncrementalFileHasher-BRS76-mb.js → IncrementalFileHasher-BBhVK491.js} +1 -1
- package/dist/packem_shared/ReapiRemoteCache-vgRxDMmu.js +1012 -0
- package/dist/packem_shared/{TaskOrchestrator-rf45vW5c.js → TaskOrchestrator-CdRaQhTO.js} +100 -11
- package/dist/packem_shared/{TrackedTaskExecutor-CFPpQfXF.js → TrackedTaskExecutor-CWSMfHAW.js} +2 -2
- package/dist/packem_shared/V2_ROOT-DKBLxKo4.js +14 -0
- package/dist/packem_shared/actionDigestForTaskHash-BRE-9MT6.js +121 -0
- package/dist/packem_shared/archive-CnggHWb-.js +152 -0
- package/dist/packem_shared/{buildForwardDependencyMap-DLPgKEto.js → buildForwardDependencyMap-0BJFMMPv.js} +1 -2
- package/dist/packem_shared/{collectFiles-ClXHnHhg.js → collectFiles-cc1gokGU.js} +2 -1
- package/dist/packem_shared/{computeTaskHash-DYqfrDGq.js → computeTaskHash-DHoBJ_-V.js} +10 -4
- package/dist/packem_shared/containsBlob-CwGB0a_q.js +125 -0
- package/dist/packem_shared/{createTaskGraph-B7nH0kY_.js → createTaskGraph-Bwl4hwAf.js} +23 -2
- package/dist/packem_shared/{defaultTaskRunner-Cp7jCmIl.js → defaultTaskRunner-BaX4ZbFv.js} +58 -15
- package/dist/packem_shared/{detectFrameworks-CeFzKE6J.js → detectFrameworks-D7nyTc-o.js} +1 -1
- package/dist/packem_shared/{detectScriptShell-CR-xXKA4.js → detectScriptShell-CzxCM9-t.js} +1 -1
- package/dist/packem_shared/digestBuffer-CPdI2E1d.js +48 -0
- package/dist/packem_shared/{expandArguments-0AwD2BIA.js → expandArguments-Ba-hHYff.js} +2 -1
- package/dist/packem_shared/expandTokensInString-Bb7nYehP.js +47 -0
- package/dist/packem_shared/{extractPackageName-BllKetnz.js → extractPackageName-CMHjqGj_.js} +2 -3
- package/dist/packem_shared/{generateRunSummary-BE1jnQ3H.js → generateRunSummary-Bah7CFay.js} +1 -1
- package/dist/packem_shared/getCurrentBranch-DVNikt0P.js +156 -0
- package/dist/packem_shared/getMainWorktreeRoot-iBqToQJ4.js +114 -0
- package/dist/packem_shared/{parseCommands-D-IgF8Zh.js → parseCommands-DDdIxaH5.js} +8 -3
- package/dist/packem_shared/resolveCacheMode-CsmHT_0o.js +21 -0
- package/dist/packem_shared/{runConcurrently-CmfC4r-f.js → runConcurrently-BCGQ9fJl.js} +1 -1
- package/dist/packem_shared/shell-quote-DWJJbt21.js +3 -0
- package/dist/packem_shared/{utils-zO0ZRgtf.js → utils-Bmnj-H2J.js} +4 -1
- package/index.js +556 -723
- package/package.json +26 -13
- package/dist/affected.d.ts +0 -82
- package/dist/archive.d.ts +0 -38
- package/dist/cache.d.ts +0 -138
- package/dist/chrome-trace.d.ts +0 -53
- package/dist/command-parser/expand-arguments.d.ts +0 -11
- package/dist/command-parser/expand-shortcut.d.ts +0 -15
- package/dist/command-parser/expand-wildcard.d.ts +0 -13
- package/dist/command-parser/index.d.ts +0 -18
- package/dist/command-parser/strip-quotes.d.ts +0 -6
- package/dist/concurrent-fallback.d.ts +0 -16
- package/dist/concurrent.d.ts +0 -23
- package/dist/default-task-runner.d.ts +0 -44
- package/dist/detect-shell.d.ts +0 -19
- package/dist/file-access-tracker.d.ts +0 -59
- package/dist/fingerprint.d.ts +0 -54
- package/dist/flow-controllers/index.d.ts +0 -7
- package/dist/flow-controllers/input-handler.d.ts +0 -44
- package/dist/flow-controllers/log-timings.d.ts +0 -18
- package/dist/flow-controllers/restart-process.d.ts +0 -21
- package/dist/flow-controllers/teardown.d.ts +0 -22
- package/dist/framework-inference.d.ts +0 -35
- package/dist/graph-visualizer.d.ts +0 -74
- package/dist/incremental-hasher.d.ts +0 -76
- package/dist/life-cycle.d.ts +0 -38
- package/dist/lockfile-hasher.d.ts +0 -73
- package/dist/log-reporter.d.ts +0 -34
- package/dist/native-binding.d.ts +0 -106
- package/dist/output-resolver.d.ts +0 -20
- package/dist/packem_shared/RemoteCache-DSU3lc87.js +0 -219
- package/dist/packem_shared/archive-UQHAnZUa.js +0 -102
- package/dist/project-constraints.d.ts +0 -9
- package/dist/remote-cache.d.ts +0 -100
- package/dist/run-summary.d.ts +0 -111
- package/dist/task-graph-utils.d.ts +0 -39
- package/dist/task-graph.d.ts +0 -22
- package/dist/task-hasher.d.ts +0 -104
- package/dist/task-orchestrator.d.ts +0 -38
- package/dist/task-scheduler.d.ts +0 -41
- package/dist/terminal-buffer.d.ts +0 -29
- package/dist/tracked-executor.d.ts +0 -46
- package/dist/types.d.ts +0 -757
- package/dist/utils.d.ts +0 -39
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export type { InputHandlerOptions } from "./input-handler.d.ts";
|
|
2
|
-
export { createInputHandler } from "./input-handler.d.ts";
|
|
3
|
-
export { formatTimingTable, logTimings } from "./log-timings.d.ts";
|
|
4
|
-
export type { RestartOptions } from "./restart-process.d.ts";
|
|
5
|
-
export { withRestart } from "./restart-process.d.ts";
|
|
6
|
-
export type { TeardownOptions } from "./teardown.d.ts";
|
|
7
|
-
export { runTeardown } from "./teardown.d.ts";
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Input handler flow controller.
|
|
3
|
-
*
|
|
4
|
-
* Routes stdin data to specific child processes based on a prefix pattern.
|
|
5
|
-
* Input prefixed with "name:" or "index:" is routed to that command's stdin.
|
|
6
|
-
* Unprefixed input goes to the default target (index 0).
|
|
7
|
-
*
|
|
8
|
-
* NOTE: This module does NOT execute commands -- it only pipes user-typed
|
|
9
|
-
* stdin data to already-running child process stdin streams. No shell
|
|
10
|
-
* invocation or command injection risk.
|
|
11
|
-
*
|
|
12
|
-
* LIMITATION: This is a standalone utility -- it is NOT integrated into
|
|
13
|
-
* runConcurrently() because the concurrent runner does not expose child
|
|
14
|
-
* stdin streams. To use this, spawn processes manually with stdin: "pipe"
|
|
15
|
-
* and pass the writable streams to createInputHandler().
|
|
16
|
-
*
|
|
17
|
-
* TODO: To fully integrate stdin routing into runConcurrently(), we would need:
|
|
18
|
-
* 1. A new "started" ProcessEvent that carries a writable stdin reference
|
|
19
|
-
* 2. On the Rust side: expose tokio::process::ChildStdin through NAPI
|
|
20
|
-
* (requires a custom wrapper since ChildStdin can't cross FFI directly)
|
|
21
|
-
* 3. In the JS fallback: return child.stdin from spawnCommand()
|
|
22
|
-
*/
|
|
23
|
-
import type { Readable, Writable } from "node:stream";
|
|
24
|
-
export interface InputHandlerOptions {
|
|
25
|
-
/** Default command index to route unprefixed input to. Default: 0. */
|
|
26
|
-
defaultTarget?: number;
|
|
27
|
-
/** Stream to read input from. Default: process.stdin. */
|
|
28
|
-
inputStream?: Readable;
|
|
29
|
-
/** Whether to pause the input stream when all processes finish. Default: true. */
|
|
30
|
-
pauseOnFinish?: boolean;
|
|
31
|
-
}
|
|
32
|
-
interface CommandStdin {
|
|
33
|
-
index: number;
|
|
34
|
-
name?: string;
|
|
35
|
-
stdin: Writable;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Creates an input handler that routes stdin to child processes.
|
|
39
|
-
* @param commands Map of command index/name to their stdin streams
|
|
40
|
-
* @param options Input handler configuration
|
|
41
|
-
* @returns cleanup function to call when done
|
|
42
|
-
*/
|
|
43
|
-
export declare const createInputHandler: (commands: CommandStdin[], options?: InputHandlerOptions) => (() => void);
|
|
44
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Log timings flow controller.
|
|
3
|
-
*
|
|
4
|
-
* Prints a summary table of all command durations after completion.
|
|
5
|
-
*/
|
|
6
|
-
import type { ConcurrentCloseEvent } from "../types.d.ts";
|
|
7
|
-
/**
|
|
8
|
-
* Generate a timing summary table string from close events.
|
|
9
|
-
* @param closeEvents Close events from the concurrent run (in completion order)
|
|
10
|
-
* @returns Formatted table string
|
|
11
|
-
*/
|
|
12
|
-
export declare const formatTimingTable: (closeEvents: ConcurrentCloseEvent[]) => string;
|
|
13
|
-
/**
|
|
14
|
-
* Print timing summary to a writable stream.
|
|
15
|
-
* @param closeEvents Close events from the concurrent run
|
|
16
|
-
* @param output Output stream (default: process.stdout)
|
|
17
|
-
*/
|
|
18
|
-
export declare const logTimings: (closeEvents: ConcurrentCloseEvent[], output?: NodeJS.WritableStream) => void;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Restart flow controller.
|
|
3
|
-
*
|
|
4
|
-
* Re-runs failed commands with configurable retry count and delay.
|
|
5
|
-
* Supports fixed delay or exponential backoff.
|
|
6
|
-
*/
|
|
7
|
-
import type { ConcurrentCommandConfig, ConcurrentRunnerOptions, ConcurrentRunResult } from "../types.d.ts";
|
|
8
|
-
export interface RestartOptions {
|
|
9
|
-
/** Delay between restarts in milliseconds. "exponential" for 2^attempt * 1000ms. */
|
|
10
|
-
delay: number | "exponential";
|
|
11
|
-
/** Maximum number of restart attempts per command. 0 = no restarts. -1 = infinite. */
|
|
12
|
-
tries: number;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Wraps a runner function to add restart-on-failure behavior.
|
|
16
|
-
* @param runFn The underlying runner function (runConcurrently or runConcurrentFallback)
|
|
17
|
-
* @param commands The original command configs
|
|
18
|
-
* @param options Runner options
|
|
19
|
-
* @param restartOptions Restart-specific options
|
|
20
|
-
*/
|
|
21
|
-
export declare const withRestart: (runFunction: (commands: ConcurrentCommandConfig[], options: ConcurrentRunnerOptions) => Promise<ConcurrentRunResult>, commands: ConcurrentCommandConfig[], options: ConcurrentRunnerOptions, restartOptions: RestartOptions) => Promise<ConcurrentRunResult>;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Teardown flow controller.
|
|
3
|
-
*
|
|
4
|
-
* Runs cleanup commands sequentially after all concurrent processes complete.
|
|
5
|
-
* Each teardown command inherits stdio (output goes directly to terminal).
|
|
6
|
-
*
|
|
7
|
-
* Commands are sourced from configuration (trusted, not user input).
|
|
8
|
-
* Shell execution is intentional for pipe/redirect support.
|
|
9
|
-
*/
|
|
10
|
-
export interface TeardownOptions {
|
|
11
|
-
/** Commands to run in sequence after all processes complete. */
|
|
12
|
-
commands: string[];
|
|
13
|
-
/** Working directory for teardown commands. */
|
|
14
|
-
cwd?: string;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Run teardown commands sequentially.
|
|
18
|
-
* Each command runs in the shell with inherited stdio.
|
|
19
|
-
* If a command fails, subsequent commands are still attempted.
|
|
20
|
-
* @returns Array of exit codes for each teardown command
|
|
21
|
-
*/
|
|
22
|
-
export declare const runTeardown: (options: TeardownOptions) => Promise<number[]>;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Detected framework information.
|
|
3
|
-
*/
|
|
4
|
-
interface DetectedFramework {
|
|
5
|
-
/** The env var prefix(es) that should be included in task hashes */
|
|
6
|
-
envPrefixes: string[];
|
|
7
|
-
/** The framework name */
|
|
8
|
-
name: string;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Detects frameworks used in a project by inspecting its package.json dependencies.
|
|
12
|
-
* @param packageJsonPath Absolute path to the package.json file
|
|
13
|
-
* @returns Array of detected frameworks with their env prefixes
|
|
14
|
-
*/
|
|
15
|
-
declare const detectFrameworks: (packageJsonPath: string) => Promise<DetectedFramework[]>;
|
|
16
|
-
/**
|
|
17
|
-
* Detects frameworks across all projects in a workspace and returns
|
|
18
|
-
* the env var patterns that should be included in task hashes.
|
|
19
|
-
* @param workspaceRoot The workspace root directory
|
|
20
|
-
* @param projects Map of project name to project configuration with root paths
|
|
21
|
-
* @returns Array of env var wildcard patterns (e.g., ["NEXT_PUBLIC_*", "VITE_*"])
|
|
22
|
-
*/
|
|
23
|
-
declare const inferFrameworkEnvPatterns: (workspaceRoot: string, projects: Record<string, {
|
|
24
|
-
root: string;
|
|
25
|
-
}>) => Promise<string[]>;
|
|
26
|
-
/**
|
|
27
|
-
* For a specific project, detects frameworks and returns the matching
|
|
28
|
-
* env vars from the current environment.
|
|
29
|
-
* @param packageJsonPath Absolute path to the project's package.json
|
|
30
|
-
* @param env The current environment variables
|
|
31
|
-
* @returns Map of env var name to value for matching framework env vars
|
|
32
|
-
*/
|
|
33
|
-
declare const getFrameworkEnvVariables: (packageJsonPath: string, env?: Record<string, string | undefined>) => Promise<Record<string, string>>;
|
|
34
|
-
export type { DetectedFramework };
|
|
35
|
-
export { detectFrameworks, getFrameworkEnvVariables, inferFrameworkEnvPatterns };
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import type { ProjectGraph, TaskGraph } from "./types.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Graph visualization output formats.
|
|
4
|
-
*/
|
|
5
|
-
type GraphFormat = "dot" | "json" | "html" | "ascii";
|
|
6
|
-
/**
|
|
7
|
-
* Options for graph visualization.
|
|
8
|
-
*/
|
|
9
|
-
interface GraphVisualizerOptions {
|
|
10
|
-
/** Show only affected/filtered tasks (highlight subset) */
|
|
11
|
-
focusedTasks?: string[];
|
|
12
|
-
/** Group tasks by project (default: true) */
|
|
13
|
-
groupByProject?: boolean;
|
|
14
|
-
/** Show task status colors (requires results) */
|
|
15
|
-
taskStatuses?: Map<string, "success" | "failure" | "skipped" | "local-cache" | "local-cache-kept-existing" | "remote-cache" | "running" | "pending">;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Exports a task graph in DOT format for Graphviz rendering.
|
|
19
|
-
* @example
|
|
20
|
-
* ```ts
|
|
21
|
-
* const dot = toGraphvizDot(taskGraph);
|
|
22
|
-
* // Render: dot -Tsvg -o graph.svg <<< "$dot"
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
declare const toGraphvizDot: (taskGraph: TaskGraph, options?: GraphVisualizerOptions) => string;
|
|
26
|
-
/**
|
|
27
|
-
* Exports the task graph as a JSON object suitable for visualization tools.
|
|
28
|
-
*/
|
|
29
|
-
interface GraphJson {
|
|
30
|
-
edges: {
|
|
31
|
-
source: string;
|
|
32
|
-
target: string;
|
|
33
|
-
}[];
|
|
34
|
-
nodes: {
|
|
35
|
-
configuration?: string;
|
|
36
|
-
id: string;
|
|
37
|
-
project: string;
|
|
38
|
-
status?: string;
|
|
39
|
-
target: string;
|
|
40
|
-
}[];
|
|
41
|
-
roots: string[];
|
|
42
|
-
}
|
|
43
|
-
declare const toGraphJson: (taskGraph: TaskGraph, taskStatuses?: Map<string, string>) => {
|
|
44
|
-
edges: GraphJson["edges"];
|
|
45
|
-
nodes: GraphJson["nodes"];
|
|
46
|
-
roots: string[];
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* Generates a self-contained HTML file with an interactive task graph visualization.
|
|
50
|
-
* Uses a simple force-directed layout with SVG rendering (no external dependencies).
|
|
51
|
-
*/
|
|
52
|
-
declare const toGraphHtml: (taskGraph: TaskGraph, options?: GraphVisualizerOptions) => string;
|
|
53
|
-
/**
|
|
54
|
-
* Renders the task graph as ASCII art for terminal display.
|
|
55
|
-
* @example
|
|
56
|
-
* ```
|
|
57
|
-
* Task Graph (6 tasks, 5 dependencies)
|
|
58
|
-
*
|
|
59
|
-
* app:build
|
|
60
|
-
* ├── lib-a:build
|
|
61
|
-
* │ └── lib-core:build
|
|
62
|
-
* └── lib-b:build
|
|
63
|
-
* └── lib-core:build (*)
|
|
64
|
-
*
|
|
65
|
-
* (*) = already shown above
|
|
66
|
-
* ```
|
|
67
|
-
*/
|
|
68
|
-
declare const toGraphAscii: (taskGraph: TaskGraph, options?: GraphVisualizerOptions) => string;
|
|
69
|
-
/**
|
|
70
|
-
* Exports a project graph in DOT format.
|
|
71
|
-
*/
|
|
72
|
-
declare const projectGraphToDot: (projectGraph: ProjectGraph) => string;
|
|
73
|
-
export type { GraphFormat, GraphJson, GraphVisualizerOptions };
|
|
74
|
-
export { projectGraphToDot, toGraphAscii, toGraphHtml, toGraphJson, toGraphvizDot };
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Incremental file hasher that only re-hashes files that have changed
|
|
3
|
-
* since the last run, based on mtime comparison.
|
|
4
|
-
*
|
|
5
|
-
* This is the key performance optimization used by Nx's daemon and
|
|
6
|
-
* Turborepo's daemon — on subsequent runs, only files whose mtime
|
|
7
|
-
* changed need to be re-read and re-hashed.
|
|
8
|
-
*
|
|
9
|
-
* The snapshot (path → { mtime, hash }) is kept in memory and can
|
|
10
|
-
* optionally be persisted to disk for cross-process reuse.
|
|
11
|
-
*/
|
|
12
|
-
interface FileSnapshot {
|
|
13
|
-
/** xxh3-128 hash of file contents */
|
|
14
|
-
hash: string;
|
|
15
|
-
/** Last modification time in milliseconds */
|
|
16
|
-
mtimeMs: number;
|
|
17
|
-
/** File size in bytes (fast pre-check) */
|
|
18
|
-
size: number;
|
|
19
|
-
}
|
|
20
|
-
interface IncrementalHasherOptions {
|
|
21
|
-
/** Directories to skip (default: node_modules, .git, dist, coverage, .cache) */
|
|
22
|
-
ignoredDirs?: Set<string>;
|
|
23
|
-
/** File to persist the snapshot to (for cross-run reuse) */
|
|
24
|
-
snapshotPath?: string;
|
|
25
|
-
workspaceRoot: string;
|
|
26
|
-
}
|
|
27
|
-
declare class IncrementalFileHasher {
|
|
28
|
-
#private;
|
|
29
|
-
constructor(options: IncrementalHasherOptions);
|
|
30
|
-
/**
|
|
31
|
-
* Loads the snapshot from disk if available.
|
|
32
|
-
* Called automatically on first use.
|
|
33
|
-
*/
|
|
34
|
-
load(): Promise<void>;
|
|
35
|
-
/**
|
|
36
|
-
* Persists the current snapshot to disk for cross-run reuse.
|
|
37
|
-
*/
|
|
38
|
-
save(): Promise<void>;
|
|
39
|
-
/**
|
|
40
|
-
* Incrementally hashes all files in a directory.
|
|
41
|
-
*
|
|
42
|
-
* Only files whose mtime or size changed since the last snapshot
|
|
43
|
-
* are re-read and re-hashed. Unchanged files reuse the cached hash.
|
|
44
|
-
*
|
|
45
|
-
* Returns a map of relative paths → hashes.
|
|
46
|
-
*/
|
|
47
|
-
hashDirectory(directoryPath: string): Promise<Record<string, string>>;
|
|
48
|
-
/**
|
|
49
|
-
* Returns how many files are in the snapshot (for diagnostics).
|
|
50
|
-
*/
|
|
51
|
-
get snapshotSize(): number;
|
|
52
|
-
/**
|
|
53
|
-
* Clears the in-memory snapshot.
|
|
54
|
-
*/
|
|
55
|
-
clear(): void;
|
|
56
|
-
/**
|
|
57
|
-
* Looks up the cached hash for `absolutePath` when its mtime and
|
|
58
|
-
* size match the snapshot; returns `undefined` otherwise. Callers
|
|
59
|
-
* that already have a `stat` result (e.g. `InProcessTaskHasher`)
|
|
60
|
-
* skip an extra syscall by passing it through directly.
|
|
61
|
-
*
|
|
62
|
-
* The snapshot is considered loaded on first call — lazy-load is
|
|
63
|
-
* synchronous-friendly here because the caller already performed
|
|
64
|
-
* an async `stat` before calling this method.
|
|
65
|
-
*/
|
|
66
|
-
getSnapshotHash(absolutePath: string, mtimeMs: number, size: number): string | undefined;
|
|
67
|
-
/**
|
|
68
|
-
* Writes a fresh snapshot entry after the caller has computed the
|
|
69
|
-
* hash. Pairs with {@link IncrementalFileHasher.getSnapshotHash}
|
|
70
|
-
* — after a miss, the caller hashes the file and records the
|
|
71
|
-
* result here so the next run can reuse it.
|
|
72
|
-
*/
|
|
73
|
-
recordSnapshot(absolutePath: string, hash: string, mtimeMs: number, size: number): void;
|
|
74
|
-
}
|
|
75
|
-
export type { FileSnapshot, IncrementalHasherOptions };
|
|
76
|
-
export { IncrementalFileHasher };
|
package/dist/life-cycle.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { LifeCycleInterface, Task, TaskResult, TaskStatus } from "./types.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Combines multiple lifecycle handlers into one.
|
|
4
|
-
* Each event is forwarded to all registered handlers.
|
|
5
|
-
*/
|
|
6
|
-
declare class CompositeLifeCycle implements LifeCycleInterface {
|
|
7
|
-
#private;
|
|
8
|
-
constructor(lifeCycles: LifeCycleInterface[]);
|
|
9
|
-
startCommand(): void;
|
|
10
|
-
endCommand(): void;
|
|
11
|
-
scheduleTask(task: Task): void;
|
|
12
|
-
startTasks(tasks: Task[]): void;
|
|
13
|
-
endTasks(taskResults: TaskResult[]): void;
|
|
14
|
-
printTaskTerminalOutput(task: Task, status: TaskStatus, terminalOutput: string): void;
|
|
15
|
-
printCacheMiss(task: Task, reasons: string): void;
|
|
16
|
-
onTaskStdout(task: Task, chunk: string): void;
|
|
17
|
-
onTaskStderr(task: Task, chunk: string): void;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* A lifecycle handler that logs task progress to the console.
|
|
21
|
-
*/
|
|
22
|
-
declare class ConsoleLifeCycle implements LifeCycleInterface {
|
|
23
|
-
#private;
|
|
24
|
-
constructor(verbose?: boolean);
|
|
25
|
-
startCommand(): void;
|
|
26
|
-
endCommand(): void;
|
|
27
|
-
scheduleTask(task: Task): void;
|
|
28
|
-
startTasks(tasks: Task[]): void;
|
|
29
|
-
endTasks(taskResults: TaskResult[]): void;
|
|
30
|
-
printTaskTerminalOutput(_task: Task, _status: TaskStatus, terminalOutput: string): void;
|
|
31
|
-
printCacheMiss(task: Task, reasons: string): void;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* A no-op lifecycle handler. Useful as a default.
|
|
35
|
-
*/
|
|
36
|
-
declare class EmptyLifeCycle implements LifeCycleInterface {
|
|
37
|
-
}
|
|
38
|
-
export { CompositeLifeCycle, ConsoleLifeCycle, EmptyLifeCycle };
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resolved dependency entry from a lockfile.
|
|
3
|
-
*/
|
|
4
|
-
interface ResolvedDependency {
|
|
5
|
-
/** The package name */
|
|
6
|
-
name: string;
|
|
7
|
-
/** The resolved version */
|
|
8
|
-
version: string;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Result of parsing a lockfile for a specific package.
|
|
12
|
-
*/
|
|
13
|
-
interface PackageLockfileHash {
|
|
14
|
-
/** The resolved dependencies that were included in the hash */
|
|
15
|
-
dependencies: ResolvedDependency[];
|
|
16
|
-
/** Hash of the resolved dependencies relevant to this package */
|
|
17
|
-
hash: string;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Extracts a package name from a node_modules path.
|
|
21
|
-
* E.g., "node_modules/@scope/name" -> "@scope/name",
|
|
22
|
-
* "node_modules/name" -> "name",
|
|
23
|
-
* "node_modules/.package-lock.json" -> undefined.
|
|
24
|
-
*/
|
|
25
|
-
declare const extractPackageName: (path: string) => string | undefined;
|
|
26
|
-
/**
|
|
27
|
-
* Parses package-lock.json (npm v2/v3 format) to extract resolved versions.
|
|
28
|
-
* The v2/v3 format uses a flat "packages" map with paths like "node_modules/pkg-name".
|
|
29
|
-
*/
|
|
30
|
-
declare const parseNpmLockfile: (content: string) => Map<string, string>;
|
|
31
|
-
/**
|
|
32
|
-
* Parses pnpm-lock.yaml to extract resolved versions.
|
|
33
|
-
* Uses a lightweight regex-based parser to avoid a YAML dependency.
|
|
34
|
-
*/
|
|
35
|
-
declare const parsePnpmLockfile: (content: string) => Map<string, string>;
|
|
36
|
-
/**
|
|
37
|
-
* Parses yarn.lock to extract resolved versions.
|
|
38
|
-
* Works with both Yarn Classic (v1) and Berry (v2+) formats.
|
|
39
|
-
*/
|
|
40
|
-
declare const parseYarnLockfile: (content: string) => Map<string, string>;
|
|
41
|
-
/**
|
|
42
|
-
* Smart lockfile hasher that only hashes the resolved versions
|
|
43
|
-
* of a package's actual dependencies, not the entire lockfile.
|
|
44
|
-
*
|
|
45
|
-
* This matches Turborepo's smart lockfile hashing behavior:
|
|
46
|
-
* changing the lockfile only busts cache for affected packages.
|
|
47
|
-
*
|
|
48
|
-
* Supports:
|
|
49
|
-
* - package-lock.json (npm v2/v3)
|
|
50
|
-
* - pnpm-lock.yaml (pnpm)
|
|
51
|
-
* - yarn.lock (Yarn Classic + Berry)
|
|
52
|
-
*/
|
|
53
|
-
declare class LockfileHasher {
|
|
54
|
-
#private;
|
|
55
|
-
constructor(workspaceRoot: string);
|
|
56
|
-
/**
|
|
57
|
-
* Computes a hash based only on the resolved dependency versions
|
|
58
|
-
* relevant to a specific package.
|
|
59
|
-
* @param packageJsonPath Path to the package.json (relative to workspace root)
|
|
60
|
-
* @returns Hash of the relevant lockfile entries, or undefined if no lockfile found
|
|
61
|
-
*/
|
|
62
|
-
hashForPackage(packageJsonPath: string): Promise<PackageLockfileHash | undefined>;
|
|
63
|
-
/**
|
|
64
|
-
* Returns the type of lockfile detected, or undefined if none found.
|
|
65
|
-
*/
|
|
66
|
-
get lockfileType(): "npm" | "pnpm" | "yarn" | undefined;
|
|
67
|
-
/**
|
|
68
|
-
* Clears the cached lockfile data.
|
|
69
|
-
*/
|
|
70
|
-
clearCache(): void;
|
|
71
|
-
}
|
|
72
|
-
export type { PackageLockfileHash, ResolvedDependency };
|
|
73
|
-
export { extractPackageName, LockfileHasher, parseNpmLockfile, parsePnpmLockfile, parseYarnLockfile };
|
package/dist/log-reporter.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { LifeCycleInterface, Task, TaskResult, TaskStatus } from "./types.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Output formatting mode for task terminal output.
|
|
4
|
-
*
|
|
5
|
-
* - `interleaved` **(default)**: emit each task's buffered output as-is
|
|
6
|
-
* — lines from parallel tasks may intermix when streamed live.
|
|
7
|
-
* - `labeled`: prefix every line with `[project#target]` so parallel
|
|
8
|
-
* tasks remain distinguishable.
|
|
9
|
-
* - `grouped`: buffer each task's output and print it as a single block
|
|
10
|
-
* bracketed by `── project#target ──` header and blank-line footer.
|
|
11
|
-
*
|
|
12
|
-
* Matches the three modes exposed by vite-task's `--log` flag.
|
|
13
|
-
*/
|
|
14
|
-
export type LogMode = "grouped" | "interleaved" | "labeled";
|
|
15
|
-
/**
|
|
16
|
-
* A lifecycle handler that renders task terminal output per {@link LogMode}.
|
|
17
|
-
*
|
|
18
|
-
* Operates on the buffered `printTaskTerminalOutput` signal the orchestrator
|
|
19
|
-
* emits at task-completion. Line-by-line streaming is the consumer's
|
|
20
|
-
* responsibility — a streaming reporter can wrap this one and emit buffered
|
|
21
|
-
* output at the end of each task regardless of streaming choices.
|
|
22
|
-
*/
|
|
23
|
-
export declare class LogReporter implements LifeCycleInterface {
|
|
24
|
-
#private;
|
|
25
|
-
constructor(mode: LogMode, write?: (chunk: string) => void);
|
|
26
|
-
printTaskTerminalOutput(task: Task, _status: TaskStatus, terminalOutput: string): void;
|
|
27
|
-
endTasks(_taskResults: TaskResult[]): void;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Convenience factory matching vite-task's `createLogReporter(mode)` surface.
|
|
31
|
-
* Consumers that already compose their own lifecycle handlers can instantiate
|
|
32
|
-
* {@link LogReporter} directly.
|
|
33
|
-
*/
|
|
34
|
-
export declare const createLogReporter: (mode: LogMode, write?: (chunk: string) => void) => LogReporter;
|
package/dist/native-binding.d.ts
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Optional native bindings for performance-critical operations.
|
|
3
|
-
*
|
|
4
|
-
* The native addon (Rust via napi-rs) provides:
|
|
5
|
-
* - Parallel file hashing using rayon + xxHash xxh3-128
|
|
6
|
-
* - Optimized task hash computation
|
|
7
|
-
* - Fast graph operations (cycle detection, topological sort)
|
|
8
|
-
*
|
|
9
|
-
* Falls back to pure TypeScript implementations when the native
|
|
10
|
-
* addon is not available (not compiled, wrong platform, etc.).
|
|
11
|
-
*
|
|
12
|
-
* Build with: pnpm build:native
|
|
13
|
-
* The napi v3 CLI outputs the .node file to the package root.
|
|
14
|
-
*/
|
|
15
|
-
interface NativeFileHash {
|
|
16
|
-
hash: string;
|
|
17
|
-
path: string;
|
|
18
|
-
}
|
|
19
|
-
interface NativeTaskHashDetails {
|
|
20
|
-
command: string;
|
|
21
|
-
implicit_deps?: string[][];
|
|
22
|
-
nodes: string[][];
|
|
23
|
-
runtime?: string[][];
|
|
24
|
-
}
|
|
25
|
-
interface NativeTaskGraph {
|
|
26
|
-
edges: string[][];
|
|
27
|
-
task_ids: string[];
|
|
28
|
-
}
|
|
29
|
-
interface NativeCycleResult {
|
|
30
|
-
cycle: string[];
|
|
31
|
-
has_cycle: boolean;
|
|
32
|
-
}
|
|
33
|
-
interface NativeConcurrentCommandConfig {
|
|
34
|
-
command: string;
|
|
35
|
-
cwd?: string;
|
|
36
|
-
env?: Record<string, string>;
|
|
37
|
-
name?: string;
|
|
38
|
-
shell?: boolean;
|
|
39
|
-
stdin?: string;
|
|
40
|
-
}
|
|
41
|
-
interface NativeConcurrentRunnerOptions {
|
|
42
|
-
killOthers?: string[];
|
|
43
|
-
killSignal?: string;
|
|
44
|
-
killTimeout?: number;
|
|
45
|
-
maxProcesses?: number;
|
|
46
|
-
shellPath?: string;
|
|
47
|
-
successCondition?: string;
|
|
48
|
-
}
|
|
49
|
-
interface NativeProcessEvent {
|
|
50
|
-
commandName?: string;
|
|
51
|
-
durationMs?: number;
|
|
52
|
-
exitCode?: number;
|
|
53
|
-
index: number;
|
|
54
|
-
killed?: boolean;
|
|
55
|
-
kind: string;
|
|
56
|
-
message?: string;
|
|
57
|
-
text?: string;
|
|
58
|
-
}
|
|
59
|
-
interface NativeConcurrentCloseEvent {
|
|
60
|
-
command: string;
|
|
61
|
-
durationMs: number;
|
|
62
|
-
exitCode: number;
|
|
63
|
-
index: number;
|
|
64
|
-
killed: boolean;
|
|
65
|
-
name?: string;
|
|
66
|
-
}
|
|
67
|
-
interface NativeConcurrentRunResult {
|
|
68
|
-
closeEvents: NativeConcurrentCloseEvent[];
|
|
69
|
-
success: boolean;
|
|
70
|
-
}
|
|
71
|
-
interface NativeBindings {
|
|
72
|
-
collectFiles: (directory: string) => string[];
|
|
73
|
-
computeTaskHash: (details: NativeTaskHashDetails) => string;
|
|
74
|
-
findAllCycles: (graph: NativeTaskGraph) => string[][];
|
|
75
|
-
findBackEdges: (graph: NativeTaskGraph) => string[][];
|
|
76
|
-
findCycle: (graph: NativeTaskGraph) => NativeCycleResult;
|
|
77
|
-
getDependentTasks: (graph: NativeTaskGraph, taskId: string) => string[];
|
|
78
|
-
getTransitiveDeps: (graph: NativeTaskGraph, taskId: string) => string[];
|
|
79
|
-
hashCommand: (project: string, target: string, configuration: string | undefined, overridesJson: string) => string;
|
|
80
|
-
hashEnvVar: (name: string, value: string) => string;
|
|
81
|
-
hashFile: (filePath: string) => string;
|
|
82
|
-
hashFilesBatch: (filePaths: string[], workspaceRoot: string) => NativeFileHash[];
|
|
83
|
-
hashFilesInDirectory: (directory: string, workspaceRoot: string) => NativeFileHash[];
|
|
84
|
-
hashString: (input: string) => string;
|
|
85
|
-
hashStrings: (inputs: string[]) => string;
|
|
86
|
-
runConcurrent: (commands: NativeConcurrentCommandConfig[], options: NativeConcurrentRunnerOptions, onEvent: (event: NativeProcessEvent) => void) => Promise<NativeConcurrentRunResult>;
|
|
87
|
-
runConcurrentBatch: (commands: NativeConcurrentCommandConfig[], options: NativeConcurrentRunnerOptions) => Promise<NativeConcurrentRunResult>;
|
|
88
|
-
topologicalSort: (graph: NativeTaskGraph) => string[];
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Attempts to load the native addon. Returns undefined if unavailable.
|
|
92
|
-
* The result is cached after the first attempt.
|
|
93
|
-
*
|
|
94
|
-
* napi v3 outputs the .node file to the package root as
|
|
95
|
-
* `task-runner-native.<platform>.node`. The napi-generated index.js
|
|
96
|
-
* handles platform detection automatically.
|
|
97
|
-
*
|
|
98
|
-
* Uses createRequire because the napi-generated index.js is CJS.
|
|
99
|
-
*/
|
|
100
|
-
declare const loadNativeBindings: () => NativeBindings | undefined;
|
|
101
|
-
/**
|
|
102
|
-
* Returns true if the native addon is loaded and available.
|
|
103
|
-
*/
|
|
104
|
-
declare const isNativeAvailable: () => boolean;
|
|
105
|
-
export type { NativeBindings, NativeConcurrentCloseEvent, NativeConcurrentCommandConfig, NativeConcurrentRunnerOptions, NativeConcurrentRunResult, NativeCycleResult, NativeFileHash, NativeProcessEvent, NativeTaskGraph, NativeTaskHashDetails, };
|
|
106
|
-
export { isNativeAvailable, loadNativeBindings };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { OutputSpec } from "./types.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Expands a task's `OutputSpec[]` into the concrete file list to
|
|
4
|
-
* archive:
|
|
5
|
-
*
|
|
6
|
-
* - literal paths → kept as-is (the archiver recursively copies
|
|
7
|
-
* directories, so `"dist"` captures its whole tree);
|
|
8
|
-
* - positive globs → expanded via `fs.glob`, filtered to files only;
|
|
9
|
-
* - negatives (`!pattern`) → applied to the combined result;
|
|
10
|
-
* - `{ auto: true }` → pulls in `autoWrites` entries that fall inside
|
|
11
|
-
* the workspace.
|
|
12
|
-
*
|
|
13
|
-
* Returns deduped, sorted workspace-relative paths so archives are
|
|
14
|
-
* byte-reproducible across invocations.
|
|
15
|
-
*
|
|
16
|
-
* Silent degradation: missing literal paths, empty glob matches, and
|
|
17
|
-
* `{ auto: true }` without tracked writes all contribute nothing
|
|
18
|
-
* rather than throwing.
|
|
19
|
-
*/
|
|
20
|
-
export declare const resolveOutputs: (workspaceRoot: string, outputs: OutputSpec[] | undefined, autoWrites?: ReadonlyArray<string>) => Promise<string[]>;
|