@junobuild/cli 0.0.8 → 0.0.9
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/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -267,7 +267,7 @@ ${e}`,V9=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),z9=Objec
|
|
|
267
267
|
`),i=!1,n=!1,s;t.on("response",a=>{let{headers:A}=a;i=A["transfer-encoding"]==="chunked"&&!A["content-length"]}),t.on("socket",a=>{let A=()=>{if(i&&!n){let l=new Error("Premature close");l.code="ERR_STREAM_PREMATURE_CLOSE",e(l)}},c=l=>{n=Dp.Buffer.compare(l.slice(-5),r)===0,!n&&s&&(n=Dp.Buffer.compare(s.slice(-3),r.slice(0,3))===0&&Dp.Buffer.compare(l.slice(-2),r.slice(3))===0),s=l};a.prependListener("close",A),a.on("data",c),t.on("close",()=>{a.removeListener("close",A),a.removeListener("data",c)})})}var am=()=>({identity:G8.Ed25519KeyIdentity.fromParsedJson(sB()),fetch:sm,env:process.env.NODE_ENV==="development"?"dev":"prod"});var PA=t=>({satelliteId:t,...am()}),O8=t=>aB().find(({p:i})=>i===t)?.n??t;var P8=async()=>{if(!await qA()){console.log(`${(0,L8.red)("No configuration found.")}`);return}let{satelliteId:t}=await No(),e=Ec("Clearing dapp assets...").start();try{await(0,q8.deleteAssets)({collection:WE,satellite:PA(t)})}finally{e.stop()}};var Ek=Lt(Am()),Pp=Lt(Gr());var Sh=Lt(Gr()),bm=Lt(wm());var Dh=async()=>{if(!sB()){console.log(`No controller found. Run ${(0,Sh.cyan)("login")} to get started \u{1F680}.`);return}let e=aB(),r=await(e?.length>0?bee(e):pk());r==="_manual_"&&(r=await pk());let i=await vee();await r8({satelliteId:r,source:i})},bee=async t=>{let{satellite:e}=await(0,bm.default)({type:"select",name:"satellite",message:"Which satellite should be linked with this dapp?",choices:[...t.map(({p:r,n:i})=>({title:i,value:r})),{title:"<not listed, manual entry>",value:"_manual_"}],initial:0});return(e===void 0||e==="")&&process.exit(1),e},pk=async()=>{let{satellite:t}=await(0,bm.default)([{type:"text",name:"satellite",message:`What's the ${(0,Sh.cyan)("id")} of your satellite?`}]);return(t===void 0||t==="")&&(console.log(`${(0,Sh.red)("The satellite ID is mandatory")}`),process.exit(1)),t},vee=async()=>{let{source:t}=await(0,bm.default)([{type:"text",name:"source",message:`What's the name or path of the build ${(0,Sh.cyan)("source")} folder of your dapp?`,initial:"build"}]);return(t===void 0||t==="")&&process.exit(1),t};var Ik=async()=>{await qA()||await Dh();let{satelliteId:t,storage:e}=await No();if(!e||!e.trailingSlash){console.log("No config for the storage, satellite unchanged.");return}if(!["always","never"].includes(e.trailingSlash)){console.log(`${(0,Pp.red)("Unknown configuration option.")}`);return}await(0,Ek.setConfig)({config:{storage:e},satellite:PA(t)}),console.log(`Run ${(0,Pp.cyan)("clear")} and ${(0,Pp.cyan)("deploy")} to apply the changes to your dapp.`)};var Rm=Lt(ob()),AM=require("buffer"),oM=Lt(require("crypto"));var Gl=Lt(require("node:fs"),1),Lfe=Gl.default.existsSync,Pfe=Gl.default.createReadStream;async function Q1(t){return new Promise((e,r)=>{Gl.default.stat(t,(i,n)=>{i?r(i):e(n)})})}async function Bk(t){return new Promise((e,r)=>{Gl.default.close(t,i=>{i?r(i):e()})})}async function mk(t,e){return new Promise((r,i)=>{Gl.default.open(t,e,(n,s)=>{n?i(n):r(s)})})}async function y1(t,e,r,i,n){return new Promise((s,a)=>{Gl.default.read(t,e,r,i,n,(A,c,l)=>{A?a(A):s({bytesRead:c,buffer:l})})})}var xee="End-Of-Stream",In=class extends Error{constructor(){super(xee)}};var Kfe=1*1024*1024;var C1=require("node:buffer"),Rh=class{constructor(e){this.position=0,this.numBuffer=new Uint8Array(8),this.fileInfo=e||{}}async readToken(e,r=this.position){let i=C1.Buffer.alloc(e.len);if(await this.readBuffer(i,{position:r})<e.len)throw new In;return e.get(i,0)}async peekToken(e,r=this.position){let i=C1.Buffer.alloc(e.len);if(await this.peekBuffer(i,{position:r})<e.len)throw new In;return e.get(i,0)}async readNumber(e){if(await this.readBuffer(this.numBuffer,{length:e.len})<e.len)throw new In;return e.get(this.numBuffer,0)}async peekNumber(e){if(await this.peekBuffer(this.numBuffer,{length:e.len})<e.len)throw new In;return e.get(this.numBuffer,0)}async ignore(e){if(this.fileInfo.size!==void 0){let r=this.fileInfo.size-this.position;if(e>r)return this.position+=r,r}return this.position+=e,e}async close(){}normalizeOptions(e,r){if(r&&r.position!==void 0&&r.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return r?{mayBeLess:r.mayBeLess===!0,offset:r.offset?r.offset:0,length:r.length?r.length:e.length-(r.offset?r.offset:0),position:r.position?r.position:this.position}:{mayBeLess:!1,offset:0,length:e.length,position:this.position}}};var w1=class extends Rh{constructor(e,r){super(r),this.fd=e}async readBuffer(e,r){let i=this.normalizeOptions(e,r);this.position=i.position;let n=await y1(this.fd,e,i.offset,i.length,i.position);if(this.position+=n.bytesRead,n.bytesRead<i.length&&(!r||!r.mayBeLess))throw new In;return n.bytesRead}async peekBuffer(e,r){let i=this.normalizeOptions(e,r),n=await y1(this.fd,e,i.offset,i.length,i.position);if(!i.mayBeLess&&n.bytesRead<i.length)throw new In;return n.bytesRead}async close(){return Bk(this.fd)}};async function b1(t){let e=await Q1(t);if(!e.isFile)throw new Error(`File not a file: ${t}`);let r=await mk(t,"r");return new w1(r,{path:t,size:e.size})}var Cu=require("node:buffer");var Ck=Lt(x0(),1),wk=require("node:buffer");function Ws(t){return new DataView(t.buffer,t.byteOffset)}var bk={len:1,get(t,e){return Ws(t).getUint8(e)},put(t,e,r){return Ws(t).setUint8(e,r),e+1}},vm={len:2,get(t,e){return Ws(t).getUint16(e,!0)},put(t,e,r){return Ws(t).setUint16(e,r,!0),e+2}},xm={len:2,get(t,e){return Ws(t).getUint16(e)},put(t,e,r){return Ws(t).setUint16(e,r),e+2}};var vk={len:4,get(t,e){return Ws(t).getUint32(e,!0)},put(t,e,r){return Ws(t).setUint32(e,r,!0),e+4}},xk={len:4,get(t,e){return Ws(t).getUint32(e)},put(t,e,r){return Ws(t).setUint32(e,r),e+4}};var _k={len:4,get(t,e){return Ws(t).getInt32(e)},put(t,e,r){return Ws(t).setInt32(e,r),e+4}};var Sk={len:8,get(t,e){return Ws(t).getBigUint64(e,!0)},put(t,e,r){return Ws(t).setBigUint64(e,r,!0),e+8}};var Mc=class{constructor(e,r){this.len=e,this.encoding=r}get(e,r){return wk.Buffer.from(e).toString(this.encoding,r,r+this.len)}},kc=class{constructor(e){this.len=e}static decode(e,r,i){let n="";for(let s=r;s<i;++s)n+=kc.codePointToString(kc.singleByteDecoder(e[s]));return n}static inRange(e,r,i){return r<=e&&e<=i}static codePointToString(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}static singleByteDecoder(e){if(kc.inRange(e,0,127))return e;let r=kc.windows1252[e-128];if(r===null)throw Error("invaliding encoding");return r}get(e,r=0){return kc.decode(e,r,r+this.len)}};kc.windows1252=[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,381,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,382,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255];function Dk(t){return[...t].map(e=>e.charCodeAt(0))}function Rk(t,e=0){let r=Number.parseInt(t.toString("utf8",148,154).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(r))return!1;let i=8*32;for(let n=e;n<e+148;n++)i+=t[n];for(let n=e+156;n<e+512;n++)i+=t[n];return r===i}var Nk={get:(t,e)=>t[e+3]&127|t[e+2]<<7|t[e+1]<<14|t[e]<<21,len:4};var Fk=["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","ai","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet"],Tk=["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/x-apache-arrow","video/mp4","audio/midi","video/x-matroska","video/webm","video/quicktime","video/vnd.avi","audio/vnd.wave","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","audio/opus","video/ogg","audio/ogg","application/ogg","audio/x-flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/x-parquet"];var Fee=4100;function Lo(t,e,r){r={offset:0,...r};for(let[i,n]of e.entries())if(r.mask){if(n!==(r.mask[i]&t[i+r.offset]))return!1}else if(n!==t[i+r.offset])return!1;return!0}async function x1(t){try{return new v1().parse(t)}catch(e){if(!(e instanceof In))throw e}}var v1=class{check(e,r){return Lo(this.buffer,e,r)}checkString(e,r){return this.check(Dk(e),r)}async parse(e){if(this.buffer=Cu.Buffer.alloc(Fee),e.fileInfo.size===void 0&&(e.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=e,await e.peekBuffer(this.buffer,{length:12,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await e.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([239,187,191]))return this.tokenizer.ignore(3),this.parse(e);if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8]))return{ext:"gz",mime:"application/gzip"};if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await e.ignore(6);let r=await e.readToken(Nk);return e.position+r>e.fileInfo.size?{ext:"mp3",mime:"audio/mpeg"}:(await e.ignore(r),x1(e))}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((this.buffer[0]===67||this.buffer[0]===70)&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4])){try{for(;e.position+30<e.fileInfo.size;){await e.readBuffer(this.buffer,{length:30});let r={compressedSize:this.buffer.readUInt32LE(18),uncompressedSize:this.buffer.readUInt32LE(22),filenameLength:this.buffer.readUInt16LE(26),extraFieldLength:this.buffer.readUInt16LE(28)};if(r.filename=await e.readToken(new Mc(r.filenameLength,"utf-8")),await e.ignore(r.extraFieldLength),r.filename==="META-INF/mozilla.rsa")return{ext:"xpi",mime:"application/x-xpinstall"};if(r.filename.endsWith(".rels")||r.filename.endsWith(".xml"))switch(r.filename.split("/")[0]){case"_rels":break;case"word":return{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};case"ppt":return{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"};case"xl":return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};default:break}if(r.filename.startsWith("xl/"))return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};if(r.filename.startsWith("3D/")&&r.filename.endsWith(".model"))return{ext:"3mf",mime:"model/3mf"};if(r.filename==="mimetype"&&r.compressedSize===r.uncompressedSize){let i=await e.readToken(new Mc(r.compressedSize,"utf-8"));switch(i=i.trim(),i){case"application/epub+zip":return{ext:"epub",mime:"application/epub+zip"};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:"application/vnd.oasis.opendocument.text"};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:"application/vnd.oasis.opendocument.spreadsheet"};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:"application/vnd.oasis.opendocument.presentation"};default:}}if(r.compressedSize===0){let i=-1;for(;i<0&&e.position<e.fileInfo.size;)await e.peekBuffer(this.buffer,{mayBeLess:!0}),i=this.buffer.indexOf("504B0304",0,"hex"),await e.ignore(i>=0?i:this.buffer.length)}else await e.ignore(r.compressedSize)}}catch(r){if(!(r instanceof In))throw r}return{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await e.ignore(28);let r=Cu.Buffer.alloc(8);return await e.readBuffer(r),Lo(r,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/opus"}:Lo(r,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:Lo(r,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:Lo(r,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:Lo(r,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:Lo(r,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(this.buffer[2]===3||this.buffer[2]===5||this.buffer[2]===7)&&(this.buffer[3]===4||this.buffer[3]===6||this.buffer[3]===8))return{ext:"zip",mime:"application/zip"};if(this.checkString("ftyp",{offset:4})&&this.buffer[8]&96){let r=this.buffer.toString("binary",8,12).replace("\0"," ").trim();switch(r){case"avif":case"avis":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:return r.startsWith("3g")?r.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/x-flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF")){await e.ignore(1350);let r=10*1024*1024,i=Cu.Buffer.alloc(Math.min(r,e.fileInfo.size));return await e.readBuffer(i,{mayBeLess:!0}),i.includes(Cu.Buffer.from("AIPrivateData"))?{ext:"ai",mime:"application/postscript"}:{ext:"pdf",mime:"application/pdf"}}if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){let r=await this.readTiffHeader(!1);if(r)return r}if(this.check([77,77])){let r=await this.readTiffHeader(!0);if(r)return r}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function r(){let A=await e.peekNumber(bk),c=128,l=0;for(;!(A&c)&&c!==0;)++l,c>>=1;let g=Cu.Buffer.alloc(l+1);return await e.readBuffer(g),g}async function i(){let A=await r(),c=await r();c[0]^=128>>c.length-1;let l=Math.min(6,c.length);return{id:A.readUIntBE(0,A.length),len:c.readUIntBE(c.length-l,l)}}async function n(A){for(;A>0;){let c=await i();if(c.id===17026)return(await e.readToken(new Mc(c.len,"utf-8"))).replace(/\00.*$/g,"");await e.ignore(c.len),--A}}let s=await i();switch(await n(s.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/x-matroska"};default:return}}if(this.check([82,73,70,70])){if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/vnd.wave"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1"))return{ext:"parquet",mime:"application/x-parquet"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(this.buffer[6]===0||this.buffer[6]===1))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){let r=this.buffer.toString("binary",2,6);if(r.match("^d*")&&r>=1e3&&r<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>"))return await e.ignore(8),await e.readToken(new Mc(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.check([137,80,78,71,13,10,26,10])){await e.ignore(8);async function r(){return{length:await e.readToken(_k),type:await e.readToken(new Mc(4,"binary"))}}do{let i=await r();if(i.length<0)return;switch(i.type){case"IDAT":return{ext:"png",mime:"image/png"};case"acTL":return{ext:"apng",mime:"image/apng"};default:await e.ignore(i.length+4)}}while(e.position+8<e.fileInfo.size);return{ext:"png",mime:"image/png"}}if(this.check([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/x-apache-arrow"};if(this.check([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"};if(this.check([102,114,101,101],{offset:4})||this.check([109,100,97,116],{offset:4})||this.check([109,111,111,118],{offset:4})||this.check([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(this.check([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(this.checkString("gimp xcf "))return{ext:"xcf",mime:"image/x-xcf"};if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217])){async function r(){let i=Cu.Buffer.alloc(16);return await e.readBuffer(i),{id:i,size:Number(await e.readToken(Sk))}}for(await e.ignore(30);e.position+24<e.fileInfo.size;){let i=await r(),n=i.size-24;if(Lo(i.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){let s=Cu.Buffer.alloc(16);if(n-=await e.readBuffer(s),Lo(s,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(Lo(s,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}await e.ignore(n)}return{ext:"asf",mime:"application/vnd.ms-asf"}}if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(this.check([0,0,0,12,106,80,32,32,13,10,135,10]))switch(await e.ignore(20),await e.readToken(new Mc(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(this.check([254,255]))return this.check([0,60,0,63,0,120,0,109,0,108],{offset:2})?{ext:"xml",mime:"application/xml"}:void 0;if(this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(this.check([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"};if(await e.peekBuffer(this.buffer,{length:Math.min(256,e.fileInfo.size),mayBeLess:!0}),this.checkString("BEGIN:")){if(this.checkString("VCARD",{offset:6}))return{ext:"vcf",mime:"text/vcard"};if(this.checkString("VCALENDAR",{offset:6}))return{ext:"ics",mime:"text/calendar"}}if(this.checkString("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(this.checkString("Extended Module:"))return{ext:"xm",mime:"audio/x-xm"};if(this.checkString("Creative Voice File"))return{ext:"voc",mime:"audio/x-voc"};if(this.check([4,0,0,0])&&this.buffer.length>=16){let r=this.buffer.readUInt32LE(12);if(r>12&&this.buffer.length>=r+16)try{let i=this.buffer.slice(16,r+16).toString();if(JSON.parse(i).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}if(this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(this.checkString("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"};if(this.check([71])&&this.check([71],{offset:188}))return{ext:"mts",mime:"video/mp2t"};if(this.check([71],{offset:4})&&this.check([71],{offset:196}))return{ext:"mts",mime:"video/mp2t"};if(this.check([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(this.check([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"};if(this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x.ms.shortcut"};if(this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x.apple.alias"};if(this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"};if(await e.peekBuffer(this.buffer,{length:Math.min(512,e.fileInfo.size),mayBeLess:!0}),Rk(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254]))return this.check([60,0,63,0,120,0,109,0,108,0],{offset:2})?{ext:"xml",mime:"application/xml"}:this.check([255,14,83,0,107,0,101,0,116,0,99,0,104,0,85,0,112,0,32,0,77,0,111,0,100,0,101,0,108,0],{offset:2})?{ext:"skp",mime:"application/vnd.sketchup.skp"}:void 0;if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"};if(this.buffer.length>=2&&this.check([255,224],{offset:0,mask:[255,224]})){if(this.check([16],{offset:1,mask:[22]}))return this.check([8],{offset:1,mask:[8]})?{ext:"aac",mime:"audio/aac"}:{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}async readTiffTag(e){let r=await this.tokenizer.readToken(e?xm:vm);switch(this.tokenizer.ignore(10),r){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"};default:}}async readTiffIFD(e){let r=await this.tokenizer.readToken(e?xm:vm);for(let i=0;i<r;++i){let n=await this.readTiffTag(e);if(n)return n}}async readTiffHeader(e){let r=(e?xm:vm).get(this.buffer,2),i=(e?xk:vk).get(this.buffer,4);if(r===42){if(i>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(i>=8&&(this.check([28,0,254,0],{offset:8})||this.check([31,0,11,0],{offset:8})))return{ext:"nef",mime:"image/x-nikon-nef"}}return await this.tokenizer.ignore(i),await this.readTiffIFD(e)??{ext:"tif",mime:"image/tiff"}}if(r===43)return{ext:"tif",mime:"image/tiff"}}};var yhe=new Set(Fk),Che=new Set(Tk);async function kk(t){let e=await b1(t);try{return await x1(e)}finally{await e.close()}}var Nm=require("fs"),k1=require("fs/promises"),Fm=Lt(Gr()),cM=Lt(Lk());var iM=Lt(eM(),1),$a=(t,e,r={})=>(Dm(e),!r.nocomment&&e.charAt(0)==="#"?!1:new Nh(e,r).match(t)),T1=$a,Kee=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",Sm=Kee==="win32",N1=Sm?{sep:"\\"}:{sep:"/"},Wee=N1.sep;$a.sep=Wee;var BA=Symbol("globstar **");$a.GLOBSTAR=BA;var tM={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},F1="[^/]",D1=F1+"*?",Vee="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",zee="(?:(?!(?:\\/|^)\\.).)*?",nM=t=>t.split("").reduce((e,r)=>(e[r]=!0,e),{}),rM=nM("().*{}+?[]^$\\!"),Xee=nM("[.("),Zee=(t,e={})=>r=>$a(r,t,e);$a.filter=Zee;var wu=(t,e={})=>Object.assign({},t,e),ete=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return $a;let e=$a;return Object.assign((i,n,s={})=>e(i,n,wu(t,s)),{Minimatch:class extends e.Minimatch{constructor(n,s={}){super(n,wu(t,s))}static defaults(n){return e.defaults(wu(t,n)).Minimatch}},filter:(i,n={})=>e.filter(i,wu(t,n)),defaults:i=>e.defaults(wu(t,i)),makeRe:(i,n={})=>e.makeRe(i,wu(t,n)),braceExpand:(i,n={})=>e.braceExpand(i,wu(t,n)),match:(i,n,s={})=>e.match(i,n,wu(t,s)),sep:e.sep,GLOBSTAR:BA})};$a.defaults=ete;var sM=(t,e={})=>(Dm(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:(0,iM.default)(t));$a.braceExpand=sM;var tte=1024*64,Dm=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>tte)throw new TypeError("pattern is too long")},R1=Symbol("subparse"),rte=(t,e={})=>new Nh(t,e).makeRe();$a.makeRe=rte;var ite=(t,e,r={})=>{let i=new Nh(e,r);return t=t.filter(n=>i.match(n)),i.options.nonull&&!t.length&&t.push(e),t};$a.match=ite;var nte=t=>t.replace(/\\(.)/g,"$1"),ste=t=>t.replace(/\\([^-\]])/g,"$1"),ate=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Ate=t=>t.replace(/[[\]\\]/g,"\\$&"),Nh=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;regexp;constructor(e,r={}){Dm(e),r=r||{},this.options=r,this.pattern=e,this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!r.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!r.nonegate,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.globSet=[],this.globParts=[],this.set=[],this.make()}debug(...e){}make(){let e=this.pattern,r=this.options;if(!r.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=this.braceExpand(),r.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let i=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.options.noglobstar?i:i.map(s=>s.reduce((a,A)=>((A!=="**"||a[a.length-1]!=="**")&&a.push(A),a),[])),this.debug(this.pattern,this.globParts);let n=this.globParts.map((s,a,A)=>s.map(c=>this.parse(c)));if(this.debug(this.pattern,n),this.set=n.filter(s=>s.indexOf(!1)===-1),Sm)for(let s=0;s<this.set.length;s++){let a=this.set[s];a[0]===""&&a[1]===""&&this.globParts[s][2]==="?"&&typeof a[3]=="string"&&/^[a-z]:$/i.test(a[3])&&(a[2]="?")}this.debug(this.pattern,this.set)}parseNegate(){if(this.nonegate)return;let e=this.pattern,r=!1,i=0;for(let n=0;n<e.length&&e.charAt(n)==="!";n++)r=!r,i++;i&&(this.pattern=e.slice(i)),this.negate=r}matchOne(e,r,i=!1){let n=this.options;if(Sm){let v=e[0]===""&&e[1]===""&&e[2]==="?"&&typeof e[3]=="string"&&/^[a-z]:$/i.test(e[3]),F=r[0]===""&&r[1]===""&&r[2]==="?"&&typeof r[3]=="string"&&/^[a-z]:$/i.test(r[3]);if(v&&F){let q=e[3],P=r[3];q.toLowerCase()===P.toLowerCase()&&(e[3]=P)}else if(F&&typeof e[0]=="string"){let q=r[3],P=e[0];q.toLowerCase()===P.toLowerCase()&&(r[3]=P,r=r.slice(3))}else if(v&&typeof r[0]=="string"){let q=e[3];q.toLowerCase()===r[0].toLowerCase()&&(r[0]=q,e=e.slice(3))}}this.debug("matchOne",this,{file:e,pattern:r}),this.debug("matchOne",e.length,r.length);for(var s=0,a=0,A=e.length,c=r.length;s<A&&a<c;s++,a++){this.debug("matchOne loop");var l=r[a],g=e[s];if(this.debug(r,l,g),l===!1)return!1;if(l===BA){this.debug("GLOBSTAR",[r,l,g]);var C=s,B=a+1;if(B===c){for(this.debug("** at the end");s<A;s++)if(e[s]==="."||e[s]===".."||!n.dot&&e[s].charAt(0)===".")return!1;return!0}for(;C<A;){var I=e[C];if(this.debug(`
|
|
268
268
|
globstar while`,e,C,r,B,I),this.matchOne(e.slice(C),r.slice(B),i))return this.debug("globstar found match!",C,A,I),!0;if(I==="."||I===".."||!n.dot&&I.charAt(0)==="."){this.debug("dot detected!",e,C,r,B);break}this.debug("globstar swallow a segment, and continue"),C++}return!!(i&&(this.debug(`
|
|
269
269
|
>>> no match, partial?`,e,C,r,B),C===A))}let v;if(typeof l=="string"?(v=g===l,this.debug("string match",l,g,v)):(v=l.test(g),this.debug("pattern match",l,g,v)),!v)return!1}if(s===A&&a===c)return!0;if(s===A)return i;if(a===c)return s===A-1&&e[s]==="";throw new Error("wtf?")}braceExpand(){return sM(this.pattern,this.options)}parse(e,r){Dm(e);let i=this.options;if(e==="**")if(i.noglobstar)e="*";else return BA;if(e==="")return"";let n="",s=!1,a=!1,A=[],c=[],l=!1,g=!1,C=-1,B=-1,I,v,F,q=e.charAt(0)===".",P=i.dot||q,M=()=>q?"":P?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",V=D=>D.charAt(0)==="."?"":i.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",ne=()=>{if(l){switch(l){case"*":n+=D1,s=!0;break;case"?":n+=F1,s=!0;break;default:n+="\\"+l;break}this.debug("clearStateChar %j %j",l,n),l=!1}};for(let D=0,Y;D<e.length&&(Y=e.charAt(D));D++){if(this.debug("%s %s %s %j",e,D,n,Y),a){if(Y==="/")return!1;rM[Y]&&(n+="\\"),n+=Y,a=!1;continue}switch(Y){case"/":return!1;case"\\":if(g&&e.charAt(D+1)==="-"){n+=Y;continue}ne(),a=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s %s %s %j <-- stateChar",e,D,n,Y),g){this.debug(" in class"),Y==="!"&&D===B+1&&(Y="^"),n+=Y;continue}this.debug("call clearStateChar %j",l),ne(),l=Y,i.noext&&ne();continue;case"(":{if(g){n+="(";continue}if(!l){n+="\\(";continue}let S={type:l,start:D-1,reStart:n.length,open:tM[l].open,close:tM[l].close};this.debug(this.pattern," ",S),A.push(S),n+=S.open,S.start===0&&S.type!=="!"&&(q=!0,n+=V(e.slice(D+1))),this.debug("plType %j %j",l,n),l=!1;continue}case")":{let S=A[A.length-1];if(g||!S){n+="\\)";continue}A.pop(),ne(),s=!0,v=S,n+=v.close,v.type==="!"&&c.push(Object.assign(v,{reEnd:n.length}));continue}case"|":{let S=A[A.length-1];if(g||!S){n+="\\|";continue}ne(),n+="|",S.start===0&&S.type!=="!"&&(q=!0,n+=V(e.slice(D+1)));continue}case"[":if(ne(),g){n+="\\"+Y;continue}g=!0,B=D,C=n.length,n+=Y;continue;case"]":if(D===B+1||!g){n+="\\"+Y;continue}I=e.substring(B+1,D);try{RegExp("["+Ate(ste(I))+"]"),n+=Y}catch{n=n.substring(0,C)+"(?:$.)"}s=!0,g=!1;continue;default:ne(),rM[Y]&&!(Y==="^"&&g)&&(n+="\\"),n+=Y;break}}for(g&&(I=e.slice(B+1),F=this.parse(I,R1),n=n.substring(0,C)+"\\["+F[0],s=s||F[1]),v=A.pop();v;v=A.pop()){let D;D=n.slice(v.reStart+v.open.length),this.debug(this.pattern,"setting tail",n,v),D=D.replace(/((?:\\{2}){0,64})(\\?)\|/g,(S,X,te)=>(te||(te="\\"),X+X+te+"|")),this.debug(`tail=%j
|
|
270
|
-
%s`,D,D,v,n);let Y=v.type==="*"?D1:v.type==="?"?F1:"\\"+v.type;s=!0,n=n.slice(0,v.reStart)+Y+"\\("+D}ne(),a&&(n+="\\\\");let ie=Xee[n.charAt(0)];for(let D=c.length-1;D>-1;D--){let Y=c[D],S=n.slice(0,Y.reStart),X=n.slice(Y.reStart,Y.reEnd-8),te=n.slice(Y.reEnd),Ce=n.slice(Y.reEnd-8,Y.reEnd)+te,je=S.split(")").length,W=S.split("(").length-je,be=te;for(let Ve=0;Ve<W;Ve++)be=be.replace(/\)[+*?]?/,"");te=be;let Ge=te===""&&r!==R1?"(?:$|\\/)":"";n=S+X+te+Ge+Ce}if(n!==""&&s&&(n="(?=.)"+n),ie&&(n=M()+n),r===R1)return[n,s];if(i.nocase&&!s&&(s=e.toUpperCase()!==e.toLowerCase()),!s)return nte(e);let T=i.nocase?"i":"";try{return Object.assign(new RegExp("^"+n+"$",T),{_glob:e,_src:n})}catch(D){return this.debug("invalid regexp",D),new RegExp("$.")}}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let r=this.options,i=r.noglobstar?D1:r.dot?Vee:zee,n=r.nocase?"i":"",s=e.map(a=>{let A=a.map(c=>typeof c=="string"?ate(c):c===BA?BA:c._src);return A.forEach((c,l)=>{let g=A[l+1],C=A[l-1];c!==BA||C===BA||(C===void 0?g!==void 0&&g!==BA?A[l+1]="(?:\\/|"+i+"\\/)?"+g:A[l]=i:g===void 0?A[l-1]=C+"(?:\\/|"+i+")?":g!==BA&&(A[l-1]=C+"(?:\\/|\\/"+i+"\\/)"+g,A[l+1]=BA))}),A.filter(c=>c!==BA).join("/")}).join("|");s="^(?:"+s+")$",this.negate&&(s="^(?!"+s+").*$");try{this.regexp=new RegExp(s,n)}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):Sm&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,r=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&r)return!0;let i=this.options;N1.sep!=="/"&&(e=e.split(N1.sep).join("/"));let n=this.slashSplit(e);this.debug(this.pattern,"split",n);let s=this.set;this.debug(this.pattern,"set",s);let a=n[n.length-1];if(!a)for(let A=n.length-2;!a&&A>=0;A--)a=n[A];for(let A=0;A<s.length;A++){let c=s[A],l=n;if(i.matchBase&&c.length===1&&(l=[a]),this.matchOne(l,c,r))return i.flipNegate?!0:!this.negate}return i.flipNegate?!1:this.negate}static defaults(e){return $a.defaults(e).Minimatch}};$a.Minimatch=Nh;var Po=require("path");var uM=async()=>{await qA()||await Dh();let{satelliteId:t,source:e=f_,ignore:r=[],headers:i=[]}=await No(),n=(0,Po.join)(process.cwd(),e),s=await fte({sourceAbsolutePath:n,satelliteId:t,ignore:r});if(s.length===0){console.log("No new files to upload.");return}let a=PA(t),A=l=>l.alternateFile??l.file,c=async l=>{let g=A(l);return(0,Rm.uploadBlob)({satellite:a,filename:(0,Po.basename)(g),fullPath:lM({file:g,sourceAbsolutePath:n}),data:new AM.Blob([await(0,k1.readFile)(l.file)]),collection:"#dapp",headers:[...ote({headers:i,file:g}),...l.mime===void 0?[]:[["Content-Type",l.mime]]],encoding:l.encoding})};for(let l=0;l<s.length;l+=20){let g=s.slice(l,l+20);g.forEach(B=>console.log(`\u2197\uFE0F ${(0,Fm.grey)(A(B))}...`));let C=Ec("Uploading...").start();try{let B=g.map(c);await Promise.all(B),C.stop(),g.forEach(I=>console.log(`\u2705 ${(0,Fm.green)(A(I))}.`))}catch(B){throw C.stop(),B}}},ote=({headers:t,file:e})=>t.filter(({source:r})=>T1(e,r)).reduce((r,{headers:i})=>[...r,...i],[]),lM=({file:t,sourceAbsolutePath:e})=>t.replace(e,""),fM=t=>(0,Nm.readdirSync)(t).flatMap(e=>{let r=(0,Po.join)(t,e);return(0,Nm.lstatSync)(r).isDirectory()?fM(r):(0,Po.join)(r)}),cte=async({files:t,sourceAbsolutePath:e,satelliteId:r})=>{let i=await(0,Rm.listAssets)({collection:WE,satellite:PA(r)}),n=t.map(a=>lte({file:a,sourceAbsolutePath:e,existingAssets:i}));return(await Promise.all(n)).filter(({upload:a})=>a).map(({file:a})=>a)},ute=async t=>{let e=await(0,k1.readFile)(t);return oM.default.createHash("sha256").update(e).digest("base64")},lte=async({file:t,existingAssets:e,sourceAbsolutePath:r})=>{let i=t.alternateFile??t.file,n=e.assets.find(({fullPath:a})=>a===lM({file:i,sourceAbsolutePath:r}));if(!n)return{file:t,upload:!0};let s=await ute(i);return{file:t,upload:s!==n.encodings.identity?.sha256}},fte=async({sourceAbsolutePath:t,satelliteId:e,ignore:r})=>{let n=fM(t).filter(l=>r.find(g=>T1(l,g))===void 0),s=({file:l,ext:g})=>{if(g==="Z")return"compress";if(g==="gz")return"gzip";if((0,Po.extname)(l)===".br")return"br";if((0,Po.extname)(l)===".zlib")return"deflate"},a=({file:l,encodingType:g})=>{if(g)return n.find(C=>C===l.replace((0,Po.extname)(l),""))},A=async l=>{let g=await kk(l),C=s({file:l,ext:g?.ext}),B=a({file:l,encodingType:C}),I=cM.default.lookup(B??l);return{file:l,alternateFile:B,mime:I,encoding:C}},c=await Promise.all(n.map(A));return cte({files:c,sourceAbsolutePath:t,satelliteId:e})};var Pn=Lt(Gr());var hM="0.0.
|
|
270
|
+
%s`,D,D,v,n);let Y=v.type==="*"?D1:v.type==="?"?F1:"\\"+v.type;s=!0,n=n.slice(0,v.reStart)+Y+"\\("+D}ne(),a&&(n+="\\\\");let ie=Xee[n.charAt(0)];for(let D=c.length-1;D>-1;D--){let Y=c[D],S=n.slice(0,Y.reStart),X=n.slice(Y.reStart,Y.reEnd-8),te=n.slice(Y.reEnd),Ce=n.slice(Y.reEnd-8,Y.reEnd)+te,je=S.split(")").length,W=S.split("(").length-je,be=te;for(let Ve=0;Ve<W;Ve++)be=be.replace(/\)[+*?]?/,"");te=be;let Ge=te===""&&r!==R1?"(?:$|\\/)":"";n=S+X+te+Ge+Ce}if(n!==""&&s&&(n="(?=.)"+n),ie&&(n=M()+n),r===R1)return[n,s];if(i.nocase&&!s&&(s=e.toUpperCase()!==e.toLowerCase()),!s)return nte(e);let T=i.nocase?"i":"";try{return Object.assign(new RegExp("^"+n+"$",T),{_glob:e,_src:n})}catch(D){return this.debug("invalid regexp",D),new RegExp("$.")}}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let r=this.options,i=r.noglobstar?D1:r.dot?Vee:zee,n=r.nocase?"i":"",s=e.map(a=>{let A=a.map(c=>typeof c=="string"?ate(c):c===BA?BA:c._src);return A.forEach((c,l)=>{let g=A[l+1],C=A[l-1];c!==BA||C===BA||(C===void 0?g!==void 0&&g!==BA?A[l+1]="(?:\\/|"+i+"\\/)?"+g:A[l]=i:g===void 0?A[l-1]=C+"(?:\\/|"+i+")?":g!==BA&&(A[l-1]=C+"(?:\\/|\\/"+i+"\\/)"+g,A[l+1]=BA))}),A.filter(c=>c!==BA).join("/")}).join("|");s="^(?:"+s+")$",this.negate&&(s="^(?!"+s+").*$");try{this.regexp=new RegExp(s,n)}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):Sm&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,r=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&r)return!0;let i=this.options;N1.sep!=="/"&&(e=e.split(N1.sep).join("/"));let n=this.slashSplit(e);this.debug(this.pattern,"split",n);let s=this.set;this.debug(this.pattern,"set",s);let a=n[n.length-1];if(!a)for(let A=n.length-2;!a&&A>=0;A--)a=n[A];for(let A=0;A<s.length;A++){let c=s[A],l=n;if(i.matchBase&&c.length===1&&(l=[a]),this.matchOne(l,c,r))return i.flipNegate?!0:!this.negate}return i.flipNegate?!1:this.negate}static defaults(e){return $a.defaults(e).Minimatch}};$a.Minimatch=Nh;var Po=require("path");var uM=async()=>{await qA()||await Dh();let{satelliteId:t,source:e=f_,ignore:r=[],headers:i=[]}=await No(),n=(0,Po.join)(process.cwd(),e),s=await fte({sourceAbsolutePath:n,satelliteId:t,ignore:r});if(s.length===0){console.log("No new files to upload.");return}let a=PA(t),A=l=>l.alternateFile??l.file,c=async l=>{let g=A(l);return(0,Rm.uploadBlob)({satellite:a,filename:(0,Po.basename)(g),fullPath:lM({file:g,sourceAbsolutePath:n}),data:new AM.Blob([await(0,k1.readFile)(l.file)]),collection:"#dapp",headers:[...ote({headers:i,file:g}),...l.mime===void 0?[]:[["Content-Type",l.mime]]],encoding:l.encoding})};for(let l=0;l<s.length;l+=20){let g=s.slice(l,l+20);g.forEach(B=>console.log(`\u2197\uFE0F ${(0,Fm.grey)(A(B))}...`));let C=Ec("Uploading...").start();try{let B=g.map(c);await Promise.all(B),C.stop(),g.forEach(I=>console.log(`\u2705 ${(0,Fm.green)(A(I))}.`))}catch(B){throw C.stop(),B}}},ote=({headers:t,file:e})=>t.filter(({source:r})=>T1(e,r)).reduce((r,{headers:i})=>[...r,...i],[]),lM=({file:t,sourceAbsolutePath:e})=>t.replace(e,""),fM=t=>(0,Nm.readdirSync)(t).flatMap(e=>{let r=(0,Po.join)(t,e);return(0,Nm.lstatSync)(r).isDirectory()?fM(r):(0,Po.join)(r)}),cte=async({files:t,sourceAbsolutePath:e,satelliteId:r})=>{let i=await(0,Rm.listAssets)({collection:WE,satellite:PA(r)}),n=t.map(a=>lte({file:a,sourceAbsolutePath:e,existingAssets:i}));return(await Promise.all(n)).filter(({upload:a})=>a).map(({file:a})=>a)},ute=async t=>{let e=await(0,k1.readFile)(t);return oM.default.createHash("sha256").update(e).digest("base64")},lte=async({file:t,existingAssets:e,sourceAbsolutePath:r})=>{let i=t.alternateFile??t.file,n=e.assets.find(({fullPath:a})=>a===lM({file:i,sourceAbsolutePath:r}));if(!n)return{file:t,upload:!0};let s=await ute(i);return{file:t,upload:s!==n.encodings.identity?.sha256}},fte=async({sourceAbsolutePath:t,satelliteId:e,ignore:r})=>{let n=fM(t).filter(l=>r.find(g=>T1(l,g))===void 0),s=({file:l,ext:g})=>{if(g==="Z")return"compress";if(g==="gz")return"gzip";if((0,Po.extname)(l)===".br")return"br";if((0,Po.extname)(l)===".zlib")return"deflate"},a=({file:l,encodingType:g})=>{if(g)return n.find(C=>C===l.replace((0,Po.extname)(l),""))},A=async l=>{let g=await kk(l),C=s({file:l,ext:g?.ext}),B=a({file:l,encodingType:C}),I=cM.default.lookup(B??l);return{file:l,alternateFile:B,mime:typeof I=="string"?I:void 0,encoding:C}},c=await Promise.all(n.map(A));return cte({files:c,sourceAbsolutePath:t,satelliteId:e})};var Pn=Lt(Gr());var hM="0.0.9";var gte=` __ __ __ __ _ ____
|
|
271
271
|
__) || | || \\| |/ \\
|
|
272
272
|
\\___/ \\___/ |_|\\__|\\____/`,M1=`${gte} CLI ${(0,Pn.grey)(`v${hM}`)}`,gM=`
|
|
273
273
|
${M1}
|