@fnet/cli 1.0.16 → 1.0.18
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/dist/fbin/index.js +5 -5
- package/dist/fnet/index.js +12 -12
- package/dist/fnode/{index.hv4s25f0.js → index.1nyzphey.js} +1 -1
- package/dist/fnode/index.8c71g5r3.js +4 -0
- package/dist/fnode/index.js +8 -8
- package/dist/fnode/{index.kvedj83h.js → index.k98v9acr.js} +1 -1
- package/dist/fservice/index.bavsyt65.js +1 -0
- package/dist/fservice/index.js +8 -8
- package/dist/fservice/index.vyehyfst.js +2 -0
- package/package.json +1 -1
- package/template/fnet/node/package.json.njk +1 -0
- package/template/fnet/node/src/default/input.args.js.njk +5 -3
- package/template/fnode/node/package.json.njk +1 -0
- package/template/fnode/node/src/default/input.args.js.njk +5 -3
- package/dist/fnode/index.s0nk6cv8.js +0 -4
- package/dist/fservice/index.q01yvaz0.js +0 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as A,b,c as v,d as w}from"./index.
|
|
1
|
+
import{a as A,b,c as v,d as w}from"./index.8c71g5r3.js";import"./index.cvxrf34y.js";import K from"node:fs";import T from"node:path";import f from"node:os";async function U(I){let{atom:q,context:z,setProgress:H}=I;H("Initializing features..."),q.doc.features=q.doc.features||{};let _=q.doc.features;if(_.cli===!1)_.cli={enabled:!1};else if(_.cli===!0)_.cli={enabled:!0};else _.cli={enabled:!0};_.cli.enabled=_.cli.enabled===!0&&(q.doc.features.form_enabled===!1||_.cli.extend===!0||_.cli.enabled===!0)}async function V({atom:I,packageDependencies:q,packageDevDependencies:z,setProgress:H}){H("Initializing dependencies")}import Z from"node:fs";import $ from"node:path";import l from"@flownet/lib-render-templates-dir";async function W({atom:I,setProgress:q,context:z,packageDependencies:H}){if(I.doc.features.cli.enabled!==!0)return;await q({message:"Creating cli."});let _={atom:I,packageDependencies:H},N=z.templateDir,M=$.join(z.projectDir,"src","cli");if(!Z.existsSync(M))Z.mkdirSync(M,{recursive:!0});await l({pattern:["index.py.njk","__init__.py.njk"],dir:$.join(N,"src","cli"),outDir:M,context:_})}import Q from"node:path";import G from"@fnet/auto-conda-env";import u from"@flownet/lib-render-templates-dir";async function X(I){let{setProgress:q,atom:z,context:H}=I;q({message:"Installing Python packages"});let _=H.projectDir,N=await G({pythonVersion:"3.12",packages:[{package:"fnet-import-parser",version:"0.1.9"}]}),{errors:M,result:F}=await N.runBin("fnet_import_parser",["--entry_file",Q.join(_,"src","default","index.py")],{captureName:"result"});if(M)throw Error(M.format());let y=JSON.parse(F.items[0].stdout).required["third-party"]?.map((J)=>{return{package:J.metadata?.package||J.path,version:J.metadata?.version||void 0,channel:J.metadata?.channel||void 0}})||[],S=z.doc.dependencies||[];for(let J of y)if(!S.some((R)=>R.package===J.package))S.push(J);let E=Q.join(_,".conda"),Y=await G({envDir:E,pythonVersion:z.doc.features.runtime.version||"3.12",packages:S});H.pythonEnv=Y,I.packageDependencies=S;let L=z.doc.features.render?.dirs||[];for(let J of L)J.dir=Q.resolve(_,J.dir),J.outDir=Q.resolve(_,J.outDir),await u(J);let O={params:{}};O.params.package_name=z.doc.name,O.params.version="0.1.0",O.params.bin_name=z.doc.name,O.params.python_requires=z.doc.features.runtime.version||">=3.12",O.params.dependencies=S,O.params.scripts=JSON.stringify({cli:`PYTHONPATH='${Q.join("src")}' '${Q.relative(H.projectDir,Y.pythonBin)}' '${Q.join("src","cli","index.py")}'`}),await u({pattern:["setup.py.njk","package.json.njk","pyproject.toml.njk"],dir:H.templateDir,outDir:H.projectDir,context:O})}class B extends b{async initRuntime(){await U(this.apiContext),await V(this.apiContext),await this.initLibraryDirPython(),await this.initNunjucks(),await this.initLibsPython()}async initLibraryDirPython(){this.setProgress({message:"Initializing library directory."});let I=this.context.projectDir;this.setProgress({message:"Cleaning project directory."});let q=A({dir:I,ignore:[".cache","node_modules",".conda",".bin",".dev"],absolute:!0});for(let _ of q)K.rmSync(_,{recursive:!0,force:!0});this.setProgress({message:"Creating project directory."});let z=I;if(!K.existsSync(z))K.mkdirSync(z,{recursive:!0});if(z=T.join(I,"src"),!K.existsSync(z))K.mkdirSync(z,{recursive:!0});z=T.join(I,"src","default");let H=this.context.projectSrcDir;if(!K.existsSync(z))try{if(f.platform()==="win32")K.symlinkSync(H,z,"junction");else K.symlinkSync(H,z,"dir")}catch(_){throw Error(`Couldn't create symlink. Error: ${_.message}`)}if(z=T.join(I,".dev"),!K.existsSync(z))K.mkdirSync(z,{recursive:!0})}async initLibsPython(){this.setProgress({message:"Initializing external libs."});let I=this.atom;I.protocol="src:",I.doc.dependencies=I.doc.dependencies||[],I.name=I.doc.name;let q=[{name:this.atom.doc.name,type:"atom",parent_id:this.atom.parent_id,atom:I}];this.libs=q}async createAtomLibFilesPython({libs:I}){await this.setProgress({message:"Creating external lib files."});let q=I.filter((z)=>z.type==="atom");for(let z=0;z<q.length;z++){let _=q[z].atom;if(_.protocol==="src:"){let N=T.resolve(this.context.projectSrcDir,`${_.fileName||_.name}.py`);if(!K.existsSync(N)){K.mkdirSync(T.dirname(N),{recursive:!0});let M=`def default():
|
|
2
2
|
`;M+=` print("Hello world!")
|
|
3
3
|
`,K.writeFileSync(N,M,"utf8")}}}}async build(){try{if(this.fileMode){if(await this.createAtomLibFilesPython({libs:this.libs}),await this.createProjectYaml(),await w(this.apiContext),await v(this.apiContext),await W(this.apiContext),this.buildMode){if(await X(this.apiContext),this.deployMode)await this.deploy()}}await this._cache_set(this.buildKey,{status:"COMPLETED"})}catch(I){throw await this._cache_set(this.buildKey,{status:"FAILED",message:I.message||I}),console.log(I),I}}}var qz=B;export{qz as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{g as gQ,h as U8,i as P}from"./index.cvxrf34y.js";var M8=U8((_5,C8)=>{C8.exports=B8;function B8(Q,X,$){if(Q instanceof RegExp)Q=z8(Q,$);if(X instanceof RegExp)X=z8(X,$);var Z=w8(Q,X,$);return Z&&{start:Z[0],end:Z[1],pre:$.slice(0,Z[0]),body:$.slice(Z[0]+Q.length,Z[1]),post:$.slice(Z[1]+X.length)}}function z8(Q,X){var $=X.match(Q);return $?$[0]:null}B8.range=w8;function w8(Q,X,$){var Z,J,V,q,_,Y=$.indexOf(Q),H=$.indexOf(X,Y+1),K=Y;if(Y>=0&&H>0){if(Q===X)return[Y,H];Z=[],V=$.length;while(K>=0&&!_){if(K==Y)Z.push(K),Y=$.indexOf(Q,K+1);else if(Z.length==1)_=[Z.pop(),H];else{if(J=Z.pop(),J<V)V=J,q=H;H=$.indexOf(X,K+1)}K=Y<H&&Y>=0?Y:H}if(Z.length)_=[V,q]}return _}});var v8=U8((Y5,N8)=>{var R8=M8();N8.exports=vQ;var A8="\x00SLASH"+Math.random()+"\x00",I8="\x00OPEN"+Math.random()+"\x00",a0="\x00CLOSE"+Math.random()+"\x00",L8="\x00COMMA"+Math.random()+"\x00",O8="\x00PERIOD"+Math.random()+"\x00";function r0(Q){return parseInt(Q,10)==Q?parseInt(Q,10):Q.charCodeAt(0)}function FQ(Q){return Q.split("\\\\").join(A8).split("\\{").join(I8).split("\\}").join(a0).split("\\,").join(L8).split("\\.").join(O8)}function NQ(Q){return Q.split(A8).join("\\").split(I8).join("{").split(a0).join("}").split(L8).join(",").split(O8).join(".")}function F8(Q){if(!Q)return[""];var X=[],$=R8("{","}",Q);if(!$)return Q.split(",");var{pre:Z,body:J,post:V}=$,q=Z.split(",");q[q.length-1]+="{"+J+"}";var _=F8(V);if(V.length)q[q.length-1]+=_.shift(),q.push.apply(q,_);return X.push.apply(X,q),X}function vQ(Q){if(!Q)return[];if(Q.substr(0,2)==="{}")Q="\\{\\}"+Q.substr(2);return W0(FQ(Q),!0).map(NQ)}function PQ(Q){return"{"+Q+"}"}function DQ(Q){return/^-?0\d/.test(Q)}function kQ(Q,X){return Q<=X}function SQ(Q,X){return Q>=X}function W0(Q,X){var $=[],Z=R8("{","}",Q);if(!Z)return[Q];var J=Z.pre,V=Z.post.length?W0(Z.post,!1):[""];if(/\$$/.test(Z.pre))for(var q=0;q<V.length;q++){var _=J+"{"+Z.body+"}"+V[q];$.push(_)}else{var Y=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(Z.body),H=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(Z.body),K=Y||H,G=Z.body.indexOf(",")>=0;if(!K&&!G){if(Z.post.match(/,.*\}/))return Q=Z.pre+"{"+Z.body+a0+Z.post,W0(Q);return[Q]}var W;if(K)W=Z.body.split(/\.\./);else if(W=F8(Z.body),W.length===1){if(W=W0(W[0],!1).map(PQ),W.length===1)return V.map(function(OQ){return Z.pre+W[0]+OQ})}var z;if(K){var j=r0(W[0]),U=r0(W[1]),B=Math.max(W[0].length,W[1].length),C=W.length==3?Math.abs(r0(W[2])):1,M=kQ,w=U<j;if(w)C*=-1,M=SQ;var R=W.some(DQ);z=[];for(var b=j;M(b,U);b+=C){var F;if(H){if(F=String.fromCharCode(b),F==="\\")F=""}else if(F=String(b),R){var e=B-F.length;if(e>0){var J0=Array(e+1).join("0");if(b<0)F="-"+J0+F.slice(1);else F=J0+F}}z.push(F)}}else{z=[];for(var y=0;y<W.length;y++)z.push.apply(z,W0(W[y],!1))}for(var y=0;y<z.length;y++)for(var q=0;q<V.length;q++){var _=J+z[y]+V[q];if(!X||K||_)$.push(_)}}return $}});var E8=gQ(v8(),1);var G0=(Q)=>{if(typeof Q!=="string")throw TypeError("invalid pattern");if(Q.length>65536)throw TypeError("pattern is too long")};var TQ={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},j0=(Q)=>Q.replace(/[[\]\\-]/g,"\\$&"),bQ=(Q)=>Q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),P8=(Q)=>Q.join(""),D8=(Q,X)=>{let $=X;if(Q.charAt($)!=="[")throw Error("not in a brace expression");let Z=[],J=[],V=$+1,q=!1,_=!1,Y=!1,H=!1,K=$,G="";Q:while(V<Q.length){let U=Q.charAt(V);if((U==="!"||U==="^")&&V===$+1){H=!0,V++;continue}if(U==="]"&&q&&!Y){K=V+1;break}if(q=!0,U==="\\"){if(!Y){Y=!0,V++;continue}}if(U==="["&&!Y){for(let[B,[C,M,w]]of Object.entries(TQ))if(Q.startsWith(B,V)){if(G)return["$.",!1,Q.length-$,!0];if(V+=B.length,w)J.push(C);else Z.push(C);_=_||M;continue Q}}if(Y=!1,G){if(U>G)Z.push(j0(G)+"-"+j0(U));else if(U===G)Z.push(j0(U));G="",V++;continue}if(Q.startsWith("-]",V+1)){Z.push(j0(U+"-")),V+=2;continue}if(Q.startsWith("-",V+1)){G=U,V+=2;continue}Z.push(j0(U)),V++}if(K<V)return["",!1,0,!1];if(!Z.length&&!J.length)return["$.",!1,Q.length-$,!0];if(J.length===0&&Z.length===1&&/^\\?.$/.test(Z[0])&&!H){let U=Z[0].length===2?Z[0].slice(-1):Z[0];return[bQ(U),!1,K-$,!1]}let W="["+(H?"^":"")+P8(Z)+"]",z="["+(H?"":"^")+P8(J)+"]";return[Z.length&&J.length?"("+W+"|"+z+")":Z.length?W:z,_,K-$,!0]};var g=(Q,{windowsPathsNoEscape:X=!1}={})=>{return X?Q.replace(/\[([^\/\\])\]/g,"$1"):Q.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1")};var uQ=new Set(["!","?","+","*","@"]),k8=(Q)=>uQ.has(Q),EQ="(?!(?:^|/)\\.\\.?(?:$|/))",P0="(?!\\.)",xQ=new Set(["[","."]),mQ=new Set(["..","."]),fQ=new Set("().*{}+?[]^$\\!"),yQ=(Q)=>Q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),s0="[^/]",S8=s0+"*?",T8=s0+"+?";class N{type;#Q;#X;#$=!1;#J=[];#q;#M;#U;#_=!1;#H;#Y;#K=!1;constructor(Q,X,$={}){if(this.type=Q,Q)this.#X=!0;if(this.#q=X,this.#Q=this.#q?this.#q.#Q:this,this.#H=this.#Q===this?$:this.#Q.#H,this.#U=this.#Q===this?[]:this.#Q.#U,Q==="!"&&!this.#Q.#_)this.#U.push(this);this.#M=this.#q?this.#q.#J.length:0}get hasMagic(){if(this.#X!==void 0)return this.#X;for(let Q of this.#J){if(typeof Q==="string")continue;if(Q.type||Q.hasMagic)return this.#X=!0}return this.#X}toString(){if(this.#Y!==void 0)return this.#Y;if(!this.type)return this.#Y=this.#J.map((Q)=>String(Q)).join("");else return this.#Y=this.type+"("+this.#J.map((Q)=>String(Q)).join("|")+")"}#Z(){if(this!==this.#Q)throw Error("should only call on root");if(this.#_)return this;this.toString(),this.#_=!0;let Q;while(Q=this.#U.pop()){if(Q.type!=="!")continue;let X=Q,$=X.#q;while($){for(let Z=X.#M+1;!$.type&&Z<$.#J.length;Z++)for(let J of Q.#J){if(typeof J==="string")throw Error("string part in extglob AST??");J.copyIn($.#J[Z])}X=$,$=X.#q}}return this}push(...Q){for(let X of Q){if(X==="")continue;if(typeof X!=="string"&&!(X instanceof N&&X.#q===this))throw Error("invalid part: "+X);this.#J.push(X)}}toJSON(){let Q=this.type===null?this.#J.slice().map((X)=>typeof X==="string"?X:X.toJSON()):[this.type,...this.#J.map((X)=>X.toJSON())];if(this.isStart()&&!this.type)Q.unshift([]);if(this.isEnd()&&(this===this.#Q||this.#Q.#_&&this.#q?.type==="!"))Q.push({});return Q}isStart(){if(this.#Q===this)return!0;if(!this.#q?.isStart())return!1;if(this.#M===0)return!0;let Q=this.#q;for(let X=0;X<this.#M;X++){let $=Q.#J[X];if(!($ instanceof N&&$.type==="!"))return!1}return!0}isEnd(){if(this.#Q===this)return!0;if(this.#q?.type==="!")return!0;if(!this.#q?.isEnd())return!1;if(!this.type)return this.#q?.isEnd();let Q=this.#q?this.#q.#J.length:0;return this.#M===Q-1}copyIn(Q){if(typeof Q==="string")this.push(Q);else this.push(Q.clone(this))}clone(Q){let X=new N(this.type,Q);for(let $ of this.#J)X.copyIn($);return X}static#G(Q,X,$,Z){let J=!1,V=!1,q=-1,_=!1;if(X.type===null){let W=$,z="";while(W<Q.length){let j=Q.charAt(W++);if(J||j==="\\"){J=!J,z+=j;continue}if(V){if(W===q+1){if(j==="^"||j==="!")_=!0}else if(j==="]"&&!(W===q+2&&_))V=!1;z+=j;continue}else if(j==="["){V=!0,q=W,_=!1,z+=j;continue}if(!Z.noext&&k8(j)&&Q.charAt(W)==="("){X.push(z),z="";let U=new N(j,X);W=N.#G(Q,U,W,Z),X.push(U);continue}z+=j}return X.push(z),W}let Y=$+1,H=new N(null,X),K=[],G="";while(Y<Q.length){let W=Q.charAt(Y++);if(J||W==="\\"){J=!J,G+=W;continue}if(V){if(Y===q+1){if(W==="^"||W==="!")_=!0}else if(W==="]"&&!(Y===q+2&&_))V=!1;G+=W;continue}else if(W==="["){V=!0,q=Y,_=!1,G+=W;continue}if(k8(W)&&Q.charAt(Y)==="("){H.push(G),G="";let z=new N(W,H);H.push(z),Y=N.#G(Q,z,Y,Z);continue}if(W==="|"){H.push(G),G="",K.push(H),H=new N(null,X);continue}if(W===")"){if(G===""&&X.#J.length===0)X.#K=!0;return H.push(G),G="",X.push(...K,H),Y}G+=W}return X.type=null,X.#X=void 0,X.#J=[Q.substring($-1)],Y}static fromGlob(Q,X={}){let $=new N(null,void 0,X);return N.#G(Q,$,0,X),$}toMMPattern(){if(this!==this.#Q)return this.#Q.toMMPattern();let Q=this.toString(),[X,$,Z,J]=this.toRegExpSource();if(!(Z||this.#X||this.#H.nocase&&!this.#H.nocaseMagicOnly&&Q.toUpperCase()!==Q.toLowerCase()))return $;let q=(this.#H.nocase?"i":"")+(J?"u":"");return Object.assign(new RegExp(`^${X}$`,q),{_src:X,_glob:Q})}get options(){return this.#H}toRegExpSource(Q){let X=Q??!!this.#H.dot;if(this.#Q===this)this.#Z();if(!this.type){let _=this.isStart()&&this.isEnd(),Y=this.#J.map((W)=>{let[z,j,U,B]=typeof W==="string"?N.#j(W,this.#X,_):W.toRegExpSource(Q);return this.#X=this.#X||U,this.#$=this.#$||B,z}).join(""),H="";if(this.isStart()){if(typeof this.#J[0]==="string"){if(!(this.#J.length===1&&mQ.has(this.#J[0]))){let z=xQ,j=X&&z.has(Y.charAt(0))||Y.startsWith("\\.")&&z.has(Y.charAt(2))||Y.startsWith("\\.\\.")&&z.has(Y.charAt(4)),U=!X&&!Q&&z.has(Y.charAt(0));H=j?EQ:U?P0:""}}}let K="";if(this.isEnd()&&this.#Q.#_&&this.#q?.type==="!")K="(?:$|\\/)";return[H+Y+K,g(Y),this.#X=!!this.#X,this.#$]}let $=this.type==="*"||this.type==="+",Z=this.type==="!"?"(?:(?!(?:":"(?:",J=this.#B(X);if(this.isStart()&&this.isEnd()&&!J&&this.type!=="!"){let _=this.toString();return this.#J=[_],this.type=null,this.#X=void 0,[_,g(this.toString()),!1,!1]}let V=!$||Q||X||!P0?"":this.#B(!0);if(V===J)V="";if(V)J=`(?:${J})(?:${V})*?`;let q="";if(this.type==="!"&&this.#K)q=(this.isStart()&&!X?P0:"")+T8;else{let _=this.type==="!"?"))"+(this.isStart()&&!X&&!Q?P0:"")+S8+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&V?")":this.type==="*"&&V?")?":`)${this.type}`;q=Z+J+_}return[q,g(J),this.#X=!!this.#X,this.#$]}#B(Q){return this.#J.map((X)=>{if(typeof X==="string")throw Error("string type in extglob ast??");let[$,Z,J,V]=X.toRegExpSource(Q);return this.#$=this.#$||V,$}).filter((X)=>!(this.isStart()&&this.isEnd())||!!X).join("|")}static#j(Q,X,$=!1){let Z=!1,J="",V=!1;for(let q=0;q<Q.length;q++){let _=Q.charAt(q);if(Z){Z=!1,J+=(fQ.has(_)?"\\":"")+_;continue}if(_==="\\"){if(q===Q.length-1)J+="\\\\";else Z=!0;continue}if(_==="["){let[Y,H,K,G]=D8(Q,q);if(K){J+=Y,V=V||H,q+=K-1,X=X||G;continue}}if(_==="*"){if($&&Q==="*")J+=T8;else J+=S8;X=!0;continue}if(_==="?"){J+=s0,X=!0;continue}J+=yQ(_)}return[J,g(Q),!!X,V]}}var V0=(Q,{windowsPathsNoEscape:X=!1}={})=>{return X?Q.replace(/[?*()[\]]/g,"[$&]"):Q.replace(/[?*()[\]\\]/g,"\\$&")};var k=(Q,X,$={})=>{if(G0(X),!$.nocomment&&X.charAt(0)==="#")return!1;return new x(X,$).match(Q)},hQ=/^\*+([^+@!?\*\[\(]*)$/,dQ=(Q)=>(X)=>!X.startsWith(".")&&X.endsWith(Q),cQ=(Q)=>(X)=>X.endsWith(Q),lQ=(Q)=>{return Q=Q.toLowerCase(),(X)=>!X.startsWith(".")&&X.toLowerCase().endsWith(Q)},oQ=(Q)=>{return Q=Q.toLowerCase(),(X)=>X.toLowerCase().endsWith(Q)},pQ=/^\*+\.\*+$/,iQ=(Q)=>!Q.startsWith(".")&&Q.includes("."),nQ=(Q)=>Q!=="."&&Q!==".."&&Q.includes("."),rQ=/^\.\*+$/,aQ=(Q)=>Q!=="."&&Q!==".."&&Q.startsWith("."),sQ=/^\*+$/,eQ=(Q)=>Q.length!==0&&!Q.startsWith("."),tQ=(Q)=>Q.length!==0&&Q!=="."&&Q!=="..",QX=/^\?+([^+@!?\*\[\(]*)?$/,XX=([Q,X=""])=>{let $=x8([Q]);if(!X)return $;return X=X.toLowerCase(),(Z)=>$(Z)&&Z.toLowerCase().endsWith(X)},$X=([Q,X=""])=>{let $=m8([Q]);if(!X)return $;return X=X.toLowerCase(),(Z)=>$(Z)&&Z.toLowerCase().endsWith(X)},ZX=([Q,X=""])=>{let $=m8([Q]);return!X?$:(Z)=>$(Z)&&Z.endsWith(X)},JX=([Q,X=""])=>{let $=x8([Q]);return!X?$:(Z)=>$(Z)&&Z.endsWith(X)},x8=([Q])=>{let X=Q.length;return($)=>$.length===X&&!$.startsWith(".")},m8=([Q])=>{let X=Q.length;return($)=>$.length===X&&$!=="."&&$!==".."},f8=typeof process==="object"&&process?typeof process.env==="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",b8={win32:{sep:"\\"},posix:{sep:"/"}},VX=f8==="win32"?b8.win32.sep:b8.posix.sep;k.sep=VX;var v=Symbol("globstar **");k.GLOBSTAR=v;var qX="[^/]",_X=qX+"*?",YX="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",KX="(?:(?!(?:\\/|^)\\.).)*?",HX=(Q,X={})=>($)=>k($,Q,X);k.filter=HX;var E=(Q,X={})=>Object.assign({},Q,X),WX=(Q)=>{if(!Q||typeof Q!=="object"||!Object.keys(Q).length)return k;let X=k;return Object.assign((Z,J,V={})=>X(Z,J,E(Q,V)),{Minimatch:class extends X.Minimatch{constructor(J,V={}){super(J,E(Q,V))}static defaults(J){return X.defaults(E(Q,J)).Minimatch}},AST:class extends X.AST{constructor(J,V,q={}){super(J,V,E(Q,q))}static fromGlob(J,V={}){return X.AST.fromGlob(J,E(Q,V))}},unescape:(Z,J={})=>X.unescape(Z,E(Q,J)),escape:(Z,J={})=>X.escape(Z,E(Q,J)),filter:(Z,J={})=>X.filter(Z,E(Q,J)),defaults:(Z)=>X.defaults(E(Q,Z)),makeRe:(Z,J={})=>X.makeRe(Z,E(Q,J)),braceExpand:(Z,J={})=>X.braceExpand(Z,E(Q,J)),match:(Z,J,V={})=>X.match(Z,J,E(Q,V)),sep:X.sep,GLOBSTAR:v})};k.defaults=WX;var y8=(Q,X={})=>{if(G0(Q),X.nobrace||!/\{(?:(?!\{).)*\}/.test(Q))return[Q];return E8.default(Q)};k.braceExpand=y8;var GX=(Q,X={})=>new x(Q,X).makeRe();k.makeRe=GX;var jX=(Q,X,$={})=>{let Z=new x(X,$);if(Q=Q.filter((J)=>Z.match(J)),Z.options.nonull&&!Q.length)Q.push(X);return Q};k.match=jX;var u8=/[?*]|[+@!]\(.*?\)|\[|\]/,zX=(Q)=>Q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class x{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(Q,X={}){if(G0(Q),X=X||{},this.options=X,this.pattern=Q,this.platform=X.platform||f8,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!X.windowsPathsNoEscape||X.allowWindowsEscape===!1,this.windowsPathsNoEscape)this.pattern=this.pattern.replace(/\\/g,"/");this.preserveMultipleSlashes=!!X.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!X.nonegate,this.comment=!1,this.empty=!1,this.partial=!!X.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=X.windowsNoMagicRoot!==void 0?X.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let Q of this.set)for(let X of Q)if(typeof X!=="string")return!0;return!1}debug(...Q){}make(){let Q=this.pattern,X=this.options;if(!X.nocomment&&Q.charAt(0)==="#"){this.comment=!0;return}if(!Q){this.empty=!0;return}if(this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],X.debug)this.debug=(...J)=>console.error(...J);this.debug(this.pattern,this.globSet);let $=this.globSet.map((J)=>this.slashSplit(J));this.globParts=this.preprocess($),this.debug(this.pattern,this.globParts);let Z=this.globParts.map((J,V,q)=>{if(this.isWindows&&this.windowsNoMagicRoot){let _=J[0]===""&&J[1]===""&&(J[2]==="?"||!u8.test(J[2]))&&!u8.test(J[3]),Y=/^[a-z]:/i.test(J[0]);if(_)return[...J.slice(0,4),...J.slice(4).map((H)=>this.parse(H))];else if(Y)return[J[0],...J.slice(1).map((H)=>this.parse(H))]}return J.map((_)=>this.parse(_))});if(this.debug(this.pattern,Z),this.set=Z.filter((J)=>J.indexOf(!1)===-1),this.isWindows)for(let J=0;J<this.set.length;J++){let V=this.set[J];if(V[0]===""&&V[1]===""&&this.globParts[J][2]==="?"&&typeof V[3]==="string"&&/^[a-z]:$/i.test(V[3]))V[2]="?"}this.debug(this.pattern,this.set)}preprocess(Q){if(this.options.noglobstar){for(let $=0;$<Q.length;$++)for(let Z=0;Z<Q[$].length;Z++)if(Q[$][Z]==="**")Q[$][Z]="*"}let{optimizationLevel:X=1}=this.options;if(X>=2)Q=this.firstPhasePreProcess(Q),Q=this.secondPhasePreProcess(Q);else if(X>=1)Q=this.levelOneOptimize(Q);else Q=this.adjascentGlobstarOptimize(Q);return Q}adjascentGlobstarOptimize(Q){return Q.map((X)=>{let $=-1;while(($=X.indexOf("**",$+1))!==-1){let Z=$;while(X[Z+1]==="**")Z++;if(Z!==$)X.splice($,Z-$)}return X})}levelOneOptimize(Q){return Q.map((X)=>{return X=X.reduce(($,Z)=>{let J=$[$.length-1];if(Z==="**"&&J==="**")return $;if(Z===".."){if(J&&J!==".."&&J!=="."&&J!=="**")return $.pop(),$}return $.push(Z),$},[]),X.length===0?[""]:X})}levelTwoFileOptimize(Q){if(!Array.isArray(Q))Q=this.slashSplit(Q);let X=!1;do{if(X=!1,!this.preserveMultipleSlashes){for(let Z=1;Z<Q.length-1;Z++){let J=Q[Z];if(Z===1&&J===""&&Q[0]==="")continue;if(J==="."||J==="")X=!0,Q.splice(Z,1),Z--}if(Q[0]==="."&&Q.length===2&&(Q[1]==="."||Q[1]===""))X=!0,Q.pop()}let $=0;while(($=Q.indexOf("..",$+1))!==-1){let Z=Q[$-1];if(Z&&Z!=="."&&Z!==".."&&Z!=="**")X=!0,Q.splice($-1,2),$-=2}}while(X);return Q.length===0?[""]:Q}firstPhasePreProcess(Q){let X=!1;do{X=!1;for(let $ of Q){let Z=-1;while((Z=$.indexOf("**",Z+1))!==-1){let V=Z;while($[V+1]==="**")V++;if(V>Z)$.splice(Z+1,V-Z);let q=$[Z+1],_=$[Z+2],Y=$[Z+3];if(q!=="..")continue;if(!_||_==="."||_===".."||!Y||Y==="."||Y==="..")continue;X=!0,$.splice(Z,1);let H=$.slice(0);H[Z]="**",Q.push(H),Z--}if(!this.preserveMultipleSlashes){for(let V=1;V<$.length-1;V++){let q=$[V];if(V===1&&q===""&&$[0]==="")continue;if(q==="."||q==="")X=!0,$.splice(V,1),V--}if($[0]==="."&&$.length===2&&($[1]==="."||$[1]===""))X=!0,$.pop()}let J=0;while((J=$.indexOf("..",J+1))!==-1){let V=$[J-1];if(V&&V!=="."&&V!==".."&&V!=="**"){X=!0;let _=J===1&&$[J+1]==="**"?["."]:[];if($.splice(J-1,2,..._),$.length===0)$.push("");J-=2}}}}while(X);return Q}secondPhasePreProcess(Q){for(let X=0;X<Q.length-1;X++)for(let $=X+1;$<Q.length;$++){let Z=this.partsMatch(Q[X],Q[$],!this.preserveMultipleSlashes);if(Z){Q[X]=[],Q[$]=Z;break}}return Q.filter((X)=>X.length)}partsMatch(Q,X,$=!1){let Z=0,J=0,V=[],q="";while(Z<Q.length&&J<X.length)if(Q[Z]===X[J])V.push(q==="b"?X[J]:Q[Z]),Z++,J++;else if($&&Q[Z]==="**"&&X[J]===Q[Z+1])V.push(Q[Z]),Z++;else if($&&X[J]==="**"&&Q[Z]===X[J+1])V.push(X[J]),J++;else if(Q[Z]==="*"&&X[J]&&(this.options.dot||!X[J].startsWith("."))&&X[J]!=="**"){if(q==="b")return!1;q="a",V.push(Q[Z]),Z++,J++}else if(X[J]==="*"&&Q[Z]&&(this.options.dot||!Q[Z].startsWith("."))&&Q[Z]!=="**"){if(q==="a")return!1;q="b",V.push(X[J]),Z++,J++}else return!1;return Q.length===X.length&&V}parseNegate(){if(this.nonegate)return;let Q=this.pattern,X=!1,$=0;for(let Z=0;Z<Q.length&&Q.charAt(Z)==="!";Z++)X=!X,$++;if($)this.pattern=Q.slice($);this.negate=X}matchOne(Q,X,$=!1){let Z=this.options;if(this.isWindows){let j=typeof Q[0]==="string"&&/^[a-z]:$/i.test(Q[0]),U=!j&&Q[0]===""&&Q[1]===""&&Q[2]==="?"&&/^[a-z]:$/i.test(Q[3]),B=typeof X[0]==="string"&&/^[a-z]:$/i.test(X[0]),C=!B&&X[0]===""&&X[1]===""&&X[2]==="?"&&typeof X[3]==="string"&&/^[a-z]:$/i.test(X[3]),M=U?3:j?0:void 0,w=C?3:B?0:void 0;if(typeof M==="number"&&typeof w==="number"){let[R,b]=[Q[M],X[w]];if(R.toLowerCase()===b.toLowerCase()){if(X[w]=R,w>M)X=X.slice(w);else if(M>w)Q=Q.slice(M)}}}let{optimizationLevel:J=1}=this.options;if(J>=2)Q=this.levelTwoFileOptimize(Q);this.debug("matchOne",this,{file:Q,pattern:X}),this.debug("matchOne",Q.length,X.length);for(var V=0,q=0,_=Q.length,Y=X.length;V<_&&q<Y;V++,q++){this.debug("matchOne loop");var H=X[q],K=Q[V];if(this.debug(X,H,K),H===!1)return!1;if(H===v){this.debug("GLOBSTAR",[X,H,K]);var G=V,W=q+1;if(W===Y){this.debug("** at the end");for(;V<_;V++)if(Q[V]==="."||Q[V]===".."||!Z.dot&&Q[V].charAt(0)===".")return!1;return!0}while(G<_){var z=Q[G];if(this.debug(`
|
|
2
|
+
globstar while`,Q,G,X,W,z),this.matchOne(Q.slice(G),X.slice(W),$))return this.debug("globstar found match!",G,_,z),!0;else{if(z==="."||z===".."||!Z.dot&&z.charAt(0)==="."){this.debug("dot detected!",Q,G,X,W);break}this.debug("globstar swallow a segment, and continue"),G++}}if($){if(this.debug(`
|
|
3
|
+
>>> no match, partial?`,Q,G,X,W),G===_)return!0}return!1}let j;if(typeof H==="string")j=K===H,this.debug("string match",H,K,j);else j=H.test(K),this.debug("pattern match",H,K,j);if(!j)return!1}if(V===_&&q===Y)return!0;else if(V===_)return $;else if(q===Y)return V===_-1&&Q[V]==="";else throw Error("wtf?")}braceExpand(){return y8(this.pattern,this.options)}parse(Q){G0(Q);let X=this.options;if(Q==="**")return v;if(Q==="")return"";let $,Z=null;if($=Q.match(sQ))Z=X.dot?tQ:eQ;else if($=Q.match(hQ))Z=(X.nocase?X.dot?oQ:lQ:X.dot?cQ:dQ)($[1]);else if($=Q.match(QX))Z=(X.nocase?X.dot?$X:XX:X.dot?ZX:JX)($);else if($=Q.match(pQ))Z=X.dot?nQ:iQ;else if($=Q.match(rQ))Z=aQ;let J=N.fromGlob(Q,this.options).toMMPattern();if(Z&&typeof J==="object")Reflect.defineProperty(J,"test",{value:Z});return J}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let Q=this.set;if(!Q.length)return this.regexp=!1,this.regexp;let X=this.options,$=X.noglobstar?_X:X.dot?YX:KX,Z=new Set(X.nocase?["i"]:[]),J=Q.map((_)=>{let Y=_.map((H)=>{if(H instanceof RegExp)for(let K of H.flags.split(""))Z.add(K);return typeof H==="string"?zX(H):H===v?v:H._src});return Y.forEach((H,K)=>{let G=Y[K+1],W=Y[K-1];if(H!==v||W===v)return;if(W===void 0)if(G!==void 0&&G!==v)Y[K+1]="(?:\\/|"+$+"\\/)?"+G;else Y[K]=$;else if(G===void 0)Y[K-1]=W+"(?:\\/|"+$+")?";else if(G!==v)Y[K-1]=W+"(?:\\/|\\/"+$+"\\/)"+G,Y[K+1]=v}),Y.filter((H)=>H!==v).join("/")}).join("|"),[V,q]=Q.length>1?["(?:",")"]:["",""];if(J="^"+V+J+q+"$",this.negate)J="^(?!"+J+").+$";try{this.regexp=new RegExp(J,[...Z].join(""))}catch(_){this.regexp=!1}return this.regexp}slashSplit(Q){if(this.preserveMultipleSlashes)return Q.split("/");else if(this.isWindows&&/^\/\/[^\/]+/.test(Q))return["",...Q.split(/\/+/)];else return Q.split(/\/+/)}match(Q,X=this.partial){if(this.debug("match",Q,this.pattern),this.comment)return!1;if(this.empty)return Q==="";if(Q==="/"&&X)return!0;let $=this.options;if(this.isWindows)Q=Q.split("\\").join("/");let Z=this.slashSplit(Q);this.debug(this.pattern,"split",Z);let J=this.set;this.debug(this.pattern,"set",J);let V=Z[Z.length-1];if(!V)for(let q=Z.length-2;!V&&q>=0;q--)V=Z[q];for(let q=0;q<J.length;q++){let _=J[q],Y=Z;if($.matchBase&&_.length===1)Y=[V];if(this.matchOne(Y,_,X)){if($.flipNegate)return!0;return!this.negate}}if($.flipNegate)return!1;return this.negate}static defaults(Q){return k.defaults(Q).Minimatch}}k.AST=N;k.Minimatch=x;k.escape=V0;k.unescape=g;import{fileURLToPath as pX}from"node:url";var q0=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date,h8=new Set,e0=typeof process==="object"&&!!process?process:{},d8=(Q,X,$,Z)=>{typeof e0.emitWarning==="function"?e0.emitWarning(Q,X,$,Z):console.error(`[${$}] ${X}: ${Q}`)},D0=globalThis.AbortController,g8=globalThis.AbortSignal;if(typeof D0>"u"){g8=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(Z,J){this._onabort.push(J)}},D0=class{constructor(){X()}signal=new g8;abort(Z){if(this.signal.aborted)return;this.signal.reason=Z,this.signal.aborted=!0;for(let J of this.signal._onabort)J(Z);this.signal.onabort?.(Z)}};let Q=e0.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",X=()=>{if(!Q)return;Q=!1,d8("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",X)}}var UX=(Q)=>!h8.has(Q),O5=Symbol("type"),r=(Q)=>Q&&Q===Math.floor(Q)&&Q>0&&isFinite(Q),c8=(Q)=>!r(Q)?null:Q<=Math.pow(2,8)?Uint8Array:Q<=Math.pow(2,16)?Uint16Array:Q<=Math.pow(2,32)?Uint32Array:Q<=Number.MAX_SAFE_INTEGER?z0:null;class z0 extends Array{constructor(Q){super(Q);this.fill(0)}}class _0{heap;length;static#Q=!1;static create(Q){let X=c8(Q);if(!X)return[];_0.#Q=!0;let $=new _0(Q,X);return _0.#Q=!1,$}constructor(Q,X){if(!_0.#Q)throw TypeError("instantiate Stack using Stack.create(n)");this.heap=new X(Q),this.length=0}push(Q){this.heap[this.length++]=Q}pop(){return this.heap[--this.length]}}class U0{#Q;#X;#$;#J;#q;#M;#U;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#_;#H;#Y;#K;#Z;#G;#B;#j;#z;#w;#R;#P;#L;#I;#A;#N;#C;#k;static unsafeExposeInternals(Q){return{starts:Q.#L,ttls:Q.#I,sizes:Q.#P,keyMap:Q.#Y,keyList:Q.#K,valList:Q.#Z,next:Q.#G,prev:Q.#B,get head(){return Q.#j},get tail(){return Q.#z},free:Q.#w,isBackgroundFetch:(X)=>Q.#W(X),backgroundFetch:(X,$,Z,J)=>Q.#E(X,$,Z,J),moveToTail:(X)=>Q.#f(X),indexes:(X)=>Q.#v(X),rindexes:(X)=>Q.#D(X),isStale:(X)=>Q.#F(X)}}get max(){return this.#Q}get maxSize(){return this.#X}get calculatedSize(){return this.#H}get size(){return this.#_}get fetchMethod(){return this.#M}get memoMethod(){return this.#U}get dispose(){return this.#$}get onInsert(){return this.#J}get disposeAfter(){return this.#q}constructor(Q){let{max:X=0,ttl:$,ttlResolution:Z=1,ttlAutopurge:J,updateAgeOnGet:V,updateAgeOnHas:q,allowStale:_,dispose:Y,onInsert:H,disposeAfter:K,noDisposeOnSet:G,noUpdateTTL:W,maxSize:z=0,maxEntrySize:j=0,sizeCalculation:U,fetchMethod:B,memoMethod:C,noDeleteOnFetchRejection:M,noDeleteOnStaleGet:w,allowStaleOnFetchRejection:R,allowStaleOnFetchAbort:b,ignoreFetchAbort:F}=Q;if(X!==0&&!r(X))throw TypeError("max option must be a nonnegative integer");let e=X?c8(X):Array;if(!e)throw Error("invalid max value: "+X);if(this.#Q=X,this.#X=z,this.maxEntrySize=j||this.#X,this.sizeCalculation=U,this.sizeCalculation){if(!this.#X&&!this.maxEntrySize)throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!=="function")throw TypeError("sizeCalculation set to non-function")}if(C!==void 0&&typeof C!=="function")throw TypeError("memoMethod must be a function if defined");if(this.#U=C,B!==void 0&&typeof B!=="function")throw TypeError("fetchMethod must be a function if specified");if(this.#M=B,this.#N=!!B,this.#Y=new Map,this.#K=Array(X).fill(void 0),this.#Z=Array(X).fill(void 0),this.#G=new e(X),this.#B=new e(X),this.#j=0,this.#z=0,this.#w=_0.create(X),this.#_=0,this.#H=0,typeof Y==="function")this.#$=Y;if(typeof H==="function")this.#J=H;if(typeof K==="function")this.#q=K,this.#R=[];else this.#q=void 0,this.#R=void 0;if(this.#A=!!this.#$,this.#k=!!this.#J,this.#C=!!this.#q,this.noDisposeOnSet=!!G,this.noUpdateTTL=!!W,this.noDeleteOnFetchRejection=!!M,this.allowStaleOnFetchRejection=!!R,this.allowStaleOnFetchAbort=!!b,this.ignoreFetchAbort=!!F,this.maxEntrySize!==0){if(this.#X!==0){if(!r(this.#X))throw TypeError("maxSize must be a positive integer if specified")}if(!r(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#g()}if(this.allowStale=!!_,this.noDeleteOnStaleGet=!!w,this.updateAgeOnGet=!!V,this.updateAgeOnHas=!!q,this.ttlResolution=r(Z)||Z===0?Z:1,this.ttlAutopurge=!!J,this.ttl=$||0,this.ttl){if(!r(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#V()}if(this.#Q===0&&this.ttl===0&&this.#X===0)throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#Q&&!this.#X){if(UX("LRU_CACHE_UNBOUNDED"))h8.add("LRU_CACHE_UNBOUNDED"),d8("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning","LRU_CACHE_UNBOUNDED",U0)}}getRemainingTTL(Q){return this.#Y.has(Q)?1/0:0}#V(){let Q=new z0(this.#Q),X=new z0(this.#Q);this.#I=Q,this.#L=X,this.#S=(J,V,q=q0.now())=>{if(X[J]=V!==0?q:0,Q[J]=V,V!==0&&this.ttlAutopurge){let _=setTimeout(()=>{if(this.#F(J))this.#T(this.#K[J],"expire")},V+1);if(_.unref)_.unref()}},this.#b=(J)=>{X[J]=Q[J]!==0?q0.now():0},this.#O=(J,V)=>{if(Q[V]){let q=Q[V],_=X[V];if(!q||!_)return;J.ttl=q,J.start=_,J.now=$||Z();let Y=J.now-_;J.remainingTTL=q-Y}};let $=0,Z=()=>{let J=q0.now();if(this.ttlResolution>0){$=J;let V=setTimeout(()=>$=0,this.ttlResolution);if(V.unref)V.unref()}return J};this.getRemainingTTL=(J)=>{let V=this.#Y.get(J);if(V===void 0)return 0;let q=Q[V],_=X[V];if(!q||!_)return 1/0;let Y=($||Z())-_;return q-Y},this.#F=(J)=>{let V=X[J],q=Q[J];return!!q&&!!V&&($||Z())-V>q}}#b=()=>{};#O=()=>{};#S=()=>{};#F=()=>!1;#g(){let Q=new z0(this.#Q);this.#H=0,this.#P=Q,this.#u=(X)=>{this.#H-=Q[X],Q[X]=0},this.#h=(X,$,Z,J)=>{if(this.#W($))return 0;if(!r(Z))if(J){if(typeof J!=="function")throw TypeError("sizeCalculation must be a function");if(Z=J($,X),!r(Z))throw TypeError("sizeCalculation return invalid (expect positive integer)")}else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return Z},this.#x=(X,$,Z)=>{if(Q[X]=$,this.#X){let J=this.#X-Q[X];while(this.#H>J)this.#m(!0)}if(this.#H+=Q[X],Z)Z.entrySize=$,Z.totalCalculatedSize=this.#H}}#u=(Q)=>{};#x=(Q,X,$)=>{};#h=(Q,X,$,Z)=>{if($||Z)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#v({allowStale:Q=this.allowStale}={}){if(this.#_)for(let X=this.#z;;){if(!this.#d(X))break;if(Q||!this.#F(X))yield X;if(X===this.#j)break;else X=this.#B[X]}}*#D({allowStale:Q=this.allowStale}={}){if(this.#_)for(let X=this.#j;;){if(!this.#d(X))break;if(Q||!this.#F(X))yield X;if(X===this.#z)break;else X=this.#G[X]}}#d(Q){return Q!==void 0&&this.#Y.get(this.#K[Q])===Q}*entries(){for(let Q of this.#v())if(this.#Z[Q]!==void 0&&this.#K[Q]!==void 0&&!this.#W(this.#Z[Q]))yield[this.#K[Q],this.#Z[Q]]}*rentries(){for(let Q of this.#D())if(this.#Z[Q]!==void 0&&this.#K[Q]!==void 0&&!this.#W(this.#Z[Q]))yield[this.#K[Q],this.#Z[Q]]}*keys(){for(let Q of this.#v()){let X=this.#K[Q];if(X!==void 0&&!this.#W(this.#Z[Q]))yield X}}*rkeys(){for(let Q of this.#D()){let X=this.#K[Q];if(X!==void 0&&!this.#W(this.#Z[Q]))yield X}}*values(){for(let Q of this.#v())if(this.#Z[Q]!==void 0&&!this.#W(this.#Z[Q]))yield this.#Z[Q]}*rvalues(){for(let Q of this.#D())if(this.#Z[Q]!==void 0&&!this.#W(this.#Z[Q]))yield this.#Z[Q]}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(Q,X={}){for(let $ of this.#v()){let Z=this.#Z[$],J=this.#W(Z)?Z.__staleWhileFetching:Z;if(J===void 0)continue;if(Q(J,this.#K[$],this))return this.get(this.#K[$],X)}}forEach(Q,X=this){for(let $ of this.#v()){let Z=this.#Z[$],J=this.#W(Z)?Z.__staleWhileFetching:Z;if(J===void 0)continue;Q.call(X,J,this.#K[$],this)}}rforEach(Q,X=this){for(let $ of this.#D()){let Z=this.#Z[$],J=this.#W(Z)?Z.__staleWhileFetching:Z;if(J===void 0)continue;Q.call(X,J,this.#K[$],this)}}purgeStale(){let Q=!1;for(let X of this.#D({allowStale:!0}))if(this.#F(X))this.#T(this.#K[X],"expire"),Q=!0;return Q}info(Q){let X=this.#Y.get(Q);if(X===void 0)return;let $=this.#Z[X],Z=this.#W($)?$.__staleWhileFetching:$;if(Z===void 0)return;let J={value:Z};if(this.#I&&this.#L){let V=this.#I[X],q=this.#L[X];if(V&&q){let _=V-(q0.now()-q);J.ttl=_,J.start=Date.now()}}if(this.#P)J.size=this.#P[X];return J}dump(){let Q=[];for(let X of this.#v({allowStale:!0})){let $=this.#K[X],Z=this.#Z[X],J=this.#W(Z)?Z.__staleWhileFetching:Z;if(J===void 0||$===void 0)continue;let V={value:J};if(this.#I&&this.#L){V.ttl=this.#I[X];let q=q0.now()-this.#L[X];V.start=Math.floor(Date.now()-q)}if(this.#P)V.size=this.#P[X];Q.unshift([$,V])}return Q}load(Q){this.clear();for(let[X,$]of Q){if($.start){let Z=Date.now()-$.start;$.start=q0.now()-Z}this.set(X,$.value,$)}}set(Q,X,$={}){if(X===void 0)return this.delete(Q),this;let{ttl:Z=this.ttl,start:J,noDisposeOnSet:V=this.noDisposeOnSet,sizeCalculation:q=this.sizeCalculation,status:_}=$,{noUpdateTTL:Y=this.noUpdateTTL}=$,H=this.#h(Q,X,$.size||0,q);if(this.maxEntrySize&&H>this.maxEntrySize){if(_)_.set="miss",_.maxEntrySizeExceeded=!0;return this.#T(Q,"set"),this}let K=this.#_===0?void 0:this.#Y.get(Q);if(K===void 0){if(K=this.#_===0?this.#z:this.#w.length!==0?this.#w.pop():this.#_===this.#Q?this.#m(!1):this.#_,this.#K[K]=Q,this.#Z[K]=X,this.#Y.set(Q,K),this.#G[this.#z]=K,this.#B[K]=this.#z,this.#z=K,this.#_++,this.#x(K,H,_),_)_.set="add";if(Y=!1,this.#k)this.#J?.(X,Q,"add")}else{this.#f(K);let G=this.#Z[K];if(X!==G){if(this.#N&&this.#W(G)){G.__abortController.abort(Error("replaced"));let{__staleWhileFetching:W}=G;if(W!==void 0&&!V){if(this.#A)this.#$?.(W,Q,"set");if(this.#C)this.#R?.push([W,Q,"set"])}}else if(!V){if(this.#A)this.#$?.(G,Q,"set");if(this.#C)this.#R?.push([G,Q,"set"])}if(this.#u(K),this.#x(K,H,_),this.#Z[K]=X,_){_.set="replace";let W=G&&this.#W(G)?G.__staleWhileFetching:G;if(W!==void 0)_.oldValue=W}}else if(_)_.set="update";if(this.#k)this.onInsert?.(X,Q,X===G?"update":"replace")}if(Z!==0&&!this.#I)this.#V();if(this.#I){if(!Y)this.#S(K,Z,J);if(_)this.#O(_,K)}if(!V&&this.#C&&this.#R){let G=this.#R,W;while(W=G?.shift())this.#q?.(...W)}return this}pop(){try{while(this.#_){let Q=this.#Z[this.#j];if(this.#m(!0),this.#W(Q)){if(Q.__staleWhileFetching)return Q.__staleWhileFetching}else if(Q!==void 0)return Q}}finally{if(this.#C&&this.#R){let Q=this.#R,X;while(X=Q?.shift())this.#q?.(...X)}}}#m(Q){let X=this.#j,$=this.#K[X],Z=this.#Z[X];if(this.#N&&this.#W(Z))Z.__abortController.abort(Error("evicted"));else if(this.#A||this.#C){if(this.#A)this.#$?.(Z,$,"evict");if(this.#C)this.#R?.push([Z,$,"evict"])}if(this.#u(X),Q)this.#K[X]=void 0,this.#Z[X]=void 0,this.#w.push(X);if(this.#_===1)this.#j=this.#z=0,this.#w.length=0;else this.#j=this.#G[X];return this.#Y.delete($),this.#_--,X}has(Q,X={}){let{updateAgeOnHas:$=this.updateAgeOnHas,status:Z}=X,J=this.#Y.get(Q);if(J!==void 0){let V=this.#Z[J];if(this.#W(V)&&V.__staleWhileFetching===void 0)return!1;if(!this.#F(J)){if($)this.#b(J);if(Z)Z.has="hit",this.#O(Z,J);return!0}else if(Z)Z.has="stale",this.#O(Z,J)}else if(Z)Z.has="miss";return!1}peek(Q,X={}){let{allowStale:$=this.allowStale}=X,Z=this.#Y.get(Q);if(Z===void 0||!$&&this.#F(Z))return;let J=this.#Z[Z];return this.#W(J)?J.__staleWhileFetching:J}#E(Q,X,$,Z){let J=X===void 0?void 0:this.#Z[X];if(this.#W(J))return J;let V=new D0,{signal:q}=$;q?.addEventListener("abort",()=>V.abort(q.reason),{signal:V.signal});let _={signal:V.signal,options:$,context:Z},Y=(j,U=!1)=>{let{aborted:B}=V.signal,C=$.ignoreFetchAbort&&j!==void 0;if($.status)if(B&&!U){if($.status.fetchAborted=!0,$.status.fetchError=V.signal.reason,C)$.status.fetchAbortIgnored=!0}else $.status.fetchResolved=!0;if(B&&!C&&!U)return K(V.signal.reason);let M=W;if(this.#Z[X]===W)if(j===void 0)if(M.__staleWhileFetching)this.#Z[X]=M.__staleWhileFetching;else this.#T(Q,"fetch");else{if($.status)$.status.fetchUpdated=!0;this.set(Q,j,_.options)}return j},H=(j)=>{if($.status)$.status.fetchRejected=!0,$.status.fetchError=j;return K(j)},K=(j)=>{let{aborted:U}=V.signal,B=U&&$.allowStaleOnFetchAbort,C=B||$.allowStaleOnFetchRejection,M=C||$.noDeleteOnFetchRejection,w=W;if(this.#Z[X]===W){if(!M||w.__staleWhileFetching===void 0)this.#T(Q,"fetch");else if(!B)this.#Z[X]=w.__staleWhileFetching}if(C){if($.status&&w.__staleWhileFetching!==void 0)$.status.returnedStale=!0;return w.__staleWhileFetching}else if(w.__returned===w)throw j},G=(j,U)=>{let B=this.#M?.(Q,J,_);if(B&&B instanceof Promise)B.then((C)=>j(C===void 0?void 0:C),U);V.signal.addEventListener("abort",()=>{if(!$.ignoreFetchAbort||$.allowStaleOnFetchAbort){if(j(void 0),$.allowStaleOnFetchAbort)j=(C)=>Y(C,!0)}})};if($.status)$.status.fetchDispatched=!0;let W=new Promise(G).then(Y,H),z=Object.assign(W,{__abortController:V,__staleWhileFetching:J,__returned:void 0});if(X===void 0)this.set(Q,z,{..._.options,status:void 0}),X=this.#Y.get(Q);else this.#Z[X]=z;return z}#W(Q){if(!this.#N)return!1;let X=Q;return!!X&&X instanceof Promise&&X.hasOwnProperty("__staleWhileFetching")&&X.__abortController instanceof D0}async fetch(Q,X={}){let{allowStale:$=this.allowStale,updateAgeOnGet:Z=this.updateAgeOnGet,noDeleteOnStaleGet:J=this.noDeleteOnStaleGet,ttl:V=this.ttl,noDisposeOnSet:q=this.noDisposeOnSet,size:_=0,sizeCalculation:Y=this.sizeCalculation,noUpdateTTL:H=this.noUpdateTTL,noDeleteOnFetchRejection:K=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:G=this.allowStaleOnFetchRejection,ignoreFetchAbort:W=this.ignoreFetchAbort,allowStaleOnFetchAbort:z=this.allowStaleOnFetchAbort,context:j,forceRefresh:U=!1,status:B,signal:C}=X;if(!this.#N){if(B)B.fetch="get";return this.get(Q,{allowStale:$,updateAgeOnGet:Z,noDeleteOnStaleGet:J,status:B})}let M={allowStale:$,updateAgeOnGet:Z,noDeleteOnStaleGet:J,ttl:V,noDisposeOnSet:q,size:_,sizeCalculation:Y,noUpdateTTL:H,noDeleteOnFetchRejection:K,allowStaleOnFetchRejection:G,allowStaleOnFetchAbort:z,ignoreFetchAbort:W,status:B,signal:C},w=this.#Y.get(Q);if(w===void 0){if(B)B.fetch="miss";let R=this.#E(Q,w,M,j);return R.__returned=R}else{let R=this.#Z[w];if(this.#W(R)){let y=$&&R.__staleWhileFetching!==void 0;if(B){if(B.fetch="inflight",y)B.returnedStale=!0}return y?R.__staleWhileFetching:R.__returned=R}let b=this.#F(w);if(!U&&!b){if(B)B.fetch="hit";if(this.#f(w),Z)this.#b(w);if(B)this.#O(B,w);return R}let F=this.#E(Q,w,M,j),J0=F.__staleWhileFetching!==void 0&&$;if(B){if(B.fetch=b?"stale":"refresh",J0&&b)B.returnedStale=!0}return J0?F.__staleWhileFetching:F.__returned=F}}async forceFetch(Q,X={}){let $=await this.fetch(Q,X);if($===void 0)throw Error("fetch() returned undefined");return $}memo(Q,X={}){let $=this.#U;if(!$)throw Error("no memoMethod provided to constructor");let{context:Z,forceRefresh:J,...V}=X,q=this.get(Q,V);if(!J&&q!==void 0)return q;let _=$(Q,q,{options:V,context:Z});return this.set(Q,_,V),_}get(Q,X={}){let{allowStale:$=this.allowStale,updateAgeOnGet:Z=this.updateAgeOnGet,noDeleteOnStaleGet:J=this.noDeleteOnStaleGet,status:V}=X,q=this.#Y.get(Q);if(q!==void 0){let _=this.#Z[q],Y=this.#W(_);if(V)this.#O(V,q);if(this.#F(q)){if(V)V.get="stale";if(!Y){if(!J)this.#T(Q,"expire");if(V&&$)V.returnedStale=!0;return $?_:void 0}else{if(V&&$&&_.__staleWhileFetching!==void 0)V.returnedStale=!0;return $?_.__staleWhileFetching:void 0}}else{if(V)V.get="hit";if(Y)return _.__staleWhileFetching;if(this.#f(q),Z)this.#b(q);return _}}else if(V)V.get="miss"}#c(Q,X){this.#B[X]=Q,this.#G[Q]=X}#f(Q){if(Q!==this.#z){if(Q===this.#j)this.#j=this.#G[Q];else this.#c(this.#B[Q],this.#G[Q]);this.#c(this.#z,Q),this.#z=Q}}delete(Q){return this.#T(Q,"delete")}#T(Q,X){let $=!1;if(this.#_!==0){let Z=this.#Y.get(Q);if(Z!==void 0)if($=!0,this.#_===1)this.#y(X);else{this.#u(Z);let J=this.#Z[Z];if(this.#W(J))J.__abortController.abort(Error("deleted"));else if(this.#A||this.#C){if(this.#A)this.#$?.(J,Q,X);if(this.#C)this.#R?.push([J,Q,X])}if(this.#Y.delete(Q),this.#K[Z]=void 0,this.#Z[Z]=void 0,Z===this.#z)this.#z=this.#B[Z];else if(Z===this.#j)this.#j=this.#G[Z];else{let V=this.#B[Z];this.#G[V]=this.#G[Z];let q=this.#G[Z];this.#B[q]=this.#B[Z]}this.#_--,this.#w.push(Z)}}if(this.#C&&this.#R?.length){let Z=this.#R,J;while(J=Z?.shift())this.#q?.(...J)}return $}clear(){return this.#y("delete")}#y(Q){for(let X of this.#D({allowStale:!0})){let $=this.#Z[X];if(this.#W($))$.__abortController.abort(Error("deleted"));else{let Z=this.#K[X];if(this.#A)this.#$?.($,Z,Q);if(this.#C)this.#R?.push([$,Z,Q])}}if(this.#Y.clear(),this.#Z.fill(void 0),this.#K.fill(void 0),this.#I&&this.#L)this.#I.fill(0),this.#L.fill(0);if(this.#P)this.#P.fill(0);if(this.#j=0,this.#z=0,this.#w.length=0,this.#H=0,this.#_=0,this.#C&&this.#R){let X=this.#R,$;while($=X?.shift())this.#q?.(...$)}}}import{posix as NX,win32 as Y8}from"node:path";import{fileURLToPath as vX}from"node:url";import{lstatSync as PX,readdir as DX,readdirSync as kX,readlinkSync as SX,realpathSync as TX}from"fs";import*as bX from"node:fs";import{lstat as EX,readdir as xX,readlink as mX,realpath as fX}from"node:fs/promises";import{EventEmitter as J8}from"node:events";import n8 from"node:stream";import{StringDecoder as BX}from"node:string_decoder";var l8=typeof process==="object"&&process?process:{stdout:null,stderr:null},wX=(Q)=>!!Q&&typeof Q==="object"&&(Q instanceof Q0||Q instanceof n8||CX(Q)||MX(Q)),CX=(Q)=>!!Q&&typeof Q==="object"&&Q instanceof J8&&typeof Q.pipe==="function"&&Q.pipe!==n8.Writable.prototype.pipe,MX=(Q)=>!!Q&&typeof Q==="object"&&Q instanceof J8&&typeof Q.write==="function"&&typeof Q.end==="function",i=Symbol("EOF"),n=Symbol("maybeEmitEnd"),a=Symbol("emittedEnd"),k0=Symbol("emittingEnd"),B0=Symbol("emittedError"),S0=Symbol("closed"),o8=Symbol("read"),T0=Symbol("flush"),p8=Symbol("flushChunk"),h=Symbol("encoding"),Y0=Symbol("decoder"),I=Symbol("flowing"),w0=Symbol("paused"),K0=Symbol("resume"),L=Symbol("buffer"),S=Symbol("pipes"),O=Symbol("bufferLength"),t0=Symbol("bufferPush"),b0=Symbol("bufferShift"),D=Symbol("objectMode"),A=Symbol("destroyed"),Q8=Symbol("error"),X8=Symbol("emitData"),i8=Symbol("emitEnd"),$8=Symbol("emitEnd2"),c=Symbol("async"),Z8=Symbol("abort"),u0=Symbol("aborted"),C0=Symbol("signal"),t=Symbol("dataListeners"),u=Symbol("discarded"),M0=(Q)=>Promise.resolve().then(Q),RX=(Q)=>Q(),AX=(Q)=>Q==="end"||Q==="finish"||Q==="prefinish",IX=(Q)=>Q instanceof ArrayBuffer||!!Q&&typeof Q==="object"&&Q.constructor&&Q.constructor.name==="ArrayBuffer"&&Q.byteLength>=0,LX=(Q)=>!Buffer.isBuffer(Q)&&ArrayBuffer.isView(Q);class V8{src;dest;opts;ondrain;constructor(Q,X,$){this.src=Q,this.dest=X,this.opts=$,this.ondrain=()=>Q[K0](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(Q){}end(){if(this.unpipe(),this.opts.end)this.dest.end()}}class r8 extends V8{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(Q,X,$){super(Q,X,$);this.proxyErrors=(Z)=>X.emit("error",Z),Q.on("error",this.proxyErrors)}}var OX=(Q)=>!!Q.objectMode,FX=(Q)=>!Q.objectMode&&!!Q.encoding&&Q.encoding!=="buffer";class Q0 extends J8{[I]=!1;[w0]=!1;[S]=[];[L]=[];[D];[h];[c];[Y0];[i]=!1;[a]=!1;[k0]=!1;[S0]=!1;[B0]=null;[O]=0;[A]=!1;[C0];[u0]=!1;[t]=0;[u]=!1;writable=!0;readable=!0;constructor(...Q){let X=Q[0]||{};super();if(X.objectMode&&typeof X.encoding==="string")throw TypeError("Encoding and objectMode may not be used together");if(OX(X))this[D]=!0,this[h]=null;else if(FX(X))this[h]=X.encoding,this[D]=!1;else this[D]=!1,this[h]=null;if(this[c]=!!X.async,this[Y0]=this[h]?new BX(this[h]):null,X&&X.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[L]});if(X&&X.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[S]});let{signal:$}=X;if($)if(this[C0]=$,$.aborted)this[Z8]();else $.addEventListener("abort",()=>this[Z8]())}get bufferLength(){return this[O]}get encoding(){return this[h]}set encoding(Q){throw Error("Encoding must be set at instantiation time")}setEncoding(Q){throw Error("Encoding must be set at instantiation time")}get objectMode(){return this[D]}set objectMode(Q){throw Error("objectMode must be set at instantiation time")}get["async"](){return this[c]}set["async"](Q){this[c]=this[c]||!!Q}[Z8](){this[u0]=!0,this.emit("abort",this[C0]?.reason),this.destroy(this[C0]?.reason)}get aborted(){return this[u0]}set aborted(Q){}write(Q,X,$){if(this[u0])return!1;if(this[i])throw Error("write after end");if(this[A])return this.emit("error",Object.assign(Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;if(typeof X==="function")$=X,X="utf8";if(!X)X="utf8";let Z=this[c]?M0:RX;if(!this[D]&&!Buffer.isBuffer(Q)){if(LX(Q))Q=Buffer.from(Q.buffer,Q.byteOffset,Q.byteLength);else if(IX(Q))Q=Buffer.from(Q);else if(typeof Q!=="string")throw Error("Non-contiguous data written to non-objectMode stream")}if(this[D]){if(this[I]&&this[O]!==0)this[T0](!0);if(this[I])this.emit("data",Q);else this[t0](Q);if(this[O]!==0)this.emit("readable");if($)Z($);return this[I]}if(!Q.length){if(this[O]!==0)this.emit("readable");if($)Z($);return this[I]}if(typeof Q==="string"&&!(X===this[h]&&!this[Y0]?.lastNeed))Q=Buffer.from(Q,X);if(Buffer.isBuffer(Q)&&this[h])Q=this[Y0].write(Q);if(this[I]&&this[O]!==0)this[T0](!0);if(this[I])this.emit("data",Q);else this[t0](Q);if(this[O]!==0)this.emit("readable");if($)Z($);return this[I]}read(Q){if(this[A])return null;if(this[u]=!1,this[O]===0||Q===0||Q&&Q>this[O])return this[n](),null;if(this[D])Q=null;if(this[L].length>1&&!this[D])this[L]=[this[h]?this[L].join(""):Buffer.concat(this[L],this[O])];let X=this[o8](Q||null,this[L][0]);return this[n](),X}[o8](Q,X){if(this[D])this[b0]();else{let $=X;if(Q===$.length||Q===null)this[b0]();else if(typeof $==="string")this[L][0]=$.slice(Q),X=$.slice(0,Q),this[O]-=Q;else this[L][0]=$.subarray(Q),X=$.subarray(0,Q),this[O]-=Q}if(this.emit("data",X),!this[L].length&&!this[i])this.emit("drain");return X}end(Q,X,$){if(typeof Q==="function")$=Q,Q=void 0;if(typeof X==="function")$=X,X="utf8";if(Q!==void 0)this.write(Q,X);if($)this.once("end",$);if(this[i]=!0,this.writable=!1,this[I]||!this[w0])this[n]();return this}[K0](){if(this[A])return;if(!this[t]&&!this[S].length)this[u]=!0;if(this[w0]=!1,this[I]=!0,this.emit("resume"),this[L].length)this[T0]();else if(this[i])this[n]();else this.emit("drain")}resume(){return this[K0]()}pause(){this[I]=!1,this[w0]=!0,this[u]=!1}get destroyed(){return this[A]}get flowing(){return this[I]}get paused(){return this[w0]}[t0](Q){if(this[D])this[O]+=1;else this[O]+=Q.length;this[L].push(Q)}[b0](){if(this[D])this[O]-=1;else this[O]-=this[L][0].length;return this[L].shift()}[T0](Q=!1){do;while(this[p8](this[b0]())&&this[L].length);if(!Q&&!this[L].length&&!this[i])this.emit("drain")}[p8](Q){return this.emit("data",Q),this[I]}pipe(Q,X){if(this[A])return Q;this[u]=!1;let $=this[a];if(X=X||{},Q===l8.stdout||Q===l8.stderr)X.end=!1;else X.end=X.end!==!1;if(X.proxyErrors=!!X.proxyErrors,$){if(X.end)Q.end()}else if(this[S].push(!X.proxyErrors?new V8(this,Q,X):new r8(this,Q,X)),this[c])M0(()=>this[K0]());else this[K0]();return Q}unpipe(Q){let X=this[S].find(($)=>$.dest===Q);if(X){if(this[S].length===1){if(this[I]&&this[t]===0)this[I]=!1;this[S]=[]}else this[S].splice(this[S].indexOf(X),1);X.unpipe()}}addListener(Q,X){return this.on(Q,X)}on(Q,X){let $=super.on(Q,X);if(Q==="data"){if(this[u]=!1,this[t]++,!this[S].length&&!this[I])this[K0]()}else if(Q==="readable"&&this[O]!==0)super.emit("readable");else if(AX(Q)&&this[a])super.emit(Q),this.removeAllListeners(Q);else if(Q==="error"&&this[B0]){let Z=X;if(this[c])M0(()=>Z.call(this,this[B0]));else Z.call(this,this[B0])}return $}removeListener(Q,X){return this.off(Q,X)}off(Q,X){let $=super.off(Q,X);if(Q==="data"){if(this[t]=this.listeners("data").length,this[t]===0&&!this[u]&&!this[S].length)this[I]=!1}return $}removeAllListeners(Q){let X=super.removeAllListeners(Q);if(Q==="data"||Q===void 0){if(this[t]=0,!this[u]&&!this[S].length)this[I]=!1}return X}get emittedEnd(){return this[a]}[n](){if(!this[k0]&&!this[a]&&!this[A]&&this[L].length===0&&this[i]){if(this[k0]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[S0])this.emit("close");this[k0]=!1}}emit(Q,...X){let $=X[0];if(Q!=="error"&&Q!=="close"&&Q!==A&&this[A])return!1;else if(Q==="data")return!this[D]&&!$?!1:this[c]?(M0(()=>this[X8]($)),!0):this[X8]($);else if(Q==="end")return this[i8]();else if(Q==="close"){if(this[S0]=!0,!this[a]&&!this[A])return!1;let J=super.emit("close");return this.removeAllListeners("close"),J}else if(Q==="error"){this[B0]=$,super.emit(Q8,$);let J=!this[C0]||this.listeners("error").length?super.emit("error",$):!1;return this[n](),J}else if(Q==="resume"){let J=super.emit("resume");return this[n](),J}else if(Q==="finish"||Q==="prefinish"){let J=super.emit(Q);return this.removeAllListeners(Q),J}let Z=super.emit(Q,...X);return this[n](),Z}[X8](Q){for(let $ of this[S])if($.dest.write(Q)===!1)this.pause();let X=this[u]?!1:super.emit("data",Q);return this[n](),X}[i8](){if(this[a])return!1;return this[a]=!0,this.readable=!1,this[c]?(M0(()=>this[$8]()),!0):this[$8]()}[$8](){if(this[Y0]){let X=this[Y0].end();if(X){for(let $ of this[S])$.dest.write(X);if(!this[u])super.emit("data",X)}}for(let X of this[S])X.end();let Q=super.emit("end");return this.removeAllListeners("end"),Q}async collect(){let Q=Object.assign([],{dataLength:0});if(!this[D])Q.dataLength=0;let X=this.promise();return this.on("data",($)=>{if(Q.push($),!this[D])Q.dataLength+=$.length}),await X,Q}async concat(){if(this[D])throw Error("cannot concat in objectMode");let Q=await this.collect();return this[h]?Q.join(""):Buffer.concat(Q,Q.dataLength)}async promise(){return new Promise((Q,X)=>{this.on(A,()=>X(Error("stream destroyed"))),this.on("error",($)=>X($)),this.on("end",()=>Q())})}[Symbol.asyncIterator](){this[u]=!1;let Q=!1,X=async()=>{return this.pause(),Q=!0,{value:void 0,done:!0}};return{next:()=>{if(Q)return X();let Z=this.read();if(Z!==null)return Promise.resolve({done:!1,value:Z});if(this[i])return X();let J,V,q=(K)=>{this.off("data",_),this.off("end",Y),this.off(A,H),X(),V(K)},_=(K)=>{this.off("error",q),this.off("end",Y),this.off(A,H),this.pause(),J({value:K,done:!!this[i]})},Y=()=>{this.off("error",q),this.off("data",_),this.off(A,H),X(),J({done:!0,value:void 0})},H=()=>q(Error("stream destroyed"));return new Promise((K,G)=>{V=G,J=K,this.once(A,H),this.once("error",q),this.once("end",Y),this.once("data",_)})},throw:X,return:X,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[u]=!1;let Q=!1,X=()=>{return this.pause(),this.off(Q8,X),this.off(A,X),this.off("end",X),Q=!0,{done:!0,value:void 0}},$=()=>{if(Q)return X();let Z=this.read();return Z===null?X():{done:!1,value:Z}};return this.once("end",X),this.once(Q8,X),this.once(A,X),{next:$,throw:X,return:X,[Symbol.iterator](){return this}}}destroy(Q){if(this[A]){if(Q)this.emit("error",Q);else this.emit(A);return this}this[A]=!0,this[u]=!0,this[L].length=0,this[O]=0;let X=this;if(typeof X.close==="function"&&!this[S0])X.close();if(Q)this.emit("error",Q);else this.emit(A);return this}static get isStream(){return wX}}var uX=TX.native,A0={lstatSync:PX,readdir:DX,readdirSync:kX,readlinkSync:SX,realpathSync:uX,promises:{lstat:EX,readdir:xX,readlink:mX,realpath:fX}},QQ=(Q)=>!Q||Q===A0||Q===bX?A0:{...A0,...Q,promises:{...A0.promises,...Q.promises||{}}},XQ=/^\\\\\?\\([a-z]:)\\?$/i,yX=(Q)=>Q.replace(/\//g,"\\").replace(XQ,"$1\\"),gX=/[\\\/]/,f=0,$Q=1,ZQ=2,l=4,JQ=6,VQ=8,X0=10,qQ=12,m=15,R0=~m,q8=16,a8=32,I0=64,d=128,E0=256,m0=512,s8=I0|d|m0,hX=1023,_8=(Q)=>Q.isFile()?VQ:Q.isDirectory()?l:Q.isSymbolicLink()?X0:Q.isCharacterDevice()?ZQ:Q.isBlockDevice()?JQ:Q.isSocket()?qQ:Q.isFIFO()?$Q:f,e8=new Map,L0=(Q)=>{let X=e8.get(Q);if(X)return X;let $=Q.normalize("NFKD");return e8.set(Q,$),$},t8=new Map,x0=(Q)=>{let X=t8.get(Q);if(X)return X;let $=L0(Q.toLowerCase());return t8.set(Q,$),$};class K8 extends U0{constructor(){super({max:256})}}class _Q extends U0{constructor(Q=16384){super({maxSize:Q,sizeCalculation:(X)=>X.length+1})}}var YQ=Symbol("PathScurry setAsCwd");class T{name;root;roots;parent;nocase;isCWD=!1;#Q;#X;get dev(){return this.#X}#$;get mode(){return this.#$}#J;get nlink(){return this.#J}#q;get uid(){return this.#q}#M;get gid(){return this.#M}#U;get rdev(){return this.#U}#_;get blksize(){return this.#_}#H;get ino(){return this.#H}#Y;get size(){return this.#Y}#K;get blocks(){return this.#K}#Z;get atimeMs(){return this.#Z}#G;get mtimeMs(){return this.#G}#B;get ctimeMs(){return this.#B}#j;get birthtimeMs(){return this.#j}#z;get atime(){return this.#z}#w;get mtime(){return this.#w}#R;get ctime(){return this.#R}#P;get birthtime(){return this.#P}#L;#I;#A;#N;#C;#k;#V;#b;#O;#S;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(Q,X=f,$,Z,J,V,q){if(this.name=Q,this.#L=J?x0(Q):L0(Q),this.#V=X&hX,this.nocase=J,this.roots=Z,this.root=$||this,this.#b=V,this.#A=q.fullpath,this.#C=q.relative,this.#k=q.relativePosix,this.parent=q.parent,this.parent)this.#Q=this.parent.#Q;else this.#Q=QQ(q.fs)}depth(){if(this.#I!==void 0)return this.#I;if(!this.parent)return this.#I=0;return this.#I=this.parent.depth()+1}childrenCache(){return this.#b}resolve(Q){if(!Q)return this;let X=this.getRootString(Q),Z=Q.substring(X.length).split(this.splitSep);return X?this.getRoot(X).#F(Z):this.#F(Z)}#F(Q){let X=this;for(let $ of Q)X=X.child($);return X}children(){let Q=this.#b.get(this);if(Q)return Q;let X=Object.assign([],{provisional:0});return this.#b.set(this,X),this.#V&=~q8,X}child(Q,X){if(Q===""||Q===".")return this;if(Q==="..")return this.parent||this;let $=this.children(),Z=this.nocase?x0(Q):L0(Q);for(let _ of $)if(_.#L===Z)return _;let J=this.parent?this.sep:"",V=this.#A?this.#A+J+Q:void 0,q=this.newChild(Q,f,{...X,parent:this,fullpath:V});if(!this.canReaddir())q.#V|=d;return $.push(q),q}relative(){if(this.isCWD)return"";if(this.#C!==void 0)return this.#C;let Q=this.name,X=this.parent;if(!X)return this.#C=this.name;let $=X.relative();return $+(!$||!X.parent?"":this.sep)+Q}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#k!==void 0)return this.#k;let Q=this.name,X=this.parent;if(!X)return this.#k=this.fullpathPosix();let $=X.relativePosix();return $+(!$||!X.parent?"":"/")+Q}fullpath(){if(this.#A!==void 0)return this.#A;let Q=this.name,X=this.parent;if(!X)return this.#A=this.name;let Z=X.fullpath()+(!X.parent?"":this.sep)+Q;return this.#A=Z}fullpathPosix(){if(this.#N!==void 0)return this.#N;if(this.sep==="/")return this.#N=this.fullpath();if(!this.parent){let Z=this.fullpath().replace(/\\/g,"/");if(/^[a-z]:\//i.test(Z))return this.#N=`//?/${Z}`;else return this.#N=Z}let Q=this.parent,X=Q.fullpathPosix(),$=X+(!X||!Q.parent?"":"/")+this.name;return this.#N=$}isUnknown(){return(this.#V&m)===f}isType(Q){return this[`is${Q}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#V&m)===VQ}isDirectory(){return(this.#V&m)===l}isCharacterDevice(){return(this.#V&m)===ZQ}isBlockDevice(){return(this.#V&m)===JQ}isFIFO(){return(this.#V&m)===$Q}isSocket(){return(this.#V&m)===qQ}isSymbolicLink(){return(this.#V&X0)===X0}lstatCached(){return this.#V&a8?this:void 0}readlinkCached(){return this.#O}realpathCached(){return this.#S}readdirCached(){let Q=this.children();return Q.slice(0,Q.provisional)}canReadlink(){if(this.#O)return!0;if(!this.parent)return!1;let Q=this.#V&m;return!(Q!==f&&Q!==X0||this.#V&E0||this.#V&d)}calledReaddir(){return!!(this.#V&q8)}isENOENT(){return!!(this.#V&d)}isNamed(Q){return!this.nocase?this.#L===L0(Q):this.#L===x0(Q)}async readlink(){let Q=this.#O;if(Q)return Q;if(!this.canReadlink())return;if(!this.parent)return;try{let X=await this.#Q.promises.readlink(this.fullpath()),$=(await this.parent.realpath())?.resolve(X);if($)return this.#O=$}catch(X){this.#m(X.code);return}}readlinkSync(){let Q=this.#O;if(Q)return Q;if(!this.canReadlink())return;if(!this.parent)return;try{let X=this.#Q.readlinkSync(this.fullpath()),$=this.parent.realpathSync()?.resolve(X);if($)return this.#O=$}catch(X){this.#m(X.code);return}}#g(Q){this.#V|=q8;for(let X=Q.provisional;X<Q.length;X++){let $=Q[X];if($)$.#u()}}#u(){if(this.#V&d)return;this.#V=(this.#V|d)&R0,this.#x()}#x(){let Q=this.children();Q.provisional=0;for(let X of Q)X.#u()}#h(){this.#V|=m0,this.#v()}#v(){if(this.#V&I0)return;let Q=this.#V;if((Q&m)===l)Q&=R0;this.#V=Q|I0,this.#x()}#D(Q=""){if(Q==="ENOTDIR"||Q==="EPERM")this.#v();else if(Q==="ENOENT")this.#u();else this.children().provisional=0}#d(Q=""){if(Q==="ENOTDIR")this.parent.#v();else if(Q==="ENOENT")this.#u()}#m(Q=""){let X=this.#V;if(X|=E0,Q==="ENOENT")X|=d;if(Q==="EINVAL"||Q==="UNKNOWN")X&=R0;if(this.#V=X,Q==="ENOTDIR"&&this.parent)this.parent.#v()}#E(Q,X){return this.#c(Q,X)||this.#W(Q,X)}#W(Q,X){let $=_8(Q),Z=this.newChild(Q.name,$,{parent:this}),J=Z.#V&m;if(J!==l&&J!==X0&&J!==f)Z.#V|=I0;return X.unshift(Z),X.provisional++,Z}#c(Q,X){for(let $=X.provisional;$<X.length;$++){let Z=X[$];if((this.nocase?x0(Q.name):L0(Q.name))!==Z.#L)continue;return this.#f(Q,Z,$,X)}}#f(Q,X,$,Z){let J=X.name;if(X.#V=X.#V&R0|_8(Q),J!==Q.name)X.name=Q.name;if($!==Z.provisional){if($===Z.length-1)Z.pop();else Z.splice($,1);Z.unshift(X)}return Z.provisional++,X}async lstat(){if((this.#V&d)===0)try{return this.#T(await this.#Q.promises.lstat(this.fullpath())),this}catch(Q){this.#d(Q.code)}}lstatSync(){if((this.#V&d)===0)try{return this.#T(this.#Q.lstatSync(this.fullpath())),this}catch(Q){this.#d(Q.code)}}#T(Q){let{atime:X,atimeMs:$,birthtime:Z,birthtimeMs:J,blksize:V,blocks:q,ctime:_,ctimeMs:Y,dev:H,gid:K,ino:G,mode:W,mtime:z,mtimeMs:j,nlink:U,rdev:B,size:C,uid:M}=Q;this.#z=X,this.#Z=$,this.#P=Z,this.#j=J,this.#_=V,this.#K=q,this.#R=_,this.#B=Y,this.#X=H,this.#M=K,this.#H=G,this.#$=W,this.#w=z,this.#G=j,this.#J=U,this.#U=B,this.#Y=C,this.#q=M;let w=_8(Q);if(this.#V=this.#V&R0|w|a8,w!==f&&w!==l&&w!==X0)this.#V|=I0}#y=[];#o=!1;#p(Q){this.#o=!1;let X=this.#y.slice();this.#y.length=0,X.forEach(($)=>$(null,Q))}readdirCB(Q,X=!1){if(!this.canReaddir()){if(X)Q(null,[]);else queueMicrotask(()=>Q(null,[]));return}let $=this.children();if(this.calledReaddir()){let J=$.slice(0,$.provisional);if(X)Q(null,J);else queueMicrotask(()=>Q(null,J));return}if(this.#y.push(Q),this.#o)return;this.#o=!0;let Z=this.fullpath();this.#Q.readdir(Z,{withFileTypes:!0},(J,V)=>{if(J)this.#D(J.code),$.provisional=0;else{for(let q of V)this.#E(q,$);this.#g($)}this.#p($.slice(0,$.provisional));return})}#l;async readdir(){if(!this.canReaddir())return[];let Q=this.children();if(this.calledReaddir())return Q.slice(0,Q.provisional);let X=this.fullpath();if(this.#l)await this.#l;else{let $=()=>{};this.#l=new Promise((Z)=>$=Z);try{for(let Z of await this.#Q.promises.readdir(X,{withFileTypes:!0}))this.#E(Z,Q);this.#g(Q)}catch(Z){this.#D(Z.code),Q.provisional=0}this.#l=void 0,$()}return Q.slice(0,Q.provisional)}readdirSync(){if(!this.canReaddir())return[];let Q=this.children();if(this.calledReaddir())return Q.slice(0,Q.provisional);let X=this.fullpath();try{for(let $ of this.#Q.readdirSync(X,{withFileTypes:!0}))this.#E($,Q);this.#g(Q)}catch($){this.#D($.code),Q.provisional=0}return Q.slice(0,Q.provisional)}canReaddir(){if(this.#V&s8)return!1;let Q=m&this.#V;if(!(Q===f||Q===l||Q===X0))return!1;return!0}shouldWalk(Q,X){return(this.#V&l)===l&&!(this.#V&s8)&&!Q.has(this)&&(!X||X(this))}async realpath(){if(this.#S)return this.#S;if((m0|E0|d)&this.#V)return;try{let Q=await this.#Q.promises.realpath(this.fullpath());return this.#S=this.resolve(Q)}catch(Q){this.#h()}}realpathSync(){if(this.#S)return this.#S;if((m0|E0|d)&this.#V)return;try{let Q=this.#Q.realpathSync(this.fullpath());return this.#S=this.resolve(Q)}catch(Q){this.#h()}}[YQ](Q){if(Q===this)return;Q.isCWD=!1,this.isCWD=!0;let X=new Set([]),$=[],Z=this;while(Z&&Z.parent)X.add(Z),Z.#C=$.join(this.sep),Z.#k=$.join("/"),Z=Z.parent,$.push("..");Z=Q;while(Z&&Z.parent&&!X.has(Z))Z.#C=void 0,Z.#k=void 0,Z=Z.parent}}class f0 extends T{sep="\\";splitSep=gX;constructor(Q,X=f,$,Z,J,V,q){super(Q,X,$,Z,J,V,q)}newChild(Q,X=f,$={}){return new f0(Q,X,this.root,this.roots,this.nocase,this.childrenCache(),$)}getRootString(Q){return Y8.parse(Q).root}getRoot(Q){if(Q=yX(Q.toUpperCase()),Q===this.root.name)return this.root;for(let[X,$]of Object.entries(this.roots))if(this.sameRoot(Q,X))return this.roots[Q]=$;return this.roots[Q]=new O0(Q,this).root}sameRoot(Q,X=this.root.name){return Q=Q.toUpperCase().replace(/\//g,"\\").replace(XQ,"$1\\"),Q===X}}class y0 extends T{splitSep="/";sep="/";constructor(Q,X=f,$,Z,J,V,q){super(Q,X,$,Z,J,V,q)}getRootString(Q){return Q.startsWith("/")?"/":""}getRoot(Q){return this.root}newChild(Q,X=f,$={}){return new y0(Q,X,this.root,this.roots,this.nocase,this.childrenCache(),$)}}class H8{root;rootPath;roots;cwd;#Q;#X;#$;nocase;#J;constructor(Q=process.cwd(),X,$,{nocase:Z,childrenCacheSize:J=16384,fs:V=A0}={}){if(this.#J=QQ(V),Q instanceof URL||Q.startsWith("file://"))Q=vX(Q);let q=X.resolve(Q);this.roots=Object.create(null),this.rootPath=this.parseRootPath(q),this.#Q=new K8,this.#X=new K8,this.#$=new _Q(J);let _=q.substring(this.rootPath.length).split($);if(_.length===1&&!_[0])_.pop();if(Z===void 0)throw TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=Z,this.root=this.newRoot(this.#J),this.roots[this.rootPath]=this.root;let Y=this.root,H=_.length-1,K=X.sep,G=this.rootPath,W=!1;for(let z of _){let j=H--;Y=Y.child(z,{relative:Array(j).fill("..").join(K),relativePosix:Array(j).fill("..").join("/"),fullpath:G+=(W?"":K)+z}),W=!0}this.cwd=Y}depth(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.depth()}childrenCache(){return this.#$}resolve(...Q){let X="";for(let J=Q.length-1;J>=0;J--){let V=Q[J];if(!V||V===".")continue;if(X=X?`${V}/${X}`:V,this.isAbsolute(V))break}let $=this.#Q.get(X);if($!==void 0)return $;let Z=this.cwd.resolve(X).fullpath();return this.#Q.set(X,Z),Z}resolvePosix(...Q){let X="";for(let J=Q.length-1;J>=0;J--){let V=Q[J];if(!V||V===".")continue;if(X=X?`${V}/${X}`:V,this.isAbsolute(V))break}let $=this.#X.get(X);if($!==void 0)return $;let Z=this.cwd.resolve(X).fullpathPosix();return this.#X.set(X,Z),Z}relative(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.relative()}relativePosix(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.relativePosix()}basename(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.name}dirname(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return(Q.parent||Q).fullpath()}async readdir(Q=this.cwd,X={withFileTypes:!0}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q,Q=this.cwd;let{withFileTypes:$}=X;if(!Q.canReaddir())return[];else{let Z=await Q.readdir();return $?Z:Z.map((J)=>J.name)}}readdirSync(Q=this.cwd,X={withFileTypes:!0}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q,Q=this.cwd;let{withFileTypes:$=!0}=X;if(!Q.canReaddir())return[];else if($)return Q.readdirSync();else return Q.readdirSync().map((Z)=>Z.name)}async lstat(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.lstat()}lstatSync(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.lstatSync()}async readlink(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q.withFileTypes,Q=this.cwd;let $=await Q.readlink();return X?$:$?.fullpath()}readlinkSync(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q.withFileTypes,Q=this.cwd;let $=Q.readlinkSync();return X?$:$?.fullpath()}async realpath(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q.withFileTypes,Q=this.cwd;let $=await Q.realpath();return X?$:$?.fullpath()}realpathSync(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q.withFileTypes,Q=this.cwd;let $=Q.realpathSync();return X?$:$?.fullpath()}async walk(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q,Q=this.cwd;let{withFileTypes:$=!0,follow:Z=!1,filter:J,walkFilter:V}=X,q=[];if(!J||J(Q))q.push($?Q:Q.fullpath());let _=new Set,Y=(K,G)=>{_.add(K),K.readdirCB((W,z)=>{if(W)return G(W);let j=z.length;if(!j)return G();let U=()=>{if(--j===0)G()};for(let B of z){if(!J||J(B))q.push($?B:B.fullpath());if(Z&&B.isSymbolicLink())B.realpath().then((C)=>C?.isUnknown()?C.lstat():C).then((C)=>C?.shouldWalk(_,V)?Y(C,U):U());else if(B.shouldWalk(_,V))Y(B,U);else U()}},!0)},H=Q;return new Promise((K,G)=>{Y(H,(W)=>{if(W)return G(W);K(q)})})}walkSync(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q,Q=this.cwd;let{withFileTypes:$=!0,follow:Z=!1,filter:J,walkFilter:V}=X,q=[];if(!J||J(Q))q.push($?Q:Q.fullpath());let _=new Set([Q]);for(let Y of _){let H=Y.readdirSync();for(let K of H){if(!J||J(K))q.push($?K:K.fullpath());let G=K;if(K.isSymbolicLink()){if(!(Z&&(G=K.realpathSync())))continue;if(G.isUnknown())G.lstatSync()}if(G.shouldWalk(_,V))_.add(G)}}return q}[Symbol.asyncIterator](){return this.iterate()}iterate(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q,Q=this.cwd;return this.stream(Q,X)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q,Q=this.cwd;let{withFileTypes:$=!0,follow:Z=!1,filter:J,walkFilter:V}=X;if(!J||J(Q))yield $?Q:Q.fullpath();let q=new Set([Q]);for(let _ of q){let Y=_.readdirSync();for(let H of Y){if(!J||J(H))yield $?H:H.fullpath();let K=H;if(H.isSymbolicLink()){if(!(Z&&(K=H.realpathSync())))continue;if(K.isUnknown())K.lstatSync()}if(K.shouldWalk(q,V))q.add(K)}}}stream(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q,Q=this.cwd;let{withFileTypes:$=!0,follow:Z=!1,filter:J,walkFilter:V}=X,q=new Q0({objectMode:!0});if(!J||J(Q))q.write($?Q:Q.fullpath());let _=new Set,Y=[Q],H=0,K=()=>{let G=!1;while(!G){let W=Y.shift();if(!W){if(H===0)q.end();return}H++,_.add(W);let z=(U,B,C=!1)=>{if(U)return q.emit("error",U);if(Z&&!C){let M=[];for(let w of B)if(w.isSymbolicLink())M.push(w.realpath().then((R)=>R?.isUnknown()?R.lstat():R));if(M.length){Promise.all(M).then(()=>z(null,B,!0));return}}for(let M of B)if(M&&(!J||J(M))){if(!q.write($?M:M.fullpath()))G=!0}H--;for(let M of B){let w=M.realpathCached()||M;if(w.shouldWalk(_,V))Y.push(w)}if(G&&!q.flowing)q.once("drain",K);else if(!j)K()},j=!0;W.readdirCB(z,!0),j=!1}};return K(),q}streamSync(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q,Q=this.cwd;let{withFileTypes:$=!0,follow:Z=!1,filter:J,walkFilter:V}=X,q=new Q0({objectMode:!0}),_=new Set;if(!J||J(Q))q.write($?Q:Q.fullpath());let Y=[Q],H=0,K=()=>{let G=!1;while(!G){let W=Y.shift();if(!W){if(H===0)q.end();return}H++,_.add(W);let z=W.readdirSync();for(let j of z)if(!J||J(j)){if(!q.write($?j:j.fullpath()))G=!0}H--;for(let j of z){let U=j;if(j.isSymbolicLink()){if(!(Z&&(U=j.realpathSync())))continue;if(U.isUnknown())U.lstatSync()}if(U.shouldWalk(_,V))Y.push(U)}}if(G&&!q.flowing)q.once("drain",K)};return K(),q}chdir(Q=this.cwd){let X=this.cwd;this.cwd=typeof Q==="string"?this.cwd.resolve(Q):Q,this.cwd[YQ](X)}}class O0 extends H8{sep="\\";constructor(Q=process.cwd(),X={}){let{nocase:$=!0}=X;super(Q,Y8,"\\",{...X,nocase:$});this.nocase=$;for(let Z=this.cwd;Z;Z=Z.parent)Z.nocase=this.nocase}parseRootPath(Q){return Y8.parse(Q).root.toUpperCase()}newRoot(Q){return new f0(this.rootPath,l,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Q})}isAbsolute(Q){return Q.startsWith("/")||Q.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(Q)}}class F0 extends H8{sep="/";constructor(Q=process.cwd(),X={}){let{nocase:$=!1}=X;super(Q,NX,"/",{...X,nocase:$});this.nocase=$}parseRootPath(Q){return"/"}newRoot(Q){return new y0(this.rootPath,l,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Q})}isAbsolute(Q){return Q.startsWith("/")}}class g0 extends F0{constructor(Q=process.cwd(),X={}){let{nocase:$=!0}=X;super(Q,{...X,nocase:$})}}var x5=process.platform==="win32"?f0:y0,KQ=process.platform==="win32"?O0:process.platform==="darwin"?g0:F0;var dX=(Q)=>Q.length>=1,cX=(Q)=>Q.length>=1;class H0{#Q;#X;#$;length;#J;#q;#M;#U;#_;#H;#Y=!0;constructor(Q,X,$,Z){if(!dX(Q))throw TypeError("empty pattern list");if(!cX(X))throw TypeError("empty glob list");if(X.length!==Q.length)throw TypeError("mismatched pattern list and glob list lengths");if(this.length=Q.length,$<0||$>=this.length)throw TypeError("index out of range");if(this.#Q=Q,this.#X=X,this.#$=$,this.#J=Z,this.#$===0){if(this.isUNC()){let[J,V,q,_,...Y]=this.#Q,[H,K,G,W,...z]=this.#X;if(Y[0]==="")Y.shift(),z.shift();let j=[J,V,q,_,""].join("/"),U=[H,K,G,W,""].join("/");this.#Q=[j,...Y],this.#X=[U,...z],this.length=this.#Q.length}else if(this.isDrive()||this.isAbsolute()){let[J,...V]=this.#Q,[q,..._]=this.#X;if(V[0]==="")V.shift(),_.shift();let Y=J+"/",H=q+"/";this.#Q=[Y,...V],this.#X=[H,..._],this.length=this.#Q.length}}}pattern(){return this.#Q[this.#$]}isString(){return typeof this.#Q[this.#$]==="string"}isGlobstar(){return this.#Q[this.#$]===v}isRegExp(){return this.#Q[this.#$]instanceof RegExp}globString(){return this.#M=this.#M||(this.#$===0?this.isAbsolute()?this.#X[0]+this.#X.slice(1).join("/"):this.#X.join("/"):this.#X.slice(this.#$).join("/"))}hasMore(){return this.length>this.#$+1}rest(){if(this.#q!==void 0)return this.#q;if(!this.hasMore())return this.#q=null;return this.#q=new H0(this.#Q,this.#X,this.#$+1,this.#J),this.#q.#H=this.#H,this.#q.#_=this.#_,this.#q.#U=this.#U,this.#q}isUNC(){let Q=this.#Q;return this.#_!==void 0?this.#_:this.#_=this.#J==="win32"&&this.#$===0&&Q[0]===""&&Q[1]===""&&typeof Q[2]==="string"&&!!Q[2]&&typeof Q[3]==="string"&&!!Q[3]}isDrive(){let Q=this.#Q;return this.#U!==void 0?this.#U:this.#U=this.#J==="win32"&&this.#$===0&&this.length>1&&typeof Q[0]==="string"&&/^[a-z]:$/i.test(Q[0])}isAbsolute(){let Q=this.#Q;return this.#H!==void 0?this.#H:this.#H=Q[0]===""&&Q.length>1||this.isDrive()||this.isUNC()}root(){let Q=this.#Q[0];return typeof Q==="string"&&this.isAbsolute()&&this.#$===0?Q:""}checkFollowGlobstar(){return!(this.#$===0||!this.isGlobstar()||!this.#Y)}markFollowGlobstar(){if(this.#$===0||!this.isGlobstar()||!this.#Y)return!1;return this.#Y=!1,!0}}var lX=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class N0{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(Q,{nobrace:X,nocase:$,noext:Z,noglobstar:J,platform:V=lX}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=V,this.mmopts={dot:!0,nobrace:X,nocase:$,noext:Z,noglobstar:J,optimizationLevel:2,platform:V,nocomment:!0,nonegate:!0};for(let q of Q)this.add(q)}add(Q){let X=new x(Q,this.mmopts);for(let $=0;$<X.set.length;$++){let Z=X.set[$],J=X.globParts[$];if(!Z||!J)throw Error("invalid pattern object");while(Z[0]==="."&&J[0]===".")Z.shift(),J.shift();let V=new H0(Z,J,0,this.platform),q=new x(V.globString(),this.mmopts),_=J[J.length-1]==="**",Y=V.isAbsolute();if(Y)this.absolute.push(q);else this.relative.push(q);if(_)if(Y)this.absoluteChildren.push(q);else this.relativeChildren.push(q)}}ignored(Q){let X=Q.fullpath(),$=`${X}/`,Z=Q.relative()||".",J=`${Z}/`;for(let V of this.relative)if(V.match(Z)||V.match(J))return!0;for(let V of this.absolute)if(V.match(X)||V.match($))return!0;return!1}childrenIgnored(Q){let X=Q.fullpath()+"/",$=(Q.relative()||".")+"/";for(let Z of this.relativeChildren)if(Z.match($))return!0;for(let Z of this.absoluteChildren)if(Z.match(X))return!0;return!1}}class W8{store;constructor(Q=new Map){this.store=Q}copy(){return new W8(new Map(this.store))}hasWalked(Q,X){return this.store.get(Q.fullpath())?.has(X.globString())}storeWalked(Q,X){let $=Q.fullpath(),Z=this.store.get($);if(Z)Z.add(X.globString());else this.store.set($,new Set([X.globString()]))}}class HQ{store=new Map;add(Q,X,$){let Z=(X?2:0)|($?1:0),J=this.store.get(Q);this.store.set(Q,J===void 0?Z:Z&J)}entries(){return[...this.store.entries()].map(([Q,X])=>[Q,!!(X&2),!!(X&1)])}}class WQ{store=new Map;add(Q,X){if(!Q.canReaddir())return;let $=this.store.get(Q);if($){if(!$.find((Z)=>Z.globString()===X.globString()))$.push(X)}else this.store.set(Q,[X])}get(Q){let X=this.store.get(Q);if(!X)throw Error("attempting to walk unknown path");return X}entries(){return this.keys().map((Q)=>[Q,this.store.get(Q)])}keys(){return[...this.store.keys()].filter((Q)=>Q.canReaddir())}}class v0{hasWalkedCache;matches=new HQ;subwalks=new WQ;patterns;follow;dot;opts;constructor(Q,X){this.opts=Q,this.follow=!!Q.follow,this.dot=!!Q.dot,this.hasWalkedCache=X?X.copy():new W8}processPatterns(Q,X){this.patterns=X;let $=X.map((Z)=>[Q,Z]);for(let[Z,J]of $){this.hasWalkedCache.storeWalked(Z,J);let V=J.root(),q=J.isAbsolute()&&this.opts.absolute!==!1;if(V){Z=Z.resolve(V==="/"&&this.opts.root!==void 0?this.opts.root:V);let K=J.rest();if(!K){this.matches.add(Z,!0,!1);continue}else J=K}if(Z.isENOENT())continue;let _,Y,H=!1;while(typeof(_=J.pattern())==="string"&&(Y=J.rest()))Z=Z.resolve(_),J=Y,H=!0;if(_=J.pattern(),Y=J.rest(),H){if(this.hasWalkedCache.hasWalked(Z,J))continue;this.hasWalkedCache.storeWalked(Z,J)}if(typeof _==="string"){let K=_===".."||_===""||_===".";this.matches.add(Z.resolve(_),q,K);continue}else if(_===v){if(!Z.isSymbolicLink()||this.follow||J.checkFollowGlobstar())this.subwalks.add(Z,J);let K=Y?.pattern(),G=Y?.rest();if(!Y||(K===""||K===".")&&!G)this.matches.add(Z,q,K===""||K===".");else if(K===".."){let W=Z.parent||Z;if(!G)this.matches.add(W,q,!0);else if(!this.hasWalkedCache.hasWalked(W,G))this.subwalks.add(W,G)}}else if(_ instanceof RegExp)this.subwalks.add(Z,J)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new v0(this.opts,this.hasWalkedCache)}filterEntries(Q,X){let $=this.subwalks.get(Q),Z=this.child();for(let J of X)for(let V of $){let q=V.isAbsolute(),_=V.pattern(),Y=V.rest();if(_===v)Z.testGlobstar(J,V,Y,q);else if(_ instanceof RegExp)Z.testRegExp(J,_,Y,q);else Z.testString(J,_,Y,q)}return Z}testGlobstar(Q,X,$,Z){if(this.dot||!Q.name.startsWith(".")){if(!X.hasMore())this.matches.add(Q,Z,!1);if(Q.canReaddir()){if(this.follow||!Q.isSymbolicLink())this.subwalks.add(Q,X);else if(Q.isSymbolicLink()){if($&&X.checkFollowGlobstar())this.subwalks.add(Q,$);else if(X.markFollowGlobstar())this.subwalks.add(Q,X)}}}if($){let J=$.pattern();if(typeof J==="string"&&J!==".."&&J!==""&&J!==".")this.testString(Q,J,$.rest(),Z);else if(J===".."){let V=Q.parent||Q;this.subwalks.add(V,$)}else if(J instanceof RegExp)this.testRegExp(Q,J,$.rest(),Z)}}testRegExp(Q,X,$,Z){if(!X.test(Q.name))return;if(!$)this.matches.add(Q,Z,!1);else this.subwalks.add(Q,$)}testString(Q,X,$,Z){if(!Q.isNamed(X))return;if(!$)this.matches.add(Q,Z,!1);else this.subwalks.add(Q,$)}}var oX=(Q,X)=>typeof Q==="string"?new N0([Q],X):Array.isArray(Q)?new N0(Q,X):Q;class G8{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#Q=[];#X;#$;signal;maxDepth;includeChildMatches;constructor(Q,X,$){if(this.patterns=Q,this.path=X,this.opts=$,this.#$=!$.posix&&$.platform==="win32"?"\\":"/",this.includeChildMatches=$.includeChildMatches!==!1,$.ignore||!this.includeChildMatches){if(this.#X=oX($.ignore??[],$),!this.includeChildMatches&&typeof this.#X.add!=="function")throw Error("cannot ignore child matches, ignore lacks add() method.")}if(this.maxDepth=$.maxDepth||1/0,$.signal)this.signal=$.signal,this.signal.addEventListener("abort",()=>{this.#Q.length=0})}#J(Q){return this.seen.has(Q)||!!this.#X?.ignored?.(Q)}#q(Q){return!!this.#X?.childrenIgnored?.(Q)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let Q=void 0;while(!this.paused&&(Q=this.#Q.shift()))Q()}onResume(Q){if(this.signal?.aborted)return;if(!this.paused)Q();else this.#Q.push(Q)}async matchCheck(Q,X){if(X&&this.opts.nodir)return;let $;if(this.opts.realpath){if($=Q.realpathCached()||await Q.realpath(),!$)return;Q=$}let J=Q.isUnknown()||this.opts.stat?await Q.lstat():Q;if(this.opts.follow&&this.opts.nodir&&J?.isSymbolicLink()){let V=await J.realpath();if(V&&(V.isUnknown()||this.opts.stat))await V.lstat()}return this.matchCheckTest(J,X)}matchCheckTest(Q,X){return Q&&(this.maxDepth===1/0||Q.depth()<=this.maxDepth)&&(!X||Q.canReaddir())&&(!this.opts.nodir||!Q.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!Q.isSymbolicLink()||!Q.realpathCached()?.isDirectory())&&!this.#J(Q)?Q:void 0}matchCheckSync(Q,X){if(X&&this.opts.nodir)return;let $;if(this.opts.realpath){if($=Q.realpathCached()||Q.realpathSync(),!$)return;Q=$}let J=Q.isUnknown()||this.opts.stat?Q.lstatSync():Q;if(this.opts.follow&&this.opts.nodir&&J?.isSymbolicLink()){let V=J.realpathSync();if(V&&(V?.isUnknown()||this.opts.stat))V.lstatSync()}return this.matchCheckTest(J,X)}matchFinish(Q,X){if(this.#J(Q))return;if(!this.includeChildMatches&&this.#X?.add){let J=`${Q.relativePosix()}/**`;this.#X.add(J)}let $=this.opts.absolute===void 0?X:this.opts.absolute;this.seen.add(Q);let Z=this.opts.mark&&Q.isDirectory()?this.#$:"";if(this.opts.withFileTypes)this.matchEmit(Q);else if($){let J=this.opts.posix?Q.fullpathPosix():Q.fullpath();this.matchEmit(J+Z)}else{let J=this.opts.posix?Q.relativePosix():Q.relative(),V=this.opts.dotRelative&&!J.startsWith(".."+this.#$)?"."+this.#$:"";this.matchEmit(!J?"."+Z:V+J+Z)}}async match(Q,X,$){let Z=await this.matchCheck(Q,$);if(Z)this.matchFinish(Z,X)}matchSync(Q,X,$){let Z=this.matchCheckSync(Q,$);if(Z)this.matchFinish(Z,X)}walkCB(Q,X,$){if(this.signal?.aborted)$();this.walkCB2(Q,X,new v0(this.opts),$)}walkCB2(Q,X,$,Z){if(this.#q(Q))return Z();if(this.signal?.aborted)Z();if(this.paused){this.onResume(()=>this.walkCB2(Q,X,$,Z));return}$.processPatterns(Q,X);let J=1,V=()=>{if(--J===0)Z()};for(let[q,_,Y]of $.matches.entries()){if(this.#J(q))continue;J++,this.match(q,_,Y).then(()=>V())}for(let q of $.subwalkTargets()){if(this.maxDepth!==1/0&&q.depth()>=this.maxDepth)continue;J++;let _=q.readdirCached();if(q.calledReaddir())this.walkCB3(q,_,$,V);else q.readdirCB((Y,H)=>this.walkCB3(q,H,$,V),!0)}V()}walkCB3(Q,X,$,Z){$=$.filterEntries(Q,X);let J=1,V=()=>{if(--J===0)Z()};for(let[q,_,Y]of $.matches.entries()){if(this.#J(q))continue;J++,this.match(q,_,Y).then(()=>V())}for(let[q,_]of $.subwalks.entries())J++,this.walkCB2(q,_,$.child(),V);V()}walkCBSync(Q,X,$){if(this.signal?.aborted)$();this.walkCB2Sync(Q,X,new v0(this.opts),$)}walkCB2Sync(Q,X,$,Z){if(this.#q(Q))return Z();if(this.signal?.aborted)Z();if(this.paused){this.onResume(()=>this.walkCB2Sync(Q,X,$,Z));return}$.processPatterns(Q,X);let J=1,V=()=>{if(--J===0)Z()};for(let[q,_,Y]of $.matches.entries()){if(this.#J(q))continue;this.matchSync(q,_,Y)}for(let q of $.subwalkTargets()){if(this.maxDepth!==1/0&&q.depth()>=this.maxDepth)continue;J++;let _=q.readdirSync();this.walkCB3Sync(q,_,$,V)}V()}walkCB3Sync(Q,X,$,Z){$=$.filterEntries(Q,X);let J=1,V=()=>{if(--J===0)Z()};for(let[q,_,Y]of $.matches.entries()){if(this.#J(q))continue;this.matchSync(q,_,Y)}for(let[q,_]of $.subwalks.entries())J++,this.walkCB2Sync(q,_,$.child(),V);V()}}class h0 extends G8{matches=new Set;constructor(Q,X,$){super(Q,X,$)}matchEmit(Q){this.matches.add(Q)}async walk(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())await this.path.lstat();return await new Promise((Q,X)=>{this.walkCB(this.path,this.patterns,()=>{if(this.signal?.aborted)X(this.signal.reason);else Q(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}}class d0 extends G8{results;constructor(Q,X,$){super(Q,X,$);this.results=new Q0({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(Q){if(this.results.write(Q),!this.results.flowing)this.pause()}stream(){let Q=this.path;if(Q.isUnknown())Q.lstat().then(()=>{this.walkCB(Q,this.patterns,()=>this.results.end())});else this.walkCB(Q,this.patterns,()=>this.results.end());return this.results}streamSync(){if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}}var iX=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class o{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(Q,X){if(!X)throw TypeError("glob options required");if(this.withFileTypes=!!X.withFileTypes,this.signal=X.signal,this.follow=!!X.follow,this.dot=!!X.dot,this.dotRelative=!!X.dotRelative,this.nodir=!!X.nodir,this.mark=!!X.mark,!X.cwd)this.cwd="";else if(X.cwd instanceof URL||X.cwd.startsWith("file://"))X.cwd=pX(X.cwd);if(this.cwd=X.cwd||"",this.root=X.root,this.magicalBraces=!!X.magicalBraces,this.nobrace=!!X.nobrace,this.noext=!!X.noext,this.realpath=!!X.realpath,this.absolute=X.absolute,this.includeChildMatches=X.includeChildMatches!==!1,this.noglobstar=!!X.noglobstar,this.matchBase=!!X.matchBase,this.maxDepth=typeof X.maxDepth==="number"?X.maxDepth:1/0,this.stat=!!X.stat,this.ignore=X.ignore,this.withFileTypes&&this.absolute!==void 0)throw Error("cannot set absolute and withFileTypes:true");if(typeof Q==="string")Q=[Q];if(this.windowsPathsNoEscape=!!X.windowsPathsNoEscape||X.allowWindowsEscape===!1,this.windowsPathsNoEscape)Q=Q.map((_)=>_.replace(/\\/g,"/"));if(this.matchBase){if(X.noglobstar)throw TypeError("base matching requires globstar");Q=Q.map((_)=>_.includes("/")?_:`./**/${_}`)}if(this.pattern=Q,this.platform=X.platform||iX,this.opts={...X,platform:this.platform},X.scurry){if(this.scurry=X.scurry,X.nocase!==void 0&&X.nocase!==X.scurry.nocase)throw Error("nocase option contradicts provided scurry option")}else{let _=X.platform==="win32"?O0:X.platform==="darwin"?g0:X.platform?F0:KQ;this.scurry=new _(this.cwd,{nocase:X.nocase,fs:X.fs})}this.nocase=this.scurry.nocase;let $=this.platform==="darwin"||this.platform==="win32",Z={...X,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:$,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},J=this.pattern.map((_)=>new x(_,Z)),[V,q]=J.reduce((_,Y)=>{return _[0].push(...Y.set),_[1].push(...Y.globParts),_},[[],[]]);this.patterns=V.map((_,Y)=>{let H=q[Y];if(!H)throw Error("invalid pattern object");return new H0(_,H,0,this.platform)})}async walk(){return[...await new h0(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new h0(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new d0(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new d0(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}}var j8=(Q,X={})=>{if(!Array.isArray(Q))Q=[Q];for(let $ of Q)if(new x($,X).hasMagic())return!0;return!1};function c0(Q,X={}){return new o(Q,X).streamSync()}function zQ(Q,X={}){return new o(Q,X).stream()}function l0(Q,X={}){return new o(Q,X).walkSync()}async function GQ(Q,X={}){return new o(Q,X).walk()}function o0(Q,X={}){return new o(Q,X).iterateSync()}function UQ(Q,X={}){return new o(Q,X).iterate()}var nX=c0,rX=Object.assign(zQ,{sync:c0}),aX=o0,sX=Object.assign(UQ,{sync:o0}),eX=Object.assign(l0,{stream:c0,iterate:o0}),jQ=Object.assign(GQ,{glob:GQ,globSync:l0,sync:eX,globStream:zQ,stream:rX,globStreamSync:c0,streamSync:nX,globIterate:UQ,iterate:sX,globIterateSync:o0,iterateSync:aX,Glob:o,hasMagic:j8,escape:V0,unescape:g});jQ.glob=jQ;import tX from"node:path";var BQ=({dir:Q,pattern:X="*",nodir:$=!1,dot:Z=!0,ignore:J=[],absolute:V=!1,matchBase:q=!1,follow:_=!1})=>{if(Q=Q||process.cwd(),Q=tX.resolve(Q),X&&!Array.isArray(X))X=[X];else X=X||["*"];if(J&&!Array.isArray(J))J=[J];else J=J||[];return l0(X,{cwd:Q,nodir:$,dot:Z,ignore:J,absolute:V,matchBase:q,follow:_})};import p from"node:fs";import i0 from"node:path";import{randomUUID as Q5}from"node:crypto";import X5 from"yaml";import $5 from"nunjucks";import Z5 from"chalk";import{Atom as $0}from"@flownet/lib-atom-api-js";import J5 from"@fnet/config";import{Api as p0}from"@flownet/lib-atom-api-js";class wQ{init({config:Q,accessToken:X}){return new Promise(($,Z)=>{if(p0.set_api_url(Q.data.url),X){p0.set_req_token(X),$(X);return}fetch(`${Q.data.issuer}/protocol/openid-connect/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(Q.data.grant.params)}).then(async(J)=>{if(!J.ok)throw Error(await J.text());return J.json()}).then((J)=>{p0.set_req_token(J.access_token),$(J.access_token)}).catch((J)=>{p0.set_req_token(),Z(J)})})}}var CQ=async(Q)=>{let{atom:X,packageDependencies:$,context:Z,deploymentProjectTarget:J,setProgress:V,deploymentProject:q,yamlTarget:_}=Q;if(J.enabled!==!0)return;let Y=J.type;try{if(Y==="lib")await(await import("./index.j5z7dtsx.js")).default({...Q});else if(Y==="red")await(await import("./index.tgkhgnrp.js")).default({...Q});else if(Y==="npm")await(await import("./index.fbzv6wwf.js")).default({...Q});else if(Y==="gcs")await(await import("./index.s66v6wt4.js")).default({...Q});else if(Y==="gitlab")await(await import("./index.kb4e4bxf.js")).default({...Q});else if(Y==="fnet-package")await(await import("./index.f2tb0x3t.js")).default({...Q});else if(Y==="fnet-form")await(await import("./index.sv7v0y60.js")).default({...Q});else if(Y==="fnet-node")await(await import("./index.vq706f75.js")).default({...Q});else if(Y==="fnet-flow")await(await import("./index.z4vz93ww.js")).default({...Q});else if(Y==="nextjs")await(await import("./index.gazd9raq.js")).default({atom:X,target:J,onProgress:V,projectDir:Z.projectDir,dependencies:$,context:Z,yamlTarget:_}),q.isDirty=!0;else if(Y==="webos")await(await import("./index.y8pvdcny.js")).default({atom:X,target:J,onProgress:V,projectDir:Z.projectDir,dependencies:$,context:Z,yamlTarget:_}),q.isDirty=!0;else if(Y==="electron")await(await import("./index.eqxmcpdc.js")).default({atom:X,target:J,onProgress:V,projectDir:Z.projectDir,dependencies:$,context:Z,yamlTarget:_}),q.isDirty=!0;else if(Y==="docker")await(await import("./index.dp9wyahp.js")).default({atom:X,target:J,onProgress:V,projectDir:Z.projectDir,dependencies:$,context:Z,yamlTarget:_}),q.isDirty=!0;else if(Y==="ios")await(await import("./index.b1q7y05p.js")).default({atom:X,target:J,onProgress:V,projectDir:Z.projectDir,dependencies:$,context:Z,yamlTarget:_}),q.isDirty=!0;else if(Y==="macos")await(await import("./index.qn0schqp.js")).default({atom:X,target:J,onProgress:V,projectDir:Z.projectDir,dependencies:$,context:Z,yamlTarget:_}),q.isDirty=!0;else if(Y==="rust")await(await import("./index.2hc9tbyx.js")).default({atom:X,target:J,onProgress:V,projectDir:Z.projectDir,dependencies:$,context:Z,yamlTarget:_}),q.isDirty=!0;else if(Y==="pypi")await(await import("./index.rht29phd.js")).default({atom:X,target:J,onProgress:V,projectDir:Z.projectDir,dependencies:$,context:Z,yamlTarget:_}),q.isDirty=!0;else{console.warn(`No deployer found for type: ${Y}`);return}}catch(H){throw console.error(`Error during deployment for type "${Y}":`,H),H}};class MQ{#Q;#X;#$;#J;#q;#M;#U;#_;#H;#Y;#K;#Z;#G;#B;#j;#z;#w;constructor(Q){this.#Q=new wQ,this.#X=Q,this.#M=[],this.#U=[],this._expire_ttl=3600,this._expire_ttl_short=300,this.#w={packageDependencies:this.#M,packageDevDependencies:this.#U,setProgress:this.setProgress.bind(this),context:this.#X,Atom:$0,registerToPackageManager:this.registerToPackageManager.bind(this)}}get apiContext(){return this.#w}get context(){return this.#X}get atom(){return this.#$}get libs(){return this.#q}set libs(Q){this.#q=Q}get fileMode(){return this.#B}get buildMode(){return this.#j}get deployMode(){return this.#z}async _cache_set(Q,X,$){}async initAuth(){if(!this.#X.id)return;this.#_=await this.#Q.init({config:this.#Z}),this.#w.atomAccessToken=this.#_}async initLibrary(){let Q=this.#X.id;this.#$=this.#X.project?.libraryAtom||await $0.get({id:Q});let X=this.#$.doc.bundleName;X=X||(this.#$.doc.name||"").toUpperCase().replace(/[^A-Z0-9]/g,"_"),this.#$.doc.bundleName=X,this.#$.type=this.#$.type||"workflow.lib",this.#w.atom=this.#$}async initLibraryDir(){this.setProgress({message:"Initializing library directory."});let Q=this.#X.projectDir;this.setProgress({message:"Cleaning project directory."});let X=BQ({dir:Q,ignore:[".cache","node_modules",".conda",".bin",".dev"],absolute:!0});for(let Z of X)p.rmSync(Z,{recursive:!0,force:!0});this.setProgress({message:"Creating project directory."});let $=Q;if(!p.existsSync($))p.mkdirSync($,{recursive:!0});if($=i0.join(Q,"src"),!p.existsSync($))p.mkdirSync($,{recursive:!0});if($=i0.join(Q,"src","default"),!p.existsSync($))p.mkdirSync($,{recursive:!0});if($=i0.join(Q,".dev"),!p.existsSync($))p.mkdirSync($,{recursive:!0})}async initNunjucks(){this.setProgress({message:"Initializing nunjucks."});let Q=this.#X.templateDir;this.#J=$5.configure(Q,{watch:!1,dev:!0}),this.#w.njEnv=this.#J}async createProjectYaml(){await this.setProgress({message:"Creating fnode.yaml"});let{content:$,...Z}=this.#$.doc,J=this.#X.projectDir,V=i0.resolve(J,"fnode.yaml");p.writeFileSync(V,X5.stringify(Z),"utf8")}async deploy(){if(await this.setProgress({message:"Deploying."}),this.#X.project?.devops){let Q=[this.#X.project?.devops];for(let X=0;X<Q.length;X++){let $=Q[X];if(await this.deployProject({deploymentProject:$}),$.isDirty===!0)await $.save()}}else if(this.#$.id){let Q=await $0.list({type:"library.deploy",parent_id:this.#$.id});for(let X=0;X<Q.length;X++){let $=Q[X];if(await this.deployProject({deploymentProject:$}),$.isDirty===!0)$=await $0.update($,{id:$.id})}}}async deployProject(Q){let{deploymentProject:X}=Q,{yamlDocument:$}=X;if(X.doc.targets&&Array.isArray(X.doc.targets))throw Error("Deployment project targets are deprecated. Please update targets in the yaml file.");let Z=Object.keys(X.doc||{}),J=$||{};for(let V=0;V<Z.length;V++){let q=X.doc[Z[V]];q.name=Z[V];let _=J.get(Z[V]);await CQ({...this.#w,deploymentProject:X,deploymentProjectTarget:q,yamlTarget:_})}}async registerToPackageManager(Q){let{target:X,packageJSON:$}=Q;if(!this.#X.id)return;let Z=await $0.first({name:X.params.name,parent_id:this.#Z.env.ATOM_PACKAGES_ID});if(!Z)Z=await $0.create({parent_id:this.#Z.env.ATOM_PACKAGES_ID,doc:{name:X.params.name,type:"pm",versions:[{v:$.version}]}});else Z.doc.versions.splice(0,0,{v:$.version}),await $0.update(Z,{id:Z.id})}async setProgress(Q){let X=typeof Q==="string"?Q:Q?.message;console.log(Z5.blue(X)),await this._cache_set(this.#Y,{status:"IN_PROGRESS",message:X})}async init(){this.#H=this.#X.buildId||Q5(),this.#w.buildId=this.#H,this.#G=this.#X.mode,this.#B=["all","deploy","build","file"].includes(this.#G),this.#j=["all","deploy","build"].includes(this.#G),this.#z=["all","deploy"].includes(this.#G),this.#K=this.#X.protocol,this.#Y="BUILD:"+this.#H,this.#Z=(await J5({optional:!0,name:this.#X.atomConfig||"atom",dir:this.#X.projectDir,tags:this.#X.tags}))?.data;try{await this.setProgress({message:"Initialization started."}),await this.initAuth(),await this.initLibrary(),await this.initRuntime()}catch(Q){throw await this._cache_set(this.#Y,{status:"FAILED",message:Q?.message||Q}),Q}}async initRuntime(){throw Error("initRuntime method must be implemented by runtime-specific builder")}async build(){throw Error("build method must be implemented by runtime-specific builder")}}var k6=MQ;import RQ from"node:fs";import AQ from"node:path";import IQ from"nunjucks";async function V5({atom:Q,setProgress:X,context:$,packageDependencies:Z}){await X({message:"Creating .gitignore"});let J={atom:Q,packageDependencies:Z},V=$.templateDir,_=IQ.compile(RQ.readFileSync(AQ.resolve(V,".gitignore.njk"),"utf8"),IQ.configure(V)).render(J),Y=$.projectDir,H=AQ.resolve(Y,".gitignore");RQ.writeFileSync(H,_,"utf8")}import n0 from"nunjucks";import s from"node:fs";import Z0 from"node:path";import LQ from"@fnet/yaml";async function q5({atom:Q,context:X,setProgress:$,Atom:Z}){if(await $({message:"Creating readme.md"}),X.project?.readme){let q=X.projectDir,_={content:X.project.readme.doc.content},Y=Z0.resolve(X.project.projectDir,"fnet/how-to.md");if(s.existsSync(Y)){let U=s.readFileSync(Y,"utf8");_.howto=U}let H=Z0.resolve(X.project.projectDir,"fnet/input.yaml");if(s.existsSync(H)){let U=await LQ({file:H,tags:X.tags});_.input=U.content}let K=Z0.resolve(X.project.projectDir,"fnet/output.yaml");if(s.existsSync(K)){let U=await LQ({file:K,tags:X.tags});_.output=U.content}let G=X.templateDir,z=n0.compile(s.readFileSync(Z0.resolve(G,"readme.md.njk"),"utf8"),n0.configure(G)).render(_),j=Z0.resolve(q,"readme.md");s.writeFileSync(j,z,"utf8")}else if(Q.id){let q=await Z.first({type:"wiki",parent_id:Q.id});if(!q||q.doc?.["content-type"]!=="markdown")return;let{content:_,...Y}=q.doc,H={content:_},K=X.templateDir,W=n0.compile(s.readFileSync(Z0.resolve(K,"readme.md.njk"),"utf8"),n0.configure(K)).render(H),z=X.projectDir,j=Z0.resolve(z,"readme.md");s.writeFileSync(j,W,"utf8")}}
|
|
4
|
+
export{BQ as a,k6 as b,V5 as c,q5 as d};
|
package/dist/fnode/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{e as S}from"./index.9qgtmxq3.js";import{f as o}from"./index.05n3mvs9.js";import{g as k,i as E}from"./index.cvxrf34y.js";import z$ from"yargs";import I1 from"chalk";import{promisify as F1}from"node:util";import _1 from"tree-kill";var a=F1(_1),N=!1;async function i($,W){if(N)return;if(N=!0,!$.killed&&$.pid)try{if(await a($.pid,"SIGTERM").catch(()=>{}),await new Promise((q)=>setTimeout(q,500)),!$.killed)await a($.pid,"SIGKILL").catch(()=>{})}catch(q){}await new Promise((q)=>setTimeout(q,100));let z=W==="SIGINT"?130:W==="SIGTERM"?143:1;process.exit(z)}function b($){["SIGINT","SIGTERM","SIGQUIT"].forEach((W)=>{process.once(W,async()=>{await i($,W)})}),process.on("uncaughtException",async(W)=>{await i($)}),process.on("unhandledRejection",async(W)=>{await i($)}),$.on("close",(W)=>{if(!N)process.exit(W)})}function t(){process.on("uncaughtException",($)=>{if(!N)N=!0,setTimeout(()=>process.exit(1),500)}),process.on("unhandledRejection",($)=>{if(!N)N=!0,setTimeout(()=>process.exit(1),500)})}import x from"node:path";import{spawn as P}from"node:child_process";import v from"node:fs";import y from"chalk";import A1 from"@fnet/config";function C($,{name:W,bin:z,preArgs:q=[],createContext:G}){if(typeof z==="function")z=z();return $.command(`${W||z} [commands..]`,`${z} ${q.join(" ")}`,(Z)=>{return Z.help(!1).version(!1)},async(Z)=>{try{let Q=await G(Z),{projectDir:Y}=Q,L=(I)=>{if(!I.includes(" "))return I;if(process.platform==="win32")return`"${I.replace(/(["^])/g,"^$1")}"`;else return`"${I.replace(/(["\\$`])/g,"\\$1")}"`},M=process.argv.slice(3).map(L),J={...process.env},K=x.join(Y,"node_modules");J.NODE_PATH=K,J.NODE_PRESERVE_SYMLINKS=1;let T=P(z,[...q,...M],{cwd:Y,stdio:"inherit",shell:!0,detached:!0,env:J});b(T)}catch(Q){console.error(Q.message),process.exit(1)}})}function D($,{name:W,bin:z,preArgs:q=[],createContext:G}){return $.command(`${W||z} [commands..]`,`${z} ${q.join(" ")}`,(Z)=>{return Z.help(!1).version(!1)},async(Z)=>{try{let Q=await G(Z),{projectDir:Y}=Q,L=(K)=>{if(!K.includes(" "))return K;if(process.platform==="win32")return`"${K.replace(/(["^])/g,"^$1")}"`;else return`"${K.replace(/(["\\$`])/g,"\\$1")}"`},M=process.argv.slice(3).map(L);z=x.join(Y,".conda","bin",z||W);let J=P(z,[...q,...M],{cwd:Y,stdio:"inherit",shell:!0,detached:!0,env:{PYTHONPATH:Y}});b(J)}catch(Q){console.error(Q.message),process.exit(1)}})}function e($,{name:W,createContext:z}){return $.command(`${W} <binary> [commands..]`,"Run a binary from conda environment",(q)=>{return q.positional("binary",{type:"string",describe:"Binary name to run from .conda/bin"}).help(!1).version(!1)},async(q)=>{try{let G=await z(q),{projectDir:Z}=G,Q=(K)=>{if(!K.includes(" "))return K;if(process.platform==="win32")return`"${K.replace(/(["^])/g,"^$1")}"`;else return`"${K.replace(/(["\\$`])/g,"\\$1")}"`},Y=q.binary,L=process.argv.slice(4).map(Q),M=x.join(Z,".conda","bin",Y),J=P(M,L,{cwd:Z,stdio:"inherit",shell:!0,detached:!0,env:{PYTHONPATH:Z}});b(J)}catch(G){console.error(G.message),process.exit(1)}})}function $1($,{name:W,preArgs:z=[],createContext:q}){return $.command(`${W} <config> <command> [options..]`,"Run a command with a config context",(G)=>{return G.positional("config",{type:"string"}).positional("command",{type:"string"}).help(!1).version(!1)},async(G)=>{try{let Z=await q(G),{projectDir:Q}=Z,Y=G.config,M=(await A1({name:Y,dir:Q,transferEnv:!1,optional:!0,tags:Z.tags}))?.data?.env||void 0,J=G.command,K=process.argv.slice(5),T=P(J,[...z,...K],{cwd:v.existsSync(Q)?Q:process.cwd(),stdio:"inherit",shell:!0,detached:!0,env:{...process.env,...M}});b(T)}catch(Z){console.error(Z.message),process.exit(1)}})}function W1($,{name:W,projectType:z="auto"}){return $.command(`${W} group [options..]`,"Run a command group.",(q)=>{return q.positional("group",{type:"string"}).option("ftag",{type:"array"}).help(!1).version(!1)},async(q)=>{try{let{runCommandGroup:G}=await import("./index.2pnjg6dc.js");await G({projectType:z,group:q.group,tags:q.ftag,args:q,argv:process.argv})}catch(G){console.error(G.message),process.exit(1)}})}function q1($,{name:W,createContext:z}){return $.command(`${W} [options]`,"Install the project as a binary",(q)=>{return q.option("name",{alias:"n",describe:"Name to use for the installed binary",type:"string"}).option("force",{alias:"f",describe:"Force overwrite if binary already exists",type:"boolean",default:!1}).option("yes",{alias:"y",describe:"Automatically answer yes to all prompts",type:"boolean",default:!1})},async(q)=>{try{let G=await z(q),{projectDir:Z}=G;console.log(y.blue("Compiling project..."));let Q=x.join(Z,".bin");if(!v.existsSync(Q))v.mkdirSync(Q,{recursive:!0});let Y=x.basename(x.dirname(Z)),L=G.project?.projectFileParsed?.features?.cli?.bin,M=q.name||L||Y;console.log(y.blue(`Using binary name: ${M}`));let J=x.join(Q,M),{spawn:K}=await import("child_process"),T=K("bun",["build","./dist/cli/esm/index.js","--compile",`--outfile=${J}`],{cwd:Z,stdio:"inherit",shell:!0});if(await new Promise((u,F)=>{T.on("close",(_)=>{if(_===0)u();else F(Error(`Compilation failed with code ${_}`))}),T.on("error",(_)=>{F(_)})}),process.platform!=="win32")v.chmodSync(J,493);console.log(y.green(`Binary compiled successfully: ${J}`)),console.log(y.blue("Installing binary..."));let I=["install",J];if(q.name)I.push("--name",q.name);if(q.force)I.push("--force");if(q.yes)I.push("--yes");let f=K("fbin",I,{stdio:"inherit",shell:!0});await new Promise((u,F)=>{f.on("close",(_)=>{if(_===0)u();else F(Error(`Installation failed with code ${_}`))}),f.on("error",(_)=>{F(_)})})}catch(G){console.error(y.red(`Failed to install binary: ${G.message}`)),process.exit(1)}})}import w from"node:path";import B from"node:fs";import z1 from"@fnet/yaml";import R1 from"yaml";async function O($){if($.id)return{id:$.id,buildId:$.buildId,mode:$.mode,protocol:$.protocol||"ac:",templateDir:S("./template/fnode/node"),projectDir:w.resolve(process.cwd(),`./.output/${$.id}`),tags:$.ftag,dev:$.dev};else try{let W=await N1({tags:$.ftag}),z=W.runtime.type==="bun"?"node":W.runtime.type;return{buildId:$.buildId,mode:$.mode,protocol:$.protocol||"src:",templateDir:S(`./template/fnode/${z}`),projectDir:w.resolve(W.projectDir,"./.workspace"),projectSrcDir:w.resolve(W.projectDir,"./src"),projectSrcDirSymlink:w.resolve(W.projectDir,"./.workspace/src-core"),projectAppDir:w.resolve(W.projectDir,"./app"),projectAppDirSymlink:w.resolve(W.projectDir,"./.workspace/app"),projectCliDir:w.resolve(W.projectDir,"./cli"),projectCliDirSymlink:w.resolve(W.projectDir,"./.workspace/cli"),project:W,tags:$.ftag,dev:$.dev}}catch(W){return console.warn(`Warning: Could not load project: ${W.message}`),{projectDir:process.cwd(),tags:$.ftag}}}async function N1({tags:$}){let W=x1(process.cwd());if(!B.existsSync(W))throw Error("fnode.yaml file not found in current directory.");let{raw:z,parsed:q}=await z1({file:W,tags:$}),G=w.dirname(W);q.features=q.features||{};let Z=q.features;if(Z.runtime=Z.runtime||{},Z.runtime.type=Z.runtime.type||"node",Z.runtime.type==="python")Z.runtime.template=Z.runtime.template||"python";else if(Z.runtime.type==="bun")Z.runtime.template=Z.runtime.template||"node";else Z.runtime.template=Z.runtime.template||"node";let Q={libraryAtom:{doc:{...q},fileName:"index"},projectDir:G,projectFilePath:W,projectFileContent:z,projectFileParsed:q,runtime:Z.runtime},Y=w.resolve(G,"fnet/targets.yaml");if(!B.existsSync(Y)){if(Y=w.resolve(G,"node.devops.yaml"),B.existsSync(Y)){let M=w.resolve(G,"fnet");if(!B.existsSync(M))B.mkdirSync(M);B.copyFileSync(Y,w.resolve(G,"fnet/targets.yaml")),B.unlinkSync(Y)}}if(B.existsSync(Y)){let{raw:M,parsed:J}=await z1({file:Y,tags:$}),K=R1.parseDocument(M);Q.devops={filePath:Y,fileContent:M,yamlDocument:K,doc:{...J},type:"library.deploy",save:async()=>{B.writeFileSync(Q.devops.filePath,K.toString())}}}let L=w.resolve(G,"readme.md");if(B.existsSync(L)){let M=B.readFileSync(L,"utf8");Q.readme={filePath:L,fileContent:M,doc:{content:M,"content-type":"markdown"},type:"wiki"}}return Q}function x1($){let W=w.resolve($,"node.yaml"),z=w.resolve($,"fnode.yaml");if(B.existsSync(z))return z;if(B.existsSync(W))try{let q=B.readFileSync(W,"utf8");return B.writeFileSync(z,q,"utf8"),B.unlinkSync(W),console.log(`Migrated node.yaml to fnode.yaml in ${$}`),z}catch(q){return console.error(`Error migrating node.yaml to fnode.yaml: ${q.message}`),W}return z}import k1 from"node:path";import G1 from"node:fs";import E1 from"node:os";import S1 from"@flownet/lib-render-templates-dir";import c from"@fnet/shelljs";var b1={command:"create",describe:"Create a new fnode project",builder:($)=>{return $.option("name",{type:"string",describe:"Project name",demandOption:!0}).option("vscode",{type:"boolean",default:!0,alias:"vs",describe:"Open in VS Code after creation"}).option("runtime",{type:"string",default:"node",choices:["node","python","bun"],describe:"Runtime environment"})},handler:async($)=>{try{let W=process.cwd(),z=S("./template/fnode/project"),q=k1.resolve(W,$.name);if(!G1.existsSync(q))G1.mkdirSync(q);await S1({dir:z,outDir:q,context:{name:$.name,runtime:$.runtime,platform:E1.platform()},copyUnmatchedAlso:!0});let G=await c("fnode build",{cwd:q});if(G.code!==0)throw Error("Failed to build project.");if(o("git")){if(G=await c("git init --initial-branch=main",{cwd:q}),G.code!==0)throw Error("Failed to initialize git.")}if(o("code")&&$.vscode){if(G=await c(`cd ${q} && code .`),G.code!==0)throw Error("Failed to open vscode.")}console.log("Creating project succeeded!"),process.exit(0)}catch(W){console.error("Initialization failed!",W.message),process.exit(1)}}},Q1=b1;import y1 from"node:os";import D1 from"@flownet/lib-render-templates-dir";import f1 from"@fnet/shelljs";var u1={command:"project",describe:"Manage fnode project",builder:($)=>{return $.option("update",{type:"boolean",default:!1,alias:"-u",describe:"Update project files"})},handler:async($)=>{try{let W=S("./template/fnode/project"),z=process.cwd(),q=await O($);if($.update){if(await D1({dir:W,outDir:z,context:{name:q.project.projectFileParsed.name,runtime:q.project.runtime.type,platform:y1.platform()},copyUnmatchedAlso:!0}),(await f1("fnode build",{cwd:z})).code!==0)throw Error("Failed to build project.");console.log("Updating project succeeded!")}process.exit(0)}catch(W){console.error("Project failed.",W.message),process.exit(1)}}},Z1=u1;class Y1{static async createBuilder($){if(!$.project)return console.warn("No project provided, defaulting to node runtime"),new(await import("./index.kvedj83h.js")).default($);let W=$.project?.runtime?.type||"node";try{return new(await this.loadBuilderClass(W))($)}catch(z){throw Error(`Failed to create builder for runtime '${W}': ${z.message}`)}}static async loadBuilderClass($){switch($.toLowerCase()){case"node":case"bun":return(await import("./index.kvedj83h.js")).default;case"python":return(await import("./index.hv4s25f0.js")).default;default:throw Error(`Unsupported runtime type: ${$}`)}}}var R=Y1;var v1={command:"build",describe:"Build fnode project",builder:($)=>{return $.option("id",{type:"string",describe:"Project ID"}).option("buildId",{type:"string",alias:"bid",describe:"Build ID"}).option("mode",{type:"string",default:"build",choices:["all","file","build","deploy","bpmn"],describe:"Build mode"}).option("ftag",{type:"array",describe:"Tags for conditional configuration"}).option("dev",{type:"boolean",default:!1,describe:"Development mode"})},handler:async($)=>{try{let W=await O($),z=await R.createBuilder(W);await z.init(),await z.build(),console.log("Building library succeeded!"),process.exit(0)}catch(W){console.error("Building library failed!",W.message),process.exit(1)}}},K1=v1;var P1={command:"build:dev",describe:"Build fnode project",builder:($)=>{return $.option("id",{type:"string",describe:"Project ID"}).option("buildId",{type:"string",alias:"bid",describe:"Build ID"}).option("mode",{type:"string",default:"build",choices:["all","file","build","deploy","bpmn"],describe:"Build mode"}).option("ftag",{type:"array",describe:"Tags for conditional configuration"}).option("dev",{type:"boolean",default:!1,describe:"Development mode"})},handler:async($)=>{try{$.dev=!0;let W=await O($),z=await R.createBuilder(W);await z.init(),await z.build(),console.log("Building library succeeded!"),process.exit(0)}catch(W){console.error("Building library failed!",W.message),process.exit(1)}}},U1=P1;var j1={command:"deploy",describe:"Build and deploy fnode project",builder:($)=>{return $.option("id",{type:"string",describe:"Project ID"}).option("buildId",{type:"string",alias:"bid",describe:"Build ID"}).option("ftag",{type:"array",describe:"Tags for conditional configuration"})},handler:async($)=>{try{let W=await O({...$,mode:"all"}),z=await R.createBuilder(W);await z.init(),await z.build(),console.log("Building library succeeded!"),process.exit(0)}catch(W){console.error("Building library failed!",W.message),process.exit(1)}}},J1=j1;var d1={command:"file",describe:"Just create files",builder:($)=>{return $.option("id",{type:"string",describe:"Project ID"}).option("buildId",{type:"string",alias:"bid",describe:"Build ID"}).option("ftag",{type:"array",describe:"Tags for conditional configuration"})},handler:async($)=>{try{let W=await O({...$,mode:"file"}),z=await R.createBuilder(W);await z.init(),await z.build(),console.log("Building library succeeded!"),process.exit(0)}catch(W){console.error("Building library failed!",W.message),process.exit(1)}}},M1=d1;import H1 from"node:path";import j from"node:fs";import m1 from"@fnet/prompt";var g1={command:"input [name]",describe:"Create or modify an input config file",builder:($)=>{return $.positional("name",{type:"string",demandOption:!1,describe:"Input name"})},handler:async($)=>{try{let W=await O($),{project:z}=W,{projectDir:q,projectFileParsed:G}=z,Z=G.input;if(!Z)throw Error("Config schema not found in project file.");if(!Reflect.has($,"name")){let{inputName:K}=await m1({type:"input",name:"inputName",message:"Input name:",initial:"dev"});$.name=K}let Q=H1.resolve(q,".fnet");if(!j.existsSync(Q))j.mkdirSync(Q);let Y=H1.resolve(Q,`${$.name}.fnet`),L=j.existsSync(Y),M=(await import("@fnet/object-from-schema")).default,J=await M({schema:Z,format:"yaml",ref:L?Y:void 0});j.writeFileSync(Y,J)}catch(W){console.error(W.message),process.exit(1)}}},L1=g1;import V from"node:path";import H from"node:fs";import m from"node:os";import{spawn as g}from"node:child_process";import U from"chalk";import A from"@fnet/prompt";import d from"chalk";import O1 from"@fnet/prompt";async function h1($){let{items:W,message:z,nameField:q="name",valueField:G="name",initialValue:Z=null,allowAbort:Q=!0}=$;if(!W||W.length===0)return console.log(d.yellow("No items available for selection.")),null;if(W.length===1&&!Q){let K=W[0],T=typeof K==="string"?K:K[G];return console.log(d.blue(`Only one option available: ${typeof K==="string"?K:K[q]}`)),T}let Y=W.map((K)=>{if(typeof K==="string")return{name:K,value:K,message:K};else return{name:K[G],value:K[G],message:K[q]||K[G]}});if(Q)Y.push({name:"cancel",value:null,message:d.yellow("Cancel")});let L=null;if(Z){let K=Y.findIndex((T)=>T.name===Z);if(K!==-1)L=K}let M="selectedItem",{[M]:J}=await O1({type:"select",name:M,message:z,choices:Y,initial:L});if(J==="cancel")return null;return J}async function l1($){let{items:W,message:z,nameField:q="name",valueField:G="name",initialValues:Z=[],allowAbort:Q=!0}=$;if(!W||W.length===0)return console.log(d.yellow("No items available for selection.")),null;let Y=W.map((K)=>{if(typeof K==="string")return{name:K,value:K,message:K};else return{name:K[G],value:K[G],message:K[q]||K[G]}}),L=[];if(Z&&Z.length>0)L=Y.map((K,T)=>Z.includes(K.name)?T:-1).filter((K)=>K!==-1);let M="selectedItems",J=await O1({type:"multiselect",name:M,message:z,choices:Y,initial:L,hint:"(Use space to select, enter to confirm)",validate:(K)=>{if(K.length===0&&!Q)return"Please select at least one item";return!0}});if(Q&&J[M].length===0)return null;return J[M]}var s={promptForSelection:h1,promptForMultipleSelection:l1};var X=V.join(m.homedir(),".fnet","express");async function T1($){$.command(["$0 [project-name]","create [project-name]"],"Create a new express project",(W)=>{return W.positional("project-name",{describe:"Name of the project",type:"string"}).option("yes",{alias:"y",describe:"Skip all prompts and use defaults",type:"boolean",default:!1}).option("runtime",{describe:"Runtime to use (node, python, bun)",type:"string",choices:["node","python","bun"],default:"node"})},async(W)=>{await p1(W)}).command("list","List express projects",(W)=>{return W.option("today",{describe:"Show only projects created today",type:"boolean",default:!1}).option("type",{describe:"Filter by project type (fnode or fnet)",type:"string",choices:["fnode","fnet"]}).option("all",{describe:"Show all projects regardless of type",type:"boolean",default:!1,alias:"a"}).option("name",{describe:"Filter by project name",type:"string"})},async(W)=>{await n1(W)}).command("open [project-name]","Open an express project",(W)=>{return W.positional("project-name",{describe:"Name of the project to open",type:"string"}).option("latest",{describe:"Open the most recent project",type:"boolean",default:!1})},async(W)=>{await i1(W)}).command("move [project-name] [destination]","Move an express project to a real project location",(W)=>{return W.positional("project-name",{describe:"Name of the project to move",type:"string"}).positional("destination",{describe:"Destination directory",type:"string"}).option("latest",{describe:"Move the most recent project",type:"boolean",default:!1})},async(W)=>{await c1(W)}).command("remove [project-name]","Remove an express project",(W)=>{return W.positional("project-name",{describe:"Name of the project to remove",type:"string"}).option("latest",{describe:"Remove the most recent project",type:"boolean",default:!1}).option("yes",{alias:"y",describe:"Skip confirmation prompt",type:"boolean",default:!1})},async(W)=>{await s1(W)}).command("enter [project-name]","Enter the directory of an express project in the active terminal",(W)=>{return W.positional("project-name",{describe:"Name of the project to enter",type:"string"}).option("latest",{describe:"Enter the most recent project directory",type:"boolean",default:!1})},async(W)=>{await r1(W)}).demandCommand(1,"You need to specify a command").help()}async function p1($){try{if(!H.existsSync(X))H.mkdirSync(X,{recursive:!0});let W=new Date().toISOString().slice(0,10).replace(/-/g,""),z=V.join(X,W);if(!H.existsSync(z))H.mkdirSync(z,{recursive:!0});let q=$.projectName,G,Z=$.runtime;if(!$.yes){if(!q){let T=H.readdirSync(z).filter((F)=>F.startsWith("fnode-")).map((F)=>parseInt(F.replace("fnode-",""),10)).filter((F)=>!isNaN(F)),f=`fnode-${T.length>0?Math.max(...T)+1:1}`;q=(await A([{type:"input",name:"projectName",message:"Enter project name:",default:f}])).projectName}Z=(await A({type:"select",name:"runtime",message:"Select runtime:",choices:["node","python","bun"],initial:Z||"node"})).runtime}else{if(!q){let J=H.readdirSync(z).filter((T)=>T.startsWith("fnode-")).map((T)=>parseInt(T.replace("fnode-",""),10)).filter((T)=>!isNaN(T));q=`fnode-${J.length>0?Math.max(...J)+1:1}`}if(!Z)Z="node"}if(G=V.join(z,q),H.existsSync(G)){let J=1;while(H.existsSync(V.join(z,`${q}-${J}`)))J++;q=`${q}-${J}`,G=V.join(z,q)}if(!$.yes){if(!(await A([{type:"confirm",name:"proceed",message:`Create express project "${q}" in ${G}?`,default:!0}])).proceed){console.log(U.yellow("Project creation cancelled."));return}}console.log(U.blue(`Creating express project "${q}" in ${G}...`));let Q=V.dirname(G),L=["create","--name",V.basename(G)];if(L.push("--runtime",Z),$.yes)L.push("--yes");if(!H.existsSync(Q))H.mkdirSync(Q,{recursive:!0});let M=g("fnode",L,{stdio:"inherit",shell:!0,cwd:Q});return new Promise((J,K)=>{M.on("close",(T)=>{if(T===0)if(console.log(U.green(`
|
|
2
|
+
import{e as E}from"./index.9qgtmxq3.js";import{f as c}from"./index.05n3mvs9.js";import{i as k}from"./index.cvxrf34y.js";import q$ from"yargs";import w1 from"chalk";import{promisify as I1}from"node:util";import F1 from"tree-kill";var r=I1(F1),N=!1;async function n($,W){if(N)return;if(N=!0,!$.killed&&$.pid)try{if(await r($.pid,"SIGTERM").catch(()=>{}),await new Promise((q)=>setTimeout(q,500)),!$.killed)await r($.pid,"SIGKILL").catch(()=>{})}catch(q){}await new Promise((q)=>setTimeout(q,100));let z=W==="SIGINT"?130:W==="SIGTERM"?143:1;process.exit(z)}function S($){["SIGINT","SIGTERM","SIGQUIT"].forEach((W)=>{process.once(W,async()=>{await n($,W)})}),process.on("uncaughtException",async(W)=>{await n($)}),process.on("unhandledRejection",async(W)=>{await n($)}),$.on("close",(W)=>{if(!N)process.exit(W)})}function a(){process.on("uncaughtException",($)=>{if(!N)N=!0,setTimeout(()=>process.exit(1),500)}),process.on("unhandledRejection",($)=>{if(!N)N=!0,setTimeout(()=>process.exit(1),500)})}import x from"node:path";import{spawn as v}from"node:child_process";import u from"node:fs";import b from"chalk";import _1 from"@fnet/config";function C($,{name:W,bin:z,preArgs:q=[],createContext:G}){if(typeof z==="function")z=z();return $.command(`${W||z} [commands..]`,`${z} ${q.join(" ")}`,(Z)=>{return Z.help(!1).version(!1)},async(Z)=>{try{let Q=await G(Z),{projectDir:Y}=Q,L=(I)=>{if(!I.includes(" "))return I;if(process.platform==="win32")return`"${I.replace(/(["^])/g,"^$1")}"`;else return`"${I.replace(/(["\\$`])/g,"\\$1")}"`},M=process.argv.slice(3).map(L),J={...process.env},K=x.join(Y,"node_modules");J.NODE_PATH=K,J.NODE_PRESERVE_SYMLINKS=1;let T=v(z,[...q,...M],{cwd:Y,stdio:"inherit",shell:!0,detached:!0,env:J});S(T)}catch(Q){console.error(Q.message),process.exit(1)}})}function y($,{name:W,bin:z,preArgs:q=[],createContext:G}){return $.command(`${W||z} [commands..]`,`${z} ${q.join(" ")}`,(Z)=>{return Z.help(!1).version(!1)},async(Z)=>{try{let Q=await G(Z),{projectDir:Y}=Q,L=(K)=>{if(!K.includes(" "))return K;if(process.platform==="win32")return`"${K.replace(/(["^])/g,"^$1")}"`;else return`"${K.replace(/(["\\$`])/g,"\\$1")}"`},M=process.argv.slice(3).map(L);z=x.join(Y,".conda","bin",z||W);let J=v(z,[...q,...M],{cwd:Y,stdio:"inherit",shell:!0,detached:!0,env:{PYTHONPATH:Y}});S(J)}catch(Q){console.error(Q.message),process.exit(1)}})}function t($,{name:W,createContext:z}){return $.command(`${W} <binary> [commands..]`,"Run a binary from conda environment",(q)=>{return q.positional("binary",{type:"string",describe:"Binary name to run from .conda/bin"}).help(!1).version(!1)},async(q)=>{try{let G=await z(q),{projectDir:Z}=G,Q=(K)=>{if(!K.includes(" "))return K;if(process.platform==="win32")return`"${K.replace(/(["^])/g,"^$1")}"`;else return`"${K.replace(/(["\\$`])/g,"\\$1")}"`},Y=q.binary,L=process.argv.slice(4).map(Q),M=x.join(Z,".conda","bin",Y),J=v(M,L,{cwd:Z,stdio:"inherit",shell:!0,detached:!0,env:{PYTHONPATH:Z}});S(J)}catch(G){console.error(G.message),process.exit(1)}})}function e($,{name:W,preArgs:z=[],createContext:q}){return $.command(`${W} <config> <command> [options..]`,"Run a command with a config context",(G)=>{return G.positional("config",{type:"string"}).positional("command",{type:"string"}).help(!1).version(!1)},async(G)=>{try{let Z=await q(G),{projectDir:Q}=Z,Y=G.config,M=(await _1({name:Y,dir:Q,transferEnv:!1,optional:!0,tags:Z.tags}))?.data?.env||void 0,J=G.command,K=process.argv.slice(5),T=v(J,[...z,...K],{cwd:u.existsSync(Q)?Q:process.cwd(),stdio:"inherit",shell:!0,detached:!0,env:{...process.env,...M}});S(T)}catch(Z){console.error(Z.message),process.exit(1)}})}function $1($,{name:W,projectType:z="auto"}){return $.command(`${W} group [options..]`,"Run a command group.",(q)=>{return q.positional("group",{type:"string"}).option("ftag",{type:"array"}).help(!1).version(!1)},async(q)=>{try{let{runCommandGroup:G}=await import("./index.2pnjg6dc.js");await G({projectType:z,group:q.group,tags:q.ftag,args:q,argv:process.argv})}catch(G){console.error(G.message),process.exit(1)}})}function W1($,{name:W,createContext:z}){return $.command(`${W} [options]`,"Install the project as a binary",(q)=>{return q.option("name",{alias:"n",describe:"Name to use for the installed binary",type:"string"}).option("force",{alias:"f",describe:"Force overwrite if binary already exists",type:"boolean",default:!1}).option("yes",{alias:"y",describe:"Automatically answer yes to all prompts",type:"boolean",default:!1})},async(q)=>{try{let G=await z(q),{projectDir:Z}=G;console.log(b.blue("Compiling project..."));let Q=x.join(Z,".bin");if(!u.existsSync(Q))u.mkdirSync(Q,{recursive:!0});let Y=x.basename(x.dirname(Z)),L=G.project?.projectFileParsed?.features?.cli?.bin,M=q.name||L||Y;console.log(b.blue(`Using binary name: ${M}`));let J=x.join(Q,M),{spawn:K}=await import("child_process"),T=K("bun",["build","./dist/cli/esm/index.js","--compile",`--outfile=${J}`],{cwd:Z,stdio:"inherit",shell:!0});if(await new Promise((f,F)=>{T.on("close",(_)=>{if(_===0)f();else F(Error(`Compilation failed with code ${_}`))}),T.on("error",(_)=>{F(_)})}),process.platform!=="win32")u.chmodSync(J,493);console.log(b.green(`Binary compiled successfully: ${J}`)),console.log(b.blue("Installing binary..."));let I=["install",J];if(q.name)I.push("--name",q.name);if(q.force)I.push("--force");if(q.yes)I.push("--yes");let D=K("fbin",I,{stdio:"inherit",shell:!0});await new Promise((f,F)=>{D.on("close",(_)=>{if(_===0)f();else F(Error(`Installation failed with code ${_}`))}),D.on("error",(_)=>{F(_)})})}catch(G){console.error(b.red(`Failed to install binary: ${G.message}`)),process.exit(1)}})}import w from"node:path";import B from"node:fs";import q1 from"@fnet/yaml";import A1 from"yaml";async function O($){if($.id)return{id:$.id,buildId:$.buildId,mode:$.mode,protocol:$.protocol||"ac:",templateDir:E("./template/fnode/node"),projectDir:w.resolve(process.cwd(),`./.output/${$.id}`),tags:$.ftag,dev:$.dev};else try{let W=await R1({tags:$.ftag}),z=W.runtime.type==="bun"?"node":W.runtime.type;return{buildId:$.buildId,mode:$.mode,protocol:$.protocol||"src:",templateDir:E(`./template/fnode/${z}`),projectDir:w.resolve(W.projectDir,"./.workspace"),projectSrcDir:w.resolve(W.projectDir,"./src"),projectSrcDirSymlink:w.resolve(W.projectDir,"./.workspace/src-core"),projectAppDir:w.resolve(W.projectDir,"./app"),projectAppDirSymlink:w.resolve(W.projectDir,"./.workspace/app"),projectCliDir:w.resolve(W.projectDir,"./cli"),projectCliDirSymlink:w.resolve(W.projectDir,"./.workspace/cli"),project:W,tags:$.ftag,dev:$.dev}}catch(W){return console.warn(`Warning: Could not load project: ${W.message}`),{projectDir:process.cwd(),tags:$.ftag}}}async function R1({tags:$}){let W=N1(process.cwd());if(!B.existsSync(W))throw Error("fnode.yaml file not found in current directory.");let{raw:z,parsed:q}=await q1({file:W,tags:$}),G=w.dirname(W);q.features=q.features||{};let Z=q.features;if(Z.runtime=Z.runtime||{},Z.runtime.type=Z.runtime.type||"node",Z.runtime.type==="python")Z.runtime.template=Z.runtime.template||"python";else if(Z.runtime.type==="bun")Z.runtime.template=Z.runtime.template||"node";else Z.runtime.template=Z.runtime.template||"node";let Q={libraryAtom:{doc:{...q},fileName:"index"},projectDir:G,projectFilePath:W,projectFileContent:z,projectFileParsed:q,runtime:Z.runtime},Y=w.resolve(G,"fnet/targets.yaml");if(!B.existsSync(Y)){if(Y=w.resolve(G,"node.devops.yaml"),B.existsSync(Y)){let M=w.resolve(G,"fnet");if(!B.existsSync(M))B.mkdirSync(M);B.copyFileSync(Y,w.resolve(G,"fnet/targets.yaml")),B.unlinkSync(Y)}}if(B.existsSync(Y)){let{raw:M,parsed:J}=await q1({file:Y,tags:$}),K=A1.parseDocument(M);Q.devops={filePath:Y,fileContent:M,yamlDocument:K,doc:{...J},type:"library.deploy",save:async()=>{B.writeFileSync(Q.devops.filePath,K.toString())}}}let L=w.resolve(G,"readme.md");if(B.existsSync(L)){let M=B.readFileSync(L,"utf8");Q.readme={filePath:L,fileContent:M,doc:{content:M,"content-type":"markdown"},type:"wiki"}}return Q}function N1($){let W=w.resolve($,"node.yaml"),z=w.resolve($,"fnode.yaml");if(B.existsSync(z))return z;if(B.existsSync(W))try{let q=B.readFileSync(W,"utf8");return B.writeFileSync(z,q,"utf8"),B.unlinkSync(W),console.log(`Migrated node.yaml to fnode.yaml in ${$}`),z}catch(q){return console.error(`Error migrating node.yaml to fnode.yaml: ${q.message}`),W}return z}import x1 from"node:path";import z1 from"node:fs";import k1 from"node:os";import E1 from"@flownet/lib-render-templates-dir";import i from"@fnet/shelljs";var S1={command:"create",describe:"Create a new fnode project",builder:($)=>{return $.option("name",{type:"string",describe:"Project name",demandOption:!0}).option("vscode",{type:"boolean",default:!0,alias:"vs",describe:"Open in VS Code after creation"}).option("runtime",{type:"string",default:"node",choices:["node","python","bun"],describe:"Runtime environment"})},handler:async($)=>{try{let W=process.cwd(),z=E("./template/fnode/project"),q=x1.resolve(W,$.name);if(!z1.existsSync(q))z1.mkdirSync(q);await E1({dir:z,outDir:q,context:{name:$.name,runtime:$.runtime,platform:k1.platform()},copyUnmatchedAlso:!0});let G=await i("fnode build",{cwd:q});if(G.code!==0)throw Error("Failed to build project.");if(c("git")){if(G=await i("git init --initial-branch=main",{cwd:q}),G.code!==0)throw Error("Failed to initialize git.")}if(c("code")&&$.vscode){if(G=await i(`cd ${q} && code .`),G.code!==0)throw Error("Failed to open vscode.")}console.log("Creating project succeeded!"),process.exit(0)}catch(W){console.error("Initialization failed!",W.message),process.exit(1)}}},G1=S1;import b1 from"node:os";import y1 from"@flownet/lib-render-templates-dir";import D1 from"@fnet/shelljs";var f1={command:"project",describe:"Manage fnode project",builder:($)=>{return $.option("update",{type:"boolean",default:!1,alias:"-u",describe:"Update project files"})},handler:async($)=>{try{let W=E("./template/fnode/project"),z=process.cwd(),q=await O($);if($.update){if(await y1({dir:W,outDir:z,context:{name:q.project.projectFileParsed.name,runtime:q.project.runtime.type,platform:b1.platform()},copyUnmatchedAlso:!0}),(await D1("fnode build",{cwd:z})).code!==0)throw Error("Failed to build project.");console.log("Updating project succeeded!")}process.exit(0)}catch(W){console.error("Project failed.",W.message),process.exit(1)}}},Q1=f1;class Z1{static async createBuilder($){if(!$.project)return console.warn("No project provided, defaulting to node runtime"),new(await import("./index.k98v9acr.js")).default($);let W=$.project?.runtime?.type||"node";try{return new(await this.loadBuilderClass(W))($)}catch(z){throw Error(`Failed to create builder for runtime '${W}': ${z.message}`)}}static async loadBuilderClass($){switch($.toLowerCase()){case"node":case"bun":return(await import("./index.k98v9acr.js")).default;case"python":return(await import("./index.1nyzphey.js")).default;default:throw Error(`Unsupported runtime type: ${$}`)}}}var R=Z1;var u1={command:"build",describe:"Build fnode project",builder:($)=>{return $.option("id",{type:"string",describe:"Project ID"}).option("buildId",{type:"string",alias:"bid",describe:"Build ID"}).option("mode",{type:"string",default:"build",choices:["all","file","build","deploy","bpmn"],describe:"Build mode"}).option("ftag",{type:"array",describe:"Tags for conditional configuration"}).option("dev",{type:"boolean",default:!1,describe:"Development mode"})},handler:async($)=>{try{let W=await O($),z=await R.createBuilder(W);await z.init(),await z.build(),console.log("Building library succeeded!"),process.exit(0)}catch(W){console.error("Building library failed!",W.message),process.exit(1)}}},Y1=u1;var v1={command:"build:dev",describe:"Build fnode project",builder:($)=>{return $.option("id",{type:"string",describe:"Project ID"}).option("buildId",{type:"string",alias:"bid",describe:"Build ID"}).option("mode",{type:"string",default:"build",choices:["all","file","build","deploy","bpmn"],describe:"Build mode"}).option("ftag",{type:"array",describe:"Tags for conditional configuration"}).option("dev",{type:"boolean",default:!1,describe:"Development mode"})},handler:async($)=>{try{$.dev=!0;let W=await O($),z=await R.createBuilder(W);await z.init(),await z.build(),console.log("Building library succeeded!"),process.exit(0)}catch(W){console.error("Building library failed!",W.message),process.exit(1)}}},K1=v1;var P1={command:"deploy",describe:"Build and deploy fnode project",builder:($)=>{return $.option("id",{type:"string",describe:"Project ID"}).option("buildId",{type:"string",alias:"bid",describe:"Build ID"}).option("ftag",{type:"array",describe:"Tags for conditional configuration"})},handler:async($)=>{try{let W=await O({...$,mode:"all"}),z=await R.createBuilder(W);await z.init(),await z.build(),console.log("Building library succeeded!"),process.exit(0)}catch(W){console.error("Building library failed!",W.message),process.exit(1)}}},U1=P1;var j1={command:"file",describe:"Just create files",builder:($)=>{return $.option("id",{type:"string",describe:"Project ID"}).option("buildId",{type:"string",alias:"bid",describe:"Build ID"}).option("ftag",{type:"array",describe:"Tags for conditional configuration"})},handler:async($)=>{try{let W=await O({...$,mode:"file"}),z=await R.createBuilder(W);await z.init(),await z.build(),console.log("Building library succeeded!"),process.exit(0)}catch(W){console.error("Building library failed!",W.message),process.exit(1)}}},J1=j1;import M1 from"node:path";import P from"node:fs";import d1 from"@fnet/prompt";var m1={command:"input [name]",describe:"Create or modify an input config file",builder:($)=>{return $.positional("name",{type:"string",demandOption:!1,describe:"Input name"})},handler:async($)=>{try{let W=await O($),{project:z}=W,{projectDir:q,projectFileParsed:G}=z,Z=G.input;if(!Z)throw Error("Config schema not found in project file.");if(!Reflect.has($,"name")){let{inputName:K}=await d1({type:"input",name:"inputName",message:"Input name:",initial:"dev"});$.name=K}let Q=M1.resolve(q,".fnet");if(!P.existsSync(Q))P.mkdirSync(Q);let Y=M1.resolve(Q,`${$.name}.fnet`),L=P.existsSync(Y),M=(await import("@fnet/object-from-schema")).default,J=await M({schema:Z,format:"yaml",ref:L?Y:void 0});P.writeFileSync(Y,J)}catch(W){console.error(W.message),process.exit(1)}}},H1=m1;import V from"node:path";import H from"node:fs";import d from"node:os";import{spawn as m}from"node:child_process";import U from"chalk";import A from"@fnet/prompt";import j from"chalk";import L1 from"@fnet/prompt";async function g1($){let{items:W,message:z,nameField:q="name",valueField:G="name",initialValue:Z=null,allowAbort:Q=!0}=$;if(!W||W.length===0)return console.log(j.yellow("No items available for selection.")),null;if(W.length===1&&!Q){let K=W[0],T=typeof K==="string"?K:K[G];return console.log(j.blue(`Only one option available: ${typeof K==="string"?K:K[q]}`)),T}let Y=W.map((K)=>{if(typeof K==="string")return{name:K,value:K,message:K};else return{name:K[G],value:K[G],message:K[q]||K[G]}});if(Q)Y.push({name:"cancel",value:null,message:j.yellow("Cancel")});let L=null;if(Z){let K=Y.findIndex((T)=>T.name===Z);if(K!==-1)L=K}let M="selectedItem",{[M]:J}=await L1({type:"select",name:M,message:z,choices:Y,initial:L});if(J==="cancel")return null;return J}async function h1($){let{items:W,message:z,nameField:q="name",valueField:G="name",initialValues:Z=[],allowAbort:Q=!0}=$;if(!W||W.length===0)return console.log(j.yellow("No items available for selection.")),null;let Y=W.map((K)=>{if(typeof K==="string")return{name:K,value:K,message:K};else return{name:K[G],value:K[G],message:K[q]||K[G]}}),L=[];if(Z&&Z.length>0)L=Y.map((K,T)=>Z.includes(K.name)?T:-1).filter((K)=>K!==-1);let M="selectedItems",J=await L1({type:"multiselect",name:M,message:z,choices:Y,initial:L,hint:"(Use space to select, enter to confirm)",validate:(K)=>{if(K.length===0&&!Q)return"Please select at least one item";return!0}});if(Q&&J[M].length===0)return null;return J[M]}var o={promptForSelection:g1,promptForMultipleSelection:h1};var X=V.join(d.homedir(),".fnet","express");async function V1($){$.command(["$0 [project-name]","create [project-name]"],"Create a new express project",(W)=>{return W.positional("project-name",{describe:"Name of the project",type:"string"}).option("yes",{alias:"y",describe:"Skip all prompts and use defaults",type:"boolean",default:!1}).option("runtime",{describe:"Runtime to use (node, python, bun)",type:"string",choices:["node","python","bun"],default:"node"})},async(W)=>{await l1(W)}).command("list","List express projects",(W)=>{return W.option("today",{describe:"Show only projects created today",type:"boolean",default:!1}).option("type",{describe:"Filter by project type (fnode or fnet)",type:"string",choices:["fnode","fnet"]}).option("all",{describe:"Show all projects regardless of type",type:"boolean",default:!1,alias:"a"}).option("name",{describe:"Filter by project name",type:"string"})},async(W)=>{await p1(W)}).command("open [project-name]","Open an express project",(W)=>{return W.positional("project-name",{describe:"Name of the project to open",type:"string"}).option("latest",{describe:"Open the most recent project",type:"boolean",default:!1})},async(W)=>{await n1(W)}).command("move [project-name] [destination]","Move an express project to a real project location",(W)=>{return W.positional("project-name",{describe:"Name of the project to move",type:"string"}).positional("destination",{describe:"Destination directory",type:"string"}).option("latest",{describe:"Move the most recent project",type:"boolean",default:!1})},async(W)=>{await i1(W)}).command("remove [project-name]","Remove an express project",(W)=>{return W.positional("project-name",{describe:"Name of the project to remove",type:"string"}).option("latest",{describe:"Remove the most recent project",type:"boolean",default:!1}).option("yes",{alias:"y",describe:"Skip confirmation prompt",type:"boolean",default:!1})},async(W)=>{await o1(W)}).command("enter [project-name]","Enter the directory of an express project in the active terminal",(W)=>{return W.positional("project-name",{describe:"Name of the project to enter",type:"string"}).option("latest",{describe:"Enter the most recent project directory",type:"boolean",default:!1})},async(W)=>{await s1(W)}).demandCommand(1,"You need to specify a command").help()}async function l1($){try{if(!H.existsSync(X))H.mkdirSync(X,{recursive:!0});let W=new Date().toISOString().slice(0,10).replace(/-/g,""),z=V.join(X,W);if(!H.existsSync(z))H.mkdirSync(z,{recursive:!0});let q=$.projectName,G,Z=$.runtime;if(!$.yes){if(!q){let T=H.readdirSync(z).filter((F)=>F.startsWith("fnode-")).map((F)=>parseInt(F.replace("fnode-",""),10)).filter((F)=>!isNaN(F)),D=`fnode-${T.length>0?Math.max(...T)+1:1}`;q=(await A([{type:"input",name:"projectName",message:"Enter project name:",default:D}])).projectName}Z=(await A({type:"select",name:"runtime",message:"Select runtime:",choices:["node","python","bun"],initial:Z||"node"})).runtime}else{if(!q){let J=H.readdirSync(z).filter((T)=>T.startsWith("fnode-")).map((T)=>parseInt(T.replace("fnode-",""),10)).filter((T)=>!isNaN(T));q=`fnode-${J.length>0?Math.max(...J)+1:1}`}if(!Z)Z="node"}if(G=V.join(z,q),H.existsSync(G)){let J=1;while(H.existsSync(V.join(z,`${q}-${J}`)))J++;q=`${q}-${J}`,G=V.join(z,q)}if(!$.yes){if(!(await A([{type:"confirm",name:"proceed",message:`Create express project "${q}" in ${G}?`,default:!0}])).proceed){console.log(U.yellow("Project creation cancelled."));return}}console.log(U.blue(`Creating express project "${q}" in ${G}...`));let Q=V.dirname(G),L=["create","--name",V.basename(G)];if(L.push("--runtime",Z),$.yes)L.push("--yes");if(!H.existsSync(Q))H.mkdirSync(Q,{recursive:!0});let M=m("fnode",L,{stdio:"inherit",shell:!0,cwd:Q});return new Promise((J,K)=>{M.on("close",(T)=>{if(T===0)if(console.log(U.green(`
|
|
3
3
|
Express project "${q}" created successfully!`)),console.log(U.blue(`
|
|
4
|
-
Project location: ${G}`)),!$.yes)
|
|
5
|
-
Failed to create express project "${q}".`)),K(Error(`Process exited with code ${T}`))})})}catch(W){console.error(U.red(`Error creating express project: ${W.message}`)),process.exit(1)}}async function
|
|
6
|
-
Express Projects:`));let q=(await import("./index.bhapgrs7.js")).default,G=["NAME","TYPE","DATE","PATH"],Z=q.createTable(G,{chars:{mid:"","mid-mid":"","left-mid":"","right-mid":""}});for(let Q of z){let Y=Q.path;if(Y.startsWith(
|
|
7
|
-
Total: ${z.length} projects`))}catch(W){console.error(U.red(`Error listing express projects: ${W.message}`)),process.exit(1)}}async function
|
|
8
|
-
Project moved successfully to ${G}`)),(await A({type:"confirm",name:"deleteOriginal",message:"Delete the original express project?",initial:!1})).deleteOriginal)H.rmSync(q,{recursive:!0,force:!0}),console.log(U.green("Original project deleted."));await
|
|
9
|
-
Opening a new shell in the project directory...`));let z=process.env.SHELL||"/bin/bash",q=
|
|
10
|
-
Returned from project directory.`)),G()})})}catch(W){console.error(U.red(`Error entering express project directory: ${W.message}`)),process.exit(1)}}import
|
|
4
|
+
Project location: ${G}`)),!$.yes)c1(G);else J();else console.error(U.red(`
|
|
5
|
+
Failed to create express project "${q}".`)),K(Error(`Process exited with code ${T}`))})})}catch(W){console.error(U.red(`Error creating express project: ${W.message}`)),process.exit(1)}}async function p1($){try{if(!H.existsSync(X)){console.log(U.yellow("No express projects found."));return}let W=H.readdirSync(X).filter((Q)=>/^\d{8}$/.test(Q)).sort((Q,Y)=>Y.localeCompare(Q));if($.today){let Q=new Date().toISOString().slice(0,10).replace(/-/g,""),Y=W.indexOf(Q);if(Y===-1){console.log(U.yellow("No express projects found for today."));return}W.splice(0,Y),W.splice(1)}let z=[];if(!$.type&&!$.all)$.type="fnode";for(let Q of W){let Y=V.join(X,Q),L=H.readdirSync(Y);for(let M of L){let J=V.join(Y,M),K=H.statSync(J),T="unknown";if(M.startsWith("fnode-")||H.existsSync(V.join(J,"fnode.yaml")))T="fnode";else if(M.startsWith("fnet-")||H.existsSync(V.join(J,"fnet.yaml")))T="fnet";if($.type&&T!==$.type)continue;if($.name&&!M.includes($.name))continue;let I=`${Q.slice(0,4)}-${Q.slice(4,6)}-${Q.slice(6,8)}`;z.push({name:M,type:T,date:I,path:J,created:K.birthtime})}}if(z.sort((Q,Y)=>Y.created-Q.created),z.length===0){console.log(U.yellow("No express projects found matching the criteria."));return}console.log(U.blue(`
|
|
6
|
+
Express Projects:`));let q=(await import("./index.bhapgrs7.js")).default,G=["NAME","TYPE","DATE","PATH"],Z=q.createTable(G,{chars:{mid:"","mid-mid":"","left-mid":"","right-mid":""}});for(let Q of z){let Y=Q.path;if(Y.startsWith(d.homedir()))Y="~"+Y.substring(d.homedir().length);Z.push([U.white(Q.name),Q.type==="fnet"?U.cyan(Q.type):Q.type==="fnode"?U.green(Q.type):Q.type,Q.date,Y])}console.log(Z.toString()),console.log(U.green("Projects: ")+U.yellow(z.filter((Q)=>Q.type==="fnode").length+" fnode, ")+U.cyan(z.filter((Q)=>Q.type==="fnet").length+" fnet")),console.log(U.blue(`
|
|
7
|
+
Total: ${z.length} projects`))}catch(W){console.error(U.red(`Error listing express projects: ${W.message}`)),process.exit(1)}}async function n1($){try{if(!H.existsSync(X)){console.log(U.yellow("No express projects found."));return}let W;if($.latest){if(W=await g(),!W){console.log(U.yellow("No express projects found."));return}}else if($.projectName){if(W=await h($.projectName),!W){console.log(U.yellow(`Project "${$.projectName}" not found.`));return}}else{let z=await l();if(!z){console.log(U.yellow("No project selected."));return}W=V.join(X,z)}await s(W)}catch(W){console.error(U.red(`Error opening express project: ${W.message}`)),process.exit(1)}}async function i1($){try{let W=process.cwd(),z=W.includes(X),q;if(z)q=W,console.log(U.blue(`Using current express project: ${V.basename(q)}`));else if($.latest){if(q=await g(),!q){console.log(U.yellow("No express projects found."));return}}else if($.projectName){if(q=await h($.projectName),!q){console.log(U.yellow(`Project "${$.projectName}" not found.`));return}}else{let Q=await l();if(!Q){console.log(U.yellow("No project selected."));return}q=V.join(X,Q)}let G=$.destination;if(!G)G=(await A({type:"input",name:"destination",message:"Enter destination directory:",initial:V.join(process.cwd(),V.basename(q))})).destination;if(G.startsWith("~"))G=V.join(d.homedir(),G.slice(1));if(G=V.resolve(G),G.startsWith(q+V.sep)||G===q){console.log(U.red("Destination cannot be inside the source directory."));return}if(H.existsSync(G)){if(!H.statSync(G).isDirectory()){console.log(U.red(`Destination "${G}" is not a directory.`));return}if(H.readdirSync(G).length>0){if(!(await A({type:"confirm",name:"overwrite",message:`Destination "${G}" is not empty. Continue anyway?`,initial:!1})).overwrite){console.log(U.yellow("Project move cancelled."));return}}}else H.mkdirSync(G,{recursive:!0});if(console.log(U.blue(`Moving project from ${q} to ${G}...`)),T1(q,G),console.log(U.green(`
|
|
8
|
+
Project moved successfully to ${G}`)),(await A({type:"confirm",name:"deleteOriginal",message:"Delete the original express project?",initial:!1})).deleteOriginal)H.rmSync(q,{recursive:!0,force:!0}),console.log(U.green("Original project deleted."));await s(G)}catch(W){console.error(U.red(`Error moving express project: ${W.message}`)),process.exit(1)}}async function g(){let $=H.readdirSync(X).filter((Q)=>/^\d{8}$/.test(Q)).sort((Q,Y)=>Y.localeCompare(Q));if($.length===0)return null;let W=$[0],z=V.join(X,W),q=H.readdirSync(z);if(q.length===0)return null;let G=null,Z=0;for(let Q of q){let Y=V.join(z,Q),L=H.statSync(Y);if(L.birthtimeMs>Z)Z=L.birthtimeMs,G=Y}return G}async function h($){let W=H.readdirSync(X).filter((z)=>/^\d{8}$/.test(z)).sort((z,q)=>q.localeCompare(z));for(let z of W){let q=V.join(X,z),G=H.readdirSync(q);if(G.includes($))return V.join(q,$);let Z=G.filter((Q)=>Q.includes($));if(Z.length>0)if(Z.length===1)return V.join(q,Z[0]);else{let Q=Z.map((L)=>({name:V.join(q,L),value:V.join(q,L),message:`${L} (${z})`})),Y=await o.promptForSelection({items:Q,message:`Multiple projects match "${$}". Please select one:`,nameField:"message",valueField:"value",allowAbort:!0});if(Y===null)return console.log(U.yellow("Operation cancelled.")),null;return Y}}return null}async function l(){let $=[],W=H.readdirSync(X).filter((q)=>/^\d{8}$/.test(q)).sort((q,G)=>G.localeCompare(q));for(let q of W){let G=V.join(X,q),Z=H.readdirSync(G);for(let Q of Z){let Y=V.join(G,Q),L=H.statSync(Y),M=`${q}/${Q}`;$.push({name:M,value:M,message:`${Q} (${q})`,created:L.birthtime})}}if($.sort((q,G)=>G.created-q.created),$.length===0)return null;let z=await o.promptForSelection({items:$,message:"Select a project:",nameField:"message",valueField:"value",allowAbort:!0});if(z===null)return console.log(U.yellow("Operation cancelled.")),null;return z}async function c1($){try{if((await A({type:"confirm",name:"openIDE",message:"Would you like to open the project in an IDE?",initial:!0})).openIDE)await s($)}catch(W){console.error(U.red(`Error opening IDE: ${W.message}`))}}async function s($){let W=await O1("code --version"),z=await O1("code-insiders --version"),q=null;if(W&&z)q=(await A({type:"select",name:"ide",message:"Which IDE would you like to use?",choices:[{name:"Visual Studio Code",value:"code"},{name:"Visual Studio Code Insiders",value:"code-insiders"}]})).ide;else if(W)q="code";else if(z)q="code-insiders";else{console.log(U.yellow("No supported IDE found. Please open the project manually.")),console.log(U.blue(`Project path: ${$}`));return}console.log(U.blue(`Opening project in ${q}...`)),console.log(U.blue(`Project path: ${$}`));let G=m(q,[$],{stdio:"inherit",shell:!0});return new Promise((Z,Q)=>{G.on("close",(Y)=>{if(Y===0)console.log(U.green(`Project opened in ${q}.`)),Z();else console.error(U.red(`Failed to open project in ${q}.`)),Q(Error(`Process exited with code ${Y}`))})})}async function O1($){return new Promise((W)=>{m($,{shell:!0,stdio:"ignore"}).on("close",(q)=>{W(q===0)})})}function T1($,W){if(!H.existsSync(W))H.mkdirSync(W,{recursive:!0});let z=H.readdirSync($,{withFileTypes:!0});for(let q of z){let G=V.join($,q.name),Z=V.join(W,q.name);if(q.isDirectory()){if(q.name===".git"||q.name===".workspace")continue;T1(G,Z)}else H.copyFileSync(G,Z)}}async function o1($){try{if(!H.existsSync(X)){console.log(U.yellow("No express projects found."));return}let W;if($.latest){if(W=await g(),!W){console.log(U.yellow("No express projects found."));return}}else if($.projectName){if(W=await h($.projectName),!W){console.log(U.yellow(`Project "${$.projectName}" not found.`));return}}else{let q=await l();if(!q){console.log(U.yellow("No project selected."));return}W=V.join(X,q)}let z=V.basename(W);if(!$.yes){if(!(await A({type:"confirm",name:"confirm",message:`Are you sure you want to remove project "${z}"?`,initial:!1})).confirm){console.log(U.yellow("Project removal cancelled."));return}}console.log(U.blue(`Removing project "${z}"...`)),H.rmSync(W,{recursive:!0,force:!0}),console.log(U.green(`Project "${z}" removed successfully.`))}catch(W){console.error(U.red(`Error removing express project: ${W.message}`)),process.exit(1)}}async function s1($){try{if(!H.existsSync(X)){console.log(U.yellow("No express projects found."));return}let W;if($.latest){if(W=await g(),!W){console.log(U.yellow("No express projects found."));return}}else if($.projectName){if(W=await h($.projectName),!W){console.log(U.yellow(`Project "${$.projectName}" not found.`));return}}else{let G=await l();if(!G){console.log(U.yellow("No project selected."));return}W=V.join(X,G)}console.log(U.blue(`Entering project directory: ${W}`)),console.log(U.yellow(`
|
|
9
|
+
Opening a new shell in the project directory...`));let z=process.env.SHELL||"/bin/bash",q=m(z,[],{stdio:"inherit",cwd:W,shell:!0});return new Promise((G)=>{q.on("close",()=>{console.log(U.green(`
|
|
10
|
+
Returned from project directory.`)),G()})})}catch(W){console.error(U.red(`Error entering express project directory: ${W.message}`)),process.exit(1)}}import C1 from"node:path";import{fileURLToPath as $$}from"node:url";import r1 from"node:fs";import p from"node:path";import{fileURLToPath as a1}from"node:url";var t1=p.dirname(a1(import.meta.url));function e1({baseDir:$}){$=$||t1;let W=$;while(W!==p.parse(W).root){let z=p.join(W,"node_modules");if(r1.existsSync(z))return z;W=p.dirname(W)}return null}var X1=e1;var W$=C1.dirname($$(import.meta.url));function B1(){let $=X1({baseDir:W$}),W=process.platform==="win32"?";":":";if($)process.env.PATH=`${C1.join($,"/.bin")}${W}${process.env.PATH}`}a();B1();async function z$(){try{let $=q$(process.argv.slice(2)).usage("Usage: $0 <command> [options]").command(G1).command(Q1).command(Y1).command(K1).command(U1).command(J1).command(H1).command("express","Create and manage express projects",V1);$=C($,{bin:"npm",createContext:O}),$=C($,{bin:"node",createContext:O}),$=C($,{bin:"bun",createContext:O}),$=C($,{name:"serve",bin:"bun",preArgs:["run","serve","--"],createContext:O}),$=C($,{name:"watch",bin:"bun",preArgs:["run","watch","--"],createContext:O}),$=C($,{name:"app",bin:"bun",preArgs:["run","app","--"],createContext:O}),$=C($,{name:"cli",bin:"bun",preArgs:["run","cli","--"],createContext:O}),$=C($,{name:"cli:dev",bin:"bun",preArgs:["run","cli:dev","--"],createContext:O}),$=C($,{name:"cli:compile",bin:"bun",preArgs:["run","cli:compile","--"],createContext:O}),$=C($,{name:"cli:compile:dev",bin:"bun",preArgs:["run","cli:compile:dev","--"],createContext:O}),$=C($,{name:"cli:install",bin:"bun",preArgs:["run","cli:install","--"],createContext:O}),$=C($,{name:"compile",bin:"bun",preArgs:["run","compile","--"],createContext:O}),$=W1($,{name:"install",createContext:O}),$=C($,{bin:"npx",createContext:O}),$=C($,{bin:"cdk",createContext:O}),$=C($,{bin:"aws",createContext:O}),$=e($,{name:"with",createContext:O}),$=$1($,{name:"run",projectType:"fnode"}),$=y($,{name:"python",createContext:O}),$=y($,{name:"python3",createContext:O}),$=y($,{name:"pip",createContext:O}),$=y($,{name:"pip3",createContext:O}),$=t($,{name:"bin",createContext:O}),$.demandCommand(1,"You need at least one command before moving on").help().version().argv}catch($){console.error(w1.red(`Fatal error: ${$.message}`)),process.exit(1)}}z$().catch(($)=>{console.error(w1.red(`Fatal error: ${$.message}`)),process.exit(1)});
|