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

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.
@@ -0,0 +1 @@
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 k}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 P=Object.defineProperty,S=h((r,e)=>P(r,"name",{value:e,configurable:!0}),"h");const F=new Set([".cache",".git",".task-runner",".task-runner-cache",".vis","coverage","dist","node_modules"]);class N{static{h(this,"R")}static{S(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=k(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};
@@ -0,0 +1,2 @@
1
+ var S=Object.defineProperty;var m=(r,t)=>S(r,"name",{value:t,configurable:!0});import{j as f,v,f as C}from"./utils-BH2W5Wml.js";import{resolve as R,join as M}from"@visulima/path";import{retrieveByTaskHash as j,storeByTaskHash as E}from"./actionDigestForTaskHash-BOL4fZ9v.js";import{FingerprintManager as F}from"./FingerprintManager-CYW2EwLc.js";import{generateRunSummary as H,writeLastRunSummary as $,writeRunSummary as x}from"./generateRunSummary-DXhnX83W.js";import{computeTaskHash as I}from"./computeTaskHash-Xxd8v-X3.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=C();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;#h;#t;#f;#a;#m;#p;#w;#e;#n;#k;#g;#d;#S;#c;#C;#R;#M;#y;#T;#s=new Map;#j;#v;#O;#o=new Map;#u=w();#l=!1;constructor(t){this.#r=t.taskHasher,this.#i=t.cache,this.#h=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.#R=t.dryRun??!1,this.#M=t.summarize??!1,this.#y=t.dataDirectory,this.#T=t.taskGraph??void 0,this.#j=Date.now(),this.#v=t.alwaysTasks??[],this.#O=t.whenContext??{branch:W(t.workspaceRoot)},this.#w?(this.#e=new F(t.workspaceRoot),this.#n=new P(t.workspaceRoot)):(this.#e=void 0,this.#n=void 0)}async run(){this.#t.startCommand?.();const t=d(()=>{this.#l=!0,this.#n?.killAll()},"signalHandler");process.on("SIGINT",t),process.on("SIGTERM",t);try{await this.#$(),this.#v.length>0&&!this.#l&&await this.#H()}finally{process.removeListener("SIGINT",t),process.removeListener("SIGTERM",t),this.#t.endCommand?.()}if(this.#T&&!this.#l){const s=H(this.#s,this.#T,this.#j);await $(s,this.#a,{dataDirectory:this.#y}),this.#M&&await x(s,this.#a,{dataDirectory:this.#y})}return this.#s}async#H(){for(const t of this.#v){this.#t.scheduleTask?.(t),this.#t.startTasks?.([t]);let s;if(this.#E(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#$(){for(;!this.#h.isComplete()&&!this.#l;){const t=this.#h.getNextBatch();if(t.length===0){if(this.#o.size>0){await this.#u.promise,this.#u=w();continue}if(this.#h.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.#h.startTask(s.id);this.#t.startTasks?.(t);for(const s of t){const e=(this.#E(s)?Promise.resolve(this.#F(s)):this.#w?this.#I(s):this.#x(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.#h.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#x(t){const s=Date.now(),e=await this.#r.hashTask(t),i=I(e);if(Object.assign(t,{hash:i,hashDetails:e}),this.#R)return this.#N(t,s);if(!this.#m&&t.cache!==!1){const h=await this.#i.get(i);if(h)return this.#D(t,h,s);if(this.#c&&await j(this.#c,i,this.#i.cacheDirectory)){const n=await this.#i.get(i);if(n){const o=await this.#D(t,n,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&&E(this.#c,t.hash,this.#i.cacheDirectory,this.#C).catch(()=>{}),a}async#I(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.#D(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.#W(t,s)}async#D(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),h={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,h);const n=a&&t.cacheOnWarning===!1;if(e===0&&t.cache!==!1&&t.hash&&!n){const o=await this.#P(t);o.length>0?(h.selfModified=!0,this.#t.printSelfModifyingSkip?.(t,o)):await this.#i.put(t.hash,i,t.outputs,e)}return h}catch(e){const i=f(t,e,s);return this.#s.set(t.id,i),i}}async#P(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,h])=>{const n=R(this.#a,a),o=await e(n);return o!==void 0&&o!==h?a:void 0}))).filter(a=>a!==void 0)}async#W(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,h,n,o=0,k=!1,g;const y=this.#S?.(t);if(y&&this.#n?.isTrackingSupported&&this.#n){const c=await this.#n.execute(t,{captureOutput:this.#p,cwd:i},y);a=c.code,h=c.terminalOutput,o=c.accesses.length,k=!0,g=c.accesses.filter(u=>u.type==="write").map(u=>u.path),n=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,h=c.terminalOutput;const u=await this.#r.hashTask(t),p=Object.keys(u.nodes).map(b=>({path:M(this.#a,b),type:"read"}));n=await this.#e.createFingerprint(p,e,t.overrides,process.env,this.#k,this.#g)}const T=a===0&&O(t.warningPattern,h),l={code:a,endTime:Date.now(),hadWarnings:T||void 0,startTime:s,status:a===0?"success":"failure",task:t,terminalOutput:h};this.#s.set(t.id,l);const D=T&&t.cacheOnWarning===!1;if(a===0&&t.cache!==!1&&n&&!D){const c=this.#L(n),u=this.#G(n,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(n);Object.assign(t,{hash:p}),await this.#i.put(p,h,t.outputs,a,n,g),await this.#i.setTaskIndex(t.id,p)}}return l}catch(a){const h=f(t,a,s);return this.#s.set(t.id,h),h}}#L(t){return t.modifiedInputs??[]}#G(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."}#N(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}#E(t){return t.when?!L(t.when,this.#O):!1}#F(t){const s=G(t.when,this.#O),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};
@@ -0,0 +1 @@
1
+ var H=Object.defineProperty;var k=(e,t)=>H(e,"name",{value:t,configurable:!0});import{createRequire as M}from"node:module";import{b as l,h as N,f as I,d as z,X as $}from"./utils-BH2W5Wml.js";import{join as b,resolve as w,relative as C}from"@visulima/path";import{getFrameworkEnvVariables as V}from"./detectFrameworks-WVZJOPgN.js";import{LockfileHasher as B}from"./extractPackageName-BeL6Gc3a.js";import{loadNativeBindings as J}from"./isNativeAvailable-BOavFPX1.js";import{looksLikeInputUri as L,parseInputUri as U}from"./INPUT_URI_SCHEMES-Csrd0tlg.js";const W=M(import.meta.url),d=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,F=k(e=>{if(typeof d<"u"&&d.versions&&d.versions.node){const[t,o]=d.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return d.getBuiltinModule(e)}return W(e)},"__cjs_getBuiltinModule"),{execFile:q}=F("node:child_process"),{stat:E,readFile:y}=F("node:fs/promises");var X=Object.defineProperty,h=k((e,t)=>X(e,"name",{value:t,configurable:!0}),"l");const Z=["package-lock.json","pnpm-lock.yaml","yarn.lock","tsconfig.base.json","tsconfig.json",".env"],A=new Set([".git",".task-runner",".task-runner-cache",".vis","coverage","dist","node_modules"]),G=new Set(["package-lock.json","pnpm-lock.yaml","yarn.lock"]);let S;const x=h(()=>(S===void 0&&(S=J()),S),"getNativeBindings"),R=h((e,t,o)=>{for(const s of Object.keys(t).toSorted())o?e.update(`${o}${s}\0`):e.update(`${s}\0`),e.update(t[s])},"hashSortedEntries"),K=h(e=>{if(e==="node -v"||e==="node --version")return Promise.resolve(process.version);const t=e.split(/\s+/),o=t[0],s=t.slice(1);return new Promise(i=>{q(o,s,{timeout:1e4},(r,c)=>{i(r?`__runtime_error__:${e}`:c.trim())})})},"executeRuntimeCommand"),P=new Map,Q=h(async e=>{let t=P.get(e);return t===void 0&&(t=await K(e),P.set(e,t)),l(e,t)},"hashRuntimeValue"),Y=new Set(["0","!","#","$","*","-","?","@","_"]),tt=h(e=>{const t=new Set,o=/\$(?:\{([^}]+)\}|([A-Z_]\w*))/gi;let s;for(;(s=o.exec(e))!==null;){const i=s[1]??s[2];if(!i)continue;const r=i.split(/[#%:/?+\-=,^]/)[0]?.trim();!r||Y.has(r)||/^\d+$/.test(r)||/^[A-Z_]\w*$/i.test(r)&&t.add(r)}return[...t]},"extractReferencedEnvVars"),T=h(e=>"fileset"in e,"isFileSetInput"),D=h(e=>{if(typeof e=="string")return e;const t=e.base==="workspace"?"{workspaceRoot}":"{projectRoot}";return e.pattern.startsWith("!")?`!${t}/${e.pattern.slice(1)}`:`${t}/${e.pattern}`},"normalizeFileset"),et=h(e=>"runtime"in e,"isRuntimeInput"),st=h(e=>"env"in e,"isEnvironmentInput"),it=h(e=>"externalDependencies"in e,"isExternalDependencyInput");class lt{static{k(this,"tt")}static{h(this,"InProcessTaskHasher")}#t;#e;#a;#c;#u;#l;#f;#s=new Map;#i;#p;#n;#m;#d;#r;#h;#o=void 0;constructor(t){this.#t=t.workspaceRoot,this.#e=t.projects,this.#a=t.namedInputs??{},this.#c=t.targetDefaults??{},this.#u=t.envVars??[],this.#l=t.globalInputs??Z,this.#f=t.globalEnv??[],this.#i=x(),this.#p=t.smartLockfileHashing??!1,this.#n=this.#p?new B(t.workspaceRoot):void 0,this.#m=t.frameworkInference??!1,this.#d=t.autoEnvVars??!1,this.#r=t.incrementalHasher,this.#h=t.onFingerprint}async hashTask(t){const o=this.#k(t),s={},i={},r={},c=await this.#b();c&&(i.__global__=c);const g=this.#w(t),f=this.#j(g,t.target.project);for(const n of g)if(T(n)){const p=await this.#_(t,D(n.fileset),f);for(const[a,u]of Object.entries(p))s[a]=u}else if(et(n))r[n.runtime]=await Q(n.runtime);else if(st(n))r[`env:${n.env}`]=l(n.env,process.env[n.env]??"");else if(it(n)){const p=await Promise.all(n.externalDependencies.map(async a=>[a,await this.#$(a)]));for(const[a,u]of p)i[a]=u}for(const n of this.#u)r[`env:${n}`]=l(n,process.env[n]??"");if(this.#d){const n=this.#y(t);if(n)for(const p of tt(n)){const a=`env:${p}`;r[a]===void 0&&(r[a]=l(p,process.env[p]??""))}}const m=this.#e[t.target.project];if(m){if(this.#n){const n=await this.#n.hashForPackage(b(m.root,"package.json"));n&&(i.__lockfile__=n.hash)}if(this.#m){const n=w(this.#t,m.root,"package.json"),p=await V(n);for(const a of Object.keys(p))r[`framework-env:${a}`]=l(a,process.env[a]??"")}}if(this.#h){const n={},p={contribute:h((a,u)=>{if(typeof a!="string"||a.length===0)throw new TypeError(`task:fingerprint contribute() requires a non-empty string key, got ${typeof a=="string"?"''":typeof a}`);if(typeof u!="string")throw new TypeError(`task:fingerprint contribute(${JSON.stringify(a)}) requires a string value, got ${typeof u}`);n[`plugin:${a}`]=l(a,u)},"contribute")};await this.#h(t,p);for(const[a,u]of Object.entries(n))r[a]=u}return{command:o,implicitDeps:Object.keys(i).length>0?i:void 0,nodes:s,runtime:Object.keys(r).length>0?r:void 0}}#k(t){const o=JSON.stringify(N(t.overrides));if(this.#i)return this.#i.hashCommand(t.target.project,t.target.target,t.target.configuration??void 0,o);const s=I();return s.update(t.target.project),s.update(t.target.target),t.target.configuration&&s.update(t.target.configuration),s.update(o),s.digest()}#y(t){const o=t.overrides.command;if(typeof o=="string")return o;const s=this.#e[t.target.project]?.targets?.[t.target.target]?.command??this.#c[t.target.target]?.command;return typeof s=="string"?s:void 0}#w(t){const o=this.#e[t.target.project]?.targets?.[t.target.target],s=this.#c[t.target.target],i=o?.inputs??s?.inputs;return i?this.#g(i,t.target.project):[{fileset:"{projectRoot}/**/*"}]}#g(t,o){const s=[],i=new Set;for(const r of t)if(typeof r=="string")if(L(r)){const c=U(r);c&&s.push(c)}else if(r.startsWith("{")||r.startsWith("!{"))s.push({fileset:r});else{if(r.startsWith("^"))continue;this.#a[r]&&!i.has(r)?(i.add(r),s.push(...this.#g(this.#a[r],o))):s.push({fileset:r})}else s.push(r);return s}#j(t,o){const s=this.#e[o]?.root??"",i=[];for(const r of t){if(!T(r))continue;const c=D(r.fileset).replace("{projectRoot}",s).replace("{workspaceRoot}",".");c.startsWith("!")&&i.push(c.slice(1).replace(/\/\*\*\/\*$/,"").replace(/\/\*$/,""))}return i}async#_(t,o,s=[]){const i=this.#e[t.target.project]?.root??"",r=o.replace("{projectRoot}",i).replace("{workspaceRoot}",".");if(r.startsWith("!"))return{};const c=w(this.#t,r.replace(/\/\*\*\/\*$/,"").replace(/\/\*$/,"")),g=s.map(n=>w(this.#t,n)),f={},m=h(n=>g.some(p=>n.startsWith(`${p}/`)||n===p),"isExcluded");try{if(this.#i){const p=this.#i.hashFilesInDirectory(c,this.#t),a=this.#r,u=[];for(const{hash:j,path:O}of p){const v=w(this.#t,O);m(v)||(f[O]=j,this.#s.set(v,j),a&&u.push(E(v).then(_=>{_.isFile()&&a.recordSnapshot(v,j,_.mtimeMs,_.size)}).catch(()=>{})))}return u.length>0&&await Promise.all(u),f}const n=(await z(c,A)).map(async p=>{if(m(p))return;const a=await this.#v(p);a&&(f[C(this.#t,p)]=a)});await Promise.all(n)}catch{}return f}async#v(t){const o=this.#s.get(t);if(o)return o;if(this.#r)try{const s=await E(t);if(s.isFile()){const i=this.#r.getSnapshotHash(t,s.mtimeMs,s.size);if(i)return this.#s.set(t,i),i;const r=await y(t),c=$(r);return this.#r.recordSnapshot(t,c,s.mtimeMs,s.size),this.#s.set(t,c),c}}catch{}try{const s=await y(t),i=$(s);return this.#s.set(t,i),i}catch{return}}async#$(t){try{const o=b(this.#t,"node_modules",t,"package.json"),s=await y(o,"utf8"),i=JSON.parse(s);return l(t,i.version??"unknown")}catch{return l(t,"not-installed")}}async#b(){if(this.#o!==void 0)return this.#o;const t=I();let o=!1;const s=await Promise.all(this.#l.filter(i=>!(this.#p&&G.has(i))).map(async i=>{const r=await this.#v(b(this.#t,i));return r?{hash:r,name:i}:void 0}));for(const i of s)i&&(t.update(i.name),t.update(i.hash),o=!0);for(const i of this.#f)t.update(`globalEnv:${i}=${process.env[i]??""}`),o=!0;return this.#o=o?t.digest():"",this.#o||void 0}clearCache(){this.#s.clear(),this.#o=void 0,this.#n?.clearCache()}async rehashFile(t){try{const o=await y(t);return $(o)}catch{return}}}const ft=h(e=>{const t=x();if(t){const s=Object.keys(e.nodes).toSorted().map(c=>[c,e.nodes[c]]),i=e.implicitDeps?Object.keys(e.implicitDeps).toSorted().map(c=>[c,e.implicitDeps[c]]):void 0,r=e.runtime?Object.keys(e.runtime).toSorted().map(c=>[c,e.runtime[c]]):void 0;return t.computeTaskHash({command:e.command,implicit_deps:i,nodes:s,runtime:r})}const o=I();return o.update(e.command),R(o,e.nodes),e.implicitDeps&&R(o,e.implicitDeps),e.runtime&&R(o,e.runtime),o.digest()},"computeTaskHash");export{lt as InProcessTaskHasher,ft as computeTaskHash};
@@ -0,0 +1,2 @@
1
+ var x=Object.defineProperty;var k=(e,a)=>x(e,"name",{value:a,configurable:!0});import{X as D}from"./utils-BH2W5Wml.js";import{createRemoteCacheBackend as F}from"./resolveCacheMode-XhD7mg7G.js";import{Cache as I}from"./Cache-C540ZPYk.js";import{inferFrameworkEnvPatterns as j}from"./detectFrameworks-WVZJOPgN.js";import{IncrementalFileHasher as H}from"./IncrementalFileHasher-CdLXVB5F.js";import{InProcessTaskHasher as O}from"./computeTaskHash-Xxd8v-X3.js";import{TaskOrchestrator as V}from"./TaskOrchestrator-BfxyRQGb.js";import{TaskScheduler as G}from"./parsePartition-uzPNgtPp.js";var P=Object.defineProperty,m=k((e,a)=>P(e,"name",{value:a,configurable:!0}),"i");const S=m(e=>{const a=[],o={};for(const[r,n]of Object.entries(e.tasks))n.always?a.push(n):o[r]=n;if(a.length===0)return{alwaysTasks:[],graph:e};const i=new Set(a.map(r=>r.id)),c={};for(const[r,n]of Object.entries(e.dependencies))i.has(r)||(c[r]=n.filter(s=>!i.has(s)));return{alwaysTasks:a,graph:{dependencies:c,roots:e.roots.filter(r=>!i.has(r)),tasks:o}}},"partitionAlwaysTasks"),z=m(e=>{if(!e||e.length===0)return;const a=[...e].sort().map(o=>`${o}=${process.env[o]??""}`).join(`
2
+ `);return D(Buffer.from(a)).slice(0,16)},"computeGlobalEnvNamespace"),A=m(e=>typeof e=="number"?Math.max(1,e):e===!1?1:3,"resolveParallel"),J=m(async(e,a,o)=>{const{lifeCycle:i,projectGraph:c,taskExecutor:r,taskGraph:n,workspaceRoot:s}=o,v=a.namespaceByGlobalEnv?z(a.globalEnv):void 0,d=new I({cacheDirectory:a.cacheDirectory,cacheNamespace:v,maxCacheAge:a.maxCacheAge,maxCacheSize:a.maxCacheSize,workspaceRoot:s});d.removeOldEntries().catch(()=>{});const p={};for(const[t,h]of Object.entries(c.nodes))p[t]=h.data;const l=a.incrementalFileHashing?new H({workspaceRoot:s}):void 0;l&&await l.load();const w=new O({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:s}),{alwaysTasks:y,graph:g}=S(n),E=A(a.parallel),C=new G(g,c,E,a.concurrencyGroups),b=m(t=>{const h=c.nodes[t.target.project]?.data.targets?.[t.target.target],T=a.targetDefaults?.[t.target.target];return h?.command??T?.command},"resolveCommand"),u=a.remoteCache?F(a.remoteCache):void 0;let f=a.fingerprintEnvPatterns??[];if(a.frameworkInference&&a.autoFingerprint){const t=await j(s,p);f=[...new Set([...f,...t])]}const R=new V({alwaysTasks:y,autoFingerprint:a.autoFingerprint,cache:d,cacheDiagnostics:a.cacheDiagnostics,captureOutput:!0,dataDirectory:a.dataDirectory,dryRun:a.dryRun,fingerprintEnvPatterns:f,lifeCycle:i,onRemoteUploadError:a.remoteCache?.onUploadError,remoteCache:u,resolveCommand:a.autoFingerprint?b:void 0,scheduler:C,skipCache:a.skipNxCache,summarize:a.summarize,taskExecutor:r,taskGraph:g,taskHasher:w,untrackedEnvVars:a.untrackedEnvVars,workspaceRoot:s});try{const t=await R.run();return l&&await l.save().catch(()=>{}),t}finally{u&&await u.close().catch(()=>{})}},"defaultTaskRunner");export{J as defaultTaskRunner};
@@ -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 _=Object.defineProperty;var d=(t,e)=>_(t,"name",{value:e,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 R=D(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,O=d(t=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[e,r]=u.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return u.getBuiltinModule(t)}return R(t)},"__cjs_getBuiltinModule"),{mkdir:f,writeFile:y,readFile:b}=O("node:fs/promises");var I=Object.defineProperty,i=d((t,e)=>I(t,"name",{value:e,configurable:!0}),"s");const P=i(t=>{switch(t.status){case"local-cache":case"local-cache-kept-existing":return"HIT";case"remote-cache":return"REMOTE_HIT";case"skipped":return"SKIPPED";default:return"MISS"}},"getCacheStatus"),q=i((t,e,r)=>{const s=Date.now(),n=`${new Date(r).toISOString().replaceAll(/[:.]/g,"-")}_${j()}`,o=[];let p=0,g=0,h=0,S=0;for(const[c,a]of t){const w=e.dependencies[c]??[],v={cacheable:a.task.cache!==!1,cacheStatus:P(a),dependencies:w,duration:a.startTime&&a.endTime?a.endTime-a.startTime:void 0,endTime:a.endTime?new Date(a.endTime).toISOString():void 0,exitCode:a.code,hash:a.task.hash,hashDetails:a.task.hashDetails,outputs:a.task.outputs,startTime:a.startTime?new Date(a.startTime).toISOString():void 0,target:{configuration:a.task.target.configuration,project:a.task.target.project,target:a.task.target.target},taskId:c};switch(o.push(v),a.status){case"failure":{g+=1;break}case"local-cache":case"local-cache-kept-existing":case"remote-cache":{h+=1;break}case"skipped":{S+=1;break}case"success":{p+=1;break}}}const T=o.toSorted((c,a)=>!c.startTime||!a.startTime?0:c.startTime.localeCompare(a.startTime));return{duration:s-r,endTime:new Date(s).toISOString(),environment:{arch:process.arch,nodeVersion:process.version,platform:process.platform},id:n,startTime:new Date(r).toISOString(),stats:{cached:h,failed:g,skipped:S,succeeded:p,total:t.size},taskGraph:{dependencies:e.dependencies,roots:e.roots},tasks:T}},"generateRunSummary"),L=".task-runner",M="last-summary.json",l=i((t,e)=>e&&e.length>0?e:m(t,L),"resolveDataDirectory"),C=i(async(t,e,r={})=>{const s=m(l(e,r.dataDirectory),"runs");await f(s,{recursive:!0});const n=`${t.id}.json`,o=m(s,n);return await y(o,JSON.stringify(t,void 0,2)),o},"writeRunSummary"),k=i((t,e={})=>m(l(t,e.dataDirectory),M),"getLastRunSummaryPath"),J=i(async(t,e,r={})=>{const s=l(e,r.dataDirectory);await f(s,{recursive:!0});const n=k(e,r);return await y(n,JSON.stringify(t,void 0,2)),n},"writeLastRunSummary"),B=i(async(t,e={})=>{try{const r=await b(k(t,e),"utf8");return JSON.parse(r)}catch{return}},"readLastRunSummary");export{q as generateRunSummary,k as getLastRunSummaryPath,B as readLastRunSummary,J as writeLastRunSummary,C as writeRunSummary};
@@ -244,7 +244,7 @@ nodes.forEach(n => {
244
244
  });
245
245
  <\/script>
246
246
  </body>
247
- </html>`])),s.nodes.length,s.edges.length,s.roots.length,JSON.stringify(s).replaceAll("</",String.raw`<\/`))},"toGraphHtml"),O=p((e,t={})=>{const{taskStatuses:s}=t,r=[],o=Object.keys(e.tasks).length,a=Object.values(e.dependencies).reduce((n,l)=>n+l.length,0);r.push(`Task Graph (${o} tasks, ${a} dependencies)`,"");const i=new Set;for(const n of Object.values(e.dependencies))for(const l of n)i.add(l);const d=Object.keys(e.tasks).filter(n=>!i.has(n));if(d.length===0){for(const n of Object.keys(e.tasks))r.push(C(n,s));return r.join(`
247
+ </html>`])),s.nodes.length,s.edges.length,s.roots.length,JSON.stringify(s).replaceAll("</",String.raw`<\/`))},"toGraphHtml"),F=p((e,t={})=>{const{taskStatuses:s}=t,r=[],o=Object.keys(e.tasks).length,a=Object.values(e.dependencies).reduce((n,l)=>n+l.length,0);r.push(`Task Graph (${o} tasks, ${a} dependencies)`,"");const i=new Set;for(const n of Object.values(e.dependencies))for(const l of n)i.add(l);const d=Object.keys(e.tasks).filter(n=>!i.has(n));if(d.length===0){for(const n of Object.keys(e.tasks))r.push(C(n,s));return r.join(`
248
248
  `)}const c=new Set;for(const n of d)k(n,"",!0,e,c,r,s);return c.size<o&&r.push("","(*) = already shown above"),r.join(`
249
- `)},"toGraphAscii"),T=p(e=>{const t=["digraph ProjectGraph {"," rankdir=LR;",' node [shape=box, style=filled, fillcolor="#87CEEB", fontname="monospace"];'];for(const s of Object.values(e.nodes)){const r=s.type==="application"?"#FFD700":"#87CEEB";t.push(` "${s.name}" [fillcolor="${r}"];`)}for(const[s,r]of Object.entries(e.dependencies))for(const o of r){const a=[];switch(o.type){case"devDependency":{a.push("style=dotted",'color="#888888"');break}case"implicit":{a.push("style=dashed");break}case"peerDependency":{a.push("style=dashed",'color="#CC8800"');break}default:a.push("style=solid")}t.push(` "${s}" -> "${o.target}" [${a.join(", ")}];`)}return t.push("}"),t.join(`
250
- `)},"projectGraphToDot");export{T as projectGraphToDot,O as toGraphAscii,G as toGraphHtml,M as toGraphJson,S as toGraphvizDot};
249
+ `)},"toGraphAscii"),O=p(e=>{const t=["digraph ProjectGraph {"," rankdir=LR;",' node [shape=box, style=filled, fillcolor="#87CEEB", fontname="monospace"];'];for(const s of Object.values(e.nodes)){const r=s.type==="application"?"#FFD700":s.type==="service"?"#90EE90":s.type==="tool"?"#FFB347":"#87CEEB";t.push(` "${s.name}" [fillcolor="${r}"];`)}for(const[s,r]of Object.entries(e.dependencies))for(const o of r){const a=[];switch(o.type){case"devDependency":{a.push("style=dotted",'color="#888888"');break}case"implicit":{a.push("style=dashed");break}case"peerDependency":{a.push("style=dashed",'color="#CC8800"');break}default:a.push("style=solid")}t.push(` "${s}" -> "${o.target}" [${a.join(", ")}];`)}return t.push("}"),t.join(`
250
+ `)},"projectGraphToDot");export{O as projectGraphToDot,F as toGraphAscii,G as toGraphHtml,M as toGraphJson,S as toGraphvizDot};
@@ -0,0 +1,3 @@
1
+ var b=Object.defineProperty;var _=(s,e)=>b(s,"name",{value:e,configurable:!0});import{createRequire as I}from"node:module";import{spawn as L}from"@lydell/node-pty";const M=I(import.meta.url),T=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,P=_(s=>{if(typeof T<"u"&&T.versions&&T.versions.node){const[e,l]=T.versions.node.split(".").map(Number);if(e>22||e===22&&l>=3||e===20&&l>=16)return T.getBuiltinModule(s)}return M(s)},"__cjs_getBuiltinModule"),{spawn:S}=P("node:child_process");var F=Object.defineProperty,a=_((s,e)=>F(s,"name",{value:e,configurable:!0}),"d");const j=a((s,e)=>{if(s.length===0)return!0;const l=e.trim().toLowerCase();if(l==="first")return s[0].exitCode===0;if(l==="last")return s.at(-1).exitCode===0;const m=/^(!?)command-(.+)$/.exec(l);if(m){const[,v,C]=m,g=v==="!",f=s.filter(t=>t.name===C||String(t.index)===C);return g?s.filter(t=>!f.includes(t)).every(t=>t.exitCode===0):f.length>0&&f.every(t=>t.exitCode===0)}return s.every(v=>v.exitCode===0)},"evaluateSuccess"),E=a((s,e)=>{try{process.platform==="win32"?S("taskkill",["/F","/T","/PID",String(s)],{stdio:"ignore"}):process.kill(-s,e)}catch{}},"killTree"),G=a((s,e,l,m,v)=>{const C=process.hrtime(),g=e.shell!==!1,f=e.stdin??"null",t=f==="inherit"?"inherit":f==="pipe"?"pipe":"ignore";let o;if(g){let i,c,p=!1;l?(i=l,c=["-c",e.command]):process.platform==="win32"?(i="cmd.exe",c=["/s","/c",`"${e.command}"`],p=!0):(i="/bin/sh",c=["-c",e.command]),o=S(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:p})}else{const i=e.command.split(/\s+/),c=i[0],p=i.slice(1);o=S(c,p,{cwd:e.cwd,detached:process.platform!=="win32",env:{...process.env,...e.env,FORCE_COLOR:process.env.FORCE_COLOR??"1"},stdio:[t,"pipe","pipe"]})}m({index:s,kill:o.pid?i=>{E(o.pid,i??"SIGTERM")}:void 0,kind:"started",pid:o.pid,write:o.stdin?i=>o.stdin.write(i):void 0});let 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 p of c)m({index:s,kind:"stdout",text:p});d&&(n=setTimeout(k,100))}),o.stdout?.on("end",()=>{n&&(clearTimeout(n),n=void 0),k()});let x="",h;const O=a(()=>{x&&(m({index:s,kind:"stderr",text:x}),x="")},"flushStderrBuffer");return o.stderr?.on("data",i=>{h&&(clearTimeout(h),h=void 0),x+=i.toString();const c=x.split(`
3
+ `);x=c.pop()??"";for(const p of c)m({index:s,kind:"stderr",text:p});x&&(h=setTimeout(O,100))}),o.stderr?.on("end",()=>{h&&(clearTimeout(h),h=void 0),O()}),o.on("error",i=>{m({index:s,kind:"error",message:i.message})}),o.on("close",(i,c)=>{n&&(clearTimeout(n),n=void 0),h&&(clearTimeout(h),h=void 0),k(),O();const p=process.hrtime(C),y=p[0]*1e3+p[1]/1e6,r=i??(c?1:-1),u={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(u)}),{child:o,index:s,startTime:C}},"spawnCommand"),N=a((s,e,l,m,v)=>{const C=process.hrtime();let g,f;l?(g=l,f=["-c",e.command]):process.platform==="win32"?(g="cmd.exe",f=["/s","/c",e.command]):(g="/bin/sh",f=["-c",e.command]);const t=L(g,f,{cols:e.ptySize?.cols??80,cwd:e.cwd??process.cwd(),env:Object.fromEntries(Object.entries({...process.env,...e.env,FORCE_COLOR:process.env.FORCE_COLOR??"1",TERM:"xterm-256color"}).filter(o=>typeof o[1]=="string")),name:"xterm-256color",rows:e.ptySize?.rows??24});return m({index:s,kill:a(o=>{t.kill(o)},"kill"),kind:"started",pid:t.pid,resize:a((o,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,x=o??(d?1:-1),h={command:e.command,durationMs:k,exitCode:x,index:s,killed:d!==void 0&&d!==0,name:e.name};m({commandName:e.name,durationMs:k,exitCode:x,index:s,killed:d!==void 0&&d!==0,kind:"close"}),v(h)}),{index:s,pty:t,startTime:C}},"spawnCommandPty"),A=a((s,e)=>new Promise(l=>{if(s.length===0){l({closeEvents:[],success:!0});return}const m=e.maxProcesses&&e.maxProcesses>0?e.maxProcesses:s.length,v=e.killSignal??"SIGTERM",C=e.killOthers??[],g=e.successCondition??"all",f=e.onEvent??(()=>{}),t=[],o=[],d=s.map((r,u)=>u);let n=!1,k=!1;const x=a(()=>{for(const r of t)r.pty?r.pty.kill(v):r.child?.pid&&E(r.child.pid,v)},"killAll"),h=a(r=>{for(const u of C)if(u==="failure"&&r.exitCode!==0||u==="success"&&r.exitCode===0)return!0;return!1},"shouldKillOthers"),O=a((r,u)=>{const R=t.findIndex(w=>w.index===r);if(R!==-1&&t.splice(R,1),n&&(u.killed=!0,k&&(u.exitCode=0)),o.push(u),!n&&h(u)&&(n=!0,x()),n||i(),t.length===0&&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(),u=s[r],R=u.stdin==="pty"?N(r,u,e.shellPath,f,w=>{O(r,w)}):G(r,u,e.shellPath,f,w=>{O(r,w)});t.push(R)}},"maybeSpawnMore"),c=a(()=>{n||(n=!0,k=!0,x())},"handleSigint"),p=a(()=>{n||(n=!0,x())},"handleNonInteractiveAbort");process.on("SIGINT",c),process.on("SIGTERM",p),process.on("exit",p);const y=l;l=a((r=>{process.removeListener("SIGINT",c),process.removeListener("SIGTERM",p),process.removeListener("exit",p),y(r)}),"resolve"),i()}),"runConcurrentFallback");export{A as runConcurrentFallback};
@@ -0,0 +1 @@
1
+ var w=Object.defineProperty;var m=(t,e)=>w(t,"name",{value:e,configurable:!0});import{createRequire as k}from"node:module";import{runConcurrentFallback as S}from"./runConcurrentFallback-Dpqxuyv-.js";import{detectScriptShell as x}from"./detectScriptShell-CaTDk5cW.js";import{logTimings as C}from"./formatTimingTable-CP3rsDwf.js";import{withRestart as I}from"./withRestart-DKtEGsQA.js";import{runTeardown as P}from"./runTeardown-DBBpBAyb.js";import{loadNativeBindings as R}from"./isNativeAvailable-BOavFPX1.js";const T=k(import.meta.url),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,v=m(t=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[e,s]=l.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return l.getBuiltinModule(t)}return T(t)},"__cjs_getBuiltinModule"),{spawn:_}=v("node:child_process");var b=Object.defineProperty,n=m((t,e)=>b(t,"name",{value:e,configurable:!0}),"t");const c=new Set;let f=!1;const M=n((t,e)=>{try{process.platform==="win32"?_("taskkill",["/F","/T","/PID",String(t)],{stdio:"ignore"}):process.kill(-t,e)}catch{}},"killTrackedTree"),u=n(t=>{for(const e of c)M(e,t)},"killAllTracked"),j=n(()=>{f||(f=!0,process.setMaxListeners(process.getMaxListeners()+3),process.on("SIGINT",()=>{u("SIGINT")}),process.on("SIGTERM",()=>{u("SIGTERM")}),process.on("exit",()=>{u("SIGTERM")}))},"installSignalHandlersOnce"),E=n(t=>t.map(e=>typeof e=="string"?{command:e}:e),"normalizeCommands"),g=n(async(t,e)=>{const s=e.shellPath??x(),o=R(),d=t.some(i=>i.stdin==="pipe"||i.stdin==="pty")||!!e.onEvent;if(o&&!d){const i={killOthers:e.killOthers,killSignal:e.killSignal,killTimeout:e.killTimeout,maxProcesses:e.maxProcesses,shellPath:s,successCondition:e.successCondition},h=t.map(r=>({command:r.command,cwd:r.cwd,env:r.env,name:r.name,shell:r.shell,stdin:r.stdin}));j();const a=new Map,y=n(r=>{if(r!=null){if(r.kind==="started"&&typeof r.pid=="number"){c.add(r.pid),a.set(r.index,r.pid);return}if(r.kind==="close"||r.kind==="error"){const p=a.get(r.index);p!==void 0&&(c.delete(p),a.delete(r.index))}}},"onLifecycle");try{return await o.runConcurrentBatch(h,i,y)}finally{for(const r of a.values())c.delete(r)}}return S(t,{...e,shellPath:s})},"coreRun"),A=n(async(t,e={})=>{const s=E(t);if(s.length===0)return{closeEvents:[],success:!0};let o;return e.restart&&e.restart.tries!==0?o=await I((d,i)=>g(d,i),s,e,{delay:e.restart.delay??0,onRetry:e.restart.onRetry,tries:e.restart.tries}):o=await g(s,e),e.timings&&C(o.closeEvents),e.teardown&&e.teardown.length>0&&await P({commands:e.teardown,cwd:e.teardownCwd}),o},"runConcurrently");export{A as runConcurrently};
@@ -0,0 +1 @@
1
+ var y=Object.defineProperty;var l=(t,n)=>y(t,"name",{value:n,configurable:!0});var b=Object.defineProperty,d=l((t,n)=>b(t,"name",{value:n,configurable:!0}),"i");const R=d(async(t,n,a,v)=>{const{delay:p,onRetry:m,tries:r}=v;if(r===0)return t(n,a);const x=new Map,c=[],w=a.onEvent;let o=[...n],u=0;for(;o.length>0;){const i=o;o=[];const E=await t(i,{...a,onEvent:d(e=>{w?.(e)},"onEvent")});for(const e of E.closeEvents){if(e.exitCode!==0){const s=x.get(e.index)??{attempts:0,commandIndex:e.index};if(s.attempts++,x.set(e.index,s),r===-1||s.attempts<=r){m&&await m(s.attempts,e.index,e.exitCode??1);const f=p==="exponential"?Math.min(2**(s.attempts-1)*1e3,3e4):p;f>0&&await C(f),o.push(i[e.index]);continue}}c.push(e)}if(u++,u>1e3)break}const h=c.every(i=>i.exitCode===0);return{closeEvents:c,success:h}},"withRestart"),C=d(t=>new Promise(n=>{setTimeout(n,t)}),"sleep");export{R as withRestart};