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