@visulima/task-runner 1.0.0-alpha.17 → 1.0.0-alpha.19

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +2 -0
  3. package/dist/index.d.ts +308 -5
  4. package/dist/index.js +1 -1
  5. package/dist/packem_shared/Cache-BVrj9bd4.js +2 -0
  6. package/dist/packem_shared/CompositeLifeCycle-C6aee9GK.js +1 -0
  7. package/dist/packem_shared/FileAccessTracker-DBz_w4wl.js +50 -0
  8. package/dist/packem_shared/HttpRemoteCache-CpPl6lzE.js +1 -0
  9. package/dist/packem_shared/IncrementalFileHasher-B-V3i2x-.js +1 -0
  10. package/dist/packem_shared/LogReporter-3R3oWj-Q.js +13 -0
  11. package/dist/packem_shared/ReapiRemoteCache-BXJip5wH.js +251 -0
  12. package/dist/packem_shared/TaskOrchestrator-CYj5MLwz.js +6 -0
  13. package/dist/packem_shared/TrackedTaskExecutor-CtYLL3vS.js +1 -0
  14. package/dist/packem_shared/buildForwardDependencyMap-DudUDFze.js +3 -0
  15. package/dist/packem_shared/collectNodeModulesBinDirs-CD-eDrtO.js +1 -0
  16. package/dist/packem_shared/computeTaskHash-CaPdG1BA.js +1 -0
  17. package/dist/packem_shared/containsBlob-DAU8R7GH.js +1 -0
  18. package/dist/packem_shared/createTaskGraph-BBG8Rosl.js +1 -0
  19. package/dist/packem_shared/defaultTaskRunner-RJnuLoJz.js +2 -0
  20. package/dist/packem_shared/generateRunSummary-L9Z2NfWn.js +1 -0
  21. package/dist/packem_shared/{getMainWorktreeRoot-DRN_i8jA.js → getMainWorktreeRoot-DB9P2wDL.js} +1 -1
  22. package/dist/packem_shared/{isNativeAvailable-BOavFPX1.js → isNativeAvailable-CkTjxb7P.js} +1 -1
  23. package/dist/packem_shared/parsePartition-Bt1jBjZH.js +1 -0
  24. package/dist/packem_shared/{resolveCacheMode-DEDFC-kM.js → resolveCacheMode--4y60ODd.js} +1 -1
  25. package/dist/packem_shared/runConcurrentFallback-BhJCT2LA.js +3 -0
  26. package/dist/packem_shared/runConcurrently-D1Ytsjaj.js +1 -0
  27. package/dist/packem_shared/{runTeardown-CiJJeWVf.js → runTeardown-DAn1xFWJ.js} +1 -1
  28. package/dist/packem_shared/tracked-executor-B90U4Um3.js +3 -0
  29. package/index.js +54 -53
  30. package/package.json +11 -11
  31. package/dist/packem_shared/Cache-C540ZPYk.js +0 -2
  32. package/dist/packem_shared/CompositeLifeCycle-D0zWvAXJ.js +0 -1
  33. package/dist/packem_shared/FileAccessTracker-IG-Z0Ijw.js +0 -47
  34. package/dist/packem_shared/HttpRemoteCache-D3Z6b_FO.js +0 -1
  35. package/dist/packem_shared/IncrementalFileHasher-CdLXVB5F.js +0 -1
  36. package/dist/packem_shared/LogReporter-BUPWiXAq.js +0 -13
  37. package/dist/packem_shared/ReapiRemoteCache-B3uQuVqP.js +0 -251
  38. package/dist/packem_shared/TaskOrchestrator-F_NrcUYn.js +0 -2
  39. package/dist/packem_shared/TrackedTaskExecutor-BiK0Coso.js +0 -2
  40. package/dist/packem_shared/buildForwardDependencyMap-w1FVPFdv.js +0 -3
  41. package/dist/packem_shared/collectNodeModulesBinDirs-JaeFLP9l.js +0 -1
  42. package/dist/packem_shared/computeTaskHash-Xxd8v-X3.js +0 -1
  43. package/dist/packem_shared/containsBlob-DBWgvkM_.js +0 -1
  44. package/dist/packem_shared/createTaskGraph-D6nPDd4s.js +0 -1
  45. package/dist/packem_shared/defaultTaskRunner-CjaCnt_W.js +0 -2
  46. package/dist/packem_shared/generateRunSummary-beN13GH4.js +0 -1
  47. package/dist/packem_shared/parsePartition-uzPNgtPp.js +0 -1
  48. package/dist/packem_shared/runConcurrentFallback-SvS4ElEX.js +0 -3
  49. package/dist/packem_shared/runConcurrently-ebFf3uYs.js +0 -1
