@visulima/task-runner 1.0.0-alpha.10 → 1.0.0-alpha.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/task-runner",
3
- "version": "1.0.0-alpha.10",
3
+ "version": "1.0.0-alpha.11",
4
4
  "description": "A task runner with caching support for monorepo workspaces",
5
5
  "keywords": [
6
6
  "cache",
@@ -70,14 +70,14 @@
70
70
  }
71
71
  },
72
72
  "optionalDependencies": {
73
- "@visulima/task-runner-binding-darwin-arm64": "1.0.0-alpha.10",
74
- "@visulima/task-runner-binding-linux-arm64-gnu": "1.0.0-alpha.10",
75
- "@visulima/task-runner-binding-linux-arm64-musl": "1.0.0-alpha.10",
76
- "@visulima/task-runner-binding-linux-x64-gnu": "1.0.0-alpha.10",
77
- "@visulima/task-runner-binding-darwin-x64": "1.0.0-alpha.10",
78
- "@visulima/task-runner-binding-win32-arm64-msvc": "1.0.0-alpha.10",
79
- "@visulima/task-runner-binding-linux-x64-musl": "1.0.0-alpha.10",
80
- "@visulima/task-runner-binding-win32-x64-msvc": "1.0.0-alpha.10"
73
+ "@visulima/task-runner-binding-darwin-arm64": "1.0.0-alpha.11",
74
+ "@visulima/task-runner-binding-darwin-x64": "1.0.0-alpha.11",
75
+ "@visulima/task-runner-binding-linux-arm64-gnu": "1.0.0-alpha.11",
76
+ "@visulima/task-runner-binding-linux-arm64-musl": "1.0.0-alpha.11",
77
+ "@visulima/task-runner-binding-linux-x64-gnu": "1.0.0-alpha.11",
78
+ "@visulima/task-runner-binding-win32-arm64-msvc": "1.0.0-alpha.11",
79
+ "@visulima/task-runner-binding-win32-x64-msvc": "1.0.0-alpha.11",
80
+ "@visulima/task-runner-binding-linux-x64-musl": "1.0.0-alpha.11"
81
81
  },
82
82
  "engines": {
83
83
  "node": "^22.14.0 || >=24.10.0"
@@ -1 +0,0 @@
1
- var d=Object.defineProperty;var h=(r,e)=>d(r,"name",{value:e,configurable:!0});import{createRequire as p}from"node:module";import{d as j,X as M}from"./utils-BH2W5Wml.js";import{join as z,dirname as b,relative as P}from"@visulima/path";const g=p(import.meta.url),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,v=h(r=>{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(r)}return g(r)},"__cjs_getBuiltinModule"),{readFile:u,mkdir:w,writeFile:_,stat:y}=v("node:fs/promises");var S=Object.defineProperty,k=h((r,e)=>S(r,"name",{value:e,configurable:!0}),"h");const F=new Set([".cache",".git",".task-runner-cache","coverage","dist","node_modules"]);class N{static{h(this,"v")}static{k(this,"IncrementalFileHasher")}#t;#i;#s;#e=new Map;#r=!1;constructor(e){this.#t=e.workspaceRoot,this.#i=e.ignoredDirs??F,this.#s=e.snapshotPath??z(e.workspaceRoot,"node_modules",".cache","task-runner","file-snapshot.json")}async load(){if(!this.#r&&(this.#r=!0,!!this.#s))try{const e=await u(this.#s,"utf8"),s=JSON.parse(e);for(const[i,t]of Object.entries(s))this.#e.set(i,t)}catch{}}async save(){if(!this.#s)return;const e=b(this.#s);await w(e,{recursive:!0});const s={};for(const[i,t]of this.#e)s[i]=t;await _(this.#s,JSON.stringify(s))}async hashDirectory(e){await this.load();const s={},i=await j(e,this.#i),t=64,a=[];for(let o=0;o<i.length;o+=t)a.push(i.slice(o,o+t));for(const o of a){const m=await Promise.all(o.map(async n=>{const l=await this.#o(n),f=P(this.#t,n);return{hash:l,relativePath:f}}));for(const{hash:n,relativePath:l}of m)n&&(s[l]=n)}return s}async#o(e){try{const s=await y(e);if(!s.isFile())return;const i=this.#e.get(e);if(i?.mtimeMs===s.mtimeMs&&i.size===s.size)return i.hash;const t=await u(e),a=M(t);return this.#e.set(e,{hash:a,mtimeMs:s.mtimeMs,size:s.size}),a}catch{this.#e.delete(e);return}}get snapshotSize(){return this.#e.size}clear(){this.#e.clear()}getSnapshotHash(e,s,i){const t=this.#e.get(e);if(t)return t.mtimeMs===s&&t.size===i?t.hash:void 0}recordSnapshot(e,s,i,t){this.#e.set(e,{hash:s,mtimeMs:i,size:t})}}export{N as IncrementalFileHasher};
@@ -1,2 +0,0 @@
1
- var C=Object.defineProperty;var m=(r,t)=>C(r,"name",{value:t,configurable:!0});import{j as f,v,f as D}from"./utils-BH2W5Wml.js";import{resolve as R,join as j}from"@visulima/path";import{retrieveByTaskHash as M,storeByTaskHash as F}from"./actionDigestForTaskHash-BOL4fZ9v.js";import{FingerprintManager as H}from"./FingerprintManager-CYW2EwLc.js";import{generateRunSummary as x,writeLastRunSummary as E,writeRunSummary as $}from"./generateRunSummary-ep21OCUT.js";import{computeTaskHash as I}from"./computeTaskHash-C2Iua2DL.js";import{TrackedTaskExecutor as P}from"./TrackedTaskExecutor-D3-LNT_d.js";import{getCurrentBranch as W,evaluateWhen as L,explainWhen as G}from"./getCurrentBranch-D-qoZByx.js";var N=Object.defineProperty,d=m((r,t)=>N(r,"name",{value:t,configurable:!0}),"l");const B=d(r=>{const t=D();t.update(r.commandHash);for(const s of Object.keys(r.fileHashes).toSorted())t.update(s),t.update(r.fileHashes[s]);for(const s of r.missingFiles)t.update(`missing:${s}`);for(const s of Object.keys(r.directoryListings).toSorted())t.update(`dir:${s}`),t.update(JSON.stringify(r.directoryListings[s]));for(const s of Object.keys(r.envHashes).toSorted())t.update(s),t.update(r.envHashes[s]);return t.digest()},"hashFingerprint"),O=d((r,t)=>{if(!r||r.length===0||!t)return!1;for(const s of r)try{if(new RegExp(s).test(t))return!0}catch{}return!1},"detectWarnings"),w=d(()=>{let r;return{promise:new Promise(t=>{r=t}),resolve:r}},"createDeferred");class X{static{m(this,"$")}static{d(this,"TaskOrchestrator")}#r;#i;#n;#t;#f;#a;#m;#p;#w;#e;#h;#k;#g;#d;#S;#c;#C;#D;#R;#y;#s=new Map;#j;#T;#v;#o=new Map;#u=w();#l=!1;constructor(t){this.#r=t.taskHasher,this.#i=t.cache,this.#n=t.scheduler,this.#t=t.lifeCycle,this.#f=t.taskExecutor,this.#a=t.workspaceRoot,this.#m=t.skipCache??!1,this.#p=t.captureOutput??!0,this.#w=t.autoFingerprint??!1,this.#k=t.fingerprintEnvPatterns??[],this.#g=t.untrackedEnvVars??[],this.#d=t.cacheDiagnostics??!1,this.#S=t.resolveCommand??void 0,this.#c=t.remoteCache??void 0,this.#C=t.onRemoteUploadError??void 0,this.#D=t.dryRun??!1,this.#R=t.summarize??!1,this.#y=t.taskGraph??void 0,this.#j=Date.now(),this.#T=t.alwaysTasks??[],this.#v=t.whenContext??{branch:W(t.workspaceRoot)},this.#w?(this.#e=new H(t.workspaceRoot),this.#h=new P(t.workspaceRoot)):(this.#e=void 0,this.#h=void 0)}async run(){this.#t.startCommand?.();const t=d(()=>{this.#l=!0,this.#h?.killAll()},"signalHandler");process.on("SIGINT",t),process.on("SIGTERM",t);try{await this.#x(),this.#T.length>0&&!this.#l&&await this.#H()}finally{process.removeListener("SIGINT",t),process.removeListener("SIGTERM",t),this.#t.endCommand?.()}if(this.#y&&!this.#l){const s=x(this.#s,this.#y,this.#j);await E(s,this.#a),this.#R&&await $(s,this.#a)}return this.#s}async#H(){for(const t of this.#T){this.#t.scheduleTask?.(t),this.#t.startTasks?.([t]);let s;if(this.#M(t))s=this.#F(t);else{const e=Date.now();try{s=await this.#b(t,e)}catch(i){s=f(t,i,e),this.#s.set(t.id,s)}}this.#t.endTasks?.([s]),s.terminalOutput&&this.#t.printTaskTerminalOutput?.(s.task,s.status,s.terminalOutput)}}async#x(){for(;!this.#n.isComplete()&&!this.#l;){const t=this.#n.getNextBatch();if(t.length===0){if(this.#o.size>0){await this.#u.promise,this.#u=w();continue}if(this.#n.remainingCount>0)throw new Error("Deadlock detected: tasks remain but none can be scheduled. This may indicate a circular dependency.");break}for(const s of t)this.#t.scheduleTask?.(s),this.#n.startTask(s.id);this.#t.startTasks?.(t);for(const s of t){const e=(this.#M(s)?Promise.resolve(this.#F(s)):this.#w?this.#$(s):this.#E(s)).catch(i=>{const a=f(s,i,Date.now());return this.#s.set(s.id,a),a}).then(i=>(this.#o.delete(s.id),this.#n.completeTask(s.id),this.#t.endTasks?.([i]),i.terminalOutput&&this.#t.printTaskTerminalOutput?.(i.task,i.status,i.terminalOutput),this.#u.resolve(),i));this.#o.set(s.id,e)}this.#o.size>0&&(await this.#u.promise,this.#u=w())}this.#o.size>0&&await Promise.all(this.#o.values())}async#E(t){const s=Date.now(),e=await this.#r.hashTask(t),i=I(e);if(Object.assign(t,{hash:i,hashDetails:e}),this.#D)return this.#G(t,s);if(!this.#m&&t.cache!==!1){const n=await this.#i.get(i);if(n)return this.#O(t,n,s);if(this.#c&&await M(this.#c,i,this.#i.cacheDirectory)){const h=await this.#i.get(i);if(h){const o=await this.#O(t,h,s);return o.status="remote-cache",o}}}const a=await this.#b(t,s);return a.code===0&&t.cache!==!1&&t.hash&&this.#c&&F(this.#c,t.hash,this.#i.cacheDirectory,this.#C).catch(()=>{}),a}async#$(t){const s=Date.now();if(!this.#m&&t.cache!==!1){const e=await this.#i.getByTaskId(t.id);if(e?.fingerprint&&this.#e){const i=this.#e.validateCommand(e.fingerprint,`${t.target.project}:${t.target.target}`,t.overrides);if(i)this.#d&&this.#t.printCacheMiss?.(t,this.#e.formatMissReasons([i]));else{const a=await this.#e.validate(e.fingerprint);if(!a)return this.#O(t,e,s);this.#d&&this.#t.printCacheMiss?.(t,this.#e.formatMissReasons(a))}}else this.#d&&!e&&this.#t.printCacheMiss?.(t,`Cache miss reasons:
2
- - No previous fingerprint found (first run)`)}return this.#P(t,s)}async#O(t,s,e){const i=await this.#i.restoreOutputs(s.hash,t.outputs,t.cacheRestore)?"local-cache":"local-cache-kept-existing",a={code:s.code,endTime:Date.now(),startTime:e,status:i,task:t,terminalOutput:s.terminalOutput};return this.#s.set(t.id,a),a}async#b(t,s){try{const{code:e,terminalOutput:i}=await this.#f(t,{captureOutput:this.#p,cwd:v(this.#a,t)}),a=e===0&&O(t.warningPattern,i),n={code:e,endTime:Date.now(),hadWarnings:a||void 0,startTime:s,status:e===0?"success":"failure",task:t,terminalOutput:i};this.#s.set(t.id,n);const h=a&&t.cacheOnWarning===!1;if(e===0&&t.cache!==!1&&t.hash&&!h){const o=await this.#I(t);o.length>0?(n.selfModified=!0,this.#t.printSelfModifyingSkip?.(t,o)):await this.#i.put(t.hash,i,t.outputs,e)}return n}catch(e){const i=f(t,e,s);return this.#s.set(t.id,i),i}}async#I(t){const s=t.hashDetails?.nodes;if(!s||typeof this.#r.rehashFile!="function")return[];const e=this.#r.rehashFile.bind(this.#r),i=Object.entries(s);return(await Promise.all(i.map(async([a,n])=>{const h=R(this.#a,a),o=await e(h);return o!==void 0&&o!==n?a:void 0}))).filter(a=>a!==void 0)}async#P(t,s){if(!this.#e)return this.#b(t,s);const e=`${t.target.project}:${t.target.target}`,i=v(this.#a,t);try{let a,n,h,o=0,k=!1,g;const y=this.#S?.(t);if(y&&this.#h?.isTrackingSupported&&this.#h){const c=await this.#h.execute(t,{captureOutput:this.#p,cwd:i},y);a=c.code,n=c.terminalOutput,o=c.accesses.length,k=!0,g=c.accesses.filter(u=>u.type==="write").map(u=>u.path),h=await this.#e.createFingerprint(c.accesses,e,t.overrides,process.env,this.#k,this.#g)}else{const c=await this.#f(t,{captureOutput:this.#p,cwd:i});a=c.code,n=c.terminalOutput;const u=await this.#r.hashTask(t),p=Object.keys(u.nodes).map(S=>({path:j(this.#a,S),type:"read"}));h=await this.#e.createFingerprint(p,e,t.overrides,process.env,this.#k,this.#g)}const T=a===0&&O(t.warningPattern,n),l={code:a,endTime:Date.now(),hadWarnings:T||void 0,startTime:s,status:a===0?"success":"failure",task:t,terminalOutput:n};this.#s.set(t.id,l);const b=T&&t.cacheOnWarning===!1;if(a===0&&t.cache!==!1&&h&&!b){const c=this.#W(h),u=this.#L(h,k,o);if(c.length>0)l.selfModified=!0,this.#t.printSelfModifyingSkip?.(t,c);else if(u)l.emptyFingerprint=!0,this.#t.printEmptyFingerprintWarning?.(t,u);else{const p=B(h);Object.assign(t,{hash:p}),await this.#i.put(p,n,t.outputs,a,h,g),await this.#i.setTaskIndex(t.id,p)}}return l}catch(a){const n=f(t,a,s);return this.#s.set(t.id,n),n}}#W(t){return t.modifiedInputs??[]}#L(t,s,e){return!s||Object.keys(t.fileHashes).length>0||Object.keys(t.directoryListings).length>0||t.missingFiles.length>0?void 0:e===0?"Tracker observed no workspace file accesses — likely a static binary on a platform without strace. Caching skipped.":"Tracker returned accesses but none fell inside the workspace. Caching skipped to avoid false cache hits."}#G(t,s){const e=t.hash?`[hash: ${t.hash.slice(0,12)}...]`:"[no hash]",i={code:0,endTime:Date.now(),startTime:s,status:"skipped",task:t,terminalOutput:`DRY RUN ${e}`};return this.#s.set(t.id,i),i}#M(t){return t.when?!L(t.when,this.#v):!1}#F(t){const s=G(t.when,this.#v),e=Date.now();this.#t.printWhenSkip?.(t,s);const i={code:0,endTime:e,startTime:e,status:"skipped",task:t,terminalOutput:s?`Skipped: ${s}`:"Skipped by when clause"};return this.#s.set(t.id,i),i}}export{X as TaskOrchestrator};
@@ -1 +0,0 @@
1
- var T=Object.defineProperty;var k=(e,t)=>T(e,"name",{value:t,configurable:!0});import{createRequire as M}from"node:module";import{b as u,h as N,f as I,d as V,X as $}from"./utils-BH2W5Wml.js";import{join as b,resolve as y,relative as q}from"@visulima/path";import{getFrameworkEnvVariables as B}from"./detectFrameworks-WVZJOPgN.js";import{LockfileHasher as C}from"./extractPackageName-BeL6Gc3a.js";import{loadNativeBindings as L}from"./isNativeAvailable-BOavFPX1.js";import{looksLikeInputUri as U,parseInputUri as X}from"./INPUT_URI_SCHEMES-Csrd0tlg.js";const W=M(import.meta.url),d=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,E=k(e=>{if(typeof d<"u"&&d.versions&&d.versions.node){const[t,o]=d.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return d.getBuiltinModule(e)}return W(e)},"__cjs_getBuiltinModule"),{execFile:z}=E("node:child_process"),{stat:P,readFile:w}=E("node:fs/promises");var Z=Object.defineProperty,p=k((e,t)=>Z(e,"name",{value:t,configurable:!0}),"u");const A=["package-lock.json","pnpm-lock.yaml","yarn.lock","tsconfig.base.json","tsconfig.json",".env"],J=new Set([".git","coverage","dist","node_modules"]),G=new Set(["package-lock.json","pnpm-lock.yaml","yarn.lock"]);let R;const H=p(()=>(R===void 0&&(R=L()),R),"getNativeBindings"),S=p((e,t,o)=>{for(const s of Object.keys(t).toSorted())o?e.update(`${o}${s}\0`):e.update(`${s}\0`),e.update(t[s])},"hashSortedEntries"),K=p(e=>{if(e==="node -v"||e==="node --version")return Promise.resolve(process.version);const t=e.split(/\s+/),o=t[0],s=t.slice(1);return new Promise(i=>{z(o,s,{timeout:1e4},(r,a)=>{i(r?`__runtime_error__:${e}`:a.trim())})})},"executeRuntimeCommand"),F=new Map,Q=p(async e=>{let t=F.get(e);return t===void 0&&(t=await K(e),F.set(e,t)),u(e,t)},"hashRuntimeValue"),Y=new Set(["0","!","#","$","*","-","?","@","_"]),tt=p(e=>{const t=new Set,o=/\$(?:\{([^}]+)\}|([A-Z_]\w*))/gi;let s;for(;(s=o.exec(e))!==null;){const i=s[1]??s[2];if(!i)continue;const r=i.split(/[#%:/?+\-=,^]/)[0]?.trim();!r||Y.has(r)||/^\d+$/.test(r)||/^[A-Z_]\w*$/i.test(r)&&t.add(r)}return[...t]},"extractReferencedEnvVars"),O=p(e=>"fileset"in e,"isFileSetInput"),x=p(e=>{if(typeof e=="string")return e;const t=e.base==="workspace"?"{workspaceRoot}":"{projectRoot}";return e.pattern.startsWith("!")?`!${t}/${e.pattern.slice(1)}`:`${t}/${e.pattern}`},"normalizeFileset"),et=p(e=>"runtime"in e,"isRuntimeInput"),st=p(e=>"env"in e,"isEnvironmentInput"),it=p(e=>"externalDependencies"in e,"isExternalDependencyInput");class ut{static{k(this,"tt")}static{p(this,"InProcessTaskHasher")}#t;#e;#a;#c;#p;#l;#u;#s=new Map;#i;#h;#n;#f;#m;#r;#o=void 0;constructor(t){this.#t=t.workspaceRoot,this.#e=t.projects,this.#a=t.namedInputs??{},this.#c=t.targetDefaults??{},this.#p=t.envVars??[],this.#l=t.globalInputs??A,this.#u=t.globalEnv??[],this.#i=H(),this.#h=t.smartLockfileHashing??!1,this.#n=this.#h?new C(t.workspaceRoot):void 0,this.#f=t.frameworkInference??!1,this.#m=t.autoEnvVars??!1,this.#r=t.incrementalHasher}async hashTask(t){const o=this.#v(t),s={},i={},r={},a=await this.#$();a&&(i.__global__=a);const g=this.#w(t),f=this.#y(g,t.target.project);for(const n of g)if(O(n)){const h=await this.#j(t,x(n.fileset),f);for(const[c,l]of Object.entries(h))s[c]=l}else if(et(n))r[n.runtime]=await Q(n.runtime);else if(st(n))r[`env:${n.env}`]=u(n.env,process.env[n.env]??"");else if(it(n)){const h=await Promise.all(n.externalDependencies.map(async c=>[c,await this.#_(c)]));for(const[c,l]of h)i[c]=l}for(const n of this.#p)r[`env:${n}`]=u(n,process.env[n]??"");if(this.#m){const n=this.#k(t);if(n)for(const h of tt(n)){const c=`env:${h}`;r[c]===void 0&&(r[c]=u(h,process.env[h]??""))}}const m=this.#e[t.target.project];if(m){if(this.#n){const n=await this.#n.hashForPackage(b(m.root,"package.json"));n&&(i.__lockfile__=n.hash)}if(this.#f){const n=y(this.#t,m.root,"package.json"),h=await B(n);for(const c of Object.keys(h))r[`framework-env:${c}`]=u(c,process.env[c]??"")}}return{command:o,implicitDeps:Object.keys(i).length>0?i:void 0,nodes:s,runtime:Object.keys(r).length>0?r:void 0}}#v(t){const o=JSON.stringify(N(t.overrides));if(this.#i)return this.#i.hashCommand(t.target.project,t.target.target,t.target.configuration??void 0,o);const s=I();return s.update(t.target.project),s.update(t.target.target),t.target.configuration&&s.update(t.target.configuration),s.update(o),s.digest()}#k(t){const o=t.overrides.command;if(typeof o=="string")return o;const s=this.#e[t.target.project]?.targets?.[t.target.target]?.command??this.#c[t.target.target]?.command;return typeof s=="string"?s:void 0}#w(t){const o=this.#e[t.target.project]?.targets?.[t.target.target],s=this.#c[t.target.target],i=o?.inputs??s?.inputs;return i?this.#d(i,t.target.project):[{fileset:"{projectRoot}/**/*"}]}#d(t,o){const s=[],i=new Set;for(const r of t)if(typeof r=="string")if(U(r)){const a=X(r);a&&s.push(a)}else if(r.startsWith("{")||r.startsWith("!{"))s.push({fileset:r});else{if(r.startsWith("^"))continue;this.#a[r]&&!i.has(r)?(i.add(r),s.push(...this.#d(this.#a[r],o))):s.push({fileset:r})}else s.push(r);return s}#y(t,o){const s=this.#e[o]?.root??"",i=[];for(const r of t){if(!O(r))continue;const a=x(r.fileset).replace("{projectRoot}",s).replace("{workspaceRoot}",".");a.startsWith("!")&&i.push(a.slice(1).replace(/\/\*\*\/\*$/,"").replace(/\/\*$/,""))}return i}async#j(t,o,s=[]){const i=this.#e[t.target.project]?.root??"",r=o.replace("{projectRoot}",i).replace("{workspaceRoot}",".");if(r.startsWith("!"))return{};const a=y(this.#t,r.replace(/\/\*\*\/\*$/,"").replace(/\/\*$/,"")),g=s.map(n=>y(this.#t,n)),f={},m=p(n=>g.some(h=>n.startsWith(`${h}/`)||n===h),"isExcluded");try{if(this.#i){const h=this.#i.hashFilesInDirectory(a,this.#t),c=this.#r,l=[];for(const{hash:j,path:D}of h){const v=y(this.#t,D);m(v)||(f[D]=j,this.#s.set(v,j),c&&l.push(P(v).then(_=>{_.isFile()&&c.recordSnapshot(v,j,_.mtimeMs,_.size)}).catch(()=>{})))}return l.length>0&&await Promise.all(l),f}const n=(await V(a,J)).map(async h=>{if(m(h))return;const c=await this.#g(h);c&&(f[q(this.#t,h)]=c)});await Promise.all(n)}catch{}return f}async#g(t){const o=this.#s.get(t);if(o)return o;if(this.#r)try{const s=await P(t);if(s.isFile()){const i=this.#r.getSnapshotHash(t,s.mtimeMs,s.size);if(i)return this.#s.set(t,i),i;const r=await w(t),a=$(r);return this.#r.recordSnapshot(t,a,s.mtimeMs,s.size),this.#s.set(t,a),a}}catch{}try{const s=await w(t),i=$(s);return this.#s.set(t,i),i}catch{return}}async#_(t){try{const o=b(this.#t,"node_modules",t,"package.json"),s=await w(o,"utf8"),i=JSON.parse(s);return u(t,i.version??"unknown")}catch{return u(t,"not-installed")}}async#$(){if(this.#o!==void 0)return this.#o;const t=I();let o=!1;const s=await Promise.all(this.#l.filter(i=>!(this.#h&&G.has(i))).map(async i=>{const r=await this.#g(b(this.#t,i));return r?{hash:r,name:i}:void 0}));for(const i of s)i&&(t.update(i.name),t.update(i.hash),o=!0);for(const i of this.#u)t.update(`globalEnv:${i}=${process.env[i]??""}`),o=!0;return this.#o=o?t.digest():"",this.#o||void 0}clearCache(){this.#s.clear(),this.#o=void 0,this.#n?.clearCache()}async rehashFile(t){try{const o=await w(t);return $(o)}catch{return}}}const ft=p(e=>{const t=H();if(t){const s=Object.keys(e.nodes).toSorted().map(a=>[a,e.nodes[a]]),i=e.implicitDeps?Object.keys(e.implicitDeps).toSorted().map(a=>[a,e.implicitDeps[a]]):void 0,r=e.runtime?Object.keys(e.runtime).toSorted().map(a=>[a,e.runtime[a]]):void 0;return t.computeTaskHash({command:e.command,implicit_deps:i,nodes:s,runtime:r})}const o=I();return o.update(e.command),S(o,e.nodes),e.implicitDeps&&S(o,e.implicitDeps),e.runtime&&S(o,e.runtime),o.digest()},"computeTaskHash");export{ut as InProcessTaskHasher,ft as computeTaskHash};
@@ -1 +0,0 @@
1
- var B=Object.defineProperty;var b=(o,r)=>B(o,"name",{value:r,configurable:!0});var C=Object.defineProperty,w=b((o,r)=>C(o,"name",{value:r,configurable:!0}),"g");const O=["configuration","library","scaffolding","tool","automation","application"],D=w(o=>{if(!o)return;const r=O.indexOf(o);return r===-1?void 0:r},"layerIndex"),q=w((o,r)=>{const a=[],{dependencyKindRules:i,enforceLayerRelationships:A,tagRelationships:p,typeBoundaries:u}=r,f=p&&Object.keys(p).length>0,h=u!==void 0,j=i!==void 0,$=A===!0;if(!f&&!h&&!j&&!$)return a;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??[],l=c.type;for(const e of v){const d=o.nodes[e.target];if(!d)continue;const g=d.data.tags??[],y=d.type;let m=!1;if(h&&R&&y==="application"&&(m=!0,a.push({dependencyProject:e.target,message:`Project "${t}" depends on "${e.target}", which is an application. Applications should not be depended upon by other projects.`,rule:"type-boundary",sourceProject:t})),P&&!m){const n=P[l];n&&!n.includes(y)&&a.push({dependencyProject:e.target,message:`Project "${t}" (type: ${l}) depends on "${e.target}" (type: ${y}). Allowed dependency types for "${l}" are: ${n.join(", ")}.`,rule:"type-boundary",sourceProject:t})}if(f&&p)for(const n of k){const s=p[n];!s||s.length===0||g.some(x=>s.includes(x))||a.push({dependencyProject:e.target,message:`Project "${t}" (tag: ${n}) depends on "${e.target}", which doesn't have any of the required tags: ${s.join(", ")}. ${g.length>0?`"${e.target}" has tags: ${g.join(", ")}.`:`"${e.target}" has no tags.`}`,rule:"tag-relationship",sourceProject:t})}if(j&&i&&(i.noProductionDependencyOnApplication&&e.type==="static"&&y==="application"&&a.push({dependencyProject:e.target,message:`Project "${t}" has a production dependency on "${e.target}", which is an application. Production dependencies on applications are not allowed. Use devDependencies instead if needed for testing.`,rule:"dependency-kind",sourceProject:t}),i.noDevDependencyOnProductionDep&&e.type==="devDependency"&&l==="library"&&v.some(n=>n.target===e.target&&n.type==="static")&&a.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=D(c.data.layer),s=D(d.data.layer);n!==void 0&&s!==void 0&&s>n&&a.push({dependencyProject:e.target,message:`Project "${t}" (layer: ${c.data.layer}) depends on "${e.target}" (layer: ${d.data.layer}). A "${c.data.layer}" project may only depend on projects at the same or lower layer. Hierarchy: ${O.join(" < ")}.`,rule:"layer-relationship",sourceProject:t})}}}return a},"enforceProjectConstraints");export{q as enforceProjectConstraints};
@@ -1 +0,0 @@
1
- var v=Object.defineProperty;var m=(t,a)=>v(t,"name",{value:a,configurable:!0});import{createRequire as _}from"node:module";import{join as u}from"@visulima/path";import{O as j}from"./utils-BH2W5Wml.js";const O=_(import.meta.url),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,R=m(t=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[a,r]=o.versions.node.split(".").map(Number);if(a>22||a===22&&r>=3||a===20&&r>=16)return o.getBuiltinModule(t)}return O(t)},"__cjs_getBuiltinModule"),{mkdir:S,writeFile:f,readFile:b}=R("node:fs/promises");var D=Object.defineProperty,n=m((t,a)=>D(t,"name",{value:a,configurable:!0}),"n");const I=n(t=>{switch(t.status){case"local-cache":case"local-cache-kept-existing":return"HIT";case"remote-cache":return"REMOTE_HIT";case"skipped":return"SKIPPED";default:return"MISS"}},"getCacheStatus"),N=n((t,a,r)=>{const s=Date.now(),c=`${new Date(r).toISOString().replaceAll(/[:.]/g,"-")}_${j()}`,d=[];let p=0,l=0,h=0,g=0;for(const[i,e]of t){const T=a.dependencies[i]??[],w={cacheable:e.task.cache!==!1,cacheStatus:I(e),dependencies:T,duration:e.startTime&&e.endTime?e.endTime-e.startTime:void 0,endTime:e.endTime?new Date(e.endTime).toISOString():void 0,exitCode:e.code,hash:e.task.hash,hashDetails:e.task.hashDetails,outputs:e.task.outputs,startTime:e.startTime?new Date(e.startTime).toISOString():void 0,target:{configuration:e.task.target.configuration,project:e.task.target.project,target:e.task.target.target},taskId:i};switch(d.push(w),e.status){case"failure":{l+=1;break}case"local-cache":case"local-cache-kept-existing":case"remote-cache":{h+=1;break}case"skipped":{g+=1;break}case"success":{p+=1;break}}}const y=d.toSorted((i,e)=>!i.startTime||!e.startTime?0:i.startTime.localeCompare(e.startTime));return{duration:s-r,endTime:new Date(s).toISOString(),environment:{arch:process.arch,nodeVersion:process.version,platform:process.platform},id:c,startTime:new Date(r).toISOString(),stats:{cached:h,failed:l,skipped:g,succeeded:p,total:t.size},taskGraph:{dependencies:a.dependencies,roots:a.roots},tasks:y}},"generateRunSummary"),$=n(async(t,a)=>{const r=u(a,".task-runner","runs");await S(r,{recursive:!0});const s=`${t.id}.json`,c=u(r,s);return await f(c,JSON.stringify(t,void 0,2)),c},"writeRunSummary"),P="last-summary.json",k=n(t=>u(t,".task-runner",P),"getLastRunSummaryPath"),q=n(async(t,a)=>{const r=u(a,".task-runner");await S(r,{recursive:!0});const s=k(a);return await f(s,JSON.stringify(t,void 0,2)),s},"writeLastRunSummary"),C=n(async t=>{try{const a=await b(k(t),"utf8");return JSON.parse(a)}catch{return}},"readLastRunSummary");export{N as generateRunSummary,k as getLastRunSummaryPath,C as readLastRunSummary,q as writeLastRunSummary,$ as writeRunSummary};
@@ -1,3 +0,0 @@
1
- var b=Object.defineProperty;var S=(s,e)=>b(s,"name",{value:e,configurable:!0});import{createRequire as M}from"node:module";import{spawn as F}from"@lydell/node-pty";const I=M(import.meta.url),T=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,P=S(s=>{if(typeof T<"u"&&T.versions&&T.versions.node){const[e,l]=T.versions.node.split(".").map(Number);if(e>22||e===22&&l>=3||e===20&&l>=16)return T.getBuiltinModule(s)}return I(s)},"__cjs_getBuiltinModule"),{spawn:_}=P("node:child_process");var L=Object.defineProperty,a=S((s,e)=>L(s,"name",{value:e,configurable:!0}),"d");const j=a((s,e)=>{if(s.length===0)return!0;const l=e.trim().toLowerCase();if(l==="first")return s[0].exitCode===0;if(l==="last")return s.at(-1).exitCode===0;const m=/^(!?)command-(.+)$/.exec(l);if(m){const[,v,C]=m,g=v==="!",u=s.filter(t=>t.name===C||String(t.index)===C);return g?s.filter(t=>!u.includes(t)).every(t=>t.exitCode===0):u.length>0&&u.every(t=>t.exitCode===0)}return s.every(v=>v.exitCode===0)},"evaluateSuccess"),E=a((s,e)=>{try{process.platform==="win32"?_("taskkill",["/F","/T","/PID",String(s)],{stdio:"ignore"}):process.kill(-s,e)}catch{}},"killTree"),G=a((s,e,l,m,v)=>{const C=process.hrtime(),g=e.shell!==!1,u=e.stdin??"null",t=u==="inherit"?"inherit":u==="pipe"?"pipe":"ignore";let o;if(g){let i,c,x=!1;l?(i=l,c=["-c",e.command]):process.platform==="win32"?(i="cmd.exe",c=["/s","/c",`"${e.command}"`],x=!0):(i="/bin/sh",c=["-c",e.command]),o=_(i,c,{cwd:e.cwd,detached:process.platform!=="win32",env:{...process.env,...e.env,FORCE_COLOR:process.env.FORCE_COLOR??"1"},stdio:[t,"pipe","pipe"],windowsVerbatimArguments:x})}else{const i=e.command.split(/\s+/),c=i[0],x=i.slice(1);o=_(c,x,{cwd:e.cwd,detached:process.platform!=="win32",env:{...process.env,...e.env,FORCE_COLOR:process.env.FORCE_COLOR??"1"},stdio:[t,"pipe","pipe"]})}m({index:s,kill:o.pid?i=>{E(o.pid,i??"SIGTERM")}:void 0,kind:"started",write:o.stdin?i=>o.stdin.write(i):void 0});let d="",n;const k=a(()=>{d&&(m({index:s,kind:"stdout",text:d}),d="")},"flushStdoutBuffer");o.stdout?.on("data",i=>{n&&(clearTimeout(n),n=void 0),d+=i.toString();const c=d.split(`
2
- `);d=c.pop()??"";for(const x of c)m({index:s,kind:"stdout",text:x});d&&(n=setTimeout(k,100))}),o.stdout?.on("end",()=>{n&&(clearTimeout(n),n=void 0),k()});let f="",h;const O=a(()=>{f&&(m({index:s,kind:"stderr",text:f}),f="")},"flushStderrBuffer");return o.stderr?.on("data",i=>{h&&(clearTimeout(h),h=void 0),f+=i.toString();const c=f.split(`
3
- `);f=c.pop()??"";for(const x of c)m({index:s,kind:"stderr",text:x});f&&(h=setTimeout(O,100))}),o.stderr?.on("end",()=>{h&&(clearTimeout(h),h=void 0),O()}),o.on("error",i=>{m({index:s,kind:"error",message:i.message})}),o.on("close",(i,c)=>{n&&(clearTimeout(n),n=void 0),h&&(clearTimeout(h),h=void 0),k(),O();const x=process.hrtime(C),y=x[0]*1e3+x[1]/1e6,r=i??(c?1:-1),p={command:e.command,durationMs:y,exitCode:r,index:s,killed:c!==null,name:e.name};m({commandName:e.name,durationMs:y,exitCode:r,index:s,killed:c!==null,kind:"close"}),v(p)}),{child:o,index:s,startTime:C}},"spawnCommand"),z=a((s,e,l,m,v)=>{const C=process.hrtime();let g,u;l?(g=l,u=["-c",e.command]):process.platform==="win32"?(g="cmd.exe",u=["/s","/c",e.command]):(g="/bin/sh",u=["-c",e.command]);const t=F(g,u,{cols:e.ptySize?.cols??80,cwd:e.cwd??process.cwd(),env:Object.fromEntries(Object.entries({...process.env,...e.env,FORCE_COLOR:process.env.FORCE_COLOR??"1",TERM:"xterm-256color"}).filter(o=>typeof o[1]=="string")),name:"xterm-256color",rows:e.ptySize?.rows??24});return m({index:s,kill:a(o=>{t.kill(o)},"kill"),kind:"started",resize:a((o,d)=>{t.resize(o,d)},"resize"),write:a(o=>{t.write(o)},"write")}),t.onData(o=>{m({index:s,kind:"stdout",text:o})}),t.onExit(({exitCode:o,signal:d})=>{const n=process.hrtime(C),k=n[0]*1e3+n[1]/1e6,f=o??(d?1:-1),h={command:e.command,durationMs:k,exitCode:f,index:s,killed:d!==void 0&&d!==0,name:e.name};m({commandName:e.name,durationMs:k,exitCode:f,index:s,killed:d!==void 0&&d!==0,kind:"close"}),v(h)}),{index:s,pty:t,startTime:C}},"spawnCommandPty"),$=a((s,e)=>new Promise(l=>{if(s.length===0){l({closeEvents:[],success:!0});return}const m=e.maxProcesses&&e.maxProcesses>0?e.maxProcesses:s.length,v=e.killSignal??"SIGTERM",C=e.killOthers??[],g=e.successCondition??"all",u=e.onEvent??(()=>{}),t=[],o=[],d=s.map((r,p)=>p);let n=!1,k=!1;const f=a(()=>{for(const r of t)r.pty?r.pty.kill(v):r.child?.pid&&E(r.child.pid,v)},"killAll"),h=a(r=>{for(const p of C)if(p==="failure"&&r.exitCode!==0||p==="success"&&r.exitCode===0)return!0;return!1},"shouldKillOthers"),O=a((r,p)=>{const R=t.findIndex(w=>w.index===r);if(R!==-1&&t.splice(R,1),n&&(p.killed=!0,k&&(p.exitCode=0)),o.push(p),!n&&h(p)&&(n=!0,f()),n||i(),t.length===0&&d.length===0){const w=j(o,g);l({closeEvents:o,success:w})}},"handleClose"),i=a(()=>{for(;t.length<m&&d.length>0;){const r=d.shift(),p=s[r],R=p.stdin==="pty"?z(r,p,e.shellPath,u,w=>{O(r,w)}):G(r,p,e.shellPath,u,w=>{O(r,w)});t.push(R)}},"maybeSpawnMore"),c=a(()=>{n||(n=!0,k=!0,f())},"handleSigint"),x=a(()=>{n||(n=!0,f())},"handleSigterm");process.on("SIGINT",c),process.on("SIGTERM",x);const y=l;l=a((r=>{process.removeListener("SIGINT",c),process.removeListener("SIGTERM",x),y(r)}),"resolve"),i()}),"runConcurrentFallback");export{$ as runConcurrentFallback};
@@ -1 +0,0 @@
1
- var d=Object.defineProperty;var l=(e,t)=>d(e,"name",{value:t,configurable:!0});import{runConcurrentFallback as u}from"./runConcurrentFallback-CShJ7HUp.js";import{detectScriptShell as h}from"./detectScriptShell-CaTDk5cW.js";import{logTimings as p}from"./formatTimingTable-CP3rsDwf.js";import{withRestart as w}from"./withRestart-CWO6BKv_.js";import{runTeardown as f}from"./runTeardown-DBBpBAyb.js";import{loadNativeBindings as g}from"./isNativeAvailable-BOavFPX1.js";var v=Object.defineProperty,n=l((e,t)=>v(e,"name",{value:t,configurable:!0}),"m");const y=n(e=>e.map(t=>typeof t=="string"?{command:t}:t),"normalizeCommands"),c=n(async(e,t)=>{const o=t.shellPath??h(),r=g(),i=e.some(a=>a.stdin==="pipe"||a.stdin==="pty")||!!t.onEvent;if(r&&!i){const a={killOthers:t.killOthers,killSignal:t.killSignal,killTimeout:t.killTimeout,maxProcesses:t.maxProcesses,shellPath:o,successCondition:t.successCondition},m=e.map(s=>({command:s.command,cwd:s.cwd,env:s.env,name:s.name,shell:s.shell,stdin:s.stdin}));return r.runConcurrentBatch(m,a)}return u(e,{...t,shellPath:o})},"coreRun"),E=n(async(e,t={})=>{const o=y(e);if(o.length===0)return{closeEvents:[],success:!0};let r;return t.restart&&t.restart.tries!==0?r=await w((i,a)=>c(i,a),o,t,{delay:t.restart.delay??0,tries:t.restart.tries}):r=await c(o,t),t.timings&&p(r.closeEvents),t.teardown&&t.teardown.length>0&&await f({commands:t.teardown,cwd:t.teardownCwd}),r},"runConcurrently");export{E as runConcurrently};