@turbo/codemod 2.0.0-canary.0 → 2.0.0-canary.2
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/cli.js +15 -15
- package/dist/transforms/add-package-names.js +1 -1
- package/dist/transforms/clean-globs.js +16 -16
- package/dist/transforms/migrate-dot-env.js +106 -0
- package/dist/transforms/migrate-env-var-dependencies.js +13 -13
- package/dist/transforms/rename-output-mode.js +1 -1
- package/dist/transforms/rename-pipeline.js +106 -0
- package/dist/transforms/set-default-outputs.js +6 -6
- package/dist/transforms/stabilize-env-mode.js +1 -1
- package/dist/transforms/stabilize-ui.js +93 -0
- package/dist/transforms/transform-env-literals-to-wildcards.js +23 -23
- package/package.json +6 -6
|
@@ -40,7 +40,7 @@ ${i.message}`:y,F=[v,e,t].filter(Boolean).join(`
|
|
|
40
40
|
`,h=Buffer.byteLength(c),f=Math.floor(Math.log(h)/Math.log(10))+1;return h+f>=Math.pow(10,f)&&(f+=1),f+h+c}};n.parse=(a,l,c)=>new n(s(o(a),l),c);var s=(a,l)=>l?Object.keys(a).reduce((c,h)=>(c[h]=a[h],c),l):a,o=a=>a.replace(/\n$/,"").split(`
|
|
41
41
|
`).reduce(u,Object.create(null)),u=(a,l)=>{let c=parseInt(l,10);if(c!==Buffer.byteLength(l)+1)return a;l=l.slice((c+" ").length);let h=l.split("="),f=h.shift().replace(/^SCHILY\.(dev|ino|nlink)/,"$1");if(!f)return a;let d=h.join("=");return a[f]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(f)?new Date(d*1e3):/^[0-9]+$/.test(d)?+d:d,a};e.exports=n}),wn=ee((t,e)=>{W(),e.exports=r=>{let i=r.length-1,n=-1;for(;i>-1&&r.charAt(i)==="/";)n=i,i--;return n===-1?r:r.slice(0,n)}}),xl=ee((t,e)=>{"use strict";W(),e.exports=r=>class extends r{warn(i,n,s={}){this.file&&(s.file=this.file),this.cwd&&(s.cwd=this.cwd),s.code=n instanceof Error&&n.code||i,s.tarCode=i,!this.strict&&s.recoverable!==!1?(n instanceof Error&&(s=Object.assign(n,s),n=n.message),this.emit("warn",s.tarCode,n,s)):n instanceof Error?this.emit("error",Object.assign(n,s)):this.emit("error",Object.assign(new Error(`${i}: ${n}`),s))}}}),ay=ee((t,e)=>{"use strict";W();var r=["|","<",">","?",":"],i=r.map(o=>String.fromCharCode(61440+o.charCodeAt(0))),n=new Map(r.map((o,u)=>[o,i[u]])),s=new Map(i.map((o,u)=>[o,r[u]]));e.exports={encode:o=>r.reduce((u,a)=>u.split(a).join(n.get(a)),o),decode:o=>i.reduce((u,a)=>u.split(a).join(s.get(a)),o)}}),ly=ee((t,e)=>{W();var{isAbsolute:r,parse:i}=te("path").win32;e.exports=n=>{let s="",o=i(n);for(;r(n)||o.root;){let u=n.charAt(0)==="/"&&n.slice(0,4)!=="//?/"?"/":o.root;n=n.slice(u.length),s+=u,o=i(n)}return[s,n]}}),ex=ee((t,e)=>{"use strict";W(),e.exports=(r,i,n)=>(r&=4095,n&&(r=(r|384)&-19),i&&(r&256&&(r|=64),r&32&&(r|=8),r&4&&(r|=1)),r)}),cy=ee((t,e)=>{"use strict";W();var r=vl(),i=Rl(),n=bn(),s=te("fs"),o=te("path"),u=_n(),a=wn(),l=(m,D)=>D?(m=u(m).replace(/^\.(\/|$)/,""),a(D)+"/"+m):u(m),c=16*1024*1024,h=Symbol("process"),f=Symbol("file"),d=Symbol("directory"),g=Symbol("symlink"),y=Symbol("hardlink"),E=Symbol("header"),v=Symbol("read"),F=Symbol("lstat"),O=Symbol("onlstat"),x=Symbol("onread"),R=Symbol("onreadlink"),L=Symbol("openfile"),_=Symbol("onopenfile"),S=Symbol("close"),N=Symbol("mode"),q=Symbol("awaitDrain"),k=Symbol("ondrain"),U=Symbol("prefix"),K=Symbol("hadError"),V=xl(),B=ay(),C=ly(),T=ex(),j=V(class extends r{constructor(m,D){if(D=D||{},super(D),typeof m!="string")throw new TypeError("path is required");this.path=u(m),this.portable=!!D.portable,this.myuid=process.getuid&&process.getuid()||0,this.myuser=process.env.USER||"",this.maxReadSize=D.maxReadSize||c,this.linkCache=D.linkCache||new Map,this.statCache=D.statCache||new Map,this.preservePaths=!!D.preservePaths,this.cwd=u(D.cwd||process.cwd()),this.strict=!!D.strict,this.noPax=!!D.noPax,this.noMtime=!!D.noMtime,this.mtime=D.mtime||null,this.prefix=D.prefix?u(D.prefix):null,this.fd=null,this.blockLen=null,this.blockRemain=null,this.buf=null,this.offset=null,this.length=null,this.pos=null,this.remain=null,typeof D.onwarn=="function"&&this.on("warn",D.onwarn);let A=!1;if(!this.preservePaths){let[w,I]=C(this.path);w&&(this.path=I,A=w)}this.win32=!!D.win32||process.platform==="win32",this.win32&&(this.path=B.decode(this.path.replace(/\\/g,"/")),m=m.replace(/\\/g,"/")),this.absolute=u(D.absolute||o.resolve(this.cwd,m)),this.path===""&&(this.path="./"),A&&this.warn("TAR_ENTRY_INFO",`stripping ${A} from absolute path`,{entry:this,path:A+this.path}),this.statCache.has(this.absolute)?this[O](this.statCache.get(this.absolute)):this[F]()}emit(m,...D){return m==="error"&&(this[K]=!0),super.emit(m,...D)}[F](){s.lstat(this.absolute,(m,D)=>{if(m)return this.emit("error",m);this[O](D)})}[O](m){this.statCache.set(this.absolute,m),this.stat=m,m.isFile()||(m.size=0),this.type=p(m),this.emit("stat",m),this[h]()}[h](){switch(this.type){case"File":return this[f]();case"Directory":return this[d]();case"SymbolicLink":return this[g]();default:return this.end()}}[N](m){return T(m,this.type==="Directory",this.portable)}[U](m){return l(m,this.prefix)}[E](){this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.header=new n({path:this[U](this.path),linkpath:this.type==="Link"?this[U](this.linkpath):this.linkpath,mode:this[N](this.stat.mode),uid:this.portable?null:this.stat.uid,gid:this.portable?null:this.stat.gid,size:this.stat.size,mtime:this.noMtime?null:this.mtime||this.stat.mtime,type:this.type,uname:this.portable?null:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?null:this.stat.atime,ctime:this.portable?null:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new i({atime:this.portable?null:this.header.atime,ctime:this.portable?null:this.header.ctime,gid:this.portable?null:this.header.gid,mtime:this.noMtime?null:this.mtime||this.header.mtime,path:this[U](this.path),linkpath:this.type==="Link"?this[U](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?null:this.header.uid,uname:this.portable?null:this.header.uname,dev:this.portable?null:this.stat.dev,ino:this.portable?null:this.stat.ino,nlink:this.portable?null:this.stat.nlink}).encode()),super.write(this.header.block)}[d](){this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[E](),this.end()}[g](){s.readlink(this.absolute,(m,D)=>{if(m)return this.emit("error",m);this[R](D)})}[R](m){this.linkpath=u(m),this[E](),this.end()}[y](m){this.type="Link",this.linkpath=u(o.relative(this.cwd,m)),this.stat.size=0,this[E](),this.end()}[f](){if(this.stat.nlink>1){let m=this.stat.dev+":"+this.stat.ino;if(this.linkCache.has(m)){let D=this.linkCache.get(m);if(D.indexOf(this.cwd)===0)return this[y](D)}this.linkCache.set(m,this.absolute)}if(this[E](),this.stat.size===0)return this.end();this[L]()}[L](){s.open(this.absolute,"r",(m,D)=>{if(m)return this.emit("error",m);this[_](D)})}[_](m){if(this.fd=m,this[K])return this[S]();this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let D=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(D),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[v]()}[v](){let{fd:m,buf:D,offset:A,length:w,pos:I}=this;s.read(m,D,A,w,I,(M,Z)=>{if(M)return this[S](()=>this.emit("error",M));this[x](Z)})}[S](m){s.close(this.fd,m)}[x](m){if(m<=0&&this.remain>0){let A=new Error("encountered unexpected EOF");return A.path=this.absolute,A.syscall="read",A.code="EOF",this[S](()=>this.emit("error",A))}if(m>this.remain){let A=new Error("did not encounter expected EOF");return A.path=this.absolute,A.syscall="read",A.code="EOF",this[S](()=>this.emit("error",A))}if(m===this.remain)for(let A=m;A<this.length&&m<this.blockRemain;A++)this.buf[A+this.offset]=0,m++,this.remain++;let D=this.offset===0&&m===this.buf.length?this.buf:this.buf.slice(this.offset,this.offset+m);this.write(D)?this[k]():this[q](()=>this[k]())}[q](m){this.once("drain",m)}write(m){if(this.blockRemain<m.length){let D=new Error("writing more data than expected");return D.path=this.absolute,this.emit("error",D)}return this.remain-=m.length,this.blockRemain-=m.length,this.pos+=m.length,this.offset+=m.length,super.write(m)}[k](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[S](m=>m?this.emit("error",m):this.end());this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[v]()}}),z=class extends j{[F](){this[O](s.lstatSync(this.absolute))}[g](){this[R](s.readlinkSync(this.absolute))}[L](){this[_](s.openSync(this.absolute,"r"))}[v](){let m=!0;try{let{fd:D,buf:A,offset:w,length:I,pos:M}=this,Z=s.readSync(D,A,w,I,M);this[x](Z),m=!1}finally{if(m)try{this[S](()=>{})}catch{}}}[q](m){m()}[S](m){s.closeSync(this.fd),m()}},P=V(class extends r{constructor(m,D){D=D||{},super(D),this.preservePaths=!!D.preservePaths,this.portable=!!D.portable,this.strict=!!D.strict,this.noPax=!!D.noPax,this.noMtime=!!D.noMtime,this.readEntry=m,this.type=m.type,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=D.prefix||null,this.path=u(m.path),this.mode=this[N](m.mode),this.uid=this.portable?null:m.uid,this.gid=this.portable?null:m.gid,this.uname=this.portable?null:m.uname,this.gname=this.portable?null:m.gname,this.size=m.size,this.mtime=this.noMtime?null:D.mtime||m.mtime,this.atime=this.portable?null:m.atime,this.ctime=this.portable?null:m.ctime,this.linkpath=u(m.linkpath),typeof D.onwarn=="function"&&this.on("warn",D.onwarn);let A=!1;if(!this.preservePaths){let[w,I]=C(this.path);w&&(this.path=I,A=w)}this.remain=m.size,this.blockRemain=m.startBlockSize,this.header=new n({path:this[U](this.path),linkpath:this.type==="Link"?this[U](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?null:this.uid,gid:this.portable?null:this.gid,size:this.size,mtime:this.noMtime?null:this.mtime,type:this.type,uname:this.portable?null:this.uname,atime:this.portable?null:this.atime,ctime:this.portable?null:this.ctime}),A&&this.warn("TAR_ENTRY_INFO",`stripping ${A} from absolute path`,{entry:this,path:A+this.path}),this.header.encode()&&!this.noPax&&super.write(new i({atime:this.portable?null:this.atime,ctime:this.portable?null:this.ctime,gid:this.portable?null:this.gid,mtime:this.noMtime?null:this.mtime,path:this[U](this.path),linkpath:this.type==="Link"?this[U](this.linkpath):this.linkpath,size:this.size,uid:this.portable?null:this.uid,uname:this.portable?null:this.uname,dev:this.portable?null:this.readEntry.dev,ino:this.portable?null:this.readEntry.ino,nlink:this.portable?null:this.readEntry.nlink}).encode()),super.write(this.header.block),m.pipe(this)}[U](m){return l(m,this.prefix)}[N](m){return T(m,this.type==="Directory",this.portable)}write(m){let D=m.length;if(D>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=D,super.write(m)}end(){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),super.end()}});j.Sync=z,j.Tar=P;var p=m=>m.isFile()?"File":m.isDirectory()?"Directory":m.isSymbolicLink()?"SymbolicLink":"Unsupported";e.exports=j}),tx=ee((t,e)=>{"use strict";W(),e.exports=function(r){r.prototype[Symbol.iterator]=function*(){for(let i=this.head;i;i=i.next)yield i.value}}}),hy=ee((t,e)=>{"use strict";W(),e.exports=r,r.Node=o,r.create=r;function r(u){var a=this;if(a instanceof r||(a=new r),a.tail=null,a.head=null,a.length=0,u&&typeof u.forEach=="function")u.forEach(function(h){a.push(h)});else if(arguments.length>0)for(var l=0,c=arguments.length;l<c;l++)a.push(arguments[l]);return a}r.prototype.removeNode=function(u){if(u.list!==this)throw new Error("removing node which does not belong to this list");var a=u.next,l=u.prev;return a&&(a.prev=l),l&&(l.next=a),u===this.head&&(this.head=a),u===this.tail&&(this.tail=l),u.list.length--,u.next=null,u.prev=null,u.list=null,a},r.prototype.unshiftNode=function(u){if(u!==this.head){u.list&&u.list.removeNode(u);var a=this.head;u.list=this,u.next=a,a&&(a.prev=u),this.head=u,this.tail||(this.tail=u),this.length++}},r.prototype.pushNode=function(u){if(u!==this.tail){u.list&&u.list.removeNode(u);var a=this.tail;u.list=this,u.prev=a,a&&(a.next=u),this.tail=u,this.head||(this.head=u),this.length++}},r.prototype.push=function(){for(var u=0,a=arguments.length;u<a;u++)n(this,arguments[u]);return this.length},r.prototype.unshift=function(){for(var u=0,a=arguments.length;u<a;u++)s(this,arguments[u]);return this.length},r.prototype.pop=function(){if(this.tail){var u=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,u}},r.prototype.shift=function(){if(this.head){var u=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,u}},r.prototype.forEach=function(u,a){a=a||this;for(var l=this.head,c=0;l!==null;c++)u.call(a,l.value,c,this),l=l.next},r.prototype.forEachReverse=function(u,a){a=a||this;for(var l=this.tail,c=this.length-1;l!==null;c--)u.call(a,l.value,c,this),l=l.prev},r.prototype.get=function(u){for(var a=0,l=this.head;l!==null&&a<u;a++)l=l.next;if(a===u&&l!==null)return l.value},r.prototype.getReverse=function(u){for(var a=0,l=this.tail;l!==null&&a<u;a++)l=l.prev;if(a===u&&l!==null)return l.value},r.prototype.map=function(u,a){a=a||this;for(var l=new r,c=this.head;c!==null;)l.push(u.call(a,c.value,this)),c=c.next;return l},r.prototype.mapReverse=function(u,a){a=a||this;for(var l=new r,c=this.tail;c!==null;)l.push(u.call(a,c.value,this)),c=c.prev;return l},r.prototype.reduce=function(u,a){var l,c=this.head;if(arguments.length>1)l=a;else if(this.head)c=this.head.next,l=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var h=0;c!==null;h++)l=u(l,c.value,h),c=c.next;return l},r.prototype.reduceReverse=function(u,a){var l,c=this.tail;if(arguments.length>1)l=a;else if(this.tail)c=this.tail.prev,l=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var h=this.length-1;c!==null;h--)l=u(l,c.value,h),c=c.prev;return l},r.prototype.toArray=function(){for(var u=new Array(this.length),a=0,l=this.head;l!==null;a++)u[a]=l.value,l=l.next;return u},r.prototype.toArrayReverse=function(){for(var u=new Array(this.length),a=0,l=this.tail;l!==null;a++)u[a]=l.value,l=l.prev;return u},r.prototype.slice=function(u,a){a=a||this.length,a<0&&(a+=this.length),u=u||0,u<0&&(u+=this.length);var l=new r;if(a<u||a<0)return l;u<0&&(u=0),a>this.length&&(a=this.length);for(var c=0,h=this.head;h!==null&&c<u;c++)h=h.next;for(;h!==null&&c<a;c++,h=h.next)l.push(h.value);return l},r.prototype.sliceReverse=function(u,a){a=a||this.length,a<0&&(a+=this.length),u=u||0,u<0&&(u+=this.length);var l=new r;if(a<u||a<0)return l;u<0&&(u=0),a>this.length&&(a=this.length);for(var c=this.length,h=this.tail;h!==null&&c>a;c--)h=h.prev;for(;h!==null&&c>u;c--,h=h.prev)l.push(h.value);return l},r.prototype.splice=function(u,a,...l){u>this.length&&(u=this.length-1),u<0&&(u=this.length+u);for(var c=0,h=this.head;h!==null&&c<u;c++)h=h.next;for(var f=[],c=0;h&&c<a;c++)f.push(h.value),h=this.removeNode(h);h===null&&(h=this.tail),h!==this.head&&h!==this.tail&&(h=h.prev);for(var c=0;c<l.length;c++)h=i(this,h,l[c]);return f},r.prototype.reverse=function(){for(var u=this.head,a=this.tail,l=u;l!==null;l=l.prev){var c=l.prev;l.prev=l.next,l.next=c}return this.head=a,this.tail=u,this};function i(u,a,l){var c=a===u.head?new o(l,null,a,u):new o(l,a,a.next,u);return c.next===null&&(u.tail=c),c.prev===null&&(u.head=c),u.length++,c}function n(u,a){u.tail=new o(a,u.tail,null,u),u.head||(u.head=u.tail),u.length++}function s(u,a){u.head=new o(a,null,u.head,u),u.tail||(u.tail=u.head),u.length++}function o(u,a,l,c){if(!(this instanceof o))return new o(u,a,l,c);this.list=c,this.value=u,a?(a.next=this,this.prev=a):this.prev=null,l?(l.prev=this,this.next=l):this.next=null}try{tx()(r)}catch{}}),Fl=ee((t,e)=>{"use strict";W();var r=class{constructor(p,m){this.path=p||"./",this.absolute=m,this.entry=null,this.stat=null,this.readdir=null,this.pending=!1,this.ignore=!1,this.piped=!1}},i=vl(),n=oy(),s=Cl(),o=cy(),u=o.Sync,a=o.Tar,l=hy(),c=Buffer.alloc(1024),h=Symbol("onStat"),f=Symbol("ended"),d=Symbol("queue"),g=Symbol("current"),y=Symbol("process"),E=Symbol("processing"),v=Symbol("processJob"),F=Symbol("jobs"),O=Symbol("jobDone"),x=Symbol("addFSEntry"),R=Symbol("addTarEntry"),L=Symbol("stat"),_=Symbol("readdir"),S=Symbol("onreaddir"),N=Symbol("pipe"),q=Symbol("entry"),k=Symbol("entryOpt"),U=Symbol("writeEntryClass"),K=Symbol("write"),V=Symbol("ondrain"),B=te("fs"),C=te("path"),T=xl(),j=_n(),z=T(class extends i{constructor(p){super(p),p=p||Object.create(null),this.opt=p,this.file=p.file||"",this.cwd=p.cwd||process.cwd(),this.maxReadSize=p.maxReadSize,this.preservePaths=!!p.preservePaths,this.strict=!!p.strict,this.noPax=!!p.noPax,this.prefix=j(p.prefix||""),this.linkCache=p.linkCache||new Map,this.statCache=p.statCache||new Map,this.readdirCache=p.readdirCache||new Map,this[U]=o,typeof p.onwarn=="function"&&this.on("warn",p.onwarn),this.portable=!!p.portable,this.zip=null,p.gzip?(typeof p.gzip!="object"&&(p.gzip={}),this.portable&&(p.gzip.portable=!0),this.zip=new n.Gzip(p.gzip),this.zip.on("data",m=>super.write(m)),this.zip.on("end",m=>super.end()),this.zip.on("drain",m=>this[V]()),this.on("resume",m=>this.zip.resume())):this.on("drain",this[V]),this.noDirRecurse=!!p.noDirRecurse,this.follow=!!p.follow,this.noMtime=!!p.noMtime,this.mtime=p.mtime||null,this.filter=typeof p.filter=="function"?p.filter:m=>!0,this[d]=new l,this[F]=0,this.jobs=+p.jobs||4,this[E]=!1,this[f]=!1}[K](p){return super.write(p)}add(p){return this.write(p),this}end(p){return p&&this.write(p),this[f]=!0,this[y](),this}write(p){if(this[f])throw new Error("write after end");return p instanceof s?this[R](p):this[x](p),this.flowing}[R](p){let m=j(C.resolve(this.cwd,p.path));if(!this.filter(p.path,p))p.resume();else{let D=new r(p.path,m,!1);D.entry=new a(p,this[k](D)),D.entry.on("end",A=>this[O](D)),this[F]+=1,this[d].push(D)}this[y]()}[x](p){let m=j(C.resolve(this.cwd,p));this[d].push(new r(p,m)),this[y]()}[L](p){p.pending=!0,this[F]+=1;let m=this.follow?"stat":"lstat";B[m](p.absolute,(D,A)=>{p.pending=!1,this[F]-=1,D?this.emit("error",D):this[h](p,A)})}[h](p,m){this.statCache.set(p.absolute,m),p.stat=m,this.filter(p.path,m)||(p.ignore=!0),this[y]()}[_](p){p.pending=!0,this[F]+=1,B.readdir(p.absolute,(m,D)=>{if(p.pending=!1,this[F]-=1,m)return this.emit("error",m);this[S](p,D)})}[S](p,m){this.readdirCache.set(p.absolute,m),p.readdir=m,this[y]()}[y](){if(!this[E]){this[E]=!0;for(let p=this[d].head;p!==null&&this[F]<this.jobs;p=p.next)if(this[v](p.value),p.value.ignore){let m=p.next;this[d].removeNode(p),p.next=m}this[E]=!1,this[f]&&!this[d].length&&this[F]===0&&(this.zip?this.zip.end(c):(super.write(c),super.end()))}}get[g](){return this[d]&&this[d].head&&this[d].head.value}[O](p){this[d].shift(),this[F]-=1,this[y]()}[v](p){if(!p.pending){if(p.entry){p===this[g]&&!p.piped&&this[N](p);return}if(p.stat||(this.statCache.has(p.absolute)?this[h](p,this.statCache.get(p.absolute)):this[L](p)),!!p.stat&&!p.ignore&&!(!this.noDirRecurse&&p.stat.isDirectory()&&!p.readdir&&(this.readdirCache.has(p.absolute)?this[S](p,this.readdirCache.get(p.absolute)):this[_](p),!p.readdir))){if(p.entry=this[q](p),!p.entry){p.ignore=!0;return}p===this[g]&&!p.piped&&this[N](p)}}}[k](p){return{onwarn:(m,D,A)=>this.warn(m,D,A),noPax:this.noPax,cwd:this.cwd,absolute:p.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix}}[q](p){this[F]+=1;try{return new this[U](p.path,this[k](p)).on("end",()=>this[O](p)).on("error",m=>this.emit("error",m))}catch(m){this.emit("error",m)}}[V](){this[g]&&this[g].entry&&this[g].entry.resume()}[N](p){p.piped=!0,p.readdir&&p.readdir.forEach(A=>{let w=p.path,I=w==="./"?"":w.replace(/\/*$/,"/");this[x](I+A)});let m=p.entry,D=this.zip;D?m.on("data",A=>{D.write(A)||m.pause()}):m.on("data",A=>{super.write(A)||m.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}}),P=class extends z{constructor(p){super(p),this[U]=u}pause(){}resume(){}[L](p){let m=this.follow?"statSync":"lstatSync";this[h](p,B[m](p.absolute))}[_](p,m){this[S](p,B.readdirSync(p.absolute))}[N](p){let m=p.entry,D=this.zip;p.readdir&&p.readdir.forEach(A=>{let w=p.path,I=w==="./"?"":w.replace(/\/*$/,"/");this[x](I+A)}),D?m.on("data",A=>{D.write(A)}):m.on("data",A=>{super[K](A)})}};z.Sync=P,e.exports=z}),Sn=ee(t=>{"use strict";W();var e=ny(),r=te("events").EventEmitter,i=te("fs"),n=i.writev;if(!n){let p=process.binding("fs"),m=p.FSReqWrap||p.FSReqCallback;n=(D,A,w,I)=>{let M=($,X)=>I($,X,A),Z=new m;Z.oncomplete=M,p.writeBuffers(D,A,w,Z)}}var s=Symbol("_autoClose"),o=Symbol("_close"),u=Symbol("_ended"),a=Symbol("_fd"),l=Symbol("_finished"),c=Symbol("_flags"),h=Symbol("_flush"),f=Symbol("_handleChunk"),d=Symbol("_makeBuf"),g=Symbol("_mode"),y=Symbol("_needDrain"),E=Symbol("_onerror"),v=Symbol("_onopen"),F=Symbol("_onread"),O=Symbol("_onwrite"),x=Symbol("_open"),R=Symbol("_path"),L=Symbol("_pos"),_=Symbol("_queue"),S=Symbol("_read"),N=Symbol("_readSize"),q=Symbol("_reading"),k=Symbol("_remain"),U=Symbol("_size"),K=Symbol("_write"),V=Symbol("_writing"),B=Symbol("_defaultFlag"),C=Symbol("_errored"),T=class extends e{constructor(p,m){if(m=m||{},super(m),this.readable=!0,this.writable=!1,typeof p!="string")throw new TypeError("path must be a string");this[C]=!1,this[a]=typeof m.fd=="number"?m.fd:null,this[R]=p,this[N]=m.readSize||16*1024*1024,this[q]=!1,this[U]=typeof m.size=="number"?m.size:1/0,this[k]=this[U],this[s]=typeof m.autoClose=="boolean"?m.autoClose:!0,typeof this[a]=="number"?this[S]():this[x]()}get fd(){return this[a]}get path(){return this[R]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[x](){i.open(this[R],"r",(p,m)=>this[v](p,m))}[v](p,m){p?this[E](p):(this[a]=m,this.emit("open",m),this[S]())}[d](){return Buffer.allocUnsafe(Math.min(this[N],this[k]))}[S](){if(!this[q]){this[q]=!0;let p=this[d]();if(p.length===0)return process.nextTick(()=>this[F](null,0,p));i.read(this[a],p,0,p.length,null,(m,D,A)=>this[F](m,D,A))}}[F](p,m,D){this[q]=!1,p?this[E](p):this[f](m,D)&&this[S]()}[o](){if(this[s]&&typeof this[a]=="number"){let p=this[a];this[a]=null,i.close(p,m=>m?this.emit("error",m):this.emit("close"))}}[E](p){this[q]=!0,this[o](),this.emit("error",p)}[f](p,m){let D=!1;return this[k]-=p,p>0&&(D=super.write(p<m.length?m.slice(0,p):m)),(p===0||this[k]<=0)&&(D=!1,this[o](),super.end()),D}emit(p,m){switch(p){case"prefinish":case"finish":break;case"drain":typeof this[a]=="number"&&this[S]();break;case"error":return this[C]?void 0:(this[C]=!0,super.emit(p,m));default:return super.emit(p,m)}}},j=class extends T{[x](){let p=!0;try{this[v](null,i.openSync(this[R],"r")),p=!1}finally{p&&this[o]()}}[S](){let p=!0;try{if(!this[q]){this[q]=!0;do{let m=this[d](),D=m.length===0?0:i.readSync(this[a],m,0,m.length,null);if(!this[f](D,m))break}while(!0);this[q]=!1}p=!1}finally{p&&this[o]()}}[o](){if(this[s]&&typeof this[a]=="number"){let p=this[a];this[a]=null,i.closeSync(p),this.emit("close")}}},z=class extends r{constructor(p,m){m=m||{},super(m),this.readable=!1,this.writable=!0,this[C]=!1,this[V]=!1,this[u]=!1,this[y]=!1,this[_]=[],this[R]=p,this[a]=typeof m.fd=="number"?m.fd:null,this[g]=m.mode===void 0?438:m.mode,this[L]=typeof m.start=="number"?m.start:null,this[s]=typeof m.autoClose=="boolean"?m.autoClose:!0;let D=this[L]!==null?"r+":"w";this[B]=m.flags===void 0,this[c]=this[B]?D:m.flags,this[a]===null&&this[x]()}emit(p,m){if(p==="error"){if(this[C])return;this[C]=!0}return super.emit(p,m)}get fd(){return this[a]}get path(){return this[R]}[E](p){this[o](),this[V]=!0,this.emit("error",p)}[x](){i.open(this[R],this[c],this[g],(p,m)=>this[v](p,m))}[v](p,m){this[B]&&this[c]==="r+"&&p&&p.code==="ENOENT"?(this[c]="w",this[x]()):p?this[E](p):(this[a]=m,this.emit("open",m),this[h]())}end(p,m){return p&&this.write(p,m),this[u]=!0,!this[V]&&!this[_].length&&typeof this[a]=="number"&&this[O](null,0),this}write(p,m){return typeof p=="string"&&(p=Buffer.from(p,m)),this[u]?(this.emit("error",new Error("write() after end()")),!1):this[a]===null||this[V]||this[_].length?(this[_].push(p),this[y]=!0,!1):(this[V]=!0,this[K](p),!0)}[K](p){i.write(this[a],p,0,p.length,this[L],(m,D)=>this[O](m,D))}[O](p,m){p?this[E](p):(this[L]!==null&&(this[L]+=m),this[_].length?this[h]():(this[V]=!1,this[u]&&!this[l]?(this[l]=!0,this[o](),this.emit("finish")):this[y]&&(this[y]=!1,this.emit("drain"))))}[h](){if(this[_].length===0)this[u]&&this[O](null,0);else if(this[_].length===1)this[K](this[_].pop());else{let p=this[_];this[_]=[],n(this[a],p,this[L],(m,D)=>this[O](m,D))}}[o](){if(this[s]&&typeof this[a]=="number"){let p=this[a];this[a]=null,i.close(p,m=>m?this.emit("error",m):this.emit("close"))}}},P=class extends z{[x](){let p;if(this[B]&&this[c]==="r+")try{p=i.openSync(this[R],this[c],this[g])}catch(m){if(m.code==="ENOENT")return this[c]="w",this[x]();throw m}else p=i.openSync(this[R],this[c],this[g]);this[v](null,p)}[o](){if(this[s]&&typeof this[a]=="number"){let p=this[a];this[a]=null,i.closeSync(p),this.emit("close")}}[K](p){let m=!0;try{this[O](null,i.writeSync(this[a],p,0,p.length,this[L])),m=!1}finally{if(m)try{this[o]()}catch{}}}};t.ReadStream=T,t.ReadStreamSync=j,t.WriteStream=z,t.WriteStreamSync=P}),Ol=ee((t,e)=>{"use strict";W();var r=xl(),i=bn(),n=te("events"),s=hy(),o=1024*1024,u=Cl(),a=Rl(),l=oy(),{nextTick:c}=te("process"),h=Buffer.from([31,139]),f=Symbol("state"),d=Symbol("writeEntry"),g=Symbol("readEntry"),y=Symbol("nextEntry"),E=Symbol("processEntry"),v=Symbol("extendedHeader"),F=Symbol("globalExtendedHeader"),O=Symbol("meta"),x=Symbol("emitMeta"),R=Symbol("buffer"),L=Symbol("queue"),_=Symbol("ended"),S=Symbol("emittedEnd"),N=Symbol("emit"),q=Symbol("unzip"),k=Symbol("consumeChunk"),U=Symbol("consumeChunkSub"),K=Symbol("consumeBody"),V=Symbol("consumeMeta"),B=Symbol("consumeHeader"),C=Symbol("consuming"),T=Symbol("bufferConcat"),j=Symbol("maybeEnd"),z=Symbol("writing"),P=Symbol("aborted"),p=Symbol("onDone"),m=Symbol("sawValidEntry"),D=Symbol("sawNullBlock"),A=Symbol("sawEOF"),w=Symbol("closeStream"),I=M=>!0;e.exports=r(class extends n{constructor(M){M=M||{},super(M),this.file=M.file||"",this[m]=null,this.on(p,Z=>{(this[f]==="begin"||this[m]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),M.ondone?this.on(p,M.ondone):this.on(p,Z=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!M.strict,this.maxMetaEntrySize=M.maxMetaEntrySize||o,this.filter=typeof M.filter=="function"?M.filter:I,this.writable=!0,this.readable=!1,this[L]=new s,this[R]=null,this[g]=null,this[d]=null,this[f]="begin",this[O]="",this[v]=null,this[F]=null,this[_]=!1,this[q]=null,this[P]=!1,this[D]=!1,this[A]=!1,this.on("end",()=>this[w]()),typeof M.onwarn=="function"&&this.on("warn",M.onwarn),typeof M.onentry=="function"&&this.on("entry",M.onentry)}[B](M,Z){this[m]===null&&(this[m]=!1);let $;try{$=new i(M,Z,this[v],this[F])}catch(X){return this.warn("TAR_ENTRY_INVALID",X)}if($.nullBlock)this[D]?(this[A]=!0,this[f]==="begin"&&(this[f]="header"),this[N]("eof")):(this[D]=!0,this[N]("nullBlock"));else if(this[D]=!1,!$.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:$});else if(!$.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:$});else{let X=$.type;if(/^(Symbolic)?Link$/.test(X)&&!$.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:$});else if(!/^(Symbolic)?Link$/.test(X)&&$.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:$});else{let G=this[d]=new u($,this[v],this[F]);if(!this[m])if(G.remain){let re=()=>{G.invalid||(this[m]=!0)};G.on("end",re)}else this[m]=!0;G.meta?G.size>this.maxMetaEntrySize?(G.ignore=!0,this[N]("ignoredEntry",G),this[f]="ignore",G.resume()):G.size>0&&(this[O]="",G.on("data",re=>this[O]+=re),this[f]="meta"):(this[v]=null,G.ignore=G.ignore||!this.filter(G.path,G),G.ignore?(this[N]("ignoredEntry",G),this[f]=G.remain?"ignore":"header",G.resume()):(G.remain?this[f]="body":(this[f]="header",G.end()),this[g]?this[L].push(G):(this[L].push(G),this[y]())))}}}[w](){c(()=>this.emit("close"))}[E](M){let Z=!0;return M?Array.isArray(M)?this.emit.apply(this,M):(this[g]=M,this.emit("entry",M),M.emittedEnd||(M.on("end",$=>this[y]()),Z=!1)):(this[g]=null,Z=!1),Z}[y](){do;while(this[E](this[L].shift()));if(!this[L].length){let M=this[g];!M||M.flowing||M.size===M.remain?this[z]||this.emit("drain"):M.once("drain",Z=>this.emit("drain"))}}[K](M,Z){let $=this[d],X=$.blockRemain,G=X>=M.length&&Z===0?M:M.slice(Z,Z+X);return $.write(G),$.blockRemain||(this[f]="header",this[d]=null,$.end()),G.length}[V](M,Z){let $=this[d],X=this[K](M,Z);return this[d]||this[x]($),X}[N](M,Z,$){!this[L].length&&!this[g]?this.emit(M,Z,$):this[L].push([M,Z,$])}[x](M){switch(this[N]("meta",this[O]),M.type){case"ExtendedHeader":case"OldExtendedHeader":this[v]=a.parse(this[O],this[v],!1);break;case"GlobalExtendedHeader":this[F]=a.parse(this[O],this[F],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":this[v]=this[v]||Object.create(null),this[v].path=this[O].replace(/\0.*/,"");break;case"NextFileHasLongLinkpath":this[v]=this[v]||Object.create(null),this[v].linkpath=this[O].replace(/\0.*/,"");break;default:throw new Error("unknown meta: "+M.type)}}abort(M){this[P]=!0,this.emit("abort",M),this.warn("TAR_ABORT",M,{recoverable:!1})}write(M){if(this[P])return;if(this[q]===null&&M){if(this[R]&&(M=Buffer.concat([this[R],M]),this[R]=null),M.length<h.length)return this[R]=M,!0;for(let $=0;this[q]===null&&$<h.length;$++)M[$]!==h[$]&&(this[q]=!1);if(this[q]===null){let $=this[_];this[_]=!1,this[q]=new l.Unzip,this[q].on("data",G=>this[k](G)),this[q].on("error",G=>this.abort(G)),this[q].on("end",G=>{this[_]=!0,this[k]()}),this[z]=!0;let X=this[q][$?"end":"write"](M);return this[z]=!1,X}}this[z]=!0,this[q]?this[q].write(M):this[k](M),this[z]=!1;let Z=this[L].length?!1:this[g]?this[g].flowing:!0;return!Z&&!this[L].length&&this[g].once("drain",$=>this.emit("drain")),Z}[T](M){M&&!this[P]&&(this[R]=this[R]?Buffer.concat([this[R],M]):M)}[j](){if(this[_]&&!this[S]&&!this[P]&&!this[C]){this[S]=!0;let M=this[d];if(M&&M.blockRemain){let Z=this[R]?this[R].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${M.blockRemain} more bytes, only ${Z} available)`,{entry:M}),this[R]&&M.write(this[R]),M.end()}this[N](p)}}[k](M){if(this[C])this[T](M);else if(!M&&!this[R])this[j]();else{if(this[C]=!0,this[R]){this[T](M);let Z=this[R];this[R]=null,this[U](Z)}else this[U](M);for(;this[R]&&this[R].length>=512&&!this[P]&&!this[A];){let Z=this[R];this[R]=null,this[U](Z)}this[C]=!1}(!this[R]||this[_])&&this[j]()}[U](M){let Z=0,$=M.length;for(;Z+512<=$&&!this[P]&&!this[A];)switch(this[f]){case"begin":case"header":this[B](M,Z),Z+=512;break;case"ignore":case"body":Z+=this[K](M,Z);break;case"meta":Z+=this[V](M,Z);break;default:throw new Error("invalid state: "+this[f])}Z<$&&(this[R]?this[R]=Buffer.concat([M.slice(Z),this[R]]):this[R]=M.slice(Z))}end(M){this[P]||(this[q]?this[q].end(M):(this[_]=!0,this.write(M)))}})}),Tl=ee((t,e)=>{"use strict";W();var r=Dn(),i=Ol(),n=te("fs"),s=Sn(),o=te("path"),u=wn();e.exports=(d,g,y)=>{typeof d=="function"?(y=d,g=null,d={}):Array.isArray(d)&&(g=d,d={}),typeof g=="function"&&(y=g,g=null),g?g=Array.from(g):g=[];let E=r(d);if(E.sync&&typeof y=="function")throw new TypeError("callback not supported for sync tar functions");if(!E.file&&typeof y=="function")throw new TypeError("callback only supported with file option");return g.length&&l(E,g),E.noResume||a(E),E.file&&E.sync?c(E):E.file?h(E,y):f(E)};var a=d=>{let g=d.onentry;d.onentry=g?y=>{g(y),y.resume()}:y=>y.resume()},l=(d,g)=>{let y=new Map(g.map(F=>[u(F),!0])),E=d.filter,v=(F,O)=>{let x=O||o.parse(F).root||".",R=F===x?!1:y.has(F)?y.get(F):v(o.dirname(F),x);return y.set(F,R),R};d.filter=E?(F,O)=>E(F,O)&&v(u(F)):F=>v(u(F))},c=d=>{let g=f(d),y=d.file,E=!0,v;try{let F=n.statSync(y),O=d.maxReadSize||16*1024*1024;if(F.size<O)g.end(n.readFileSync(y));else{let x=0,R=Buffer.allocUnsafe(O);for(v=n.openSync(y,"r");x<F.size;){let L=n.readSync(v,R,0,O,x);x+=L,g.write(R.slice(0,L))}g.end()}E=!1}finally{if(E&&v)try{n.closeSync(v)}catch{}}},h=(d,g)=>{let y=new i(d),E=d.maxReadSize||16*1024*1024,v=d.file,F=new Promise((O,x)=>{y.on("error",x),y.on("end",O),n.stat(v,(R,L)=>{if(R)x(R);else{let _=new s.ReadStream(v,{readSize:E,size:L.size});_.on("error",x),_.pipe(y)}})});return g?F.then(g,g):F},f=d=>new i(d)}),rx=ee((t,e)=>{"use strict";W();var r=Dn(),i=Fl(),n=Sn(),s=Tl(),o=te("path");e.exports=(d,g,y)=>{if(typeof g=="function"&&(y=g),Array.isArray(d)&&(g=d,d={}),!g||!Array.isArray(g)||!g.length)throw new TypeError("no files or directories specified");g=Array.from(g);let E=r(d);if(E.sync&&typeof y=="function")throw new TypeError("callback not supported for sync tar functions");if(!E.file&&typeof y=="function")throw new TypeError("callback only supported with file option");return E.file&&E.sync?u(E,g):E.file?a(E,g,y):E.sync?h(E,g):f(E,g)};var u=(d,g)=>{let y=new i.Sync(d),E=new n.WriteStreamSync(d.file,{mode:d.mode||438});y.pipe(E),l(y,g)},a=(d,g,y)=>{let E=new i(d),v=new n.WriteStream(d.file,{mode:d.mode||438});E.pipe(v);let F=new Promise((O,x)=>{v.on("error",x),v.on("close",O),E.on("error",x)});return c(E,g),y?F.then(y,y):F},l=(d,g)=>{g.forEach(y=>{y.charAt(0)==="@"?s({file:o.resolve(d.cwd,y.slice(1)),sync:!0,noResume:!0,onentry:E=>d.add(E)}):d.add(y)}),d.end()},c=(d,g)=>{for(;g.length;){let y=g.shift();if(y.charAt(0)==="@")return s({file:o.resolve(d.cwd,y.slice(1)),noResume:!0,onentry:E=>d.add(E)}).then(E=>c(d,g));d.add(y)}d.end()},h=(d,g)=>{let y=new i.Sync(d);return l(y,g),y},f=(d,g)=>{let y=new i(d);return c(y,g),y}}),fy=ee((t,e)=>{"use strict";W();var r=Dn(),i=Fl(),n=te("fs"),s=Sn(),o=Tl(),u=te("path"),a=bn();e.exports=(g,y,E)=>{let v=r(g);if(!v.file)throw new TypeError("file is required");if(v.gzip)throw new TypeError("cannot append to compressed archives");if(!y||!Array.isArray(y)||!y.length)throw new TypeError("no files or directories specified");return y=Array.from(y),v.sync?l(v,y):h(v,y,E)};var l=(g,y)=>{let E=new i.Sync(g),v=!0,F,O;try{try{F=n.openSync(g.file,"r+")}catch(L){if(L.code==="ENOENT")F=n.openSync(g.file,"w+");else throw L}let x=n.fstatSync(F),R=Buffer.alloc(512);e:for(O=0;O<x.size;O+=512){for(let S=0,N=0;S<512;S+=N){if(N=n.readSync(F,R,S,R.length-S,O+S),O===0&&R[0]===31&&R[1]===139)throw new Error("cannot append to compressed archives");if(!N)break e}let L=new a(R);if(!L.cksumValid)break;let _=512*Math.ceil(L.size/512);if(O+_+512>x.size)break;O+=_,g.mtimeCache&&g.mtimeCache.set(L.path,L.mtime)}v=!1,c(g,E,O,F,y)}finally{if(v)try{n.closeSync(F)}catch{}}},c=(g,y,E,v,F)=>{let O=new s.WriteStreamSync(g.file,{fd:v,start:E});y.pipe(O),f(y,F)},h=(g,y,E)=>{y=Array.from(y);let v=new i(g),F=(x,R,L)=>{let _=(U,K)=>{U?n.close(x,V=>L(U)):L(null,K)},S=0;if(R===0)return _(null,0);let N=0,q=Buffer.alloc(512),k=(U,K)=>{if(U)return _(U);if(N+=K,N<512&&K)return n.read(x,q,N,q.length-N,S+N,k);if(S===0&&q[0]===31&&q[1]===139)return _(new Error("cannot append to compressed archives"));if(N<512)return _(null,S);let V=new a(q);if(!V.cksumValid)return _(null,S);let B=512*Math.ceil(V.size/512);if(S+B+512>R||(S+=B+512,S>=R))return _(null,S);g.mtimeCache&&g.mtimeCache.set(V.path,V.mtime),N=0,n.read(x,q,0,512,S,k)};n.read(x,q,0,512,S,k)},O=new Promise((x,R)=>{v.on("error",R);let L="r+",_=(S,N)=>{if(S&&S.code==="ENOENT"&&L==="r+")return L="w+",n.open(g.file,L,_);if(S)return R(S);n.fstat(N,(q,k)=>{if(q)return n.close(N,()=>R(q));F(N,k.size,(U,K)=>{if(U)return R(U);let V=new s.WriteStream(g.file,{fd:N,start:K});v.pipe(V),V.on("error",R),V.on("close",x),d(v,y)})})};n.open(g.file,L,_)});return E?O.then(E,E):O},f=(g,y)=>{y.forEach(E=>{E.charAt(0)==="@"?o({file:u.resolve(g.cwd,E.slice(1)),sync:!0,noResume:!0,onentry:v=>g.add(v)}):g.add(E)}),g.end()},d=(g,y)=>{for(;y.length;){let E=y.shift();if(E.charAt(0)==="@")return o({file:u.resolve(g.cwd,E.slice(1)),noResume:!0,onentry:v=>g.add(v)}).then(v=>d(g,y));g.add(E)}g.end()}}),ix=ee((t,e)=>{"use strict";W();var r=Dn(),i=fy();e.exports=(s,o,u)=>{let a=r(s);if(!a.file)throw new TypeError("file is required");if(a.gzip)throw new TypeError("cannot append to compressed archives");if(!o||!Array.isArray(o)||!o.length)throw new TypeError("no files or directories specified");return o=Array.from(o),n(a),i(a,o,u)};var n=s=>{let o=s.filter;s.mtimeCache||(s.mtimeCache=new Map),s.filter=o?(u,a)=>o(u,a)&&!(s.mtimeCache.get(u)>a.mtime):(u,a)=>!(s.mtimeCache.get(u)>a.mtime)}}),nx=ee((t,e)=>{W();var{promisify:r}=te("util"),i=te("fs"),n=s=>{if(!s)s={mode:511,fs:i};else if(typeof s=="object")s={mode:511,fs:i,...s};else if(typeof s=="number")s={mode:s,fs:i};else if(typeof s=="string")s={mode:parseInt(s,8),fs:i};else throw new TypeError("invalid options argument");return s.mkdir=s.mkdir||s.fs.mkdir||i.mkdir,s.mkdirAsync=r(s.mkdir),s.stat=s.stat||s.fs.stat||i.stat,s.statAsync=r(s.stat),s.statSync=s.statSync||s.fs.statSync||i.statSync,s.mkdirSync=s.mkdirSync||s.fs.mkdirSync||i.mkdirSync,s};e.exports=n}),sx=ee((t,e)=>{W();var r=process.env.__TESTING_MKDIRP_PLATFORM__||process.platform,{resolve:i,parse:n}=te("path"),s=o=>{if(/\0/.test(o))throw Object.assign(new TypeError("path must be a string without null bytes"),{path:o,code:"ERR_INVALID_ARG_VALUE"});if(o=i(o),r==="win32"){let u=/[*|"<>?:]/,{root:a}=n(o);if(u.test(o.substr(a.length)))throw Object.assign(new Error("Illegal characters in path."),{path:o,code:"EINVAL"})}return o};e.exports=s}),ox=ee((t,e)=>{W();var{dirname:r}=te("path"),i=(s,o,u=void 0)=>u===o?Promise.resolve():s.statAsync(o).then(a=>a.isDirectory()?u:void 0,a=>a.code==="ENOENT"?i(s,r(o),o):void 0),n=(s,o,u=void 0)=>{if(u!==o)try{return s.statSync(o).isDirectory()?u:void 0}catch(a){return a.code==="ENOENT"?n(s,r(o),o):void 0}};e.exports={findMade:i,findMadeSync:n}}),py=ee((t,e)=>{W();var{dirname:r}=te("path"),i=(s,o,u)=>{o.recursive=!1;let a=r(s);return a===s?o.mkdirAsync(s,o).catch(l=>{if(l.code!=="EISDIR")throw l}):o.mkdirAsync(s,o).then(()=>u||s,l=>{if(l.code==="ENOENT")return i(a,o).then(c=>i(s,o,c));if(l.code!=="EEXIST"&&l.code!=="EROFS")throw l;return o.statAsync(s).then(c=>{if(c.isDirectory())return u;throw l},()=>{throw l})})},n=(s,o,u)=>{let a=r(s);if(o.recursive=!1,a===s)try{return o.mkdirSync(s,o)}catch(l){if(l.code!=="EISDIR")throw l;return}try{return o.mkdirSync(s,o),u||s}catch(l){if(l.code==="ENOENT")return n(s,o,n(a,o,u));if(l.code!=="EEXIST"&&l.code!=="EROFS")throw l;try{if(!o.statSync(s).isDirectory())throw l}catch{throw l}}};e.exports={mkdirpManual:i,mkdirpManualSync:n}}),ux=ee((t,e)=>{W();var{dirname:r}=te("path"),{findMade:i,findMadeSync:n}=ox(),{mkdirpManual:s,mkdirpManualSync:o}=py(),u=(l,c)=>(c.recursive=!0,r(l)===l?c.mkdirAsync(l,c):i(c,l).then(h=>c.mkdirAsync(l,c).then(()=>h).catch(f=>{if(f.code==="ENOENT")return s(l,c);throw f}))),a=(l,c)=>{if(c.recursive=!0,r(l)===l)return c.mkdirSync(l,c);let h=n(c,l);try{return c.mkdirSync(l,c),h}catch(f){if(f.code==="ENOENT")return o(l,c);throw f}};e.exports={mkdirpNative:u,mkdirpNativeSync:a}}),ax=ee((t,e)=>{W();var r=te("fs"),i=process.env.__TESTING_MKDIRP_NODE_VERSION__||process.version,n=i.replace(/^v/,"").split("."),s=+n[0]>10||+n[0]==10&&+n[1]>=12,o=s?a=>a.mkdir===r.mkdir:()=>!1,u=s?a=>a.mkdirSync===r.mkdirSync:()=>!1;e.exports={useNative:o,useNativeSync:u}}),lx=ee((t,e)=>{W();var r=nx(),i=sx(),{mkdirpNative:n,mkdirpNativeSync:s}=ux(),{mkdirpManual:o,mkdirpManualSync:u}=py(),{useNative:a,useNativeSync:l}=ax(),c=(f,d)=>(f=i(f),d=r(d),a(d)?n(f,d):o(f,d)),h=(f,d)=>(f=i(f),d=r(d),l(d)?s(f,d):u(f,d));c.sync=h,c.native=(f,d)=>n(i(f),r(d)),c.manual=(f,d)=>o(i(f),r(d)),c.nativeSync=(f,d)=>s(i(f),r(d)),c.manualSync=(f,d)=>u(i(f),r(d)),e.exports=c}),cx=ee((t,e)=>{"use strict";W();var r=te("fs"),i=te("path"),n=r.lchown?"lchown":"chown",s=r.lchownSync?"lchownSync":"chownSync",o=r.lchown&&!process.version.match(/v1[1-9]+\./)&&!process.version.match(/v10\.[6-9]/),u=(O,x,R)=>{try{return r[s](O,x,R)}catch(L){if(L.code!=="ENOENT")throw L}},a=(O,x,R)=>{try{return r.chownSync(O,x,R)}catch(L){if(L.code!=="ENOENT")throw L}},l=o?(O,x,R,L)=>_=>{!_||_.code!=="EISDIR"?L(_):r.chown(O,x,R,L)}:(O,x,R,L)=>L,c=o?(O,x,R)=>{try{return u(O,x,R)}catch(L){if(L.code!=="EISDIR")throw L;a(O,x,R)}}:(O,x,R)=>u(O,x,R),h=process.version,f=(O,x,R)=>r.readdir(O,x,R),d=(O,x)=>r.readdirSync(O,x);/^v4\./.test(h)&&(f=(O,x,R)=>r.readdir(O,R));var g=(O,x,R,L)=>{r[n](O,x,R,l(O,x,R,_=>{L(_&&_.code!=="ENOENT"?_:null)}))},y=(O,x,R,L,_)=>{if(typeof x=="string")return r.lstat(i.resolve(O,x),(S,N)=>{if(S)return _(S.code!=="ENOENT"?S:null);N.name=x,y(O,N,R,L,_)});if(x.isDirectory())E(i.resolve(O,x.name),R,L,S=>{if(S)return _(S);let N=i.resolve(O,x.name);g(N,R,L,_)});else{let S=i.resolve(O,x.name);g(S,R,L,_)}},E=(O,x,R,L)=>{f(O,{withFileTypes:!0},(_,S)=>{if(_){if(_.code==="ENOENT")return L();if(_.code!=="ENOTDIR"&&_.code!=="ENOTSUP")return L(_)}if(_||!S.length)return g(O,x,R,L);let N=S.length,q=null,k=U=>{if(!q){if(U)return L(q=U);if(--N===0)return g(O,x,R,L)}};S.forEach(U=>y(O,U,x,R,k))})},v=(O,x,R,L)=>{if(typeof x=="string")try{let _=r.lstatSync(i.resolve(O,x));_.name=x,x=_}catch(_){if(_.code==="ENOENT")return;throw _}x.isDirectory()&&F(i.resolve(O,x.name),R,L),c(i.resolve(O,x.name),R,L)},F=(O,x,R)=>{let L;try{L=d(O,{withFileTypes:!0})}catch(_){if(_.code==="ENOENT")return;if(_.code==="ENOTDIR"||_.code==="ENOTSUP")return c(O,x,R);throw _}return L&&L.length&&L.forEach(_=>v(O,_,x,R)),c(O,x,R)};e.exports=E,E.sync=F}),hx=ee((t,e)=>{"use strict";W();var r=lx(),i=te("fs"),n=te("path"),s=cx(),o=_n(),u=class extends Error{constructor(y,E){super("Cannot extract through symbolic link"),this.path=E,this.symlink=y}get name(){return"SylinkError"}},a=class extends Error{constructor(y,E){super(E+": Cannot cd into '"+y+"'"),this.path=y,this.code=E}get name(){return"CwdError"}},l=(y,E)=>y.get(o(E)),c=(y,E,v)=>y.set(o(E),v),h=(y,E)=>{i.stat(y,(v,F)=>{(v||!F.isDirectory())&&(v=new a(y,v&&v.code||"ENOTDIR")),E(v)})};e.exports=(y,E,v)=>{y=o(y);let F=E.umask,O=E.mode|448,x=(O&F)!==0,R=E.uid,L=E.gid,_=typeof R=="number"&&typeof L=="number"&&(R!==E.processUid||L!==E.processGid),S=E.preserve,N=E.unlink,q=E.cache,k=o(E.cwd),U=(V,B)=>{V?v(V):(c(q,y,!0),B&&_?s(B,R,L,C=>U(C)):x?i.chmod(y,O,v):v())};if(q&&l(q,y)===!0)return U();if(y===k)return h(y,U);if(S)return r(y,{mode:O}).then(V=>U(null,V),U);let K=o(n.relative(k,y)).split("/");f(k,K,O,q,N,k,null,U)};var f=(y,E,v,F,O,x,R,L)=>{if(!E.length)return L(null,R);let _=E.shift(),S=o(n.resolve(y+"/"+_));if(l(F,S))return f(S,E,v,F,O,x,R,L);i.mkdir(S,v,d(S,E,v,F,O,x,R,L))},d=(y,E,v,F,O,x,R,L)=>_=>{_?i.lstat(y,(S,N)=>{if(S)S.path=S.path&&o(S.path),L(S);else if(N.isDirectory())f(y,E,v,F,O,x,R,L);else if(O)i.unlink(y,q=>{if(q)return L(q);i.mkdir(y,v,d(y,E,v,F,O,x,R,L))});else{if(N.isSymbolicLink())return L(new u(y,y+"/"+E.join("/")));L(_)}}):(R=R||y,f(y,E,v,F,O,x,R,L))},g=y=>{let E=!1,v="ENOTDIR";try{E=i.statSync(y).isDirectory()}catch(F){v=F.code}finally{if(!E)throw new a(y,v)}};e.exports.sync=(y,E)=>{y=o(y);let v=E.umask,F=E.mode|448,O=(F&v)!==0,x=E.uid,R=E.gid,L=typeof x=="number"&&typeof R=="number"&&(x!==E.processUid||R!==E.processGid),_=E.preserve,S=E.unlink,N=E.cache,q=o(E.cwd),k=V=>{c(N,y,!0),V&&L&&s.sync(V,x,R),O&&i.chmodSync(y,F)};if(N&&l(N,y)===!0)return k();if(y===q)return g(q),k();if(_)return k(r.sync(y,F));let U=o(n.relative(q,y)).split("/"),K=null;for(let V=U.shift(),B=q;V&&(B+="/"+V);V=U.shift())if(B=o(n.resolve(B)),!l(N,B))try{i.mkdirSync(B,F),K=K||B,c(N,B,!0)}catch{let C=i.lstatSync(B);if(C.isDirectory()){c(N,B,!0);continue}else if(S){i.unlinkSync(B),i.mkdirSync(B,F),K=K||B,c(N,B,!0);continue}else if(C.isSymbolicLink())return new u(B,B+"/"+U.join("/"))}return k(K)}}),dy=ee((t,e)=>{W();var r=Object.create(null),{hasOwnProperty:i}=Object.prototype;e.exports=n=>(i.call(r,n)||(r[n]=n.normalize("NFKD")),r[n])}),fx=ee((t,e)=>{W();var r=te("assert"),i=dy(),n=wn(),{join:s}=te("path"),o=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,u=o==="win32";e.exports=()=>{let a=new Map,l=new Map,c=E=>E.split("/").slice(0,-1).reduce((v,F)=>(v.length&&(F=s(v[v.length-1],F)),v.push(F||"/"),v),[]),h=new Set,f=E=>{let v=l.get(E);if(!v)throw new Error("function does not have any path reservations");return{paths:v.paths.map(F=>a.get(F)),dirs:[...v.dirs].map(F=>a.get(F))}},d=E=>{let{paths:v,dirs:F}=f(E);return v.every(O=>O[0]===E)&&F.every(O=>O[0]instanceof Set&&O[0].has(E))},g=E=>h.has(E)||!d(E)?!1:(h.add(E),E(()=>y(E)),!0),y=E=>{if(!h.has(E))return!1;let{paths:v,dirs:F}=l.get(E),O=new Set;return v.forEach(x=>{let R=a.get(x);r.equal(R[0],E),R.length===1?a.delete(x):(R.shift(),typeof R[0]=="function"?O.add(R[0]):R[0].forEach(L=>O.add(L)))}),F.forEach(x=>{let R=a.get(x);r(R[0]instanceof Set),R[0].size===1&&R.length===1?a.delete(x):R[0].size===1?(R.shift(),O.add(R[0])):R[0].delete(E)}),h.delete(E),O.forEach(x=>g(x)),!0};return{check:d,reserve:(E,v)=>{E=u?["win32 parallelization disabled"]:E.map(O=>i(n(s(O))).toLowerCase());let F=new Set(E.map(O=>c(O)).reduce((O,x)=>O.concat(x)));return l.set(v,{dirs:F,paths:E}),E.forEach(O=>{let x=a.get(O);x?x.push(v):a.set(O,[v])}),F.forEach(O=>{let x=a.get(O);x?x[x.length-1]instanceof Set?x[x.length-1].add(v):x.push(new Set([v])):a.set(O,[new Set([v])])}),g(v)}}}}),px=ee((t,e)=>{W();var r=process.env.__FAKE_PLATFORM__||process.platform,i=r==="win32",n=global.__FAKE_TESTING_FS__||te("fs"),{O_CREAT:s,O_TRUNC:o,O_WRONLY:u,UV_FS_O_FILEMAP:a=0}=n.constants,l=i&&!!a,c=512*1024,h=a|o|s|u;e.exports=l?f=>f<c?h:"w":()=>"w"}),my=ee((t,e)=>{"use strict";W();var r=te("assert"),i=Ol(),n=te("fs"),s=Sn(),o=te("path"),u=hx(),a=ay(),l=fx(),c=ly(),h=_n(),f=wn(),d=dy(),g=Symbol("onEntry"),y=Symbol("checkFs"),E=Symbol("checkFs2"),v=Symbol("pruneCache"),F=Symbol("isReusable"),O=Symbol("makeFs"),x=Symbol("file"),R=Symbol("directory"),L=Symbol("link"),_=Symbol("symlink"),S=Symbol("hardlink"),N=Symbol("unsupported"),q=Symbol("checkPath"),k=Symbol("mkdir"),U=Symbol("onError"),K=Symbol("pending"),V=Symbol("pend"),B=Symbol("unpend"),C=Symbol("ended"),T=Symbol("maybeClose"),j=Symbol("skip"),z=Symbol("doChown"),P=Symbol("uid"),p=Symbol("gid"),m=Symbol("checkedCwd"),D=te("crypto"),A=px(),w=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,I=w==="win32",M=(b,Y)=>{if(!I)return n.unlink(b,Y);let J=b+".DELETE."+D.randomBytes(16).toString("hex");n.rename(b,J,se=>{if(se)return Y(se);n.unlink(J,Y)})},Z=b=>{if(!I)return n.unlinkSync(b);let Y=b+".DELETE."+D.randomBytes(16).toString("hex");n.renameSync(b,Y),n.unlinkSync(Y)},$=(b,Y,J)=>b===b>>>0?b:Y===Y>>>0?Y:J,X=b=>d(f(h(b))).toLowerCase(),G=(b,Y)=>{Y=X(Y);for(let J of b.keys()){let se=X(J);(se===Y||se.indexOf(Y+"/")===0)&&b.delete(J)}},re=b=>{for(let Y of b.keys())b.delete(Y)},le=class extends i{constructor(b){if(b||(b={}),b.ondone=Y=>{this[C]=!0,this[T]()},super(b),this[m]=!1,this.reservations=l(),this.transform=typeof b.transform=="function"?b.transform:null,this.writable=!0,this.readable=!1,this[K]=0,this[C]=!1,this.dirCache=b.dirCache||new Map,typeof b.uid=="number"||typeof b.gid=="number"){if(typeof b.uid!="number"||typeof b.gid!="number")throw new TypeError("cannot set owner without number uid and gid");if(b.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=b.uid,this.gid=b.gid,this.setOwner=!0}else this.uid=null,this.gid=null,this.setOwner=!1;b.preserveOwner===void 0&&typeof b.uid!="number"?this.preserveOwner=process.getuid&&process.getuid()===0:this.preserveOwner=!!b.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():null,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():null,this.forceChown=b.forceChown===!0,this.win32=!!b.win32||I,this.newer=!!b.newer,this.keep=!!b.keep,this.noMtime=!!b.noMtime,this.preservePaths=!!b.preservePaths,this.unlink=!!b.unlink,this.cwd=h(o.resolve(b.cwd||process.cwd())),this.strip=+b.strip||0,this.processUmask=b.noChmod?0:process.umask(),this.umask=typeof b.umask=="number"?b.umask:this.processUmask,this.dmode=b.dmode||511&~this.umask,this.fmode=b.fmode||438&~this.umask,this.on("entry",Y=>this[g](Y))}warn(b,Y,J={}){return(b==="TAR_BAD_ARCHIVE"||b==="TAR_ABORT")&&(J.recoverable=!1),super.warn(b,Y,J)}[T](){this[C]&&this[K]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[q](b){if(this.strip){let Y=h(b.path).split("/");if(Y.length<this.strip)return!1;if(b.path=Y.slice(this.strip).join("/"),b.type==="Link"){let J=h(b.linkpath).split("/");if(J.length>=this.strip)b.linkpath=J.slice(this.strip).join("/");else return!1}}if(!this.preservePaths){let Y=h(b.path),J=Y.split("/");if(J.includes("..")||I&&/^[a-z]:\.\.$/i.test(J[0]))return this.warn("TAR_ENTRY_ERROR","path contains '..'",{entry:b,path:Y}),!1;let[se,ae]=c(Y);se&&(b.path=ae,this.warn("TAR_ENTRY_INFO",`stripping ${se} from absolute path`,{entry:b,path:Y}))}if(o.isAbsolute(b.path)?b.absolute=h(o.resolve(b.path)):b.absolute=h(o.resolve(this.cwd,b.path)),!this.preservePaths&&b.absolute.indexOf(this.cwd+"/")!==0&&b.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:b,path:h(b.path),resolvedPath:b.absolute,cwd:this.cwd}),!1;if(b.absolute===this.cwd&&b.type!=="Directory"&&b.type!=="GNUDumpDir")return!1;if(this.win32){let{root:Y}=o.win32.parse(b.absolute);b.absolute=Y+a.encode(b.absolute.slice(Y.length));let{root:J}=o.win32.parse(b.path);b.path=J+a.encode(b.path.slice(J.length))}return!0}[g](b){if(!this[q](b))return b.resume();switch(r.equal(typeof b.absolute,"string"),b.type){case"Directory":case"GNUDumpDir":b.mode&&(b.mode=b.mode|448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[y](b);case"CharacterDevice":case"BlockDevice":case"FIFO":default:return this[N](b)}}[U](b,Y){b.name==="CwdError"?this.emit("error",b):(this.warn("TAR_ENTRY_ERROR",b,{entry:Y}),this[B](),Y.resume())}[k](b,Y,J){u(h(b),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:Y,noChmod:this.noChmod},J)}[z](b){return this.forceChown||this.preserveOwner&&(typeof b.uid=="number"&&b.uid!==this.processUid||typeof b.gid=="number"&&b.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[P](b){return $(this.uid,b.uid,this.processUid)}[p](b){return $(this.gid,b.gid,this.processGid)}[x](b,Y){let J=b.mode&4095||this.fmode,se=new s.WriteStream(b.absolute,{flags:A(b.size),mode:J,autoClose:!1});se.on("error",fe=>{se.fd&&n.close(se.fd,()=>{}),se.write=()=>!0,this[U](fe,b),Y()});let ae=1,ge=fe=>{if(fe){se.fd&&n.close(se.fd,()=>{}),this[U](fe,b),Y();return}--ae===0&&n.close(se.fd,Se=>{Se?this[U](Se,b):this[B](),Y()})};se.on("finish",fe=>{let Se=b.absolute,ct=se.fd;if(b.mtime&&!this.noMtime){ae++;let ht=b.atime||new Date,Qi=b.mtime;n.futimes(ct,ht,Qi,en=>en?n.utimes(Se,ht,Qi,ou=>ge(ou&&en)):ge())}if(this[z](b)){ae++;let ht=this[P](b),Qi=this[p](b);n.fchown(ct,ht,Qi,en=>en?n.chown(Se,ht,Qi,ou=>ge(ou&&en)):ge())}ge()});let ce=this.transform&&this.transform(b)||b;ce!==b&&(ce.on("error",fe=>{this[U](fe,b),Y()}),b.pipe(ce)),ce.pipe(se)}[R](b,Y){let J=b.mode&4095||this.dmode;this[k](b.absolute,J,se=>{if(se){this[U](se,b),Y();return}let ae=1,ge=ce=>{--ae===0&&(Y(),this[B](),b.resume())};b.mtime&&!this.noMtime&&(ae++,n.utimes(b.absolute,b.atime||new Date,b.mtime,ge)),this[z](b)&&(ae++,n.chown(b.absolute,this[P](b),this[p](b),ge)),ge()})}[N](b){b.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${b.type}`,{entry:b}),b.resume()}[_](b,Y){this[L](b,b.linkpath,"symlink",Y)}[S](b,Y){let J=h(o.resolve(this.cwd,b.linkpath));this[L](b,J,"link",Y)}[V](){this[K]++}[B](){this[K]--,this[T]()}[j](b){this[B](),b.resume()}[F](b,Y){return b.type==="File"&&!this.unlink&&Y.isFile()&&Y.nlink<=1&&!I}[y](b){this[V]();let Y=[b.path];b.linkpath&&Y.push(b.linkpath),this.reservations.reserve(Y,J=>this[E](b,J))}[v](b){b.type==="SymbolicLink"?re(this.dirCache):b.type!=="Directory"&&G(this.dirCache,b.absolute)}[E](b,Y){this[v](b);let J=ce=>{this[v](b),Y(ce)},se=()=>{this[k](this.cwd,this.dmode,ce=>{if(ce){this[U](ce,b),J();return}this[m]=!0,ae()})},ae=()=>{if(b.absolute!==this.cwd){let ce=h(o.dirname(b.absolute));if(ce!==this.cwd)return this[k](ce,this.dmode,fe=>{if(fe){this[U](fe,b),J();return}ge()})}ge()},ge=()=>{n.lstat(b.absolute,(ce,fe)=>{if(fe&&(this.keep||this.newer&&fe.mtime>b.mtime)){this[j](b),J();return}if(ce||this[F](b,fe))return this[O](null,b,J);if(fe.isDirectory()){if(b.type==="Directory"){let Se=!this.noChmod&&b.mode&&(fe.mode&4095)!==b.mode,ct=ht=>this[O](ht,b,J);return Se?n.chmod(b.absolute,b.mode,ct):ct()}if(b.absolute!==this.cwd)return n.rmdir(b.absolute,Se=>this[O](Se,b,J))}if(b.absolute===this.cwd)return this[O](null,b,J);M(b.absolute,Se=>this[O](Se,b,J))})};this[m]?ae():se()}[O](b,Y,J){if(b){this[U](b,Y),J();return}switch(Y.type){case"File":case"OldFile":case"ContiguousFile":return this[x](Y,J);case"Link":return this[S](Y,J);case"SymbolicLink":return this[_](Y,J);case"Directory":case"GNUDumpDir":return this[R](Y,J)}}[L](b,Y,J,se){n[J](Y,b.absolute,ae=>{ae?this[U](ae,b):(this[B](),b.resume()),se()})}},be=b=>{try{return[null,b()]}catch(Y){return[Y,null]}},Ee=class extends le{[O](b,Y){return super[O](b,Y,()=>{})}[y](b){if(this[v](b),!this[m]){let ae=this[k](this.cwd,this.dmode);if(ae)return this[U](ae,b);this[m]=!0}if(b.absolute!==this.cwd){let ae=h(o.dirname(b.absolute));if(ae!==this.cwd){let ge=this[k](ae,this.dmode);if(ge)return this[U](ge,b)}}let[Y,J]=be(()=>n.lstatSync(b.absolute));if(J&&(this.keep||this.newer&&J.mtime>b.mtime))return this[j](b);if(Y||this[F](b,J))return this[O](null,b);if(J.isDirectory()){if(b.type==="Directory"){let ge=!this.noChmod&&b.mode&&(J.mode&4095)!==b.mode,[ce]=ge?be(()=>{n.chmodSync(b.absolute,b.mode)}):[];return this[O](ce,b)}let[ae]=be(()=>n.rmdirSync(b.absolute));this[O](ae,b)}let[se]=b.absolute===this.cwd?[]:be(()=>Z(b.absolute));this[O](se,b)}[x](b,Y){let J=b.mode&4095||this.fmode,se=ce=>{let fe;try{n.closeSync(ae)}catch(Se){fe=Se}(ce||fe)&&this[U](ce||fe,b),Y()},ae;try{ae=n.openSync(b.absolute,A(b.size),J)}catch(ce){return se(ce)}let ge=this.transform&&this.transform(b)||b;ge!==b&&(ge.on("error",ce=>this[U](ce,b)),b.pipe(ge)),ge.on("data",ce=>{try{n.writeSync(ae,ce,0,ce.length)}catch(fe){se(fe)}}),ge.on("end",ce=>{let fe=null;if(b.mtime&&!this.noMtime){let Se=b.atime||new Date,ct=b.mtime;try{n.futimesSync(ae,Se,ct)}catch(ht){try{n.utimesSync(b.absolute,Se,ct)}catch{fe=ht}}}if(this[z](b)){let Se=this[P](b),ct=this[p](b);try{n.fchownSync(ae,Se,ct)}catch(ht){try{n.chownSync(b.absolute,Se,ct)}catch{fe=fe||ht}}}se(fe)})}[R](b,Y){let J=b.mode&4095||this.dmode,se=this[k](b.absolute,J);if(se){this[U](se,b),Y();return}if(b.mtime&&!this.noMtime)try{n.utimesSync(b.absolute,b.atime||new Date,b.mtime)}catch{}if(this[z](b))try{n.chownSync(b.absolute,this[P](b),this[p](b))}catch{}Y(),b.resume()}[k](b,Y){try{return u.sync(h(b),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:Y})}catch(J){return J}}[L](b,Y,J,se){try{n[J+"Sync"](Y,b.absolute),se(),b.resume()}catch(ae){return this[U](ae,b)}}};le.Sync=Ee,e.exports=le}),dx=ee((t,e)=>{"use strict";W();var r=Dn(),i=my(),n=te("fs"),s=Sn(),o=te("path"),u=wn();e.exports=(d,g,y)=>{typeof d=="function"?(y=d,g=null,d={}):Array.isArray(d)&&(g=d,d={}),typeof g=="function"&&(y=g,g=null),g?g=Array.from(g):g=[];let E=r(d);if(E.sync&&typeof y=="function")throw new TypeError("callback not supported for sync tar functions");if(!E.file&&typeof y=="function")throw new TypeError("callback only supported with file option");return g.length&&a(E,g),E.file&&E.sync?l(E):E.file?c(E,y):E.sync?h(E):f(E)};var a=(d,g)=>{let y=new Map(g.map(F=>[u(F),!0])),E=d.filter,v=(F,O)=>{let x=O||o.parse(F).root||".",R=F===x?!1:y.has(F)?y.get(F):v(o.dirname(F),x);return y.set(F,R),R};d.filter=E?(F,O)=>E(F,O)&&v(u(F)):F=>v(u(F))},l=d=>{let g=new i.Sync(d),y=d.file,E=n.statSync(y),v=d.maxReadSize||16*1024*1024;new s.ReadStreamSync(y,{readSize:v,size:E.size}).pipe(g)},c=(d,g)=>{let y=new i(d),E=d.maxReadSize||16*1024*1024,v=d.file,F=new Promise((O,x)=>{y.on("error",x),y.on("close",O),n.stat(v,(R,L)=>{if(R)x(R);else{let _=new s.ReadStream(v,{readSize:E,size:L.size});_.on("error",x),_.pipe(y)}})});return g?F.then(g,g):F},h=d=>new i.Sync(d),f=d=>new i(d)}),mx=ee(t=>{"use strict";W(),t.c=t.create=rx(),t.r=t.replace=fy(),t.t=t.list=Tl(),t.u=t.update=ix(),t.x=t.extract=dx(),t.Pack=Fl(),t.Unpack=my(),t.Parse=Ol(),t.ReadEntry=Cl(),t.WriteEntry=cy(),t.Header=bn(),t.Pax=Rl(),t.types=uy()}),yx=ee((t,e)=>{W();function r(i,n){typeof n=="boolean"&&(n={forever:n}),this._originalTimeouts=JSON.parse(JSON.stringify(i)),this._timeouts=i,this._options=n||{},this._maxRetryTime=n&&n.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}e.exports=r,r.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},r.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},r.prototype.retry=function(i){if(this._timeout&&clearTimeout(this._timeout),!i)return!1;var n=new Date().getTime();if(i&&n-this._operationStart>=this._maxRetryTime)return this._errors.push(i),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(i);var s=this._timeouts.shift();if(s===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),s=this._cachedTimeouts.slice(-1);else return!1;var o=this;return this._timer=setTimeout(function(){o._attempts++,o._operationTimeoutCb&&(o._timeout=setTimeout(function(){o._operationTimeoutCb(o._attempts)},o._operationTimeout),o._options.unref&&o._timeout.unref()),o._fn(o._attempts)},s),this._options.unref&&this._timer.unref(),!0},r.prototype.attempt=function(i,n){this._fn=i,n&&(n.timeout&&(this._operationTimeout=n.timeout),n.cb&&(this._operationTimeoutCb=n.cb));var s=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){s._operationTimeoutCb()},s._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},r.prototype.try=function(i){console.log("Using RetryOperation.try() is deprecated"),this.attempt(i)},r.prototype.start=function(i){console.log("Using RetryOperation.start() is deprecated"),this.attempt(i)},r.prototype.start=r.prototype.try,r.prototype.errors=function(){return this._errors},r.prototype.attempts=function(){return this._attempts},r.prototype.mainError=function(){if(this._errors.length===0)return null;for(var i={},n=null,s=0,o=0;o<this._errors.length;o++){var u=this._errors[o],a=u.message,l=(i[a]||0)+1;i[a]=l,l>=s&&(n=u,s=l)}return n}}),gx=ee(t=>{W();var e=yx();t.operation=function(r){var i=t.timeouts(r);return new e(i,{forever:r&&(r.forever||r.retries===1/0),unref:r&&r.unref,maxRetryTime:r&&r.maxRetryTime})},t.timeouts=function(r){if(r instanceof Array)return[].concat(r);var i={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in r)i[n]=r[n];if(i.minTimeout>i.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var s=[],o=0;o<i.retries;o++)s.push(this.createTimeout(o,i));return r&&r.forever&&!s.length&&s.push(this.createTimeout(o,i)),s.sort(function(u,a){return u-a}),s},t.createTimeout=function(r,i){var n=i.randomize?Math.random()+1:1,s=Math.round(n*Math.max(i.minTimeout,1)*Math.pow(i.factor,r));return s=Math.min(s,i.maxTimeout),s},t.wrap=function(r,i,n){if(i instanceof Array&&(n=i,i=null),!n){n=[];for(var s in r)typeof r[s]=="function"&&n.push(s)}for(var o=0;o<n.length;o++){var u=n[o],a=r[u];r[u]=function(l){var c=t.operation(i),h=Array.prototype.slice.call(arguments,1),f=h.pop();h.push(function(d){c.retry(d)||(d&&(arguments[0]=c.mainError()),f.apply(this,arguments))}),c.attempt(function(){l.apply(r,h)})}.bind(r,a),r[u].options=i}}}),Ex=ee((t,e)=>{W(),e.exports=gx()}),Dx=ee((t,e)=>{W();var r=Ex();function i(n,s){function o(u,a){var l=s||{},c;"randomize"in l||(l.randomize=!0),c=r.operation(l);function h(g){a(g||new Error("Aborted"))}function f(g,y){if(g.bail){h(g);return}c.retry(g)?l.onRetry&&l.onRetry(g,y):a(c.mainError())}function d(g){var y;try{y=n(h,g)}catch(E){f(E,g);return}Promise.resolve(y).then(u).catch(function(E){f(E,g)})}c.attempt(d)}return new Promise(o)}e.exports=i}),_x={};qR(_x,{bold:()=>vx,dimmed:()=>Rx,error:()=>Tx,grey:()=>xx,info:()=>Ax,item:()=>Fx,log:()=>jr,turboBlue:()=>Si,turboGradient:()=>wx,turboLoader:()=>Sx,turboRed:()=>_y,underline:()=>Cx,warn:()=>Ox,yellow:()=>by});W();var Ey="#0099F7",Dy="#F11712",bx="#FFFF00",wx=(0,gy.default)(Ey,Dy),Si=cr.default.hex(Ey),_y=cr.default.hex(Dy),by=cr.default.hex(bx),Sx=t=>(0,yy.default)({text:t,spinner:{frames:[" ",Si("> "),Si(">> "),Si(">>>")]}}),Ax=(...t)=>{jr(Si.bold(">>>"),...t)},vx=(...t)=>{jr(cr.default.bold(...t))},Cx=(...t)=>{jr(cr.default.underline(...t))},Rx=(...t)=>{jr(cr.default.dim(...t))},xx=(...t)=>{jr(cr.default.grey(...t))},Fx=(...t)=>{jr(Si.bold(" \u2022"),...t)},jr=(...t)=>{console.log(...t)},Ox=(...t)=>{console.error(by.bold(">>>"),...t)},Tx=(...t)=>{console.error(_y.bold(">>>"),...t)};W();W();W();W();var YB=zs(zR());W();W();function Lx(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}W();W();function wl(t){return wl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wl(t)}W();function Bx(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Px(t,e){if(e&&(wl(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Bx(t)}W();function Gs(t){return Gs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Gs(t)}W();W();function yn(t,e){return yn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},yn(t,e)}function Ix(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&yn(t,e)}W();W();function Nx(t){return Function.toString.call(t).indexOf("[native code]")!==-1}W();W();function Mx(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Us(t,e,r){return Mx()?Us=Reflect.construct.bind():Us=function(i,n,s){var o=[null];o.push.apply(o,n);var u=Function.bind.apply(i,o),a=new u;return s&&yn(a,s.prototype),a},Us.apply(null,arguments)}function Sl(t){var e=typeof Map=="function"?new Map:void 0;return Sl=function(r){if(r===null||!Nx(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(r))return e.get(r);e.set(r,i)}function i(){return Us(r,arguments,Gs(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),yn(i,r)},Sl(t)}var KB=zs(JR()),JB=function(t){Ix(e,t);function e(r){var i;return Lx(this,e),i=Px(this,Gs(e).call(this,"No package.json could be found upwards from the directory ".concat(r))),i.directory=r,i}return e}(Sl(Error));W();W();W();W();W();W();var aP=zs(mx()),lP=(0,Sy.promisify)(wy.Stream.pipeline);W();W();var pP=zs(Dx());W();W();W();var Le=class extends Error{constructor(t,e){var r;super(t),this.name="ConvertError",this.type=(r=e==null?void 0:e.type)!=null?r:"unknown",Error.captureStackTrace(this,Le)}};W();W();W();W();var jx=/^(?!_)(?<manager>.+)@(?<version>.+)$/;function Ue({workspaceRoot:t}){let e=Nt.default.join(t,"package.json");try{return(0,Ze.readJsonSync)(e,"utf8")}catch(r){if(r&&typeof r=="object"&&"code"in r){if(r.code==="ENOENT")throw new Le(`no "package.json" found at ${t}`,{type:"package_json-missing"});if(r.code==="EJSONPARSE")throw new Le(`failed to parse "package.json" at ${t}`,{type:"package_json-parse_error"})}throw new Error(`unexpected error reading "package.json" at ${t}`)}}function Ws({workspaceRoot:t}){let{packageManager:e}=Ue({workspaceRoot:t});if(e)try{let r=jx.exec(e);if(r){let[i,n]=r;return n}}catch{}}function An({workspaceRoot:t}){let e=Ue({workspaceRoot:t}),r=Nt.default.basename(t),{name:i=r,description:n}=e;return{name:i,description:n}}function ry({workspaceRoot:t}){let e=Nt.default.join(t,"pnpm-workspace.yaml");if((0,Ze.existsSync)(e))try{let r=Hu.load((0,Ze.readFileSync)(e,"utf8"));if(r instanceof Object&&"packages"in r&&Array.isArray(r.packages))return r.packages}catch{throw new Le(`failed to parse ${e}`,{type:"pnpm-workspace_parse_error"})}return[]}function Ys({root:t,lockFile:e,workspaceConfig:r}){let i=s=>Nt.default.join(t,s),n={root:t,lockfile:i(e),packageJson:i("package.json"),nodeModules:i("node_modules")};return r&&(n.workspaceConfig=i(r)),n}function kl({workspaces:t}){var e;return t?Array.isArray(t)?t:"packages"in t?(e=t.packages)!=null?e:[]:[]:[]}function Ks({workspaceRoot:t,workspaceGlobs:e}){return e?e.flatMap(r=>{let i=[`${r}/package.json`];return(0,Fy.sync)(i,{onlyFiles:!0,absolute:!0,cwd:t,ignore:["**/node_modules/**"]})}).map(r=>{let i=Nt.default.dirname(r),{name:n,description:s}=An({workspaceRoot:i});return{name:n,description:s,paths:{root:i,packageJson:r,nodeModules:Nt.default.join(i,"node_modules")}}}):[]}function Hx({directory:t}){let e=Nt.default.resolve(process.cwd(),t);return{exists:(0,Ze.existsSync)(e),absolute:e}}function hr({packageManager:t,action:e,project:r}){let i=r.workspaceData.globs.length>0;return`${e==="remove"?"Removing":"Adding"} ${t} ${i?"workspaces":""} ${e==="remove"?"from":"to"} ${r.name}`}function qx({project:t}){let e=r=>!(r.includes("*")&&(r.includes("**")||r.split("/").slice(0,-1).join("/").includes("*"))||["!","[","]","{","}"].some(i=>r.includes(i)));return t.workspaceData.globs.every(e)}function It({project:t,options:e}){e!=null&&e.dry||(0,Ze.rmSync)(t.paths.lockfile,{force:!0})}async function Oy({project:t,options:e}){if(!(e!=null&&e.dry)&&(0,Ze.existsSync)(t.paths.lockfile))try{let{stdout:r}=await(0,xy.default)("bun",["bun.lockb"],{stdin:"ignore",cwd:t.paths.root});await(0,Ze.writeFile)(Nt.default.join(t.paths.root,"yarn.lock"),r)}catch{}finally{(0,Ze.rmSync)(t.paths.lockfile,{force:!0})}}function $x({dependencyList:t,project:e,to:r}){let i=[];return e.workspaceData.workspaces.forEach(n=>{let{name:s}=n;if(t[s]){let o=t[s],u=o.startsWith("workspace:")?o.slice(10):o;t[s]=r.name==="pnpm"?`workspace:${u}`:u,i.push(s)}}),{dependencyList:t,updated:i}}function ar({project:t,workspace:e,to:r,logger:i,options:n}){if(["yarn","npm","bun"].includes(r.name)&&["yarn","npm","bun"].includes(t.packageManager))return;let s=Ue({workspaceRoot:e.paths.root}),o={dependencies:[],devDependencies:[],peerDependencies:[],optionalDependencies:[]},u=["dependencies","devDependencies","peerDependencies","optionalDependencies"];u.forEach(h=>{let f=s[h];if(f){let{updated:d,dependencyList:g}=$x({dependencyList:f,project:t,to:r});s[h]=g,o[h]=d}});let a=h=>{let f=o[h].length;if(f>0)return`${Ry.default.green(f.toString())} ${h}`},l=u.map(a).filter(Boolean),c=`./${vy.default.relative(t.paths.root,e.paths.packageJson)}`;if(l.length>=1){let h="updating";l.forEach((f,d)=>{l.length===1?h+=` ${f} in ${c}`:d===l.length-1?h+=`and ${f} in ${c}`:h+=` ${f}, `}),i.workspaceStep(h)}else i.workspaceStep(`no workspace dependencies found in ${c}`);n!=null&&n.dry||(0,Cy.writeJSONSync)(e.paths.packageJson,s,{spaces:2})}var lr={name:"pnpm",lock:"pnpm-lock.yaml"};async function Ty(t){let e=Nr.default.join(t.workspaceRoot,lr.lock),r=Nr.default.join(t.workspaceRoot,"pnpm-workspace.yaml"),i=Ws({workspaceRoot:t.workspaceRoot});return(0,He.existsSync)(e)||(0,He.existsSync)(r)||i===lr.name}async function Ux(t){if(!await Ty(t))throw new Le("Not a pnpm project",{type:"package_manager-unexpected"});let{name:e,description:r}=An(t);return{name:e,description:r,packageManager:lr.name,paths:Ys({root:t.workspaceRoot,lockFile:lr.lock,workspaceConfig:"pnpm-workspace.yaml"}),workspaceData:{globs:ry(t),workspaces:Ks({workspaceGlobs:ry(t),...t})}}}async function Gx(t){let{project:e,to:r,logger:i,options:n}=t,s=e.workspaceData.globs.length>0;i.mainStep(hr({action:"create",packageManager:lr.name,project:e}));let o=Ue({workspaceRoot:e.paths.root});i.rootHeader(),o.packageManager=`${r.name}@${r.version}`,i.rootStep(`adding "packageManager" field to ${e.name} root "package.json"`),n!=null&&n.dry||((0,He.writeJSONSync)(e.paths.packageJson,o,{spaces:2}),s&&(i.rootStep('adding "pnpm-workspace.yaml"'),(0,He.writeFileSync)(Nr.default.join(e.paths.root,"pnpm-workspace.yaml"),`packages:
|
|
42
42
|
${e.workspaceData.globs.map(u=>` - "${u}"`).join(`
|
|
43
|
-
`)}`))),s&&(ar({workspace:{name:"root",paths:e.paths},project:e,to:r,logger:i,options:n}),i.workspaceHeader(),e.workspaceData.workspaces.forEach(u=>{ar({workspace:u,project:e,to:r,logger:i,options:n})}))}async function zx(t){let{project:e,logger:r,options:i}=t,n=e.workspaceData.globs.length>0;r.mainStep(hr({action:"remove",packageManager:lr.name,project:e}));let s=Ue({workspaceRoot:e.paths.root});if(e.paths.workspaceConfig&&n&&(r.subStep('removing "pnpm-workspace.yaml"'),i!=null&&i.dry||(0,He.rmSync)(e.paths.workspaceConfig,{force:!0})),r.subStep(`removing "packageManager" field in ${e.name} root "package.json"`),delete s.packageManager,!(i!=null&&i.dry)){(0,He.writeJSONSync)(e.paths.packageJson,s,{spaces:2});let o=[e.paths.nodeModules,...e.workspaceData.workspaces.map(u=>u.paths.nodeModules)];try{r.subStep('removing "node_modules"'),await Promise.all(o.map(u=>(0,He.rm)(u,{recursive:!0,force:!0})))}catch{throw new Le("Failed to remove node_modules",{type:"error_removing_node_modules"})}}}async function Wx(t){let{project:e,logger:r,options:i}=t;r.subStep(`removing ${Nr.default.relative(e.paths.root,e.paths.lockfile)}`),i!=null&&i.dry||(0,He.rmSync)(e.paths.lockfile,{force:!0})}async function Yx(t){let{project:e,options:r,logger:i}=t,n=()=>{i.subStep(`converting ${Nr.default.relative(e.paths.root,e.paths.lockfile)} to ${lr.lock}`)},s=async()=>{if(!(r!=null&&r.dry)&&(0,He.existsSync)(e.paths.lockfile))try{await(0,Ay.default)(lr.name,["import"],{stdio:"ignore",cwd:e.paths.root})}catch{}finally{It({project:e,options:r})}};switch(e.packageManager){case"pnpm":break;case"bun":n(),await Oy({project:e,options:r}),await s(),(0,He.rmSync)(Nr.default.join(e.paths.root,"yarn.lock"),{force:!0});break;case"npm":n(),await s();break;case"yarn":n(),await s();break}}var Kx={detect:Ty,read:Ux,create:Gx,remove:zx,clean:Wx,convertLock:Yx};W();var Ai={name:"npm",lock:"package-lock.json"};async function ky(t){let e=gn.default.join(t.workspaceRoot,Ai.lock),r=Ws({workspaceRoot:t.workspaceRoot});return(0,wt.existsSync)(e)||r===Ai.name}async function Vx(t){if(!await ky(t))throw new Le("Not an npm project",{type:"package_manager-unexpected"});let e=Ue(t),{name:r,description:i}=An(t),n=kl({workspaces:e.workspaces});return{name:r,description:i,packageManager:Ai.name,paths:Ys({root:t.workspaceRoot,lockFile:Ai.lock}),workspaceData:{globs:n,workspaces:Ks({workspaceGlobs:n,...t})}}}async function Zx(t){let{project:e,options:r,to:i,logger:n}=t,s=e.workspaceData.globs.length>0;n.mainStep(hr({packageManager:Ai.name,action:"create",project:e}));let o=Ue({workspaceRoot:e.paths.root});n.rootHeader(),n.rootStep(`adding "packageManager" field to ${gn.default.relative(e.paths.root,e.paths.packageJson)}`),o.packageManager=`${i.name}@${i.version}`,s?(n.rootStep(`adding "workspaces" field to ${gn.default.relative(e.paths.root,e.paths.packageJson)}`),o.workspaces=e.workspaceData.globs,r!=null&&r.dry||(0,wt.writeJSONSync)(e.paths.packageJson,o,{spaces:2}),ar({workspace:{name:"root",paths:e.paths},project:e,to:i,logger:n,options:r}),n.workspaceHeader(),e.workspaceData.workspaces.forEach(u=>{ar({workspace:u,project:e,to:i,logger:n,options:r})})):r!=null&&r.dry||(0,wt.writeJSONSync)(e.paths.packageJson,o,{spaces:2})}async function Jx(t){let{project:e,logger:r,options:i}=t,n=e.workspaceData.globs.length>0;r.mainStep(hr({packageManager:Ai.name,action:"remove",project:e}));let s=Ue({workspaceRoot:e.paths.root});if(n&&(r.subStep(`removing "workspaces" field in ${e.name} root "package.json"`),delete s.workspaces),r.subStep(`removing "packageManager" field in ${e.name} root "package.json"`),delete s.packageManager,!(i!=null&&i.dry)){(0,wt.writeJSONSync)(e.paths.packageJson,s,{spaces:2});let o=[e.paths.nodeModules,...e.workspaceData.workspaces.map(u=>u.paths.nodeModules)];try{r.subStep('removing "node_modules"'),await Promise.all(o.map(u=>(0,wt.rm)(u,{recursive:!0,force:!0})))}catch{throw new Le("Failed to remove node_modules",{type:"error_removing_node_modules"})}}}async function Xx(t){let{project:e,logger:r,options:i}=t;r.subStep(`removing ${gn.default.relative(e.paths.root,e.paths.lockfile)}`),i!=null&&i.dry||(0,wt.rmSync)(e.paths.lockfile,{force:!0})}async function Qx(t){let{project:e,options:r}=t;switch(e.packageManager){case"pnpm":It({project:e,options:r});break;case"bun":It({project:e,options:r});break;case"npm":break;case"yarn":It({project:e,options:r});break}}var eF={detect:ky,read:Vx,create:Zx,remove:Jx,clean:Xx,convertLock:Qx};W();var Mr={name:"yarn",lock:"yarn.lock"};async function Ly(t){let e=vi.default.join(t.workspaceRoot,Mr.lock),r=Ws({workspaceRoot:t.workspaceRoot});return(0,St.existsSync)(e)||r===Mr.name}async function tF(t){if(!await Ly(t))throw new Le("Not a yarn project",{type:"package_manager-unexpected"});let e=Ue(t),{name:r,description:i}=An(t),n=kl({workspaces:e.workspaces});return{name:r,description:i,packageManager:Mr.name,paths:Ys({root:t.workspaceRoot,lockFile:Mr.lock}),workspaceData:{globs:n,workspaces:Ks({workspaceGlobs:n,...t})}}}async function rF(t){let{project:e,to:r,logger:i,options:n}=t,s=e.workspaceData.globs.length>0;i.mainStep(hr({packageManager:Mr.name,action:"create",project:e}));let o=Ue({workspaceRoot:e.paths.root});i.rootHeader(),i.rootStep(`adding "packageManager" field to ${vi.default.relative(e.paths.root,e.paths.packageJson)}`),o.packageManager=`${r.name}@${r.version}`,s?(i.rootStep(`adding "workspaces" field to ${vi.default.relative(e.paths.root,e.paths.packageJson)}`),o.workspaces=e.workspaceData.globs,n!=null&&n.dry||(0,St.writeJSONSync)(e.paths.packageJson,o,{spaces:2}),ar({workspace:{name:"root",paths:e.paths},project:e,to:r,logger:i,options:n}),i.workspaceHeader(),e.workspaceData.workspaces.forEach(u=>{ar({workspace:u,project:e,to:r,logger:i,options:n})})):n!=null&&n.dry||(0,St.writeJSONSync)(e.paths.packageJson,o,{spaces:2})}async function iF(t){let{project:e,logger:r,options:i}=t,n=e.workspaceData.globs.length>0;r.mainStep(hr({packageManager:Mr.name,action:"remove",project:e}));let s=Ue({workspaceRoot:e.paths.root});if(n&&(r.subStep(`removing "workspaces" field in ${e.name} root "package.json"`),delete s.workspaces),r.subStep(`removing "packageManager" field in ${e.name} root "package.json"`),delete s.packageManager,!(i!=null&&i.dry)){(0,St.writeJSONSync)(e.paths.packageJson,s,{spaces:2});let o=[e.paths.nodeModules,...e.workspaceData.workspaces.map(u=>u.paths.nodeModules)];try{r.subStep('removing "node_modules"'),await Promise.all(o.map(u=>(0,St.rm)(u,{recursive:!0,force:!0})))}catch{throw new Le("Failed to remove node_modules",{type:"error_removing_node_modules"})}}}async function nF(t){let{project:e,logger:r,options:i}=t;r.subStep(`removing ${vi.default.relative(e.paths.root,e.paths.lockfile)}`),i!=null&&i.dry||(0,St.rmSync)(e.paths.lockfile,{force:!0})}async function sF(t){let{project:e,options:r,logger:i}=t,n=()=>{i.subStep(`converting ${vi.default.relative(e.paths.root,e.paths.lockfile)} to ${Mr.lock}`)};switch(e.packageManager){case"pnpm":It({project:e,options:r});break;case"bun":n(),await Oy({project:e,options:r});break;case"npm":It({project:e,options:r});break;case"yarn":break}}var oF={detect:Ly,read:tF,create:rF,remove:iF,clean:nF,convertLock:sF};W();var Ci={name:"bun",lock:"bun.lockb"};async function By(t){let e=En.default.join(t.workspaceRoot,Ci.lock),r=Ws({workspaceRoot:t.workspaceRoot});return(0,At.existsSync)(e)||r===Ci.name}async function uF(t){if(!await By(t))throw new Le("Not a bun project",{type:"package_manager-unexpected"});let e=Ue(t),{name:r,description:i}=An(t),n=kl({workspaces:e.workspaces});return{name:r,description:i,packageManager:Ci.name,paths:Ys({root:t.workspaceRoot,lockFile:Ci.lock}),workspaceData:{globs:n,workspaces:Ks({workspaceGlobs:n,...t})}}}async function aF(t){let{project:e,to:r,logger:i,options:n}=t,s=e.workspaceData.globs.length>0;if(!qx({project:e}))throw new Le("Unable to convert project to bun - workspace globs unsupported",{type:"bun-workspace_glob_error"});i.mainStep(hr({packageManager:Ci.name,action:"create",project:e}));let o=Ue({workspaceRoot:e.paths.root});i.rootHeader(),i.rootStep(`adding "packageManager" field to ${En.default.relative(e.paths.root,e.paths.packageJson)}`),o.packageManager=`${r.name}@${r.version}`,s?(i.rootStep(`adding "workspaces" field to ${En.default.relative(e.paths.root,e.paths.packageJson)}`),o.workspaces=e.workspaceData.globs,n!=null&&n.dry||(0,At.writeJSONSync)(e.paths.packageJson,o,{spaces:2}),ar({workspace:{name:"root",paths:e.paths},project:e,to:r,logger:i,options:n}),i.workspaceHeader(),e.workspaceData.workspaces.forEach(u=>{ar({workspace:u,project:e,to:r,logger:i,options:n})})):n!=null&&n.dry||(0,At.writeJSONSync)(e.paths.packageJson,o,{spaces:2})}async function lF(t){let{project:e,logger:r,options:i}=t,n=e.workspaceData.globs.length>0;r.mainStep(hr({packageManager:Ci.name,action:"remove",project:e}));let s=Ue({workspaceRoot:e.paths.root});if(n&&(r.subStep(`removing "workspaces" field in ${e.name} root "package.json"`),delete s.workspaces),r.subStep(`removing "packageManager" field in ${e.name} root "package.json"`),delete s.packageManager,!(i!=null&&i.dry)){(0,At.writeJSONSync)(e.paths.packageJson,s,{spaces:2});let o=[e.paths.nodeModules,...e.workspaceData.workspaces.map(u=>u.paths.nodeModules)];try{r.subStep('removing "node_modules"'),await Promise.all(o.map(u=>(0,At.rm)(u,{recursive:!0,force:!0})))}catch{throw new Le("Failed to remove node_modules",{type:"error_removing_node_modules"})}}}async function cF(t){let{project:e,logger:r,options:i}=t;r.subStep(`removing ${En.default.relative(e.paths.root,e.paths.lockfile)}`),i!=null&&i.dry||(0,At.rmSync)(e.paths.lockfile,{force:!0})}async function hF(t){let{project:e,options:r}=t;switch(e.packageManager){case"pnpm":It({project:e,options:r});break;case"bun":break;case"npm":It({project:e,options:r});break;case"yarn":It({project:e,options:r});break}}var fF={detect:By,read:uF,create:aF,remove:lF,clean:cF,convertLock:hF},Py={pnpm:Kx,yarn:oF,npm:eF,bun:fF};W();async function Ll({root:t}){let{exists:e,absolute:r}=Hx({directory:t});if(!e)throw new Le(`Could not find directory at ${r}. Ensure the directory exists.`,{type:"invalid_directory"});for(let{detect:i,read:n}of Object.values(Py))if(await i({workspaceRoot:r}))return n({workspaceRoot:r});throw new Le("Could not determine package manager. Add `packageManager` to `package.json` or ensure a lockfile is present.",{type:"package_manager-unable_to_detect"})}W();W();W();W();var c_=require("fs-extra");var su=ie(require("chalk"));var DF=ie(qy());function Pl(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function vn(t){return vn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vn(t)}function Il(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Nl(t,e){if(e&&(vn(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Il(t)}function Hr(t){return Hr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Hr(t)}function Ht(t,e){return Ht=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,n){return i.__proto__=n,i},Ht(t,e)}function Ml(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ht(t,e)}function jl(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function Hl(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ri(t,e,r){return Hl()?Ri=Reflect.construct.bind():Ri=function(n,s,o){var u=[null];u.push.apply(u,s);var a=Function.bind.apply(n,u),l=new a;return o&&Ht(l,o.prototype),l},Ri.apply(null,arguments)}function Cn(t){var e=typeof Map=="function"?new Map:void 0;return Cn=function(i){if(i===null||!jl(i))return i;if(typeof i!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e!="undefined"){if(e.has(i))return e.get(i);e.set(i,n)}function n(){return Ri(i,arguments,Hr(this).constructor)}return n.prototype=Object.create(i.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Ht(n,i)},Cn(t)}var $y=ie(require("find-up"));var _F=ie(require("fs-extra")),z2=function(t){Ml(e,t);function e(r){var i;return Pl(this,e),i=Nl(this,Hr(e).call(this,"No package.json could be found upwards from the directory ".concat(r))),i.directory=r,i}return e}(Cn(Error));var bF=ie(require("fs")),wF=ie(require("path"));var BF=ie(require("fs")),PF=ie(require("path"));var IF=ie($s());var it={};Fh(it,{bold:()=>xF,dimmed:()=>OF,error:()=>Jy,grey:()=>TF,info:()=>RF,item:()=>kF,log:()=>pr,turboBlue:()=>xi,turboGradient:()=>CF,turboLoader:()=>Vy,turboRed:()=>Yy,underline:()=>FF,warn:()=>Zy,yellow:()=>Ky});var fr=ie(require("chalk")),Uy=ie(require("ora")),Gy=ie(require("gradient-string")),zy="#0099F7",Wy="#F11712",vF="#FFFF00",CF=(0,Gy.default)(zy,Wy),xi=fr.default.hex(zy),Yy=fr.default.hex(Wy),Ky=fr.default.hex(vF),Vy=t=>(0,Uy.default)({text:t,spinner:{frames:[" ",xi("> "),xi(">> "),xi(">>>")]}}),RF=(...t)=>{pr(xi.bold(">>>"),...t)},xF=(...t)=>{pr(fr.default.bold(...t))},FF=(...t)=>{pr(fr.default.underline(...t))},OF=(...t)=>{pr(fr.default.dim(...t))},TF=(...t)=>{pr(fr.default.grey(...t))},kF=(...t)=>{pr(xi.bold(" \u2022"),...t)},pr=(...t)=>{console.log(...t)},Zy=(...t)=>{console.error(Ky.bold(">>>"),...t)},Jy=(...t)=>{console.error(Yy.bold(">>>"),...t)};var NF=ie(require("os")),MF=ie(ai());var jF=ie(require("fs-extra"));var HF=ie(require("path")),qF=ie(require("fs-extra")),$F=ie(require("chalk"));var ZD=require("stream"),JD=require("util"),Ak=require("path"),vk=require("os"),XD=require("fs"),Ck=ie(VD());var iN=(0,JD.promisify)(ZD.Stream.pipeline);var QD=require("fs-extra");var Ik=ie(require("path")),Nk=ie(o_()),Mk=ie(require("chalk")),Ch=require("fs-extra");var dt=ie(require("chalk")),Xi=class{constructor(e){this.transform=e.transformer,this.dry=e.dry}_log(...e){console.log(...e)}modified(...e){this._log(dt.default.green(" MODIFIED "),...e,this.dry?dt.default.dim("(dry run)"):"")}unchanged(...e){this._log(dt.default.gray(" UNCHANGED "),...e,this.dry?dt.default.dim("(dry run)"):"")}skipped(...e){this._log(dt.default.yellow(" SKIPPED "),...e,this.dry?dt.default.dim("(dry run)"):"")}error(...e){this._log(dt.default.red(" ERROR "),...e,this.dry?dt.default.dim("(dry run)"):"")}info(...e){this._log(dt.default.bold(" INFO "),...e,this.dry?dt.default.dim("(dry run)"):"")}};var u_=ie(require("os")),Rh=ie(require("path"));var ru=ie(require("chalk")),nu=require("diff"),Rr=require("fs-extra"),iu=class{constructor(e){this.changes=[];if(this.filePath=e.filePath,this.rootPath=e.rootPath,this.after=e.after,this.error=e.error,e.before===void 0)try{Rh.default.extname(e.filePath)===".json"?this.before=(0,Rr.readJsonSync)(e.filePath):this.before=(0,Rr.readFileSync)(e.filePath)}catch{this.before=""}else e.before===null?this.before="":this.before=e.before;e.after?typeof this.before=="object"||typeof e.after=="object"?this.changes=(0,nu.diffJson)(this.before,e.after):this.changes=(0,nu.diffLines)(this.before,e.after):this.changes=[]}fileName(){return Rh.default.relative(this.rootPath,this.filePath)}write(){this.after&&(typeof this.after=="object"?(0,Rr.writeJsonSync)(this.filePath,this.after,{spaces:2}):(0,Rr.writeFileSync)(this.filePath,this.after))}additions(){return this.changes.filter(e=>e.added).length}deletions(){return this.changes.filter(e=>e.removed).length}hasChanges(){return this.additions()>0||this.deletions()>0}log(e){e.diff?(this.changes.forEach(r=>{r.added?process.stdout.write(ru.default.green(r.value)):r.removed?process.stdout.write(ru.default.red(r.value)):process.stdout.write(ru.default.dim(r.value))}),it.log(u_.default.EOL)):it.log(this.after)}};var Yn=class{constructor(e){this.modifications={};this.transform=e.transformer,this.rootPath=e.rootPath,this.dry=e.dry,this.print=e.print,this.logger=new Xi(e)}abortTransform(e){return this.logger.error(e.reason),{fatalError:new Error(e.reason),changes:e.changes||{}}}modifyFile(e){this.modifications[e.filePath]=new iu({rootPath:this.rootPath,...e})}finish(){let e={changes:{}};return Object.keys(this.modifications).forEach(i=>{let n=this.modifications[i],s={action:"unchanged",additions:n.additions(),deletions:n.deletions()};if(n.hasChanges()){if(this.dry)s.action="skipped",this.logger.skipped(su.default.dim(n.fileName()));else try{n.write(),s.action="modified",this.logger.modified(su.default.bold(n.fileName()))}catch(o){let u="Unknown error";o instanceof Error&&(u=o.message),s.error=new Error(u),s.action="error",this.logger.error(n.fileName(),u)}this.print&&n.log({diff:!0})}else this.logger.unchanged(su.default.dim(n.fileName()));e.changes[n.fileName()]=s}),Object.keys(e.changes).some(i=>e.changes[i].action==="error")?this.abortTransform({reason:"Encountered an error while transforming files",changes:e.changes}):e}static logResults(e){let r=Object.keys(e.changes);if(it.log(),r.length>0){it.bold("Results:");let i={};r.forEach(n=>{var o;let s=e.changes[n];i[n]={action:s.action,additions:s.additions,deletions:s.deletions,error:((o=s.error)==null?void 0:o.message)||"None"}}),console.table(i),it.log()}}};function a_({transformer:t,rootPath:e,options:r}){let i={transformer:t,rootPath:e,...r},n=new Xi(i),s=new Yn(i);return{log:n,runner:s}}var h_="add-package-names",jk="Ensure all packages have a name in their package.json",Hk="2.0.0";async function l_(t){try{return await(0,c_.readJson)(t)}catch{return null}}function f_({pkgPath:t,pkgName:e}){let r="",i=e;if(e&&e.startsWith("@")&&e.includes("/")){let s=e.split("/");r=`${s[0]}/`,i=s[1]}let n=xh.default.basename(xh.default.dirname(t));return e?`${r}${n}-${i}`:`${r}${n}`}async function p_({root:t,options:e}){let{log:r,runner:i}=a_({transformer:h_,rootPath:t,options:e});r.info('Validating that each package has a unique "name"...');let n;try{n=await Ll({root:t})}catch{return i.abortTransform({reason:`Unable to determine package manager for ${t}`})}let s=[n.paths.packageJson],o=[l_(n.paths.packageJson)];n.workspaceData.workspaces.forEach(c=>{let h=c.paths.packageJson;s.push(h),o.push(l_(h))});let u=await Promise.all(o),a=Object.fromEntries(s.map((c,h)=>[c,u[h]])),l=new Set;for(let[c,h]of Object.entries(a))if(h)if(!h.name||l.has(h.name)){let f=f_({pkgPath:c,pkgName:h.name});i.modifyFile({filePath:c,after:{...h,name:f}}),l.add(f)}else l.add(h.name);return i.finish()}var qk={name:h_,description:jk,introducedIn:Hk,transformer:p_},$k=qk;0&&(module.exports={getNewPkgName,transformer});
|
|
43
|
+
`)}`))),s&&(ar({workspace:{name:"root",paths:e.paths},project:e,to:r,logger:i,options:n}),i.workspaceHeader(),e.workspaceData.workspaces.forEach(u=>{ar({workspace:u,project:e,to:r,logger:i,options:n})}))}async function zx(t){let{project:e,logger:r,options:i}=t,n=e.workspaceData.globs.length>0;r.mainStep(hr({action:"remove",packageManager:lr.name,project:e}));let s=Ue({workspaceRoot:e.paths.root});if(e.paths.workspaceConfig&&n&&(r.subStep('removing "pnpm-workspace.yaml"'),i!=null&&i.dry||(0,He.rmSync)(e.paths.workspaceConfig,{force:!0})),r.subStep(`removing "packageManager" field in ${e.name} root "package.json"`),delete s.packageManager,!(i!=null&&i.dry)){(0,He.writeJSONSync)(e.paths.packageJson,s,{spaces:2});let o=[e.paths.nodeModules,...e.workspaceData.workspaces.map(u=>u.paths.nodeModules)];try{r.subStep('removing "node_modules"'),await Promise.all(o.map(u=>(0,He.rm)(u,{recursive:!0,force:!0})))}catch{throw new Le("Failed to remove node_modules",{type:"error_removing_node_modules"})}}}async function Wx(t){let{project:e,logger:r,options:i}=t;r.subStep(`removing ${Nr.default.relative(e.paths.root,e.paths.lockfile)}`),i!=null&&i.dry||(0,He.rmSync)(e.paths.lockfile,{force:!0})}async function Yx(t){let{project:e,options:r,logger:i}=t,n=()=>{i.subStep(`converting ${Nr.default.relative(e.paths.root,e.paths.lockfile)} to ${lr.lock}`)},s=async()=>{if(!(r!=null&&r.dry)&&(0,He.existsSync)(e.paths.lockfile))try{await(0,Ay.default)(lr.name,["import"],{stdio:"ignore",cwd:e.paths.root})}catch{}finally{It({project:e,options:r})}};switch(e.packageManager){case"pnpm":break;case"bun":n(),await Oy({project:e,options:r}),await s(),(0,He.rmSync)(Nr.default.join(e.paths.root,"yarn.lock"),{force:!0});break;case"npm":n(),await s();break;case"yarn":n(),await s();break}}var Kx={detect:Ty,read:Ux,create:Gx,remove:zx,clean:Wx,convertLock:Yx};W();var Ai={name:"npm",lock:"package-lock.json"};async function ky(t){let e=gn.default.join(t.workspaceRoot,Ai.lock),r=Ws({workspaceRoot:t.workspaceRoot});return(0,wt.existsSync)(e)||r===Ai.name}async function Vx(t){if(!await ky(t))throw new Le("Not an npm project",{type:"package_manager-unexpected"});let e=Ue(t),{name:r,description:i}=An(t),n=kl({workspaces:e.workspaces});return{name:r,description:i,packageManager:Ai.name,paths:Ys({root:t.workspaceRoot,lockFile:Ai.lock}),workspaceData:{globs:n,workspaces:Ks({workspaceGlobs:n,...t})}}}async function Zx(t){let{project:e,options:r,to:i,logger:n}=t,s=e.workspaceData.globs.length>0;n.mainStep(hr({packageManager:Ai.name,action:"create",project:e}));let o=Ue({workspaceRoot:e.paths.root});n.rootHeader(),n.rootStep(`adding "packageManager" field to ${gn.default.relative(e.paths.root,e.paths.packageJson)}`),o.packageManager=`${i.name}@${i.version}`,s?(n.rootStep(`adding "workspaces" field to ${gn.default.relative(e.paths.root,e.paths.packageJson)}`),o.workspaces=e.workspaceData.globs,r!=null&&r.dry||(0,wt.writeJSONSync)(e.paths.packageJson,o,{spaces:2}),ar({workspace:{name:"root",paths:e.paths},project:e,to:i,logger:n,options:r}),n.workspaceHeader(),e.workspaceData.workspaces.forEach(u=>{ar({workspace:u,project:e,to:i,logger:n,options:r})})):r!=null&&r.dry||(0,wt.writeJSONSync)(e.paths.packageJson,o,{spaces:2})}async function Jx(t){let{project:e,logger:r,options:i}=t,n=e.workspaceData.globs.length>0;r.mainStep(hr({packageManager:Ai.name,action:"remove",project:e}));let s=Ue({workspaceRoot:e.paths.root});if(n&&(r.subStep(`removing "workspaces" field in ${e.name} root "package.json"`),delete s.workspaces),r.subStep(`removing "packageManager" field in ${e.name} root "package.json"`),delete s.packageManager,!(i!=null&&i.dry)){(0,wt.writeJSONSync)(e.paths.packageJson,s,{spaces:2});let o=[e.paths.nodeModules,...e.workspaceData.workspaces.map(u=>u.paths.nodeModules)];try{r.subStep('removing "node_modules"'),await Promise.all(o.map(u=>(0,wt.rm)(u,{recursive:!0,force:!0})))}catch{throw new Le("Failed to remove node_modules",{type:"error_removing_node_modules"})}}}async function Xx(t){let{project:e,logger:r,options:i}=t;r.subStep(`removing ${gn.default.relative(e.paths.root,e.paths.lockfile)}`),i!=null&&i.dry||(0,wt.rmSync)(e.paths.lockfile,{force:!0})}async function Qx(t){let{project:e,options:r}=t;switch(e.packageManager){case"pnpm":It({project:e,options:r});break;case"bun":It({project:e,options:r});break;case"npm":break;case"yarn":It({project:e,options:r});break}}var eF={detect:ky,read:Vx,create:Zx,remove:Jx,clean:Xx,convertLock:Qx};W();var Mr={name:"yarn",lock:"yarn.lock"};async function Ly(t){let e=vi.default.join(t.workspaceRoot,Mr.lock),r=Ws({workspaceRoot:t.workspaceRoot});return(0,St.existsSync)(e)||r===Mr.name}async function tF(t){if(!await Ly(t))throw new Le("Not a yarn project",{type:"package_manager-unexpected"});let e=Ue(t),{name:r,description:i}=An(t),n=kl({workspaces:e.workspaces});return{name:r,description:i,packageManager:Mr.name,paths:Ys({root:t.workspaceRoot,lockFile:Mr.lock}),workspaceData:{globs:n,workspaces:Ks({workspaceGlobs:n,...t})}}}async function rF(t){let{project:e,to:r,logger:i,options:n}=t,s=e.workspaceData.globs.length>0;i.mainStep(hr({packageManager:Mr.name,action:"create",project:e}));let o=Ue({workspaceRoot:e.paths.root});i.rootHeader(),i.rootStep(`adding "packageManager" field to ${vi.default.relative(e.paths.root,e.paths.packageJson)}`),o.packageManager=`${r.name}@${r.version}`,s?(i.rootStep(`adding "workspaces" field to ${vi.default.relative(e.paths.root,e.paths.packageJson)}`),o.workspaces=e.workspaceData.globs,n!=null&&n.dry||(0,St.writeJSONSync)(e.paths.packageJson,o,{spaces:2}),ar({workspace:{name:"root",paths:e.paths},project:e,to:r,logger:i,options:n}),i.workspaceHeader(),e.workspaceData.workspaces.forEach(u=>{ar({workspace:u,project:e,to:r,logger:i,options:n})})):n!=null&&n.dry||(0,St.writeJSONSync)(e.paths.packageJson,o,{spaces:2})}async function iF(t){let{project:e,logger:r,options:i}=t,n=e.workspaceData.globs.length>0;r.mainStep(hr({packageManager:Mr.name,action:"remove",project:e}));let s=Ue({workspaceRoot:e.paths.root});if(n&&(r.subStep(`removing "workspaces" field in ${e.name} root "package.json"`),delete s.workspaces),r.subStep(`removing "packageManager" field in ${e.name} root "package.json"`),delete s.packageManager,!(i!=null&&i.dry)){(0,St.writeJSONSync)(e.paths.packageJson,s,{spaces:2});let o=[e.paths.nodeModules,...e.workspaceData.workspaces.map(u=>u.paths.nodeModules)];try{r.subStep('removing "node_modules"'),await Promise.all(o.map(u=>(0,St.rm)(u,{recursive:!0,force:!0})))}catch{throw new Le("Failed to remove node_modules",{type:"error_removing_node_modules"})}}}async function nF(t){let{project:e,logger:r,options:i}=t;r.subStep(`removing ${vi.default.relative(e.paths.root,e.paths.lockfile)}`),i!=null&&i.dry||(0,St.rmSync)(e.paths.lockfile,{force:!0})}async function sF(t){let{project:e,options:r,logger:i}=t,n=()=>{i.subStep(`converting ${vi.default.relative(e.paths.root,e.paths.lockfile)} to ${Mr.lock}`)};switch(e.packageManager){case"pnpm":It({project:e,options:r});break;case"bun":n(),await Oy({project:e,options:r});break;case"npm":It({project:e,options:r});break;case"yarn":break}}var oF={detect:Ly,read:tF,create:rF,remove:iF,clean:nF,convertLock:sF};W();var Ci={name:"bun",lock:"bun.lockb"};async function By(t){let e=En.default.join(t.workspaceRoot,Ci.lock),r=Ws({workspaceRoot:t.workspaceRoot});return(0,At.existsSync)(e)||r===Ci.name}async function uF(t){if(!await By(t))throw new Le("Not a bun project",{type:"package_manager-unexpected"});let e=Ue(t),{name:r,description:i}=An(t),n=kl({workspaces:e.workspaces});return{name:r,description:i,packageManager:Ci.name,paths:Ys({root:t.workspaceRoot,lockFile:Ci.lock}),workspaceData:{globs:n,workspaces:Ks({workspaceGlobs:n,...t})}}}async function aF(t){let{project:e,to:r,logger:i,options:n}=t,s=e.workspaceData.globs.length>0;if(!qx({project:e}))throw new Le("Unable to convert project to bun - workspace globs unsupported",{type:"bun-workspace_glob_error"});i.mainStep(hr({packageManager:Ci.name,action:"create",project:e}));let o=Ue({workspaceRoot:e.paths.root});i.rootHeader(),i.rootStep(`adding "packageManager" field to ${En.default.relative(e.paths.root,e.paths.packageJson)}`),o.packageManager=`${r.name}@${r.version}`,s?(i.rootStep(`adding "workspaces" field to ${En.default.relative(e.paths.root,e.paths.packageJson)}`),o.workspaces=e.workspaceData.globs,n!=null&&n.dry||(0,At.writeJSONSync)(e.paths.packageJson,o,{spaces:2}),ar({workspace:{name:"root",paths:e.paths},project:e,to:r,logger:i,options:n}),i.workspaceHeader(),e.workspaceData.workspaces.forEach(u=>{ar({workspace:u,project:e,to:r,logger:i,options:n})})):n!=null&&n.dry||(0,At.writeJSONSync)(e.paths.packageJson,o,{spaces:2})}async function lF(t){let{project:e,logger:r,options:i}=t,n=e.workspaceData.globs.length>0;r.mainStep(hr({packageManager:Ci.name,action:"remove",project:e}));let s=Ue({workspaceRoot:e.paths.root});if(n&&(r.subStep(`removing "workspaces" field in ${e.name} root "package.json"`),delete s.workspaces),r.subStep(`removing "packageManager" field in ${e.name} root "package.json"`),delete s.packageManager,!(i!=null&&i.dry)){(0,At.writeJSONSync)(e.paths.packageJson,s,{spaces:2});let o=[e.paths.nodeModules,...e.workspaceData.workspaces.map(u=>u.paths.nodeModules)];try{r.subStep('removing "node_modules"'),await Promise.all(o.map(u=>(0,At.rm)(u,{recursive:!0,force:!0})))}catch{throw new Le("Failed to remove node_modules",{type:"error_removing_node_modules"})}}}async function cF(t){let{project:e,logger:r,options:i}=t;r.subStep(`removing ${En.default.relative(e.paths.root,e.paths.lockfile)}`),i!=null&&i.dry||(0,At.rmSync)(e.paths.lockfile,{force:!0})}async function hF(t){let{project:e,options:r}=t;switch(e.packageManager){case"pnpm":It({project:e,options:r});break;case"bun":break;case"npm":It({project:e,options:r});break;case"yarn":It({project:e,options:r});break}}var fF={detect:By,read:uF,create:aF,remove:lF,clean:cF,convertLock:hF},Py={pnpm:Kx,yarn:oF,npm:eF,bun:fF};W();async function Ll({root:t}){let{exists:e,absolute:r}=Hx({directory:t});if(!e)throw new Le(`Could not find directory at ${r}. Ensure the directory exists.`,{type:"invalid_directory"});for(let{detect:i,read:n}of Object.values(Py))if(await i({workspaceRoot:r}))return n({workspaceRoot:r});throw new Le("Could not determine package manager. Add `packageManager` to `package.json` or ensure a lockfile is present.",{type:"package_manager-unable_to_detect"})}W();W();W();W();var c_=require("fs-extra");var su=ie(require("chalk"));var DF=ie(qy());function Pl(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function vn(t){return vn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vn(t)}function Il(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Nl(t,e){if(e&&(vn(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Il(t)}function Hr(t){return Hr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Hr(t)}function Ht(t,e){return Ht=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,n){return i.__proto__=n,i},Ht(t,e)}function Ml(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ht(t,e)}function jl(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function Hl(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ri(t,e,r){return Hl()?Ri=Reflect.construct.bind():Ri=function(n,s,o){var u=[null];u.push.apply(u,s);var a=Function.bind.apply(n,u),l=new a;return o&&Ht(l,o.prototype),l},Ri.apply(null,arguments)}function Cn(t){var e=typeof Map=="function"?new Map:void 0;return Cn=function(i){if(i===null||!jl(i))return i;if(typeof i!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e!="undefined"){if(e.has(i))return e.get(i);e.set(i,n)}function n(){return Ri(i,arguments,Hr(this).constructor)}return n.prototype=Object.create(i.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Ht(n,i)},Cn(t)}var $y=ie(require("find-up"));var _F=ie(require("fs-extra")),z2=function(t){Ml(e,t);function e(r){var i;return Pl(this,e),i=Nl(this,Hr(e).call(this,"No package.json could be found upwards from the directory ".concat(r))),i.directory=r,i}return e}(Cn(Error));var bF=ie(require("fs")),wF=ie(require("path"));var BF=ie(require("fs")),PF=ie(require("path"));var IF=ie($s());var it={};Fh(it,{bold:()=>xF,dimmed:()=>OF,error:()=>Jy,grey:()=>TF,info:()=>RF,item:()=>kF,log:()=>pr,turboBlue:()=>xi,turboGradient:()=>CF,turboLoader:()=>Vy,turboRed:()=>Yy,underline:()=>FF,warn:()=>Zy,yellow:()=>Ky});var fr=ie(require("chalk")),Uy=ie(require("ora")),Gy=ie(require("gradient-string")),zy="#0099F7",Wy="#F11712",vF="#FFFF00",CF=(0,Gy.default)(zy,Wy),xi=fr.default.hex(zy),Yy=fr.default.hex(Wy),Ky=fr.default.hex(vF),Vy=t=>(0,Uy.default)({text:t,spinner:{frames:[" ",xi("> "),xi(">> "),xi(">>>")]}}),RF=(...t)=>{pr(xi.bold(">>>"),...t)},xF=(...t)=>{pr(fr.default.bold(...t))},FF=(...t)=>{pr(fr.default.underline(...t))},OF=(...t)=>{pr(fr.default.dim(...t))},TF=(...t)=>{pr(fr.default.grey(...t))},kF=(...t)=>{pr(xi.bold(" \u2022"),...t)},pr=(...t)=>{console.log(...t)},Zy=(...t)=>{console.error(Ky.bold(">>>"),...t)},Jy=(...t)=>{console.error(Yy.bold(">>>"),...t)};var NF=ie(require("os")),MF=ie(ai());var jF=ie(require("fs-extra"));var HF=ie(require("path")),qF=ie(require("fs-extra")),$F=ie(require("chalk"));var ZD=require("stream"),JD=require("util"),Ak=require("path"),vk=require("os"),XD=require("fs"),Ck=ie(VD());var iN=(0,JD.promisify)(ZD.Stream.pipeline);var QD=require("fs-extra");var Ik=ie(require("path")),Nk=ie(o_()),Mk=ie(require("chalk")),Ch=require("fs-extra");var dt=ie(require("chalk")),Xi=class{constructor(e){this.transform=e.transformer,this.dry=e.dry}_log(...e){console.log(...e)}modified(...e){this._log(dt.default.green(" MODIFIED "),...e,this.dry?dt.default.dim("(dry run)"):"")}unchanged(...e){this._log(dt.default.gray(" UNCHANGED "),...e,this.dry?dt.default.dim("(dry run)"):"")}skipped(...e){this._log(dt.default.yellow(" SKIPPED "),...e,this.dry?dt.default.dim("(dry run)"):"")}error(...e){this._log(dt.default.red(" ERROR "),...e,this.dry?dt.default.dim("(dry run)"):"")}info(...e){this._log(dt.default.bold(" INFO "),...e,this.dry?dt.default.dim("(dry run)"):"")}};var u_=ie(require("os")),Rh=ie(require("path"));var ru=ie(require("chalk")),nu=require("diff"),Rr=require("fs-extra"),iu=class{constructor(e){this.changes=[];if(this.filePath=e.filePath,this.rootPath=e.rootPath,this.after=e.after,this.error=e.error,e.before===void 0)try{Rh.default.extname(e.filePath)===".json"?this.before=(0,Rr.readJsonSync)(e.filePath):this.before=(0,Rr.readFileSync)(e.filePath)}catch{this.before=""}else e.before===null?this.before="":this.before=e.before;e.after?typeof this.before=="object"||typeof e.after=="object"?this.changes=(0,nu.diffJson)(this.before,e.after):this.changes=(0,nu.diffLines)(this.before,e.after):this.changes=[]}fileName(){return Rh.default.relative(this.rootPath,this.filePath)}write(){this.after&&(typeof this.after=="object"?(0,Rr.writeJsonSync)(this.filePath,this.after,{spaces:2}):(0,Rr.writeFileSync)(this.filePath,this.after))}additions(){return this.changes.filter(e=>e.added).length}deletions(){return this.changes.filter(e=>e.removed).length}hasChanges(){return this.additions()>0||this.deletions()>0}log(e){e.diff?(this.changes.forEach(r=>{r.added?process.stdout.write(ru.default.green(r.value)):r.removed?process.stdout.write(ru.default.red(r.value)):process.stdout.write(ru.default.dim(r.value))}),it.log(u_.default.EOL)):it.log(this.after)}};var Yn=class{constructor(e){this.modifications={};this.transform=e.transformer,this.rootPath=e.rootPath,this.dry=e.dry,this.print=e.print,this.logger=new Xi(e)}abortTransform(e){return this.logger.error(e.reason),{fatalError:new Error(e.reason),changes:e.changes||{}}}modifyFile(e){this.modifications[e.filePath]=new iu({rootPath:this.rootPath,...e})}finish(){let e={changes:{}};return Object.keys(this.modifications).forEach(i=>{let n=this.modifications[i],s={action:"unchanged",additions:n.additions(),deletions:n.deletions()};if(n.hasChanges()){if(this.dry)s.action="skipped",this.logger.skipped(su.default.dim(n.fileName()));else try{n.write(),s.action="modified",this.logger.modified(su.default.bold(n.fileName()))}catch(o){let u="Unknown error";o instanceof Error&&(u=o.message),s.error=new Error(u),s.action="error",this.logger.error(n.fileName(),u)}this.print&&n.log({diff:!0})}else this.logger.unchanged(su.default.dim(n.fileName()));e.changes[n.fileName()]=s}),Object.keys(e.changes).some(i=>e.changes[i].action==="error")?this.abortTransform({reason:"Encountered an error while transforming files",changes:e.changes}):e}static logResults(e){let r=Object.keys(e.changes);if(it.log(),r.length>0){it.bold("Results:");let i={};r.forEach(n=>{var o;let s=e.changes[n];i[n]={action:s.action,additions:s.additions,deletions:s.deletions,error:((o=s.error)==null?void 0:o.message)||"None"}}),console.table(i),it.log()}}};function a_({transformer:t,rootPath:e,options:r}){let i={transformer:t,rootPath:e,...r},n=new Xi(i),s=new Yn(i);return{log:n,runner:s}}var h_="add-package-names",jk="Ensure all packages have a name in their package.json",Hk="2.0.0-canary.0";async function l_(t){try{return await(0,c_.readJson)(t)}catch{return null}}function f_({pkgPath:t,pkgName:e}){let r="",i=e;if(e&&e.startsWith("@")&&e.includes("/")){let s=e.split("/");r=`${s[0]}/`,i=s[1]}let n=xh.default.basename(xh.default.dirname(t));return e?`${r}${n}-${i}`:`${r}${n}`}async function p_({root:t,options:e}){let{log:r,runner:i}=a_({transformer:h_,rootPath:t,options:e});r.info('Validating that each package has a unique "name"...');let n;try{n=await Ll({root:t})}catch{return i.abortTransform({reason:`Unable to determine package manager for ${t}`})}let s=[n.paths.packageJson],o=[l_(n.paths.packageJson)];n.workspaceData.workspaces.forEach(c=>{let h=c.paths.packageJson;s.push(h),o.push(l_(h))});let u=await Promise.all(o),a=Object.fromEntries(s.map((c,h)=>[c,u[h]])),l=new Set;for(let[c,h]of Object.entries(a))if(h)if(!h.name||l.has(h.name)){let f=f_({pkgPath:c,pkgName:h.name});i.modifyFile({filePath:c,after:{...h,name:f}}),l.add(f)}else l.add(h.name);return i.finish()}var qk={name:h_,description:jk,introducedIn:Hk,transformer:p_},$k=qk;0&&(module.exports={getNewPkgName,transformer});
|
|
44
44
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
45
45
|
/*! Bundled license information:
|
|
46
46
|
|