@easbot/utils 0.2.6 → 0.2.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/LICENSE +21 -21
- package/dist/chunks/{chunk-5WE7YHVK.mjs → chunk-K627C4PG.mjs} +1 -1
- package/dist/chunks/{chunk-ZOB2VAGM.cjs → chunk-KVF2G3UO.cjs} +2 -2
- package/dist/chunks/log-RRRQ3MA4.mjs +1 -0
- package/dist/chunks/log-T263VNOE.cjs +1 -0
- package/dist/chunks/{main-5MBAAGCL.cjs → main-JZ7RERNZ.cjs} +4 -4
- package/dist/chunks/{main-NR2RC5BC.mjs → main-LS64TONI.mjs} +2 -2
- package/dist/index.cjs +13 -13
- package/dist/index.mjs +3 -3
- package/package.json +6 -6
- package/dist/chunks/log-XEHFP6P2.cjs +0 -1
- package/dist/chunks/log-XZMXOVEC.mjs +0 -1
- /package/dist/chunks/{chunk-JFAKFWSO.cjs → chunk-4WYZIKXQ.cjs} +0 -0
- /package/dist/chunks/{chunk-SOVDCHON.mjs → chunk-PKFYT2QD.mjs} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{c as Log}from'./chunk-K627C4PG.mjs';import'./chunk-PKFYT2QD.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkKVF2G3UO_cjs=require('./chunk-KVF2G3UO.cjs');require('./chunk-4WYZIKXQ.cjs');Object.defineProperty(exports,"Log",{enumerable:true,get:function(){return chunkKVF2G3UO_cjs.c}});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunk4WYZIKXQ_cjs=require('./chunk-4WYZIKXQ.cjs');var fr=chunk4WYZIKXQ_cjs.b((hr,gt)=>{chunk4WYZIKXQ_cjs.j();var qe=Object.defineProperty,vt=Object.getOwnPropertyDescriptor,xt=Object.getOwnPropertyNames,kt=Object.prototype.hasOwnProperty,$t=(e,t)=>{for(var r in t)qe(e,r,{get:t[r],enumerable:true});},St=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of xt(t))!kt.call(e,o)&&o!==r&&qe(e,o,{get:()=>t[o],enumerable:!(n=vt(t,o))||n.enumerable});return e},Et=e=>St(qe({},"__esModule",{value:true}),e),Pe={};$t(Pe,{analyzeMetafile:()=>rr,analyzeMetafileSync:()=>ar,build:()=>Xt,buildSync:()=>nr,context:()=>Zt,default:()=>cr,formatMessages:()=>tr,formatMessagesSync:()=>lr,initialize:()=>sr,stop:()=>or,transform:()=>er,transformSync:()=>ir,version:()=>Gt});gt.exports=Et(Pe);function Ve(e){let t=n=>{if(n===null)r.write8(0);else if(typeof n=="boolean")r.write8(1),r.write8(+n);else if(typeof n=="number")r.write8(2),r.write32(n|0);else if(typeof n=="string")r.write8(3),r.write(ie(n));else if(n instanceof Uint8Array)r.write8(4),r.write(n);else if(n instanceof Array){r.write8(5),r.write32(n.length);for(let o of n)t(o);}else {let o=Object.keys(n);r.write8(6),r.write32(o.length);for(let s of o)r.write(ie(s)),t(n[s]);}},r=new rt;return r.write32(0),r.write32(e.id<<1|+!e.isRequest),t(e.value),Ue(r.buf,r.len-4,0),r.buf.subarray(0,r.len)}function At(e){let t=()=>{switch(r.read8()){case 0:return null;case 1:return !!r.read8();case 2:return r.read32();case 3:return we(r.read());case 4:return r.read();case 5:{let a=r.read32(),d=[];for(let i=0;i<a;i++)d.push(t());return d}case 6:{let a=r.read32(),d={};for(let i=0;i<a;i++)d[we(r.read())]=t();return d}default:throw new Error("Invalid packet")}},r=new rt(e),n=r.read32(),o=(n&1)===0;n>>>=1;let s=t();if(r.ptr!==e.length)throw new Error("Invalid packet");return {id:n,isRequest:o,value:s}}var rt=class{constructor(e=new Uint8Array(1024)){this.buf=e,this.len=0,this.ptr=0;}_write(e){if(this.len+e>this.buf.length){let t=new Uint8Array((this.len+e)*2);t.set(this.buf),this.buf=t;}return this.len+=e,this.len-e}write8(e){let t=this._write(1);this.buf[t]=e;}write32(e){let t=this._write(4);Ue(this.buf,e,t);}write(e){let t=this._write(4+e.length);Ue(this.buf,e.length,t),this.buf.set(e,t+4);}_read(e){if(this.ptr+e>this.buf.length)throw new Error("Invalid packet");return this.ptr+=e,this.ptr-e}read8(){return this.buf[this._read(1)]}read32(){return nt(this.buf,this._read(4))}read(){let e=this.read32(),t=new Uint8Array(e),r=this._read(t.length);return t.set(this.buf.subarray(r,r+e)),t}},ie,we,Re;if(typeof TextEncoder<"u"&&typeof TextDecoder<"u"){let e=new TextEncoder,t=new TextDecoder;ie=r=>e.encode(r),we=r=>t.decode(r),Re='new TextEncoder().encode("")';}else if(typeof Buffer<"u")ie=e=>Buffer.from(e),we=e=>{let{buffer:t,byteOffset:r,byteLength:n}=e;return Buffer.from(t,r,n).toString()},Re='Buffer.from("")';else throw new Error("No UTF-8 codec found");if(!(ie("")instanceof Uint8Array))throw new Error(`Invariant violation: "${Re} instanceof Uint8Array" is incorrectly false
|
|
2
2
|
|
|
3
3
|
This indicates that your JavaScript environment is broken. You cannot use
|
|
4
4
|
esbuild in this environment because esbuild relies on this invariant. This
|
|
@@ -11,7 +11,7 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
11
11
|
`),suggestion:""}}break}}return null}function Ee(e,t,r){let n=5;e+=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,n+1).map((s,a)=>{if(a===n)return `
|
|
12
12
|
...`;if(!s.location)return `
|
|
13
13
|
error: ${s.text}`;let{file:d,line:i,column:c}=s.location,u=s.pluginName?`[plugin: ${s.pluginName}] `:"";return `
|
|
14
|
-
${d}:${i}:${c}: ERROR: ${u}${s.text}`}).join("");let o=new Error(e);for(let[s,a]of [["errors",t],["warnings",r]])Object.defineProperty(o,s,{configurable:true,enumerable:true,get:()=>a,set:d=>Object.defineProperty(o,s,{configurable:true,enumerable:true,value:d})});return o}function ke(e,t){for(let r of e)r.detail=t.load(r.detail);return e}function Qe(e,t,r){if(e==null)return null;let n={},o=l(e,n,"file",b),s=l(e,n,"namespace",b),a=l(e,n,"line",me),d=l(e,n,"column",me),i=l(e,n,"length",me),c=l(e,n,"lineText",b),u=l(e,n,"suggestion",b);if(J(e,n,t),c){let y=c.slice(0,(d&&d>0?d:0)+(i&&i>0?i:0)+(r&&r>0?r:80));!/[\x7F-\uFFFF]/.test(y)&&!/\n/.test(c)&&(c=y);}return {file:o||"",namespace:s||"",line:a||0,column:d||0,length:i||0,lineText:c||"",suggestion:u||""}}function fe(e,t,r,n,o){let s=[],a=0;for(let d of e){let i={},c=l(d,i,"id",b),u=l(d,i,"pluginName",b),y=l(d,i,"text",b),B=l(d,i,"location",Ke),_=l(d,i,"notes",ce),N=l(d,i,"detail",Me),I=`in element ${a} of "${t}"`;J(d,i,I);let L=[];if(_)for(let W of _){let z={},k=l(W,z,"text",b),w=l(W,z,"location",Ke);J(W,z,I),L.push({text:k||"",location:Qe(w,I,o)});}s.push({id:c||"",pluginName:u||n,text:y||"",location:Qe(B,I,o),notes:L,detail:r?r.store(N):-1}),a++;}return s}function Ce(e,t){let r=[];for(let n of e){if(typeof n!="string")throw new Error(`${V(t)} must be an array of strings`);r.push(n);}return r}function Nt(e,t){let r=Object.create(null);for(let n in e){let o=e[n];if(typeof o!="string")throw new Error(`key ${V(n)} in object ${V(t)} must be a string`);r[n]=o;}return r}function It({path:e,contents:t,hash:r}){let n=null;return {path:e,contents:t,hash:r,get text(){let o=this.contents;return (n===null||o!==t)&&(t=o,n=we(o)),n}}}function Le(e){let t=e.source;return e.flags&&(t=`(?${e.flags})${t}`),t}function Rt(e){let t;try{t=we(e);}catch{return Pt(e)}return JSON.parse(t)}var de=
|
|
14
|
+
${d}:${i}:${c}: ERROR: ${u}${s.text}`}).join("");let o=new Error(e);for(let[s,a]of [["errors",t],["warnings",r]])Object.defineProperty(o,s,{configurable:true,enumerable:true,get:()=>a,set:d=>Object.defineProperty(o,s,{configurable:true,enumerable:true,value:d})});return o}function ke(e,t){for(let r of e)r.detail=t.load(r.detail);return e}function Qe(e,t,r){if(e==null)return null;let n={},o=l(e,n,"file",b),s=l(e,n,"namespace",b),a=l(e,n,"line",me),d=l(e,n,"column",me),i=l(e,n,"length",me),c=l(e,n,"lineText",b),u=l(e,n,"suggestion",b);if(J(e,n,t),c){let y=c.slice(0,(d&&d>0?d:0)+(i&&i>0?i:0)+(r&&r>0?r:80));!/[\x7F-\uFFFF]/.test(y)&&!/\n/.test(c)&&(c=y);}return {file:o||"",namespace:s||"",line:a||0,column:d||0,length:i||0,lineText:c||"",suggestion:u||""}}function fe(e,t,r,n,o){let s=[],a=0;for(let d of e){let i={},c=l(d,i,"id",b),u=l(d,i,"pluginName",b),y=l(d,i,"text",b),B=l(d,i,"location",Ke),_=l(d,i,"notes",ce),N=l(d,i,"detail",Me),I=`in element ${a} of "${t}"`;J(d,i,I);let L=[];if(_)for(let W of _){let z={},k=l(W,z,"text",b),w=l(W,z,"location",Ke);J(W,z,I),L.push({text:k||"",location:Qe(w,I,o)});}s.push({id:c||"",pluginName:u||n,text:y||"",location:Qe(B,I,o),notes:L,detail:r?r.store(N):-1}),a++;}return s}function Ce(e,t){let r=[];for(let n of e){if(typeof n!="string")throw new Error(`${V(t)} must be an array of strings`);r.push(n);}return r}function Nt(e,t){let r=Object.create(null);for(let n in e){let o=e[n];if(typeof o!="string")throw new Error(`key ${V(n)} in object ${V(t)} must be a string`);r[n]=o;}return r}function It({path:e,contents:t,hash:r}){let n=null;return {path:e,contents:t,hash:r,get text(){let o=this.contents;return (n===null||o!==t)&&(t=o,n=we(o)),n}}}function Le(e){let t=e.source;return e.flags&&(t=`(?${e.flags})${t}`),t}function Rt(e){let t;try{t=we(e);}catch{return Pt(e)}return JSON.parse(t)}var de=chunk4WYZIKXQ_cjs.a("fs"),Ge=chunk4WYZIKXQ_cjs.a("os"),ne=chunk4WYZIKXQ_cjs.a("path"),ve=process.env.ESBUILD_BINARY_PATH||ve,Ut=e=>!!e&&e!=="/usr/bin/esbuild",Xe="@esbuild/darwin-arm64",Ze="@esbuild/darwin-x64",Te={"win32 arm64 LE":"@esbuild/win32-arm64","win32 ia32 LE":"@esbuild/win32-ia32","win32 x64 LE":"@esbuild/win32-x64"},Fe={"aix ppc64 BE":"@esbuild/aix-ppc64","android arm64 LE":"@esbuild/android-arm64","darwin arm64 LE":"@esbuild/darwin-arm64","darwin x64 LE":"@esbuild/darwin-x64","freebsd arm64 LE":"@esbuild/freebsd-arm64","freebsd x64 LE":"@esbuild/freebsd-x64","linux arm LE":"@esbuild/linux-arm","linux arm64 LE":"@esbuild/linux-arm64","linux ia32 LE":"@esbuild/linux-ia32","linux mips64el LE":"@esbuild/linux-mips64el","linux ppc64 LE":"@esbuild/linux-ppc64","linux riscv64 LE":"@esbuild/linux-riscv64","linux s390x BE":"@esbuild/linux-s390x","linux x64 LE":"@esbuild/linux-x64","linux loong64 LE":"@esbuild/linux-loong64","netbsd arm64 LE":"@esbuild/netbsd-arm64","netbsd x64 LE":"@esbuild/netbsd-x64","openbsd arm64 LE":"@esbuild/openbsd-arm64","openbsd x64 LE":"@esbuild/openbsd-x64","sunos x64 LE":"@esbuild/sunos-x64"},et={"android arm LE":"@esbuild/android-arm","android x64 LE":"@esbuild/android-x64","openharmony arm64 LE":"@esbuild/openharmony-arm64"};function Wt(){let e,t,r=false,n=`${process.platform} ${Ge.arch()} ${Ge.endianness()}`;if(n in Te)e=Te[n],t="esbuild.exe";else if(n in Fe)e=Fe[n],t="bin/esbuild";else if(n in et)e=et[n],t="bin/esbuild",r=true;else throw new Error(`Unsupported platform: ${n}`);return {pkg:e,subpath:t,isWASM:r}}function zt(){let e=chunk4WYZIKXQ_cjs.a.resolve("esbuild"),t=ne.dirname(ne.dirname(ne.dirname(e)));if(ne.basename(t)==="node_modules"){for(let r in Fe)try{let n=Fe[r];if(de.existsSync(ne.join(t,n)))return n}catch{}for(let r in Te)try{let n=Te[r];if(de.existsSync(ne.join(t,n)))return n}catch{}}return null}function qt(e,t){let r=ne.dirname(chunk4WYZIKXQ_cjs.a.resolve("esbuild"));return ne.join(r,`downloaded-${e.replace("/","-")}-${ne.basename(t)}`)}function Jt(){if(Ut(ve))if(!de.existsSync(ve))console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${ve}`);else return {binPath:ve,isWASM:false};let{pkg:e,subpath:t,isWASM:r}=Wt(),n;try{n=chunk4WYZIKXQ_cjs.a.resolve(`${e}/${t}`);}catch(o){if(n=qt(e,t),!de.existsSync(n)){try{chunk4WYZIKXQ_cjs.a.resolve(e);}catch{let s=zt();if(s){let a=`
|
|
15
15
|
Specifically the "${s}" package is present but this platform
|
|
16
16
|
needs the "${e}" package instead. People often get into this
|
|
17
17
|
situation by installing esbuild on Windows or macOS and copying "node_modules"
|
|
@@ -60,7 +60,7 @@ want to do that.
|
|
|
60
60
|
If you are installing esbuild with npm, make sure that you don't specify the
|
|
61
61
|
"--no-optional" or "--omit=optional" flags. The "optionalDependencies" feature
|
|
62
62
|
of "package.json" is used by esbuild to install the correct binary executable
|
|
63
|
-
for your current platform.`)}throw o}}if(/\.zip\//.test(n)){let o;try{o=
|
|
63
|
+
for your current platform.`)}throw o}}if(/\.zip\//.test(n)){let o;try{o=chunk4WYZIKXQ_cjs.a("pnpapi");}catch{}if(o){let s=o.getPackageInformation(o.topLevel).packageLocation,a=ne.join(s,"node_modules",".cache","esbuild",`pnpapi-${e.replace("/","-")}-0.28.0-${ne.basename(t)}`);return de.existsSync(a)||(de.mkdirSync(ne.dirname(a),{recursive:true}),de.copyFileSync(n,a),de.chmodSync(a,493)),{binPath:a,isWASM:r}}}return {binPath:n,isWASM:r}}var ht=chunk4WYZIKXQ_cjs.a("child_process"),Vt=chunk4WYZIKXQ_cjs.a("crypto"),We=chunk4WYZIKXQ_cjs.a("path"),pe=chunk4WYZIKXQ_cjs.a("fs"),Yt=chunk4WYZIKXQ_cjs.a("os"),Ht=chunk4WYZIKXQ_cjs.a("tty"),H;if(process.env.ESBUILD_WORKER_THREADS!=="0"){try{H=chunk4WYZIKXQ_cjs.a("worker_threads");}catch{}let[e,t]=process.versions.node.split(".");(+e<12||+e==12&&+t<17||+e==13&&+t<13)&&(H=void 0);}var tt,Oe=((tt=H?.workerData)==null?void 0:tt.esbuildVersion)==="0.28.0",mt=()=>{if(!ve&&(We.basename(__filename)!=="main.js"||We.basename(__dirname)!=="lib"))throw new Error(`The esbuild JavaScript API cannot be bundled. Please mark the "esbuild" package as external so it's not included in the bundle.
|
|
64
64
|
|
|
65
65
|
More information: The file containing the code for esbuild's JavaScript API (${__filename}) does not appear to be inside the esbuild package on the file system, which usually means that the esbuild package was bundled into another file. This is problematic because the API needs to run a binary executable inside the esbuild package which is located using a relative path from the API code to the executable. If the esbuild package is bundled, the relative path will be incorrect and the executable won't be found.`);{let{binPath:e,isWASM:t}=Jt();return t?["node",[e]]:[e,[]]}},Ae=()=>Ht.isatty(2),Kt={readFile(e,t){try{let r=pe.readFileSync(e,"utf8");try{pe.unlinkSync(e);}catch{}t(null,r);}catch(r){t(r,null);}},writeFile(e,t){try{let r=pt();pe.writeFileSync(r,e),t(r);}catch{t(null);}}},Qt={readFile(e,t){try{pe.readFile(e,"utf8",(r,n)=>{try{pe.unlink(e,()=>t(r,n));}catch{t(r,n);}});}catch(r){t(r,null);}},writeFile(e,t){try{let r=pt();pe.writeFile(r,e,n=>t(n!==null?null:r));}catch{t(null);}}},Gt="0.28.0",Xt=e=>ye().build(e),Zt=e=>ye().context(e),er=(e,t)=>ye().transform(e,t),tr=(e,t)=>ye().formatMessages(e,t),rr=(e,t)=>ye().analyzeMetafile(e,t),nr=e=>{if(H&&!Oe)return K||(K=Ie(H)),K.buildSync(e);let t;return Ne(r=>r.buildOrContext({callName:"buildSync",refs:null,options:e,isTTY:Ae(),defaultWD:ge,callback:(n,o)=>{if(n)throw n;t=o;}})),t},ir=(e,t)=>{if(H&&!Oe)return K||(K=Ie(H)),K.transformSync(e,t);let r;return Ne(n=>n.transform({callName:"transformSync",refs:null,input:e,options:t||{},isTTY:Ae(),fs:Kt,callback:(o,s)=>{if(o)throw o;r=s;}})),r},lr=(e,t)=>{if(H&&!Oe)return K||(K=Ie(H)),K.formatMessagesSync(e,t);let r;return Ne(n=>n.formatMessages({callName:"formatMessagesSync",refs:null,messages:e,options:t,callback:(o,s)=>{if(o)throw o;r=s;}})),r},ar=(e,t)=>{if(H&&!Oe)return K||(K=Ie(H)),K.analyzeMetafileSync(e,t);let r;return Ne(n=>n.analyzeMetafile({callName:"analyzeMetafileSync",refs:null,metafile:typeof e=="string"?e:JSON.stringify(e),options:t,callback:(o,s)=>{if(o)throw o;r=s;}})),r},or=()=>(_e&&_e(),K&&K.stop(),Promise.resolve()),ze=false,sr=e=>{if(e=Lt(e||{}),e.wasmURL)throw new Error('The "wasmURL" option only works in the browser');if(e.wasmModule)throw new Error('The "wasmModule" option only works in the browser');if(e.worker)throw new Error('The "worker" option only works in the browser');if(ze)throw new Error('Cannot call "initialize" more than once');return ye(),ze=true,Promise.resolve()},ge=process.cwd(),Se,_e,ye=()=>{if(Se)return Se;let[e,t]=mt(),r=ht.spawn(e,t.concat("--service=0.28.0","--ping"),{windowsHide:true,stdio:["pipe","pipe","inherit"],cwd:ge}),{readFromStdout:n,afterClose:o,service:s}=ct({writeToStdin(u){r.stdin.write(u,y=>{y&&o(y);});},readFileSync:pe.readFileSync,isSync:false,hasFS:true,esbuild:Pe});r.stdin.on("error",o),r.on("error",o);let a=r.stdin,d=r.stdout;d.on("data",n),d.on("end",o),_e=()=>{a.destroy(),d.destroy(),r.kill(),ze=false,Se=void 0,_e=void 0;};let i=0;r.unref(),a.unref&&a.unref(),d.unref&&d.unref();let c={ref(){++i===1&&r.ref();},unref(){--i===0&&r.unref();}};return Se={build:u=>new Promise((y,B)=>{s.buildOrContext({callName:"build",refs:c,options:u,isTTY:Ae(),defaultWD:ge,callback:(_,N)=>_?B(_):y(N)});}),context:u=>new Promise((y,B)=>s.buildOrContext({callName:"context",refs:c,options:u,isTTY:Ae(),defaultWD:ge,callback:(_,N)=>_?B(_):y(N)})),transform:(u,y)=>new Promise((B,_)=>s.transform({callName:"transform",refs:c,input:u,options:y||{},isTTY:Ae(),fs:Qt,callback:(N,I)=>N?_(N):B(I)})),formatMessages:(u,y)=>new Promise((B,_)=>s.formatMessages({callName:"formatMessages",refs:c,messages:u,options:y,callback:(N,I)=>N?_(N):B(I)})),analyzeMetafile:(u,y)=>new Promise((B,_)=>s.analyzeMetafile({callName:"analyzeMetafile",refs:c,metafile:typeof u=="string"?u:JSON.stringify(u),options:y,callback:(N,I)=>N?_(N):B(I)}))},Se},Ne=e=>{let[t,r]=mt(),n=new Uint8Array,{readFromStdout:o,afterClose:s,service:a}=ct({writeToStdin(i){if(n.length!==0)throw new Error("Must run at most one command");n=i;},isSync:true,hasFS:true,esbuild:Pe});e(a);let d=ht.execFileSync(t,r.concat("--service=0.28.0"),{cwd:ge,windowsHide:true,input:n,maxBuffer:+process.env.ESBUILD_MAX_BUFFER||16*1024*1024});o(d),s(null);},pt=()=>We.join(Yt.tmpdir(),`esbuild-${Vt.randomBytes(32).toString("hex")}`),K=null,Ie=e=>{let{port1:t,port2:r}=new e.MessageChannel,n=new e.Worker(__filename,{workerData:{workerPort:r,defaultWD:ge,esbuildVersion:"0.28.0"},transferList:[r],execArgv:[]}),o=0,s=c=>{let u=new Error(`Build failed with 1 error:
|
|
66
|
-
error: ${c}`),y=[{id:"",pluginName:"",text:c,location:null,notes:[],detail:void 0}];return u.errors=y,u.warnings=[],u},a=c=>{if(!c)return;let u=c.plugins;if(u&&u.length>0)throw s("Cannot use plugins in synchronous API calls")},d=(c,u)=>{for(let y in u)c[y]=u[y];},i=(c,u)=>{let y=o++,B=new SharedArrayBuffer(8),_=new Int32Array(B),N={sharedBuffer:B,id:y,command:c,args:u};n.postMessage(N);let I=Atomics.wait(_,0,0);if(I!=="ok"&&I!=="not-equal")throw new Error("Internal error: Atomics.wait() failed: "+I);let{message:{id:L,resolve:W,reject:z,properties:k}}=e.receiveMessageOnPort(t);if(y!==L)throw new Error(`Internal error: Expected id ${y} but got id ${L}`);if(z)throw d(z,k),z;return W};return n.unref(),{buildSync(c){return a(c),i("build",[c])},transformSync(c,u){return i("transform",[c,u])},formatMessagesSync(c,u){return i("formatMessages",[c,u])},analyzeMetafileSync(c,u){return i("analyzeMetafile",[c,u])},stop(){n.terminate(),K=null;}}},ur=()=>{let e=H.workerData.workerPort,t=H.parentPort,r=n=>{let o={};if(n&&typeof n=="object")for(let s in n)o[s]=n[s];return o};try{let n=ye();ge=H.workerData.defaultWD,t.on("message",o=>{(async()=>{let{sharedBuffer:s,id:a,command:d,args:i}=o,c=new Int32Array(s);try{switch(d){case "build":e.postMessage({id:a,resolve:await n.build(i[0])});break;case "transform":e.postMessage({id:a,resolve:await n.transform(i[0],i[1])});break;case "formatMessages":e.postMessage({id:a,resolve:await n.formatMessages(i[0],i[1])});break;case "analyzeMetafile":e.postMessage({id:a,resolve:await n.analyzeMetafile(i[0],i[1])});break;default:throw new Error(`Invalid command: ${d}`)}}catch(u){e.postMessage({id:a,reject:u,properties:r(u)});}Atomics.add(c,0,1),Atomics.notify(c,0,1/0);})();});}catch(n){t.on("message",o=>{let{sharedBuffer:s,id:a}=o,d=new Int32Array(s);e.postMessage({id:a,reject:n,properties:r(n)}),Atomics.add(d,0,1),Atomics.notify(d,0,1/0);});}};Oe&&ur();var cr=Pe;});var
|
|
66
|
+
error: ${c}`),y=[{id:"",pluginName:"",text:c,location:null,notes:[],detail:void 0}];return u.errors=y,u.warnings=[],u},a=c=>{if(!c)return;let u=c.plugins;if(u&&u.length>0)throw s("Cannot use plugins in synchronous API calls")},d=(c,u)=>{for(let y in u)c[y]=u[y];},i=(c,u)=>{let y=o++,B=new SharedArrayBuffer(8),_=new Int32Array(B),N={sharedBuffer:B,id:y,command:c,args:u};n.postMessage(N);let I=Atomics.wait(_,0,0);if(I!=="ok"&&I!=="not-equal")throw new Error("Internal error: Atomics.wait() failed: "+I);let{message:{id:L,resolve:W,reject:z,properties:k}}=e.receiveMessageOnPort(t);if(y!==L)throw new Error(`Internal error: Expected id ${y} but got id ${L}`);if(z)throw d(z,k),z;return W};return n.unref(),{buildSync(c){return a(c),i("build",[c])},transformSync(c,u){return i("transform",[c,u])},formatMessagesSync(c,u){return i("formatMessages",[c,u])},analyzeMetafileSync(c,u){return i("analyzeMetafile",[c,u])},stop(){n.terminate(),K=null;}}},ur=()=>{let e=H.workerData.workerPort,t=H.parentPort,r=n=>{let o={};if(n&&typeof n=="object")for(let s in n)o[s]=n[s];return o};try{let n=ye();ge=H.workerData.defaultWD,t.on("message",o=>{(async()=>{let{sharedBuffer:s,id:a,command:d,args:i}=o,c=new Int32Array(s);try{switch(d){case "build":e.postMessage({id:a,resolve:await n.build(i[0])});break;case "transform":e.postMessage({id:a,resolve:await n.transform(i[0],i[1])});break;case "formatMessages":e.postMessage({id:a,resolve:await n.formatMessages(i[0],i[1])});break;case "analyzeMetafile":e.postMessage({id:a,resolve:await n.analyzeMetafile(i[0],i[1])});break;default:throw new Error(`Invalid command: ${d}`)}}catch(u){e.postMessage({id:a,reject:u,properties:r(u)});}Atomics.add(c,0,1),Atomics.notify(c,0,1/0);})();});}catch(n){t.on("message",o=>{let{sharedBuffer:s,id:a}=o,d=new Int32Array(s);e.postMessage({id:a,reject:n,properties:r(n)}),Atomics.add(d,0,1),Atomics.notify(d,0,1/0);});}};Oe&&ur();var cr=Pe;});var mainJZ7RERNZ = fr();module.exports=mainJZ7RERNZ;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {b,k,a,j,i}from'./chunk-
|
|
1
|
+
import {b,k,a,j,i}from'./chunk-PKFYT2QD.mjs';var hr=b((mr,yt)=>{k();var Je=Object.defineProperty,kt=Object.getOwnPropertyDescriptor,$t=Object.getOwnPropertyNames,St=Object.prototype.hasOwnProperty,Et=(e,t)=>{for(var r in t)Je(e,r,{get:t[r],enumerable:true});},At=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of $t(t))!St.call(e,o)&&o!==r&&Je(e,o,{get:()=>t[o],enumerable:!(n=kt(t,o))||n.enumerable});return e},Pt=e=>At(Je({},"__esModule",{value:true}),e),Pe={};Et(Pe,{analyzeMetafile:()=>ir,analyzeMetafileSync:()=>sr,build:()=>er,buildSync:()=>lr,context:()=>tr,default:()=>dr,formatMessages:()=>nr,formatMessagesSync:()=>or,initialize:()=>cr,stop:()=>ur,transform:()=>rr,transformSync:()=>ar,version:()=>Zt});yt.exports=Pt(Pe);function He(e){let t=n=>{if(n===null)r.write8(0);else if(typeof n=="boolean")r.write8(1),r.write8(+n);else if(typeof n=="number")r.write8(2),r.write32(n|0);else if(typeof n=="string")r.write8(3),r.write(ie(n));else if(n instanceof Uint8Array)r.write8(4),r.write(n);else if(n instanceof Array){r.write8(5),r.write32(n.length);for(let o of n)t(o);}else {let o=Object.keys(n);r.write8(6),r.write32(o.length);for(let s of o)r.write(ie(s)),t(n[s]);}},r=new it;return r.write32(0),r.write32(e.id<<1|+!e.isRequest),t(e.value),We(r.buf,r.len-4,0),r.buf.subarray(0,r.len)}function Ot(e){let t=()=>{switch(r.read8()){case 0:return null;case 1:return !!r.read8();case 2:return r.read32();case 3:return we(r.read());case 4:return r.read();case 5:{let a=r.read32(),d=[];for(let i=0;i<a;i++)d.push(t());return d}case 6:{let a=r.read32(),d={};for(let i=0;i<a;i++)d[we(r.read())]=t();return d}default:throw new Error("Invalid packet")}},r=new it(e),n=r.read32(),o=(n&1)===0;n>>>=1;let s=t();if(r.ptr!==e.length)throw new Error("Invalid packet");return {id:n,isRequest:o,value:s}}var it=class{constructor(e=new Uint8Array(1024)){this.buf=e,this.len=0,this.ptr=0;}_write(e){if(this.len+e>this.buf.length){let t=new Uint8Array((this.len+e)*2);t.set(this.buf),this.buf=t;}return this.len+=e,this.len-e}write8(e){let t=this._write(1);this.buf[t]=e;}write32(e){let t=this._write(4);We(this.buf,e,t);}write(e){let t=this._write(4+e.length);We(this.buf,e.length,t),this.buf.set(e,t+4);}_read(e){if(this.ptr+e>this.buf.length)throw new Error("Invalid packet");return this.ptr+=e,this.ptr-e}read8(){return this.buf[this._read(1)]}read32(){return lt(this.buf,this._read(4))}read(){let e=this.read32(),t=new Uint8Array(e),r=this._read(t.length);return t.set(this.buf.subarray(r,r+e)),t}},ie,we,Ue;if(typeof TextEncoder<"u"&&typeof TextDecoder<"u"){let e=new TextEncoder,t=new TextDecoder;ie=r=>e.encode(r),we=r=>t.decode(r),Ue='new TextEncoder().encode("")';}else if(typeof Buffer<"u")ie=e=>Buffer.from(e),we=e=>{let{buffer:t,byteOffset:r,byteLength:n}=e;return Buffer.from(t,r,n).toString()},Ue='Buffer.from("")';else throw new Error("No UTF-8 codec found");if(!(ie("")instanceof Uint8Array))throw new Error(`Invariant violation: "${Ue} instanceof Uint8Array" is incorrectly false
|
|
2
2
|
|
|
3
3
|
This indicates that your JavaScript environment is broken. You cannot use
|
|
4
4
|
esbuild in this environment because esbuild relies on this invariant. This
|
|
@@ -63,4 +63,4 @@ of "package.json" is used by esbuild to install the correct binary executable
|
|
|
63
63
|
for your current platform.`)}throw o}}if(/\.zip\//.test(n)){let o;try{o=a("pnpapi");}catch{}if(o){let s=o.getPackageInformation(o.topLevel).packageLocation,a=ne.join(s,"node_modules",".cache","esbuild",`pnpapi-${e.replace("/","-")}-0.28.0-${ne.basename(t)}`);return de.existsSync(a)||(de.mkdirSync(ne.dirname(a),{recursive:true}),de.copyFileSync(n,a),de.chmodSync(a,493)),{binPath:a,isWASM:r}}}return {binPath:n,isWASM:r}}var pt=a("child_process"),Ht=a("crypto"),ze=a("path"),pe=a("fs"),Kt=a("os"),Qt=a("tty"),H;if(process.env.ESBUILD_WORKER_THREADS!=="0"){try{H=a("worker_threads");}catch{}let[e,t]=process.versions.node.split(".");(+e<12||+e==12&&+t<17||+e==13&&+t<13)&&(H=void 0);}var nt,Oe=((nt=H?.workerData)==null?void 0:nt.esbuildVersion)==="0.28.0",gt=()=>{if(!ve&&(ze.basename(j)!=="main.js"||ze.basename(i)!=="lib"))throw new Error(`The esbuild JavaScript API cannot be bundled. Please mark the "esbuild" package as external so it's not included in the bundle.
|
|
64
64
|
|
|
65
65
|
More information: The file containing the code for esbuild's JavaScript API (${j}) does not appear to be inside the esbuild package on the file system, which usually means that the esbuild package was bundled into another file. This is problematic because the API needs to run a binary executable inside the esbuild package which is located using a relative path from the API code to the executable. If the esbuild package is bundled, the relative path will be incorrect and the executable won't be found.`);{let{binPath:e,isWASM:t}=Yt();return t?["node",[e]]:[e,[]]}},Ae=()=>Qt.isatty(2),Gt={readFile(e,t){try{let r=pe.readFileSync(e,"utf8");try{pe.unlinkSync(e);}catch{}t(null,r);}catch(r){t(r,null);}},writeFile(e,t){try{let r=wt();pe.writeFileSync(r,e),t(r);}catch{t(null);}}},Xt={readFile(e,t){try{pe.readFile(e,"utf8",(r,n)=>{try{pe.unlink(e,()=>t(r,n));}catch{t(r,n);}});}catch(r){t(r,null);}},writeFile(e,t){try{let r=wt();pe.writeFile(r,e,n=>t(n!==null?null:r));}catch{t(null);}}},Zt="0.28.0",er=e=>ye().build(e),tr=e=>ye().context(e),rr=(e,t)=>ye().transform(e,t),nr=(e,t)=>ye().formatMessages(e,t),ir=(e,t)=>ye().analyzeMetafile(e,t),lr=e=>{if(H&&!Oe)return K||(K=Re(H)),K.buildSync(e);let t;return Ie(r=>r.buildOrContext({callName:"buildSync",refs:null,options:e,isTTY:Ae(),defaultWD:ge,callback:(n,o)=>{if(n)throw n;t=o;}})),t},ar=(e,t)=>{if(H&&!Oe)return K||(K=Re(H)),K.transformSync(e,t);let r;return Ie(n=>n.transform({callName:"transformSync",refs:null,input:e,options:t||{},isTTY:Ae(),fs:Gt,callback:(o,s)=>{if(o)throw o;r=s;}})),r},or=(e,t)=>{if(H&&!Oe)return K||(K=Re(H)),K.formatMessagesSync(e,t);let r;return Ie(n=>n.formatMessages({callName:"formatMessagesSync",refs:null,messages:e,options:t,callback:(o,s)=>{if(o)throw o;r=s;}})),r},sr=(e,t)=>{if(H&&!Oe)return K||(K=Re(H)),K.analyzeMetafileSync(e,t);let r;return Ie(n=>n.analyzeMetafile({callName:"analyzeMetafileSync",refs:null,metafile:typeof e=="string"?e:JSON.stringify(e),options:t,callback:(o,s)=>{if(o)throw o;r=s;}})),r},ur=()=>(Ne&&Ne(),K&&K.stop(),Promise.resolve()),qe=false,cr=e=>{if(e=Ft(e||{}),e.wasmURL)throw new Error('The "wasmURL" option only works in the browser');if(e.wasmModule)throw new Error('The "wasmModule" option only works in the browser');if(e.worker)throw new Error('The "worker" option only works in the browser');if(qe)throw new Error('Cannot call "initialize" more than once');return ye(),qe=true,Promise.resolve()},ge=process.cwd(),Se,Ne,ye=()=>{if(Se)return Se;let[e,t]=gt(),r=pt.spawn(e,t.concat("--service=0.28.0","--ping"),{windowsHide:true,stdio:["pipe","pipe","inherit"],cwd:ge}),{readFromStdout:n,afterClose:o,service:s}=dt({writeToStdin(u){r.stdin.write(u,y=>{y&&o(y);});},readFileSync:pe.readFileSync,isSync:false,hasFS:true,esbuild:Pe});r.stdin.on("error",o),r.on("error",o);let a=r.stdin,d=r.stdout;d.on("data",n),d.on("end",o),Ne=()=>{a.destroy(),d.destroy(),r.kill(),qe=false,Se=void 0,Ne=void 0;};let i=0;r.unref(),a.unref&&a.unref(),d.unref&&d.unref();let c={ref(){++i===1&&r.ref();},unref(){--i===0&&r.unref();}};return Se={build:u=>new Promise((y,N)=>{s.buildOrContext({callName:"build",refs:c,options:u,isTTY:Ae(),defaultWD:ge,callback:(B,_)=>B?N(B):y(_)});}),context:u=>new Promise((y,N)=>s.buildOrContext({callName:"context",refs:c,options:u,isTTY:Ae(),defaultWD:ge,callback:(B,_)=>B?N(B):y(_)})),transform:(u,y)=>new Promise((N,B)=>s.transform({callName:"transform",refs:c,input:u,options:y||{},isTTY:Ae(),fs:Xt,callback:(_,I)=>_?B(_):N(I)})),formatMessages:(u,y)=>new Promise((N,B)=>s.formatMessages({callName:"formatMessages",refs:c,messages:u,options:y,callback:(_,I)=>_?B(_):N(I)})),analyzeMetafile:(u,y)=>new Promise((N,B)=>s.analyzeMetafile({callName:"analyzeMetafile",refs:c,metafile:typeof u=="string"?u:JSON.stringify(u),options:y,callback:(_,I)=>_?B(_):N(I)}))},Se},Ie=e=>{let[t,r]=gt(),n=new Uint8Array,{readFromStdout:o,afterClose:s,service:a}=dt({writeToStdin(i){if(n.length!==0)throw new Error("Must run at most one command");n=i;},isSync:true,hasFS:true,esbuild:Pe});e(a);let d=pt.execFileSync(t,r.concat("--service=0.28.0"),{cwd:ge,windowsHide:true,input:n,maxBuffer:+process.env.ESBUILD_MAX_BUFFER||16*1024*1024});o(d),s(null);},wt=()=>ze.join(Kt.tmpdir(),`esbuild-${Ht.randomBytes(32).toString("hex")}`),K=null,Re=e=>{let{port1:t,port2:r}=new e.MessageChannel,n=new e.Worker(j,{workerData:{workerPort:r,defaultWD:ge,esbuildVersion:"0.28.0"},transferList:[r],execArgv:[]}),o=0,s=c=>{let u=new Error(`Build failed with 1 error:
|
|
66
|
-
error: ${c}`),y=[{id:"",pluginName:"",text:c,location:null,notes:[],detail:void 0}];return u.errors=y,u.warnings=[],u},a=c=>{if(!c)return;let u=c.plugins;if(u&&u.length>0)throw s("Cannot use plugins in synchronous API calls")},d=(c,u)=>{for(let y in u)c[y]=u[y];},i=(c,u)=>{let y=o++,N=new SharedArrayBuffer(8),B=new Int32Array(N),_={sharedBuffer:N,id:y,command:c,args:u};n.postMessage(_);let I=Atomics.wait(B,0,0);if(I!=="ok"&&I!=="not-equal")throw new Error("Internal error: Atomics.wait() failed: "+I);let{message:{id:L,resolve:W,reject:z,properties:k}}=e.receiveMessageOnPort(t);if(y!==L)throw new Error(`Internal error: Expected id ${y} but got id ${L}`);if(z)throw d(z,k),z;return W};return n.unref(),{buildSync(c){return a(c),i("build",[c])},transformSync(c,u){return i("transform",[c,u])},formatMessagesSync(c,u){return i("formatMessages",[c,u])},analyzeMetafileSync(c,u){return i("analyzeMetafile",[c,u])},stop(){n.terminate(),K=null;}}},fr=()=>{let e=H.workerData.workerPort,t=H.parentPort,r=n=>{let o={};if(n&&typeof n=="object")for(let s in n)o[s]=n[s];return o};try{let n=ye();ge=H.workerData.defaultWD,t.on("message",o=>{(async()=>{let{sharedBuffer:s,id:a,command:d,args:i}=o,c=new Int32Array(s);try{switch(d){case "build":e.postMessage({id:a,resolve:await n.build(i[0])});break;case "transform":e.postMessage({id:a,resolve:await n.transform(i[0],i[1])});break;case "formatMessages":e.postMessage({id:a,resolve:await n.formatMessages(i[0],i[1])});break;case "analyzeMetafile":e.postMessage({id:a,resolve:await n.analyzeMetafile(i[0],i[1])});break;default:throw new Error(`Invalid command: ${d}`)}}catch(u){e.postMessage({id:a,reject:u,properties:r(u)});}Atomics.add(c,0,1),Atomics.notify(c,0,1/0);})();});}catch(n){t.on("message",o=>{let{sharedBuffer:s,id:a}=o,d=new Int32Array(s);e.postMessage({id:a,reject:n,properties:r(n)}),Atomics.add(d,0,1),Atomics.notify(d,0,1/0);});}};Oe&&fr();var dr=Pe;});var
|
|
66
|
+
error: ${c}`),y=[{id:"",pluginName:"",text:c,location:null,notes:[],detail:void 0}];return u.errors=y,u.warnings=[],u},a=c=>{if(!c)return;let u=c.plugins;if(u&&u.length>0)throw s("Cannot use plugins in synchronous API calls")},d=(c,u)=>{for(let y in u)c[y]=u[y];},i=(c,u)=>{let y=o++,N=new SharedArrayBuffer(8),B=new Int32Array(N),_={sharedBuffer:N,id:y,command:c,args:u};n.postMessage(_);let I=Atomics.wait(B,0,0);if(I!=="ok"&&I!=="not-equal")throw new Error("Internal error: Atomics.wait() failed: "+I);let{message:{id:L,resolve:W,reject:z,properties:k}}=e.receiveMessageOnPort(t);if(y!==L)throw new Error(`Internal error: Expected id ${y} but got id ${L}`);if(z)throw d(z,k),z;return W};return n.unref(),{buildSync(c){return a(c),i("build",[c])},transformSync(c,u){return i("transform",[c,u])},formatMessagesSync(c,u){return i("formatMessages",[c,u])},analyzeMetafileSync(c,u){return i("analyzeMetafile",[c,u])},stop(){n.terminate(),K=null;}}},fr=()=>{let e=H.workerData.workerPort,t=H.parentPort,r=n=>{let o={};if(n&&typeof n=="object")for(let s in n)o[s]=n[s];return o};try{let n=ye();ge=H.workerData.defaultWD,t.on("message",o=>{(async()=>{let{sharedBuffer:s,id:a,command:d,args:i}=o,c=new Int32Array(s);try{switch(d){case "build":e.postMessage({id:a,resolve:await n.build(i[0])});break;case "transform":e.postMessage({id:a,resolve:await n.transform(i[0],i[1])});break;case "formatMessages":e.postMessage({id:a,resolve:await n.formatMessages(i[0],i[1])});break;case "analyzeMetafile":e.postMessage({id:a,resolve:await n.analyzeMetafile(i[0],i[1])});break;default:throw new Error(`Invalid command: ${d}`)}}catch(u){e.postMessage({id:a,reject:u,properties:r(u)});}Atomics.add(c,0,1),Atomics.notify(c,0,1/0);})();});}catch(n){t.on("message",o=>{let{sharedBuffer:s,id:a}=o,d=new Int32Array(s);e.postMessage({id:a,reject:n,properties:r(n)}),Atomics.add(d,0,1),Atomics.notify(d,0,1/0);});}};Oe&&fr();var dr=Pe;});var mainLS64TONI = hr();export{mainLS64TONI as default};
|