@visulima/task-runner 1.0.0-alpha.2 → 1.0.0-alpha.20

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 (102) hide show
  1. package/CHANGELOG.md +310 -0
  2. package/README.md +198 -52
  3. package/dist/index.d.ts +3795 -34
  4. package/dist/index.js +1 -20
  5. package/dist/packem_chunks/index.js +31 -0
  6. package/dist/packem_shared/Cache-C8FfeXpg.js +2 -0
  7. package/dist/packem_shared/CompositeLifeCycle-C6aee9GK.js +1 -0
  8. package/dist/packem_shared/FileAccessTracker-DBz_w4wl.js +50 -0
  9. package/dist/packem_shared/FingerprintManager-CYW2EwLc.js +2 -0
  10. package/dist/packem_shared/HttpRemoteCache-CpPl6lzE.js +1 -0
  11. package/dist/packem_shared/INPUT_URI_SCHEMES-Csrd0tlg.js +1 -0
  12. package/dist/packem_shared/IncrementalFileHasher-B-V3i2x-.js +1 -0
  13. package/dist/packem_shared/LogReporter-3R3oWj-Q.js +13 -0
  14. package/dist/packem_shared/ReapiRemoteCache-BXJip5wH.js +251 -0
  15. package/dist/packem_shared/TaskOrchestrator-CYj5MLwz.js +6 -0
  16. package/dist/packem_shared/TerminalBuffer-BtZy7TpT.js +3 -0
  17. package/dist/packem_shared/TrackedTaskExecutor-CtYLL3vS.js +1 -0
  18. package/dist/packem_shared/V2_ROOT-injxWBrl.js +1 -0
  19. package/dist/packem_shared/actionDigestForTaskHash-BOL4fZ9v.js +1 -0
  20. package/dist/packem_shared/archive-CDfGy5Lm.js +1 -0
  21. package/dist/packem_shared/buildForwardDependencyMap-DudUDFze.js +3 -0
  22. package/dist/packem_shared/collectFiles-W4bnBRpb.js +1 -0
  23. package/dist/packem_shared/collectNodeModulesBinDirs-CD-eDrtO.js +1 -0
  24. package/dist/packem_shared/computeTaskHash-CaPdG1BA.js +1 -0
  25. package/dist/packem_shared/containsBlob-DAU8R7GH.js +1 -0
  26. package/dist/packem_shared/createInputHandler-CkDCpPYy.js +1 -0
  27. package/dist/packem_shared/createTaskGraph-D8Jn_Dn9.js +1 -0
  28. package/dist/packem_shared/defaultTaskRunner-DMHpavzm.js +2 -0
  29. package/dist/packem_shared/detectFrameworks-WVZJOPgN.js +1 -0
  30. package/dist/packem_shared/detectScriptShell-CaTDk5cW.js +1 -0
  31. package/dist/packem_shared/digestBuffer-g11aCaDx.js +1 -0
  32. package/dist/packem_shared/enforceProjectConstraints-dNc1SwRi.js +1 -0
  33. package/dist/packem_shared/expandArguments-D7qvc6Rp.js +1 -0
  34. package/dist/packem_shared/expandShortcut-BErNHNXZ.js +1 -0
  35. package/dist/packem_shared/expandTokensInString-DVSFEdWu.js +1 -0
  36. package/dist/packem_shared/expandWildcard-DE0dOOZF.js +1 -0
  37. package/dist/packem_shared/extractPackageName-BeL6Gc3a.js +1 -0
  38. package/dist/packem_shared/findCycle-BY8-jmzB.js +1 -0
  39. package/dist/packem_shared/formatTimingTable-CP3rsDwf.js +7 -0
  40. package/dist/packem_shared/generateRunSummary-L9Z2NfWn.js +1 -0
  41. package/dist/packem_shared/getCurrentBranch-D-qoZByx.js +1 -0
  42. package/dist/packem_shared/getMainWorktreeRoot-DB9P2wDL.js +1 -0
  43. package/dist/packem_shared/isNativeAvailable-CkTjxb7P.js +1 -0
  44. package/dist/packem_shared/parseCommands-BHsXoUCd.js +1 -0
  45. package/dist/packem_shared/parsePartition-Bt1jBjZH.js +1 -0
  46. package/dist/packem_shared/projectGraphToDot-FN6oHDGH.js +250 -0
  47. package/dist/packem_shared/resolveCacheMode--4y60ODd.js +1 -0
  48. package/dist/packem_shared/resolveOutputs-CzGGEbcP.js +1 -0
  49. package/dist/packem_shared/runConcurrentFallback-BhJCT2LA.js +3 -0
  50. package/dist/packem_shared/runConcurrently-D1Ytsjaj.js +1 -0
  51. package/dist/packem_shared/runTeardown-DAn1xFWJ.js +1 -0
  52. package/dist/packem_shared/shell-quote-BhmqDUL1.js +1 -0
  53. package/dist/packem_shared/stripQuotes-jkZb0CL9.js +1 -0
  54. package/dist/packem_shared/toChromeTrace-DxN5NQIU.js +1 -0
  55. package/dist/packem_shared/tracked-executor-B90U4Um3.js +3 -0
  56. package/dist/packem_shared/utils-BH2W5Wml.js +1 -0
  57. package/dist/packem_shared/withRestart-DKtEGsQA.js +1 -0
  58. package/index.js +603 -0
  59. package/package.json +31 -19
  60. package/binding.js +0 -204
  61. package/dist/affected.d.ts +0 -48
  62. package/dist/cache.d.ts +0 -103
  63. package/dist/default-task-runner.d.ts +0 -44
  64. package/dist/file-access-tracker.d.ts +0 -53
  65. package/dist/fingerprint.d.ts +0 -45
  66. package/dist/framework-inference.d.ts +0 -35
  67. package/dist/graph-visualizer.d.ts +0 -74
  68. package/dist/incremental-hasher.d.ts +0 -58
  69. package/dist/life-cycle.d.ts +0 -36
  70. package/dist/lockfile-hasher.d.ts +0 -73
  71. package/dist/native-binding.d.ts +0 -64
  72. package/dist/packem_shared/Cache-IYpTYVUC.js +0 -298
  73. package/dist/packem_shared/CompositeLifeCycle-7AtYw1dv.js +0 -112
  74. package/dist/packem_shared/FileAccessTracker-CrtBAt5D.js +0 -239
  75. package/dist/packem_shared/FingerprintManager-D6Y0erg-.js +0 -227
  76. package/dist/packem_shared/IncrementalFileHasher-Ds3J6dgb.js +0 -151
  77. package/dist/packem_shared/RemoteCache-BDqrnDEi.js +0 -179
  78. package/dist/packem_shared/TaskOrchestrator-BvYs3ONw.js +0 -342
  79. package/dist/packem_shared/TaskScheduler-CJilHDta.js +0 -111
  80. package/dist/packem_shared/TrackedTaskExecutor-BGUKFE-7.js +0 -164
  81. package/dist/packem_shared/collectFiles-ClXHnHhg.js +0 -22
  82. package/dist/packem_shared/computeTaskHash-BoCnnvIJ.js +0 -356
  83. package/dist/packem_shared/createTaskGraph-CcsFaSrz.js +0 -164
  84. package/dist/packem_shared/defaultTaskRunner-CrW4v5Ye.js +0 -79
  85. package/dist/packem_shared/detectFrameworks-CeFzKE6J.js +0 -101
  86. package/dist/packem_shared/extractPackageName-CbVNW-dr.js +0 -189
  87. package/dist/packem_shared/filterAffectedTasks-I-18zPg6.js +0 -135
  88. package/dist/packem_shared/findCycle-DF4_BRdO.js +0 -212
  89. package/dist/packem_shared/generateRunSummary-qn-_jKwt.js +0 -134
  90. package/dist/packem_shared/isNativeAvailable-BWhnZ4ES.js +0 -19
  91. package/dist/packem_shared/projectGraphToDot-VdTjHcVp.js +0 -202
  92. package/dist/packem_shared/utils-zO0ZRgtf.js +0 -390
  93. package/dist/remote-cache.d.ts +0 -55
  94. package/dist/run-summary.d.ts +0 -89
  95. package/dist/task-graph-utils.d.ts +0 -39
  96. package/dist/task-graph.d.ts +0 -22
  97. package/dist/task-hasher.d.ts +0 -67
  98. package/dist/task-orchestrator.d.ts +0 -38
  99. package/dist/task-scheduler.d.ts +0 -18
  100. package/dist/tracked-executor.d.ts +0 -46
  101. package/dist/types.d.ts +0 -385
  102. package/dist/utils.d.ts +0 -39
@@ -0,0 +1,251 @@
1
+ var F=Object.defineProperty;var f=(i,e)=>F(i,"name",{value:e,configurable:!0});import{createRequire as O}from"node:module";import{dirname as $}from"@visulima/path";const U=O(import.meta.url),_=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,y=f(i=>{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(i)}return U(i)},"__cjs_getBuiltinModule"),{randomUUID:N}=y("node:crypto"),{createWriteStream:D}=y("node:fs"),{mkdir:z,rm:I}=y("node:fs/promises"),{Readable:V}=y("node:stream"),{pipeline:j}=y("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((i,e)=>W(i,"name",{value:e,configurable:!0}),"n");let w;const G=S(async()=>{let i,e;try{i=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:i,protoLoader:e}},"importGrpc"),H=S(async()=>{const{grpc:i,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:s,Root:a}=t,r=new a;s(M,r,{keepCase:!0}),s(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}),p=i.loadPackageDefinition(o),c=p.build.bazel.remote.execution.v2,u=p.google.bytestream;w={clients:{ActionCache:c.ActionCache,ByteStream:u.ByteStream,Capabilities:c.Capabilities,ContentAddressableStorage:c.ContentAddressableStorage},definition:o}}return{clients:w.clients,grpc:i}},"loadReapiProto");S(()=>{w=void 0},"resetReapiProtoCache");var Y=Object.defineProperty,d=f((i,e)=>Y(i,"name",{value:e,configurable:!0}),"l");const k="IDENTITY",P=0,K=5,J=16,X=7,E=4*1024*1024,T=64*1024,q=256,x=10,Z=d((i,e)=>`${i===""?"":`${i}/`}blobs/${e.hash}/${String(e.sizeBytes)}`,"buildReadResourceName"),Q=d((i,e)=>`${i===""?"":`${i}/`}uploads/${N()}/blobs/${e.hash}/${String(e.sizeBytes)}`,"buildWriteResourceName"),g=d(async(i,e,t,s,a)=>{const r=i[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 p={deadline:Date.now()+a};r.call(i,t,s,p,(c,u)=>{if(c){o(c);return}n(u)})})},"callUnary");class ue{static{f(this,"ReapiRemoteCache")}static{d(this,"ReapiRemoteCache")}#o;#h;#u;#e;#l;#m;#t;#f;#a=new Map;#d=new Set;#b=1e4;#_=!1;#n;#r;constructor(e){const{target:t,useTls:s}=ie(e.url);this.#o=t,this.#h=s,this.#u=e.bearerToken,this.#e=e.instanceName??"",this.#t=e.timeout??3e4,this.#f=e.onUploadError;const a=e.mode??"readwrite";if(this.#l=a==="read"||a==="readwrite",this.#m=a==="write"||a==="readwrite",this.#u!==void 0&&!this.#h&&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(){this.#_=!0;const e=this.#n;if(e===void 0)return;if(this.#n=void 0,this.#d.size>0){const s=Promise.allSettled(this.#d),a=new Promise(r=>{setTimeout(r,this.#b)});await Promise.race([s,a])}let t;try{t=await e}catch{return}for(const s of[t.actionCache,t.byteStream,t.capabilities,t.cas])try{s.close()}catch{}}#c(e){if(this.#_)return Promise.reject(new Error("[task-runner] REAPI backend is closed; refusing new RPC"));const t=e();return this.#d.add(t),t.finally(()=>{this.#d.delete(t)}).catch(()=>{}),t}async probeCapabilities(){return this.#c(()=>this.#g())}async containsAction(e){return this.#c(()=>this.#w(e))}async#w(e){if(!this.#l)return!1;await this.#p();try{const{actionCache:t}=await this.#s(),s=await this.#i();return await g(t,"GetActionResult",{action_digest:h(e),inline_stderr:!1,inline_stdout:!1,instance_name:this.#e},s,this.#t),!0}catch(t){if(C(t))return!1;throw t}}async fetchBlob(e,t){return this.#c(()=>this.#R(e,t))}async#R(e,t){if(!this.#l)return!1;await this.#p();try{const s=await this.#y();if(await z($(t),{recursive:!0}),e.sizeBytes<=s){const a=await this.#E(e);return a===void 0?!1:(await j(V.from(a),D(t)),!0)}return await this.#T(e,t)}catch{return await I(t,{force:!0}).catch(()=>{}),!1}}async retrieveAction(e){return this.#c(()=>this.#B(e))}async#B(e){if(!this.#l)return null;await this.#p();try{const{actionCache:t}=await this.#s(),s=await this.#i(),a=await g(t,"GetActionResult",{action_digest:h(e),inline_stderr:!1,inline_stdout:!1,instance_name:this.#e},s,this.#t);return ee(a)}catch(t){if(C(t))return null;throw t}}async storeAction(e,t,s){return this.#c(()=>this.#C(e,t,s))}async#C(e,t,s){if(!this.#m)return!1;await this.#p();try{const a=await this.#S(s.map(c=>c.digest)),r=new Set(a.map(c=>c.hash)),n=s.filter(c=>r.has(c.digest.hash));await this.#v(n);const{actionCache:o}=await this.#s(),p=await this.#i();return await g(o,"UpdateActionResult",{action_digest:h(e),action_result:te(t),instance_name:this.#e},p,this.#t),!0}catch(a){return this.#f?.(e.hash,a),!1}}async#s(){return this.#n===void 0&&(this.#n=(async()=>{const{clients:e,grpc:t}=await H(),s=this.#h?t.credentials.createSsl():t.credentials.createInsecure();return{actionCache:new e.ActionCache(this.#o,s),byteStream:new e.ByteStream(this.#o,s),capabilities:new e.Capabilities(this.#o,s),cas:new e.ContentAddressableStorage(this.#o,s),clients:e,grpc:t}})()),this.#n}async#i(){const{grpc:e}=await this.#s(),t=new e.Metadata;return this.#u!==void 0&&t.set("authorization",`Bearer ${this.#u}`),t}async#y(){return(await this.#g()).maxBatchTotalSizeBytes}async#g(){if(this.#r!==void 0)return this.#r;try{const{capabilities:e}=await this.#s(),t=await this.#i(),s=(await g(e,"GetCapabilities",{instance_name:this.#e},t,this.#t))?.cache_capabilities,a=s&&typeof s.max_batch_total_size_bytes=="number"?s.max_batch_total_size_bytes:0,r=(s?.digest_functions??[]).map(String);return this.#r={digestFunctions:r,maxBatchTotalSizeBytes:a>0?a:E},this.#r}catch(e){if(se(e))throw e;return this.#r={digestFunctions:[],maxBatchTotalSizeBytes:E},this.#r}}async#p(){const{digestFunctions:e}=await this.#g();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#S(e){if(e.length===0)return[];const{cas:t}=await this.#s(),s=await this.#i();return((await g(t,"FindMissingBlobs",{blob_digests:e.map(a=>h(a)),instance_name:this.#e},s,this.#t))?.missing_blob_digests??[]).map(a=>R(a))}async#v(e){if(e.length===0)return;const t=await this.#y(),s=t-q,a=[],r=[];for(const o of e)(o.digest.sizeBytes<=s?a:r).push(o);const n=ae(a,t);for(const o of n)await this.#A(o);for(const o of r)await this.#k(o)}async#A(e){const t=[],s=[];for(const a of e){const r=this.#a.get(a.digest.hash);if(r!==void 0){s.push(r);continue}t.push(a)}if(t.length>0){const a=this.#D(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(s)}async#D(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:s}=await this.#s(),a=await this.#i(),r=(await g(s,"BatchUpdateBlobs",{instance_name:this.#e,requests:t},a,this.#t))?.responses??[];for(const n of r){const o=n.status.code??0;if(o!==P)throw new Error(`[task-runner] BatchUpdateBlobs reported code ${String(o)} for ${n.digest.hash}: ${n.status.message??""}`)}return!0}async#k(e){const t=this.#a.get(e.digest.hash);if(t!==void 0){await t;return}const s=this.#P(e);this.#a.set(e.digest.hash,s);try{await s}finally{this.#a.delete(e.digest.hash)}}async#P(e){const{byteStream:t}=await this.#s(),s=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 p={deadline:Date.now()+this.#t*x},c=r.call(t,s,p,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 b=0;b<v.byteLength;b+=T){const A=v.subarray(b,b+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#E(e){const{cas:t}=await this.#s(),s=await this.#i(),a=(await g(t,"BatchReadBlobs",{acceptable_compressors:[k],digests:[h(e)],instance_name:this.#e},s,this.#t))?.responses?.[0];if(!(!a||(a.status.code??0)!==P))return a.data===void 0?Buffer.alloc(0):Buffer.isBuffer(a.data)?a.data:Buffer.from(a.data)}async#T(e,t){const{byteStream:s}=await this.#s(),a=await this.#i(),r=Z(this.#e,e),n=s.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},p=n.call(s,{read_limit:0,read_offset:0,resource_name:r},a,o),c=D(t);try{for await(const u of p){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=d(i=>({hash:i.hash,size_bytes:i.sizeBytes}),"digestToProto"),R=d(i=>({hash:i?.hash??"",sizeBytes:typeof i?.size_bytes=="number"?i.size_bytes:0}),"protoToDigest"),ee=d(i=>({exitCode:i?.exit_code??0,outputDirectories:(i?.output_directories??[]).map(e=>({path:e.path,treeDigest:R(e.tree_digest)})),outputFiles:(i?.output_files??[]).map(e=>({digest:R(e.digest),isExecutable:e.is_executable??!1,path:e.path})),stdoutDigest:i?.stdout_digest===void 0?void 0:R(i.stdout_digest)}),"protoToActionResult"),te=d(i=>({exit_code:i.exitCode,output_directories:i.outputDirectories.map(e=>({path:e.path,tree_digest:h(e.treeDigest)})),output_files:i.outputFiles.map(e=>({digest:h(e.digest),is_executable:e.isExecutable,path:e.path})),stdout_digest:i.stdoutDigest===void 0?void 0:h(i.stdoutDigest)}),"actionResultToProto"),C=d(i=>{if(typeof i!="object"||i===null)return!1;const{code:e}=i;return e===K},"isNotFoundError"),se=d(i=>{if(typeof i!="object"||i===null)return!1;const{code:e}=i;return e===J||e===X},"isAuthError"),ie=d(i=>{const e=i.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[,s,a]=t,r=(a??"").trim();if(r==="")throw new Error(`[task-runner] REAPI backend url ${i} is missing a host:port target.`);return{target:r,useTls:s?.toLowerCase()==="grpcs"}},"parseGrpcUrl"),ae=d((i,e)=>{const t=[];let s=[],a=0;for(const r of i){const n=r.digest.sizeBytes+q;a+n>e&&s.length>0&&(t.push(s),s=[],a=0),s.push(r),a+=n}return s.length>0&&t.push(s),t},"bucketIntoBatches"),re=d(async i=>{const e=[];for await(const t of i)e.push(Buffer.isBuffer(t)?t:Buffer.from(t));return Buffer.concat(e)},"streamToBuffer");export{ue as ReapiRemoteCache};
@@ -0,0 +1,6 @@
1
+ var M=Object.defineProperty;var y=(r,t)=>M(r,"name",{value:t,configurable:!0});import{j as m,v as D,f as E}from"./utils-BH2W5Wml.js";import{resolve as H,join as F}from"@visulima/path";import{retrieveByTaskHash as x,storeByTaskHash as P}from"./actionDigestForTaskHash-BOL4fZ9v.js";import{T as W,s as I,a as A,m as B}from"./tracked-executor-B90U4Um3.js";import{FingerprintManager as L}from"./FingerprintManager-CYW2EwLc.js";import{generateRunSummary as z,writeLastRunSummary as N,writeRunSummary as G}from"./generateRunSummary-L9Z2NfWn.js";import{findCycle as U}from"./findCycle-BY8-jmzB.js";import{computeTaskHash as J}from"./computeTaskHash-CaPdG1BA.js";import{getCurrentBranch as V,evaluateWhen as Y,explainWhen as X}from"./getCurrentBranch-D-qoZByx.js";var _=Object.defineProperty,d=y((r,t)=>_(r,"name",{value:t,configurable:!0}),"p");const q=d(r=>{const t=E();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"),S=d((r,t)=>{if(!r||r.length===0||!t)return!1;for(const s of r)try{if(new RegExp(s).test(t))return!0}catch{}return!1},"detectWarnings"),j=d(r=>r!==void 0&&r.length>0&&r.every(t=>typeof t!="string"&&t.auto),"isAutoOnlyOutputs"),C="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.",w=d(()=>{let r;return{promise:new Promise(t=>{r=t}),resolve:r}},"createDeferred"),K=d(r=>new Proxy(r,{get(t,s,i){const e=Reflect.get(t,s,i);return typeof e!="function"?e:(...a)=>{try{return e.apply(t,a)}catch{return}}}}),"wrapLifeCycle");class ot{static{y(this,"Y")}static{d(this,"TaskOrchestrator")}#o;#a;#r;#t;#m;#n;#g;#l;#k;#i;#c;#y;#w;#f;#j;#d;#C;#v;#R;#T;#e;#s=new Map;#$;#O;#b;#M;#E;#h=new Map;#u=w();#p=!1;constructor(t){this.#o=t.taskHasher,this.#a=t.cache,this.#r=t.scheduler,this.#t=K(t.lifeCycle),this.#m=t.taskExecutor,this.#n=t.workspaceRoot,this.#g=t.skipCache??!1,this.#l=t.captureOutput??!0,this.#k=t.autoFingerprint??!1,this.#y=t.fingerprintEnvPatterns??[],this.#w=t.untrackedEnvVars??[],this.#f=t.cacheDiagnostics??!1,this.#j=t.resolveCommand??void 0,this.#d=t.remoteCache??void 0,this.#C=t.onRemoteUploadError??void 0,this.#v=t.dryRun??!1,this.#R=t.summarize??!1,this.#T=t.dataDirectory,this.#e=t.taskGraph??void 0,this.#$=Date.now(),this.#O=t.alwaysTasks??[],this.#M=t.bail??!1,this.#b=t.whenContext??{branch:V(t.workspaceRoot)},this.#E=this.#U();const s=this.#e?Object.values(this.#e.tasks).some(i=>i.hashMode==="trace"):!1;this.#k||s?(this.#i=new L(t.workspaceRoot),this.#c=new W(t.workspaceRoot)):(this.#i=void 0,this.#c=void 0)}async run(){this.#t.startCommand?.();const t=this.#r.getOrphanDependencies?.();if(t&&t.size>0){const i=["[task-runner] Task graph contains dependency refs that don't resolve to any task — treating them as already-completed:"];for(const[e,a]of t)i.push(` - ${e} → ${a.join(", ")}`);process.stderr.write(`${i.join(`
2
+ `)}
3
+ `)}const s=d(()=>{this.#p=!0,this.#c?.killAll(),this.#u.resolve()},"signalHandler");process.on("SIGINT",s),process.on("SIGTERM",s);try{await this.#W(),this.#O.length>0&&!this.#p&&await this.#P()}finally{process.removeListener("SIGINT",s),process.removeListener("SIGTERM",s),this.#t.endCommand?.()}if(this.#e&&!this.#p)try{const i=z(this.#s,this.#e,this.#$);await N(i,this.#n,{dataDirectory:this.#T}),this.#R&&await G(i,this.#n,{dataDirectory:this.#T})}catch(i){const e=i instanceof Error?i.message:String(i);process.stderr.write(`[task-runner] Failed to persist run summary: ${e}
4
+ `)}return this.#s}async#P(){for(const t of this.#O){this.#t.scheduleTask?.(t),this.#t.startTasks?.([t]);let s;if(this.#F(t))s=this.#x(t);else{const i=Date.now();try{s=await this.#S(t,i)}catch(e){s=m(t,e,i),this.#s.set(t.id,s)}}this.#t.endTasks?.([s]),s.terminalOutput&&this.#t.printTaskTerminalOutput?.(s.task,s.status,s.terminalOutput)}}async#W(){for(;!this.#r.isComplete()&&!this.#p;){const t=this.#r.getNextBatch();if(t.length===0){if(this.#h.size>0){await this.#u.promise,this.#u=w();continue}if(this.#r.remainingCount>0)throw new Error(this.#V());break}for(const s of t)this.#t.scheduleTask?.(s),this.#r.startTask(s.id);this.#t.startTasks?.(t);for(const s of t){const i=(this.#F(s)?Promise.resolve(this.#x(s)):this.#I(s)?this.#B(s):this.#A(s)).catch(e=>{const a=m(s,e,Date.now());return this.#s.set(s.id,a),a}).then(e=>{this.#h.delete(s.id),this.#r.completeTask(s.id),e.status==="failure"&&this.#J(s.id);try{this.#t.endTasks?.([e])}catch{}if(e.terminalOutput)try{this.#t.printTaskTerminalOutput?.(e.task,e.status,e.terminalOutput)}catch{}return this.#u.resolve(),e}).catch(e=>m(s,e,Date.now()));this.#h.set(s.id,i)}this.#h.size>0&&(await this.#u.promise,this.#u=w())}this.#h.size>0&&await Promise.all(this.#h.values())}#I(t){return this.#k?!0:t.hashMode==="trace"&&this.#i!==void 0}async#A(t){const s=Date.now(),i=await this.#o.hashTask(t),e=J(i);if(Object.assign(t,{hash:e,hashDetails:i}),this.#v)return this.#H(t,s);if(!this.#g&&t.cache!==!1){const n=await this.#a.get(e);if(n)return this.#D(t,n,s);if(this.#d&&await x(this.#d,e,this.#a.cacheDirectory)){const h=await this.#a.get(e);if(h){const o=await this.#D(t,h,s);return o.status="remote-cache",o}}}const a=await this.#S(t,s);return a.code===0&&t.cache!==!1&&t.hash&&this.#d&&P(this.#d,t.hash,this.#a.cacheDirectory,this.#C).catch(()=>{}),a}async#B(t){const s=Date.now();if(this.#v)return this.#H(t,s);if(!this.#g&&t.cache!==!1){const i=await this.#a.getByTaskId(t.id);if(i?.fingerprint&&this.#i){const e=this.#i.validateCommand(i.fingerprint,`${t.target.project}:${t.target.target}`,t.overrides);if(e)this.#f&&this.#t.printCacheMiss?.(t,this.#i.formatMissReasons([e]));else{const a=await this.#i.validate(i.fingerprint);if(!a)return this.#D(t,i,s);this.#f&&this.#t.printCacheMiss?.(t,this.#i.formatMissReasons(a))}}else this.#f&&!i&&this.#t.printCacheMiss?.(t,`Cache miss reasons:
5
+ - No previous fingerprint found (first run)`)}return this.#z(t,s)}async#D(t,s,i){const e=await this.#a.restoreOutputs(s.hash,t.outputs,t.cacheRestore)?"local-cache":"local-cache-kept-existing",a={code:s.code,endTime:Date.now(),startTime:i,status:e,task:t,terminalOutput:s.terminalOutput};return this.#s.set(t.id,a),a}async#S(t,s){try{const{code:i,retryAttempts:e,terminalOutput:a}=await this.#m(t,{captureOutput:this.#l,cwd:D(this.#n,t)}),n=i===0&&S(t.warningPattern,a),h={code:i,endTime:Date.now(),hadWarnings:n||void 0,retryAttempts:e&&e>0?e:void 0,startTime:s,status:i===0?"success":"failure",task:t,terminalOutput:a};this.#s.set(t.id,h);const o=n&&t.cacheOnWarning===!1;if(i===0&&t.cache!==!1&&t.hash&&!o&&!this.#p){const l=await this.#L(t);l.length>0?(h.selfModified=!0,this.#t.printSelfModifyingSkip?.(t,l)):j(t.outputs)?this.#t.printEmptyFingerprintWarning?.(t,C):await this.#a.put(t.hash,a,t.outputs,i)}return h}catch(i){const e=m(t,i,s);return this.#s.set(t.id,e),e}}async#L(t){const s=t.hashDetails?.nodes;if(!s||typeof this.#o.rehashFile!="function")return[];const i=this.#o.rehashFile.bind(this.#o),e=Object.entries(s);return(await Promise.all(e.map(async([a,n])=>{const h=H(this.#n,a),o=await i(h);return o!==void 0&&o!==n?a:void 0}))).filter(a=>a!==void 0)}async#z(t,s){if(!this.#i)return this.#S(t,s);const i=`${t.target.project}:${t.target.target}`,e=D(this.#n,t);try{let a,n,h,o=0,l=!1,g,k,v=!1,T;const O=this.#j?.(t);if(O&&this.#c?.isTrackingSupported&&this.#c){const c=await this.#c.execute(t,{captureOutput:this.#l,cwd:e},O);a=c.code,n=c.terminalOutput,v=c.hints.cacheDisabled,T=I(c.hints);const p=A(c.accesses,c.hints);o=p.length,l=!0,k=p.filter(u=>u.type==="write").map(u=>u.path),h=await this.#i.createFingerprint(p,i,t.overrides,process.env,B(this.#y,c.hints),this.#w)}else{const c=await this.#m(t,{captureOutput:this.#l,cwd:e});a=c.code,n=c.terminalOutput,g=c.retryAttempts;const p=await this.#o.hashTask(t),u=Object.keys(p.nodes).map($=>({path:F(this.#n,$),type:"read"}));h=await this.#i.createFingerprint(u,i,t.overrides,process.env,this.#y,this.#w)}const b=a===0&&S(t.warningPattern,n),f={cacheHints:T,code:a,endTime:Date.now(),hadWarnings:b||void 0,retryAttempts:g&&g>0?g:void 0,startTime:s,status:a===0?"success":"failure",task:t,terminalOutput:n};this.#s.set(t.id,f);const R=b&&t.cacheOnWarning===!1;if(a===0&&t.cache!==!1&&h&&!R&&!this.#p){const c=this.#N(h),p=this.#G(h,l,o);if(v)f.cacheDisabledByTask=!0,this.#t.printCacheDisabledByTask?.(t);else if(c.length>0)f.selfModified=!0,this.#t.printSelfModifyingSkip?.(t,c);else if(p)f.emptyFingerprint=!0,this.#t.printEmptyFingerprintWarning?.(t,p);else if(j(t.outputs)&&(!k||k.length===0))this.#t.printEmptyFingerprintWarning?.(t,C);else{const u=q(h);Object.assign(t,{hash:u}),await this.#a.put(u,n,t.outputs,a,h,k),await this.#a.setTaskIndex(t.id,u)}}return f}catch(a){const n=m(t,a,s);return this.#s.set(t.id,n),n}}#N(t){return t.modifiedInputs??[]}#G(t,s,i){return!s||Object.keys(t.fileHashes).length>0||Object.keys(t.directoryListings).length>0||t.missingFiles.length>0?void 0:i===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."}#H(t,s){const i=t.hash?`[hash: ${t.hash.slice(0,12)}...]`:"[no hash]",e={code:0,endTime:Date.now(),startTime:s,status:"skipped",task:t,terminalOutput:`DRY RUN ${i}`};return this.#s.set(t.id,e),e}#F(t){return t.when?!Y(t.when,this.#b):!1}#x(t){const s=X(t.when,this.#b),i=Date.now();this.#t.printWhenSkip?.(t,s);const e={code:0,endTime:i,startTime:i,status:"skipped",task:t,terminalOutput:s?`Skipped: ${s}`:"Skipped by when clause"};return this.#s.set(t.id,e),e}#U(){const t=new Map;if(!this.#e)return t;for(const[s,i]of Object.entries(this.#e.dependencies))for(const e of i){const a=t.get(e);a?a.push(s):t.set(e,[s])}return t}#J(t){if(!this.#e)return;const s=`Skipped: upstream dependency failed (${t})`,{tasks:i}=this.#e,e=new Set;if(this.#M)for(const a of Object.keys(i))e.add(a);else{const a=[t],n=new Set([t]);for(;a.length>0;){const h=a.shift();for(const o of this.#E.get(h)??[])n.has(o)||(n.add(o),e.add(o),a.push(o))}}for(const a of e){if(this.#s.has(a)||this.#h.has(a))continue;const n=i[a];if(!n)continue;const h=Date.now(),o={code:0,endTime:h,startTime:h,status:"skipped",task:n,terminalOutput:s};this.#s.set(a,o),this.#r.completeTask(a);try{this.#t.endTasks?.([o])}catch{}}}#V(){const t=["Deadlock detected: tasks remain but none can be scheduled."];if(this.#e){const i=U(this.#e);i&&i.length>0&&t.push(`Circular dependency found: ${i.join(" → ")}`)}const s=this.#r.describeStrandedTasks?.();if(s&&s.length>0){t.push("Stranded tasks (id → unmet deps):");for(const{id:i,unmetDeps:e}of s)t.push(` - ${i} → ${e.length>0?e.join(", "):"(no unmet deps — scheduler bug, please report)"}`)}return t.join(`
6
+ `)}}export{ot as TaskOrchestrator};
@@ -0,0 +1,3 @@
1
+ var c=Object.defineProperty;var l=(r,s)=>c(r,"name",{value:s,configurable:!0});var o=Object.defineProperty,f=l((r,s)=>o(r,"name",{value:s,configurable:!0}),"c");class b{static{l(this,"TerminalBuffer")}static{f(this,"TerminalBuffer")}#i=[""];#t=0;#h=0;#e;constructor(s=256*1024){this.#e=s}write(s){let i=0;for(;i<s.length;){const t=s[i];if(t==="\x1B"){if(i+1>=s.length){i++;continue}if(s[i+1]==="["){i=this.#n(s,i+2);continue}i+=s[i+1]==="("||s[i+1]===")"?3:2;continue}if(t==="\r"){this.#h=0,i++;continue}if(t===`
2
+ `){this.#t++,this.#h=0,this.#s(this.#t),i++;continue}this.#s(this.#t),this.#l(t),this.#h++,i++}this.#g()}toString(){return this.#i.join(`
3
+ `)}#n(s,i){let t=i,h="";for(;t<s.length&&(s[t]>="0"&&s[t]<="9"||s[t]===";");)h+=s[t]??"",t++;if(t>=s.length)return t;const e=s[t],a=Number.parseInt(h,10)||1;switch(e){case"A":{this.#t=Math.max(0,this.#t-a);break}case"B":{this.#t=Math.min(this.#i.length-1,this.#t+a);break}case"C":{this.#h+=a;break}case"D":{this.#h=Math.max(0,this.#h-a);break}case"f":case"H":{const n=h.split(";");this.#t=Math.max(0,(Number.parseInt(n[0]??"1",10)||1)-1),this.#h=Math.max(0,(Number.parseInt(n[1]??"1",10)||1)-1),this.#s(this.#t);break}case"G":{this.#h=Math.max(0,a-1);break}case"J":{this.#o(Number.parseInt(h,10)||0);break}case"K":{this.#f(Number.parseInt(h,10)||0);break}case"m":{const n=`\x1B[${h}m`;this.#s(this.#t),this.#c(n);break}}return t+1}#l(s){const i=this.#i[this.#t]??"",t=this.#h;let h=0,e=0;for(;h<i.length&&e<t;)if(i[h]==="\x1B"&&i[h+1]==="["){for(h+=2;h<i.length&&!(i[h]>="A"&&i[h]<="Z"||i[h]>="a"&&i[h]<="z");)h++;h<i.length&&h++}else h++,e++;if(e<t)this.#i[this.#t]=i+" ".repeat(t-e)+s;else{let a=h;a<i.length&&i[a]!=="\x1B"&&a++,this.#i[this.#t]=i.slice(0,h)+s+i.slice(a)}}#c(s){const i=this.#i[this.#t]??"";let t=0,h=0;for(;t<i.length&&h<this.#h;)if(i[t]==="\x1B"&&i[t+1]==="["){for(t+=2;t<i.length&&!(i[t]>="A"&&i[t]<="Z"||i[t]>="a"&&i[t]<="z");)t++;t<i.length&&t++}else t++,h++;this.#i[this.#t]=i.slice(0,t)+s+i.slice(t)}#o(s){switch(s){case 0:{this.#s(this.#t),this.#a(this.#t,this.#h),this.#i.length=this.#t+1;break}case 1:{for(let i=0;i<this.#t;i++)this.#i[i]="";this.#s(this.#t),this.#r(this.#t,this.#h);break}case 2:{this.#i=[""],this.#t=0,this.#h=0;break}}}#f(s){switch(this.#s(this.#t),s){case 0:{this.#a(this.#t,this.#h);break}case 1:{this.#r(this.#t,this.#h);break}case 2:{this.#i[this.#t]="";break}}}#a(s,i){const t=this.#i[s]??"";let h=0,e=0;for(;h<t.length&&e<i;)if(t[h]==="\x1B"&&t[h+1]==="["){for(h+=2;h<t.length&&!(t[h]>="A"&&t[h]<="Z"||t[h]>="a"&&t[h]<="z");)h++;h<t.length&&h++}else h++,e++;this.#i[s]=t.slice(0,h)}#r(s,i){const t=this.#i[s]??"";let h=0,e=0;for(;h<t.length&&e<i;)if(t[h]==="\x1B"&&t[h+1]==="["){for(h+=2;h<t.length&&!(t[h]>="A"&&t[h]<="Z"||t[h]>="a"&&t[h]<="z");)h++;h<t.length&&h++}else h++,e++;this.#i[s]=" ".repeat(i)+t.slice(h)}#s(s){for(;this.#i.length<=s;)this.#i.push("")}#g(){let s=0;for(const i of this.#i)s+=i.length+1;for(;s>this.#e&&this.#i.length>1;){const i=this.#i.shift();s-=i.length+1,this.#t=Math.max(0,this.#t-1)}}}export{b as TerminalBuffer};
@@ -0,0 +1 @@
1
+ import{createRequire as e}from"node:module";import"@visulima/path";import{T as _}from"./tracked-executor-B90U4Um3.js";import"./FileAccessTracker-DBz_w4wl.js";import"./collectNodeModulesBinDirs-CD-eDrtO.js";import"./utils-BH2W5Wml.js";const i=e(import.meta.url),t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process;export{_ as TrackedTaskExecutor};
@@ -0,0 +1 @@
1
+ var h=Object.defineProperty;var c=(a,t)=>h(a,"name",{value:t,configurable:!0});import{join as s}from"@visulima/path";var n=Object.defineProperty,e=c((a,t)=>n(a,"name",{value:t,configurable:!0}),"s");const r="v2",i="cas",P="ac",d="task-hash-index",m="tmp",o=e(a=>a.slice(0,2),"shard"),y=e((a,t)=>s(a,r,i,o(t),t),"casBlobPath"),V=e((a,t)=>s(a,r,P,o(t),`${t}.json`),"acEntryPath"),_=e((a,t)=>s(a,r,d,o(t),t),"taskHashIndexPath"),b=e(a=>s(a,r,m),"tmpDirectory");export{P as V2_AC,i as V2_CAS,d as V2_INDEX,r as V2_ROOT,m as V2_TMP,V as acEntryPath,y as casBlobPath,o as shard,_ as taskHashIndexPath,b as tmpDirectory};
@@ -0,0 +1 @@
1
+ var T=Object.defineProperty;var f=(t,e)=>T(t,"name",{value:e,configurable:!0});import{createRequire as B}from"node:module";import{join as u}from"@visulima/path";import{e as k,c as H}from"./archive-CDfGy5Lm.js";const _=B(import.meta.url),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=f(t=>{if(typeof c<"u"&&c.versions&&c.versions.node){const[e,s]=c.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return c.getBuiltinModule(t)}return _(t)},"__cjs_getBuiltinModule"),{randomUUID:p,createHash:m}=h("node:crypto"),{createReadStream:g}=h("node:fs"),{mkdir:y,rm:l,stat:b}=h("node:fs/promises");var j=Object.defineProperty,n=f((t,e)=>j(t,"name",{value:e,configurable:!0}),"n");const z="vis-entry.tar.gz",d=n(t=>{const e=`vis-task:${t}`;return{hash:m("sha256").update(Buffer.from(e,"utf8")).digest("hex"),sizeBytes:0}},"actionDigestForTaskHash"),A=n(async(t,e)=>{try{return await t.containsAction(d(e))}catch{return!1}},"containsByTaskHash"),P=n(async(t,e,s)=>{const i=await t.retrieveAction(d(e));if(i===null||i.outputFiles.length===0)return!1;const a=i.outputFiles[0];if(!a)return!1;const r=u(s,e),o=u(s,`.download-${e}-${p()}.tar.gz`);try{return await y(s,{recursive:!0}),await t.fetchBlob(a.digest,o)?(await y(r,{recursive:!0}),await k(o,r),!0):!1}catch{return await l(r,{force:!0,recursive:!0}).catch(()=>{}),!1}finally{await l(o,{force:!0}).catch(()=>{})}},"retrieveByTaskHash"),R=n(async(t,e,s,i)=>{const a=u(s,e),r=u(s,`.upload-${e}-${p()}.tar.gz`);try{try{await b(u(a,".commit"))}catch{return!1}try{await H(a,r);const o=await x(r),v={exitCode:0,outputDirectories:[],outputFiles:[{digest:o,isExecutable:!1,path:z}]},w={digest:o,open:n(()=>Promise.resolve(g(r)),"open")};return await t.storeAction(d(e),v,[w])}catch(o){return i?.(e,o),!1}}finally{await l(r,{force:!0}).catch(()=>{})}},"storeByTaskHash"),x=n(async t=>{const e=m("sha256");let s=0;for await(const i of g(t)){const a=i;e.update(a),s+=a.byteLength}return{hash:e.digest("hex"),sizeBytes:s}},"digestFile");export{d as actionDigestForTaskHash,A as containsByTaskHash,P as retrieveByTaskHash,R as storeByTaskHash};
@@ -0,0 +1 @@
1
+ var I=Object.defineProperty;var l=(a,e)=>I(a,"name",{value:e,configurable:!0});import{createRequire as P}from"node:module";import{join as M,resolve as p,sep as R}from"@visulima/path";import{parseTar as w,createTar as T}from"nanotar";const j=P(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,f=l(a=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[e,t]=u.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return u.getBuiltinModule(a)}return j(a)},"__cjs_getBuiltinModule"),{mkdir:h,writeFile:O,utimes:G,readdir:S,readFile:b,stat:A}=f("node:fs/promises"),{Readable:D}=f("node:stream"),{pipeline:g}=f("node:stream/promises"),{createGunzip:F,createGzip:L,createBrotliCompress:W,constants:d,createBrotliDecompress:$}=f("node:zlib");var k=Object.defineProperty,o=l((a,e)=>k(a,"name",{value:e,configurable:!0}),"i");const q={params:{[d.BROTLI_PARAM_MODE]:d.BROTLI_MODE_TEXT,[d.BROTLI_PARAM_QUALITY]:4}},_=o(async a=>{const e=[],t=p(a),r=o(async(s,i)=>{const m=await S(s,{withFileTypes:!0});m.sort((n,c)=>n.name<c.name?-1:n.name>c.name?1:0);for(const n of m){const c=M(s,n.name),v=i===""?n.name:`${i}/${n.name}`;if(n.isDirectory()){await r(c,v);continue}if(!n.isFile())continue;const[z,B]=await Promise.all([b(c),A(c)]);e.push({attrs:{mode:(B.mode&4095).toString(8),mtime:Math.floor(B.mtimeMs)},data:z,name:v})}},"walk");return await r(t,""),e},"collectEntries"),N=o((a,e)=>{if(e===""||e==="."||e==="./"||e.startsWith("/")||e.startsWith("\\")||/^[a-z]:[\\/]/i.test(e))return null;const t=p(a),r=p(t,e),s=t.endsWith(R)?t:`${t}${R}`;return r!==t&&!r.startsWith(s)?null:r},"safeJoinForExtract"),y=o(async(a,e,t={})=>{const r=t.preserveMtime??!0,s=t.preservePerms??!0;await h(e,{recursive:!0});for(const i of a){if(i.data===void 0)continue;const m=N(e,i.name);if(m===null)throw new Error(`[task-runner] refusing to extract tar entry with unsafe path: ${i.name}`);await h(M(m,".."),{recursive:!0});const n=s&&i.attrs?.mode!==void 0?Number.parseInt(i.attrs.mode,8):void 0;if(await O(m,i.data,n===void 0?void 0:{mode:n}),r&&i.attrs?.mtime!==void 0){const c=new Date(i.attrs.mtime*1e3);await G(m,c,c)}}},"writeTarEntries"),E=o(async(a,e,t)=>{const{createWriteStream:r}=await import("node:fs");await g(D.from(Buffer.from(a)),e,r(t))},"compressBuffer"),x=o(async(a,e)=>{const{createReadStream:t}=await import("node:fs"),r=[];return await g(t(a),e,async s=>{for await(const i of s)r.push(i)}),Buffer.concat(r)},"decompressBuffer");o(async(a,e)=>{const t=await _(a),r=T(t);await O(e,r)},"createTar");o(async(a,e,t)=>{const r=await b(a),s=w(r);await y(s,e,t)},"extractTar");const X=o(async(a,e)=>{const t=await _(a),r=T(t);await E(r,L(),e)},"createTarGz"),Y=o(async(a,e,t)=>{const r=await x(a,F()),s=w(r);await y(s,e,t)},"extractTarGz"),H=o(async(a,e)=>{const t=await _(a),r=T(t);await E(r,W(q),e)},"createTarBrotli"),K=o(async(a,e,t)=>{const r=await x(a,$()),s=w(r);await y(s,e,t)},"extractTarBrotli");export{K as a,H as b,X as c,Y as e};
@@ -0,0 +1,3 @@
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,s]=l.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return l.getBuiltinModule(e)}return P(e)},"__cjs_getBuiltinModule"),{execFile:m}=_("node:child_process");var v=Object.defineProperty,d=u((e,t)=>v(e,"name",{value:t,configurable:!0}),"a");const g=d(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=d((e,t)=>{let s,o=0,r;for(const[n,a]of Object.entries(t)){const{root:c}=a;if(c===""||c==="."){r=n;continue}(e.startsWith(`${c}/`)||e===c)&&c.length>o&&(s=n,o=c.length)}return s??r},"findProjectForFile"),F=d(e=>{const t=new Map;for(const[s,o]of Object.entries(e.dependencies))for(const r of o){let n=t.get(r.target);n||(n=new Set,t.set(r.target,n)),n.add(s)}return t},"buildReverseDependencyMap"),S=d(e=>{const t=new Map;for(const[s,o]of Object.entries(e.dependencies)){const r=new Set;for(const n of o)r.add(n.target);r.size>0&&t.set(s,r)}return t},"buildForwardDependencyMap"),h=d((e,t,s,o)=>{const r=new Set,n=new Set(t),a=[...t];for(;a.length>0;){const c=a.shift(),f=s.get(c);if(f)for(const i of f)n.has(i)||(n.add(i),e.add(i),r.add(i),o==="deep"&&a.push(i))}return r},"expandInDirection"),A=d((e,t,s)=>{const o=new Set(e);let r=new Set,n=new Set;if(s.downstream!=="none"){const a=F(t);r=h(o,e,a,s.downstream)}if(s.upstream!=="none"){const a=S(t);n=h(o,e,a,s.upstream)}return{affected:o,downstream:r,upstream:n}},"expandAffected"),R=d((e,t,s)=>new Promise((o,r)=>{m("git",["merge-base",t,s],{cwd:e},(n,a)=>{n?r(n):o(a.trim())})}),"getMergeBase"),D=d(async(e,t,s)=>{g(t),g(s);try{const o=await R(e,t,s);return await new Promise((r,n)=>{m("git",["diff","--name-only",o,s],{cwd:e},(a,c)=>{a?n(a):r(c.trim().split(`
2
+ `).filter(Boolean))})})}catch{return new Promise((o,r)=>{m("git",["diff","--name-only",`${t}...${s}`],{cwd:e},(n,a)=>{n?r(n):o(a.trim().split(`
3
+ `).filter(Boolean))})})}},"getChangedFiles"),O=d(async e=>{const{base:t="main",downstream:s="deep",head:o="HEAD",projectGraph:r,projects:n,upstream:a="none",workspaceRoot:c}=e,f=await D(c,t,o),i=new Set;for(const j of f){const w=M(j,n);if(w)i.add(w);else return{affectedProjects:Object.keys(n),changedFiles:f,changedProjects:[...i],downstreamProjects:[],upstreamProjects:[]}}const p=A(i,r,{downstream:s,upstream:a});return{affectedProjects:[...p.affected],changedFiles:f,changedProjects:[...i],downstreamProjects:[...p.downstream],upstreamProjects:[...p.upstream]}},"getAffectedProjects"),T=d((e,t)=>e.filter(s=>{const o=s.split(":")[0];return t.has(o)}),"filterAffectedTasks");export{S as buildForwardDependencyMap,F as buildReverseDependencyMap,A as expandAffected,T as filterAffectedTasks,O as getAffectedProjects,D as getChangedFiles};
@@ -0,0 +1 @@
1
+ import{createRequire as e}from"node:module";import{d as l,j as u,T as d,b as p,E as _,v as f,h as m,O as g}from"./utils-BH2W5Wml.js";import"@visulima/path";const i=e(import.meta.url),t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process;export{l as collectFiles,u as createFailureResult,d as hashFile,p as hashStrings,_ as readPackageDeps,f as resolveTaskCwd,m as sortObjectKeys,g as uniqueId};
@@ -0,0 +1 @@
1
+ var u=Object.defineProperty;var c=(e,t)=>u(e,"name",{value:t,configurable:!0});import{createRequire as l}from"node:module";const h=l(import.meta.url),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,f=c(e=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[t,n]=s.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return s.getBuiltinModule(e)}return h(e)},"__cjs_getBuiltinModule"),{delimiter:d,isAbsolute:p,resolve:P,join:_,dirname:v}=f("node:path");var b=Object.defineProperty,i=c((e,t)=>b(e,"name",{value:t,configurable:!0}),"i");const m=64,g=i(e=>{const t=p(e)?e:P(process.cwd(),e),n=[];let o=t,r=0;for(;r<m;){n.push(_(o,"node_modules",".bin"));const a=v(o);if(a===o)break;o=a,r+=1}return n},"collectNodeModulesBinDirs"),j=i(e=>{if(e){const t=e.PATH;if(t!==void 0)return t;const n=e.Path;if(n!==void 0)return n}return process.env.PATH??process.env.Path??""},"readPath"),T=i((e,t)=>{const n=g(e),o=j(t);if(n.length===0)return o;const r=n.join(d);return o.length>0?`${r}${d}${o}`:r},"buildEnhancedPath"),B=i((e,t)=>{const n={...e};return n.PATH=T(t,e),"Path"in n&&n.Path!==void 0&&(n.Path=n.PATH),n},"withEnhancedPath");export{T as buildEnhancedPath,g as collectNodeModulesBinDirs,B as withEnhancedPath};
@@ -0,0 +1 @@
1
+ var W=Object.defineProperty;var k=(e,t)=>W(e,"name",{value:t,configurable:!0});import{createRequire as C}from"node:module";import{b as f,h as T,f as x,d as L,X as R}from"./utils-BH2W5Wml.js";import{join as I,resolve as _,relative as Z}from"@visulima/path";import{getFrameworkEnvVariables as A}from"./detectFrameworks-WVZJOPgN.js";import{LockfileHasher as U}from"./extractPackageName-BeL6Gc3a.js";import{loadNativeBindings as G}from"./isNativeAvailable-CkTjxb7P.js";import{looksLikeInputUri as K,parseInputUri as Q}from"./INPUT_URI_SCHEMES-Csrd0tlg.js";const J=C(import.meta.url),v=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,F=k(e=>{if(typeof v<"u"&&v.versions&&v.versions.node){const[t,o]=v.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return v.getBuiltinModule(e)}return J(e)},"__cjs_getBuiltinModule"),{execFile:z}=F("node:child_process"),{stat:P,readFile:j}=F("node:fs/promises"),{matchesGlob:B}=F("node:path");var X=Object.defineProperty,u=k((e,t)=>X(e,"name",{value:t,configurable:!0}),"u");const Y=["package-lock.json","pnpm-lock.yaml","yarn.lock","tsconfig.base.json","tsconfig.json",".env"],tt=new Set([".git",".task-runner",".task-runner-cache",".vis","coverage","dist","node_modules"]),et=new Set(["package-lock.json","pnpm-lock.yaml","yarn.lock"]);let D;const V=u(()=>(D===void 0&&(D=G()),D),"getNativeBindings"),E=u((e,t,o)=>{for(const i of Object.keys(t).toSorted())o?e.update(`${o}${i}\0`):e.update(`${i}\0`),e.update(t[i])},"hashSortedEntries"),st=u(e=>{if(e==="node -v"||e==="node --version")return Promise.resolve(process.version);const t=e.split(/\s+/),o=t[0],i=t.slice(1);return new Promise(r=>{z(o,i,{timeout:1e4},(s,n)=>{r(s?`__runtime_error__:${e}`:n.trim())})})},"executeRuntimeCommand"),y=u(e=>Object.hasOwn(process.env,e)?`1:${process.env[e]??""}`:"0:","envSignature"),it=u(e=>{if(!e||e.length===0)return[];const t=[];let o=!1;for(const i of e)typeof i=="string"?t.push(i):i.auto&&(o=!0);return t.sort(),o?[...t,{auto:!0}]:t},"canonicaliseOutputs"),N=new Map,rt=u(async e=>{let t=N.get(e);return t===void 0&&(t=await st(e),N.set(e,t)),f(e,t)},"hashRuntimeValue"),ot=new Set(["0","!","#","$","*","-","?","@","_"]),nt=u(e=>{const t=new Set,o=/\$(?:\{([^}]+)\}|([A-Z_]\w*))/gi;let i;for(;(i=o.exec(e))!==null;){const r=i[1]??i[2];if(!r)continue;const s=r.split(/[#%:/?+\-=,^]/)[0]?.trim();!s||ot.has(s)||/^\d+$/.test(s)||/^[A-Z_]\w*$/i.test(s)&&t.add(s)}return[...t]},"extractReferencedEnvVars"),M=u(e=>"fileset"in e,"isFileSetInput"),q=u(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"),at=u(e=>"runtime"in e,"isRuntimeInput"),ct=u(e=>"env"in e,"isEnvironmentInput"),pt=u(e=>"externalDependencies"in e,"isExternalDependencyInput");class yt{static{k(this,"ot")}static{u(this,"InProcessTaskHasher")}#t;#e;#a;#c;#u;#f;#l;#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.#f=t.globalInputs??Y,this.#l=t.globalEnv??[],this.#i=V(),this.#p=t.smartLockfileHashing??!1,this.#n=this.#p?new U(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.#w(t),i={},r={},s={},n=await this.#$();n&&(r.__global__=n);const d=this.#k(t),b=this.#j(d,t.target.project);for(const a of d)if(M(a)){const h=await this.#_(t,q(a.fileset),b);for(const[c,p]of Object.entries(h))i[c]=p}else if(at(a))s[a.runtime]=await rt(a.runtime);else if(ct(a))s[`env:${a.env}`]=f(a.env,y(a.env));else if(pt(a)){const h=await Promise.all(a.externalDependencies.map(async c=>[c,await this.#b(c)]));for(const[c,p]of h)r[c]=p}for(const a of this.#u)s[`env:${a}`]=f(a,y(a));if(this.#d){const a=this.#g(t);if(a)for(const h of nt(a)){const c=`env:${h}`;s[c]===void 0&&(s[c]=f(h,y(h)))}}const m=this.#e[t.target.project];if(m){if(this.#n){const a=await this.#n.hashForPackage(I(m.root,"package.json"));a&&(r.__lockfile__=a.hash)}if(this.#m){const a=_(this.#t,m.root,"package.json"),h=await A(a);for(const c of Object.keys(h))s[`framework-env:${c}`]=f(c,y(c))}}if(this.#h){const a={},h={contribute:u((c,p)=>{if(typeof c!="string"||c.length===0)throw new TypeError(`task:fingerprint contribute() requires a non-empty string key, got ${typeof c=="string"?"''":typeof c}`);if(typeof p!="string")throw new TypeError(`task:fingerprint contribute(${JSON.stringify(c)}) requires a string value, got ${typeof p}`);a[`plugin:${c}`]=f(c,p)},"contribute")};await this.#h(t,h);for(const[c,p]of Object.entries(a))s[c]=p}return{command:o,implicitDeps:Object.keys(r).length>0?r:void 0,nodes:i,runtime:Object.keys(s).length>0?s:void 0}}#w(t){const o=JSON.stringify(T(t.overrides)),i=this.#g(t)??"",r=JSON.stringify(it(t.outputs));if(this.#i){const n=JSON.stringify({command:i,outputs:r,overrides:T(t.overrides)});return this.#i.hashCommand(t.target.project,t.target.target,t.target.configuration??void 0,n)}const s=x();return s.update(t.target.project),s.update(t.target.target),t.target.configuration&&s.update(t.target.configuration),s.update(o),s.update(`command:${i}`),s.update(`outputs:${r}`),s.digest()}#g(t){const o=t.overrides.command;if(typeof o=="string")return o;const i=this.#e[t.target.project]?.targets?.[t.target.target]?.command??this.#c[t.target.target]?.command;return typeof i=="string"?i:void 0}#k(t){const o=this.#e[t.target.project]?.targets?.[t.target.target],i=this.#c[t.target.target],r=o?.inputs??i?.inputs;return r?this.#v(r,t.target.project):[{fileset:"{projectRoot}/**/*"}]}#v(t,o){const i=[],r=new Set;for(const s of t)if(typeof s=="string")if(K(s)){const n=Q(s);n&&i.push(n)}else if(s.startsWith("{")||s.startsWith("!{"))i.push({fileset:s});else{if(s.startsWith("^"))continue;this.#a[s]&&!r.has(s)?(r.add(s),i.push(...this.#v(this.#a[s],o))):i.push({fileset:s})}else i.push(s);return i}#j(t,o){const i=this.#e[o]?.root??"",r=[];for(const s of t){if(!M(s))continue;const n=q(s.fileset).replace("{projectRoot}",i).replace("{workspaceRoot}",".");n.startsWith("!")&&r.push(n.slice(1))}return r}async#_(t,o,i=[]){const r=this.#e[t.target.project]?.root??"",s=o.replace("{projectRoot}",r).replace("{workspaceRoot}",".");if(s.startsWith("!"))return{};const n=s.split("/"),d=n.findIndex(p=>/[*?[{]/.test(p)),b=d===-1?n:n.slice(0,d),m=_(this.#t,b.join("/")||"."),a=i.map(p=>_(this.#t,p)),h={},c=u(p=>a.some(l=>B(p,l)),"isExcluded");try{if(this.#i){const l=this.#i.hashFilesInDirectory(m,this.#t),g=this.#r,$=[];for(const{hash:O,path:H}of l){const w=_(this.#t,H);c(w)||(h[H]=O,this.#s.set(w,O),g&&$.push(P(w).then(S=>{S.isFile()&&g.recordSnapshot(w,O,S.mtimeMs,S.size)}).catch(()=>{})))}return $.length>0&&await Promise.all($),h}const p=(await L(m,tt)).map(async l=>{if(c(l))return;const g=await this.#y(l);g&&(h[Z(this.#t,l)]=g)});await Promise.all(p)}catch{}return h}async#y(t){const o=this.#s.get(t);if(o)return o;if(this.#r)try{const i=await P(t);if(i.isFile()){const r=this.#r.getSnapshotHash(t,i.mtimeMs,i.size);if(r)return this.#s.set(t,r),r;const s=await j(t),n=R(s);return this.#r.recordSnapshot(t,n,i.mtimeMs,i.size),this.#s.set(t,n),n}}catch{}try{const i=await j(t),r=R(i);return this.#s.set(t,r),r}catch{return}}async#b(t){try{const o=I(this.#t,"node_modules",t,"package.json"),i=await j(o,"utf8"),r=JSON.parse(i);return f(t,r.version??"unknown")}catch{return f(t,"not-installed")}}async#$(){if(this.#o!==void 0)return this.#o;const t=x();let o=!1;const i=await Promise.all(this.#f.filter(r=>!(this.#p&&et.has(r))).map(async r=>{const s=await this.#y(I(this.#t,r));return s?{hash:s,name:r}:void 0}));for(const r of i)r&&(t.update(r.name),t.update(r.hash),o=!0);for(const r of this.#l)t.update(`globalEnv:${r}=${y(r)}`),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 j(t);return R(o)}catch{return}}}const wt=u(e=>{const t=V();if(t){const i=Object.keys(e.nodes).toSorted().map(n=>[n,e.nodes[n]]),r=e.implicitDeps?Object.keys(e.implicitDeps).toSorted().map(n=>[n,e.implicitDeps[n]]):void 0,s=e.runtime?Object.keys(e.runtime).toSorted().map(n=>[n,e.runtime[n]]):void 0;return t.computeTaskHash({command:e.command,implicit_deps:r,nodes:i,runtime:s})}const o=x();return o.update(e.command),E(o,e.nodes),e.implicitDeps&&E(o,e.implicitDeps),e.runtime&&E(o,e.runtime),o.digest()},"computeTaskHash");export{yt as InProcessTaskHasher,wt as computeTaskHash};
@@ -0,0 +1 @@
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 m}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:y,createWriteStream:b}=h("node:fs"),{stat:B,mkdir:n,rename:d,rm:f,utimes:P,writeFile:$}=h("node:fs/promises"),{pipeline:v}=h("node:stream/promises");var M=Object.defineProperty,i=l((e,t)=>M(e,"name",{value:t,configurable:!0}),"s");const g=i(async(e,t)=>{try{const r=await B(u(e,t.hash));return r.isFile()&&r.size===t.sizeBytes}catch{return!1}},"containsBlob"),A=i(async(e,t,r)=>{const a=u(e,t.hash);if(await g(e,t)){await w(e,t).catch(()=>{});return}const o=await O(e,r);try{await n(m(a),{recursive:!0}),await d(o,a)}catch(s){if(await f(o,{force:!0}).catch(()=>{}),!T(s))throw s}},"putBlobFromFile"),I=i(async(e,t,r)=>{const a=u(e,t.hash);if(await g(e,t)){await w(e,t).catch(()=>{});return}const o=_(e),s=`${o}/${F()}`;await n(o,{recursive:!0}),await $(s,r);try{await n(m(a),{recursive:!0}),await d(s,a)}catch(p){if(await f(s,{force:!0}).catch(()=>{}),!T(p))throw p}},"putBlobFromBytes"),W=i(async(e,t,r)=>{const a=u(e,t.hash);try{await B(a)}catch{return!1}return await n(m(r),{recursive:!0}),await v(y(a),b(r)),await w(e,t).catch(()=>{}),!0},"fetchBlobToFile"),X=i(async(e,t)=>{const r=await q(e);return r?.hash===t.hash&&r.sizeBytes===t.sizeBytes},"verifyBlob"),w=i(async(e,t)=>{const r=new Date;await P(u(e,t.hash),r,r)},"touchBlob"),O=i(async(e,t)=>{const r=_(e),a=`${r}/${F()}`;await n(r,{recursive:!0});try{await v(y(t),b(a))}catch(o){throw await f(a,{force:!0}).catch(()=>{}),o}return a},"stageBlob"),T=i(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,w as touchBlob,X as verifyBlob};
@@ -0,0 +1 @@
1
+ var v=Object.defineProperty;var f=(t,n)=>v(t,"name",{value:n,configurable:!0});var w=Object.defineProperty,g=f((t,n)=>w(t,"name",{value:n,configurable:!0}),"i");const S=/^(\S+?):(.+)/s,y=g((t,n={})=>{const{defaultTarget:m=0,inputStream:r=process.stdin,pauseOnFinish:l=!0}=n,a=new Map,s=new Map;for(const e of t)a.set(e.index,e),e.name&&s.set(e.name,e);const o=g(e=>{const i=e.toString(),c=S.exec(i);if(c){const[,p,b]=c,d=s.get(p)??a.get(Number(p));if(d){d.stdin.write(b);return}}const u=a.get(m);u&&u.stdin.write(i)},"onData");return r.on("data",o),()=>{r.removeListener("data",o),l&&typeof r.pause=="function"&&r.pause()}},"createInputHandler");export{y as createInputHandler};
@@ -0,0 +1 @@
1
+ var C=Object.defineProperty;var j=(t,e)=>C(t,"name",{value:e,configurable:!0});import{findCycle as P}from"./findCycle-BY8-jmzB.js";var T=Object.defineProperty,d=j((t,e)=>T(t,"name",{value:e,configurable:!0}),"g");const m=d(t=>{const e=[t.project,t.target];return t.configuration&&e.push(t.configuration),e.join(":")},"getTaskId"),A=d(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"),k=d(t=>{if(t===void 0)return;const e=typeof t=="string"?[t]:t;return e.length===0?void 0:e},"normalizeWarningPattern"),v=d((t,e,o,c)=>{const a=o.projects[t],r=a?.targets?.[e],p=c?.[e],i=r?.outputs??p?.outputs??[],g=a?.root&&a.root.length>0?a.root:".";return i.map(s=>typeof s=="string"?s.replaceAll("{projectRoot}",g).replaceAll("{projectName}",t):s)},"getTaskOutputs"),f=d((t,e,o,c,a)=>{const r=c.projects[t];if(!r)return[];if(!(r.targets?.[e]!==void 0||a?.[e]!==void 0))return[];const p={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,concurrencyWeight:r.targets?.[e]?.concurrencyWeight??a?.[e]?.concurrencyWeight,hashMode:r.targets?.[e]?.hashMode??a?.[e]?.hashMode,id:m(p),maxConcurrent:r.targets?.[e]?.maxConcurrent??a?.[e]?.maxConcurrent,outputs:v(t,e,c,a),overrides:o,parallelism:r.targets?.[e]?.parallelism??a?.[e]?.parallelism,projectRoot:r.root,pty:r.targets?.[e]?.pty??a?.[e]?.pty,target:p,warningPattern:k(r.targets?.[e]?.warningPattern??a?.[e]?.warningPattern),when:r.targets?.[e]?.when??a?.[e]?.when}]},"getSameProjectTask"),W=d((t,e,o,c,a,r)=>{const p=[],i=a.dependencies[t]??[];for(const g of i){if(g.target===t||g.type==="peerDependency")continue;const s=c.projects[g.target];if(s&&(s.targets?.[e]!==void 0||r?.[e]!==void 0)){const u={project:g.target,target:e};p.push({soft:g.type==="devDependency",task:{always:s.targets?.[e]?.always??r?.[e]?.always,cache:s.targets?.[e]?.cache??r?.[e]?.cache,cacheOnWarning:s.targets?.[e]?.cacheOnWarning??r?.[e]?.cacheOnWarning,cacheRestore:s.targets?.[e]?.cacheRestore??r?.[e]?.cacheRestore,concurrencyGroup:s.targets?.[e]?.concurrencyGroup??r?.[e]?.concurrencyGroup,concurrencyWeight:s.targets?.[e]?.concurrencyWeight??r?.[e]?.concurrencyWeight,hashMode:s.targets?.[e]?.hashMode??r?.[e]?.hashMode,id:m(u),maxConcurrent:s.targets?.[e]?.maxConcurrent??r?.[e]?.maxConcurrent,outputs:v(g.target,e,c,r),overrides:o,parallelism:s.targets?.[e]?.parallelism??r?.[e]?.parallelism,projectRoot:s.root,pty:s.targets?.[e]?.pty??r?.[e]?.pty,target:u,warningPattern:k(s.targets?.[e]?.warningPattern??r?.[e]?.warningPattern),when:s.targets?.[e]?.when??r?.[e]?.when}})}}return p},"getDependencyProjectTasks"),y=d(t=>t.map(e=>({soft:!1,task:e})),"asHardDependencies"),D=d((t,e,o,c,a)=>{if(e.startsWith("^")){const r=e.slice(1);return W(t.target.project,r,{},o,c,a)}return y(f(t.target.project,e,{},o,a))},"resolveStringDependency"),G=d((t,e,o,c,a)=>{const r=[];if(e.dependencies)r.push(...W(t.target.project,e.target,e.params==="forward"?t.overrides:{},o,c,a));else if(e.projects){const p=Array.isArray(e.projects)?e.projects:[e.projects];for(const i of p)r.push(...y(f(i,e.target,e.params==="forward"?t.overrides:{},o,a)))}else r.push(...y(f(t.target.project,e.target,e.params==="forward"?t.overrides:{},o,a)));return r},"resolveConfigDependency"),R=d((t,e,o,c,a)=>typeof e=="string"?D(t,e,o,c,a):G(t,e,o,c,a),"resolveDependency"),S=d((t,e)=>{const{projectGraph:o,targetDefaults:c,workspace:a}=e,r=a.projects[t.target.project];if(!r)return[];const p=r.targets?.[t.target.target],i=c?.[t.target.target],g=p?.dependsOn??i?.dependsOn??[],s=[];for(const u of g){const n=R(t,u,a,o,c);s.push(...n)}return s},"resolveTaskDependencies"),b="\0",w=d((t,e)=>`${t}${b}${e}`,"edgeKey"),x=d((t,e,o,c,a)=>{if(o.size===0)return;const r=d((p,i)=>{const g=w(p,i);return o.has(g)&&!c.has(g)},"isSoftEdge");for(let p=o.size;p>=0;p-=1){const i=P({dependencies:e,roots:[],tasks:t});if(!i||i.length<2)return;let g=!0;for(let n=0;n<i.length-1;n+=1)if(!r(i[n],i[n+1])){g=!1;break}if(!g)return;const s=i.at(-2),u=i.at(-1);e[s]=(e[s]??[]).filter(n=>n!==u),o.delete(w(s,u)),a?.(i)}},"breakSoftOnlyCycles"),$=d((t,e)=>{const o={},c={},a=new Set,r=new Set,p=new Set,i=new Set(t.map(n=>n.id)),g=[...t];for(;g.length>0;){const n=g.shift();if(!n)break;if(p.has(n.id))continue;p.add(n.id),o[n.id]=n,c[n.id]=[];const l=S(n,e);for(const{soft:O,task:h}of l)c[n.id]?.push(h.id),(O?a:r).add(w(n.id,h.id)),!p.has(h.id)&&!i.has(h.id)&&(g.push(h),i.add(h.id))}x(o,c,a,r,e.onCycleBroken);const s=new Set;for(const n of Object.values(c))for(const l of n)s.add(l);const u=Object.keys(o).filter(n=>!s.has(n));return{dependencies:c,roots:u,tasks:o}},"createTaskGraph");export{$ as createTaskGraph,m as getTaskId,A as parseTaskId};
@@ -0,0 +1,2 @@
1
+ var v=Object.defineProperty;var I=(e,a)=>v(e,"name",{value:a,configurable:!0});import{X as w}from"./utils-BH2W5Wml.js";import{createRemoteCacheBackend as N}from"./resolveCacheMode--4y60ODd.js";import{Cache as A}from"./Cache-C8FfeXpg.js";import{inferFrameworkEnvPatterns as y}from"./detectFrameworks-WVZJOPgN.js";import{IncrementalFileHasher as L}from"./IncrementalFileHasher-B-V3i2x-.js";import{InProcessTaskHasher as P}from"./computeTaskHash-CaPdG1BA.js";import{TaskOrchestrator as b}from"./TaskOrchestrator-CYj5MLwz.js";import{TaskScheduler as H}from"./parsePartition-Bt1jBjZH.js";var G=Object.defineProperty,m=I((e,a)=>G(e,"name",{value:a,configurable:!0}),"i");const U=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"),B=m(e=>{if(!e||e.length===0)return;const a=[...e].sort().map(o=>`${o}=${process.env[o]??""}`).join(`
2
+ `);return w(Buffer.from(a)).slice(0,16)},"computeGlobalEnvNamespace"),Y=["GITHUB_*","RUNNER_*","ACTIONS_*","GH_*","CI_*","BUILDKITE_*","CIRCLECI_*","CIRCLE_*","GITLAB_*","VERCEL_GIT_*","NETLIFY_BUILD_*","COREPACK_*","VOLTA_*","NPM_CONFIG_*","YARN_*","PNPM_*","NODE_OPTIONS","NODE_PATH","NODE_REPL_HISTORY","NODE_EXTRA_CA_CERTS","LD_PRELOAD","LD_LIBRARY_PATH","DYLD_INSERT_LIBRARIES","DYLD_LIBRARY_PATH","DISPLAY","XAUTHORITY","DBUS_SESSION_BUS_ADDRESS","SSH_AUTH_SOCK","SSH_AGENT_PID","TMUX","TMUX_PANE","STY","WINDOWID","TERM_SESSION_ID","PROCESSOR_*","USERDNSDOMAIN","LOGONSERVER","USERDOMAIN_*"],j=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,R=a.namespaceByGlobalEnv?B(a.globalEnv):void 0,_=new A({cacheDirectory:a.cacheDirectory,cacheNamespace:R,maxCacheAge:a.maxCacheAge,maxCacheSize:a.maxCacheSize,workspaceRoot:n});_.removeOldEntries().catch(()=>{});const p={};for(const[r,f]of Object.entries(c.nodes))p[r]=f.data;const l=a.incrementalFileHashing?new L({workspaceRoot:n}):void 0;l&&await l.load();const d=new P({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:k,graph:u}=U(s),g=j(a.parallel),S=new H(u,c,g,a.concurrencyGroups),D=Object.values(u.tasks).some(r=>r.hashMode==="trace"),T=m(r=>{const f=c.nodes[r.target.project]?.data.targets?.[r.target.target],O=a.targetDefaults?.[r.target.target];return f?.command??O?.command},"resolveCommand"),h=a.remoteCache?N(a.remoteCache):void 0;let E=a.fingerprintEnvPatterns??[];if(a.frameworkInference&&(a.autoFingerprint||D)){const r=await y(n,p);E=[...new Set([...E,...r])]}const C=new b({alwaysTasks:k,autoFingerprint:a.autoFingerprint,bail:a.bail,cache:_,cacheDiagnostics:a.cacheDiagnostics,captureOutput:!0,dataDirectory:a.dataDirectory,dryRun:a.dryRun,fingerprintEnvPatterns:E,lifeCycle:i,onRemoteUploadError:a.remoteCache?.onUploadError,remoteCache:h,resolveCommand:T,scheduler:S,skipCache:a.skipNxCache,summarize:a.summarize,taskExecutor:t,taskGraph:u,taskHasher:d,untrackedEnvVars:[...Y,...a.untrackedEnvVars??[]],workspaceRoot:n});try{const r=await C.run();return l&&await l.save().catch(()=>{}),r}finally{h&&await h.close().catch(()=>{})}},"defaultTaskRunner");export{q as defaultTaskRunner};
@@ -0,0 +1 @@
1
+ var v=Object.defineProperty;var f=(a,e)=>v(a,"name",{value:e,configurable:!0});import{join as P}from"@visulima/path";import{E as x}from"./utils-BH2W5Wml.js";var k=Object.defineProperty,c=f((a,e)=>k(a,"name",{value:e,configurable:!0}),"i");const g=[{envPrefixes:["NEXT_PUBLIC_"],name:"Next.js",packages:["next"]},{envPrefixes:["VITE_"],name:"Vite",packages:["vite"]},{envPrefixes:["REACT_APP_"],name:"Create React App",packages:["react-scripts"]},{envPrefixes:["GATSBY_"],name:"Gatsby",packages:["gatsby"]},{envPrefixes:["NUXT_PUBLIC_"],name:"Nuxt",packages:["nuxt","nuxt3"]},{envPrefixes:["EXPO_PUBLIC_"],name:"Expo",packages:["expo"]},{envPrefixes:["REMIX_PUBLIC_"],name:"Remix",packages:["@remix-run/react","@remix-run/node"]},{envPrefixes:["PUBLIC_"],name:"Astro",packages:["astro"]},{envPrefixes:["PUBLIC_"],name:"SvelteKit",packages:["@sveltejs/kit"]},{envPrefixes:["VITE_"],name:"Solid Start",packages:["@solidjs/start","solid-start"]}],m=c(async a=>{const e=await x(a,{optional:!1,peer:!1});if(!e)return[];const s=[];for(const r of g)r.packages.some(t=>e.has(t))&&s.push({envPrefixes:r.envPrefixes,name:r.name});return s},"detectFrameworks"),d=c(async(a,e)=>{const s=new Set,r=Object.values(e).map(async t=>{const i=P(a,t.root,"package.json"),n=await m(i);for(const o of n)for(const p of o.envPrefixes)s.add(p)});return await Promise.all(r),[...s].toSorted().map(t=>`${t}*`)},"inferFrameworkEnvPatterns"),E=c(async(a,e=process.env)=>{const s=await m(a),r={};for(const t of s)for(const i of t.envPrefixes)for(const[n,o]of Object.entries(e))n.startsWith(i)&&o!==void 0&&(r[n]=o);return r},"getFrameworkEnvVariables");export{m as detectFrameworks,E as getFrameworkEnvVariables,d as inferFrameworkEnvPatterns};
@@ -0,0 +1 @@
1
+ var c=Object.defineProperty;var n=(t,e)=>c(t,"name",{value:e,configurable:!0});import{createRequire as l}from"node:module";const u=l(import.meta.url),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,p=n(t=>{if(typeof i<"u"&&i.versions&&i.versions.node){const[e,o]=i.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return i.getBuiltinModule(t)}return u(t)},"__cjs_getBuiltinModule"),{execFileSync:d}=p("node:child_process");var f=Object.defineProperty,s=n((t,e)=>f(t,"name",{value:e,configurable:!0}),"i");let r;const g=s(()=>{if(r!==void 0)return r??void 0;const t=process.env.npm_config_script_shell;if(t)return r=t,t;try{const e=d("npm",["config","get","script-shell"],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:5e3}).trim();if(e&&e!=="undefined"&&e!=="null"&&e!=="")return r=e,e}catch{}r=null},"detectScriptShell"),h=s(()=>{r=void 0},"resetShellCache");export{g as detectScriptShell,h as resetShellCache};
@@ -0,0 +1 @@
1
+ var u=Object.defineProperty;var o=(e,s)=>u(e,"name",{value:s,configurable:!0});import{createRequire as f}from"node:module";const p=f(import.meta.url),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,i=o(e=>{if(typeof r<"u"&&r.versions&&r.versions.node){const[s,t]=r.versions.node.split(".").map(Number);if(s>22||s===22&&t>=3||s===20&&t>=16)return r.getBuiltinModule(e)}return p(e)},"__cjs_getBuiltinModule"),{createHash:n}=i("node:crypto"),{createReadStream:l}=i("node:fs"),{stat:g}=i("node:fs/promises");var h=Object.defineProperty,a=o((e,s)=>h(e,"name",{value:s,configurable:!0}),"s");const y=a(e=>({hash:n("sha256").update(e).digest("hex"),sizeBytes:e.byteLength}),"digestBuffer"),b=a(async e=>{try{const{size:s}=await g(e),t=n("sha256"),c=l(e);for await(const d of c)t.update(d);return{hash:t.digest("hex"),sizeBytes:s}}catch{return}},"digestFile");export{y as digestBuffer,b as digestFile};
@@ -0,0 +1 @@
1
+ var T=Object.defineProperty;var b=(o,a)=>T(o,"name",{value:a,configurable:!0});var B=Object.defineProperty,O=b((o,a)=>B(o,"name",{value:a,configurable:!0}),"g");const A=["configuration","library","scaffolding","tool","automation","application"],D=new Set(["application","service","tool"]),w=O(o=>{if(!o)return;const a=A.indexOf(o);return a===-1?void 0:a},"layerIndex"),q=O((o,a)=>{const s=[],{dependencyKindRules:p,enforceLayerRelationships:C,tagRelationships:l,typeBoundaries:u}=a,h=l&&Object.keys(l).length>0,f=u!==void 0,j=p!==void 0,$=C===!0;if(!h&&!f&&!j&&!$)return s;const R=u?.enforceApplicationBoundary!==!1,P=u?.allowedDependencyTypes;for(const[t,v]of Object.entries(o.dependencies)){const c=o.nodes[t];if(!c)continue;const k=c.data.tags??[],y=c.type;for(const e of v){const i=o.nodes[e.target];if(!i)continue;const g=i.data.tags??[],r=i.type;let m=!1;if(f&&R&&D.has(r)&&(m=!0,s.push({dependencyProject:e.target,message:`Project "${t}" depends on "${e.target}", which is a ${r}. ${r.charAt(0).toUpperCase()+r.slice(1)}s are deployment targets and should not be depended upon by other projects.`,rule:"type-boundary",sourceProject:t})),P&&!m){const n=P[y];n&&!n.includes(r)&&s.push({dependencyProject:e.target,message:`Project "${t}" (type: ${y}) depends on "${e.target}" (type: ${r}). Allowed dependency types for "${y}" are: ${n.join(", ")}.`,rule:"type-boundary",sourceProject:t})}if(h&&l)for(const n of k){const d=l[n];!d||d.length===0||g.some(x=>d.includes(x))||s.push({dependencyProject:e.target,message:`Project "${t}" (tag: ${n}) depends on "${e.target}", which doesn't have any of the required tags: ${d.join(", ")}. ${g.length>0?`"${e.target}" has tags: ${g.join(", ")}.`:`"${e.target}" has no tags.`}`,rule:"tag-relationship",sourceProject:t})}if(j&&p&&(p.noProductionDependencyOnApplication&&e.type==="static"&&D.has(r)&&s.push({dependencyProject:e.target,message:`Project "${t}" has a production dependency on "${e.target}", which is a ${r}. Production dependencies on ${r}s are not allowed. Use devDependencies instead if needed for testing.`,rule:"dependency-kind",sourceProject:t}),p.noDevDependencyOnProductionDep&&e.type==="devDependency"&&y==="library"&&v.some(n=>n.target===e.target&&n.type==="static")&&s.push({dependencyProject:e.target,message:`Project "${t}" has "${e.target}" in both dependencies and devDependencies. This is redundant — remove it from devDependencies.`,rule:"dependency-kind",sourceProject:t})),$){const n=w(c.data.layer),d=w(i.data.layer);n!==void 0&&d!==void 0&&d>n&&s.push({dependencyProject:e.target,message:`Project "${t}" (layer: ${c.data.layer}) depends on "${e.target}" (layer: ${i.data.layer}). A "${c.data.layer}" project may only depend on projects at the same or lower layer. Hierarchy: ${A.join(" < ")}.`,rule:"layer-relationship",sourceProject:t})}}}return s},"enforceProjectConstraints");export{q as enforceProjectConstraints};
@@ -0,0 +1 @@
1
+ var c=Object.defineProperty;var s=(t,e)=>c(t,"name",{value:e,configurable:!0});import{s as o}from"./shell-quote-BhmqDUL1.js";var m=Object.defineProperty,i=s((t,e)=>m(t,"name",{value:e,configurable:!0}),"u");const l=/\\?\{([@*]|[1-9]\d*)\}/g,g=i((t,e)=>{if(e.length===0)return t;const u=t.command.replaceAll(l,(a,n)=>{if(a.startsWith("\\"))return a.slice(1);const r=Number(n);return!Number.isNaN(r)&&r<=e.length?o(e[r-1]):n==="@"?e.map(o).join(" "):n==="*"?o(e.join(" ")):""});return{...t,command:u}},"expandArguments");export{g as expandArguments};
@@ -0,0 +1 @@
1
+ var c=Object.defineProperty;var a=(e,n)=>c(e,"name",{value:n,configurable:!0});var m=Object.defineProperty,u=a((e,n)=>m(e,"name",{value:n,configurable:!0}),"m");const p=/^(npm|yarn|pnpm|bun|node|deno):(\S+)(.*)/,x=u(e=>{const n=p.exec(e.command);if(!n)return e;const[,r,t,d]=n;let o;return r==="node"?o="node --run":r==="deno"?o="deno task":o=`${r} run`,{...e,command:`${o} ${t}${d}`,name:e.name??t}},"expandShortcut");export{x as expandShortcut};
@@ -0,0 +1 @@
1
+ var m=Object.defineProperty;var l=(e,t)=>m(e,"name",{value:t,configurable:!0});import{s as f}from"./shell-quote-BhmqDUL1.js";var p=Object.defineProperty,a=l((e,t)=>p(e,"name",{value:t,configurable:!0}),"s");const u={"affected.files":"affectedFiles",changed_files:"affectedFiles"},g=/\\?\$\{\s*([\w.]+)\s*(?:\|\s*flag\s+(["'])(.*?)\2\s*)?\}/g,h=a((e,t)=>{if(e===t)return".";const n=`${t}/`;if(e.startsWith(n))return e.slice(n.length)},"rewriteForProjectRoot"),j=a((e,t)=>e.replaceAll(g,(n,d,v,o)=>{if(n.startsWith("\\"))return n.slice(1);const i=u[d];if(!i)return n;const c=t[i]??[],s=t.projectRoot?c.map(r=>h(r,t.projectRoot)).filter(r=>r!==void 0):c;return s.length===0?"":o!==void 0&&o.length>0?s.map(r=>`${o} ${f(r)}`).join(" "):s.map(f).join(" ")}),"expandTokensInString"),k=a((e,t)=>{if(!e.command.includes("${"))return e;const n=j(e.command,t);return n===e.command?e:{...e,command:n}},"expandTokens");export{k as expandTokens,j as expandTokensInString};
@@ -0,0 +1 @@
1
+ var $=Object.defineProperty;var l=(e,n)=>$(e,"name",{value:n,configurable:!0});import{createRequire as S}from"node:module";const v=S(import.meta.url),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=l(e=>{if(typeof i<"u"&&i.versions&&i.versions.node){const[n,s]=i.versions.node.split(".").map(Number);if(n>22||n===22&&s>=3||n===20&&s>=16)return i.getBuiltinModule(e)}return v(e)},"__cjs_getBuiltinModule"),{existsSync:R,readFileSync:m}=g("node:fs"),{join:j}=g("node:path");var w=Object.defineProperty,d=l((e,n)=>w(e,"name",{value:n,configurable:!0}),"i");const O=/(?:npm|yarn|pnpm|bun) run|node --run|deno task/,h=d(e=>{try{const n=m(j(e,"package.json"),"utf8");return JSON.parse(n).scripts??{}}catch{return{}}},"readPackageScripts"),T=d(e=>{const n={};for(const s of["deno.json","deno.jsonc"]){const r=j(e,s);if(R(r)){try{let t=m(r,"utf8");s.endsWith("c")&&(t=t.replaceAll(/"(?:[^"\\]|\\.)*"|\/\/[^\n]*/g,a=>a.startsWith('"')?a:""));const c=JSON.parse(t);c.tasks&&Object.assign(n,c.tasks)}catch{}break}}return{...h(e),...n}},"readDenoTasks"),W=d(e=>e.replaceAll(/[$()*+.?[\\\]^{|}]/g,String.raw`\$&`),"escapeRegExp"),N=d(e=>{const{command:n}=e,s=O.exec(n);if(!s)return e;const r=n.slice(s.index+s[0].length).trim(),t=r.split(/\s/)[0]??"";if(!t.includes("*"))return e;const c=e.cwd??process.cwd(),a=s[0]==="deno task"?T(c):h(c),x=Object.keys(a),_=t.split("*").map(W).join("(.+)"),y=new RegExp(`^${_}$`),p=/!\(([^)]+)\)/.exec(t);let u;p&&(u=new RegExp(p[1]));const f=x.filter(o=>!(!y.test(o)||u?.test(o)));if(f.length===0)return e;const b=r.slice(t.length),k=n.slice(0,s.index+s[0].length);return f.map(o=>({...e,command:`${k} ${o}${b}`,name:e.name??o}))},"expandWildcard");export{N as expandWildcard};
@@ -0,0 +1 @@
1
+ var m=Object.defineProperty;var l=(i,e)=>m(i,"name",{value:e,configurable:!0});import{createRequire as d}from"node:module";import{E as k,f as y}from"./utils-BH2W5Wml.js";import{join as u}from"@visulima/path";const h=d(import.meta.url),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,v=l(i=>{if(typeof c<"u"&&c.versions&&c.versions.node){const[e,r]=c.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return c.getBuiltinModule(i)}return h(i)},"__cjs_getBuiltinModule"),{readFile:g}=v("node:fs/promises");var _=Object.defineProperty,f=l((i,e)=>_(i,"name",{value:e,configurable:!0}),"c");const j=f(i=>{const e=/.*node_modules\/((?:@[^/]+\/)?[^/]+)/.exec(i);if(!e?.[1])return;const r=e[1];if(!r.startsWith("."))return r},"extractPackageName"),b=f(i=>{const e=new Map;try{const r=JSON.parse(i);if(r.packages)for(const[s,n]of Object.entries(r.packages)){if(!s||!n.version)continue;const t=j(s);t&&!e.has(t)&&e.set(t,n.version)}if(e.size===0&&r.dependencies)for(const[s,n]of Object.entries(r.dependencies))n.version&&e.set(s,n.version)}catch{}return e},"parseNpmLockfile"),x=f(i=>{const e=new Map,r=/^\s{4,}(\S+):\n\s+specifier:.*\n\s+version:\s*'?([^'\n(]+)/gm;let s;for(;(s=r.exec(i)??void 0)!==void 0;){const n=s[1].replaceAll(/^['"]|['"]$/g,"");let t=s[2].trim();const o=t.indexOf("(");o>0&&(t=t.slice(0,o).trim()),e.has(n)||e.set(n,t)}if(e.size===0){const n=/^\s{2}[/'"]?(?:@([^/@']+)\/)?([^@']+)@(\d[^:'"\s]*)/gm;for(;(s=n.exec(i)??void 0)!==void 0;){const t=s[1],o=t?`@${t}/${s[2]}`:s[2],a=s[3];e.has(o)||e.set(o,a)}}return e},"parsePnpmLockfile"),L=f(i=>{const e=new Map,r=/^["']?(?:@([^/@"']+)\/)?([^@"']+)@[^"'\n]+["']?:?[\t\v\f\r \u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*\n\s+version:?\s+"?([^"\n]+)"?/gm;let s;for(;(s=r.exec(i)??void 0)!==void 0;){const n=s[1],t=n?`@${n}/${s[2]}`:s[2],o=s[3].trim();e.has(t)||e.set(t,o)}return e},"parseYarnLockfile");class M{static{l(this,"v")}static{f(this,"LockfileHasher")}#s;#e;#t;constructor(e){this.#s=e}async hashForPackage(e){const r=u(this.#s,e),s=await k(r);if(!s||s.size===0)return;const n=await this.#r();if(!n)return;const t=[];for(const a of s){const p=n.get(a);p&&t.push({name:a,version:p})}if(t.length===0)return;t.sort((a,p)=>a.name.localeCompare(p.name));const o=y();for(const a of t)o.update(`${a.name}@${a.version}`);return{dependencies:t,hash:o.digest()}}get lockfileType(){return this.#t}clearCache(){this.#e=void 0,this.#t=void 0}async#r(){if(this.#e!==void 0)return this.#e.size>0?this.#e:void 0;const e=[{file:"package-lock.json",parser:b,type:"npm"},{file:"pnpm-lock.yaml",parser:x,type:"pnpm"},{file:"yarn.lock",parser:L,type:"yarn"}];for(const{file:r,parser:s,type:n}of e)try{const t=await g(u(this.#s,r),"utf8"),o=s(t);return this.#e=o,this.#t=n,o}catch{}this.#e=new Map}}export{M as LockfileHasher,j as extractPackageName,b as parseNpmLockfile,x as parsePnpmLockfile,L as parseYarnLockfile};
@@ -0,0 +1 @@
1
+ var l=Object.defineProperty;var k=(n,o)=>l(n,"name",{value:o,configurable:!0});var u=Object.defineProperty,p=k((n,o)=>u(n,"name",{value:o,configurable:!0}),"a");const y=p(n=>{const o=new Set,r=new Set,c=new Map;for(const f of Object.keys(n.tasks)){if(o.has(f))continue;const s=[f];for(;s.length>0;){const t=s.at(-1);o.has(t)||(o.add(t),r.add(t));const a=n.dependencies[t]??[];let e=!1;for(const d of a){if(r.has(d)){const i=[d];let h=t;for(;h!==d;)i.push(h),h=c.get(h)??d;return i.push(d),i.reverse(),i}if(!o.has(d)){c.set(d,t),s.push(d),e=!0;break}}e||(s.pop(),r.delete(t))}}},"findCycle"),w=p(n=>{const o=[],r=new Set,c=new Set,f=[],s=p(t=>{r.add(t),c.add(t),f.push(t);const a=n.dependencies[t]??[];for(const e of a)if(c.has(e)){const d=f.indexOf(e),i=[...f.slice(d),e];o.push(i)}else r.has(e)||s(e);f.pop(),c.delete(t)},"dfs");for(const t of Object.keys(n.tasks))r.has(t)||s(t);return o},"findCycles"),O=p((n,o)=>{const r=new Map;for(const s of Object.keys(n.tasks))r.set(s,(n.dependencies[s]??[]).length);const c=new Map;for(const[s,t]of Object.entries(n.dependencies))for(const a of t){let e=c.get(a);e||(e=[],c.set(a,e)),e.push(s)}const f=[];for(const[s,t]of r)t===0&&f.push(s);for(;f.length>0;){const s=f.shift();o(s);const t=c.get(s)??[];for(const a of t){const e=(r.get(a)??1)-1;r.set(a,e),e===0&&f.push(a)}}},"walkTaskGraph"),g=p(n=>{const o={};for(const c of Object.keys(n.tasks))o[c]=[];for(const[c,f]of Object.entries(n.dependencies))for(const s of f)o[s]?.push(c);const r=Object.keys(n.tasks).filter(c=>(o[c]?.length??0)===0);return{dependencies:o,roots:r,tasks:{...n.tasks}}},"reverseTaskGraph"),j=p(n=>Object.keys(n.tasks).filter(o=>(n.dependencies[o]?.length??0)===0),"getLeafTasks"),T=p(n=>{const o=new Set,r=new Set,c=[],f=p(e=>{o.add(e),r.add(e);const d=n.dependencies[e]??[];for(const i of d)r.has(i)?c.push({from:e,to:i}):o.has(i)||f(i);r.delete(e)},"dfs");for(const e of Object.keys(n.tasks))o.has(e)||f(e);const s={};for(const[e,d]of Object.entries(n.dependencies))s[e]=d.filter(i=>!c.some(h=>h.from===e&&h.to===i));const t=new Set;for(const e of Object.values(s))for(const d of e)t.add(d);const a=Object.keys(n.tasks).filter(e=>!t.has(e));return{dependencies:s,roots:a,tasks:{...n.tasks}}},"makeAcyclic"),v=p((n,o)=>{const r=g(n),c=[],f=new Set,s=[o];for(;s.length>0;){const t=s.shift();if(f.has(t))continue;f.add(t),t!==o&&c.push(t);const a=r.dependencies[t]??[];for(const e of a)f.has(e)||s.push(e)}return c},"getDependentTasks"),S=p((n,o)=>{const r=[],c=new Set,f=[o];for(;f.length>0;){const s=f.shift();if(c.has(s))continue;c.add(s),s!==o&&r.push(s);const t=n.dependencies[s]??[];for(const a of t)c.has(a)||f.push(a)}return r},"getTransitiveDependencies");export{y as findCycle,w as findCycles,v as getDependentTasks,j as getLeafTasks,S as getTransitiveDependencies,T as makeAcyclic,g as reverseTaskGraph,O as walkTaskGraph};
@@ -0,0 +1,7 @@
1
+ var f=Object.defineProperty;var m=(n,t)=>f(n,"name",{value:t,configurable:!0});var M=Object.defineProperty,d=m((n,t)=>M(n,"name",{value:t,configurable:!0}),"r");const s=d(n=>{if(n<1e3)return`${Math.round(n)}ms`;if(n<6e4)return`${(n/1e3).toFixed(1)}s`;const t=Math.floor(n/6e4),a=(n%6e4/1e3).toFixed(1);return`${t}m ${a}s`},"formatDuration"),E=d(n=>{if(n.length===0)return"";const t=n.toSorted((e,i)=>i.durationMs-e.durationMs),a=Math.max(4,...t.map(e=>(e.name??String(e.index)).length)),r=Math.max(8,...t.map(e=>s(e.durationMs).length)),o=Math.max(4,...t.map(e=>String(e.exitCode).length)),p=["name".padEnd(a),"duration".padEnd(r),"code".padEnd(o),"killed","command"].join(" │ "),g=["─".repeat(a),"─".repeat(r),"─".repeat(o),"─".repeat(6),"─".repeat(20)].join("─┼─"),l=t.map(e=>{const i=(e.name??String(e.index)).padEnd(a),u=s(e.durationMs).padEnd(r),c=String(e.exitCode).padEnd(o),h=(e.killed?"yes":"no").padEnd(6),x=e.command.length>40?`${e.command.slice(0,39)}…`:e.command;return[i,u,c,h,x].join(" │ ")});return[p,g,...l].join(`
2
+ `)},"formatTimingTable"),S=d((n,t=process.stdout)=>{if(n.length===0)return;const a=E(n);t.write(`
3
+ ── Timing Summary ───────────────────────────────────
4
+
5
+ `),t.write(a),t.write(`
6
+
7
+ `)},"logTimings");export{E as formatTimingTable,S as logTimings};
@@ -0,0 +1 @@
1
+ var R=Object.defineProperty;var d=(e,t)=>R(e,"name",{value:t,configurable:!0});import{createRequire as D}from"node:module";import{join as m}from"@visulima/path";import{O as j}from"./utils-BH2W5Wml.js";const b=D(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_=d(e=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[t,a]=u.versions.node.split(".").map(Number);if(t>22||t===22&&a>=3||t===20&&a>=16)return u.getBuiltinModule(e)}return b(e)},"__cjs_getBuiltinModule"),{mkdir:y,writeFile:S,readFile:O}=_("node:fs/promises");var I=Object.defineProperty,s=d((e,t)=>I(e,"name",{value:t,configurable:!0}),"s");const P=s(e=>{if(e.cacheDisabledByTask)return"disabled-by-task";if(e.selfModified)return"self-modified";if(e.emptyFingerprint)return"empty-fingerprint"},"getCacheSkipReason"),L=s(e=>{switch(e.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"),N=s((e,t,a)=>{const i=Date.now(),n=`${new Date(a).toISOString().replaceAll(/[:.]/g,"-")}_${j()}`,c=[];let l=0,h=0,f=0,g=0;for(const[o,r]of e){const w=t.dependencies[o]??[],v={cacheable:r.task.cache!==!1,cacheHints:r.cacheHints,cacheSkipReason:P(r),cacheStatus:L(r),dependencies:w,duration:r.startTime&&r.endTime?r.endTime-r.startTime:void 0,endTime:r.endTime?new Date(r.endTime).toISOString():void 0,exitCode:r.code,hash:r.task.hash,hashDetails:r.task.hashDetails,outputs:r.task.outputs,retryAttempts:r.retryAttempts,startTime:r.startTime?new Date(r.startTime).toISOString():void 0,target:{configuration:r.task.target.configuration,project:r.task.target.project,target:r.task.target.target},taskId:o};switch(c.push(v),r.status){case"failure":{h+=1;break}case"local-cache":case"local-cache-kept-existing":case"remote-cache":{f+=1;break}case"skipped":{g+=1;break}case"success":{l+=1;break}}}const T=c.toSorted((o,r)=>!o.startTime||!r.startTime?0:o.startTime.localeCompare(r.startTime));return{duration:i-a,endTime:new Date(i).toISOString(),environment:{arch:process.arch,nodeVersion:process.version,platform:process.platform},id:n,startTime:new Date(a).toISOString(),stats:{cached:f,failed:h,skipped:g,succeeded:l,total:e.size},taskGraph:{dependencies:t.dependencies,roots:t.roots},tasks:T}},"generateRunSummary"),M=".task-runner",H="last-summary.json",p=s((e,t)=>t&&t.length>0?t:m(e,M),"resolveDataDirectory"),$=s(async(e,t,a={})=>{const i=m(p(t,a.dataDirectory),"runs");await y(i,{recursive:!0});const n=`${e.id}.json`,c=m(i,n);return await S(c,JSON.stringify(e,void 0,2)),c},"writeRunSummary"),k=s((e,t={})=>m(p(e,t.dataDirectory),H),"getLastRunSummaryPath"),q=s(async(e,t,a={})=>{const i=p(t,a.dataDirectory);await y(i,{recursive:!0});const n=k(t,a);return await S(n,JSON.stringify(e,void 0,2)),n},"writeLastRunSummary"),B=s(async(e,t={})=>{try{const a=await O(k(e,t),"utf8");return JSON.parse(a)}catch{return}},"readLastRunSummary");export{N as generateRunSummary,k as getLastRunSummaryPath,B as readLastRunSummary,q as writeLastRunSummary,$ as writeRunSummary};
@@ -0,0 +1 @@
1
+ var p=Object.defineProperty;var l=(e,r)=>p(e,"name",{value:r,configurable:!0});import{createRequire as b}from"node:module";const g=b(import.meta.url),a=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,y=l(e=>{if(typeof a<"u"&&a.versions&&a.versions.node){const[r,t]=a.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return a.getBuiltinModule(e)}return g(e)},"__cjs_getBuiltinModule"),{execFileSync:_}=y("node:child_process");var $=Object.defineProperty,i=l((e,r)=>$(e,"name",{value:r,configurable:!0}),"o");const f=i(e=>e==="windows"?"win32":e,"normalisePlatform"),d=i((e,r)=>(Array.isArray(e)?e:[e]).some(t=>f(t)===f(r)),"matchPlatform"),h=i((e,r)=>r===""?!1:(Array.isArray(e)?e:[e]).includes(r),"matchBranch"),x=i((e,r)=>{if(typeof e=="string"){const o=r[e];return o!==void 0&&o!==""}const t=r[e.name];if(e.equals!==void 0)return t===e.equals;if(e.exists!==void 0){const o=t!==void 0&&t!=="";return e.exists?o:!o}return t!==void 0&&t!==""},"matchSingleEnv"),v=i((e,r)=>(Array.isArray(e)?e:[e]).some(t=>x(t,r)),"matchEnv"),A=i(e=>{const r=e.CI;return r!==void 0&&r!==""&&r!=="false"&&r!=="0"},"detectCi"),u=new Map,P=i(e=>{const r=u.get(e);if(r!==void 0)return r;try{let t=_("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:e,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim();return t==="HEAD"&&(t=""),u.set(e,t),t}catch{return u.set(e,""),""}},"getCurrentBranch"),S=i(()=>{u.clear()},"resetBranchCache"),m=i(e=>{const r=e.env??process.env;return{branch:e.branch??"",ci:e.ci??A(r),currentPlatform:e.platform??process.platform,env:r}},"resolveWhenContext"),j=i((e,r={})=>{if(!e)return!0;const{branch:t,ci:o,currentPlatform:s,env:n}=m(r);return!(e.os!==void 0&&!d(e.os,s)||e.env!==void 0&&!v(e.env,n)||e.branch!==void 0&&!h(e.branch,t)||e.ci!==void 0&&e.ci!==o||e.not&&(e.not.os!==void 0&&d(e.not.os,s)||e.not.env!==void 0&&v(e.not.env,n)||e.not.branch!==void 0&&h(e.not.branch,t)||e.not.ci!==void 0&&e.not.ci===o))},"evaluateWhen"),q=i((e,r={})=>{if(!e||j(e,r))return"";const{branch:t,ci:o,currentPlatform:s,env:n}=m(r),c=[];return e.os!==void 0&&!d(e.os,s)&&c.push(`os=${s} does not match ${JSON.stringify(e.os)}`),e.env!==void 0&&!v(e.env,n)&&c.push("env clause did not match"),e.branch!==void 0&&!h(e.branch,t)&&c.push(`branch=${t||"(unknown)"} does not match ${JSON.stringify(e.branch)}`),e.ci!==void 0&&e.ci!==o&&c.push(`ci=${o} does not match required ci=${e.ci}`),e.not?.os!==void 0&&d(e.not.os,s)&&c.push(`os=${s} matches excluded ${JSON.stringify(e.not.os)}`),e.not?.env!==void 0&&v(e.not.env,n)&&c.push("env clause matches excluded matcher"),e.not?.branch!==void 0&&h(e.not.branch,t)&&c.push(`branch=${t} matches excluded ${JSON.stringify(e.not.branch)}`),e.not?.ci!==void 0&&e.not.ci===o&&c.push(`ci=${o} matches excluded ci=${e.not.ci}`),c.join("; ")},"explainWhen");export{j as evaluateWhen,q as explainWhen,P as getCurrentBranch,S as resetBranchCache};
@@ -0,0 +1 @@
1
+ var h=Object.defineProperty;var c=(e,t)=>h(e,"name",{value:t,configurable:!0});import{createRequire as m}from"node:module";import{isAbsolute as M,resolve as g,dirname as R}from"@visulima/path";import{loadNativeBindings as L}from"./isNativeAvailable-CkTjxb7P.js";const v=m(import.meta.url),n=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,k=c(e=>{if(typeof n<"u"&&n.versions&&n.versions.node){const[t,r]=n.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return n.getBuiltinModule(e)}return v(e)},"__cjs_getBuiltinModule"),{execFileSync:y}=k("node:child_process"),{statSync:_,realpathSync:b}=k("node:fs");var j=Object.defineProperty,o=c((e,t)=>j(e,"name",{value:t,configurable:!0}),"r");let a,d=!1;const l=o(()=>{if(d)return a;d=!0;const e=L();return e&&typeof e.getMainWorktreeRoot=="function"&&typeof e.isLinkedWorktree=="function"&&(a={getMainWorktreeRoot:e.getMainWorktreeRoot,isLinkedWorktree:e.isLinkedWorktree,resetWorktreeCache:typeof e.resetWorktreeCache=="function"?e.resetWorktreeCache:()=>{}}),a},"getNativeBindings"),s=new Map,f=o(e=>{try{return b(e)}catch{return e}},"canonicalize"),p=o(e=>{try{return _(g(e,".git")).isFile()}catch{return!1}},"fallbackIsLinkedWorktree"),C=o(e=>{const t=f(e);if(s.has(t))return s.get(t);let r;try{if(p(t)){const i=y("git",["rev-parse","--git-common-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();if(i.length>0){const W=M(i)?i:g(t,i),u=f(R(W));r=u===t?void 0:u}}else r=void 0}catch{r=void 0}return s.set(t,r),r},"fallbackGetMainWorktreeRoot"),T=o(e=>{const t=l();if(t){const r=t.getMainWorktreeRoot(e);return typeof r=="string"&&r.length>0?r:void 0}return C(e)},"getMainWorktreeRoot"),w=o(e=>{const t=l();return t?t.isLinkedWorktree(e):p(e)},"isLinkedWorktree"),x=o(()=>{s.clear();const e=l();e&&e.resetWorktreeCache()},"resetWorktreeCache");export{T as getMainWorktreeRoot,w as isLinkedWorktree,x as resetWorktreeCache};
@@ -0,0 +1 @@
1
+ var c=Object.defineProperty;var n=(e,t)=>c(e,"name",{value:t,configurable:!0});import{createRequire as u}from"node:module";const l=u(import.meta.url),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,d=n(e=>{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(e)}return l(e)},"__cjs_getBuiltinModule"),{createRequire:f}=d("node:module");var p=Object.defineProperty,a=n((e,t)=>p(e,"name",{value:t,configurable:!0}),"n");let o,s=!1;const v=f(import.meta.url),m=a(()=>{if(s)return o;s=!0;try{const e=v("../index.js");typeof e.hashCommand=="function"&&typeof e.hashFile=="function"&&typeof e.runConcurrent=="function"&&(o=e)}catch{o=void 0}return o},"loadNativeBindings"),b=a(()=>m()!==void 0,"isNativeAvailable");export{b as isNativeAvailable,m as loadNativeBindings};
@@ -0,0 +1 @@
1
+ var s=Object.defineProperty;var p=(o,t)=>s(o,"name",{value:t,configurable:!0});import{expandArguments as i}from"./expandArguments-D7qvc6Rp.js";import{expandShortcut as d}from"./expandShortcut-BErNHNXZ.js";import{expandTokens as f}from"./expandTokensInString-DVSFEdWu.js";import{expandTokensInString as T}from"./expandTokensInString-DVSFEdWu.js";import{expandWildcard as u}from"./expandWildcard-DE0dOOZF.js";import{stripQuotes as c}from"./stripQuotes-jkZb0CL9.js";var l=Object.defineProperty,x=p((o,t)=>l(o,"name",{value:t,configurable:!0}),"a");const h=x((o,t={})=>{const{additionalArguments:m=[],tokens:n}=t;let r=o.map(e=>typeof e=="string"?{command:e}:{...e});return r=r.map(c),r=r.map(d),r=r.flatMap(e=>{const a=u(e);return Array.isArray(a)?a:[a]}),n&&(r=r.map(e=>f(e,n))),m.length>0&&(r=r.map(e=>i(e,m))),r},"parseCommands");export{i as expandArguments,d as expandShortcut,f as expandTokens,T as expandTokensInString,u as expandWildcard,h as parseCommands,c as stripQuotes};
@@ -0,0 +1 @@
1
+ var w=Object.defineProperty;var d=(n,t)=>w(n,"name",{value:t,configurable:!0});var v=Object.defineProperty,c=d((n,t)=>v(n,"name",{value:t,configurable:!0}),"u");const g=c(n=>{switch(n){case"high":return 2;case"low":return 0;default:return 1}},"taskPriorityWeight"),O=c(n=>{const t=n??process.env.VIS_PARTITION;if(!t)return;const s=t.split("/");if(s.length!==2)throw new Error(`Invalid partition format: "${t}". Expected format: "index/total" (e.g., "1/4").`);const e=Number(s[0]),i=Number(s[1]);if(!Number.isInteger(e)||!Number.isInteger(i)||e<1||i<1)throw new Error(`Invalid partition values: "${t}". Both index and total must be positive integers.`);if(e>i)throw new Error(`Invalid partition index: ${e} exceeds total ${i}.`);return{index:e,total:i}},"parsePartition"),k=c(n=>{const t=new Map,s=new Set,e=c(i=>{if(t.has(i))return t.get(i);if(s.has(i))return 0;s.add(i);const r=n.dependencies[i]??[];let o=0;for(const a of r)a.type!=="peerDependency"&&(o=Math.max(o,e(a.target)+1));return t.set(i,o),s.delete(i),o},"calculateDepth");for(const i of Object.keys(n.nodes))e(i);return t},"calculateProjectDepths"),y=c(n=>{const t=new Map;for(const s of Object.values(n.tasks)){const e=s.maxConcurrent;if(typeof e!="number"||e<=0||!Number.isFinite(e))continue;const i=s.target.target,r=t.get(i);(r===void 0||e<r)&&t.set(i,e)}return t},"buildTargetCaps"),b=c(n=>{const t=n.concurrencyWeight;return typeof t!="number"||!Number.isInteger(t)||t<=0?1:t},"resolveWeight"),x=c(n=>{const t=new Map;if(n===void 0)return t;for(const[s,e]of Object.entries(n))typeof e=="number"&&e>0&&Number.isFinite(e)&&t.set(s,e);return t},"buildGroupCaps"),j=c((n,t,s)=>{const e=[];return t.has(n.target.target)&&e.push(`target:${n.target.target}`),n.concurrencyGroup!==void 0&&s.has(n.concurrencyGroup)&&e.push(`group:${n.concurrencyGroup}`),e},"computeTaskKeys");class I{static{d(this,"TaskScheduler")}static{c(this,"TaskScheduler")}#t;#c;#s=new Set;#e=new Set;#h;#u;#f;#n;#o;#r;#i=new Map;#a=0;#l=new Map;static partitionTasks(t,s){if(s.total<1)throw new Error(`Invalid partition total: ${s.total}. Must be at least 1.`);if(s.index<1||s.index>s.total)throw new Error(`Invalid partition index: ${s.index}. Must be between 1 and ${s.total}.`);if(t.length===0)return[];const e=[...t].toSorted((a,h)=>a.id.localeCompare(h.id)),i=Math.ceil(e.length/s.total),r=i*(s.index-1),o=s.index===s.total?e.length:i*s.index;return e.slice(r,o)}constructor(t,s,e=3,i){if(this.#t=t,this.#c=e,this.#h=Object.keys(t.tasks).length,this.#u=this.#b(),this.#f=k(s),this.#n=y(t),this.#o=x(i),this.#r=new Map,this.#n.size>0||this.#o.size>0)for(const[r,o]of Object.entries(t.tasks)){const a=j(o,this.#n,this.#o);a.length>0&&this.#r.set(r,a)}}getNextBatch(){if(this.#c-this.#a<=0&&this.#e.size>0)return[];if(this.#e.size>0){for(const a of this.#e)if(this.#t.tasks[a]?.parallelism===!1)return[]}const t=this.#p(),s=this.#g(t),e=[],i=new Map(this.#i);let r=this.#a;const o=this.#e.size===0;for(const a of s){const h=b(a),f=this.#c-r;if(!(h<=f||o&&e.length===0))continue;if(a.parallelism===!1&&e.length>0)break;const l=this.#r.get(a.id);if(!(l!==void 0&&l.some(u=>{const p=this.#d(u),m=(i.get(u)??0)+1;return p!==void 0&&m>p}))){if(l!==void 0)for(const u of l)i.set(u,(i.get(u)??0)+1);if(r+=h,e.push(a),a.parallelism===!1)break}}return e}startTask(t){if(this.#e.has(t))return;this.#e.add(t);const s=this.#t.tasks[t],e=s===void 0?1:b(s);this.#l.set(t,e),this.#a+=e;const i=this.#r.get(t);if(i!==void 0)for(const r of i)this.#i.set(r,(this.#i.get(r)??0)+1)}completeTask(t){const s=this.#e.delete(t);if(this.#s.add(t),!s)return;const e=this.#l.get(t);e!==void 0&&(this.#a-=e,this.#l.delete(t));const i=this.#r.get(t);if(i!==void 0)for(const r of i){const o=(this.#i.get(r)??0)-1;o<=0?this.#i.delete(r):this.#i.set(r,o)}}#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.#s.size===this.#h}get remainingCount(){return this.#h-this.#s.size}get runningCount(){return this.#e.size}getOrphanDependencies(){const t=new Map,{tasks:s}=this.#t;for(const[e,i]of Object.entries(this.#t.dependencies)){if(!(e in s))continue;const r=i.filter(o=>!(o in s));r.length>0&&t.set(e,r)}return t}describeStrandedTasks(){const t=[],{tasks:s}=this.#t;for(const e of Object.keys(s)){if(this.#s.has(e)||this.#e.has(e))continue;const i=(this.#t.dependencies[e]??[]).filter(r=>r in s&&!this.#s.has(r));t.push({id:e,unmetDeps:i})}return t}#p(){const t=[],{tasks:s}=this.#t;for(const[e,i]of Object.entries(s))this.#s.has(e)||this.#e.has(e)||(this.#t.dependencies[e]??[]).every(r=>this.#s.has(r)||!(r in s))&&t.push(i);return t}#g(t){return[...t].toSorted((s,e)=>{const i=g(s.priority),r=g(e.priority);if(i!==r)return r-i;const o=this.#u.get(s.id)??0,a=this.#u.get(e.id)??0;if(o!==a)return a-o;const h=this.#f.get(s.target.project)??0,f=this.#f.get(e.target.project)??0;return h!==f?f-h:s.id.localeCompare(e.id)})}#b(){const t=new Map;for(const s of Object.keys(this.#t.tasks))t.set(s,0);for(const s of Object.values(this.#t.dependencies))for(const e of s)t.set(e,(t.get(e)??0)+1);return t}}export{I as TaskScheduler,O as parsePartition};