Socket
Socket
Sign inDemoInstall

@esbuild-kit/core-utils

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@esbuild-kit/core-utils - npm Package Compare versions

Comparing version 2.2.1 to 2.3.0

2

dist/index.js

@@ -23,2 +23,2 @@ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Re=require("source-map-support"),xe=require("url"),At=require("esbuild"),Fe=require("crypto"),Ye=require("fs"),Ge=require("path"),Me=require("os");function _(i){return i&&typeof i=="object"&&"default"in i?i:{default:i}}var He=_(Re),je=_(Fe),F=_(Ye),Y=_(Ge),Oe=_(Me);const qe="setSourceMapsEnabled"in process&&typeof Error.prepareStackTrace!="function";function _e(){if(qe){process.setSourceMapsEnabled(!0);return}const i=new Map;return He.default.install({environment:"node",retrieveSourceMap(t){const A=i.get(t);return A?{url:t,map:A}:null}}),i}const Pe=`

})`.replace(/[\n\t]+/g,"");function pt(i){if(!i.includes("import"))return;const[t]=aA(i);if(t.length===0)return;const A=new mt(i);for(const n of t)n.d>-1&&A.appendRight(n.se,cA);return{code:A.toString(),map:A.generateMap({hires:!0})}}function lA(i){try{const t=F.default.readFileSync(i,"utf8");return JSON.parse(t)}catch{}}const Ft=()=>Math.floor(Date.now()/1e8);class uA extends Map{cacheDirectory=Y.default.join(Oe.default.tmpdir(),"esbuild-kit");cacheFiles;constructor(){super(),F.default.mkdirSync(this.cacheDirectory,{recursive:!0}),this.cacheFiles=F.default.readdirSync(this.cacheDirectory).map(t=>{const[A,n]=t.split("-");return{time:Number(A),key:n,fileName:t}}),setImmediate(()=>this.expireDiskCache())}get(t){const A=super.get(t);if(A)return A;const n=this.cacheFiles.find(c=>c.key===t);if(!n)return;const s=Y.default.join(this.cacheDirectory,n.fileName),a=lA(s);if(!a){F.default.promises.unlink(s).then(()=>{const c=this.cacheFiles.indexOf(n);this.cacheFiles.splice(c,1)},()=>{});return}return super.set(t,a),a}set(t,A){if(super.set(t,A),A){const n=Ft();F.default.promises.writeFile(Y.default.join(this.cacheDirectory,`${n}-${t}`),JSON.stringify(A)).catch(()=>{})}return this}expireDiskCache(){const t=Ft();for(const A of this.cacheFiles)t-A.time>7&&F.default.promises.unlink(Y.default.join(this.cacheDirectory,A.fileName)).catch(()=>{})}}var nt=process.env.ESBK_DISABLE_CACHE?new Map:new uA;const Yt=",".charCodeAt(0),fA=";".charCodeAt(0),Gt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Mt=new Uint8Array(64),Ht=new Uint8Array(128);for(let i=0;i<Gt.length;i++){const t=Gt.charCodeAt(i);Mt[i]=t,Ht[t]=i}const wt=typeof TextDecoder<"u"?new TextDecoder:typeof Buffer<"u"?{decode(i){return Buffer.from(i.buffer,i.byteOffset,i.byteLength).toString()}}:{decode(i){let t="";for(let A=0;A<i.length;A++)t+=String.fromCharCode(i[A]);return t}};function QA(i){const t=new Int32Array(5),A=[];let n=0;do{const s=hA(i,n),a=[];let c=!0,C=0;t[0]=0;for(let Q=n;Q<s;Q++){let g;Q=$(i,Q,t,0);const f=t[0];f<C&&(c=!1),C=f,jt(i,Q,s)?(Q=$(i,Q,t,1),Q=$(i,Q,t,2),Q=$(i,Q,t,3),jt(i,Q,s)?(Q=$(i,Q,t,4),g=[f,t[1],t[2],t[3],t[4]]):g=[f,t[1],t[2],t[3]]):g=[f],a.push(g)}c||gA(a),A.push(a),n=s+1}while(n<=i.length);return A}function hA(i,t){const A=i.indexOf(";",t);return A===-1?i.length:A}function $(i,t,A,n){let s=0,a=0,c=0;do{const Q=i.charCodeAt(t++);c=Ht[Q],s|=(c&31)<<a,a+=5}while(c&32);const C=s&1;return s>>>=1,C&&(s=-2147483648|-s),A[n]+=s,t}function jt(i,t,A){return t>=A?!1:i.charCodeAt(t)!==Yt}function gA(i){i.sort(CA)}function CA(i,t){return i[0]-t[0]}function BA(i){const t=new Int32Array(5),A=1024*16,n=A-36,s=new Uint8Array(A),a=s.subarray(0,n);let c=0,C="";for(let Q=0;Q<i.length;Q++){const g=i[Q];if(Q>0&&(c===A&&(C+=wt.decode(s),c=0),s[c++]=fA),g.length!==0){t[0]=0;for(let f=0;f<g.length;f++){const r=g[f];c>n&&(C+=wt.decode(a),s.copyWithin(0,n,c),c-=n),f>0&&(s[c++]=Yt),c=W(s,c,t,r,0),r.length!==1&&(c=W(s,c,t,r,1),c=W(s,c,t,r,2),c=W(s,c,t,r,3),r.length!==4&&(c=W(s,c,t,r,4)))}}}return C+wt.decode(s.subarray(0,c))}function W(i,t,A,n,s){const a=n[s];let c=a-A[s];A[s]=a,c=c<0?-c<<1|1:c<<1;do{let C=c&31;c>>>=5,c>0&&(C|=32),i[t++]=Mt[C]}while(c>0);return t}const EA=/^[\w+.-]+:\/\//,dA=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?/,pA=/^file:(?:\/\/((?![a-z]:)[^/]*)?)?(\/?.*)/i;function wA(i){return EA.test(i)}function IA(i){return i.startsWith("//")}function Ot(i){return i.startsWith("/")}function kA(i){return i.startsWith("file:")}function it(i){const t=dA.exec(i);return qt(t[1],t[2]||"",t[3],t[4]||"",t[5]||"/")}function bA(i){const t=pA.exec(i),A=t[2];return qt("file:","",t[1]||"","",Ot(A)?A:"/"+A)}function qt(i,t,A,n,s){return{scheme:i,user:t,host:A,port:n,path:s,relativePath:!1}}function _t(i){if(IA(i)){const A=it("http:"+i);return A.scheme="",A}if(Ot(i)){const A=it("http://foo.com"+i);return A.scheme="",A.host="",A}if(kA(i))return bA(i);if(wA(i))return it(i);const t=it("http://foo.com/"+i);return t.scheme="",t.host="",t.relativePath=!0,t}function mA(i){if(i.endsWith("/.."))return i;const t=i.lastIndexOf("/");return i.slice(0,t+1)}function DA(i,t){!i.relativePath||(Pt(t),i.path==="/"?i.path=t.path:i.path=mA(t.path)+i.path,i.relativePath=t.relativePath)}function Pt(i){const{relativePath:t}=i,A=i.path.split("/");let n=1,s=0,a=!1;for(let C=1;C<A.length;C++){const Q=A[C];if(!Q){a=!0;continue}if(a=!1,Q!=="."){if(Q===".."){s?(a=!0,s--,n--):t&&(A[n++]=Q);continue}A[n++]=Q,s++}}let c="";for(let C=1;C<n;C++)c+="/"+A[C];(!c||a&&!c.endsWith("/.."))&&(c+="/"),i.path=c}function JA(i,t){if(!i&&!t)return"";const A=_t(i);if(t&&!A.scheme){const n=_t(t);A.scheme=n.scheme,A.host||(A.user=n.user,A.host=n.host,A.port=n.port),DA(A,n)}if(Pt(A),A.relativePath){const n=A.path.slice(1);return n?!(t||i).startsWith(".")||n.startsWith(".")?n:"./"+n:"."}return!A.scheme&&!A.host?A.path:`${A.scheme}//${A.user}${A.host}${A.port}${A.path}`}function Tt(i,t){return t&&!t.endsWith("/")&&(t+="/"),JA(i,t)}function KA(i){if(!i)return"";const t=i.lastIndexOf("/");return i.slice(0,t+1)}const R=0;function SA(i,t){const A=Xt(i,0);if(A===i.length)return i;t||(i=i.slice());for(let n=A;n<i.length;n=Xt(i,n+1))i[n]=LA(i[n],t);return i}function Xt(i,t){for(let A=t;A<i.length;A++)if(!yA(i[A]))return A;return i.length}function yA(i){for(let t=1;t<i.length;t++)if(i[t][R]<i[t-1][R])return!1;return!0}function LA(i,t){return t||(i=i.slice()),i.sort(vA)}function vA(i,t){return i[R]-t[R]}let st=!1;function UA(i,t,A,n){for(;A<=n;){const s=A+(n-A>>1),a=i[s][R]-t;if(a===0)return st=!0,s;a<0?A=s+1:n=s-1}return st=!1,A-1}function NA(i,t,A){for(let n=A+1;n<i.length&&i[n][R]===t;A=n++);return A}function RA(i,t,A){for(let n=A-1;n>=0&&i[n][R]===t;A=n--);return A}function xA(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}function FA(i,t,A,n){const{lastKey:s,lastNeedle:a,lastIndex:c}=A;let C=0,Q=i.length-1;if(n===s){if(t===a)return st=c!==-1&&i[c][R]===t,c;t>=a?C=c===-1?0:c:Q=c}return A.lastKey=n,A.lastNeedle=t,A.lastIndex=UA(i,t,C,Q)}const $t=-1,YA=1;let It,Wt;class Vt{constructor(t,A){this._decodedMemo=xA(),this._bySources=void 0,this._bySourceMemos=void 0;const n=typeof t=="string";if(!n&&t._decodedMemo)return t;const s=n?JSON.parse(t):t,{version:a,file:c,names:C,sourceRoot:Q,sources:g,sourcesContent:f}=s;this.version=a,this.file=c,this.names=C,this.sourceRoot=Q,this.sources=g,this.sourcesContent=f;const r=Tt(Q||"",KA(A));this.resolvedSources=g.map(m=>Tt(m||"",r));const{mappings:E}=s;typeof E=="string"?(this._encoded=E,this._decoded=void 0):(this._encoded=void 0,this._decoded=SA(E,n))}}It=i=>i._decoded||(i._decoded=QA(i._encoded)),Wt=(i,t,A)=>{const n=It(i);return t>=n.length?null:GA(n[t],i._decodedMemo,t,A,YA)};function GA(i,t,A,n,s){let a=FA(i,n,t,A);return st?a=(s===$t?NA:RA)(i,n,a):s===$t&&a++,a===-1||a===i.length?null:i[a]}let zt,ot;class Zt{constructor(){this._indexes={__proto__:null},this.array=[]}}zt=(i,t)=>i._indexes[t],ot=(i,t)=>{const A=zt(i,t);if(A!==void 0)return A;const{array:n,_indexes:s}=i;return s[t]=n.push(t)-1};let te,ee,kt,Ae;class MA{constructor({file:t,sourceRoot:A}={}){this._names=new Zt,this._sources=new Zt,this._sourcesContent=[],this._mappings=[],this.file=t,this.sourceRoot=A}}te=(i,t,A,n,s,a,c)=>{const{_mappings:C,_sources:Q,_sourcesContent:g,_names:f}=i,r=HA(C,t);if(n==null){const y=[A],v=re(r,A,y);return ne(r,v,y)}const E=ot(Q,n),m=c?[A,E,s,a,ot(f,c)]:[A,E,s,a],I=re(r,A,m);E===g.length&&(g[E]=null),ne(r,I,m)},ee=(i,t,A)=>{const{_sources:n,_sourcesContent:s}=i;s[ot(n,t)]=A},kt=i=>{const{file:t,sourceRoot:A,_mappings:n,_sources:s,_sourcesContent:a,_names:c}=i;return{version:3,file:t,names:c.array,sourceRoot:A||void 0,sources:s.array,sourcesContent:a,mappings:n}},Ae=i=>{const t=kt(i);return Object.assign(Object.assign({},t),{mappings:BA(t.mappings)})};function HA(i,t){for(let A=i.length;A<=t;A++)i[A]=[];return i[t]}function re(i,t,A){let n=i.length;for(let s=n-1;s>=0;s--,n--){const a=i[s],c=a[0];if(c>t)continue;if(c<t)break;const C=jA(a,A);if(C===0)return n;if(C<0)break}return n}function jA(i,t){let A=V(i.length,t.length);return A!==0?A:i.length===1?0:(A=V(i[1],t[1]),A!==0||(A=V(i[2],t[2]),A!==0)||(A=V(i[3],t[3]),A!==0)?A:i.length===4?0:V(i[4],t[4]))}function V(i,t){return i-t}function ne(i,t,A){if(t!==-1){for(let n=i.length;n>t;n--)i[n]=i[n-1];i[t]=A}}const ie={source:null,column:null,line:null,name:null,content:null},OA=[];function se(i,t,A,n){return{map:i,sources:t,source:A,content:n}}function oe(i,t){return se(i,t,"",null)}function qA(i,t){return se(null,OA,i,t)}function _A(i){const t=new MA({file:i.map.file}),{sources:A,map:n}=i,s=n.names,a=It(n);for(let c=0;c<a.length;c++){const C=a[c];let Q=null,g=null,f=null;for(let r=0;r<C.length;r++){const E=C[r],m=E[0];let I=ie;if(E.length!==1){const et=A[E[1]];if(I=ae(et,E[2],E[3],E.length===5?s[E[4]]:""),I==null)continue}const{column:y,line:v,name:Z,content:tt,source:U}=I;v===g&&y===f&&U===Q||(g=v,f=y,Q=U,te(t,c,m,U,v,y,Z),tt!=null&&ee(t,U,tt))}}return t}function ae(i,t,A,n){if(!i.map)return{column:A,line:t,name:n,source:i.source,content:i.content};const s=Wt(i.map,t,A);return s==null?null:s.length===1?ie:ae(i.sources[s[1]],s[2],s[3],s.length===5?i.map.names[s[4]]:n)}function PA(i){return Array.isArray(i)?i:[i]}function TA(i,t){const A=PA(i).map(a=>new Vt(a,"")),n=A.pop();for(let a=0;a<A.length;a++)if(A[a].sources.length>1)throw new Error(`Transformation map ${a} must have exactly one source file.
Did you specify these with the most recent transformation maps first?`);let s=ce(n,t,"",0);for(let a=A.length-1;a>=0;a--)s=oe(A[a],[s]);return s}function ce(i,t,A,n){const{resolvedSources:s,sourcesContent:a}=i,c=n+1,C=s.map((Q,g)=>{const f={importer:A,depth:c,source:Q||"",content:void 0},r=t(f.source,f),{source:E,content:m}=f;if(r)return ce(new Vt(r,E),t,E,c);const I=m!==void 0?m:a?a[g]:null;return qA(E,I)});return oe(i,C)}class XA{constructor(t,A){const n=A.decodedMappings?kt(t):Ae(t);this.version=n.version,this.file=n.file,this.mappings=n.mappings,this.names=n.names,this.sourceRoot=n.sourceRoot,this.sources=n.sources,A.excludeContent||(this.sourcesContent=n.sourcesContent)}toString(){return JSON.stringify(this)}}function le(i,t,A){const n=typeof A=="object"?A:{excludeContent:!!A,decodedMappings:!1},s=TA(i,t);return new XA(_A(s),n)}function $A(i,t){const A=[],n={code:i,map:""};for(const s of t){const a=s(n.code);a&&(Object.assign(n,a),A.unshift(a.map))}return n.map=A.length>1?le(A,()=>null).toString():A[0].toString(),n}async function WA(i,t){const A=[],n={code:i,map:""};for(const s of t){const a=await s(n.code);a&&(Object.assign(n,a),A.unshift(a.map))}return n.map=A.length>1?le(A,()=>null).toString():A[0].toString(),n}const VA=process.versions.node,ue=i=>{const t={target:`node${VA}`,loader:"default",sourcemap:!0,keepNames:!0,minifySyntax:!0,minifyWhitespace:!0,...i};if(t.sourcefile){const{sourcefile:A}=t,n=Y.default.extname(A);n?(n===".cts"||n===".mts")&&(t.sourcefile=`${A.slice(0,-3)}ts`):t.sourcefile+=".js"}return t};function zA(i,t,A){const n={};t.endsWith(".cjs")||t.endsWith(".cts")||(n["import.meta.url"]=`'${xe.pathToFileURL(t)}'`);const s=ue({format:"cjs",sourcefile:t,define:n,...A}),a=St(i+JSON.stringify(s)+At.version),c=nt.get(a);if(c)return c;const C=$A(i,[Q=>{const g=At.transformSync(Q,s);return s.sourcefile!==t&&(g.map=g.map.replace(`"${s.sourcefile}"`,`"${t}"`)),g},pt]);if(C.warnings.length>0){const{warnings:Q}=C;for(const g of Q)console.log(g)}return nt.set(a,C),C}async function ZA(i,t,A){const n=ue({format:"esm",sourcefile:t,...A}),s=St(i+JSON.stringify(n)+At.version),a=nt.get(s);if(a)return a;const c=await WA(i,[async C=>{const Q=await At.transform(C,n);return n.sourcefile!==t&&(Q.map=Q.map.replace(`"${n.sourcefile}"`,`"${t}"`)),Q},pt]);if(c.warnings.length>0){const{warnings:C}=c;for(const Q of C)console.log(Q)}return nt.set(s,c),c}const tr={".js":".ts",".cjs":".cts",".mjs":".mts"};function er(i){const t=Y.default.extname(i),A=tr[t];if(A)return i.slice(0,-t.length)+A}const bt=process.versions.node.split(".").map(Number),Ar=i=>bt[0]-i[0]||bt[1]-i[1]||bt[2]-i[2];exports.applySourceMap=Te,exports.compareNodeVersion=Ar,exports.installSourceMapSupport=_e,exports.resolveTsPath=er,exports.transform=ZA,exports.transformDynamicImport=pt,exports.transformSync=zA;
Did you specify these with the most recent transformation maps first?`);let s=ce(n,t,"",0);for(let a=A.length-1;a>=0;a--)s=oe(A[a],[s]);return s}function ce(i,t,A,n){const{resolvedSources:s,sourcesContent:a}=i,c=n+1,C=s.map((Q,g)=>{const f={importer:A,depth:c,source:Q||"",content:void 0},r=t(f.source,f),{source:E,content:m}=f;if(r)return ce(new Vt(r,E),t,E,c);const I=m!==void 0?m:a?a[g]:null;return qA(E,I)});return oe(i,C)}class XA{constructor(t,A){const n=A.decodedMappings?kt(t):Ae(t);this.version=n.version,this.file=n.file,this.mappings=n.mappings,this.names=n.names,this.sourceRoot=n.sourceRoot,this.sources=n.sources,A.excludeContent||(this.sourcesContent=n.sourcesContent)}toString(){return JSON.stringify(this)}}function le(i,t,A){const n=typeof A=="object"?A:{excludeContent:!!A,decodedMappings:!1},s=TA(i,t);return new XA(_A(s),n)}function $A(i,t){const A=[],n={code:i,map:""};for(const s of t){const a=s(n.code);a&&(Object.assign(n,a),A.unshift(a.map))}return n.map=A.length>1?le(A,()=>null).toString():A[0].toString(),n}async function WA(i,t){const A=[],n={code:i,map:""};for(const s of t){const a=await s(n.code);a&&(Object.assign(n,a),A.unshift(a.map))}return n.map=A.length>1?le(A,()=>null).toString():A[0].toString(),n}const VA=process.versions.node,ue=i=>{const t={target:`node${VA}`,loader:"default",sourcemap:!0,minify:!0,keepNames:!0,...i};if(t.sourcefile){const{sourcefile:A}=t,n=Y.default.extname(A);n?(n===".cts"||n===".mts")&&(t.sourcefile=`${A.slice(0,-3)}ts`):t.sourcefile+=".js"}return t};function zA(i,t,A){const n={};t.endsWith(".cjs")||t.endsWith(".cts")||(n["import.meta.url"]=`'${xe.pathToFileURL(t)}'`);const s=ue({format:"cjs",sourcefile:t,define:n,...A}),a=St(i+JSON.stringify(s)+At.version),c=nt.get(a);if(c)return c;const C=$A(i,[Q=>{const g=At.transformSync(Q,s);return s.sourcefile!==t&&(g.map=g.map.replace(`"${s.sourcefile}"`,`"${t}"`)),g},pt]);if(C.warnings.length>0){const{warnings:Q}=C;for(const g of Q)console.log(g)}return nt.set(a,C),C}async function ZA(i,t,A){const n=ue({format:"esm",sourcefile:t,...A}),s=St(i+JSON.stringify(n)+At.version),a=nt.get(s);if(a)return a;const c=await WA(i,[async C=>{const Q=await At.transform(C,n);return n.sourcefile!==t&&(Q.map=Q.map.replace(`"${n.sourcefile}"`,`"${t}"`)),Q},pt]);if(c.warnings.length>0){const{warnings:C}=c;for(const Q of C)console.log(Q)}return nt.set(s,c),c}const tr={".js":".ts",".cjs":".cts",".mjs":".mts"};function er(i){const t=Y.default.extname(i),A=tr[t];if(A)return i.slice(0,-t.length)+A}const bt=process.versions.node.split(".").map(Number),Ar=i=>bt[0]-i[0]||bt[1]-i[1]||bt[2]-i[2];exports.applySourceMap=Te,exports.compareNodeVersion=Ar,exports.installSourceMapSupport=_e,exports.resolveTsPath=er,exports.transform=ZA,exports.transformDynamicImport=pt,exports.transformSync=zA;
{
"name": "@esbuild-kit/core-utils",
"version": "2.2.1",
"version": "2.3.0",
"publishConfig": {

@@ -5,0 +5,0 @@ "access": "public"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc