Comparing version 1.8.8 to 1.8.9
{ | ||
"name": "esmock", | ||
"version": "1.8.8", | ||
"version": "1.8.9", | ||
"license": "ISC", | ||
@@ -5,0 +5,0 @@ "readmeFilename": "README.md", |
@@ -1,1 +0,1 @@ | ||
import d from"fs";import f from"path";import l from"resolvewithplus";import{esmockKeySet as k,esmockKeyGet as K,esmockCacheSet as j,esmockCacheResolvedPathIsESMGet as M,esmockCacheResolvedPathIsESMSet as S}from"./esmockCache.js";const y=e=>typeof e=="object"&&e,g=/^(object|function)$/,w=e=>g.test(typeof e)&&e,O=e=>y(e)&&"default"in e,m="file:///",p=(e,s)=>(s||(s=l.iscoremodule(e)?"node:":m),s.includes(m)&&(e=d.realpathSync.native(e)),process.platform==="win32"&&(e=e.split(f.sep).join(f.posix.sep)),`${s}${e.replace(/^\//,"")}`),E=(e,s,o)=>{const c=y(e),t=y(s);return c&&t?o=Object.assign({},e,s):s?o=s:c?o=Object.assign({},e):e&&(o=e),o},x=(e,s,o)=>{const c=l.iscoremodule(o),t=E(O(e)&&e.default,O(s)?s.default:s),n=Object.assign({},e||{},{default:t},s);return!c&&w(n.default)&&(n.default.default=n.default),n},I=/(^\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))/,$=(e,s)=>(s=M(e),typeof s=="boolean"||(s=!l.iscoremodule(e)&&I.test(d.readFileSync(e,"utf-8")),S(e,s)),s),D=(e,s)=>{const o="default"in e&&e.default;return/boolean|string|number/.test(typeof o)?e:Object.prototype.toString.call(o)==="[object Module]"?Object.assign({},o,e,{esmockKey:s}):Object.assign(o,e,{esmockKey:s})},G=e=>{const s=n=>n==="null"||j(n,null),o=K(e.split("esmk=")[1]),[c,t]=o.split("#esmockModuleKeys=");String(t).split("#").forEach(s),String(c.split("esmockGlobals=")[1]).split("#").forEach(s)},R=((e=0)=>()=>++e)(),N=async(e,s,o,c,t)=>{const n=$(o),r=t.partial?await import(p(o)):null,i=x(r,c,o),a=Object.keys(i).sort().join(),u=`${p(o)}?`+["esmockKey="+e,"esmockModuleKey="+s,"isesm="+n,a?"exportNames="+a:"exportNone"].join("&");return j(u,i),u},b=async(e,s,o,c,t,n,r)=>{if(t=t||Object.keys(c),n=n||[],!t.length)return n;let i=l(t[0],e);if(!i)throw e=e.replace(/^\/\//,"").replace(process.cwd(),".").replace(process.env.HOME,"~"),new Error(`not a valid path: "${t[0]}" (used by ${e})`);return process.platform==="win32"&&(i=i.split(f.sep).join(f.posix.sep)),n.push(await N(o,t[0],i,c[t[0]],r)),b(e,s,o,c,t.slice(1),n,r)},C=async(e,s,o,c,t)=>{const n=l(s,e),r=typeof t.key=="number"?t.key:R(),i=await b(e,n,r,o,Object.keys(o),0,t),a=await b(e,n,r,c,Object.keys(c),0,t);if(n===null)throw new Error(`modulePath not found: "${s}"`);const u=p(n,m)+"?"+"key=:esmockKey?esmockGlobals=:esmockGlobals#esmockModuleKeys=:moduleKeys".replace(/:esmockKey/,r).replace(/:esmockGlobals/,a.join("#")||"null").replace(/:moduleKeys/,i.join("#"));return k(String(r),u),p(n,m)+`?esmk=${r}`};export{C as esmockModuleMock,G as esmockModuleImportedPurge,D as esmockModuleImportedSanitize}; | ||
import d from"fs";import f from"path";import l from"resolvewithplus";import{esmockKeySet as O,esmockKeyGet as K,esmockCacheSet as j,esmockCacheResolvedPathIsESMGet as M,esmockCacheResolvedPathIsESMSet as S}from"./esmockCache.js";const y=e=>typeof e=="object"&&e,k=e=>y(e)&&"default"in e,m="file:///",p=(e,s)=>(s||(s=l.iscoremodule(e)?"node:":m),s.includes(m)&&(e=d.realpathSync.native(e)),process.platform==="win32"&&(e=e.split(f.sep).join(f.posix.sep)),`${s}${e.replace(/^\//,"")}`),g=(e,s,o)=>{const c=y(e),t=y(s);return c&&t?o=Object.assign({},e,s):s?o=s:c?o=Object.assign({},e):e&&(o=e),o},w=(e,s,o)=>{const c=l.iscoremodule(o),t=g(k(e)&&e.default,k(s)?s.default:s),n=Object.assign({},e||{},{default:t},s);return!c&&Object.isExtensible(n.default)&&(n.default.default=n.default),n},E=/(^\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))/,x=(e,s)=>(s=M(e),typeof s=="boolean"||(s=!l.iscoremodule(e)&&E.test(d.readFileSync(e,"utf-8")),S(e,s)),s),I=(e,s)=>{const o="default"in e&&e.default;return/boolean|string|number/.test(typeof o)?e:Object.prototype.toString.call(o)==="[object Module]"?Object.assign({},o,e,{esmockKey:s}):Object.assign(o,e,{esmockKey:s})},D=e=>{const s=n=>n==="null"||j(n,null),o=K(e.split("esmk=")[1]),[c,t]=o.split("#esmockModuleKeys=");String(t).split("#").forEach(s),String(c.split("esmockGlobals=")[1]).split("#").forEach(s)},G=((e=0)=>()=>++e)(),$=async(e,s,o,c,t)=>{const n=x(o),r=t.partial?await import(p(o)):null,i=w(r,c,o),a=Object.keys(i).sort().join(),u=`${p(o)}?`+["esmockKey="+e,"esmockModuleKey="+s,"isesm="+n,a?"exportNames="+a:"exportNone"].join("&");return j(u,i),u},b=async(e,s,o,c,t,n,r)=>{if(t=t||Object.keys(c),n=n||[],!t.length)return n;let i=l(t[0],e);if(!i)throw e=e.replace(/^\/\//,"").replace(process.cwd(),".").replace(process.env.HOME,"~"),new Error(`not a valid path: "${t[0]}" (used by ${e})`);return process.platform==="win32"&&(i=i.split(f.sep).join(f.posix.sep)),n.push(await $(o,t[0],i,c[t[0]],r)),b(e,s,o,c,t.slice(1),n,r)},N=async(e,s,o,c,t)=>{const n=l(s,e),r=typeof t.key=="number"?t.key:G(),i=await b(e,n,r,o,Object.keys(o),0,t),a=await b(e,n,r,c,Object.keys(c),0,t);if(n===null)throw new Error(`modulePath not found: "${s}"`);const u=p(n,m)+"?"+"key=:esmockKey?esmockGlobals=:esmockGlobals#esmockModuleKeys=:moduleKeys".replace(/:esmockKey/,r).replace(/:esmockGlobals/,a.join("#")||"null").replace(/:moduleKeys/,i.join("#"));return O(String(r),u),p(n,m)+`?esmk=${r}`};export{N as esmockModuleMock,D as esmockModuleImportedPurge,I as esmockModuleImportedSanitize}; |
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
12031