@@ -1,251 +0,0 @@
1
- var F=Object.defineProperty;var f=(s,e)=>F(s,"name",{value:e,configurable:!0});import{createRequire as O}from"node:module";import{dirname as j}from"@visulima/path";const U=O(import.meta.url),_=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,b=f(s=>{if(typeof _<"u"&&_.versions&&_.versions.node){const[e,t]=_.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return _.getBuiltinModule(s)}return U(s)},"__cjs_getBuiltinModule"),{randomUUID:N}=b("node:crypto"),{createWriteStream:D}=b("node:fs"),{mkdir:V,rm:z}=b("node:fs/promises"),{Readable:I}=b("node:stream"),{pipeline:$}=b("node:stream/promises"),M=`syntax = "proto3";
2
-
3
- package build.bazel.remote.execution.v2;
4
-
5
- message Digest {
6
- string hash = 1;
7
- int64 size_bytes = 2;
8
- }
9
-
10
- message NodeProperties {
11
- repeated NodeProperty properties = 1;
12
- string mtime = 2;
13
- uint32 unix_mode = 3;
14
- }
15
-
16
- message NodeProperty {
17
- string name = 1;
18
- string value = 2;
19
- }
20
-
21
- message OutputFile {
22
- string path = 1;
23
- Digest digest = 2;
24
- bool is_executable = 4;
25
- bytes contents = 5;
26
- NodeProperties node_properties = 7;
27
- }
28
-
29
- message OutputDirectory {
30
- string path = 1;
31
- Digest tree_digest = 3;
32
- bool is_topologically_sorted = 4;
33
- Digest root_directory_digest = 5;
34
- }
35
-
36
- message OutputSymlink {
37
- string path = 1;
38
- string target = 2;
39
- NodeProperties node_properties = 3;
40
- }
41
-
42
- message ActionResult {
43
- repeated OutputFile output_files = 2;
44
- repeated OutputSymlink output_file_symlinks = 10;
45
- repeated OutputSymlink output_symlinks = 12;
46
- repeated OutputDirectory output_directories = 3;
47
- repeated OutputSymlink output_directory_symlinks = 11;
48
- int32 exit_code = 4;
49
- bytes stdout_raw = 5;
50
- Digest stdout_digest = 6;
51
- bytes stderr_raw = 7;
52
- Digest stderr_digest = 8;
53
- }
54
-
55
- message FindMissingBlobsRequest {
56
- string instance_name = 1;
57
- repeated Digest blob_digests = 2;
58
- DigestFunction.Value digest_function = 3;
59
- }
60
-
61
- message FindMissingBlobsResponse {
62
- repeated Digest missing_blob_digests = 2;
63
- }
64
-
65
- message BatchUpdateBlobsRequest {
66
- message Request {
67
- Digest digest = 1;
68
- bytes data = 2;
69
- Compressor.Value compressor = 3;
70
- }
71
- string instance_name = 1;
72
- repeated Request requests = 2;
73
- DigestFunction.Value digest_function = 5;
74
- }
75
-
76
- message BatchUpdateBlobsResponse {
77
- message Response {
78
- Digest digest = 1;
79
- Status status = 2;
80
- }
81
- repeated Response responses = 1;
82
- }
83
-
84
- message BatchReadBlobsRequest {
85
- string instance_name = 1;
86
- repeated Digest digests = 2;
87
- repeated Compressor.Value acceptable_compressors = 3;
88
- DigestFunction.Value digest_function = 4;
89
- }
90
-
91
- message BatchReadBlobsResponse {
92
- message Response {
93
- Digest digest = 1;
94
- bytes data = 2;
95
- Compressor.Value compressor = 4;
96
- Status status = 3;
97
- }
98
- repeated Response responses = 1;
99
- }
100
-
101
- message GetActionResultRequest {
102
- string instance_name = 1;
103
- Digest action_digest = 2;
104
- bool inline_stdout = 3;
105
- bool inline_stderr = 4;
106
- repeated string inline_output_files = 5;
107
- DigestFunction.Value digest_function = 6;
108
- }
109
-
110
- message UpdateActionResultRequest {
111
- string instance_name = 1;
112
- Digest action_digest = 2;
113
- ActionResult action_result = 3;
114
- ResultsCachePolicy results_cache_policy = 4;
115
- DigestFunction.Value digest_function = 5;
116
- }
117
-
118
- message ResultsCachePolicy {
119
- int32 priority = 1;
120
- }
121
-
122
- message GetCapabilitiesRequest {
123
- string instance_name = 1;
124
- }
125
-
126
- message ServerCapabilities {
127
- CacheCapabilities cache_capabilities = 1;
128
- ExecutionCapabilities execution_capabilities = 2;
129
- SemVer deprecated_api_version = 3;
130
- SemVer low_api_version = 4;
131
- SemVer high_api_version = 5;
132
- }
133
-
134
- message ExecutionCapabilities {
135
- DigestFunction.Value digest_function = 1;
136
- bool exec_enabled = 2;
137
- PriorityCapabilities execution_priority_capabilities = 3;
138
- repeated string supported_node_properties = 4;
139
- repeated DigestFunction.Value digest_functions = 5;
140
- }
141
-
142
- message CacheCapabilities {
143
- repeated DigestFunction.Value digest_functions = 1;
144
- ActionCacheUpdateCapabilities action_cache_update_capabilities = 2;
145
- PriorityCapabilities cache_priority_capabilities = 3;
146
- int64 max_batch_total_size_bytes = 4;
147
- SymlinkAbsolutePathStrategy.Value symlink_absolute_path_strategy = 5;
148
- repeated Compressor.Value supported_compressors = 6;
149
- repeated Compressor.Value supported_batch_update_compressors = 7;
150
- }
151
-
152
- message ActionCacheUpdateCapabilities {
153
- bool update_enabled = 1;
154
- }
155
-
156
- message PriorityCapabilities {
157
- message PriorityRange {
158
- int32 min_priority = 1;
159
- int32 max_priority = 2;
160
- }
161
- repeated PriorityRange priorities = 1;
162
- }
163
-
164
- message SymlinkAbsolutePathStrategy {
165
- enum Value {
166
- UNKNOWN = 0;
167
- DISALLOWED = 1;
168
- ALLOWED = 2;
169
- }
170
- }
171
-
172
- message DigestFunction {
173
- enum Value {
174
- UNKNOWN = 0;
175
- SHA256 = 1;
176
- SHA1 = 2;
177
- MD5 = 3;
178
- VSO = 4;
179
- SHA384 = 5;
180
- SHA512 = 6;
181
- MURMUR3 = 7;
182
- SHA256TREE = 8;
183
- BLAKE3 = 9;
184
- }
185
- }
186
-
187
- message Compressor {
188
- enum Value {
189
- IDENTITY = 0;
190
- ZSTD = 1;
191
- DEFLATE = 2;
192
- BROTLI = 3;
193
- }
194
- }
195
-
196
- message SemVer {
197
- int32 major = 1;
198
- int32 minor = 2;
199
- string patch = 3;
200
- string prerelease = 4;
201
- }
202
-
203
- message Status {
204
- int32 code = 1;
205
- string message = 2;
206
- }
207
-
208
- service ContentAddressableStorage {
209
- rpc FindMissingBlobs(FindMissingBlobsRequest) returns (FindMissingBlobsResponse);
210
- rpc BatchUpdateBlobs(BatchUpdateBlobsRequest) returns (BatchUpdateBlobsResponse);
211
- rpc BatchReadBlobs(BatchReadBlobsRequest) returns (BatchReadBlobsResponse);
212
- }
213
-
214
- service ActionCache {
215
- rpc GetActionResult(GetActionResultRequest) returns (ActionResult);
216
- rpc UpdateActionResult(UpdateActionResultRequest) returns (ActionResult);
217
- }
218
-
219
- service Capabilities {
220
- rpc GetCapabilities(GetCapabilitiesRequest) returns (ServerCapabilities);
221
- }
222
- `,L=`syntax = "proto3";
223
-
224
- package google.bytestream;
225
-
226
- message ReadRequest {
227
- string resource_name = 1;
228
- int64 read_offset = 2;
229
- int64 read_limit = 3;
230
- }
231
-
232
- message ReadResponse {
233
- bytes data = 10;
234
- }
235
-
236
- message WriteRequest {
237
- string resource_name = 1;
238
- int64 write_offset = 2;
239
- bool finish_write = 3;
240
- bytes data = 10;
241
- }
242
-
243
- message WriteResponse {
244
- int64 committed_size = 1;
245
- }
246
-
247
- service ByteStream {
248
- rpc Read(ReadRequest) returns (stream ReadResponse);
249
- rpc Write(stream WriteRequest) returns (WriteResponse);
250
- }
251
- `;var W=Object.defineProperty,S=f((s,e)=>W(s,"name",{value:e,configurable:!0}),"n");let w;const G=S(async()=>{let s,e;try{s=await import("@grpc/grpc-js")}catch(t){throw new Error('[task-runner] remoteCache.backend = "reapi" needs the optional peer dependency `@grpc/grpc-js`. Install it with `pnpm add @grpc/grpc-js` (or your package manager\'s equivalent), or switch to backend: "http".',{cause:t})}try{e=await import("@grpc/proto-loader")}catch(t){throw new Error('[task-runner] remoteCache.backend = "reapi" needs the optional peer dependency `@grpc/proto-loader`. Install it with `pnpm add @grpc/proto-loader` (or your package manager\'s equivalent), or switch to backend: "http".',{cause:t})}return{grpc:s,protoLoader:e}},"importGrpc"),H=S(async()=>{const{grpc:s,protoLoader:e}=await G();if(w===void 0){let t;try{t=await import("../packem_chunks/index.js").then(l=>l.i)}catch(l){throw new Error('[task-runner] remoteCache.backend = "reapi" needs `protobufjs` (normally installed transitively via `@grpc/proto-loader`). Install it with `pnpm add protobufjs` (or your package manager\'s equivalent) if your installer does not hoist transitive deps.',{cause:l})}const{parse:i,Root:a}=t,r=new a;i(M,r,{keepCase:!0}),i(L,r,{keepCase:!0}),r.resolveAll();const n=r.toJSON(),o=e.fromJSON(n,{arrays:!0,defaults:!0,enums:String,keepCase:!0,longs:Number,objects:!0,oneofs:!0}),d=s.loadPackageDefinition(o),c=d.build.bazel.remote.execution.v2,u=d.google.bytestream;w={clients:{ActionCache:c.ActionCache,ByteStream:u.ByteStream,Capabilities:c.Capabilities,ContentAddressableStorage:c.ContentAddressableStorage},definition:o}}return{clients:w.clients,grpc:s}},"loadReapiProto");S(()=>{w=void 0},"resetReapiProtoCache");var Y=Object.defineProperty,p=f((s,e)=>Y(s,"name",{value:e,configurable:!0}),"l");const k="IDENTITY",E=0,K=5,J=16,X=7,P=4*1024*1024,T=64*1024,q=256,x=10,Z=p((s,e)=>`${s===""?"":`${s}/`}blobs/${e.hash}/${String(e.sizeBytes)}`,"buildReadResourceName"),Q=p((s,e)=>`${s===""?"":`${s}/`}uploads/${N()}/blobs/${e.hash}/${String(e.sizeBytes)}`,"buildWriteResourceName"),g=p(async(s,e,t,i,a)=>{const r=s[e];if(typeof r!="function")throw new TypeError(`[task-runner] REAPI client is missing method ${e} — proto descriptor mismatch.`);return new Promise((n,o)=>{const d={deadline:Date.now()+a};r.call(s,t,i,d,(c,u)=>{if(c){o(c);return}n(u)})})},"callUnary");class ue{static{f(this,"ReapiRemoteCache")}static{p(this,"ReapiRemoteCache")}#o;#p;#c;#e;#u;#h;#t;#g;#a=new Map;#n;#r;constructor(e){const{target:t,useTls:i}=ie(e.url);this.#o=t,this.#p=i,this.#c=e.bearerToken,this.#e=e.instanceName??"",this.#t=e.timeout??3e4,this.#g=e.onUploadError;const a=e.mode??"readwrite";if(this.#u=a==="read"||a==="readwrite",this.#h=a==="write"||a==="readwrite",this.#c!==void 0&&!this.#p&&e.allowInsecureBearer!==!0)throw new Error('[task-runner] remoteCache.backend = "reapi" refuses to send a bearer token over cleartext gRPC. Use `grpcs://` (or terminate TLS at a reverse proxy), or pass `allowInsecureBearer: true` for trusted-boundary deployments (loopback, mesh mTLS sidecar).')}async close(){const e=this.#n;if(e===void 0)return;this.#n=void 0;let t;try{t=await e}catch{return}for(const i of[t.actionCache,t.byteStream,t.capabilities,t.cas])try{i.close()}catch{}}async probeCapabilities(){return this.#d()}async containsAction(e){if(!this.#u)return!1;await this.#l();try{const{actionCache:t}=await this.#s(),i=await this.#i();return await g(t,"GetActionResult",{action_digest:h(e),inline_stderr:!1,inline_stdout:!1,instance_name:this.#e},i,this.#t),!0}catch(t){if(C(t))return!1;throw t}}async fetchBlob(e,t){if(!this.#u)return!1;await this.#l();try{const i=await this.#m();if(await V(j(t),{recursive:!0}),e.sizeBytes<=i){const a=await this.#B(e);return a===void 0?!1:(await $(I.from(a),D(t)),!0)}return await this.#C(e,t)}catch{return await z(t,{force:!0}).catch(()=>{}),!1}}async retrieveAction(e){if(!this.#u)return null;await this.#l();try{const{actionCache:t}=await this.#s(),i=await this.#i(),a=await g(t,"GetActionResult",{action_digest:h(e),inline_stderr:!1,inline_stdout:!1,instance_name:this.#e},i,this.#t);return ee(a)}catch(t){if(C(t))return null;throw t}}async storeAction(e,t,i){if(!this.#h)return!1;await this.#l();try{const a=await this.#f(i.map(c=>c.digest)),r=new Set(a.map(c=>c.hash)),n=i.filter(c=>r.has(c.digest.hash));await this.#_(n);const{actionCache:o}=await this.#s(),d=await this.#i();return await g(o,"UpdateActionResult",{action_digest:h(e),action_result:te(t),instance_name:this.#e},d,this.#t),!0}catch(a){return this.#g?.(e.hash,a),!1}}async#s(){return this.#n===void 0&&(this.#n=(async()=>{const{clients:e,grpc:t}=await H(),i=this.#p?t.credentials.createSsl():t.credentials.createInsecure();return{actionCache:new e.ActionCache(this.#o,i),byteStream:new e.ByteStream(this.#o,i),capabilities:new e.Capabilities(this.#o,i),cas:new e.ContentAddressableStorage(this.#o,i),clients:e,grpc:t}})()),this.#n}async#i(){const{grpc:e}=await this.#s(),t=new e.Metadata;return this.#c!==void 0&&t.set("authorization",`Bearer ${this.#c}`),t}async#m(){return(await this.#d()).maxBatchTotalSizeBytes}async#d(){if(this.#r!==void 0)return this.#r;try{const{capabilities:e}=await this.#s(),t=await this.#i(),i=(await g(e,"GetCapabilities",{instance_name:this.#e},t,this.#t))?.cache_capabilities,a=i&&typeof i.max_batch_total_size_bytes=="number"?i.max_batch_total_size_bytes:0,r=(i?.digest_functions??[]).map(String);return this.#r={digestFunctions:r,maxBatchTotalSizeBytes:a>0?a:P},this.#r}catch(e){if(se(e))throw e;return this.#r={digestFunctions:[],maxBatchTotalSizeBytes:P},this.#r}}async#l(){const{digestFunctions:e}=await this.#d();if(e.length!==0&&!e.some(t=>t.toUpperCase()==="SHA256"))throw new Error(`[task-runner] REAPI server does not advertise SHA256 in cache_capabilities.digest_functions (got: ${e.join(", ")}). vis pins sha256 for action digests; a server expecting a different digest function would reject every request.`)}async#f(e){if(e.length===0)return[];const{cas:t}=await this.#s(),i=await this.#i();return((await g(t,"FindMissingBlobs",{blob_digests:e.map(a=>h(a)),instance_name:this.#e},i,this.#t))?.missing_blob_digests??[]).map(a=>R(a))}async#_(e){if(e.length===0)return;const t=await this.#m(),i=t-q,a=[],r=[];for(const o of e)(o.digest.sizeBytes<=i?a:r).push(o);const n=ae(a,t);for(const o of n)await this.#b(o);for(const o of r)await this.#w(o)}async#b(e){const t=[],i=[];for(const a of e){const r=this.#a.get(a.digest.hash);if(r!==void 0){i.push(r);continue}t.push(a)}if(t.length>0){const a=this.#y(t);for(const r of t)this.#a.set(r.digest.hash,a);try{await a}finally{for(const r of t)this.#a.delete(r.digest.hash)}}await Promise.all(i)}async#y(e){const t=[];for(const n of e){const o=await re(await n.open());t.push({compressor:k,data:o,digest:h(n.digest)})}const{cas:i}=await this.#s(),a=await this.#i(),r=(await g(i,"BatchUpdateBlobs",{instance_name:this.#e,requests:t},a,this.#t))?.responses??[];for(const n of r){const o=n.status.code??0;if(o!==E)throw new Error(`[task-runner] BatchUpdateBlobs reported code ${String(o)} for ${n.digest.hash}: ${n.status.message??""}`)}return!0}async#w(e){const t=this.#a.get(e.digest.hash);if(t!==void 0){await t;return}const i=this.#R(e);this.#a.set(e.digest.hash,i);try{await i}finally{this.#a.delete(e.digest.hash)}}async#R(e){const{byteStream:t}=await this.#s(),i=await this.#i(),a=Q(this.#e,e.digest),r=t.Write;if(typeof r!="function")throw new TypeError("[task-runner] REAPI ByteStream client is missing Write method.");return await new Promise((n,o)=>{const d={deadline:Date.now()+this.#t*x},c=r.call(t,i,d,u=>{if(u){o(u);return}n()});(async()=>{try{let u=0,l=!0;const m=await e.open();for await(const B of m){const v=Buffer.isBuffer(B)?B:Buffer.from(B);for(let y=0;y<v.byteLength;y+=T){const A=v.subarray(y,y+T);c.write({data:A,finish_write:!1,resource_name:l?a:"",write_offset:u}),u+=A.byteLength,l=!1}}c.write({data:Buffer.alloc(0),finish_write:!0,resource_name:l?a:"",write_offset:u}),c.end()}catch(u){try{c.cancel?.()}catch{}o(u)}})()}),!0}async#B(e){const{cas:t}=await this.#s(),i=await this.#i(),a=(await g(t,"BatchReadBlobs",{acceptable_compressors:[k],digests:[h(e)],instance_name:this.#e},i,this.#t))?.responses?.[0];if(!(!a||(a.status.code??0)!==E))return a.data===void 0?Buffer.alloc(0):Buffer.isBuffer(a.data)?a.data:Buffer.from(a.data)}async#C(e,t){const{byteStream:i}=await this.#s(),a=await this.#i(),r=Z(this.#e,e),n=i.Read;if(typeof n!="function")throw new TypeError("[task-runner] REAPI ByteStream client is missing Read method.");const o={deadline:Date.now()+this.#t*x},d=n.call(i,{read_limit:0,read_offset:0,resource_name:r},a,o),c=D(t);try{for await(const u of d){const{data:l}=u;l!==void 0&&(c.write(Buffer.isBuffer(l)?l:Buffer.from(l))||await new Promise(m=>{c.once("drain",()=>{m()})}))}return await new Promise((u,l)=>{c.end(m=>{if(m){l(m);return}u()})}),!0}catch(u){if(c.destroy(),C(u))return!1;throw u}}}const h=p(s=>({hash:s.hash,size_bytes:s.sizeBytes}),"digestToProto"),R=p(s=>({hash:s?.hash??"",sizeBytes:typeof s?.size_bytes=="number"?s.size_bytes:0}),"protoToDigest"),ee=p(s=>({exitCode:s?.exit_code??0,outputDirectories:(s?.output_directories??[]).map(e=>({path:e.path,treeDigest:R(e.tree_digest)})),outputFiles:(s?.output_files??[]).map(e=>({digest:R(e.digest),isExecutable:e.is_executable??!1,path:e.path})),stdoutDigest:s?.stdout_digest===void 0?void 0:R(s.stdout_digest)}),"protoToActionResult"),te=p(s=>({exit_code:s.exitCode,output_directories:s.outputDirectories.map(e=>({path:e.path,tree_digest:h(e.treeDigest)})),output_files:s.outputFiles.map(e=>({digest:h(e.digest),is_executable:e.isExecutable,path:e.path})),stdout_digest:s.stdoutDigest===void 0?void 0:h(s.stdoutDigest)}),"actionResultToProto"),C=p(s=>{if(typeof s!="object"||s===null)return!1;const{code:e}=s;return e===K},"isNotFoundError"),se=p(s=>{if(typeof s!="object"||s===null)return!1;const{code:e}=s;return e===J||e===X},"isAuthError"),ie=p(s=>{const e=s.trim();if(e==="")throw new Error("[task-runner] REAPI backend requires a non-empty `url`.");const t=/^(grpcs?):\/\/(.+)$/i.exec(e);if(t===null)return{target:e,useTls:!1};const[,i,a]=t,r=(a??"").trim();if(r==="")throw new Error(`[task-runner] REAPI backend url ${s} is missing a host:port target.`);return{target:r,useTls:i?.toLowerCase()==="grpcs"}},"parseGrpcUrl"),ae=p((s,e)=>{const t=[];let i=[],a=0;for(const r of s){const n=r.digest.sizeBytes+q;a+n>e&&i.length>0&&(t.push(i),i=[],a=0),i.push(r),a+=n}return i.length>0&&t.push(i),t},"bucketIntoBatches"),re=p(async s=>{const e=[];for await(const t of s)e.push(Buffer.isBuffer(t)?t:Buffer.from(t));return Buffer.concat(e)},"streamToBuffer");export{ue as ReapiRemoteCache};
@@ -1,2 +0,0 @@
1
- var M=Object.defineProperty;var k=(r,t)=>M(r,"name",{value:t,configurable:!0});import{j as w,v as O,f as j}from"./utils-BH2W5Wml.js";import{resolve as F,join as E}from"@visulima/path";import{retrieveByTaskHash as H,storeByTaskHash as W}from"./actionDigestForTaskHash-BOL4fZ9v.js";import{FingerprintManager as x}from"./FingerprintManager-CYW2EwLc.js";import{generateRunSummary as I,writeLastRunSummary as P,writeRunSummary as $}from"./generateRunSummary-beN13GH4.js";import{computeTaskHash as A}from"./computeTaskHash-Xxd8v-X3.js";import{TrackedTaskExecutor as L}from"./TrackedTaskExecutor-BiK0Coso.js";import{getCurrentBranch as N,evaluateWhen as B,explainWhen as G}from"./getCurrentBranch-D-qoZByx.js";var z=Object.defineProperty,p=k((r,t)=>z(r,"name",{value:t,configurable:!0}),"l");const U=p(r=>{const t=j();t.update(r.commandHash);for(const s of Object.keys(r.fileHashes).toSorted())t.update(s),t.update(r.fileHashes[s]);for(const s of r.missingFiles)t.update(`missing:${s}`);for(const s of Object.keys(r.directoryListings).toSorted())t.update(`dir:${s}`),t.update(JSON.stringify(r.directoryListings[s]));for(const s of Object.keys(r.envHashes).toSorted())t.update(s),t.update(r.envHashes[s]);return t.digest()},"hashFingerprint"),b=p((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"),D=p(r=>r!==void 0&&r.length>0&&r.every(t=>typeof t!="string"&&t.auto),"isAutoOnlyOutputs"),S="Outputs are `{ auto: true }` only, but no file writes were captured (write tracking unavailable for this task) — not caching, so a later hit can't restore a missing build artifact.",y=p(()=>{let r;return{promise:new Promise(t=>{r=t}),resolve:r}},"createDeferred");class tt{static{k(this,"N")}static{p(this,"TaskOrchestrator")}#r;#e;#n;#t;#m;#a;#g;#d;#w;#s;#h;#k;#y;#l;#C;#c;#R;#v;#M;#T;#u;#i=new Map;#j;#O;#b;#o=new Map;#p=y();#f=!1;constructor(t){this.#r=t.taskHasher,this.#e=t.cache,this.#n=t.scheduler,this.#t=t.lifeCycle,this.#m=t.taskExecutor,this.#a=t.workspaceRoot,this.#g=t.skipCache??!1,this.#d=t.captureOutput??!0,this.#w=t.autoFingerprint??!1,this.#k=t.fingerprintEnvPatterns??[],this.#y=t.untrackedEnvVars??[],this.#l=t.cacheDiagnostics??!1,this.#C=t.resolveCommand??void 0,this.#c=t.remoteCache??void 0,this.#R=t.onRemoteUploadError??void 0,this.#v=t.dryRun??!1,this.#M=t.summarize??!1,this.#T=t.dataDirectory,this.#u=t.taskGraph??void 0,this.#j=Date.now(),this.#O=t.alwaysTasks??[],this.#b=t.whenContext??{branch:N(t.workspaceRoot)};const s=this.#u?Object.values(this.#u.tasks).some(e=>e.hashMode==="trace"):!1;this.#w||s?(this.#s=new x(t.workspaceRoot),this.#h=new L(t.workspaceRoot)):(this.#s=void 0,this.#h=void 0)}async run(){this.#t.startCommand?.();const t=p(()=>{this.#f=!0,this.#h?.killAll()},"signalHandler");process.on("SIGINT",t),process.on("SIGTERM",t);try{await this.#x(),this.#O.length>0&&!this.#f&&await this.#W()}finally{process.removeListener("SIGINT",t),process.removeListener("SIGTERM",t),this.#t.endCommand?.()}if(this.#u&&!this.#f){const s=I(this.#i,this.#u,this.#j);await P(s,this.#a,{dataDirectory:this.#T}),this.#M&&await $(s,this.#a,{dataDirectory:this.#T})}return this.#i}async#W(){for(const t of this.#O){this.#t.scheduleTask?.(t),this.#t.startTasks?.([t]);let s;if(this.#E(t))s=this.#H(t);else{const e=Date.now();try{s=await this.#S(t,e)}catch(i){s=w(t,i,e),this.#i.set(t.id,s)}}this.#t.endTasks?.([s]),s.terminalOutput&&this.#t.printTaskTerminalOutput?.(s.task,s.status,s.terminalOutput)}}async#x(){for(;!this.#n.isComplete()&&!this.#f;){const t=this.#n.getNextBatch();if(t.length===0){if(this.#o.size>0){await this.#p.promise,this.#p=y();continue}if(this.#n.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.#n.startTask(s.id);this.#t.startTasks?.(t);for(const s of t){const e=(this.#E(s)?Promise.resolve(this.#H(s)):this.#I(s)?this.#$(s):this.#P(s)).catch(i=>{const a=w(s,i,Date.now());return this.#i.set(s.id,a),a}).then(i=>(this.#o.delete(s.id),this.#n.completeTask(s.id),this.#t.endTasks?.([i]),i.terminalOutput&&this.#t.printTaskTerminalOutput?.(i.task,i.status,i.terminalOutput),this.#p.resolve(),i));this.#o.set(s.id,e)}this.#o.size>0&&(await this.#p.promise,this.#p=y())}this.#o.size>0&&await Promise.all(this.#o.values())}#I(t){return this.#w?!0:t.hashMode==="trace"&&this.#s!==void 0}async#P(t){const s=Date.now(),e=await this.#r.hashTask(t),i=A(e);if(Object.assign(t,{hash:i,hashDetails:e}),this.#v)return this.#F(t,s);if(!this.#g&&t.cache!==!1){const n=await this.#e.get(i);if(n)return this.#D(t,n,s);if(this.#c&&await H(this.#c,i,this.#e.cacheDirectory)){const h=await this.#e.get(i);if(h){const c=await this.#D(t,h,s);return c.status="remote-cache",c}}}const a=await this.#S(t,s);return a.code===0&&t.cache!==!1&&t.hash&&this.#c&&W(this.#c,t.hash,this.#e.cacheDirectory,this.#R).catch(()=>{}),a}async#$(t){const s=Date.now();if(this.#v)return this.#F(t,s);if(!this.#g&&t.cache!==!1){const e=await this.#e.getByTaskId(t.id);if(e?.fingerprint&&this.#s){const i=this.#s.validateCommand(e.fingerprint,`${t.target.project}:${t.target.target}`,t.overrides);if(i)this.#l&&this.#t.printCacheMiss?.(t,this.#s.formatMissReasons([i]));else{const a=await this.#s.validate(e.fingerprint);if(!a)return this.#D(t,e,s);this.#l&&this.#t.printCacheMiss?.(t,this.#s.formatMissReasons(a))}}else this.#l&&!e&&this.#t.printCacheMiss?.(t,`Cache miss reasons:
2
- - No previous fingerprint found (first run)`)}return this.#L(t,s)}async#D(t,s,e){const i=await this.#e.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.#i.set(t.id,a),a}async#S(t,s){try{const{code:e,retryAttempts:i,terminalOutput:a}=await this.#m(t,{captureOutput:this.#d,cwd:O(this.#a,t)}),n=e===0&&b(t.warningPattern,a),h={code:e,endTime:Date.now(),hadWarnings:n||void 0,retryAttempts:i&&i>0?i:void 0,startTime:s,status:e===0?"success":"failure",task:t,terminalOutput:a};this.#i.set(t.id,h);const c=n&&t.cacheOnWarning===!1;if(e===0&&t.cache!==!1&&t.hash&&!c){const d=await this.#A(t);d.length>0?(h.selfModified=!0,this.#t.printSelfModifyingSkip?.(t,d)):D(t.outputs)?this.#t.printEmptyFingerprintWarning?.(t,S):await this.#e.put(t.hash,a,t.outputs,e)}return h}catch(e){const i=w(t,e,s);return this.#i.set(t.id,i),i}}async#A(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,n])=>{const h=F(this.#a,a),c=await e(h);return c!==void 0&&c!==n?a:void 0}))).filter(a=>a!==void 0)}async#L(t,s){if(!this.#s)return this.#S(t,s);const e=`${t.target.project}:${t.target.target}`,i=O(this.#a,t);try{let a,n,h,c=0,d=!1,f,m;const v=this.#C?.(t);if(v&&this.#h?.isTrackingSupported&&this.#h){const o=await this.#h.execute(t,{captureOutput:this.#d,cwd:i},v);a=o.code,n=o.terminalOutput,c=o.accesses.length,d=!0,m=o.accesses.filter(u=>u.type==="write").map(u=>u.path),h=await this.#s.createFingerprint(o.accesses,e,t.overrides,process.env,this.#k,this.#y)}else{const o=await this.#m(t,{captureOutput:this.#d,cwd:i});a=o.code,n=o.terminalOutput,f=o.retryAttempts;const u=await this.#r.hashTask(t),l=Object.keys(u.nodes).map(R=>({path:E(this.#a,R),type:"read"}));h=await this.#s.createFingerprint(l,e,t.overrides,process.env,this.#k,this.#y)}const T=a===0&&b(t.warningPattern,n),g={code:a,endTime:Date.now(),hadWarnings:T||void 0,retryAttempts:f&&f>0?f:void 0,startTime:s,status:a===0?"success":"failure",task:t,terminalOutput:n};this.#i.set(t.id,g);const C=T&&t.cacheOnWarning===!1;if(a===0&&t.cache!==!1&&h&&!C){const o=this.#N(h),u=this.#B(h,d,c);if(o.length>0)g.selfModified=!0,this.#t.printSelfModifyingSkip?.(t,o);else if(u)g.emptyFingerprint=!0,this.#t.printEmptyFingerprintWarning?.(t,u);else if(D(t.outputs)&&(!m||m.length===0))this.#t.printEmptyFingerprintWarning?.(t,S);else{const l=U(h);Object.assign(t,{hash:l}),await this.#e.put(l,n,t.outputs,a,h,m),await this.#e.setTaskIndex(t.id,l)}}return g}catch(a){const n=w(t,a,s);return this.#i.set(t.id,n),n}}#N(t){return t.modifiedInputs??[]}#B(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."}#F(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.#i.set(t.id,i),i}#E(t){return t.when?!B(t.when,this.#b):!1}#H(t){const s=G(t.when,this.#b),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.#i.set(t.id,i),i}}export{tt as TaskOrchestrator};
@@ -1,2 +0,0 @@
1
- var y=Object.defineProperty;var a=(o,t)=>y(o,"name",{value:t,configurable:!0});import{createRequire as g}from"node:module";import{join as n}from"@visulima/path";import{FileAccessTracker as E,generatePreloadScript as P}from"./FileAccessTracker-IG-Z0Ijw.js";import{withEnhancedPath as b}from"./collectNodeModulesBinDirs-JaeFLP9l.js";import{O as N}from"./utils-BH2W5Wml.js";const S=g(import.meta.url),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,m=a(o=>{if(typeof i<"u"&&i.versions&&i.versions.node){const[t,r]=i.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return i.getBuiltinModule(o)}return S(o)},"__cjs_getBuiltinModule"),{exec:T}=m("node:child_process"),{mkdir:O,writeFile:j,readFile:x,rm:l}=m("node:fs/promises");var R=Object.defineProperty,$=a((o,t)=>R(o,"name",{value:t,configurable:!0}),"u");class C{static{a(this,"TrackedTaskExecutor")}static{$(this,"TrackedTaskExecutor")}#t;#e;#r=new Set;constructor(t){this.#e=t,this.#t=new E(t)}get isTrackingSupported(){return!0}get isStraceSupported(){return this.#t.isSupported()}async execute(t,r,c){const s=r.cwd??(t.projectRoot?n(this.#e,t.projectRoot):this.#e);if(this.#t.isSupported()){const e=await this.#t.track(c,{cwd:s,env:r.env});return{accesses:e.accesses,code:e.code,terminalOutput:e.output}}return this.#s(c,s,r.env)}async#s(t,r,c){const s=n(this.#e,"node_modules",".cache","task-runner");await O(s,{recursive:!0});const e=N(),p=n(s,`preload-${e}.log`),u=n(s,`preload-${e}.mjs`),f=P(p);return await j(u,f),new Promise(_=>{const h=T(t,{cwd:r,env:b({...process.env,...c,NODE_OPTIONS:`${process.env.NODE_OPTIONS??""} --import ${u}`.trim()},r),maxBuffer:52428800},async(q,w,k)=>{this.#r.delete(h);let d=[];try{const v=await x(p,"utf8");d=this.#o(v)}catch{}await l(p,{force:!0}).catch(()=>{}),await l(u,{force:!0}).catch(()=>{}),_({accesses:d,code:h.exitCode??1,terminalOutput:w+k})});this.#r.add(h)})}killAll(){this.#t.killAll();for(const t of this.#r)try{t.kill("SIGTERM")}catch{}this.#r.clear()}#o(t){const r=[],c=new Set;for(const s of t.split(`
2
- `))if(s.trim())try{const e=JSON.parse(s);e.path&&!c.has(e.path)&&(c.add(e.path),e.path.startsWith(this.#e)&&r.push({path:e.path,type:e.type}))}catch{}return r}}export{C as TrackedTaskExecutor};
@@ -1,3 +0,0 @@
1
- var b=Object.defineProperty;var u=(e,t)=>b(e,"name",{value:t,configurable:!0});import{createRequire as y}from"node:module";const P=y(import.meta.url),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_=u(e=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[t,r]=l.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return l.getBuiltinModule(e)}return P(e)},"__cjs_getBuiltinModule"),{execFile:m}=_("node:child_process");var v=Object.defineProperty,i=u((e,t)=>v(e,"name",{value:t,configurable:!0}),"c");const g=i(e=>{if(!/^[\w./~^@{}][\w.\-/~^@{}]*$/.test(e))throw new Error(`Invalid git ref: "${e}". Refs must start with an alphanumeric character or one of _ . / ~ ^ @ { } and may only contain letters, digits, dots, dashes, underscores, slashes, tildes, carets, @, and braces.`)},"validateGitRef"),M=i((e,t)=>{let r,s=0;for(const[o,n]of Object.entries(t)){const{root:a}=n;(e.startsWith(`${a}/`)||e===a)&&a.length>s&&(r=o,s=a.length)}return r},"findProjectForFile"),F=i(e=>{const t=new Map;for(const[r,s]of Object.entries(e.dependencies))for(const o of s){let n=t.get(o.target);n||(n=new Set,t.set(o.target,n)),n.add(r)}return t},"buildReverseDependencyMap"),S=i(e=>{const t=new Map;for(const[r,s]of Object.entries(e.dependencies)){const o=new Set;for(const n of s)o.add(n.target);o.size>0&&t.set(r,o)}return t},"buildForwardDependencyMap"),h=i((e,t,r,s)=>{const o=new Set,n=new Set(t),a=[...t];for(;a.length>0;){const f=a.shift(),d=r.get(f);if(d)for(const c of d)n.has(c)||(n.add(c),e.add(c),o.add(c),s==="deep"&&a.push(c))}return o},"expandInDirection"),A=i((e,t,r)=>{const s=new Set(e);let o=new Set,n=new Set;if(r.downstream!=="none"){const a=F(t);o=h(s,e,a,r.downstream)}if(r.upstream!=="none"){const a=S(t);n=h(s,e,a,r.upstream)}return{affected:s,downstream:o,upstream:n}},"expandAffected"),R=i((e,t,r)=>new Promise((s,o)=>{m("git",["merge-base",t,r],{cwd:e},(n,a)=>{n?o(n):s(a.trim())})}),"getMergeBase"),D=i(async(e,t,r)=>{g(t),g(r);try{const s=await R(e,t,r);return await new Promise((o,n)=>{m("git",["diff","--name-only",s,r],{cwd:e},(a,f)=>{a?n(a):o(f.trim().split(`
2
- `).filter(Boolean))})})}catch{return new Promise((s,o)=>{m("git",["diff","--name-only",`${t}...${r}`],{cwd:e},(n,a)=>{n?o(n):s(a.trim().split(`
3
- `).filter(Boolean))})})}},"getChangedFiles"),O=i(async e=>{const{base:t="main",downstream:r="deep",head:s="HEAD",projectGraph:o,projects:n,upstream:a="none",workspaceRoot:f}=e,d=await D(f,t,s),c=new Set;for(const j of d){const w=M(j,n);if(w)c.add(w);else return{affectedProjects:Object.keys(n),changedFiles:d,changedProjects:[...c],downstreamProjects:[],upstreamProjects:[]}}const p=A(c,o,{downstream:r,upstream:a});return{affectedProjects:[...p.affected],changedFiles:d,changedProjects:[...c],downstreamProjects:[...p.downstream],upstreamProjects:[...p.upstream]}},"getAffectedProjects"),T=i((e,t)=>e.filter(r=>{const s=r.split(":")[0];return t.has(s)}),"filterAffectedTasks");export{S as buildForwardDependencyMap,F as buildReverseDependencyMap,A as expandAffected,T as filterAffectedTasks,O as getAffectedProjects,D as getChangedFiles};
@@ -1 +0,0 @@
1
- var d=Object.defineProperty;var c=(n,e)=>d(n,"name",{value:e,configurable:!0});import{delimiter as a,isAbsolute as h,resolve as l,join as u,dirname as P}from"@visulima/path";var f=Object.defineProperty,i=c((n,e)=>f(n,"name",{value:e,configurable:!0}),"i");const v=64,b=i(n=>{const e=h(n)?n:l(process.cwd(),n),t=[];let o=e,r=0;for(;r<v;){t.push(u(o,"node_modules",".bin"));const s=P(o);if(s===o)break;o=s,r+=1}return t},"collectNodeModulesBinDirs"),p=i(n=>{if(n){const e=n.PATH;if(e!==void 0)return e;const t=n.Path;if(t!==void 0)return t}return process.env.PATH??process.env.Path??""},"readPath"),m=i((n,e)=>{const t=b(n),o=p(e);if(t.length===0)return o;const r=t.join(a);return o.length>0?`${r}${a}${o}`:r},"buildEnhancedPath"),H=i((n,e)=>{const t={...n};return t.PATH=m(e,n),"Path"in t&&t.Path!==void 0&&(t.Path=t.PATH),t},"withEnhancedPath");export{m as buildEnhancedPath,b as collectNodeModulesBinDirs,H as withEnhancedPath};
@@ -1 +0,0 @@
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};
@@ -1 +0,0 @@
1
- var j=Object.defineProperty;var l=(e,t)=>j(e,"name",{value:t,configurable:!0});import{createRequire as E}from"node:module";import{dirname as f}from"@visulima/path";import{O as F}from"./utils-BH2W5Wml.js";import{digestFile as q}from"./digestBuffer-g11aCaDx.js";import{casBlobPath as u,tmpDirectory as _}from"./V2_ROOT-injxWBrl.js";const z=E(import.meta.url),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=l(e=>{if(typeof c<"u"&&c.versions&&c.versions.node){const[t,r]=c.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return c.getBuiltinModule(e)}return z(e)},"__cjs_getBuiltinModule"),{createReadStream:w,createWriteStream:y}=h("node:fs"),{stat:b,mkdir:n,rename:B,rm:d,utimes:P,writeFile:$}=h("node:fs/promises"),{pipeline:v}=h("node:stream/promises");var M=Object.defineProperty,s=l((e,t)=>M(e,"name",{value:t,configurable:!0}),"s");const g=s(async(e,t)=>{try{const r=await b(u(e,t.hash));return r.isFile()&&r.size===t.sizeBytes}catch{return!1}},"containsBlob"),A=s(async(e,t,r)=>{const a=u(e,t.hash);if(await g(e,t)){await m(e,t).catch(()=>{});return}const o=await O(e,r);try{await n(f(a),{recursive:!0}),await B(o,a)}catch(i){if(await d(o,{force:!0}).catch(()=>{}),!T(i))throw i}},"putBlobFromFile"),I=s(async(e,t,r)=>{const a=u(e,t.hash);if(await g(e,t)){await m(e,t).catch(()=>{});return}const o=_(e),i=`${o}/${F()}`;await n(o,{recursive:!0}),await $(i,r);try{await n(f(a),{recursive:!0}),await B(i,a)}catch(p){if(await d(i,{force:!0}).catch(()=>{}),!T(p))throw p}},"putBlobFromBytes"),W=s(async(e,t,r)=>{const a=u(e,t.hash);try{await b(a)}catch{return!1}return await n(f(r),{recursive:!0}),await v(w(a),y(r)),await m(e,t).catch(()=>{}),!0},"fetchBlobToFile"),X=s(async(e,t)=>{const r=await q(e);return r?.hash===t.hash&&r.sizeBytes===t.sizeBytes},"verifyBlob"),m=s(async(e,t)=>{const r=new Date;await P(u(e,t.hash),r,r)},"touchBlob"),O=s(async(e,t)=>{const r=_(e),a=`${r}/${F()}`;return await n(r,{recursive:!0}),await v(w(t),y(a)),a},"stageBlob"),T=s(e=>{if(typeof e!="object"||e===null)return!1;const{code:t}=e;return t==="EEXIST"||t==="ENOTEMPTY"},"isAlreadyExistsError");export{g as containsBlob,W as fetchBlobToFile,I as putBlobFromBytes,A as putBlobFromFile,m as touchBlob,X as verifyBlob};
@@ -1 +0,0 @@
1
- var m=Object.defineProperty;var h=(t,e)=>m(t,"name",{value:e,configurable:!0});var v=Object.defineProperty,p=h((t,e)=>v(t,"name",{value:e,configurable:!0}),"p");const l=p(t=>{const e=[t.project,t.target];return t.configuration&&e.push(t.configuration),e.join(":")},"getTaskId"),R=p(t=>{const e=t.split(":");if(e.length<2)throw new Error(`Invalid task ID: ${t}`);return{configuration:e[2],project:e[0],target:e[1]}},"parseTaskId"),f=p(t=>{if(t===void 0)return;const e=typeof t=="string"?[t]:t;return e.length===0?void 0:e},"normalizeWarningPattern"),j=p((t,e,s,o)=>{const a=s.projects[t],r=a?.targets?.[e],i=o?.[e];return(r?.outputs??i?.outputs??[]).map(g=>typeof g=="string"?g.replace("{projectRoot}",a?.root??"").replace("{projectName}",t):g)},"getTaskOutputs"),d=p((t,e,s,o,a)=>{const r=o.projects[t];if(!r)return[];if(!(r.targets?.[e]!==void 0||a?.[e]!==void 0))return[];const i={project:t,target:e};return[{always:r.targets?.[e]?.always??a?.[e]?.always,cache:r.targets?.[e]?.cache??a?.[e]?.cache,cacheOnWarning:r.targets?.[e]?.cacheOnWarning??a?.[e]?.cacheOnWarning,cacheRestore:r.targets?.[e]?.cacheRestore??a?.[e]?.cacheRestore,concurrencyGroup:r.targets?.[e]?.concurrencyGroup??a?.[e]?.concurrencyGroup,hashMode:r.targets?.[e]?.hashMode??a?.[e]?.hashMode,id:l(i),maxConcurrent:r.targets?.[e]?.maxConcurrent??a?.[e]?.maxConcurrent,outputs:j(t,e,o,a),overrides:s,parallelism:r.targets?.[e]?.parallelism??a?.[e]?.parallelism,projectRoot:r.root,target:i,warningPattern:f(r.targets?.[e]?.warningPattern??a?.[e]?.warningPattern),when:r.targets?.[e]?.when??a?.[e]?.when}]},"getSameProjectTask"),w=p((t,e,s,o,a,r)=>{const i=[],g=a.dependencies[t]??[];for(const n of g){const c=o.projects[n.target];if(c&&(c.targets?.[e]!==void 0||r?.[e]!==void 0)){const u={project:n.target,target:e};i.push({always:c.targets?.[e]?.always??r?.[e]?.always,cache:c.targets?.[e]?.cache??r?.[e]?.cache,cacheOnWarning:c.targets?.[e]?.cacheOnWarning??r?.[e]?.cacheOnWarning,cacheRestore:c.targets?.[e]?.cacheRestore??r?.[e]?.cacheRestore,concurrencyGroup:c.targets?.[e]?.concurrencyGroup??r?.[e]?.concurrencyGroup,hashMode:c.targets?.[e]?.hashMode??r?.[e]?.hashMode,id:l(u),maxConcurrent:c.targets?.[e]?.maxConcurrent??r?.[e]?.maxConcurrent,outputs:j(n.target,e,o,r),overrides:s,parallelism:c.targets?.[e]?.parallelism??r?.[e]?.parallelism,projectRoot:c.root,target:u,warningPattern:f(c.targets?.[e]?.warningPattern??r?.[e]?.warningPattern),when:c.targets?.[e]?.when??r?.[e]?.when})}}return i},"getDependencyProjectTasks"),k=p((t,e,s,o,a)=>{if(e.startsWith("^")){const r=e.slice(1);return w(t.target.project,r,{},s,o,a)}return d(t.target.project,e,{},s,a)},"resolveStringDependency"),O=p((t,e,s,o,a)=>{const r=[];if(e.dependencies)r.push(...w(t.target.project,e.target,e.params==="forward"?t.overrides:{},s,o,a));else if(e.projects){const i=Array.isArray(e.projects)?e.projects:[e.projects];for(const g of i)r.push(...d(g,e.target,e.params==="forward"?t.overrides:{},s,a))}else r.push(...d(t.target.project,e.target,e.params==="forward"?t.overrides:{},s,a));return r},"resolveConfigDependency"),P=p((t,e,s,o,a)=>typeof e=="string"?k(t,e,s,o,a):O(t,e,s,o,a),"resolveDependency"),T=p((t,e)=>{const{projectGraph:s,targetDefaults:o,workspace:a}=e,r=a.projects[t.target.project];if(!r)return[];const i=r.targets?.[t.target.target],g=o?.[t.target.target],n=i?.dependsOn??g?.dependsOn??[],c=[];for(const u of n){const y=P(t,u,a,s,o);c.push(...y)}return c},"resolveTaskDependencies"),C=p((t,e)=>{const s={},o={},a=new Set,r=[...t];for(;r.length>0;){const n=r.shift();if(!n)break;if(a.has(n.id))continue;a.add(n.id),s[n.id]=n,o[n.id]=[];const c=T(n,e);for(const u of c)o[n.id]?.push(u.id),a.has(u.id)||r.push(u)}const i=new Set;for(const n of Object.values(o))for(const c of n)i.add(c);const g=Object.keys(s).filter(n=>!i.has(n));return{dependencies:o,roots:g,tasks:s}},"createTaskGraph");export{C as createTaskGraph,l as getTaskId,R as parseTaskId};
@@ -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-DEDFC-kM.js";import{Cache as F}from"./Cache-C540ZPYk.js";import{inferFrameworkEnvPatterns as O}from"./detectFrameworks-WVZJOPgN.js";import{IncrementalFileHasher as H}from"./IncrementalFileHasher-CdLXVB5F.js";import{InProcessTaskHasher as G}from"./computeTaskHash-Xxd8v-X3.js";import{TaskOrchestrator as P}from"./TaskOrchestrator-F_NrcUYn.js";import{TaskScheduler as S}from"./parsePartition-uzPNgtPp.js";var V=Object.defineProperty,m=g((e,a)=>V(e,"name",{value:a,configurable:!0}),"i");const z=m(e=>{const a=[],o={};for(const[t,s]of Object.entries(e.tasks))s.always?a.push(s):o[t]=s;if(a.length===0)return{alwaysTasks:[],graph:e};const i=new Set(a.map(t=>t.id)),c={};for(const[t,s]of Object.entries(e.dependencies))i.has(t)||(c[t]=s.filter(n=>!i.has(n)));return{alwaysTasks:a,graph:{dependencies:c,roots:e.roots.filter(t=>!i.has(t)),tasks:o}}},"partitionAlwaysTasks"),A=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"),B=m(e=>typeof e=="number"?Math.max(1,e):e===!1?1:3,"resolveParallel"),Q=m(async(e,a,o)=>{const{lifeCycle:i,projectGraph:c,taskExecutor:t,taskGraph:s,workspaceRoot:n}=o,v=a.namespaceByGlobalEnv?A(a.globalEnv):void 0,k=new F({cacheDirectory:a.cacheDirectory,cacheNamespace:v,maxCacheAge:a.maxCacheAge,maxCacheSize:a.maxCacheSize,workspaceRoot:n});k.removeOldEntries().catch(()=>{});const p={};for(const[r,d]of Object.entries(c.nodes))p[r]=d.data;const l=a.incrementalFileHashing?new H({workspaceRoot:n}):void 0;l&&await l.load();const w=new G({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:n}),{alwaysTasks:y,graph:u}=z(s),E=B(a.parallel),C=new S(u,c,E,a.concurrencyGroups),b=Object.values(u.tasks).some(r=>r.hashMode==="trace"),R=m(r=>{const d=c.nodes[r.target.project]?.data.targets?.[r.target.target],j=a.targetDefaults?.[r.target.target];return d?.command??j?.command},"resolveCommand"),h=a.remoteCache?I(a.remoteCache):void 0;let f=a.fingerprintEnvPatterns??[];if(a.frameworkInference&&(a.autoFingerprint||b)){const r=await O(n,p);f=[...new Set([...f,...r])]}const T=new P({alwaysTasks:y,autoFingerprint:a.autoFingerprint,cache:k,cacheDiagnostics:a.cacheDiagnostics,captureOutput:!0,dataDirectory:a.dataDirectory,dryRun:a.dryRun,fingerprintEnvPatterns:f,lifeCycle:i,onRemoteUploadError:a.remoteCache?.onUploadError,remoteCache:h,resolveCommand:R,scheduler:C,skipCache:a.skipNxCache,summarize:a.summarize,taskExecutor:t,taskGraph:u,taskHasher:w,untrackedEnvVars:a.untrackedEnvVars,workspaceRoot:n});try{const r=await T.run();return l&&await l.save().catch(()=>{}),r}finally{h&&await h.close().catch(()=>{})}},"defaultTaskRunner");export{Q as defaultTaskRunner};
@@ -1 +0,0 @@
1
- var D=Object.defineProperty;var d=(t,e)=>D(t,"name",{value:e,configurable:!0});import{createRequire as R}from"node:module";import{join as m}from"@visulima/path";import{O as j}from"./utils-BH2W5Wml.js";const _=R(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,O=d(t=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[e,r]=u.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return u.getBuiltinModule(t)}return _(t)},"__cjs_getBuiltinModule"),{mkdir:f,writeFile:y,readFile:b}=O("node:fs/promises");var I=Object.defineProperty,i=d((t,e)=>I(t,"name",{value:e,configurable:!0}),"n");const P=i(t=>{switch(t.status){case"local-cache":case"local-cache-kept-existing":return"HIT";case"remote-cache":return"REMOTE_HIT";case"skipped":return"SKIPPED";default:return"MISS"}},"getCacheStatus"),$=i((t,e,r)=>{const s=Date.now(),n=`${new Date(r).toISOString().replaceAll(/[:.]/g,"-")}_${j()}`,o=[];let l=0,g=0,h=0,S=0;for(const[c,a]of t){const w=e.dependencies[c]??[],v={cacheable:a.task.cache!==!1,cacheStatus:P(a),dependencies:w,duration:a.startTime&&a.endTime?a.endTime-a.startTime:void 0,endTime:a.endTime?new Date(a.endTime).toISOString():void 0,exitCode:a.code,hash:a.task.hash,hashDetails:a.task.hashDetails,outputs:a.task.outputs,retryAttempts:a.retryAttempts,startTime:a.startTime?new Date(a.startTime).toISOString():void 0,target:{configuration:a.task.target.configuration,project:a.task.target.project,target:a.task.target.target},taskId:c};switch(o.push(v),a.status){case"failure":{g+=1;break}case"local-cache":case"local-cache-kept-existing":case"remote-cache":{h+=1;break}case"skipped":{S+=1;break}case"success":{l+=1;break}}}const T=o.toSorted((c,a)=>!c.startTime||!a.startTime?0:c.startTime.localeCompare(a.startTime));return{duration:s-r,endTime:new Date(s).toISOString(),environment:{arch:process.arch,nodeVersion:process.version,platform:process.platform},id:n,startTime:new Date(r).toISOString(),stats:{cached:h,failed:g,skipped:S,succeeded:l,total:t.size},taskGraph:{dependencies:e.dependencies,roots:e.roots},tasks:T}},"generateRunSummary"),L=".task-runner",M="last-summary.json",p=i((t,e)=>e&&e.length>0?e:m(t,L),"resolveDataDirectory"),q=i(async(t,e,r={})=>{const s=m(p(e,r.dataDirectory),"runs");await f(s,{recursive:!0});const n=`${t.id}.json`,o=m(s,n);return await y(o,JSON.stringify(t,void 0,2)),o},"writeRunSummary"),k=i((t,e={})=>m(p(t,e.dataDirectory),M),"getLastRunSummaryPath"),C=i(async(t,e,r={})=>{const s=p(e,r.dataDirectory);await f(s,{recursive:!0});const n=k(e,r);return await y(n,JSON.stringify(t,void 0,2)),n},"writeLastRunSummary"),J=i(async(t,e={})=>{try{const r=await b(k(t,e),"utf8");return JSON.parse(r)}catch{return}},"readLastRunSummary");export{$ as generateRunSummary,k as getLastRunSummaryPath,J as readLastRunSummary,C as writeLastRunSummary,q as writeRunSummary};
@@ -1 +0,0 @@
1
- var p=Object.defineProperty;var d=(r,t)=>p(r,"name",{value:t,configurable:!0});var g=Object.defineProperty,h=d((r,t)=>g(r,"name",{value:t,configurable:!0}),"u");const f=h(r=>{switch(r){case"high":return 2;case"low":return 0;default:return 1}},"taskPriorityWeight"),k=h(r=>{const t=r??process.env.VIS_PARTITION;if(!t)return;const e=t.split("/");if(e.length!==2)throw new Error(`Invalid partition format: "${t}". Expected format: "index/total" (e.g., "1/4").`);const s=Number(e[0]),i=Number(e[1]);if(!Number.isInteger(s)||!Number.isInteger(i)||s<1||i<1)throw new Error(`Invalid partition values: "${t}". Both index and total must be positive integers.`);if(s>i)throw new Error(`Invalid partition index: ${s} exceeds total ${i}.`);return{index:s,total:i}},"parsePartition"),b=h(r=>{const t=new Map,e=new Set,s=h(i=>{if(t.has(i))return t.get(i);if(e.has(i))return 0;e.add(i);const n=r.dependencies[i]??[];let o=0;for(const a of n)o=Math.max(o,s(a.target)+1);return t.set(i,o),e.delete(i),o},"calculateDepth");for(const i of Object.keys(r.nodes))s(i);return t},"calculateProjectDepths"),w=h(r=>{const t=new Map;for(const e of Object.values(r.tasks)){const s=e.maxConcurrent;if(typeof s!="number"||s<=0||!Number.isFinite(s))continue;const i=e.target.target,n=t.get(i);(n===void 0||s<n)&&t.set(i,s)}return t},"buildTargetCaps"),m=h(r=>{const t=new Map;if(r===void 0)return t;for(const[e,s]of Object.entries(r))typeof s=="number"&&s>0&&Number.isFinite(s)&&t.set(e,s);return t},"buildGroupCaps"),v=h((r,t,e)=>{const s=[];return t.has(r.target.target)&&s.push(`target:${r.target.target}`),r.concurrencyGroup!==void 0&&e.has(r.concurrencyGroup)&&s.push(`group:${r.concurrencyGroup}`),s},"computeTaskKeys");class y{static{d(this,"TaskScheduler")}static{h(this,"TaskScheduler")}#i;#u;#r=new Set;#t=new Set;#a;#c;#h;#n;#o;#e;#s=new Map;static partitionTasks(t,e){if(e.total<1)throw new Error(`Invalid partition total: ${e.total}. Must be at least 1.`);if(e.index<1||e.index>e.total)throw new Error(`Invalid partition index: ${e.index}. Must be between 1 and ${e.total}.`);if(t.length===0)return[];const s=[...t].toSorted((a,c)=>a.id.localeCompare(c.id)),i=Math.ceil(s.length/e.total),n=i*(e.index-1),o=e.index===e.total?s.length:i*e.index;return s.slice(n,o)}constructor(t,e,s=3,i){if(this.#i=t,this.#u=s,this.#a=Object.keys(t.tasks).length,this.#c=this.#p(),this.#h=b(e),this.#n=w(t),this.#o=m(i),this.#e=new Map,this.#n.size>0||this.#o.size>0)for(const[n,o]of Object.entries(t.tasks)){const a=v(o,this.#n,this.#o);a.length>0&&this.#e.set(n,a)}}getNextBatch(){const t=this.#u-this.#t.size;if(t<=0)return[];const e=this.#f(),s=this.#l(e);if(this.#e.size===0)return s.slice(0,t);const i=[],n=new Map(this.#s);for(const o of s){if(i.length>=t)break;const a=this.#e.get(o.id);if(a===void 0){i.push(o);continue}if(!a.some(c=>{const u=this.#d(c),l=(n.get(c)??0)+1;return u!==void 0&&l>u})){for(const c of a)n.set(c,(n.get(c)??0)+1);i.push(o)}}return i}startTask(t){if(this.#t.has(t))return;this.#t.add(t);const e=this.#e.get(t);if(e!==void 0)for(const s of e)this.#s.set(s,(this.#s.get(s)??0)+1)}completeTask(t){const e=this.#t.delete(t);if(this.#r.add(t),!e)return;const s=this.#e.get(t);if(s!==void 0)for(const i of s){const n=(this.#s.get(i)??0)-1;n<=0?this.#s.delete(i):this.#s.set(i,n)}}#d(t){if(t.startsWith("target:"))return this.#n.get(t.slice(7));if(t.startsWith("group:"))return this.#o.get(t.slice(6))}isComplete(){return this.#r.size===this.#a}get remainingCount(){return this.#a-this.#r.size}get runningCount(){return this.#t.size}#f(){const t=[];for(const[e,s]of Object.entries(this.#i.tasks))this.#r.has(e)||this.#t.has(e)||(this.#i.dependencies[e]??[]).every(i=>this.#r.has(i))&&t.push(s);return t}#l(t){return[...t].toSorted((e,s)=>{const i=f(e.priority),n=f(s.priority);if(i!==n)return n-i;const o=this.#c.get(e.id)??0,a=this.#c.get(s.id)??0;if(o!==a)return a-o;const c=this.#h.get(e.target.project)??0,u=this.#h.get(s.target.project)??0;return c!==u?u-c:e.id.localeCompare(s.id)})}#p(){const t=new Map;for(const e of Object.keys(this.#i.tasks))t.set(e,0);for(const e of Object.values(this.#i.dependencies))for(const s of e)t.set(s,(t.get(s)??0)+1);return t}}export{y as TaskScheduler,k as parsePartition};
@@ -1,3 +0,0 @@
1
- var b=Object.defineProperty;var _=(s,e)=>b(s,"name",{value:e,configurable:!0});import{createRequire as I}from"node:module";import{spawn as L}from"@lydell/node-pty";const M=I(import.meta.url),T=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,P=_(s=>{if(typeof T<"u"&&T.versions&&T.versions.node){const[e,l]=T.versions.node.split(".").map(Number);if(e>22||e===22&&l>=3||e===20&&l>=16)return T.getBuiltinModule(s)}return M(s)},"__cjs_getBuiltinModule"),{spawn:S}=P("node:child_process");var F=Object.defineProperty,a=_((s,e)=>F(s,"name",{value:e,configurable:!0}),"d");const j=a((s,e)=>{if(s.length===0)return!0;const l=e.trim().toLowerCase();if(l==="first")return s[0].exitCode===0;if(l==="last")return s.at(-1).exitCode===0;const m=/^(!?)command-(.+)$/.exec(l);if(m){const[,v,C]=m,g=v==="!",f=s.filter(t=>t.name===C||String(t.index)===C);return g?s.filter(t=>!f.includes(t)).every(t=>t.exitCode===0):f.length>0&&f.every(t=>t.exitCode===0)}return s.every(v=>v.exitCode===0)},"evaluateSuccess"),E=a((s,e)=>{try{process.platform==="win32"?S("taskkill",["/F","/T","/PID",String(s)],{stdio:"ignore"}):process.kill(-s,e)}catch{}},"killTree"),$=a((s,e,l,m,v)=>{const C=process.hrtime(),g=e.shell!==!1,f=e.stdin??"null",t=f==="inherit"?"inherit":f==="pipe"?"pipe":"ignore";let o;if(g){let i,d,p=!1;l?(i=l,d=["-c",e.command]):process.platform==="win32"?(i="cmd.exe",d=["/s","/c",`"${e.command}"`],p=!0):(i="/bin/sh",d=["-c",e.command]),o=S(i,d,{cwd:e.cwd,detached:process.platform!=="win32",env:{...process.env,...e.env,FORCE_COLOR:process.env.FORCE_COLOR??"1"},stdio:[t,"pipe","pipe"],windowsVerbatimArguments:p})}else{const i=e.command.split(/\s+/),d=i[0],p=i.slice(1);o=S(d,p,{cwd:e.cwd,detached:process.platform!=="win32",env:{...process.env,...e.env,FORCE_COLOR:process.env.FORCE_COLOR??"1"},stdio:[t,"pipe","pipe"]})}m({index:s,kill:o.pid?i=>{E(o.pid,i??"SIGTERM")}:void 0,kind:"started",pid:o.pid,write:o.stdin?i=>o.stdin.write(i):void 0});let c="",n;const k=a(()=>{c&&(m({index:s,kind:"stdout",text:c.replace(/\r$/,"")}),c="")},"flushStdoutBuffer");o.stdout?.on("data",i=>{n&&(clearTimeout(n),n=void 0),c+=i.toString();const d=c.split(`
2
- `);c=d.pop()??"";for(const p of d)m({index:s,kind:"stdout",text:p.replace(/\r$/,"")});c&&(n=setTimeout(k,100))}),o.stdout?.on("end",()=>{n&&(clearTimeout(n),n=void 0),k()});let x="",h;const O=a(()=>{x&&(m({index:s,kind:"stderr",text:x.replace(/\r$/,"")}),x="")},"flushStderrBuffer");return o.stderr?.on("data",i=>{h&&(clearTimeout(h),h=void 0),x+=i.toString();const d=x.split(`
3
- `);x=d.pop()??"";for(const p of d)m({index:s,kind:"stderr",text:p.replace(/\r$/,"")});x&&(h=setTimeout(O,100))}),o.stderr?.on("end",()=>{h&&(clearTimeout(h),h=void 0),O()}),o.on("error",i=>{m({index:s,kind:"error",message:i.message})}),o.on("close",(i,d)=>{n&&(clearTimeout(n),n=void 0),h&&(clearTimeout(h),h=void 0),k(),O();const p=process.hrtime(C),y=p[0]*1e3+p[1]/1e6,r=i??(d?1:-1),u={command:e.command,durationMs:y,exitCode:r,index:s,killed:d!==null,name:e.name};m({commandName:e.name,durationMs:y,exitCode:r,index:s,killed:d!==null,kind:"close"}),v(u)}),{child:o,index:s,startTime:C}},"spawnCommand"),G=a((s,e,l,m,v)=>{const C=process.hrtime();let g,f;l?(g=l,f=["-c",e.command]):process.platform==="win32"?(g="cmd.exe",f=["/s","/c",e.command]):(g="/bin/sh",f=["-c",e.command]);const t=L(g,f,{cols:e.ptySize?.cols??80,cwd:e.cwd??process.cwd(),env:Object.fromEntries(Object.entries({...process.env,...e.env,FORCE_COLOR:process.env.FORCE_COLOR??"1",TERM:"xterm-256color"}).filter(o=>typeof o[1]=="string")),name:"xterm-256color",rows:e.ptySize?.rows??24});return m({index:s,kill:a(o=>{t.kill(o)},"kill"),kind:"started",pid:t.pid,resize:a((o,c)=>{t.resize(o,c)},"resize"),write:a(o=>{t.write(o)},"write")}),t.onData(o=>{m({index:s,kind:"stdout",text:o})}),t.onExit(({exitCode:o,signal:c})=>{const n=process.hrtime(C),k=n[0]*1e3+n[1]/1e6,x=o??(c?1:-1),h={command:e.command,durationMs:k,exitCode:x,index:s,killed:c!==void 0&&c!==0,name:e.name};m({commandName:e.name,durationMs:k,exitCode:x,index:s,killed:c!==void 0&&c!==0,kind:"close"}),v(h)}),{index:s,pty:t,startTime:C}},"spawnCommandPty"),q=a((s,e)=>new Promise(l=>{if(s.length===0){l({closeEvents:[],success:!0});return}const m=e.maxProcesses&&e.maxProcesses>0?e.maxProcesses:s.length,v=e.killSignal??"SIGTERM",C=e.killOthers??[],g=e.successCondition??"all",f=e.onEvent??(()=>{}),t=[],o=[],c=s.map((r,u)=>u);let n=!1,k=!1;const x=a(()=>{for(const r of t)r.pty?r.pty.kill(v):r.child?.pid&&E(r.child.pid,v)},"killAll"),h=a(r=>{for(const u of C)if(u==="failure"&&r.exitCode!==0||u==="success"&&r.exitCode===0)return!0;return!1},"shouldKillOthers"),O=a((r,u)=>{const R=t.findIndex(w=>w.index===r);if(R!==-1&&t.splice(R,1),n&&(u.killed=!0,k&&(u.exitCode=0)),o.push(u),!n&&h(u)&&(n=!0,x()),n||i(),t.length===0&&c.length===0){const w=j(o,g);l({closeEvents:o,success:w})}},"handleClose"),i=a(()=>{for(;t.length<m&&c.length>0;){const r=c.shift(),u=s[r],R=u.stdin==="pty"?G(r,u,e.shellPath,f,w=>{O(r,w)}):$(r,u,e.shellPath,f,w=>{O(r,w)});t.push(R)}},"maybeSpawnMore"),d=a(()=>{n||(n=!0,k=!0,x())},"handleSigint"),p=a(()=>{n||(n=!0,x())},"handleNonInteractiveAbort");process.on("SIGINT",d),process.on("SIGTERM",p),process.on("exit",p);const y=l;l=a((r=>{process.removeListener("SIGINT",d),process.removeListener("SIGTERM",p),process.removeListener("exit",p),y(r)}),"resolve"),i()}),"runConcurrentFallback");export{q as runConcurrentFallback};
@@ -1 +0,0 @@
1
- var k=Object.defineProperty;var p=(t,e)=>k(t,"name",{value:e,configurable:!0});import{createRequire as v}from"node:module";import{runConcurrentFallback as S}from"./runConcurrentFallback-SvS4ElEX.js";import{detectScriptShell as b}from"./detectScriptShell-CaTDk5cW.js";import{logTimings as x}from"./formatTimingTable-CP3rsDwf.js";import{withRestart as C}from"./withRestart-DKtEGsQA.js";import{runTeardown as E}from"./runTeardown-CiJJeWVf.js";import{loadNativeBindings as I}from"./isNativeAvailable-BOavFPX1.js";import{buildEnhancedPath as R}from"./collectNodeModulesBinDirs-JaeFLP9l.js";const T=v(import.meta.url),a=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,P=p(t=>{if(typeof a<"u"&&a.versions&&a.versions.node){const[e,s]=a.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return a.getBuiltinModule(t)}return T(t)},"__cjs_getBuiltinModule"),{spawn:_}=P("node:child_process");var M=Object.defineProperty,i=p((t,e)=>M(t,"name",{value:e,configurable:!0}),"o");const d=new Set;let h=!1;const j=i((t,e)=>{try{process.platform==="win32"?_("taskkill",["/F","/T","/PID",String(t)],{stdio:"ignore"}):process.kill(-t,e)}catch{}},"killTrackedTree"),u=i(t=>{for(const e of d)j(e,t)},"killAllTracked"),G=i(()=>{h||(h=!0,process.setMaxListeners(process.getMaxListeners()+3),process.on("SIGINT",()=>{u("SIGINT")}),process.on("SIGTERM",()=>{u("SIGTERM")}),process.on("exit",()=>{u("SIGTERM")}))},"installSignalHandlersOnce"),B=i(t=>t.map(e=>typeof e=="string"?{command:e}:e),"normalizeCommands"),N=i(t=>t.map(e=>{const s=e.cwd??process.cwd(),o=R(s,e.env),n={...e.env??{}};return n.PATH=o,"Path"in n&&(n.Path=o),{...e,env:n}}),"withEnhancedPathConfigs"),g=i(async(t,e)=>{const s=e.shellPath??b(),o=N(t),n=I(),m=o.some(l=>l.stdin==="pipe"||l.stdin==="pty")||!!e.onEvent;if(n&&!m){const l={killOthers:e.killOthers,killSignal:e.killSignal,killTimeout:e.killTimeout,maxProcesses:e.maxProcesses,shellPath:s,successCondition:e.successCondition},w=o.map(r=>({command:r.command,cwd:r.cwd,env:r.env,name:r.name,shell:r.shell,stdin:r.stdin}));G();const c=new Map,y=i(r=>{if(r!=null){if(r.kind==="started"&&typeof r.pid=="number"){d.add(r.pid),c.set(r.index,r.pid);return}if(r.kind==="close"||r.kind==="error"){const f=c.get(r.index);f!==void 0&&(d.delete(f),c.delete(r.index))}}},"onLifecycle");try{return await n.runConcurrentBatch(w,l,y)}finally{for(const r of c.values())d.delete(r)}}return S(o,{...e,shellPath:s})},"coreRun"),K=i(async(t,e={})=>{const s=B(t);if(s.length===0)return{closeEvents:[],success:!0};let o;return e.restart&&e.restart.tries!==0?o=await C((n,m)=>g(n,m),s,e,{delay:e.restart.delay??0,onRetry:e.restart.onRetry,tries:e.restart.tries}):o=await g(s,e),e.timings&&x(o.closeEvents),e.teardown&&e.teardown.length>0&&await E({commands:e.teardown,cwd:e.teardownCwd}),o},"runConcurrently");export{K as runConcurrently};