esm-wallaby
Version:
Tomorrow's ECMAScript modules today!
1 lines • 2.14 kB
JavaScript
require("module").Module._extensions[".js"]=function(e,t){e._compile(require("fs").readFileSync(t,"utf8"),t)};const e=(function(){return this||Function("return this")()})(),{apply:t,defineProperty:n}=Reflect,{freeze:r}=Object,{hasOwnProperty:l}=Object.prototype,o=Symbol.for,{type:i,versions:u}=process,{filename:a,id:s,parent:c}=module,_=x(u,"electron"),p=_&&"renderer"===i;let d="";"string"==typeof s&&s.startsWith("internal/")&&(d=w("internal/esm/loader"));const f=require("module"),{Script:m}=require("vm"),{createCachedData:y,runInNewContext:h,runInThisContext:b}=m.prototype,{sep:g}=require("path"),{readFileSync:v}=require("fs"),q=new f(s);function w(e){let t;try{const{internalBinding:n}=require("internal/bootstrap/loaders"),r=n("natives");x(r,e)&&(t=r[e])}catch(e){}return"string"==typeof t?t:""}function x(e,n){return null!=e&&t(l,e,[n])}function j(){return k(require,q,T),q.exports}function D(e,t){return j()(e,t)}function F(e,t){try{return v(e,t)}catch(e){}return null}let O,S;q.filename=a,q.parent=c;let C="",I="";""!==d?(I=d,S={__proto__:null,filename:"esm.js"}):(C=__dirname+g+"node_modules"+g+".cache"+g+"esm",O=F(C+g+".data.blob"),I=F(__dirname+g+"esm"+g+"loader.js","utf8"),null===O&&(O=void 0),null===I&&(I=""),S={__proto__:null,cachedData:O,filename:a,produceCachedData:"function"!=typeof y});const M=new m("const __global__ = this;(function (require, module, __shared__) { "+I+"\n});",S);let k,T;if(k=p?t(b,M,[{__proto__:null,filename:a}]):t(h,M,[{__proto__:null,global:e},{__proto__:null,filename:a}]),T=j(),""!==C){const{dir:e}=T.package;let t=e.get(C);if(void 0===t){let n=O;void 0===n&&(n=null),t={buffer:O,compile:new Map([["esm",{circular:0,code:null,codeWithTDZ:null,filename:null,firstAwaitOutsideFunction:null,firstReturnOutsideFunction:null,mtime:-1,scriptData:n,sourceType:1,transforms:0,yieldIndex:-1}]]),meta:new Map},e.set(C,t)}const{pendingScripts:n}=T;let r=n.get(C);void 0===r&&(r=new Map,n.set(C,r)),r.set("esm",M)}n(D,T.symbol.package,{__proto__:null,value:!0}),n(D,T.customInspectKey,{__proto__:null,value:()=>"esm enabled"}),n(D,o("esm:package"),{__proto__:null,value:!0}),r(D),module.exports=D;