Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

esmock

Package Overview
Dependencies
Maintainers
1
Versions
107
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esmock - npm Package Compare versions

Comparing version 1.9.3 to 1.9.4

4

package.json
{
"name": "esmock",
"type": "module",
"version": "1.9.3",
"version": "1.9.4",
"license": "ISC",

@@ -57,4 +57,4 @@ "readmeFilename": "README.md",

"dependencies": {
"resolvewithplus": "^0.8.5"
"resolvewithplus": "^0.8.7"
}
}

@@ -1,2 +0,2 @@

import{esmockModuleMock as m,esmockModuleImportedPurge as s,esmockModuleImportedSanitize as n}from"./esmockModule.js";import{esmockCache as d}from"./esmockCache.js";const r=async(e,o,t,c={},p)=>{const l=(p||new Error).stack.split(`
`)[2].replace(/^.*file:\/\//,"").replace(/:[\d]*:[\d]*.*$/,"").replace(/^.*:/,"").replace(/.*at [^(]*\(/,"");if(!global.esmockloader)throw new Error("process must be started with --loader=esmock");const a=await m(l,e,o||{},t||{},c),i=await import(a);return c.purge!==!1&&s(a),n(i,a)};r.px=async(e,o,t)=>r(e,o,t,{partial:!0},new Error),r.p=async(e,o,t)=>r(e,o,t,{purge:!1},new Error),r.purge=e=>{e&&/object|function/.test(typeof e)&&"esmockKey"in e&&s(e.esmockKey)},r.esmockCache=d;export default r;
import{esmockModuleMock as m,esmockModuleImportedPurge as s,esmockModuleImportedSanitize as n}from"./esmockModule.js";import{esmockCache as d}from"./esmockCache.js";const r=async(e,t,a,o={},p)=>{const l=(p||new Error).stack.split(`
`)[2].replace(/^.*file:\/\//,"").replace(/:[\d]*:[\d]*.*$/,"").replace(/^.*:/,"").replace(/.*at [^(]*\(/,"");if(!global.esmockloader)throw new Error("process must be started with --loader=esmock");const c=await m(l,e,t||{},a||{},o),i=await import(c);return o.purge!==!1&&s(c),n(i,c)};r.px=async(e,t,a,o)=>r(e,t,a,{...o,partial:!0},new Error),r.p=async(e,t,a,o)=>r(e,t,a,{...o,purge:!1},new Error),r.purge=e=>{e&&/object|function/.test(typeof e)&&"esmockKey"in e&&s(e.esmockKey)},r.esmockCache=d;export default r;

@@ -1,1 +0,1 @@

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};
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=/^node:/.test(e)?"":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};
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