Comparing version 2.5.0 to 2.5.1
{ | ||
"name": "esmock", | ||
"type": "module", | ||
"version": "2.5.0", | ||
"version": "2.5.1", | ||
"license": "ISC", | ||
@@ -6,0 +6,0 @@ "readmeFilename": "README.md", |
@@ -1,3 +0,3 @@ | ||
var Te=Object.defineProperty;var Ke=(e,t)=>{for(var s in t)Te(e,s,{get:t[s],enumerable:!0})};import Ne from"node:module";var C={};Ke(C,{default:()=>E,getSource:()=>ot,globalPreload:()=>Ye,initialize:()=>et,load:()=>oe,resolve:()=>st});import Ue from"node:fs/promises";import X from"node:module";import Be from"process";var Ae=(e,t)=>new Error(`invalid moduleId: "${e}" (used by ${t})`),De=(e,t)=>new Error(`un-mocked moduleId: "${e}" (used by ${t})`),Ge=()=>new Error("For versions of node prior to v20.6.0, the loader chain process must include esmock. start the process using --loader=esmock."),ze=(e,t)=>new Error(`no mocks provided for module: "${e}" (used by ${t})`),f={errModuleIdNotFound:Ae,errModuleIdNotMocked:De,errMissingLoader:Ge,errModuleIdNoDefs:ze};var[V,_e]=Be.versions.node.split(".").map(e=>+e),Y=V<16||V===16&&_e<12,g=import.meta.url,Le=/\?esmkgdefs=.*/,ee=/.*\?esmkgdefs=/,x=/#-#esmkdefs/,W=/^file:\/\/\/import\?/,Ve=/file:\/\/\/import\?([^#]*)/,We=/\bimport,|,import\b|\bimport\b/g,S=/esmkTreeId=\d*/,Ze=/esmkModuleId=([^&]*)/,Z=/\?esmk=\d*/,$=/.*exportNames=(.*)/,qe=/.*#-#/,He=/isesm=true/,Je=/isfound=false/,Qe=/^(commonjs|module)$/,Xe=/strict=3/,q=/^(#![^\n]*\n)/,H=(e,t)=>new RegExp(`.*(${e}(\\?${t}(?:(?!#-#).)*)).*`),O=global.mockKeys=global.mockKeys||{},Ye=!X.register&&(({port:e})=>(e.addEventListener("message",t=>O[t.data.key]=t.data.keylong),e.unref(),"global.postMessageEsmk = d => port.postMessage(d)")),et=X.register&&(e=>{e&&e.port&&e.port.on("message",t=>{O[t.key]=t.keylong})}),J=e=>{let[t,s]=e.match(Ve)||[];return[t,$.test(s)&&s.replace($,"$1").split(",")]},tt=e=>{let t=e.split(x)[1]||"",s=J(t),o=e.replace(ee,""),r=J(o);return[s[0]||r[0],[...new Set([s[1]||[],r[1]||[]].flat())]]},te=e=>Z.test(e)&&O[e.match(Z)[0].split("=")[1]],Q=async(e,t,s)=>s.parentURL&&(s.conditions.slice(-1)[0]==="node-addons"||s.importAssertions||Y)?e(t,s):e(t),st=async(e,t,s)=>{let{parentURL:o}=t,r=te(o)||o;if(!S.test(r))return Q(s,e,t);let[c]=String(r).match(S),[n,l]=r.split(x),a=n&&n.replace(ee,"");if(r.includes(`esmkModuleId=${e}&isfound=false`)){let I=H(`file:///${e}`,c),M=(a.match(I)||l.match(I)||[])[2];if(M)return{shortCircuit:!0,url:g+M}}if(W.test(e))return{shortCircuit:!0,url:e.replace(W,g+"?")};let m=await Q(s,e,t),p=H(m.url,c),d=p.test(l)&&l.replace(p,"$1")||p.test(a)&&a.replace(p,"$1");if(d?m.url=He.test(d)?d:g+"#-#"+d:a&&a!=="0"&&(m.url.startsWith("node:")||(m.url+="?esmkgdefs="+a)),Xe.test(r)&&!d)throw f.errModuleIdNotMocked(m.url,r.split("?")[0]);return m},se=g+"?esmock-loader=true",E=(e=>async()=>e=e||(await import(se)).default===!0)(),oe=async(e,t,s)=>{if(e===se)return{format:"module",shortCircuit:!0,responseURL:e,source:"export default true"};let o=te(e)||e;if(o&&(o.match(S)||[])[0]){let[n,l]=tt(o);if(l&&l.length){let a=await s(e,t);if(!Qe.test(a.format))return a;let m=a.source===null||a.source===void 0,p=String(m?await Ue.readFile(new URL(e)):a.source),d=(p.match(q)||[])[0]||"",I=d?p.replace(q,""):p,M=a.format==="commonjs"?`const {${l}} = global.esmockCacheGet("${n}");`:`import {${l}} from '${n}';`;return{format:a.format,shortCircuit:!0,responseURL:encodeURI(e),source:d+M+I}}}if(x.test(e))return s(e,t);e=e.replace(Le,""),e.startsWith(g)&&(e=e.replace(qe,""),Je.test(e)&&(e=e.replace(g,`file:///${e.match(Ze)[1]}`)));let c=$.test(e)&&e.replace($,"$1").replace(We,"").split(",");return c&&c[0]?{format:"module",shortCircuit:!0,responseURL:encodeURI(e),source:c.map(n=>n==="default"?`export default global.esmockCacheGet("${e}").default`:`export const ${n} = global.esmockCacheGet("${e}").${n}`).join(` | ||
`)}:s(e,t)},ot=Y&&oe;import Rt from"fs";import me from"fs";import ue from"url";import i from"path";import pe from"module";var N=pe.createRequire(import.meta.url),re=me.realpathSync.native,de=new RegExp("^(?:node:)?("+pe.builtinModules.join("|").replace("/","/")+")$"),rt=/^\.?\.?([a-zA-Z]:)?(\/|\\)/,T=/^.\.?(?=\/|\\)/,ne=/\\/g,nt=/index.[tj]sx?$/,ct=/[\\/]resolvewithplus[\\/]/,it=/(^@[^/]*\/[^/]*|^[^/]*)\/?(.*)$/,P=/^#/,fe=/(\*)/g,ge=/([./])/g,at=/^node:/,lt=/^file:/,ke=[".js",".mjs",".ts",".tsx",".json",".node"],ce="node_modules",R="package.json",ie="node",ae="default",K="import",w=".",he=e=>e&&typeof e=="object",v={},mt=e=>at.test(e)?e:`node:${e}`,ut=e=>e&&ue.pathToFileURL(e).href,pt=e=>de.test(e),dt=e=>lt.test(e)?ue.fileURLToPath(e):e,ft=e=>i.resolve(i.extname(e)?i.dirname(e):e)+i.sep,F=e=>ne.test(e)?e.replace(ne,i.posix.sep):e,k=(e,t)=>{try{t=me.statSync(e)}catch{t=!1}return t&&(t.isFile()||t.isFIFO())},be=e=>e.split(i.sep).reduce((t,s,o)=>(s===ce&&!ct.test(e)||(s=o?i.join(t[0][o-1],s):s||i.sep,t[0].push(s),t[1].push(i.resolve(i.join(s,ce)))),t),[[],[]])[1].reverse(),gt=e=>{let t=e.split(i.sep).slice(1).reduce((s,o,r)=>(s.push(i.resolve(i.join(r?s[r-1]:i.sep,o))),s),[]).reverse().find(s=>k(i.join(s,R)));return t&&i.join(t,R)},kt=e=>(String(e).match(it)||[]).slice(1),le=(e,t)=>new RegExp(e.replace(ge,"\\$1").replace(fe,".*")).test(t),ht=(e,t,s)=>{let o=new RegExp(e.replace(ge,"\\$1").replace(fe,"(.*)")),r=(s.match(o)||[])[1];return r&&t.replace("*",r)},je=(e,t,s,o=!1)=>(le(e,s)&&(t.includes("*")?le(t,s)?o=s:e.includes("*")&&e!==t&&(o=ht(e,t,s)):o=t),o),ye=(e,t,s,o=e[0])=>e.length?(P.test(s)?P.test(o):T.test(o))&&typeof t[o]=="string"&&je(o,t[o],s)||ye(e.slice(1),t,s):null,u=(e,t)=>{let s=!1;return typeof e=="string"?e:(!s&&Array.isArray(e)&&(s=e.reduce((o,r)=>o||u(r,t),null)),!s&&he(e)&&(typeof e[t]=="string"&&(s=e[t]),!s&&e[ie]&&(s=u(e[ie],t)),!s&&e[ae]&&(s=u(e[ae],t)),!s&&e[t]&&(s=u(e[t],t)),!s&&e[w]&&(s=typeof e[w]=="string"?t===K&&u(e[w],t):u(e[w],t)),s||(s=ye(Object.keys(e),e,t))),s)},Ie=(e,t)=>{let s=t&&t.ismodule&&e.module,o=s||t&&t.browser&&e.browser,r=e.exports,c,n;return o&&(typeof o=="string"?n=o:he(o)&&([c]=Object.keys(o).filter(l=>nt.test(l)),n=c in o&&o[c])),r&&(n=u(r,K)),n},b=e=>{var t=null;return k(e)?t=e:ke.some(s=>k(e+s)&&(t=e+s)),t},Me=(e,t)=>{let s=null,o,r=i.join(e,R),c=k(r)&&N(r);return(o=Ie(c,t))?s=b(i.join(e,o)):(o=c.main)?s=b(i.join(e,o))||b(i.join(e,i.join(o,"index"))):ke.some(n=>(n=i.join(e,`index${n}`))&&k(n)&&(s=n)),s},$e=(e,t,s)=>{let o=T.test(e)?i.join(t,e):e;return b(o,s)||Me(o,s)},bt=(e,t,s)=>{let o=s&&s.imports,r=u(o,t);return r&&(T.test(r)?i.join(e,r):we(r,e,{isposixpath:!0}))},jt=(e,t,s,o)=>{let r=u(o&&o.exports,s?"./"+s:K);return r&&i.join(e,t,r)},yt=(e,t,s,o)=>{let r=i.join(e,t,R),c=k(r),n=c&&N(r);return c&&jt(e,t,s,n,o)},It=(e,t,s)=>{let o=gt(t),r=i.dirname(o);return o&&bt(r,e,N(o),s)},Mt=(e,t,s)=>{let[o,r]=kt(e);if(P.test(o))return It(e,t,s);let c=be(t).sort((n,l)=>n.length>l.length);return function n(l,a,m=a-1){return a--?yt(i.join(l[m-a]),o,r,s)||$e(i.join(l[m-a],e),null,s)||n(c,a,m):null}(c,c.length)},$t=(e,t,s)=>{var o=null;return t=typeof t=="string"?ft(dt(decodeURI(t))):process.cwd(),de.test(e)?o=mt(e):(o=rt.test(e)?$e(F(e),t,s):Mt(e,t),o=o&&(s.isposixpath?re(o):ut(F(re(o))))),o},we=(e,t,s)=>{let o=v[e+t];return o||(o=$t(e,t,s||{}),v[e+t]=o)},j=Object.assign(we,{pathToPosix:F,getasnode_module_paths:be,getesmkeyvalmatch:je,getasfilesync:b,getasdirsync:Me,gettargetindex:Ie,iscoremodule:pt,esmparse:u,cache:v});var Re=/(^\s*|[});\n]\s*)(import\s+(['"]|(\*\s+as\s+)?[^"'()\n;]+\s+from\s+['"]|\{)|export\s+\*\s+from\s+["']|export\s+(\{|default|function|class|var|const|let|async\s+function))/;import Se from"node:module";import xe from"node:worker_threads";var A=xe.MessageChannel&&new xe.MessageChannel,Oe=(e=>()=>(typeof e=="boolean"||(e=!!Se.register)&&Se.register("./esmockLoader.js",{parentURL:import.meta.url,data:{port:A.port2},transferList:[A.port2]}),e))(),Ee=Object.assign(e=>{Oe()?A.port1.postMessage(e):typeof global.postMessageEsmk=="function"&&global.postMessageEsmk(e)},{register:Oe});var D={isESM:{},mockDefs:{}},Ce=(e,t)=>(Ee({key:e,keylong:t}),global.mockKeys[String(e)]=t),G=e=>global.mockKeys[String(e)],z=(e,t)=>global.esmockCache.mockDefs[e]=t,wt=e=>global.esmockCache.mockDefs[e],Pe=e=>D.isESM[e],ve=(e,t)=>D.isESM[e]=t;Object.assign(global,{esmockCache:D,esmockCacheGet:wt,esmockTreeIdGet:G,mockKeys:global.mockKeys||{}});var U=e=>typeof e=="object"&&e,B=e=>U(e)&&"default"in e,St=/^\.?\.?([a-zA-Z]:)?(\/|\\)/,xt=((e=0)=>()=>++e)(),Ot=Object.getPrototypeOf({}),Et=e=>Object.getPrototypeOf(e)===Ot,Ct=(e,t)=>Et(e)?Object.assign({},e,t):Object.assign(Object.keys(e).reduce((s,o)=>(Object.defineProperty(s,o,{value:e[o],writable:!0}),s),Object.create(e)),t),Pt=(e,t)=>U(e)&&U(t)?Ct(e,t):t,vt=(e,t,s)=>s===null?Object.assign({},e||{},t):(t=Object.assign({},e||{},{default:Pt(B(e)&&e.default,B(t)?t.default:t)},t),!j.iscoremodule(s)&&Object.isExtensible(t.default)&&(t.default.default=t.default),t),Ft=(e,t)=>(t=Pe(e),typeof t=="boolean"||(t=!j.iscoremodule(e)&&St.test(e)&&Re.test(Rt.readFileSync(e,"utf-8")),ve(e,t)),t),Nt=(e,t)=>{let s=B(e)&&e.default;return/boolean|string|number/.test(typeof s)?e:Object.isExtensible(s)?Object.assign(s,e,{esmkTreeId:t}):Object.assign({},s,e,{esmkTreeId:t})},Tt=e=>{let t=c=>c==="null"||z(c,null),s=G(e.split("esmk=")[1]),[o,r]=s.split("#-#esmkdefs=");String(r).split("#-#").forEach(t),String(o.split("esmkgdefs=")[1]).split("#-#").forEach(t)},Kt=async(e,t,s,o,r)=>{t=vt(r.strict||!o||await import(o),t,o);let c=(o||"file:///"+s)+"?"+["esmkTreeId="+e,"esmkModuleId="+s,"isfound="+!!o,"isesm="+Ft(o),"exportNames="+Object.keys(t).sort().join()].join("&");return z(c,t),c},_=async(e,t,s,o,r,c,n)=>{if(o=o||Object.keys(s),n=o[0],c=c||[],!n)return c;let l=j(n,e);if(!l&&r.isModuleNotFoundError!==!1&&n!=="import")throw f.errModuleIdNotFound(n,e);return c.push(await Kt(t,s[n],n,l,r)),_(e,t,s,o.slice(1),r,c)},At=async(e,t,s,o,r)=>{let c=j(e,t);if(!c)throw f.errModuleIdNotFound(e,t);let n=o?Object.keys(o):[],l=s?Object.keys(s):[];if(r.strict===3&&!n.length&&!l.length)throw f.errModuleIdNoDefs(e,t);let a=typeof r.id=="number"?r.id:xt(),m=`${c}?key=${a}&strict=${r.strict}?`+["esmkgdefs="+(n.length&&(await _(t,a,o,n,r)).join("#-#")||0),"esmkdefs=",l.length&&(await _(t,a,s,l,r)).join("#-#")||0].join("#-#");return Ce(String(a),m),c+`?esmk=${a}`},y=Object.assign(At,{purge:Tt,sanitize:Nt});var Dt=/^.*(\(|at )(.*):[\d]*:[\d]*.*$/,Fe=(e,t)=>(e=typeof e[1]=="string"?e:[e[0],new Error().stack.split(` | ||
`)[3].replace(Dt,"$2"),...e.slice(1)],e[4]={...e[4],...t},e);var h=e=>async(...t)=>{let[s,o,r,c,n]=Fe(t,e);if(!Ne.register&&!await E())throw f.errMissingLoader();let l=await y(s,o,r,c,n),a=await import(l);return n.purge!==!1&&y.purge(l),y.sanitize(a,l)},L=e=>e&&/object|function/.test(typeof e)&&"esmkTreeId"in e&&y.purge(e.esmkTreeId),Gt=Object.assign(h({strict:1}),{purge:L,p:h({strict:1,purge:!1})}),zt=Object.assign(h({strict:3}),{purge:L,p:h({strict:3,purge:!1})}),hs=Object.assign(h(),{purge:L,p:h({purge:!1}),strict:Gt,strictest:zt});var Ut=Ne.register?{}:C,{load:bs,resolve:js,getSource:ys,initialize:Is,globalPreload:Ms}=Ut;export{hs as default,ys as getSource,Ms as globalPreload,Is as initialize,bs as load,js as resolve,Gt as strict,zt as strictest}; | ||
var Ke=Object.defineProperty;var Ae=(e,t)=>{for(var o in t)Ke(e,o,{get:t[o],enumerable:!0})};import Ne from"node:module";var C={};Ae(C,{default:()=>E,getSource:()=>rt,globalPreload:()=>et,initialize:()=>tt,load:()=>se,resolve:()=>st});import Be from"node:fs/promises";import X from"node:module";import _e from"process";var De=(e,t)=>new Error(`invalid moduleId: "${e}" (used by ${t})`),Ge=(e,t)=>new Error(`un-mocked moduleId: "${e}" (used by ${t})`),ze=()=>new Error("For versions of node prior to v20.6.0, the loader chain process must include esmock. start the process using --loader=esmock."),Ue=(e,t)=>new Error(`no mocks provided for module: "${e}" (used by ${t})`),f={errModuleIdNotFound:De,errModuleIdNotMocked:Ge,errMissingLoader:ze,errModuleIdNoDefs:Ue};var[V,Le]=_e.versions.node.split(".").map(e=>+e),Y=V<16||V===16&&Le<12,k=import.meta.url,Ve=/\?esmkgdefs=.*/,ee=/.*\?esmkgdefs=/,x=/#-#esmkdefs/,W=/^file:\/\/\/import\?/,We=/file:\/\/\/import\?([^#]*)/,Ze=/\bimport,|,import\b|\bimport\b/g,S=/esmkTreeId=\d*/,qe=/esmkModuleId=([^&]*)/,Z=/\?esmk=\d*/,$=/.*exportNames=(.*)/,He=/.*#-#/,Je=/isesm=true/,Qe=/isfound=false/,Xe=/^(commonjs|module)$/,Ye=/strict=3/,q=/^(#![^\n]*\n)/,H=(e,t)=>new RegExp(`.*(${e}(\\?${t}(?:(?!#-#).)*)).*`),O=global.mockKeys=global.mockKeys||{},et=!X.register&&(({port:e})=>(e.addEventListener("message",t=>O[t.data.key]=t.data.keylong),e.unref(),"global.postMessageEsmk = d => port.postMessage(d)")),tt=X.register&&(e=>{e&&e.port&&e.port.on("message",t=>{O[t.key]=t.keylong})}),J=e=>{let[t,o]=e.match(We)||[];return[t,$.test(o)&&o.replace($,"$1").split(",")]},ot=e=>{let t=e.split(x)[1]||"",o=J(t),s=e.replace(ee,""),r=J(s);return[o[0]||r[0],[...new Set([o[1]||[],r[1]||[]].flat())]]},te=e=>Z.test(e)&&O[e.match(Z)[0].split("=")[1]],Q=async(e,t,o)=>o.parentURL&&(o.conditions.slice(-1)[0]==="node-addons"||o.importAssertions||Y)?e(t,o):e(t),st=async(e,t,o)=>{let{parentURL:s}=t,r=te(s)||s;if(!S.test(r))return Q(o,e,t);let[c]=String(r).match(S),[n,l]=r.split(x),a=n&&n.replace(ee,"");if(r.includes(`esmkModuleId=${e}&isfound=false`)){let I=H(`file:///${e}`,c),M=(a.match(I)||l.match(I)||[])[2];if(M)return{shortCircuit:!0,url:k+M}}if(W.test(e))return{shortCircuit:!0,url:e.replace(W,k+"?")};let m=await Q(o,e,t),p=H(m.url,c),d=p.test(l)&&l.replace(p,"$1")||p.test(a)&&a.replace(p,"$1");if(d?m.url=Je.test(d)?d:k+"#-#"+d:a&&a!=="0"&&(m.url.startsWith("node:")||(m.url+="?esmkgdefs="+a)),Ye.test(r)&&!d)throw f.errModuleIdNotMocked(m.url,r.split("?")[0]);return m},oe=k+"?esmock-loader=true",E=(e=>async()=>e=e||(await import(oe)).default===!0)(),se=async(e,t,o)=>{if(e===oe)return{format:"module",shortCircuit:!0,responseURL:e,source:"export default true"};let s=te(e)||e;if(s&&(s.match(S)||[])[0]){let[n,l]=ot(s);if(l&&l.length){let a=await o(e,t);if(!Xe.test(a.format))return a;let m=a.source===null||a.source===void 0,p=String(m?await Be.readFile(new URL(e)):a.source),d=(p.match(q)||[])[0]||"",I=d?p.replace(q,""):p,M=a.format==="commonjs"?`const {${l}} = global.esmockCacheGet("${n}");`:`import {${l}} from '${n}';`;return{format:a.format,shortCircuit:!0,responseURL:encodeURI(e),source:d+M+I}}}if(x.test(e))return o(e,t);e=e.replace(Ve,""),e.startsWith(k)&&(e=e.replace(He,""),Qe.test(e)&&(e=e.replace(k,`file:///${e.match(qe)[1]}`)));let c=$.test(e)&&e.replace($,"$1").replace(Ze,"").split(",");return c&&c[0]?{format:"module",shortCircuit:!0,responseURL:encodeURI(e),source:c.map(n=>n==="default"?`export default global.esmockCacheGet("${e}").default`:`export const ${n} = global.esmockCacheGet("${e}").${n}`).join(` | ||
`)}:o(e,t)},rt=Y&&se;import Ot from"fs";import ue from"fs";import pe from"url";import i from"path";import de from"module";var F=de.createRequire(import.meta.url),re=ue.realpathSync.native,fe=new RegExp("^(?:node:)?("+de.builtinModules.join("|").replace("/","/")+")$"),nt=/^\.?\.?([a-zA-Z]:)?(\/|\\)/,N=/^.\.?(?=\/|\\)/,ne=/\\/g,ct=/index.[tj]sx?$/,it=/[\\/]resolvewithplus[\\/]/,ce=/\.js$/,at=/\.ts$/,lt=/(^@[^/]*\/[^/]*|^[^/]*)\/?(.*)$/,T=/^#/,ge=/(\*)/g,ke=/([./])/g,mt=/^node:/,ut=/^file:/,he=[".js",".mjs",".ts",".tsx",".json",".node"],ie="node_modules",R="package.json",ae="node",le="default",K="import",w=".",ye=e=>e&&typeof e=="object",P={},pt=e=>mt.test(e)?e:`node:${e}`,dt=e=>e&&pe.pathToFileURL(e).href,ft=e=>fe.test(e),gt=e=>ut.test(e)?pe.fileURLToPath(e):e,kt=e=>i.resolve(i.extname(e)?i.dirname(e):e)+i.sep,v=e=>ne.test(e)?e.replace(ne,i.posix.sep):e,g=(e,t)=>{try{t=ue.statSync(e)}catch{t=!1}return t&&(t.isFile()||t.isFIFO())},be=e=>e.split(i.sep).reduce((t,o,s)=>(o===ie&&!it.test(e)||(o=s?i.join(t[0][s-1],o):o||i.sep,t[0].push(o),t[1].push(i.resolve(i.join(o,ie)))),t),[[],[]])[1].reverse(),ht=e=>{let t=e.split(i.sep).slice(1).reduce((o,s,r)=>(o.push(i.resolve(i.join(r?o[r-1]:i.sep,s))),o),[]).reverse().find(o=>g(i.join(o,R)));return t&&i.join(t,R)},yt=e=>(String(e).match(lt)||[]).slice(1),me=(e,t)=>new RegExp(e.replace(ke,"\\$1").replace(ge,".*")).test(t),bt=(e,t,o)=>{let s=new RegExp(e.replace(ke,"\\$1").replace(ge,"(.*)")),r=(o.match(s)||[])[1];return r&&t.replace("*",r)},je=(e,t,o,s=!1)=>(me(e,o)&&(t.includes("*")?me(t,o)?s=o:e.includes("*")&&e!==t&&(s=bt(e,t,o)):s=t),s),Ie=(e,t,o,s=e[0])=>e.length?(T.test(o)?T.test(s):N.test(s))&&typeof t[s]=="string"&&je(s,t[s],o)||Ie(e.slice(1),t,o):null,u=(e,t)=>{let o=!1;return typeof e=="string"?e:(!o&&Array.isArray(e)&&(o=e.reduce((s,r)=>s||u(r,t),null)),!o&&ye(e)&&(typeof e[t]=="string"&&(o=e[t]),!o&&e[ae]&&(o=u(e[ae],t)),!o&&e[le]&&(o=u(e[le],t)),!o&&e[t]&&(o=u(e[t],t)),!o&&e[w]&&(o=typeof e[w]=="string"?t===K&&u(e[w],t):u(e[w],t)),o||(o=Ie(Object.keys(e),e,t))),o)},Me=(e,t)=>{let o=t&&t.ismodule&&e.module,s=o||t&&t.browser&&e.browser,r=e.exports,c,n;return s&&(typeof s=="string"?n=s:ye(s)&&([c]=Object.keys(s).filter(l=>ct.test(l)),n=c in s&&s[c])),r&&(n=u(r,K)),n},y=(e,t={})=>{var o=null,s=t.isTypescript&&ce.test(e)&&e.replace(ce,".ts");return g(s)?o=s:g(e)?o=e:he.some(r=>g(e+r)&&(o=e+r)),o},$e=(e,t)=>{let o=null,s,r=i.join(e,R),c=g(r)&&F(r);return(s=Me(c,t))?o=y(i.join(e,s)):(s=c.main)?o=y(i.join(e,s),t)||y(i.join(e,i.join(s,"index"))):he.some(n=>(n=i.join(e,`index${n}`))&&g(n)&&(o=n)),o},we=(e,t,o)=>{let s=N.test(e)?i.join(t,e):e;return y(s,o)||$e(s,o)},jt=(e,t,o)=>{let s=o&&o.imports,r=u(s,t);return r&&(N.test(r)?i.join(e,r):Re(r,e,{isposixpath:!0}))},It=(e,t,o,s)=>{let r=u(s&&s.exports,o?"./"+o:K);return r&&i.join(e,t,r)},Mt=(e,t,o,s)=>{let r=i.join(e,t,R),c=g(r),n=c&&F(r);return c&&It(e,t,o,n,s)},$t=(e,t,o)=>{let s=ht(t),r=i.dirname(s);return s&&jt(r,e,F(s),o)},wt=(e,t,o)=>{let[s,r]=yt(e);if(T.test(s))return $t(e,t,o);let c=be(t).sort((n,l)=>n.length>l.length);return function n(l,a,m=a-1){return a--?Mt(i.join(l[m-a]),s,r,o)||we(i.join(l[m-a],e),null,o)||n(c,a,m):null}(c,c.length)},Rt=(e,t,o)=>{var s=null;return t=typeof t=="string"?kt(gt(decodeURI(t))):process.cwd(),fe.test(e)?s=pt(e):(s=nt.test(e)?we(v(e),t,o):wt(e,t,o),s=s&&(o.isposixpath?re(s):dt(v(re(s))))),s},St=(e,t,o)=>(o=o||{},o.isTypescript=typeof o.isTypescript=="boolean"?o.isTypescript:at.test(t),o),Re=(e,t,o)=>{let s=P[e+t];return s||(o=St(e,t,o),s=Rt(e,t,o),P[e+t]=s)},b=Object.assign(Re,{pathToPosix:v,getasnode_module_paths:be,getesmkeyvalmatch:je,getasfilesync:y,getasdirsync:$e,gettargetindex:Me,iscoremodule:ft,esmparse:u,cache:P});var Se=/(^\s*|[});\n]\s*)(import\s+(['"]|(\*\s+as\s+)?[^"'()\n;]+\s+from\s+['"]|\{)|export\s+\*\s+from\s+["']|export\s+(\{|default|function|class|var|const|let|async\s+function))/;import xe from"node:module";import Oe from"node:worker_threads";var A=Oe.MessageChannel&&new Oe.MessageChannel,Ee=(e=>()=>(typeof e=="boolean"||(e=!!xe.register)&&xe.register("./esmockLoader.js",{parentURL:import.meta.url,data:{port:A.port2},transferList:[A.port2]}),e))(),Ce=Object.assign(e=>{Ee()?A.port1.postMessage(e):typeof global.postMessageEsmk=="function"&&global.postMessageEsmk(e)},{register:Ee});var D={isESM:{},mockDefs:{}},Te=(e,t)=>(Ce({key:e,keylong:t}),global.mockKeys[String(e)]=t),G=e=>global.mockKeys[String(e)],z=(e,t)=>global.esmockCache.mockDefs[e]=t,xt=e=>global.esmockCache.mockDefs[e],Pe=e=>D.isESM[e],ve=(e,t)=>D.isESM[e]=t;Object.assign(global,{esmockCache:D,esmockCacheGet:xt,esmockTreeIdGet:G,mockKeys:global.mockKeys||{}});var U=e=>typeof e=="object"&&e,B=e=>U(e)&&"default"in e,Et=/^\.?\.?([a-zA-Z]:)?(\/|\\)/,Ct=((e=0)=>()=>++e)(),Tt=Object.getPrototypeOf({}),Pt=e=>Object.getPrototypeOf(e)===Tt,vt=(e,t)=>Pt(e)?Object.assign({},e,t):Object.assign(Object.keys(e).reduce((o,s)=>(Object.defineProperty(o,s,{value:e[s],writable:!0}),o),Object.create(e)),t),Ft=(e,t)=>U(e)&&U(t)?vt(e,t):t,Nt=(e,t,o)=>o===null?Object.assign({},e||{},t):(t=Object.assign({},e||{},{default:Ft(B(e)&&e.default,B(t)?t.default:t)},t),!b.iscoremodule(o)&&Object.isExtensible(t.default)&&(t.default.default=t.default),t),Kt=(e,t)=>(t=Pe(e),typeof t=="boolean"||(t=!b.iscoremodule(e)&&Et.test(e)&&Se.test(Ot.readFileSync(e,"utf-8")),ve(e,t)),t),At=(e,t)=>{let o=B(e)&&e.default;return/boolean|string|number/.test(typeof o)?e:Object.isExtensible(o)?Object.assign(o,e,{esmkTreeId:t}):Object.assign({},o,e,{esmkTreeId:t})},Dt=e=>{let t=c=>c==="null"||z(c,null),o=G(e.split("esmk=")[1]),[s,r]=o.split("#-#esmkdefs=");String(r).split("#-#").forEach(t),String(s.split("esmkgdefs=")[1]).split("#-#").forEach(t)},Gt=async(e,t,o,s,r)=>{t=Nt(r.strict||!s||await import(s),t,s);let c=(s||"file:///"+o)+"?"+["esmkTreeId="+e,"esmkModuleId="+o,"isfound="+!!s,"isesm="+Kt(s),"exportNames="+Object.keys(t).sort().join()].join("&");return z(c,t),c},_=async(e,t,o,s,r,c,n)=>{if(s=s||Object.keys(o),n=s[0],c=c||[],!n)return c;let l=b(n,e);if(!l&&r.isModuleNotFoundError!==!1&&n!=="import")throw f.errModuleIdNotFound(n,e);return c.push(await Gt(t,o[n],n,l,r)),_(e,t,o,s.slice(1),r,c)},zt=async(e,t,o,s,r)=>{let c=b(e,t);if(!c)throw f.errModuleIdNotFound(e,t);let n=s?Object.keys(s):[],l=o?Object.keys(o):[];if(r.strict===3&&!n.length&&!l.length)throw f.errModuleIdNoDefs(e,t);let a=typeof r.id=="number"?r.id:Ct(),m=`${c}?key=${a}&strict=${r.strict}?`+["esmkgdefs="+(n.length&&(await _(t,a,s,n,r)).join("#-#")||0),"esmkdefs=",l.length&&(await _(t,a,o,l,r)).join("#-#")||0].join("#-#");return Te(String(a),m),c+`?esmk=${a}`},j=Object.assign(zt,{purge:Dt,sanitize:At});var Ut=/^.*(\(|at )(.*):[\d]*:[\d]*.*$/,Fe=(e,t)=>(e=typeof e[1]=="string"?e:[e[0],new Error().stack.split(` | ||
`)[3].replace(Ut,"$2"),...e.slice(1)],e[4]={...e[4],...t},e);var h=e=>async(...t)=>{let[o,s,r,c,n]=Fe(t,e);if(!Ne.register&&!await E())throw f.errMissingLoader();let l=await j(o,s,r,c,n),a=await import(l);return n.purge!==!1&&j.purge(l),j.sanitize(a,l)},L=e=>e&&/object|function/.test(typeof e)&&"esmkTreeId"in e&&j.purge(e.esmkTreeId),Bt=Object.assign(h({strict:1}),{purge:L,p:h({strict:1,purge:!1})}),_t=Object.assign(h({strict:3}),{purge:L,p:h({strict:3,purge:!1})}),Io=Object.assign(h(),{purge:L,p:h({purge:!1}),strict:Bt,strictest:_t});var Lt=Ne.register?{}:C,{load:Mo,resolve:$o,getSource:wo,initialize:Ro,globalPreload:So}=Lt;export{Io as default,wo as getSource,So as globalPreload,Ro as initialize,Mo as load,$o as resolve,Bt as strict,_t as strictest}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23318
143