Comparing version 2.3.6 to 2.3.7
{ | ||
"name": "esmock", | ||
"type": "module", | ||
"version": "2.3.6", | ||
"version": "2.3.7", | ||
"license": "ISC", | ||
@@ -16,3 +16,3 @@ "readmeFilename": "README.md", | ||
"type": "git", | ||
"url": "https://github.com/iambumblehead/esmock.git" | ||
"url": "git+https://github.com/iambumblehead/esmock.git" | ||
}, | ||
@@ -19,0 +19,0 @@ "contributors": [ |
@@ -86,3 +86,3 @@ ```diff | ||
assert.deepEqual(await userCount(), 2) | ||
assert.equal(await userCount(), 2) | ||
}) | ||
@@ -89,0 +89,0 @@ |
@@ -1,3 +0,3 @@ | ||
import ve from"process";var g=import.meta.url;var Ee=(e,t)=>new Error(`invalid moduleId: "${e}" (used by ${t})`),Oe=(e,t)=>new Error(`un-mocked moduleId: "${e}" (used by ${t})`),Se=()=>new Error("the loader chain process must include esmock. start the process using --loader=esmock."),Ce=(e,t)=>new Error(`no mocks provided for module: "${e}" (used by ${t}`),p={errModuleIdNotFound:Ee,errModuleIdNotMocked:Oe,errMissingLoader:Se,errModuleIdNoDefs:Ce};var[V,Fe]=ve.versions.node.split(".").map(e=>+e),H=V<16||V===16&&Fe<12,Te=/\?esmkgdefs=.*/,Q=/.*\?esmkgdefs=/,E=/#-#esmkdefs/,W=/^file:\/\/\/import\?/,Pe=/file:\/\/\/import\?([^#]*)/,Ae=/\bimport,|,import\b|\bimport\b/g,x=/esmkTreeId=\d*/,Ne=/esmkModuleId=([^&]*)/,_=/\?esmk=\d*/,w=/.*exportNames=(.*)/,De=/.*#-#/,Ge=/isesm=true/,Ke=/isfound=false/,q=/^(#![^\n]*\n)/,Tt=({port:e})=>(e.addEventListener("message",t=>global.mockKeys[t.data.key]=t.data.keylong),e.unref(),"global.postMessageEsmk = d => port.postMessage(d)"),B=e=>{let[t,s]=e.match(Pe)||[];return[t,w.test(s)&&s.replace(w,"$1").split(",")]},Ue=e=>{let t=e.split(E)[1]||"",s=B(t),o=e.replace(Q,""),r=B(o);return[s[0]||r[0],[...new Set([s[1]||[],r[1]||[]].flat())]]},J=e=>_.test(e)&&global.esmockTreeIdGet(e.match(_)[0].split("=")[1]),Z=async(e,t,s)=>s.parentURL&&(s.conditions.slice(-1)[0]==="node-addons"||s.importAssertions||H)?e(t,s):e(t),Pt=async(e,t,s)=>{let{parentURL:o}=t,r=J(o)||o;if(!x.test(r))return Z(s,e,t);let[c]=String(r).match(x),[n,a]=r.split(E),l=n&&n.replace(Q,"");if(r.includes(`esmkModuleId=${e}&isfound=false`)){let M=new RegExp(".*file:///"+e+"(\\?"+c+"(?:(?!#-#).)*).*"),z=(l.match(M)||a.match(M)||[])[1];if(z)return{shortCircuit:!0,url:g+z}}if(W.test(e))return{shortCircuit:!0,url:e.replace(W,g+"?")};let m=await Z(s,e,t),d=new RegExp(".*("+m.url+"\\?"+c+"(?:(?!#-#).)*).*"),f=d.test(a)&&a.replace(d,"$1")||d.test(l)&&l.replace(d,"$1");if(f?m.url=Ge.test(f)?f:g+"#-#"+f:l&&l!=="0"&&(m.url.startsWith("node:")||(m.url+="?esmkgdefs="+l)),/strict=3/.test(r)&&!f)throw p.errModuleIdNotMocked(m.url,r.split("?")[0]);return m},L="esmock-loader=true",ze=e=>`${e}?${L}`,X=async e=>(await import(ze(e))).default===!0,Ve=async(e,t,s)=>{if(e.endsWith(L))return{format:"module",shortCircuit:!0,responseURL:e,source:"export default true"};let o=J(e)||e;if(o&&(o.match(x)||[])[0]){let[n,a]=Ue(o);if(a&&a.length){let l=await s(e,t),m=String(l.source),d=(m.match(q)||[])[0]||"",f=d?m.replace(q,""):m,M=t.format==="commonjs"?`const {${a}} = require('${n}');`:`import {${a}} from '${n}';`;return{format:l.format,shortCircuit:!0,responseURL:encodeURI(e),source:d+M+f}}}if(E.test(e))return s(e,t);e=e.replace(Te,""),e.startsWith(g)&&(e=e.replace(De,""),Ke.test(e)&&(e=e.replace(g,`file:///${e.match(Ne)[1]}`)));let c=w.test(e)&&e.replace(w,"$1").replace(Ae,"").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)},At=H&&Ve;var Y=(e=>async()=>e=e||X(import.meta.url))();import mt from"fs";import ut from"node:url";import ce from"fs";import ie from"url";import i from"path";import ae from"module";var v=ae.createRequire(import.meta.url),ee=ce.realpathSync.native,le=new RegExp("^(?:node:)?("+ae.builtinModules.join("|").replace("/","/")+")$"),We=/^\.?\.?([a-zA-Z]:)?(\/|\\)/,F=/^.\.?(?=\/|\\)/,te=/\\/g,_e=/index.[tj]sx?$/,qe=/[\\/]resolvewithplus[\\/]/,Be=/(^@[^/]*\/[^/]*|^[^/]*)\/?(.*)$/,O=/^#/,me=/(\*)/g,ue=/([./])/g,Ze=/^node:/,He=/^file:/,pe=[".js",".mjs",".ts",".tsx",".json",".node"],se="node_modules",$="package.json",oe="node",re="default",T="import",R=".",de=e=>e&&typeof e=="object",S={},Qe=e=>Ze.test(e)?e:`node:${e}`,Je=e=>e&&ie.pathToFileURL(e).href,Le=e=>le.test(e),Xe=e=>He.test(e)?ie.fileURLToPath(e):e,Ye=e=>i.resolve(i.extname(e)?i.dirname(e):e)+i.sep,C=e=>te.test(e)?e.replace(te,i.posix.sep):e,k=(e,t)=>{try{t=ce.statSync(e)}catch{t=!1}return t&&(t.isFile()||t.isFIFO())},fe=e=>e.split(i.sep).reduce((t,s,o)=>(s===se&&!qe.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,se)))),t),[[],[]])[1].reverse(),et=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,$)));return t&&i.join(t,$)},tt=e=>(String(e).match(Be)||[]).slice(1),ne=(e,t)=>new RegExp(e.replace(ue,"\\$1").replace(me,".*")).test(t),st=(e,t,s)=>{let o=new RegExp(e.replace(ue,"\\$1").replace(me,"(.*)")),r=(s.match(o)||[])[1];return r&&t.replace("*",r)},ge=(e,t,s,o=!1)=>(ne(e,s)&&(t.includes("*")?ne(t,s)?o=s:e.includes("*")&&e!==t&&(o=st(e,t,s)):o=t),o),ke=(e,t,s,o=e[0])=>e.length?(O.test(s)?O.test(o):F.test(o))&&typeof t[o]=="string"&&ge(o,t[o],s)||ke(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&&de(e)&&(typeof e[t]=="string"&&(s=e[t]),!s&&e[oe]&&(s=u(e[oe],t)),!s&&e[re]&&(s=u(e[re],t)),!s&&e[t]&&(s=u(e[t],t)),!s&&e[R]&&(s=typeof e[R]=="string"?t===T&&u(e[R],t):u(e[R],t)),s||(s=ke(Object.keys(e),e,t))),s)},he=(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:de(o)&&([c]=Object.keys(o).filter(a=>_e.test(a)),n=c in o&&o[c])),r&&(n=u(r,T)),n},j=e=>{var t=null;return k(e)?t=e:pe.some(s=>k(e+s)&&(t=e+s)),t},ye=(e,t)=>{let s=null,o,r=i.join(e,$),c=k(r)&&v(r);return(o=he(c,t))?s=j(i.join(e,o)):(o=c.main)?s=j(i.join(e,o))||j(i.join(e,i.join(o,"index"))):pe.some(n=>(n=i.join(e,`index${n}`))&&k(n)&&(s=n)),s},be=(e,t,s)=>{let o=F.test(e)?i.join(t,e):e;return j(o,s)||ye(o,s)},ot=(e,t,s)=>{let o=s&&s.imports,r=u(o,t);return r&&(F.test(r)?i.join(e,r):je(r,e,{isposixpath:!0}))},rt=(e,t,s,o)=>{let r=u(o&&o.exports,s?"./"+s:T);return r&&i.join(e,t,r)},nt=(e,t,s,o)=>{let r=i.join(e,t,$),c=k(r),n=c&&v(r);return c&&rt(e,t,s,n,o)},ct=(e,t,s)=>{let o=et(t),r=i.dirname(o);return o&&ot(r,e,v(o),s)},it=(e,t,s)=>{let[o,r]=tt(e);if(O.test(o))return ct(e,t,s);let c=fe(t).sort((n,a)=>n.length>a.length);return function n(a,l,m=l-1){return l--?nt(i.join(a[m-l]),o,r,s)||be(i.join(a[m-l],e),null,s)||n(c,l,m):null}(c,c.length)},at=(e,t,s)=>{var o=null;return t=typeof t=="string"?Ye(Xe(decodeURI(t))):process.cwd(),le.test(e)?o=Qe(e):(o=We.test(e)?be(C(e),t,s):it(e,t),o=o&&(s.isposixpath?ee(o):Je(C(ee(o))))),o},je=(e,t,s)=>{let o=S[e+t];return o||(o=at(e,t,s||{}),S[e+t]=o)},h=Object.assign(je,{pathToPosix:C,getasnode_module_paths:fe,getesmkeyvalmatch:ge,getasfilesync:j,getasdirsync:ye,gettargetindex:he,iscoremodule:Le,esmparse:u,cache:S});var Ie=/(^\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))/;var P={isESM:{},mockDefs:{}},Me=(e,t)=>(typeof global.postMessageEsmk=="function"&&global.postMessageEsmk({key:e,keylong:t}),global.mockKeys[String(e)]=t),A=e=>global.mockKeys[String(e)],N=(e,t)=>global.esmockCache.mockDefs[e]=t,lt=e=>global.esmockCache.mockDefs[e],we=e=>P.isESM[e],Re=(e,t)=>P.isESM[e]=t;Object.assign(global,{esmockCache:P,esmockCacheGet:lt,esmockTreeIdGet:A,mockKeys:{}});var D=e=>typeof e=="object"&&e,G=e=>D(e)&&"default"in e,pt=/^\.?\.?([a-zA-Z]:)?(\/|\\)/,dt=typeof import.meta.resolve=="function",ft=((e=0)=>()=>++e)(),$e=e=>e.startsWith("file://")?e:ut.pathToFileURL(e),gt=Object.getPrototypeOf({}),kt=e=>Object.getPrototypeOf(e)===gt,y=dt?import.meta.resolve.constructor.name==="AsyncFunction"?async(e,t)=>import.meta.resolve(e,$e(t)).catch(()=>h(e,t)):(e,t)=>{try{return import.meta.resolve(e,$e(t))}catch{return h(e,t)}}:h,ht=(e,t)=>kt(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),yt=(e,t)=>D(e)&&D(t)?ht(e,t):t,bt=(e,t,s)=>s===null?Object.assign({},e||{},t):(t=Object.assign({},e||{},{default:yt(G(e)&&e.default,G(t)?t.default:t)},t),!h.iscoremodule(s)&&Object.isExtensible(t.default)&&(t.default.default=t.default),t),jt=(e,t)=>(t=we(e),typeof t=="boolean"||(t=!h.iscoremodule(e)&&pt.test(e)&&Ie.test(mt.readFileSync(e,"utf-8")),Re(e,t)),t),It=(e,t)=>{let s=G(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})},Mt=e=>{let t=c=>c==="null"||N(c,null),s=A(e.split("esmk=")[1]),[o,r]=s.split("#-#esmkdefs=");String(r).split("#-#").forEach(t),String(o.split("esmkgdefs=")[1]).split("#-#").forEach(t)},wt=async(e,t,s,o,r)=>{t=bt(r.strict||!o||await import(o),t,o);let c=(o||"file:///"+s)+"?"+["esmkTreeId="+e,"esmkModuleId="+s,"isfound="+!!o,"isesm="+jt(o),"exportNames="+Object.keys(t).sort().join()].join("&");return N(c,t),c},K=async(e,t,s,o,r,c,n)=>{if(o=o||Object.keys(s),n=o[0],c=c||[],!n)return c;let a=y.constructor.name==="AsyncFunction"?await y(n,e):y(n,e);if(!a&&r.isModuleNotFoundError!==!1&&n!=="import")throw p.errModuleIdNotFound(n,e);return c.push(await wt(t,s[n],n,a,r)),K(e,t,s,o.slice(1),r,c)},Rt=async(e,t,s,o,r)=>{let c=y.constructor.name==="AsyncFunction"?await y(e,t):y(e,t);if(!c)throw p.errModuleIdNotFound(e,t);let n=o?Object.keys(o):[],a=s?Object.keys(s):[];if(r.strict===3&&!n.length&&!a.length)throw p.errModuleIdNoDefs(e,t);let l=typeof r.id=="number"?r.id:ft(),m=`${c}?key=${l}&strict=${r.strict}?`+["esmkgdefs="+(n.length&&(await K(t,l,o,n,r)).join("#-#")||0),"esmkdefs=",a.length&&(await K(t,l,s,a,r)).join("#-#")||0].join("#-#");return Me(String(l),m),c+`?esmk=${l}`},I=Object.assign(Rt,{purge:Mt,sanitize:It});var $t=/^.*(\(|at )(.*):[\d]*:[\d]*.*$/,xe=(e,t)=>(e=typeof e[1]=="string"?e:[e[0],new Error().stack.split(` | ||
`)[3].replace($t,"$2"),...e.slice(1)],e[4]={...e[4],...t},e);var b=e=>async(...t)=>{let[s,o,r,c,n]=xe(t,e);if(!await Y())throw p.errMissingLoader();let a=await I(s,o,r,c,n),l=await import(a);return n.purge!==!1&&I.purge(a),I.sanitize(l,a)},U=e=>e&&/object|function/.test(typeof e)&&"esmkTreeId"in e&&I.purge(e.esmkTreeId),xt=Object.assign(b({strict:1}),{purge:U,p:b({strict:1,purge:!1})}),Et=Object.assign(b({strict:3}),{purge:U,p:b({strict:3,purge:!1})}),rs=Object.assign(b(),{purge:U,p:b({purge:!1}),strict:xt,strictest:Et});export{rs as default,At as getSource,Tt as globalPreload,Ve as load,X as loaderIsVerified,Pt as resolve,xt as strict,Et as strictest}; | ||
import ve from"process";var g=import.meta.url;var Ee=(e,t)=>new Error(`invalid moduleId: "${e}" (used by ${t})`),Oe=(e,t)=>new Error(`un-mocked moduleId: "${e}" (used by ${t})`),Se=()=>new Error("the loader chain process must include esmock. start the process using --loader=esmock."),Ce=(e,t)=>new Error(`no mocks provided for module: "${e}" (used by ${t})`),p={errModuleIdNotFound:Ee,errModuleIdNotMocked:Oe,errMissingLoader:Se,errModuleIdNoDefs:Ce};var[V,Fe]=ve.versions.node.split(".").map(e=>+e),H=V<16||V===16&&Fe<12,Te=/\?esmkgdefs=.*/,Q=/.*\?esmkgdefs=/,E=/#-#esmkdefs/,W=/^file:\/\/\/import\?/,Pe=/file:\/\/\/import\?([^#]*)/,Ae=/\bimport,|,import\b|\bimport\b/g,x=/esmkTreeId=\d*/,Ne=/esmkModuleId=([^&]*)/,_=/\?esmk=\d*/,w=/.*exportNames=(.*)/,De=/.*#-#/,Ge=/isesm=true/,Ke=/isfound=false/,q=/^(#![^\n]*\n)/,Tt=({port:e})=>(e.addEventListener("message",t=>global.mockKeys[t.data.key]=t.data.keylong),e.unref(),"global.postMessageEsmk = d => port.postMessage(d)"),B=e=>{let[t,s]=e.match(Pe)||[];return[t,w.test(s)&&s.replace(w,"$1").split(",")]},Ue=e=>{let t=e.split(E)[1]||"",s=B(t),o=e.replace(Q,""),r=B(o);return[s[0]||r[0],[...new Set([s[1]||[],r[1]||[]].flat())]]},J=e=>_.test(e)&&global.esmockTreeIdGet(e.match(_)[0].split("=")[1]),Z=async(e,t,s)=>s.parentURL&&(s.conditions.slice(-1)[0]==="node-addons"||s.importAssertions||H)?e(t,s):e(t),Pt=async(e,t,s)=>{let{parentURL:o}=t,r=J(o)||o;if(!x.test(r))return Z(s,e,t);let[c]=String(r).match(x),[n,a]=r.split(E),l=n&&n.replace(Q,"");if(r.includes(`esmkModuleId=${e}&isfound=false`)){let M=new RegExp(".*file:///"+e+"(\\?"+c+"(?:(?!#-#).)*).*"),z=(l.match(M)||a.match(M)||[])[1];if(z)return{shortCircuit:!0,url:g+z}}if(W.test(e))return{shortCircuit:!0,url:e.replace(W,g+"?")};let m=await Z(s,e,t),d=new RegExp(".*("+m.url+"\\?"+c+"(?:(?!#-#).)*).*"),f=d.test(a)&&a.replace(d,"$1")||d.test(l)&&l.replace(d,"$1");if(f?m.url=Ge.test(f)?f:g+"#-#"+f:l&&l!=="0"&&(m.url.startsWith("node:")||(m.url+="?esmkgdefs="+l)),/strict=3/.test(r)&&!f)throw p.errModuleIdNotMocked(m.url,r.split("?")[0]);return m},X="?esmock-loader=true",Y=e=>import(e+X).then(t=>t.default===!0),ze=async(e,t,s)=>{if(e.endsWith(X))return{format:"module",shortCircuit:!0,responseURL:e,source:"export default true"};let o=J(e)||e;if(o&&(o.match(x)||[])[0]){let[n,a]=Ue(o);if(a&&a.length){let l=await s(e,t),m=String(l.source),d=(m.match(q)||[])[0]||"",f=d?m.replace(q,""):m,M=t.format==="commonjs"?`const {${a}} = require('${n}');`:`import {${a}} from '${n}';`;return{format:l.format,shortCircuit:!0,responseURL:encodeURI(e),source:d+M+f}}}if(E.test(e))return s(e,t);e=e.replace(Te,""),e.startsWith(g)&&(e=e.replace(De,""),Ke.test(e)&&(e=e.replace(g,`file:///${e.match(Ne)[1]}`)));let c=w.test(e)&&e.replace(w,"$1").replace(Ae,"").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)},At=H&&ze;var L=(e=>()=>e=e||Y(import.meta.url))();import lt from"fs";import mt from"node:url";import ce from"fs";import ie from"url";import i from"path";import ae from"module";var v=ae.createRequire(import.meta.url),ee=ce.realpathSync.native,le=new RegExp("^(?:node:)?("+ae.builtinModules.join("|").replace("/","/")+")$"),Ve=/^\.?\.?([a-zA-Z]:)?(\/|\\)/,F=/^.\.?(?=\/|\\)/,te=/\\/g,We=/index.[tj]sx?$/,_e=/[\\/]resolvewithplus[\\/]/,qe=/(^@[^/]*\/[^/]*|^[^/]*)\/?(.*)$/,O=/^#/,me=/(\*)/g,ue=/([./])/g,Be=/^node:/,Ze=/^file:/,pe=[".js",".mjs",".ts",".tsx",".json",".node"],se="node_modules",$="package.json",oe="node",re="default",T="import",R=".",de=e=>e&&typeof e=="object",S={},He=e=>Be.test(e)?e:`node:${e}`,Qe=e=>e&&ie.pathToFileURL(e).href,Je=e=>le.test(e),Xe=e=>Ze.test(e)?ie.fileURLToPath(e):e,Ye=e=>i.resolve(i.extname(e)?i.dirname(e):e)+i.sep,C=e=>te.test(e)?e.replace(te,i.posix.sep):e,k=(e,t)=>{try{t=ce.statSync(e)}catch{t=!1}return t&&(t.isFile()||t.isFIFO())},fe=e=>e.split(i.sep).reduce((t,s,o)=>(s===se&&!_e.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,se)))),t),[[],[]])[1].reverse(),Le=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,$)));return t&&i.join(t,$)},et=e=>(String(e).match(qe)||[]).slice(1),ne=(e,t)=>new RegExp(e.replace(ue,"\\$1").replace(me,".*")).test(t),tt=(e,t,s)=>{let o=new RegExp(e.replace(ue,"\\$1").replace(me,"(.*)")),r=(s.match(o)||[])[1];return r&&t.replace("*",r)},ge=(e,t,s,o=!1)=>(ne(e,s)&&(t.includes("*")?ne(t,s)?o=s:e.includes("*")&&e!==t&&(o=tt(e,t,s)):o=t),o),ke=(e,t,s,o=e[0])=>e.length?(O.test(s)?O.test(o):F.test(o))&&typeof t[o]=="string"&&ge(o,t[o],s)||ke(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&&de(e)&&(typeof e[t]=="string"&&(s=e[t]),!s&&e[oe]&&(s=u(e[oe],t)),!s&&e[re]&&(s=u(e[re],t)),!s&&e[t]&&(s=u(e[t],t)),!s&&e[R]&&(s=typeof e[R]=="string"?t===T&&u(e[R],t):u(e[R],t)),s||(s=ke(Object.keys(e),e,t))),s)},he=(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:de(o)&&([c]=Object.keys(o).filter(a=>We.test(a)),n=c in o&&o[c])),r&&(n=u(r,T)),n},j=e=>{var t=null;return k(e)?t=e:pe.some(s=>k(e+s)&&(t=e+s)),t},ye=(e,t)=>{let s=null,o,r=i.join(e,$),c=k(r)&&v(r);return(o=he(c,t))?s=j(i.join(e,o)):(o=c.main)?s=j(i.join(e,o))||j(i.join(e,i.join(o,"index"))):pe.some(n=>(n=i.join(e,`index${n}`))&&k(n)&&(s=n)),s},be=(e,t,s)=>{let o=F.test(e)?i.join(t,e):e;return j(o,s)||ye(o,s)},st=(e,t,s)=>{let o=s&&s.imports,r=u(o,t);return r&&(F.test(r)?i.join(e,r):je(r,e,{isposixpath:!0}))},ot=(e,t,s,o)=>{let r=u(o&&o.exports,s?"./"+s:T);return r&&i.join(e,t,r)},rt=(e,t,s,o)=>{let r=i.join(e,t,$),c=k(r),n=c&&v(r);return c&&ot(e,t,s,n,o)},nt=(e,t,s)=>{let o=Le(t),r=i.dirname(o);return o&&st(r,e,v(o),s)},ct=(e,t,s)=>{let[o,r]=et(e);if(O.test(o))return nt(e,t,s);let c=fe(t).sort((n,a)=>n.length>a.length);return function n(a,l,m=l-1){return l--?rt(i.join(a[m-l]),o,r,s)||be(i.join(a[m-l],e),null,s)||n(c,l,m):null}(c,c.length)},it=(e,t,s)=>{var o=null;return t=typeof t=="string"?Ye(Xe(decodeURI(t))):process.cwd(),le.test(e)?o=He(e):(o=Ve.test(e)?be(C(e),t,s):ct(e,t),o=o&&(s.isposixpath?ee(o):Qe(C(ee(o))))),o},je=(e,t,s)=>{let o=S[e+t];return o||(o=it(e,t,s||{}),S[e+t]=o)},h=Object.assign(je,{pathToPosix:C,getasnode_module_paths:fe,getesmkeyvalmatch:ge,getasfilesync:j,getasdirsync:ye,gettargetindex:he,iscoremodule:Je,esmparse:u,cache:S});var Ie=/(^\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))/;var P={isESM:{},mockDefs:{}},Me=(e,t)=>(typeof global.postMessageEsmk=="function"&&global.postMessageEsmk({key:e,keylong:t}),global.mockKeys[String(e)]=t),A=e=>global.mockKeys[String(e)],N=(e,t)=>global.esmockCache.mockDefs[e]=t,at=e=>global.esmockCache.mockDefs[e],we=e=>P.isESM[e],Re=(e,t)=>P.isESM[e]=t;Object.assign(global,{esmockCache:P,esmockCacheGet:at,esmockTreeIdGet:A,mockKeys:{}});var D=e=>typeof e=="object"&&e,G=e=>D(e)&&"default"in e,ut=/^\.?\.?([a-zA-Z]:)?(\/|\\)/,pt=typeof import.meta.resolve=="function",dt=((e=0)=>()=>++e)(),ft=/^file:\/\//,$e=e=>ft.test(e)?e:mt.pathToFileURL(e),gt=Object.getPrototypeOf({}),kt=e=>Object.getPrototypeOf(e)===gt,y=pt?import.meta.resolve.constructor.name==="AsyncFunction"?async(e,t)=>import.meta.resolve(e,$e(t)).catch(()=>h(e,t)):(e,t)=>{try{return import.meta.resolve(e,$e(t))}catch{return h(e,t)}}:h,ht=(e,t)=>kt(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),yt=(e,t)=>D(e)&&D(t)?ht(e,t):t,bt=(e,t,s)=>s===null?Object.assign({},e||{},t):(t=Object.assign({},e||{},{default:yt(G(e)&&e.default,G(t)?t.default:t)},t),!h.iscoremodule(s)&&Object.isExtensible(t.default)&&(t.default.default=t.default),t),jt=(e,t)=>(t=we(e),typeof t=="boolean"||(t=!h.iscoremodule(e)&&ut.test(e)&&Ie.test(lt.readFileSync(e,"utf-8")),Re(e,t)),t),It=(e,t)=>{let s=G(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})},Mt=e=>{let t=c=>c==="null"||N(c,null),s=A(e.split("esmk=")[1]),[o,r]=s.split("#-#esmkdefs=");String(r).split("#-#").forEach(t),String(o.split("esmkgdefs=")[1]).split("#-#").forEach(t)},wt=async(e,t,s,o,r)=>{t=bt(r.strict||!o||await import(o),t,o);let c=(o||"file:///"+s)+"?"+["esmkTreeId="+e,"esmkModuleId="+s,"isfound="+!!o,"isesm="+jt(o),"exportNames="+Object.keys(t).sort().join()].join("&");return N(c,t),c},K=async(e,t,s,o,r,c,n)=>{if(o=o||Object.keys(s),n=o[0],c=c||[],!n)return c;let a=y.constructor.name==="AsyncFunction"?await y(n,e):y(n,e);if(!a&&r.isModuleNotFoundError!==!1&&n!=="import")throw p.errModuleIdNotFound(n,e);return c.push(await wt(t,s[n],n,a,r)),K(e,t,s,o.slice(1),r,c)},Rt=async(e,t,s,o,r)=>{let c=y.constructor.name==="AsyncFunction"?await y(e,t):y(e,t);if(!c)throw p.errModuleIdNotFound(e,t);let n=o?Object.keys(o):[],a=s?Object.keys(s):[];if(r.strict===3&&!n.length&&!a.length)throw p.errModuleIdNoDefs(e,t);let l=typeof r.id=="number"?r.id:dt(),m=`${c}?key=${l}&strict=${r.strict}?`+["esmkgdefs="+(n.length&&(await K(t,l,o,n,r)).join("#-#")||0),"esmkdefs=",a.length&&(await K(t,l,s,a,r)).join("#-#")||0].join("#-#");return Me(String(l),m),c+`?esmk=${l}`},I=Object.assign(Rt,{purge:Mt,sanitize:It});var $t=/^.*(\(|at )(.*):[\d]*:[\d]*.*$/,xe=(e,t)=>(e=typeof e[1]=="string"?e:[e[0],new Error().stack.split(` | ||
`)[3].replace($t,"$2"),...e.slice(1)],e[4]={...e[4],...t},e);var b=e=>async(...t)=>{let[s,o,r,c,n]=xe(t,e);if(!await L())throw p.errMissingLoader();let a=await I(s,o,r,c,n),l=await import(a);return n.purge!==!1&&I.purge(a),I.sanitize(l,a)},U=e=>e&&/object|function/.test(typeof e)&&"esmkTreeId"in e&&I.purge(e.esmkTreeId),xt=Object.assign(b({strict:1}),{purge:U,p:b({strict:1,purge:!1})}),Et=Object.assign(b({strict:3}),{purge:U,p:b({strict:3,purge:!1})}),rs=Object.assign(b(),{purge:U,p:b({purge:!1}),strict:xt,strictest:Et});export{rs as default,At as getSource,Tt as globalPreload,ze as load,Y as loaderIsVerified,Pt as resolve,xt as strict,Et 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
19619