@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,219 +0,0 @@
|
|
|
1
|
-
import { createRequire as __cjs_createRequire } from "node:module";
|
|
2
|
-
|
|
3
|
-
const __cjs_require = __cjs_createRequire(import.meta.url);
|
|
4
|
-
|
|
5
|
-
const __cjs_getProcess = typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" ? globalThis.process : process;
|
|
6
|
-
|
|
7
|
-
const __cjs_getBuiltinModule = (module) => {
|
|
8
|
-
// Check if we're in Node.js and version supports getBuiltinModule
|
|
9
|
-
if (typeof __cjs_getProcess !== "undefined" && __cjs_getProcess.versions && __cjs_getProcess.versions.node) {
|
|
10
|
-
const [major, minor] = __cjs_getProcess.versions.node.split(".").map(Number);
|
|
11
|
-
// Node.js 20.16.0+ and 22.3.0+
|
|
12
|
-
if (major > 22 || (major === 22 && minor >= 3) || (major === 20 && minor >= 16)) {
|
|
13
|
-
return __cjs_getProcess.getBuiltinModule(module);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
// Fallback to createRequire
|
|
17
|
-
return __cjs_require(module);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const {
|
|
21
|
-
createHmac,
|
|
22
|
-
timingSafeEqual
|
|
23
|
-
} = __cjs_getBuiltinModule("node:crypto");
|
|
24
|
-
const {
|
|
25
|
-
createWriteStream,
|
|
26
|
-
createReadStream
|
|
27
|
-
} = __cjs_getBuiltinModule("node:fs");
|
|
28
|
-
const {
|
|
29
|
-
mkdir,
|
|
30
|
-
rm,
|
|
31
|
-
stat
|
|
32
|
-
} = __cjs_getBuiltinModule("node:fs/promises");
|
|
33
|
-
const {
|
|
34
|
-
pipeline
|
|
35
|
-
} = __cjs_getBuiltinModule("node:stream/promises");
|
|
36
|
-
import { join } from '@visulima/path';
|
|
37
|
-
import { e as extractTarBrotli, a as extractTarGz, c as createTarBrotli, b as createTarGz } from './archive-UQHAnZUa.js';
|
|
38
|
-
|
|
39
|
-
const SIGNATURE_HEADER = "X-Artifact-Signature";
|
|
40
|
-
const MIN_SECRET_LENGTH = 16;
|
|
41
|
-
const computeArtifactSignatureStream = async (secret, hash, archivePath) => {
|
|
42
|
-
const hmac = createHmac("sha256", secret);
|
|
43
|
-
hmac.update(hash);
|
|
44
|
-
const source = createReadStream(archivePath);
|
|
45
|
-
for await (const chunk of source) {
|
|
46
|
-
hmac.update(chunk);
|
|
47
|
-
}
|
|
48
|
-
return hmac.digest("hex");
|
|
49
|
-
};
|
|
50
|
-
const signaturesMatch = (a, b) => {
|
|
51
|
-
if (a.length !== b.length) {
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
try {
|
|
55
|
-
return timingSafeEqual(Buffer.from(a, "hex"), Buffer.from(b, "hex"));
|
|
56
|
-
} catch {
|
|
57
|
-
return false;
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
class RemoteCache {
|
|
61
|
-
#url;
|
|
62
|
-
#token;
|
|
63
|
-
#teamId;
|
|
64
|
-
#timeout;
|
|
65
|
-
#read;
|
|
66
|
-
#write;
|
|
67
|
-
#onUploadError;
|
|
68
|
-
#compression;
|
|
69
|
-
#signingSecret;
|
|
70
|
-
#verifyOnDownload;
|
|
71
|
-
constructor(options) {
|
|
72
|
-
this.#url = options.url.replace(/\/$/, "");
|
|
73
|
-
this.#token = options.token;
|
|
74
|
-
this.#teamId = options.teamId;
|
|
75
|
-
this.#timeout = options.timeout ?? 3e4;
|
|
76
|
-
this.#read = options.read ?? true;
|
|
77
|
-
this.#write = options.write ?? true;
|
|
78
|
-
this.#onUploadError = options.onUploadError;
|
|
79
|
-
this.#compression = options.compression ?? "gzip";
|
|
80
|
-
if (options.signing) {
|
|
81
|
-
if (options.signing.secret.length < MIN_SECRET_LENGTH) {
|
|
82
|
-
throw new Error(`Remote cache signing secret must be at least ${String(MIN_SECRET_LENGTH)} characters.`);
|
|
83
|
-
}
|
|
84
|
-
this.#signingSecret = options.signing.secret;
|
|
85
|
-
this.#verifyOnDownload = options.signing.verifyOnDownload ?? false;
|
|
86
|
-
} else {
|
|
87
|
-
this.#signingSecret = void 0;
|
|
88
|
-
this.#verifyOnDownload = false;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Retrieves a cached artifact from the remote cache.
|
|
93
|
-
* Returns the local path to the extracted cache entry, or undefined if not found.
|
|
94
|
-
*/
|
|
95
|
-
async retrieve(hash, localCacheDirectory) {
|
|
96
|
-
if (!this.#read) {
|
|
97
|
-
return false;
|
|
98
|
-
}
|
|
99
|
-
const entryDirectory = join(localCacheDirectory, hash);
|
|
100
|
-
const archivePath = join(localCacheDirectory, `.remote-${hash}.tar.gz`);
|
|
101
|
-
try {
|
|
102
|
-
const artifactUrl = this.#buildUrl(`/v8/artifacts/${hash}`);
|
|
103
|
-
const response = await fetch(artifactUrl, {
|
|
104
|
-
headers: this.#buildHeaders(),
|
|
105
|
-
method: "GET",
|
|
106
|
-
signal: AbortSignal.timeout(this.#timeout)
|
|
107
|
-
});
|
|
108
|
-
if (!response.ok) {
|
|
109
|
-
return false;
|
|
110
|
-
}
|
|
111
|
-
const receivedSignature = this.#signingSecret ? response.headers.get(SIGNATURE_HEADER.toLowerCase()) ?? response.headers.get(SIGNATURE_HEADER) : null;
|
|
112
|
-
if (this.#signingSecret && !receivedSignature && this.#verifyOnDownload) {
|
|
113
|
-
return false;
|
|
114
|
-
}
|
|
115
|
-
if (!response.body) {
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
118
|
-
await mkdir(localCacheDirectory, { recursive: true });
|
|
119
|
-
await pipeline(response.body, createWriteStream(archivePath));
|
|
120
|
-
if (this.#signingSecret && receivedSignature) {
|
|
121
|
-
const expected = await computeArtifactSignatureStream(this.#signingSecret, hash, archivePath);
|
|
122
|
-
if (!signaturesMatch(receivedSignature, expected)) {
|
|
123
|
-
return false;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
await mkdir(entryDirectory, { recursive: true });
|
|
127
|
-
await (this.#compression === "brotli" ? extractTarBrotli(archivePath, entryDirectory) : extractTarGz(archivePath, entryDirectory));
|
|
128
|
-
await rm(archivePath, { force: true });
|
|
129
|
-
return true;
|
|
130
|
-
} catch {
|
|
131
|
-
await rm(archivePath, { force: true }).catch(() => {
|
|
132
|
-
});
|
|
133
|
-
await rm(entryDirectory, { force: true, recursive: true }).catch(() => {
|
|
134
|
-
});
|
|
135
|
-
return false;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Stores a cache entry in the remote cache.
|
|
140
|
-
*/
|
|
141
|
-
async store(hash, localCacheDirectory) {
|
|
142
|
-
if (!this.#write) {
|
|
143
|
-
return false;
|
|
144
|
-
}
|
|
145
|
-
const entryDirectory = join(localCacheDirectory, hash);
|
|
146
|
-
const archivePath = join(localCacheDirectory, `.upload-${hash}.tar.gz`);
|
|
147
|
-
try {
|
|
148
|
-
await stat(join(entryDirectory, ".commit"));
|
|
149
|
-
await (this.#compression === "brotli" ? createTarBrotli(entryDirectory, archivePath) : createTarGz(entryDirectory, archivePath));
|
|
150
|
-
const artifactUrl = this.#buildUrl(`/v8/artifacts/${hash}`);
|
|
151
|
-
const { size } = await stat(archivePath);
|
|
152
|
-
const uploadHeaders = {
|
|
153
|
-
...this.#buildHeaders(),
|
|
154
|
-
"Content-Length": String(size),
|
|
155
|
-
// Advertise the compression format in a custom header so
|
|
156
|
-
// spec-compatible servers (and the matching download side)
|
|
157
|
-
// can branch if needed. The body is still an opaque blob
|
|
158
|
-
// from the server's perspective.
|
|
159
|
-
"Content-Type": "application/octet-stream",
|
|
160
|
-
"X-Artifact-Compression": this.#compression
|
|
161
|
-
};
|
|
162
|
-
if (this.#signingSecret) {
|
|
163
|
-
uploadHeaders[SIGNATURE_HEADER] = await computeArtifactSignatureStream(this.#signingSecret, hash, archivePath);
|
|
164
|
-
}
|
|
165
|
-
const response = await fetch(artifactUrl, {
|
|
166
|
-
body: createReadStream(archivePath),
|
|
167
|
-
// @ts-expect-error — `duplex` is a Node-specific fetch
|
|
168
|
-
// option required when the body is a stream. The DOM
|
|
169
|
-
// `RequestInit` type doesn't include it yet.
|
|
170
|
-
duplex: "half",
|
|
171
|
-
headers: uploadHeaders,
|
|
172
|
-
method: "PUT",
|
|
173
|
-
signal: AbortSignal.timeout(this.#timeout)
|
|
174
|
-
});
|
|
175
|
-
await rm(archivePath, { force: true });
|
|
176
|
-
return response.ok;
|
|
177
|
-
} catch (error) {
|
|
178
|
-
await rm(archivePath, { force: true }).catch(() => {
|
|
179
|
-
});
|
|
180
|
-
this.#onUploadError?.(hash, error);
|
|
181
|
-
return false;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Checks if an artifact exists in the remote cache without downloading it.
|
|
186
|
-
*/
|
|
187
|
-
async exists(hash) {
|
|
188
|
-
if (!this.#read) {
|
|
189
|
-
return false;
|
|
190
|
-
}
|
|
191
|
-
try {
|
|
192
|
-
const artifactUrl = this.#buildUrl(`/v8/artifacts/${hash}`);
|
|
193
|
-
const response = await fetch(artifactUrl, {
|
|
194
|
-
headers: this.#buildHeaders(),
|
|
195
|
-
method: "HEAD",
|
|
196
|
-
signal: AbortSignal.timeout(this.#timeout)
|
|
197
|
-
});
|
|
198
|
-
return response.ok;
|
|
199
|
-
} catch {
|
|
200
|
-
return false;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
#buildUrl(path) {
|
|
204
|
-
const url = `${this.#url}${path}`;
|
|
205
|
-
if (this.#teamId) {
|
|
206
|
-
return `${url}?teamId=${encodeURIComponent(this.#teamId)}`;
|
|
207
|
-
}
|
|
208
|
-
return url;
|
|
209
|
-
}
|
|
210
|
-
#buildHeaders() {
|
|
211
|
-
const headers = {};
|
|
212
|
-
if (this.#token) {
|
|
213
|
-
headers["Authorization"] = `Bearer ${this.#token}`;
|
|
214
|
-
}
|
|
215
|
-
return headers;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
export { RemoteCache };
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { createRequire as __cjs_createRequire } from "node:module";
|
|
2
|
-
|
|
3
|
-
const __cjs_require = __cjs_createRequire(import.meta.url);
|
|
4
|
-
|
|
5
|
-
const __cjs_getProcess = typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" ? globalThis.process : process;
|
|
6
|
-
|
|
7
|
-
const __cjs_getBuiltinModule = (module) => {
|
|
8
|
-
// Check if we're in Node.js and version supports getBuiltinModule
|
|
9
|
-
if (typeof __cjs_getProcess !== "undefined" && __cjs_getProcess.versions && __cjs_getProcess.versions.node) {
|
|
10
|
-
const [major, minor] = __cjs_getProcess.versions.node.split(".").map(Number);
|
|
11
|
-
// Node.js 20.16.0+ and 22.3.0+
|
|
12
|
-
if (major > 22 || (major === 22 && minor >= 3) || (major === 20 && minor >= 16)) {
|
|
13
|
-
return __cjs_getProcess.getBuiltinModule(module);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
// Fallback to createRequire
|
|
17
|
-
return __cjs_require(module);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const {
|
|
21
|
-
execFile
|
|
22
|
-
} = __cjs_getBuiltinModule("node:child_process");
|
|
23
|
-
const {
|
|
24
|
-
createReadStream,
|
|
25
|
-
createWriteStream
|
|
26
|
-
} = __cjs_getBuiltinModule("node:fs");
|
|
27
|
-
const {
|
|
28
|
-
rm
|
|
29
|
-
} = __cjs_getBuiltinModule("node:fs/promises");
|
|
30
|
-
const {
|
|
31
|
-
pipeline
|
|
32
|
-
} = __cjs_getBuiltinModule("node:stream/promises");
|
|
33
|
-
const {
|
|
34
|
-
createBrotliDecompress,
|
|
35
|
-
createBrotliCompress,
|
|
36
|
-
constants
|
|
37
|
-
} = __cjs_getBuiltinModule("node:zlib");
|
|
38
|
-
|
|
39
|
-
const BROTLI_COMPRESS_OPTIONS = {
|
|
40
|
-
params: {
|
|
41
|
-
[constants.BROTLI_PARAM_MODE]: constants.BROTLI_MODE_TEXT,
|
|
42
|
-
[constants.BROTLI_PARAM_QUALITY]: 4
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
const createTar = (sourceDirectory, outputPath) => new Promise((resolve, reject) => {
|
|
46
|
-
execFile("tar", ["-cf", outputPath, "-C", sourceDirectory, "."], (error) => {
|
|
47
|
-
if (error) {
|
|
48
|
-
reject(error);
|
|
49
|
-
} else {
|
|
50
|
-
resolve();
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
const extractTar = (archivePath, destinationDirectory) => new Promise((resolve, reject) => {
|
|
55
|
-
execFile("tar", ["-xf", archivePath, "-C", destinationDirectory], (error) => {
|
|
56
|
-
if (error) {
|
|
57
|
-
reject(error);
|
|
58
|
-
} else {
|
|
59
|
-
resolve();
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
const createTarGz = (sourceDirectory, outputPath) => new Promise((resolve, reject) => {
|
|
64
|
-
execFile("tar", ["-czf", outputPath, "-C", sourceDirectory, "."], (error) => {
|
|
65
|
-
if (error) {
|
|
66
|
-
reject(error);
|
|
67
|
-
} else {
|
|
68
|
-
resolve();
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
const extractTarGz = (archivePath, destinationDirectory) => new Promise((resolve, reject) => {
|
|
73
|
-
execFile("tar", ["-xzf", archivePath, "-C", destinationDirectory], (error) => {
|
|
74
|
-
if (error) {
|
|
75
|
-
reject(error);
|
|
76
|
-
} else {
|
|
77
|
-
resolve();
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
const createTarBrotli = async (sourceDirectory, outputPath) => {
|
|
82
|
-
const tarPath = `${outputPath}.tar`;
|
|
83
|
-
try {
|
|
84
|
-
await createTar(sourceDirectory, tarPath);
|
|
85
|
-
await pipeline(createReadStream(tarPath), createBrotliCompress(BROTLI_COMPRESS_OPTIONS), createWriteStream(outputPath));
|
|
86
|
-
} finally {
|
|
87
|
-
await rm(tarPath, { force: true }).catch(() => {
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
const extractTarBrotli = async (archivePath, destinationDirectory) => {
|
|
92
|
-
const tarPath = `${archivePath}.tar`;
|
|
93
|
-
try {
|
|
94
|
-
await pipeline(createReadStream(archivePath), createBrotliDecompress(), createWriteStream(tarPath));
|
|
95
|
-
await extractTar(tarPath, destinationDirectory);
|
|
96
|
-
} finally {
|
|
97
|
-
await rm(tarPath, { force: true }).catch(() => {
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
export { extractTarGz as a, createTarGz as b, createTarBrotli as c, extractTarBrotli as e };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ConstraintsConfig, ConstraintViolation, ProjectGraph } from "./types.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Enforces project dependency constraints on a project graph.
|
|
4
|
-
* @param projectGraph The workspace project graph to validate.
|
|
5
|
-
* @param constraints The constraint rules to enforce.
|
|
6
|
-
* @returns Array of violations found. Empty means all constraints pass.
|
|
7
|
-
*/
|
|
8
|
-
declare const enforceProjectConstraints: (projectGraph: ProjectGraph, constraints: ConstraintsConfig) => ConstraintViolation[];
|
|
9
|
-
export { enforceProjectConstraints };
|
package/dist/remote-cache.d.ts
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Compression algorithm used for artifact tarballs on the wire.
|
|
3
|
-
* - `"gzip"` (default): tar+gzip, matches Turborepo's protocol format
|
|
4
|
-
* and stays interop-safe with existing remote cache servers.
|
|
5
|
-
* - `"brotli"`: tar + Node brotli (BROTLI_MODE_TEXT, quality 4) — a
|
|
6
|
-
* solid ratio/speed trade-off for source-tree tarballs. Both upload
|
|
7
|
-
* and download sides must agree; switching invalidates existing
|
|
8
|
-
* remote entries (they will simply re-populate on next run).
|
|
9
|
-
*/
|
|
10
|
-
export type RemoteCacheCompression = "brotli" | "gzip";
|
|
11
|
-
/**
|
|
12
|
-
* HMAC signing configuration for cache integrity.
|
|
13
|
-
*
|
|
14
|
-
* When set, every upload carries an `X-Artifact-Signature` header
|
|
15
|
-
* containing the HMAC-SHA256 digest of `hash | body`. On download,
|
|
16
|
-
* the client recomputes the HMAC and rejects any artifact whose
|
|
17
|
-
* signature doesn't match using a constant-time comparison.
|
|
18
|
-
*
|
|
19
|
-
* Prevents cache poisoning in shared team environments where a
|
|
20
|
-
* compromised cache server (or a MITM) could inject malicious
|
|
21
|
-
* artifacts. Unsigned entries (written before signing was enabled)
|
|
22
|
-
* are accepted only when `verifyOnDownload === false` — the default.
|
|
23
|
-
*/
|
|
24
|
-
export interface RemoteCacheSigning {
|
|
25
|
-
/** Shared secret. Must be at least 16 characters. */
|
|
26
|
-
secret: string;
|
|
27
|
-
/**
|
|
28
|
-
* Reject downloads whose signature doesn't match or is missing.
|
|
29
|
-
* Set to `true` once every upload on your server is signed.
|
|
30
|
-
* @default false
|
|
31
|
-
*/
|
|
32
|
-
verifyOnDownload?: boolean;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Options for the remote cache.
|
|
36
|
-
*/
|
|
37
|
-
interface RemoteCacheOptions {
|
|
38
|
-
/**
|
|
39
|
-
* Compression format for artifact tarballs. Defaults to `"gzip"`
|
|
40
|
-
* for Turborepo protocol compatibility.
|
|
41
|
-
*/
|
|
42
|
-
compression?: RemoteCacheCompression;
|
|
43
|
-
/**
|
|
44
|
-
* Called when a fire-and-forget upload fails.
|
|
45
|
-
* Since uploads are non-blocking, errors are silently swallowed by default.
|
|
46
|
-
* Provide this callback to log or report upload failures.
|
|
47
|
-
*/
|
|
48
|
-
onUploadError?: (hash: string, error: unknown) => void;
|
|
49
|
-
/** Whether to enable remote cache reads */
|
|
50
|
-
read?: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* HMAC-SHA256 signing for upload integrity. When set, every
|
|
53
|
-
* uploaded artifact carries an `X-Artifact-Signature` header;
|
|
54
|
-
* downloads with `verifyOnDownload: true` reject unsigned or
|
|
55
|
-
* tampered payloads.
|
|
56
|
-
*/
|
|
57
|
-
signing?: RemoteCacheSigning;
|
|
58
|
-
/** Team ID or namespace for cache isolation */
|
|
59
|
-
teamId?: string;
|
|
60
|
-
/** Request timeout in milliseconds (default: 30000) */
|
|
61
|
-
timeout?: number;
|
|
62
|
-
/** Authentication token for the remote cache */
|
|
63
|
-
token?: string;
|
|
64
|
-
/** Remote cache server URL (e.g., "https://cache.example.com") */
|
|
65
|
-
url: string;
|
|
66
|
-
/** Whether to enable remote cache writes */
|
|
67
|
-
write?: boolean;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* HTTP-based remote cache compatible with the Turborepo remote cache protocol.
|
|
71
|
-
*
|
|
72
|
-
* Protocol:
|
|
73
|
-
* - GET /v8/artifacts/{hash}?teamId={team} -> retrieve cached artifact (gzipped tar)
|
|
74
|
-
* - PUT /v8/artifacts/{hash}?teamId={team} -> store artifact
|
|
75
|
-
* - POST /v8/artifacts/events -> analytics (optional)
|
|
76
|
-
*
|
|
77
|
-
* Authentication via `Authorization: Bearer {token}` header.
|
|
78
|
-
*
|
|
79
|
-
* The cache entry is a gzipped tarball containing the cache directory contents
|
|
80
|
-
* (code, terminalOutput, fingerprint.json, outputs/, .commit).
|
|
81
|
-
*/
|
|
82
|
-
declare class RemoteCache {
|
|
83
|
-
#private;
|
|
84
|
-
constructor(options: RemoteCacheOptions);
|
|
85
|
-
/**
|
|
86
|
-
* Retrieves a cached artifact from the remote cache.
|
|
87
|
-
* Returns the local path to the extracted cache entry, or undefined if not found.
|
|
88
|
-
*/
|
|
89
|
-
retrieve(hash: string, localCacheDirectory: string): Promise<boolean>;
|
|
90
|
-
/**
|
|
91
|
-
* Stores a cache entry in the remote cache.
|
|
92
|
-
*/
|
|
93
|
-
store(hash: string, localCacheDirectory: string): Promise<boolean>;
|
|
94
|
-
/**
|
|
95
|
-
* Checks if an artifact exists in the remote cache without downloading it.
|
|
96
|
-
*/
|
|
97
|
-
exists(hash: string): Promise<boolean>;
|
|
98
|
-
}
|
|
99
|
-
export type { RemoteCacheOptions };
|
|
100
|
-
export { RemoteCache };
|
package/dist/run-summary.d.ts
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import type { OutputSpec, TaskGraph, TaskHashDetails, TaskResults } from "./types.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Summary of a single task execution.
|
|
4
|
-
*/
|
|
5
|
-
interface TaskSummary {
|
|
6
|
-
/** Whether the task was cacheable */
|
|
7
|
-
cacheable: boolean;
|
|
8
|
-
/** Cache status */
|
|
9
|
-
cacheStatus: "HIT" | "MISS" | "REMOTE_HIT" | "SKIPPED";
|
|
10
|
-
/** Dependencies on other tasks */
|
|
11
|
-
dependencies: string[];
|
|
12
|
-
/** Duration in milliseconds */
|
|
13
|
-
duration: number | undefined;
|
|
14
|
-
/** End time (ISO 8601) */
|
|
15
|
-
endTime: string | undefined;
|
|
16
|
-
/** Exit code */
|
|
17
|
-
exitCode: number | undefined;
|
|
18
|
-
/** The computed cache hash */
|
|
19
|
-
hash: string | undefined;
|
|
20
|
-
/** Detailed hash information */
|
|
21
|
-
hashDetails: TaskHashDetails | undefined;
|
|
22
|
-
/** The task's declared outputs (glob patterns, literals, or `{ auto: true }`). */
|
|
23
|
-
outputs: OutputSpec[];
|
|
24
|
-
/** Start time (ISO 8601) */
|
|
25
|
-
startTime: string | undefined;
|
|
26
|
-
/** The task target */
|
|
27
|
-
target: {
|
|
28
|
-
configuration?: string;
|
|
29
|
-
project: string;
|
|
30
|
-
target: string;
|
|
31
|
-
};
|
|
32
|
-
/** The task ID (e.g., "app:build") */
|
|
33
|
-
taskId: string;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Complete summary of a task runner execution.
|
|
37
|
-
*/
|
|
38
|
-
interface RunSummary {
|
|
39
|
-
/** Total duration in milliseconds */
|
|
40
|
-
duration: number;
|
|
41
|
-
/** Run end time (ISO 8601) */
|
|
42
|
-
endTime: string;
|
|
43
|
-
/** Environment info */
|
|
44
|
-
environment: {
|
|
45
|
-
/** Architecture */
|
|
46
|
-
arch: string;
|
|
47
|
-
/** Node.js version */
|
|
48
|
-
nodeVersion: string;
|
|
49
|
-
/** Platform */
|
|
50
|
-
platform: string;
|
|
51
|
-
};
|
|
52
|
-
/** Unique run ID */
|
|
53
|
-
id: string;
|
|
54
|
-
/** Run start time (ISO 8601) */
|
|
55
|
-
startTime: string;
|
|
56
|
-
/** Overall execution statistics */
|
|
57
|
-
stats: {
|
|
58
|
-
/** Number of cached tasks (local + remote) */
|
|
59
|
-
cached: number;
|
|
60
|
-
/** Number of failed tasks */
|
|
61
|
-
failed: number;
|
|
62
|
-
/** Number of skipped tasks */
|
|
63
|
-
skipped: number;
|
|
64
|
-
/** Number of successful tasks */
|
|
65
|
-
succeeded: number;
|
|
66
|
-
/** Total number of tasks */
|
|
67
|
-
total: number;
|
|
68
|
-
};
|
|
69
|
-
/** The task graph used for this run */
|
|
70
|
-
taskGraph: {
|
|
71
|
-
dependencies: Record<string, string[]>;
|
|
72
|
-
roots: string[];
|
|
73
|
-
};
|
|
74
|
-
/** Summary of each task */
|
|
75
|
-
tasks: TaskSummary[];
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Generates a run summary from task results.
|
|
79
|
-
*/
|
|
80
|
-
declare const generateRunSummary: (results: TaskResults, taskGraph: TaskGraph, startTime: number) => RunSummary;
|
|
81
|
-
/**
|
|
82
|
-
* Writes the run summary to a JSON file in the `.task-runner/runs/` directory.
|
|
83
|
-
* @param summary The run summary to write
|
|
84
|
-
* @param workspaceRoot The workspace root directory
|
|
85
|
-
* @returns The path to the written summary file
|
|
86
|
-
*/
|
|
87
|
-
declare const writeRunSummary: (summary: RunSummary, workspaceRoot: string) => Promise<string>;
|
|
88
|
-
/**
|
|
89
|
-
* Path where the most-recent run summary is persisted.
|
|
90
|
-
* Consumers (e.g. CLIs exposing `--last-details`) read this file
|
|
91
|
-
* to replay or render the previous run without re-executing.
|
|
92
|
-
*/
|
|
93
|
-
declare const getLastRunSummaryPath: (workspaceRoot: string) => string;
|
|
94
|
-
/**
|
|
95
|
-
* Persists `summary` as the most-recent run summary at
|
|
96
|
-
* `.task-runner/last-summary.json`, overwriting any previous entry.
|
|
97
|
-
*
|
|
98
|
-
* This is the companion to {@link readLastRunSummary} and powers
|
|
99
|
-
* CLI surfaces that display "last run" details without re-running tasks.
|
|
100
|
-
* @returns The path to the written summary file
|
|
101
|
-
*/
|
|
102
|
-
declare const writeLastRunSummary: (summary: RunSummary, workspaceRoot: string) => Promise<string>;
|
|
103
|
-
/**
|
|
104
|
-
* Reads the most-recent run summary written by {@link writeLastRunSummary}.
|
|
105
|
-
* Returns `undefined` when no previous run has been recorded or the file
|
|
106
|
-
* cannot be parsed — callers should render an informational message
|
|
107
|
-
* instead of treating this as an error.
|
|
108
|
-
*/
|
|
109
|
-
declare const readLastRunSummary: (workspaceRoot: string) => Promise<RunSummary | undefined>;
|
|
110
|
-
export type { RunSummary, TaskSummary };
|
|
111
|
-
export { generateRunSummary, getLastRunSummaryPath, readLastRunSummary, writeLastRunSummary, writeRunSummary };
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { TaskGraph } from "./types.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Finds a single cycle in the task graph, if one exists.
|
|
4
|
-
* Returns the cycle as an array of task IDs, or null if no cycle exists.
|
|
5
|
-
*/
|
|
6
|
-
export declare const findCycle: (taskGraph: TaskGraph) => string[] | undefined;
|
|
7
|
-
/**
|
|
8
|
-
* Finds all cycles in the task graph.
|
|
9
|
-
*/
|
|
10
|
-
export declare const findCycles: (taskGraph: TaskGraph) => string[][];
|
|
11
|
-
/**
|
|
12
|
-
* Walks the task graph in topological order (dependencies before dependents),
|
|
13
|
-
* calling the callback for each task.
|
|
14
|
-
*
|
|
15
|
-
* Note: If the graph contains cycles, tasks involved in cycles will not be visited.
|
|
16
|
-
* Use `findCycle` to detect cycles before walking if complete traversal is required.
|
|
17
|
-
*/
|
|
18
|
-
export declare const walkTaskGraph: (taskGraph: TaskGraph, callback: (taskId: string) => void) => void;
|
|
19
|
-
/**
|
|
20
|
-
* Returns a reversed copy of the task graph (edges point in the opposite direction).
|
|
21
|
-
*/
|
|
22
|
-
export declare const reverseTaskGraph: (taskGraph: TaskGraph) => TaskGraph;
|
|
23
|
-
/**
|
|
24
|
-
* Returns the leaf tasks (tasks with no dependencies of their own).
|
|
25
|
-
*/
|
|
26
|
-
export declare const getLeafTasks: (taskGraph: TaskGraph) => string[];
|
|
27
|
-
/**
|
|
28
|
-
* Removes edges that form cycles, making the graph acyclic.
|
|
29
|
-
* Returns a new task graph without the cycle-forming edges.
|
|
30
|
-
*/
|
|
31
|
-
export declare const makeAcyclic: (taskGraph: TaskGraph) => TaskGraph;
|
|
32
|
-
/**
|
|
33
|
-
* Gets all tasks that depend on the given task (directly or transitively).
|
|
34
|
-
*/
|
|
35
|
-
export declare const getDependentTasks: (taskGraph: TaskGraph, taskId: string) => string[];
|
|
36
|
-
/**
|
|
37
|
-
* Gets all tasks that the given task depends on (directly or transitively).
|
|
38
|
-
*/
|
|
39
|
-
export declare const getTransitiveDependencies: (taskGraph: TaskGraph, taskId: string) => string[];
|
package/dist/task-graph.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { ProjectGraph, TargetConfiguration, Task, TaskGraph, TaskTarget, WorkspaceConfiguration } from "./types.d.ts";
|
|
2
|
-
interface CreateTaskGraphOptions {
|
|
3
|
-
/** The project graph */
|
|
4
|
-
projectGraph: ProjectGraph;
|
|
5
|
-
/** Target default configurations */
|
|
6
|
-
targetDefaults?: Record<string, Partial<TargetConfiguration>>;
|
|
7
|
-
/** The workspace configuration */
|
|
8
|
-
workspace: WorkspaceConfiguration;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Creates a unique task ID from a target.
|
|
12
|
-
*/
|
|
13
|
-
declare const getTaskId: (target: TaskTarget) => string;
|
|
14
|
-
/**
|
|
15
|
-
* Parses a task ID into its component parts.
|
|
16
|
-
*/
|
|
17
|
-
declare const parseTaskId: (taskId: string) => TaskTarget;
|
|
18
|
-
/**
|
|
19
|
-
* Creates a task graph from a list of tasks, resolving all dependencies.
|
|
20
|
-
*/
|
|
21
|
-
declare const createTaskGraph: (initialTasks: Task[], options: CreateTaskGraphOptions) => TaskGraph;
|
|
22
|
-
export { createTaskGraph, getTaskId, parseTaskId };
|