pyodide 0.28.1 → 0.28.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/pyodide.asm.wasm CHANGED
Binary file
package/pyodide.d.ts CHANGED
@@ -1762,5 +1762,9 @@ export declare function loadPyodide(options?: {
1762
1762
  _snapshotDeserializer?: (obj: any) => any;
1763
1763
  }): Promise<PyodideAPI>;
1764
1764
 
1765
+ export type {
1766
+ PyodideAPI as PyodideInterface,
1767
+ };
1768
+
1765
1769
  export type {};
1766
1770
  export type {Lockfile, LockfileInfo, LockfilePackage, PackageData};
package/pyodide.js CHANGED
@@ -1,6 +1,6 @@
1
- "use strict";var loadPyodide=(()=>{var ce=Object.create;var R=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var de=Object.getOwnPropertyNames;var ue=Object.getPrototypeOf,fe=Object.prototype.hasOwnProperty;var o=(e,t)=>R(e,"name",{value:t,configurable:!0}),m=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var me=(e,t)=>{for(var r in t)R(e,r,{get:t[r],enumerable:!0})},j=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of de(t))!fe.call(e,s)&&s!==r&&R(e,s,{get:()=>t[s],enumerable:!(a=le(t,s))||a.enumerable});return e};var b=(e,t,r)=>(r=e!=null?ce(ue(e)):{},j(t||!e||!e.__esModule?R(r,"default",{value:e,enumerable:!0}):r,e)),pe=e=>j(R({},"__esModule",{value:!0}),e);var H=(()=>{for(var e=new Uint8Array(128),t=0;t<64;t++)e[t<26?t+65:t<52?t+71:t<62?t-4:t*4-205]=t;return r=>{for(var a=r.length,s=new Uint8Array((a-(r[a-1]=="=")-(r[a-2]=="="))*3/4|0),n=0,i=0;n<a;){var c=e[r.charCodeAt(n++)],l=e[r.charCodeAt(n++)],d=e[r.charCodeAt(n++)],f=e[r.charCodeAt(n++)];s[i++]=c<<2|l>>4,s[i++]=l<<4|d>>2,s[i++]=d<<6|f}return s}})();var Ce={};me(Ce,{loadPyodide:()=>$,version:()=>O});function ge(e){return!isNaN(parseFloat(e))&&isFinite(e)}o(ge,"_isNumber");function E(e){return e.charAt(0).toUpperCase()+e.substring(1)}o(E,"_capitalize");function D(e){return function(){return this[e]}}o(D,"_getter");var k=["isConstructor","isEval","isNative","isToplevel"],I=["columnNumber","lineNumber"],N=["fileName","functionName","source"],ye=["args"],be=["evalOrigin"],L=k.concat(I,N,ye,be);function g(e){if(e)for(var t=0;t<L.length;t++)e[L[t]]!==void 0&&this["set"+E(L[t])](e[L[t]])}o(g,"StackFrame");g.prototype={getArgs:o(function(){return this.args},"getArgs"),setArgs:o(function(e){if(Object.prototype.toString.call(e)!=="[object Array]")throw new TypeError("Args must be an Array");this.args=e},"setArgs"),getEvalOrigin:o(function(){return this.evalOrigin},"getEvalOrigin"),setEvalOrigin:o(function(e){if(e instanceof g)this.evalOrigin=e;else if(e instanceof Object)this.evalOrigin=new g(e);else throw new TypeError("Eval Origin must be an Object or StackFrame")},"setEvalOrigin"),toString:o(function(){var e=this.getFileName()||"",t=this.getLineNumber()||"",r=this.getColumnNumber()||"",a=this.getFunctionName()||"";return this.getIsEval()?e?"[eval] ("+e+":"+t+":"+r+")":"[eval]:"+t+":"+r:a?a+" ("+e+":"+t+":"+r+")":e+":"+t+":"+r},"toString")};g.fromString=o(function(t){var r=t.indexOf("("),a=t.lastIndexOf(")"),s=t.substring(0,r),n=t.substring(r+1,a).split(","),i=t.substring(a+1);if(i.indexOf("@")===0)var c=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(i,""),l=c[1],d=c[2],f=c[3];return new g({functionName:s,args:n||void 0,fileName:l,lineNumber:d||void 0,columnNumber:f||void 0})},"StackFrame$$fromString");for(h=0;h<k.length;h++)g.prototype["get"+E(k[h])]=D(k[h]),g.prototype["set"+E(k[h])]=function(e){return function(t){this[e]=!!t}}(k[h]);var h;for(S=0;S<I.length;S++)g.prototype["get"+E(I[S])]=D(I[S]),g.prototype["set"+E(I[S])]=function(e){return function(t){if(!ge(t))throw new TypeError(e+" must be a Number");this[e]=Number(t)}}(I[S]);var S;for(w=0;w<N.length;w++)g.prototype["get"+E(N[w])]=D(N[w]),g.prototype["set"+E(N[w])]=function(e){return function(t){this[e]=String(t)}}(N[w]);var w,T=g;function ve(){var e=/^\s*at .*(\S+:\d+|\(native\))/m,t=/^(eval@)?(\[native code])?$/;return{parse:o(function(a){if(a.stack&&a.stack.match(e))return this.parseV8OrIE(a);if(a.stack)return this.parseFFOrSafari(a);throw new Error("Cannot parse given Error object")},"ErrorStackParser$$parse"),extractLocation:o(function(a){if(a.indexOf(":")===-1)return[a];var s=/(.+?)(?::(\d+))?(?::(\d+))?$/,n=s.exec(a.replace(/[()]/g,""));return[n[1],n[2]||void 0,n[3]||void 0]},"ErrorStackParser$$extractLocation"),parseV8OrIE:o(function(a){var s=a.stack.split(`
2
- `).filter(function(n){return!!n.match(e)},this);return s.map(function(n){n.indexOf("(eval ")>-1&&(n=n.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));var i=n.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),c=i.match(/ (\(.+\)$)/);i=c?i.replace(c[0],""):i;var l=this.extractLocation(c?c[1]:i),d=c&&i||void 0,f=["eval","<anonymous>"].indexOf(l[0])>-1?void 0:l[0];return new T({functionName:d,fileName:f,lineNumber:l[1],columnNumber:l[2],source:n})},this)},"ErrorStackParser$$parseV8OrIE"),parseFFOrSafari:o(function(a){var s=a.stack.split(`
3
- `).filter(function(n){return!n.match(t)},this);return s.map(function(n){if(n.indexOf(" > eval")>-1&&(n=n.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),n.indexOf("@")===-1&&n.indexOf(":")===-1)return new T({functionName:n});var i=/((.*".+"[^@]*)?[^@]*)(?:@)/,c=n.match(i),l=c&&c[1]?c[1]:void 0,d=this.extractLocation(n.replace(i,""));return new T({functionName:l,fileName:d[0],lineNumber:d[1],columnNumber:d[2],source:n})},this)},"ErrorStackParser$$parseFFOrSafari")}}o(ve,"ErrorStackParser");var he=new ve;var V=he;var y=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&!process.browser,U=y&&typeof module<"u"&&typeof module.exports<"u"&&typeof m<"u"&&typeof __dirname<"u",z=y&&!U,Ve=typeof globalThis.Bun<"u",Se=typeof Deno<"u",q=!y&&!Se,J=q&&typeof window=="object"&&typeof document=="object"&&typeof document.createElement=="function"&&"sessionStorage"in window&&typeof importScripts!="function",Y=q&&typeof importScripts=="function"&&typeof self=="object",ze=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Chrome")==-1&&navigator.userAgent.indexOf("Safari")>-1,A=typeof read=="function"&&typeof load=="function";var G,C,X,K,M;async function W(){if(!y||(G=(await import(/* webpackIgnore */"node:url")).default,K=await import(/* webpackIgnore */"node:fs"),M=await import(/* webpackIgnore */"node:fs/promises"),X=(await import(/* webpackIgnore */"node:vm")).default,C=await import(/* webpackIgnore */"node:path"),B=C.sep,typeof m<"u"))return;let e=K,t=await import(/* webpackIgnore */"node:crypto"),r=await import(/* webpackIgnore */"ws"),a=await import(/* webpackIgnore */"node:child_process"),s={fs:e,crypto:t,ws:r,child_process:a};globalThis.require=function(n){return s[n]}}o(W,"initNodeModules");function we(e,t){return C.resolve(t||".",e)}o(we,"node_resolvePath");function Ee(e,t){return t===void 0&&(t=location),new URL(e,t).toString()}o(Ee,"browser_resolvePath");var x;y?x=we:A?x=o(e=>e,"resolvePath"):x=Ee;var B;y||(B="/");function Pe(e,t){return e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?{response:fetch(e)}:{binary:M.readFile(e).then(r=>new Uint8Array(r.buffer,r.byteOffset,r.byteLength))}}o(Pe,"node_getBinaryResponse");function ke(e,t){if(e.startsWith("file://")&&(e=e.slice(7)),e.includes("://"))throw new Error("Shell cannot fetch urls");return{binary:Promise.resolve(new Uint8Array(readbuffer(e)))}}o(ke,"shell_getBinaryResponse");function Ie(e,t){let r=new URL(e,location);return{response:fetch(r,t?{integrity:t}:{})}}o(Ie,"browser_getBinaryResponse");var _;y?_=Pe:A?_=ke:_=Ie;async function Q(e,t){let{response:r,binary:a}=_(e,t);if(a)return a;let s=await r;if(!s.ok)throw new Error(`Failed to load '${e}': request failed.`);return new Uint8Array(await s.arrayBuffer())}o(Q,"loadBinaryFile");var F;if(J)F=o(async e=>await import(/* webpackIgnore */e),"loadScript");else if(Y)F=o(async e=>{try{globalThis.importScripts(e)}catch(t){if(t instanceof TypeError)await import(/* webpackIgnore */e);else throw t}},"loadScript");else if(y)F=Ne;else if(A)F=load;else throw new Error("Cannot determine runtime environment");async function Ne(e){e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?X.runInThisContext(await(await fetch(e)).text()):await import(/* webpackIgnore */G.pathToFileURL(e).href)}o(Ne,"nodeLoadScript");async function Z(e){if(y){await W();let t=await M.readFile(e,{encoding:"utf8"});return JSON.parse(t)}else if(A){let t=read(e);return JSON.parse(t)}else return await(await fetch(e)).json()}o(Z,"loadLockFile");async function ee(){if(U)return __dirname;let e;try{throw new Error}catch(a){e=a}let t=V.parse(e)[0].fileName;if(y&&!t.startsWith("file://")&&(t=`file://${t}`),z){let a=await import(/* webpackIgnore */"node:path");return(await import(/* webpackIgnore */"node:url")).fileURLToPath(a.dirname(t))}let r=t.lastIndexOf(B);if(r===-1)throw new Error("Could not extract indexURL path from pyodide module location");return t.slice(0,r)}o(ee,"calculateDirname");function te(e){return e.substring(0,e.lastIndexOf("/")+1)||globalThis.location?.toString()||"."}o(te,"calculateInstallBaseUrl");function ne(e){let t=e.FS,r=e.FS.filesystems.MEMFS,a=e.PATH,s={DIR_MODE:16895,FILE_MODE:33279,mount:o(function(n){if(!n.opts.fileSystemHandle)throw new Error("opts.fileSystemHandle is required");return r.mount.apply(null,arguments)},"mount"),syncfs:o(async(n,i,c)=>{try{let l=s.getLocalSet(n),d=await s.getRemoteSet(n),f=i?d:l,u=i?l:d;await s.reconcile(n,f,u),c(null)}catch(l){c(l)}},"syncfs"),getLocalSet:o(n=>{let i=Object.create(null);function c(f){return f!=="."&&f!==".."}o(c,"isRealDir");function l(f){return u=>a.join2(f,u)}o(l,"toAbsolute");let d=t.readdir(n.mountpoint).filter(c).map(l(n.mountpoint));for(;d.length;){let f=d.pop(),u=t.stat(f);t.isDir(u.mode)&&d.push.apply(d,t.readdir(f).filter(c).map(l(f))),i[f]={timestamp:u.mtime,mode:u.mode}}return{type:"local",entries:i}},"getLocalSet"),getRemoteSet:o(async n=>{let i=Object.create(null),c=await Fe(n.opts.fileSystemHandle);for(let[l,d]of c)l!=="."&&(i[a.join2(n.mountpoint,l)]={timestamp:d.kind==="file"?new Date((await d.getFile()).lastModified):new Date,mode:d.kind==="file"?s.FILE_MODE:s.DIR_MODE});return{type:"remote",entries:i,handles:c}},"getRemoteSet"),loadLocalEntry:o(n=>{let c=t.lookupPath(n).node,l=t.stat(n);if(t.isDir(l.mode))return{timestamp:l.mtime,mode:l.mode};if(t.isFile(l.mode))return c.contents=r.getFileDataAsTypedArray(c),{timestamp:l.mtime,mode:l.mode,contents:c.contents};throw new Error("node type not supported")},"loadLocalEntry"),storeLocalEntry:o((n,i)=>{if(t.isDir(i.mode))t.mkdirTree(n,i.mode);else if(t.isFile(i.mode))t.writeFile(n,i.contents,{canOwn:!0});else throw new Error("node type not supported");t.chmod(n,i.mode),t.utime(n,i.timestamp,i.timestamp)},"storeLocalEntry"),removeLocalEntry:o(n=>{var i=t.stat(n);t.isDir(i.mode)?t.rmdir(n):t.isFile(i.mode)&&t.unlink(n)},"removeLocalEntry"),loadRemoteEntry:o(async n=>{if(n.kind==="file"){let i=await n.getFile();return{contents:new Uint8Array(await i.arrayBuffer()),mode:s.FILE_MODE,timestamp:new Date(i.lastModified)}}else{if(n.kind==="directory")return{mode:s.DIR_MODE,timestamp:new Date};throw new Error("unknown kind: "+n.kind)}},"loadRemoteEntry"),storeRemoteEntry:o(async(n,i,c)=>{let l=n.get(a.dirname(i)),d=t.isFile(c.mode)?await l.getFileHandle(a.basename(i),{create:!0}):await l.getDirectoryHandle(a.basename(i),{create:!0});if(d.kind==="file"){let f=await d.createWritable();await f.write(c.contents),await f.close()}n.set(i,d)},"storeRemoteEntry"),removeRemoteEntry:o(async(n,i)=>{await n.get(a.dirname(i)).removeEntry(a.basename(i)),n.delete(i)},"removeRemoteEntry"),reconcile:o(async(n,i,c)=>{let l=0,d=[];Object.keys(i.entries).forEach(function(p){let v=i.entries[p],P=c.entries[p];(!P||t.isFile(v.mode)&&v.timestamp.getTime()>P.timestamp.getTime())&&(d.push(p),l++)}),d.sort();let f=[];if(Object.keys(c.entries).forEach(function(p){i.entries[p]||(f.push(p),l++)}),f.sort().reverse(),!l)return;let u=i.type==="remote"?i.handles:c.handles;for(let p of d){let v=a.normalize(p.replace(n.mountpoint,"/")).substring(1);if(c.type==="local"){let P=u.get(v),se=await s.loadRemoteEntry(P);s.storeLocalEntry(p,se)}else{let P=s.loadLocalEntry(p);await s.storeRemoteEntry(u,v,P)}}for(let p of f)if(c.type==="local")s.removeLocalEntry(p);else{let v=a.normalize(p.replace(n.mountpoint,"/")).substring(1);await s.removeRemoteEntry(u,v)}},"reconcile")};e.FS.filesystems.NATIVEFS_ASYNC=s}o(ne,"initializeNativeFS");var Fe=o(async e=>{let t=[];async function r(s){for await(let n of s.values())t.push(n),n.kind==="directory"&&await r(n)}o(r,"collect"),await r(e);let a=new Map;a.set(".",e);for(let s of t){let n=(await e.resolve(s)).join("/");a.set(n,s)}return a},"getFsHandles");var re=H("AGFzbQEAAAABDANfAGAAAW9gAW8BfwMDAgECByECD2NyZWF0ZV9zZW50aW5lbAAAC2lzX3NlbnRpbmVsAAEKEwIHAPsBAPsbCwkAIAD7GvsUAAs=");var _e=async function(){if(!(globalThis.navigator&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&typeof navigator.maxTouchPoints<"u"&&navigator.maxTouchPoints>1))){return;try{let t=await WebAssembly.compile(re);return await WebAssembly.instantiate(t)}catch(t){if(t instanceof WebAssembly.CompileError)return;throw t}}}();async function ie(){let e=await _e;if(e)return e.exports;let t=Symbol("error marker");return{create_sentinel:o(()=>t,"create_sentinel"),is_sentinel:o(r=>r===t,"is_sentinel")}}o(ie,"getSentinelImport");function oe(e){let t={noImageDecoding:!0,noAudioDecoding:!0,noWasmDecoding:!1,preRun:De(e),print:e.stdout,printErr:e.stderr,onExit(r){t.exitCode=r},thisProgram:e._sysExecutable,arguments:e.args,API:{config:e},locateFile:o(r=>e.indexURL+r,"locateFile"),instantiateWasm:Ue(e.indexURL)};return t}o(oe,"createSettings");function Re(e){return function(t){let r="/";try{t.FS.mkdirTree(e)}catch(a){console.error(`Error occurred while making a home directory '${e}':`),console.error(a),console.error(`Using '${r}' for a home directory instead`),e=r}t.FS.chdir(e)}}o(Re,"createHomeDirectory");function Ae(e){return function(t){Object.assign(t.ENV,e)}}o(Ae,"setEnvironment");function Oe(e){return e?[async t=>{t.addRunDependency("fsInitHook");try{await e(t.FS,{sitePackages:t.API.sitePackages})}finally{t.removeRunDependency("fsInitHook")}}]:[]}o(Oe,"callFsInitHook");function Le(e){let t=e.HEAPU32[e._Py_Version>>>2],r=t>>>24&255,a=t>>>16&255,s=t>>>8&255;return[r,a,s]}o(Le,"computeVersionTuple");function Te(e){let t=Q(e);return async r=>{r.API.pyVersionTuple=Le(r);let[a,s]=r.API.pyVersionTuple;r.FS.mkdirTree("/lib"),r.API.sitePackages=`/lib/python${a}.${s}/site-packages`,r.FS.mkdirTree(r.API.sitePackages),r.addRunDependency("install-stdlib");try{let n=await t;r.FS.writeFile(`/lib/python${a}${s}.zip`,n)}catch(n){console.error("Error occurred while installing the standard library:"),console.error(n)}finally{r.removeRunDependency("install-stdlib")}}}o(Te,"installStdlib");function De(e){let t;return e.stdLibURL!=null?t=e.stdLibURL:t=e.indexURL+"python_stdlib.zip",[Te(t),Re(e.env.HOME),Ae(e.env),ne,...Oe(e.fsInit)]}o(De,"getFileSystemInitializationFuncs");function Ue(e){if(typeof WasmOffsetConverter<"u")return;let{binary:t,response:r}=_(e+"pyodide.asm.wasm"),a=ie();return function(s,n){return async function(){s.sentinel=await a;try{let i;r?i=await WebAssembly.instantiateStreaming(r,s):i=await WebAssembly.instantiate(await t,s);let{instance:c,module:l}=i;n(c,l)}catch(i){console.warn("wasm instantiation failed!"),console.warn(i)}}(),{}}}o(Ue,"getInstantiateWasmFunc");var ae="0.28.1";var O=ae;async function $(e={}){if(e.lockFileContents&&e.lockFileURL)throw new Error("Can't pass both lockFileContents and lockFileURL");await W();let t=e.indexURL||await ee();t=x(t),t.endsWith("/")||(t+="/");let r=e;if(!e.lockFileContents){let u=e.lockFileURL??t+"pyodide-lock.json";r.lockFileContents=Z(u),r.packageBaseUrl??=te(u)}if(r.indexURL=t,r.cdnUrl=r.packageBaseUrl??`https://cdn.jsdelivr.net/pyodide/v${O}/full/`,e.packageCacheDir){let u=x(e.packageCacheDir);u.endsWith("/")||(u+="/"),e.packageCacheDir=u}let a={fullStdLib:!1,jsglobals:globalThis,stdin:globalThis.prompt?globalThis.prompt:void 0,args:[],env:{},packages:[],packageCacheDir:r.packageBaseUrl,enableRunUntilComplete:!0,checkAPIVersion:!0,BUILD_ID:"0c0e2ff761547b9adb2156e2c54b8f253cfb8209e53008729249c6f0bed76fff"},s=Object.assign(a,r);s.env.HOME??="/home/pyodide",s.env.PYTHONINSPECT??="1";let n=oe(s),i=n.API;if(i.lockFilePromise=Promise.resolve(r.lockFileContents),typeof _createPyodideModule!="function"){let u=`${s.indexURL}pyodide.asm.js`;await F(u)}let c;if(e._loadSnapshot){let u=await e._loadSnapshot;ArrayBuffer.isView(u)?c=u:c=new Uint8Array(u),n.noInitialRun=!0,n.INITIAL_MEMORY=c.length}let l=await _createPyodideModule(n);if(n.exitCode!==void 0)throw new l.ExitStatus(n.exitCode);if(e.pyproxyToStringRepr&&i.setPyProxyToStringMethod(!0),e.convertNullToNone&&i.setCompatNullToNone(!0),i.version!==O&&s.checkAPIVersion)throw new Error(`Pyodide version does not match: '${O}' <==> '${i.version}'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.`);l.locateFile=u=>{throw u.endsWith(".so")?new Error(`Failed to find dynamic library "${u}"`):new Error(`Unexpected call to locateFile("${u}")`)};let d;c&&(d=i.restoreSnapshot(c));let f=i.finalizeBootstrap(d,e._snapshotDeserializer);return i.sys.path.insert(0,""),i._pyodide.set_excepthook(),await i.packageIndexReady,i.initializeStreams(s.stdin,s.stdout,s.stderr),f}o($,"loadPyodide");globalThis.loadPyodide=$;return pe(Ce);})();
1
+ "use strict";var loadPyodide=(()=>{var ce=Object.create;var A=Object.defineProperty;var de=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var fe=Object.getPrototypeOf,me=Object.prototype.hasOwnProperty;var o=(e,t)=>A(e,"name",{value:t,configurable:!0}),m=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var pe=(e,t)=>{for(var r in t)A(e,r,{get:t[r],enumerable:!0})},H=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ue(t))!me.call(e,a)&&a!==r&&A(e,a,{get:()=>t[a],enumerable:!(s=de(t,a))||s.enumerable});return e};var b=(e,t,r)=>(r=e!=null?ce(fe(e)):{},H(t||!e||!e.__esModule?A(r,"default",{value:e,enumerable:!0}):r,e)),ge=e=>H(A({},"__esModule",{value:!0}),e);var V=(()=>{for(var e=new Uint8Array(128),t=0;t<64;t++)e[t<26?t+65:t<52?t+71:t<62?t-4:t*4-205]=t;return r=>{for(var s=r.length,a=new Uint8Array((s-(r[s-1]=="=")-(r[s-2]=="="))*3/4|0),n=0,i=0;n<s;){var l=e[r.charCodeAt(n++)],c=e[r.charCodeAt(n++)],d=e[r.charCodeAt(n++)],u=e[r.charCodeAt(n++)];a[i++]=l<<2|c>>4,a[i++]=c<<4|d>>2,a[i++]=d<<6|u}return a}})();var Me={};pe(Me,{loadPyodide:()=>j,version:()=>L});function ye(e){return!isNaN(parseFloat(e))&&isFinite(e)}o(ye,"_isNumber");function E(e){return e.charAt(0).toUpperCase()+e.substring(1)}o(E,"_capitalize");function U(e){return function(){return this[e]}}o(U,"_getter");var k=["isConstructor","isEval","isNative","isToplevel"],I=["columnNumber","lineNumber"],N=["fileName","functionName","source"],be=["args"],ve=["evalOrigin"],T=k.concat(I,N,be,ve);function g(e){if(e)for(var t=0;t<T.length;t++)e[T[t]]!==void 0&&this["set"+E(T[t])](e[T[t]])}o(g,"StackFrame");g.prototype={getArgs:o(function(){return this.args},"getArgs"),setArgs:o(function(e){if(Object.prototype.toString.call(e)!=="[object Array]")throw new TypeError("Args must be an Array");this.args=e},"setArgs"),getEvalOrigin:o(function(){return this.evalOrigin},"getEvalOrigin"),setEvalOrigin:o(function(e){if(e instanceof g)this.evalOrigin=e;else if(e instanceof Object)this.evalOrigin=new g(e);else throw new TypeError("Eval Origin must be an Object or StackFrame")},"setEvalOrigin"),toString:o(function(){var e=this.getFileName()||"",t=this.getLineNumber()||"",r=this.getColumnNumber()||"",s=this.getFunctionName()||"";return this.getIsEval()?e?"[eval] ("+e+":"+t+":"+r+")":"[eval]:"+t+":"+r:s?s+" ("+e+":"+t+":"+r+")":e+":"+t+":"+r},"toString")};g.fromString=o(function(t){var r=t.indexOf("("),s=t.lastIndexOf(")"),a=t.substring(0,r),n=t.substring(r+1,s).split(","),i=t.substring(s+1);if(i.indexOf("@")===0)var l=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(i,""),c=l[1],d=l[2],u=l[3];return new g({functionName:a,args:n||void 0,fileName:c,lineNumber:d||void 0,columnNumber:u||void 0})},"StackFrame$$fromString");for(h=0;h<k.length;h++)g.prototype["get"+E(k[h])]=U(k[h]),g.prototype["set"+E(k[h])]=function(e){return function(t){this[e]=!!t}}(k[h]);var h;for(S=0;S<I.length;S++)g.prototype["get"+E(I[S])]=U(I[S]),g.prototype["set"+E(I[S])]=function(e){return function(t){if(!ye(t))throw new TypeError(e+" must be a Number");this[e]=Number(t)}}(I[S]);var S;for(w=0;w<N.length;w++)g.prototype["get"+E(N[w])]=U(N[w]),g.prototype["set"+E(N[w])]=function(e){return function(t){this[e]=String(t)}}(N[w]);var w,D=g;function he(){var e=/^\s*at .*(\S+:\d+|\(native\))/m,t=/^(eval@)?(\[native code])?$/;return{parse:o(function(s){if(s.stack&&s.stack.match(e))return this.parseV8OrIE(s);if(s.stack)return this.parseFFOrSafari(s);throw new Error("Cannot parse given Error object")},"ErrorStackParser$$parse"),extractLocation:o(function(s){if(s.indexOf(":")===-1)return[s];var a=/(.+?)(?::(\d+))?(?::(\d+))?$/,n=a.exec(s.replace(/[()]/g,""));return[n[1],n[2]||void 0,n[3]||void 0]},"ErrorStackParser$$extractLocation"),parseV8OrIE:o(function(s){var a=s.stack.split(`
2
+ `).filter(function(n){return!!n.match(e)},this);return a.map(function(n){n.indexOf("(eval ")>-1&&(n=n.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));var i=n.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),l=i.match(/ (\(.+\)$)/);i=l?i.replace(l[0],""):i;var c=this.extractLocation(l?l[1]:i),d=l&&i||void 0,u=["eval","<anonymous>"].indexOf(c[0])>-1?void 0:c[0];return new D({functionName:d,fileName:u,lineNumber:c[1],columnNumber:c[2],source:n})},this)},"ErrorStackParser$$parseV8OrIE"),parseFFOrSafari:o(function(s){var a=s.stack.split(`
3
+ `).filter(function(n){return!n.match(t)},this);return a.map(function(n){if(n.indexOf(" > eval")>-1&&(n=n.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),n.indexOf("@")===-1&&n.indexOf(":")===-1)return new D({functionName:n});var i=/((.*".+"[^@]*)?[^@]*)(?:@)/,l=n.match(i),c=l&&l[1]?l[1]:void 0,d=this.extractLocation(n.replace(i,""));return new D({functionName:c,fileName:d[0],lineNumber:d[1],columnNumber:d[2],source:n})},this)},"ErrorStackParser$$parseFFOrSafari")}}o(he,"ErrorStackParser");var Se=new he;var z=Se;var y=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&!process.browser,C=y&&typeof module<"u"&&typeof module.exports<"u"&&typeof m<"u"&&typeof __dirname<"u",q=y&&!C,ze=typeof globalThis.Bun<"u",we=typeof Deno<"u",J=!y&&!we,Y=J&&typeof window=="object"&&typeof document=="object"&&typeof document.createElement=="function"&&"sessionStorage"in window&&typeof importScripts!="function",K=J&&typeof importScripts=="function"&&typeof self=="object",qe=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Chrome")==-1&&navigator.userAgent.indexOf("Safari")>-1,R=typeof read=="function"&&typeof load=="function";var X,M,Q,G,B;async function W(){if(!y||(X=(await import(/* webpackIgnore */"node:url")).default,G=await import(/* webpackIgnore */"node:fs"),B=await import(/* webpackIgnore */"node:fs/promises"),Q=(await import(/* webpackIgnore */"node:vm")).default,M=await import(/* webpackIgnore */"node:path"),$=M.sep,typeof m<"u"))return;let e=G,t=await import(/* webpackIgnore */"node:crypto"),r=await import(/* webpackIgnore */"ws"),s=await import(/* webpackIgnore */"node:child_process"),a={fs:e,crypto:t,ws:r,child_process:s};globalThis.require=function(n){return a[n]}}o(W,"initNodeModules");function Ee(e,t){return M.resolve(t||".",e)}o(Ee,"node_resolvePath");function Pe(e,t){return t===void 0&&(t=location),new URL(e,t).toString()}o(Pe,"browser_resolvePath");var x;y?x=Ee:R?x=o(e=>e,"resolvePath"):x=Pe;var $;y||($="/");function ke(e,t){return e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?{response:fetch(e)}:{binary:B.readFile(e).then(r=>new Uint8Array(r.buffer,r.byteOffset,r.byteLength))}}o(ke,"node_getBinaryResponse");function Ie(e,t){if(e.startsWith("file://")&&(e=e.slice(7)),e.includes("://"))throw new Error("Shell cannot fetch urls");return{binary:Promise.resolve(new Uint8Array(readbuffer(e)))}}o(Ie,"shell_getBinaryResponse");function Ne(e,t){let r=new URL(e,location);return{response:fetch(r,t?{integrity:t}:{})}}o(Ne,"browser_getBinaryResponse");var _;y?_=ke:R?_=Ie:_=Ne;async function Z(e,t){let{response:r,binary:s}=_(e,t);if(s)return s;let a=await r;if(!a.ok)throw new Error(`Failed to load '${e}': request failed.`);return new Uint8Array(await a.arrayBuffer())}o(Z,"loadBinaryFile");var F;if(Y)F=o(async e=>await import(/* webpackIgnore */e),"loadScript");else if(K)F=o(async e=>{try{globalThis.importScripts(e)}catch(t){if(t instanceof TypeError)await import(/* webpackIgnore */e);else throw t}},"loadScript");else if(y)F=Fe;else if(R)F=load;else throw new Error("Cannot determine runtime environment");async function Fe(e){e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?Q.runInThisContext(await(await fetch(e)).text()):await import(/* webpackIgnore */X.pathToFileURL(e).href)}o(Fe,"nodeLoadScript");async function ee(e){if(y){await W();let t=await B.readFile(e,{encoding:"utf8"});return JSON.parse(t)}else if(R){let t=read(e);return JSON.parse(t)}else return await(await fetch(e)).json()}o(ee,"loadLockFile");async function te(){if(C)return __dirname;let e;try{throw new Error}catch(s){e=s}let t=z.parse(e)[0].fileName;if(y&&!t.startsWith("file://")&&(t=`file://${t}`),q){let s=await import(/* webpackIgnore */"node:path");return(await import(/* webpackIgnore */"node:url")).fileURLToPath(s.dirname(t))}let r=t.lastIndexOf($);if(r===-1)throw new Error("Could not extract indexURL path from pyodide module location");return t.slice(0,r)}o(te,"calculateDirname");function ne(e){return e.substring(0,e.lastIndexOf("/")+1)||globalThis.location?.toString()||"."}o(ne,"calculateInstallBaseUrl");function re(e){let t=e.FS,r=e.FS.filesystems.MEMFS,s=e.PATH,a={DIR_MODE:16895,FILE_MODE:33279,mount:o(function(n){if(!n.opts.fileSystemHandle)throw new Error("opts.fileSystemHandle is required");return r.mount.apply(null,arguments)},"mount"),syncfs:o(async(n,i,l)=>{try{let c=a.getLocalSet(n),d=await a.getRemoteSet(n),u=i?d:c,f=i?c:d;await a.reconcile(n,u,f),l(null)}catch(c){l(c)}},"syncfs"),getLocalSet:o(n=>{let i=Object.create(null);function l(u){return u!=="."&&u!==".."}o(l,"isRealDir");function c(u){return f=>s.join2(u,f)}o(c,"toAbsolute");let d=t.readdir(n.mountpoint).filter(l).map(c(n.mountpoint));for(;d.length;){let u=d.pop(),f=t.stat(u);t.isDir(f.mode)&&d.push.apply(d,t.readdir(u).filter(l).map(c(u))),i[u]={timestamp:f.mtime,mode:f.mode}}return{type:"local",entries:i}},"getLocalSet"),getRemoteSet:o(async n=>{let i=Object.create(null),l=await xe(n.opts.fileSystemHandle);for(let[c,d]of l)c!=="."&&(i[s.join2(n.mountpoint,c)]={timestamp:d.kind==="file"?new Date((await d.getFile()).lastModified):new Date,mode:d.kind==="file"?a.FILE_MODE:a.DIR_MODE});return{type:"remote",entries:i,handles:l}},"getRemoteSet"),loadLocalEntry:o(n=>{let l=t.lookupPath(n).node,c=t.stat(n);if(t.isDir(c.mode))return{timestamp:c.mtime,mode:c.mode};if(t.isFile(c.mode))return l.contents=r.getFileDataAsTypedArray(l),{timestamp:c.mtime,mode:c.mode,contents:l.contents};throw new Error("node type not supported")},"loadLocalEntry"),storeLocalEntry:o((n,i)=>{if(t.isDir(i.mode))t.mkdirTree(n,i.mode);else if(t.isFile(i.mode))t.writeFile(n,i.contents,{canOwn:!0});else throw new Error("node type not supported");t.chmod(n,i.mode),t.utime(n,i.timestamp,i.timestamp)},"storeLocalEntry"),removeLocalEntry:o(n=>{var i=t.stat(n);t.isDir(i.mode)?t.rmdir(n):t.isFile(i.mode)&&t.unlink(n)},"removeLocalEntry"),loadRemoteEntry:o(async n=>{if(n.kind==="file"){let i=await n.getFile();return{contents:new Uint8Array(await i.arrayBuffer()),mode:a.FILE_MODE,timestamp:new Date(i.lastModified)}}else{if(n.kind==="directory")return{mode:a.DIR_MODE,timestamp:new Date};throw new Error("unknown kind: "+n.kind)}},"loadRemoteEntry"),storeRemoteEntry:o(async(n,i,l)=>{let c=n.get(s.dirname(i)),d=t.isFile(l.mode)?await c.getFileHandle(s.basename(i),{create:!0}):await c.getDirectoryHandle(s.basename(i),{create:!0});if(d.kind==="file"){let u=await d.createWritable();await u.write(l.contents),await u.close()}n.set(i,d)},"storeRemoteEntry"),removeRemoteEntry:o(async(n,i)=>{await n.get(s.dirname(i)).removeEntry(s.basename(i)),n.delete(i)},"removeRemoteEntry"),reconcile:o(async(n,i,l)=>{let c=0,d=[];Object.keys(i.entries).forEach(function(p){let v=i.entries[p],P=l.entries[p];(!P||t.isFile(v.mode)&&v.timestamp.getTime()>P.timestamp.getTime())&&(d.push(p),c++)}),d.sort();let u=[];if(Object.keys(l.entries).forEach(function(p){i.entries[p]||(u.push(p),c++)}),u.sort().reverse(),!c)return;let f=i.type==="remote"?i.handles:l.handles;for(let p of d){let v=s.normalize(p.replace(n.mountpoint,"/")).substring(1);if(l.type==="local"){let P=f.get(v),le=await a.loadRemoteEntry(P);a.storeLocalEntry(p,le)}else{let P=a.loadLocalEntry(p);await a.storeRemoteEntry(f,v,P)}}for(let p of u)if(l.type==="local")a.removeLocalEntry(p);else{let v=s.normalize(p.replace(n.mountpoint,"/")).substring(1);await a.removeRemoteEntry(f,v)}},"reconcile")};e.FS.filesystems.NATIVEFS_ASYNC=a}o(re,"initializeNativeFS");var xe=o(async e=>{let t=[];async function r(a){for await(let n of a.values())t.push(n),n.kind==="directory"&&await r(n)}o(r,"collect"),await r(e);let s=new Map;s.set(".",e);for(let a of t){let n=(await e.resolve(a)).join("/");s.set(n,a)}return s},"getFsHandles");var ie=V("AGFzbQEAAAABDANfAGAAAW9gAW8BfwMDAgECByECD2NyZWF0ZV9zZW50aW5lbAAAC2lzX3NlbnRpbmVsAAEKEwIHAPsBAPsbCwkAIAD7GvsUAAs=");var Ae=async function(){if(!(globalThis.navigator&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&typeof navigator.maxTouchPoints<"u"&&navigator.maxTouchPoints>1))){return;try{let t=await WebAssembly.compile(ie);return await WebAssembly.instantiate(t)}catch(t){if(t instanceof WebAssembly.CompileError)return;throw t}}}();async function oe(){let e=await Ae;if(e)return e.exports;let t=Symbol("error marker");return{create_sentinel:o(()=>t,"create_sentinel"),is_sentinel:o(r=>r===t,"is_sentinel")}}o(oe,"getSentinelImport");function se(e){let t={noImageDecoding:!0,noAudioDecoding:!0,noWasmDecoding:!1,preRun:Ue(e),print:e.stdout,printErr:e.stderr,onExit(r){t.exitCode=r},thisProgram:e._sysExecutable,arguments:e.args,API:{config:e},locateFile:o(r=>e.indexURL+r,"locateFile"),instantiateWasm:Ce(e.indexURL)};return t}o(se,"createSettings");function Re(e){return function(t){let r="/";try{t.FS.mkdirTree(e)}catch(s){console.error(`Error occurred while making a home directory '${e}':`),console.error(s),console.error(`Using '${r}' for a home directory instead`),e=r}t.FS.chdir(e)}}o(Re,"createHomeDirectory");function Oe(e){return function(t){Object.assign(t.ENV,e)}}o(Oe,"setEnvironment");function Le(e){return e?[async t=>{t.addRunDependency("fsInitHook");try{await e(t.FS,{sitePackages:t.API.sitePackages})}finally{t.removeRunDependency("fsInitHook")}}]:[]}o(Le,"callFsInitHook");function Te(e){let t=e.HEAPU32[e._Py_Version>>>2],r=t>>>24&255,s=t>>>16&255,a=t>>>8&255;return[r,s,a]}o(Te,"computeVersionTuple");function De(e){let t=Z(e);return async r=>{r.API.pyVersionTuple=Te(r);let[s,a]=r.API.pyVersionTuple;r.FS.mkdirTree("/lib"),r.API.sitePackages=`/lib/python${s}.${a}/site-packages`,r.FS.mkdirTree(r.API.sitePackages),r.addRunDependency("install-stdlib");try{let n=await t;r.FS.writeFile(`/lib/python${s}${a}.zip`,n)}catch(n){console.error("Error occurred while installing the standard library:"),console.error(n)}finally{r.removeRunDependency("install-stdlib")}}}o(De,"installStdlib");function Ue(e){let t;return e.stdLibURL!=null?t=e.stdLibURL:t=e.indexURL+"python_stdlib.zip",[De(t),Re(e.env.HOME),Oe(e.env),re,...Le(e.fsInit)]}o(Ue,"getFileSystemInitializationFuncs");function Ce(e){if(typeof WasmOffsetConverter<"u")return;let{binary:t,response:r}=_(e+"pyodide.asm.wasm"),s=oe();return function(a,n){return async function(){a.sentinel=await s;try{let i;r?i=await WebAssembly.instantiateStreaming(r,a):i=await WebAssembly.instantiate(await t,a);let{instance:l,module:c}=i;n(l,c)}catch(i){console.warn("wasm instantiation failed!"),console.warn(i)}}(),{}}}o(Ce,"getInstantiateWasmFunc");var ae="0.28.2";function O(e){return e===void 0||e.endsWith("/")?e:e+"/"}o(O,"withTrailingSlash");var L=ae;async function j(e={}){if(e.lockFileContents&&e.lockFileURL)throw new Error("Can't pass both lockFileContents and lockFileURL");await W();let t=e.indexURL||await te();t=O(x(t));let r=e;if(r.packageBaseUrl=O(r.packageBaseUrl),r.cdnUrl=O(r.packageBaseUrl??`https://cdn.jsdelivr.net/pyodide/v${L}/full/`),!e.lockFileContents){let f=e.lockFileURL??t+"pyodide-lock.json";r.lockFileContents=ee(f),r.packageBaseUrl??=ne(f)}r.indexURL=t,r.packageCacheDir&&(r.packageCacheDir=O(x(r.packageCacheDir)));let s={fullStdLib:!1,jsglobals:globalThis,stdin:globalThis.prompt?globalThis.prompt:void 0,args:[],env:{},packages:[],packageCacheDir:r.packageBaseUrl,enableRunUntilComplete:!0,checkAPIVersion:!0,BUILD_ID:"941a75c165c70d9d65a059137df0382b4c6a7747ff5f3de2b264ce4a2fb36cf5"},a=Object.assign(s,r);a.env.HOME??="/home/pyodide",a.env.PYTHONINSPECT??="1";let n=se(a),i=n.API;if(i.lockFilePromise=Promise.resolve(r.lockFileContents),typeof _createPyodideModule!="function"){let f=`${a.indexURL}pyodide.asm.js`;await F(f)}let l;if(e._loadSnapshot){let f=await e._loadSnapshot;ArrayBuffer.isView(f)?l=f:l=new Uint8Array(f),n.noInitialRun=!0,n.INITIAL_MEMORY=l.length}let c=await _createPyodideModule(n);if(n.exitCode!==void 0)throw new c.ExitStatus(n.exitCode);if(e.pyproxyToStringRepr&&i.setPyProxyToStringMethod(!0),e.convertNullToNone&&i.setCompatNullToNone(!0),i.version!==L&&a.checkAPIVersion)throw new Error(`Pyodide version does not match: '${L}' <==> '${i.version}'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.`);c.locateFile=f=>{throw f.endsWith(".so")?new Error(`Failed to find dynamic library "${f}"`):new Error(`Unexpected call to locateFile("${f}")`)};let d;l&&(d=i.restoreSnapshot(l));let u=i.finalizeBootstrap(d,e._snapshotDeserializer);return i.sys.path.insert(0,""),i._pyodide.set_excepthook(),await i.packageIndexReady,i.initializeStreams(a.stdin,a.stdout,a.stderr),u}o(j,"loadPyodide");globalThis.loadPyodide=j;return ge(Me);})();
4
4
  try{Object.assign(exports,loadPyodide)}catch(_){}
5
5
  globalThis.loadPyodide=loadPyodide.loadPyodide;
6
6
  //# sourceMappingURL=pyodide.js.map
package/pyodide.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/js/pyodide.umd.ts", "../src/js/vendor/stackframe/stackframe.ts", "../src/js/vendor/stackframe/error-stack-parser.ts", "../src/js/environments.ts", "../src/js/compat.ts", "../src/js/nativefs.ts", "../src/core/sentinel.ts", "../src/js/emscripten-settings.ts", "../src/js/version.ts", "../src/js/pyodide.ts"],
4
- "sourcesContent": ["import { loadPyodide, version } from \"./pyodide\";\nimport { type PackageData } from \"./types\";\nexport { loadPyodide, version, type PackageData };\n(globalThis as any).loadPyodide = loadPyodide;\n", "// @ts-nocheck\n// Port of https://github.com/stacktracejs/stackframe/blob/master/stackframe.js.\n// Rewritten to ES6 and removed UMD and CommonJS support.\n\nfunction _isNumber(n) {\n return !isNaN(parseFloat(n)) && isFinite(n);\n}\n\nfunction _capitalize(str) {\n return str.charAt(0).toUpperCase() + str.substring(1);\n}\n\nfunction _getter(p) {\n return function () {\n return this[p];\n };\n}\n\nvar booleanProps = [\"isConstructor\", \"isEval\", \"isNative\", \"isToplevel\"];\nvar numericProps = [\"columnNumber\", \"lineNumber\"];\nvar stringProps = [\"fileName\", \"functionName\", \"source\"];\nvar arrayProps = [\"args\"];\nvar objectProps = [\"evalOrigin\"];\n\nvar props = booleanProps.concat(\n numericProps,\n stringProps,\n arrayProps,\n objectProps,\n);\n\ndeclare namespace StackFrame {\n export interface StackFrameOptions {\n isConstructor?: boolean;\n isEval?: boolean;\n isNative?: boolean;\n isToplevel?: boolean;\n columnNumber?: number;\n lineNumber?: number;\n fileName?: string;\n functionName?: string;\n source?: string;\n args?: any[];\n evalOrigin?: StackFrame;\n }\n}\n\ndeclare class StackFrame {\n constructor(obj: StackFrame.StackFrameOptions);\n\n args?: any[];\n getArgs(): any[] | undefined;\n setArgs(args: any[]): void;\n\n evalOrigin?: StackFrame;\n getEvalOrigin(): StackFrame | undefined;\n setEvalOrigin(stackframe: StackFrame): void;\n\n isConstructor?: boolean;\n getIsConstructor(): boolean | undefined;\n setIsConstructor(isConstructor: boolean): void;\n\n isEval?: boolean;\n getIsEval(): boolean | undefined;\n setIsEval(isEval: boolean): void;\n\n isNative?: boolean;\n getIsNative(): boolean | undefined;\n setIsNative(isNative: boolean): void;\n\n isToplevel?: boolean;\n getIsToplevel(): boolean | undefined;\n setIsToplevel(isToplevel: boolean): void;\n\n columnNumber?: number;\n getColumnNumber(): number | undefined;\n setColumnNumber(columnNumber: number): void;\n\n lineNumber?: number;\n getLineNumber(): number | undefined;\n setLineNumber(lineNumber: number): void;\n\n fileName?: string;\n getFileName(): string | undefined;\n setFileName(fileName: string): void;\n\n functionName?: string;\n getFunctionName(): string | undefined;\n setFunctionName(functionName: string): void;\n\n source?: string;\n getSource(): string | undefined;\n setSource(source: string): void;\n\n toString(): string;\n}\n\nfunction StackFrame(obj) {\n if (!obj) return;\n for (var i = 0; i < props.length; i++) {\n if (obj[props[i]] !== undefined) {\n this[\"set\" + _capitalize(props[i])](obj[props[i]]);\n }\n }\n}\n\nStackFrame.prototype = {\n getArgs: function () {\n return this.args;\n },\n setArgs: function (v) {\n if (Object.prototype.toString.call(v) !== \"[object Array]\") {\n throw new TypeError(\"Args must be an Array\");\n }\n this.args = v;\n },\n\n getEvalOrigin: function () {\n return this.evalOrigin;\n },\n setEvalOrigin: function (v) {\n if (v instanceof StackFrame) {\n this.evalOrigin = v;\n } else if (v instanceof Object) {\n this.evalOrigin = new StackFrame(v);\n } else {\n throw new TypeError(\"Eval Origin must be an Object or StackFrame\");\n }\n },\n\n toString: function () {\n var fileName = this.getFileName() || \"\";\n var lineNumber = this.getLineNumber() || \"\";\n var columnNumber = this.getColumnNumber() || \"\";\n var functionName = this.getFunctionName() || \"\";\n if (this.getIsEval()) {\n if (fileName) {\n return (\n \"[eval] (\" + fileName + \":\" + lineNumber + \":\" + columnNumber + \")\"\n );\n }\n return \"[eval]:\" + lineNumber + \":\" + columnNumber;\n }\n if (functionName) {\n return (\n functionName +\n \" (\" +\n fileName +\n \":\" +\n lineNumber +\n \":\" +\n columnNumber +\n \")\"\n );\n }\n return fileName + \":\" + lineNumber + \":\" + columnNumber;\n },\n};\n\nStackFrame.fromString = function StackFrame$$fromString(str) {\n var argsStartIndex = str.indexOf(\"(\");\n var argsEndIndex = str.lastIndexOf(\")\");\n\n var functionName = str.substring(0, argsStartIndex);\n var args = str.substring(argsStartIndex + 1, argsEndIndex).split(\",\");\n var locationString = str.substring(argsEndIndex + 1);\n\n if (locationString.indexOf(\"@\") === 0) {\n var parts = /@(.+?)(?::(\\d+))?(?::(\\d+))?$/.exec(locationString, \"\");\n var fileName = parts[1];\n var lineNumber = parts[2];\n var columnNumber = parts[3];\n }\n\n return new StackFrame({\n functionName: functionName,\n args: args || undefined,\n fileName: fileName,\n lineNumber: lineNumber || undefined,\n columnNumber: columnNumber || undefined,\n });\n};\n\nfor (var i = 0; i < booleanProps.length; i++) {\n StackFrame.prototype[\"get\" + _capitalize(booleanProps[i])] = _getter(\n booleanProps[i],\n );\n StackFrame.prototype[\"set\" + _capitalize(booleanProps[i])] = (function (p) {\n return function (v) {\n this[p] = Boolean(v);\n };\n })(booleanProps[i]);\n}\n\nfor (var j = 0; j < numericProps.length; j++) {\n StackFrame.prototype[\"get\" + _capitalize(numericProps[j])] = _getter(\n numericProps[j],\n );\n StackFrame.prototype[\"set\" + _capitalize(numericProps[j])] = (function (p) {\n return function (v) {\n if (!_isNumber(v)) {\n throw new TypeError(p + \" must be a Number\");\n }\n this[p] = Number(v);\n };\n })(numericProps[j]);\n}\n\nfor (var k = 0; k < stringProps.length; k++) {\n StackFrame.prototype[\"get\" + _capitalize(stringProps[k])] = _getter(\n stringProps[k],\n );\n StackFrame.prototype[\"set\" + _capitalize(stringProps[k])] = (function (p) {\n return function (v) {\n this[p] = String(v);\n };\n })(stringProps[k]);\n}\n\nexport default StackFrame;\n", "// @ts-nocheck\n// Port of https://github.com/stacktracejs/error-stack-parser\n// Rewritten to ES6 and removed UMD and CommonJS support.\n// Removed old opera support.\n\nimport StackFrame from \"./stackframe\";\n\ndeclare namespace ErrorStackParser {\n export type { StackFrame };\n /**\n * Given an Error object, extract the most information from it.\n *\n * @param {Error} error object\n * @return {Array} of StackFrames\n */\n export function parse(error: Error): StackFrame[];\n}\n\nfunction ErrorStackParser() {\n var CHROME_IE_STACK_REGEXP = /^\\s*at .*(\\S+:\\d+|\\(native\\))/m;\n var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\\[native code])?$/;\n\n return {\n /**\n * Given an Error object, extract the most information from it.\n *\n * @param {Error} error object\n * @return {Array} of StackFrames\n */\n parse: function ErrorStackParser$$parse(error: Error): StackFrame[] {\n if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {\n return this.parseV8OrIE(error);\n } else if (error.stack) {\n return this.parseFFOrSafari(error);\n } else {\n throw new Error(\"Cannot parse given Error object\");\n }\n },\n\n // Separate line and column numbers from a string of the form: (URI:Line:Column)\n extractLocation: function ErrorStackParser$$extractLocation(urlLike) {\n // Fail-fast but return locations like \"(native)\"\n if (urlLike.indexOf(\":\") === -1) {\n return [urlLike];\n }\n\n var regExp = /(.+?)(?::(\\d+))?(?::(\\d+))?$/;\n var parts = regExp.exec(urlLike.replace(/[()]/g, \"\"));\n return [parts[1], parts[2] || undefined, parts[3] || undefined];\n },\n\n parseV8OrIE: function ErrorStackParser$$parseV8OrIE(error) {\n var filtered = error.stack.split(\"\\n\").filter(function (line) {\n return !!line.match(CHROME_IE_STACK_REGEXP);\n }, this);\n\n return filtered.map(function (line) {\n if (line.indexOf(\"(eval \") > -1) {\n // Throw away eval information until we implement stacktrace.js/stackframe#8\n line = line\n .replace(/eval code/g, \"eval\")\n .replace(/(\\(eval at [^()]*)|(,.*$)/g, \"\");\n }\n var sanitizedLine = line\n .replace(/^\\s+/, \"\")\n .replace(/\\(eval code/g, \"(\")\n .replace(/^.*?\\s+/, \"\");\n\n // capture and preserve the parenthesized location \"(/foo/my bar.js:12:87)\" in\n // case it has spaces in it, as the string is split on \\s+ later on\n var location = sanitizedLine.match(/ (\\(.+\\)$)/);\n\n // remove the parenthesized location from the line, if it was matched\n sanitizedLine = location\n ? sanitizedLine.replace(location[0], \"\")\n : sanitizedLine;\n\n // if a location was matched, pass it to extractLocation() otherwise pass all sanitizedLine\n // because this line doesn't have function name\n var locationParts = this.extractLocation(\n location ? location[1] : sanitizedLine,\n );\n var functionName = (location && sanitizedLine) || undefined;\n var fileName =\n [\"eval\", \"<anonymous>\"].indexOf(locationParts[0]) > -1\n ? undefined\n : locationParts[0];\n\n return new StackFrame({\n functionName: functionName,\n fileName: fileName,\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n source: line,\n });\n }, this);\n },\n\n parseFFOrSafari: function ErrorStackParser$$parseFFOrSafari(error) {\n var filtered = error.stack.split(\"\\n\").filter(function (line) {\n return !line.match(SAFARI_NATIVE_CODE_REGEXP);\n }, this);\n\n return filtered.map(function (line) {\n // Throw away eval information until we implement stacktrace.js/stackframe#8\n if (line.indexOf(\" > eval\") > -1) {\n line = line.replace(\n / line (\\d+)(?: > eval line \\d+)* > eval:\\d+:\\d+/g,\n \":$1\",\n );\n }\n\n if (line.indexOf(\"@\") === -1 && line.indexOf(\":\") === -1) {\n // Safari eval frames only have function names and nothing else\n return new StackFrame({\n functionName: line,\n });\n } else {\n var functionNameRegex = /((.*\".+\"[^@]*)?[^@]*)(?:@)/;\n var matches = line.match(functionNameRegex);\n var functionName = matches && matches[1] ? matches[1] : undefined;\n var locationParts = this.extractLocation(\n line.replace(functionNameRegex, \"\"),\n );\n\n return new StackFrame({\n functionName: functionName,\n fileName: locationParts[0],\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n source: line,\n });\n }\n }, this);\n },\n };\n}\n\nconst errorStackParser = new ErrorStackParser();\n\nexport { StackFrame };\nexport default errorStackParser;\n", "// @ts-nocheck\n\n/** @private */\nexport const IN_NODE =\n typeof process === \"object\" &&\n typeof process.versions === \"object\" &&\n typeof process.versions.node === \"string\" &&\n !process.browser; /* This last condition checks if we run the browser shim of process */\n\n/** @private */\nexport const IN_NODE_COMMONJS =\n IN_NODE &&\n typeof module !== \"undefined\" &&\n typeof module.exports !== \"undefined\" &&\n typeof require !== \"undefined\" &&\n typeof __dirname !== \"undefined\";\n\n/** @private */\nexport const IN_NODE_ESM = IN_NODE && !IN_NODE_COMMONJS;\n\n/** @private */\nexport const IN_BUN = typeof globalThis.Bun !== \"undefined\";\n\n/** @private */\nexport const IN_DENO = typeof Deno !== \"undefined\"; // just in case...\n\n/** @private */\nexport const IN_BROWSER = !IN_NODE && !IN_DENO;\n\n/** @private */\nexport const IN_BROWSER_MAIN_THREAD =\n IN_BROWSER &&\n typeof window === \"object\" &&\n typeof document === \"object\" &&\n typeof document.createElement === \"function\" &&\n \"sessionStorage\" in window &&\n typeof importScripts !== \"function\";\n\n/** @private */\nexport const IN_BROWSER_WEB_WORKER =\n IN_BROWSER && typeof importScripts === \"function\" && typeof self === \"object\";\n\n/** @private */\nexport const IN_SAFARI =\n typeof navigator === \"object\" &&\n typeof navigator.userAgent === \"string\" &&\n navigator.userAgent.indexOf(\"Chrome\") == -1 &&\n navigator.userAgent.indexOf(\"Safari\") > -1;\n\n/** @private */\nexport const IN_SHELL = typeof read == \"function\" && typeof load === \"function\";\n\n/**\n * Detects the current environment and returns a record with the results.\n * This function is useful for debugging and testing purposes.\n * @private\n */\nexport function detectEnvironment(): Record<string, boolean> {\n return {\n IN_NODE,\n IN_NODE_COMMONJS,\n IN_NODE_ESM,\n IN_BUN,\n IN_DENO,\n IN_BROWSER,\n IN_BROWSER_MAIN_THREAD,\n IN_BROWSER_WEB_WORKER,\n IN_SAFARI,\n IN_SHELL,\n };\n}\n", "import ErrorStackParser from \"./vendor/stackframe/error-stack-parser\";\nimport {\n IN_NODE,\n IN_NODE_ESM,\n IN_BROWSER_MAIN_THREAD,\n IN_BROWSER_WEB_WORKER,\n IN_NODE_COMMONJS,\n IN_SHELL,\n} from \"./environments\";\nimport { Lockfile } from \"./types\";\n\nlet nodeUrlMod: typeof import(\"node:url\");\nlet nodePath: typeof import(\"node:path\");\nlet nodeVmMod: typeof import(\"node:vm\");\n/** @private */\nexport let nodeFSMod: typeof import(\"node:fs\");\n/** @private */\nexport let nodeFsPromisesMod: typeof import(\"node:fs/promises\");\n\ndeclare function load(a: string): Promise<void>;\ndeclare function read(a: string): string;\ndeclare function readbuffer(a: string): ArrayBuffer;\n\ndeclare var globalThis: {\n importScripts: (url: string) => void;\n document?: typeof document;\n fetch?: typeof fetch;\n location?: URL;\n};\n\n/**\n * If we're in node, it's most convenient to import various node modules on\n * initialization. Otherwise, this does nothing.\n * @private\n */\nexport async function initNodeModules() {\n if (!IN_NODE) {\n return;\n }\n // @ts-ignore\n nodeUrlMod = (await import(\"node:url\")).default;\n nodeFSMod = await import(\"node:fs\");\n nodeFsPromisesMod = await import(\"node:fs/promises\");\n\n // @ts-ignore\n nodeVmMod = (await import(\"node:vm\")).default;\n nodePath = await import(\"node:path\");\n pathSep = nodePath.sep;\n\n // Emscripten uses `require`, so if it's missing (because we were imported as\n // an ES6 module) we need to polyfill `require` with `import`. `import` is\n // async and `require` is synchronous, so we import all packages that might be\n // required up front and define require to look them up in this table.\n\n if (typeof require !== \"undefined\") {\n return;\n }\n // These are all the packages required in pyodide.asm.js. You can get this\n // list with:\n // $ grep -o 'require(\"[a-z]*\")' pyodide.asm.js | sort -u\n const fs = nodeFSMod;\n const crypto = await import(\"node:crypto\");\n const ws = await import(\"ws\");\n const child_process = await import(\"node:child_process\");\n const node_modules: { [mode: string]: any } = {\n fs,\n crypto,\n ws,\n child_process,\n };\n // Since we're in an ES6 module, this is only modifying the module namespace,\n // it's still private to Pyodide.\n (globalThis as any).require = function (mod: string): any {\n return node_modules[mod];\n };\n}\n\nexport function isAbsolute(path: string): boolean {\n return path.includes(\"://\") || path.startsWith(\"/\");\n}\n\nfunction node_resolvePath(path: string, base?: string): string {\n return nodePath.resolve(base || \".\", path);\n}\n\nfunction browser_resolvePath(path: string, base?: string): string {\n if (base === undefined) {\n // @ts-ignore\n base = location;\n }\n return new URL(path, base).toString();\n}\n\nexport let resolvePath: (rest: string, base?: string) => string;\nif (IN_NODE) {\n resolvePath = node_resolvePath;\n} else if (IN_SHELL) {\n resolvePath = (x) => x;\n} else {\n resolvePath = browser_resolvePath;\n}\n\n/**\n * Get the path separator. If we are on Linux or in the browser, it's /.\n * In Windows, it's \\.\n * @private\n */\nexport let pathSep: string;\n\nif (!IN_NODE) {\n pathSep = \"/\";\n}\n\n/**\n * Load a binary file, only for use in Node. If the path explicitly is a URL,\n * then fetch from a URL, else load from the file system.\n * @param indexURL base path to resolve relative paths\n * @param path the path to load\n * @param checksum sha-256 checksum of the package\n * @returns An ArrayBuffer containing the binary data\n * @private\n */\nfunction node_getBinaryResponse(\n path: string,\n _file_sub_resource_hash?: string | undefined, // Ignoring sub resource hash. See issue-2431.\n):\n | { response: Promise<Response>; binary?: undefined }\n | { binary: Promise<Uint8Array> } {\n if (path.startsWith(\"file://\")) {\n // handle file:// with filesystem operations rather than with fetch.\n path = path.slice(\"file://\".length);\n }\n if (path.includes(\"://\")) {\n // If it has a protocol, make a fetch request\n return { response: fetch(path) };\n } else {\n // Otherwise get it from the file system\n return {\n binary: nodeFsPromisesMod\n .readFile(path)\n .then(\n (data: Buffer) =>\n new Uint8Array(data.buffer, data.byteOffset, data.byteLength),\n ),\n };\n }\n}\n\nfunction shell_getBinaryResponse(\n path: string,\n _file_sub_resource_hash?: string | undefined, // Ignoring sub resource hash. See issue-2431.\n):\n | { response: Promise<Response>; binary?: undefined }\n | { binary: Promise<Uint8Array> } {\n if (path.startsWith(\"file://\")) {\n // handle file:// with filesystem operations rather than with fetch.\n path = path.slice(\"file://\".length);\n }\n if (path.includes(\"://\")) {\n // If it has a protocol, make a fetch request\n throw new Error(\"Shell cannot fetch urls\");\n } else {\n // Otherwise get it from the file system\n return {\n binary: Promise.resolve(new Uint8Array(readbuffer(path))),\n };\n }\n}\n\n/**\n * Load a binary file, only for use in browser. Resolves relative paths against\n * indexURL.\n *\n * @param path the path to load\n * @param subResourceHash the sub resource hash for fetch() integrity check\n * @returns A Uint8Array containing the binary data\n * @private\n */\nfunction browser_getBinaryResponse(\n path: string,\n subResourceHash: string | undefined,\n): { response: Promise<Response>; binary?: undefined } {\n const url = new URL(path, location as unknown as URL);\n let options = subResourceHash ? { integrity: subResourceHash } : {};\n return { response: fetch(url, options) };\n}\n\n/** @private */\nexport let getBinaryResponse: (\n path: string,\n file_sub_resource_hash?: string | undefined,\n) =>\n | { response: Promise<Response>; binary?: undefined }\n | { response?: undefined; binary: Promise<Uint8Array> };\nif (IN_NODE) {\n getBinaryResponse = node_getBinaryResponse;\n} else if (IN_SHELL) {\n getBinaryResponse = shell_getBinaryResponse;\n} else {\n getBinaryResponse = browser_getBinaryResponse;\n}\n\nexport async function loadBinaryFile(\n path: string,\n file_sub_resource_hash?: string | undefined,\n): Promise<Uint8Array> {\n const { response, binary } = getBinaryResponse(path, file_sub_resource_hash);\n if (binary) {\n return binary;\n }\n const r = await response;\n if (!r.ok) {\n throw new Error(`Failed to load '${path}': request failed.`);\n }\n return new Uint8Array(await r.arrayBuffer());\n}\n\n/**\n * Currently loadScript is only used once to load `pyodide.asm.js`.\n * @param url\n * @private\n */\nexport let loadScript: (url: string) => Promise<void>;\n\nif (IN_BROWSER_MAIN_THREAD) {\n // browser\n loadScript = async (url) => await import(/* webpackIgnore: true */ url);\n} else if (IN_BROWSER_WEB_WORKER) {\n // webworker\n loadScript = async (url) => {\n try {\n // use importScripts in classic web worker\n globalThis.importScripts(url);\n } catch (e) {\n // importScripts throws TypeError in a module type web worker, use import instead\n if (e instanceof TypeError) {\n await import(/* webpackIgnore: true */ url);\n } else {\n throw e;\n }\n }\n };\n} else if (IN_NODE) {\n loadScript = nodeLoadScript;\n} else if (IN_SHELL) {\n loadScript = load;\n} else {\n throw new Error(\"Cannot determine runtime environment\");\n}\n\n/**\n * Load a text file and executes it as Javascript\n * @param url The path to load. May be a url or a relative file system path.\n * @private\n */\nasync function nodeLoadScript(url: string) {\n if (url.startsWith(\"file://\")) {\n // handle file:// with filesystem operations rather than with fetch.\n url = url.slice(\"file://\".length);\n }\n if (url.includes(\"://\")) {\n // If it's a url, load it with fetch then eval it.\n nodeVmMod.runInThisContext(await (await fetch(url)).text());\n } else {\n // Otherwise, hopefully it is a relative path we can load from the file\n // system.\n await import(/* webpackIgnore: true */ nodeUrlMod.pathToFileURL(url).href);\n }\n}\n\nexport async function loadLockFile(lockFileURL: string): Promise<Lockfile> {\n if (IN_NODE) {\n await initNodeModules();\n const package_string = await nodeFsPromisesMod.readFile(lockFileURL, {\n encoding: \"utf8\",\n });\n return JSON.parse(package_string);\n } else if (IN_SHELL) {\n const package_string = read(lockFileURL);\n return JSON.parse(package_string);\n } else {\n let response = await fetch(lockFileURL);\n return await response.json();\n }\n}\n\n/**\n * Calculate the directory name of the current module.\n * This is used to guess the indexURL when it is not provided.\n */\nexport async function calculateDirname(): Promise<string> {\n if (IN_NODE_COMMONJS) {\n return __dirname;\n }\n\n let err: Error;\n try {\n throw new Error();\n } catch (e) {\n err = e as Error;\n }\n let fileName = ErrorStackParser.parse(err)[0].fileName!;\n\n if (IN_NODE && !fileName.startsWith(\"file://\")) {\n fileName = `file://${fileName}`; // Error stack filenames are not starting with `file://` in `Bun`\n }\n\n if (IN_NODE_ESM) {\n const nodePath = await import(\"node:path\");\n const nodeUrl = await import(\"node:url\");\n\n // FIXME: We would like to use import.meta.url here,\n // but mocha seems to mess with compiling typescript files to ES6.\n return nodeUrl.fileURLToPath(nodePath.dirname(fileName));\n }\n\n const indexOfLastSlash = fileName.lastIndexOf(pathSep);\n if (indexOfLastSlash === -1) {\n throw new Error(\n \"Could not extract indexURL path from pyodide module location\",\n );\n }\n return fileName.slice(0, indexOfLastSlash);\n}\n\n/**\n * Ensure that the directory exists before trying to download files into it (Node.js only).\n * @param dir The directory to ensure exists\n */\nexport async function ensureDirNode(dir?: string) {\n if (!IN_NODE) {\n return;\n }\n if (!dir) {\n return;\n }\n\n try {\n // Check if the `installBaseUrl` directory exists\n await nodeFsPromisesMod.stat(dir); // Use `.stat()` which works even on ASAR archives of Electron apps, while `.access` doesn't.\n } catch {\n // If it doesn't exist, make it. Call mkdir() here only when necessary after checking the existence to avoid an error on read-only file systems. See https://github.com/pyodide/pyodide/issues/4736\n await nodeFsPromisesMod.mkdir(dir, {\n recursive: true,\n });\n }\n}\n\n/**\n * Calculates the install base url for the package manager.\n * exported for testing\n * @param lockFileURL\n * @returns the install base url\n * @private\n */\nexport function calculateInstallBaseUrl(lockFileURL: string) {\n // 1. If the lockfile URL includes a path with slash (file url in Node.js or http url in browser), use the directory of the lockfile URL\n // 2. Otherwise, fallback to the current location\n // 2.1. In the browser, use `location` to get the current location\n // 2.2. In Node.js just use the pwd\n return (\n lockFileURL.substring(0, lockFileURL.lastIndexOf(\"/\") + 1) ||\n globalThis.location?.toString() ||\n \".\"\n );\n}\n", "import { Module } from \"./types\";\n\n/**\n * @private\n */\nasync function syncfs(m: Module, direction: boolean): Promise<void> {\n return new Promise((resolve, reject) => {\n m.FS.syncfs(direction, (err: any) => {\n if (err) {\n reject(err);\n } else {\n resolve();\n }\n });\n });\n}\n\n/**\n * @private\n */\nexport async function syncLocalToRemote(m: Module): Promise<void> {\n return await syncfs(m, false);\n}\n\n/**\n * @private\n */\nexport async function syncRemoteToLocal(m: Module): Promise<void> {\n return await syncfs(m, true);\n}\n\n/**\n * @private\n */\nexport function initializeNativeFS(module: Module) {\n const FS = module.FS;\n const MEMFS = module.FS.filesystems.MEMFS;\n const PATH = module.PATH;\n\n const nativeFSAsync = {\n // DIR_MODE: {{{ cDefine('S_IFDIR') }}} | 511 /* 0777 */,\n // FILE_MODE: {{{ cDefine('S_IFREG') }}} | 511 /* 0777 */,\n DIR_MODE: 16384 | 511,\n FILE_MODE: 32768 | 511,\n mount: function (mount: any) {\n if (!mount.opts.fileSystemHandle) {\n throw new Error(\"opts.fileSystemHandle is required\");\n }\n\n // reuse all of the core MEMFS functionality\n return MEMFS.mount.apply(null, arguments);\n },\n syncfs: async (mount: any, populate: Boolean, callback: Function) => {\n try {\n const local = nativeFSAsync.getLocalSet(mount);\n const remote = await nativeFSAsync.getRemoteSet(mount);\n const src = populate ? remote : local;\n const dst = populate ? local : remote;\n await nativeFSAsync.reconcile(mount, src, dst);\n callback(null);\n } catch (e) {\n callback(e);\n }\n },\n // Returns file set of emscripten's filesystem at the mountpoint.\n getLocalSet: (mount: any) => {\n let entries = Object.create(null);\n\n function isRealDir(p: string) {\n return p !== \".\" && p !== \"..\";\n }\n\n function toAbsolute(root: string) {\n return (p: string) => {\n return PATH.join2(root, p);\n };\n }\n\n let check = FS.readdir(mount.mountpoint)\n .filter(isRealDir)\n .map(toAbsolute(mount.mountpoint));\n\n while (check.length) {\n let path = check.pop();\n let stat = FS.stat(path);\n\n if (FS.isDir(stat.mode)) {\n check.push.apply(\n check,\n FS.readdir(path).filter(isRealDir).map(toAbsolute(path)),\n );\n }\n\n entries[path] = { timestamp: stat.mtime, mode: stat.mode };\n }\n\n return { type: \"local\", entries: entries };\n },\n // Returns file set of the real, on-disk filesystem at the mountpoint.\n getRemoteSet: async (mount: any) => {\n // TODO: this should be a map.\n const entries = Object.create(null);\n\n const handles = await getFsHandles(mount.opts.fileSystemHandle);\n for (const [path, handle] of handles) {\n if (path === \".\") continue;\n\n entries[PATH.join2(mount.mountpoint, path)] = {\n timestamp:\n handle.kind === \"file\"\n ? new Date((await handle.getFile()).lastModified)\n : new Date(),\n mode:\n handle.kind === \"file\"\n ? nativeFSAsync.FILE_MODE\n : nativeFSAsync.DIR_MODE,\n };\n }\n\n return { type: \"remote\", entries, handles };\n },\n loadLocalEntry: (path: string) => {\n const lookup = FS.lookupPath(path);\n const node = lookup.node;\n const stat = FS.stat(path);\n\n if (FS.isDir(stat.mode)) {\n return { timestamp: stat.mtime, mode: stat.mode };\n } else if (FS.isFile(stat.mode)) {\n node.contents = MEMFS.getFileDataAsTypedArray(node);\n return {\n timestamp: stat.mtime,\n mode: stat.mode,\n contents: node.contents,\n };\n } else {\n throw new Error(\"node type not supported\");\n }\n },\n storeLocalEntry: (path: string, entry: any) => {\n if (FS.isDir(entry[\"mode\"])) {\n FS.mkdirTree(path, entry[\"mode\"]);\n } else if (FS.isFile(entry[\"mode\"])) {\n FS.writeFile(path, entry[\"contents\"], { canOwn: true });\n } else {\n throw new Error(\"node type not supported\");\n }\n\n FS.chmod(path, entry[\"mode\"]);\n FS.utime(path, entry[\"timestamp\"], entry[\"timestamp\"]);\n },\n removeLocalEntry: (path: string) => {\n var stat = FS.stat(path);\n\n if (FS.isDir(stat.mode)) {\n FS.rmdir(path);\n } else if (FS.isFile(stat.mode)) {\n FS.unlink(path);\n }\n },\n loadRemoteEntry: async (handle: any) => {\n if (handle.kind === \"file\") {\n const file = await handle.getFile();\n return {\n contents: new Uint8Array(await file.arrayBuffer()),\n mode: nativeFSAsync.FILE_MODE,\n timestamp: new Date(file.lastModified),\n };\n } else if (handle.kind === \"directory\") {\n return {\n mode: nativeFSAsync.DIR_MODE,\n timestamp: new Date(),\n };\n } else {\n throw new Error(\"unknown kind: \" + handle.kind);\n }\n },\n storeRemoteEntry: async (handles: any, path: string, entry: any) => {\n const parentDirHandle = handles.get(PATH.dirname(path));\n const handle = FS.isFile(entry.mode)\n ? await parentDirHandle.getFileHandle(PATH.basename(path), {\n create: true,\n })\n : await parentDirHandle.getDirectoryHandle(PATH.basename(path), {\n create: true,\n });\n if (handle.kind === \"file\") {\n const writable = await handle.createWritable();\n await writable.write(entry.contents);\n await writable.close();\n }\n handles.set(path, handle);\n },\n removeRemoteEntry: async (handles: any, path: string) => {\n const parentDirHandle = handles.get(PATH.dirname(path));\n await parentDirHandle.removeEntry(PATH.basename(path));\n handles.delete(path);\n },\n reconcile: async (mount: any, src: any, dst: any) => {\n let total = 0;\n\n const create: Array<string> = [];\n Object.keys(src.entries).forEach(function (key) {\n const e = src.entries[key];\n const e2 = dst.entries[key];\n if (\n !e2 ||\n (FS.isFile(e.mode) &&\n e[\"timestamp\"].getTime() > e2[\"timestamp\"].getTime())\n ) {\n create.push(key);\n total++;\n }\n });\n // sort paths in ascending order so directory entries are created\n // before the files inside them\n create.sort();\n\n const remove: Array<string> = [];\n Object.keys(dst.entries).forEach(function (key) {\n if (!src.entries[key]) {\n remove.push(key);\n total++;\n }\n });\n // sort paths in descending order so files are deleted before their\n // parent directories\n remove.sort().reverse();\n\n if (!total) {\n return;\n }\n\n const handles = src.type === \"remote\" ? src.handles : dst.handles;\n\n for (const path of create) {\n const relPath = PATH.normalize(\n path.replace(mount.mountpoint, \"/\"),\n ).substring(1);\n if (dst.type === \"local\") {\n const handle = handles.get(relPath);\n const entry = await nativeFSAsync.loadRemoteEntry(handle);\n nativeFSAsync.storeLocalEntry(path, entry);\n } else {\n const entry = nativeFSAsync.loadLocalEntry(path);\n await nativeFSAsync.storeRemoteEntry(handles, relPath, entry);\n }\n }\n\n for (const path of remove) {\n if (dst.type === \"local\") {\n nativeFSAsync.removeLocalEntry(path);\n } else {\n const relPath = PATH.normalize(\n path.replace(mount.mountpoint, \"/\"),\n ).substring(1);\n await nativeFSAsync.removeRemoteEntry(handles, relPath);\n }\n }\n },\n };\n\n module.FS.filesystems.NATIVEFS_ASYNC = nativeFSAsync;\n}\n\nconst getFsHandles = async (dirHandle: any) => {\n const handles: any = [];\n\n async function collect(curDirHandle: any) {\n for await (const entry of curDirHandle.values()) {\n handles.push(entry);\n if (entry.kind === \"directory\") {\n await collect(entry);\n }\n }\n }\n\n await collect(dirHandle);\n\n const result = new Map();\n result.set(\".\", dirHandle);\n for (const handle of handles) {\n const relativePath = (await dirHandle.resolve(handle)).join(\"/\");\n result.set(relativePath, handle);\n }\n return result;\n};\n", "// @ts-ignore Can't find sentinel.wasm or it's corresponding type declarations\nimport sentinelWasm from \"./sentinel.wasm\";\n\ndeclare const sentinelWasm: Uint8Array;\n\nconst sentinelInstancePromise: Promise<WebAssembly.Instance | undefined> =\n (async function () {\n // Starting with iOS 18.3.1, WebKit on iOS has an issue with the garbage\n // collector that breaks the call trampoline. See #130418 and\n // https://bugs.webkit.org/show_bug.cgi?id=293113 for details.\n let isIOS =\n globalThis.navigator &&\n (/iPad|iPhone|iPod/.test(navigator.userAgent) ||\n // Starting with iPadOS 13, iPads might send a platform string that looks like a desktop Mac.\n // To differentiate, we check if the platform is 'MacIntel' (common for Macs and newer iPads)\n // AND if the device has multi-touch capabilities (navigator.maxTouchPoints > 1)\n (navigator.platform === \"MacIntel\" &&\n typeof navigator.maxTouchPoints !== \"undefined\" &&\n navigator.maxTouchPoints > 1));\n if (isIOS) {\n return undefined;\n }\n return undefined;\n try {\n const module = await WebAssembly.compile(sentinelWasm);\n return await WebAssembly.instantiate(module);\n } catch (e) {\n if (e instanceof WebAssembly.CompileError) {\n return undefined;\n }\n throw e;\n }\n })();\n\ntype SentinelInstance<T> = {\n create_sentinel: () => T;\n is_sentinel: (val: any) => val is T;\n};\n\n/**\n * @private\n */\nexport async function getSentinelImport(): Promise<SentinelInstance<Symbol>> {\n const sentinelInstance = await sentinelInstancePromise;\n if (sentinelInstance) {\n return sentinelInstance.exports as SentinelInstance<Symbol>;\n }\n const error_marker = Symbol(\"error marker\");\n return {\n create_sentinel: () => error_marker,\n is_sentinel: (val: any): val is typeof error_marker => val === error_marker,\n };\n}\n", "/** @private */\n\nimport { ConfigType } from \"./pyodide\";\nimport { initializeNativeFS } from \"./nativefs\";\nimport { loadBinaryFile, getBinaryResponse } from \"./compat\";\nimport { API, PreRunFunc, type Module } from \"./types\";\nimport { getSentinelImport } from \"generated/sentinel\";\n\n/**\n * @private\n * @hidden\n */\nexport interface EmscriptenSettings {\n readonly noImageDecoding?: boolean;\n readonly noAudioDecoding?: boolean;\n readonly noWasmDecoding?: boolean;\n readonly preRun: readonly PreRunFunc[];\n readonly print?: (a: string) => void;\n readonly printErr?: (a: string) => void;\n readonly onExit?: (code: number) => void;\n readonly thisProgram?: string;\n readonly arguments: readonly string[];\n readonly instantiateWasm?: (\n imports: { [key: string]: any },\n successCallback: (\n instance: WebAssembly.Instance,\n module: WebAssembly.Module,\n ) => void,\n ) => void;\n readonly API: API;\n readonly locateFile: (file: string) => string;\n\n noInitialRun?: boolean;\n INITIAL_MEMORY?: number;\n exitCode?: number;\n}\n\n/**\n * Get the base settings to use to load Pyodide.\n *\n * @private\n */\nexport function createSettings(config: ConfigType): EmscriptenSettings {\n const settings: EmscriptenSettings = {\n noImageDecoding: true,\n noAudioDecoding: true,\n noWasmDecoding: false,\n preRun: getFileSystemInitializationFuncs(config),\n print: config.stdout,\n printErr: config.stderr,\n onExit(code) {\n settings.exitCode = code;\n },\n thisProgram: config._sysExecutable,\n arguments: config.args,\n API: { config } as API,\n // Emscripten calls locateFile exactly one time with argument\n // pyodide.asm.wasm to get the URL it should download it from.\n //\n // If we set instantiateWasm the return value of locateFile actually is\n // unused, but Emscripten calls it anyways. We set instantiateWasm except\n // when compiling with source maps, see comment in getInstantiateWasmFunc().\n //\n // It also is called when Emscripten tries to find a dependency of a shared\n // library but it failed to find it in the file system. But for us that\n // means dependency resolution has already failed and we want to throw an\n // error anyways.\n locateFile: (path: string) => config.indexURL + path,\n instantiateWasm: getInstantiateWasmFunc(config.indexURL),\n };\n return settings;\n}\n\n/**\n * Make the home directory inside the virtual file system,\n * then change the working directory to it.\n *\n * @param Module The Emscripten Module.\n * @param path The path to the home directory.\n * @private\n */\nfunction createHomeDirectory(path: string): PreRunFunc {\n return function (Module) {\n const fallbackPath = \"/\";\n try {\n Module.FS.mkdirTree(path);\n } catch (e) {\n console.error(`Error occurred while making a home directory '${path}':`);\n console.error(e);\n console.error(`Using '${fallbackPath}' for a home directory instead`);\n path = fallbackPath;\n }\n Module.FS.chdir(path);\n };\n}\n\nfunction setEnvironment(env: { [key: string]: string }): PreRunFunc {\n return function (Module) {\n Object.assign(Module.ENV, env);\n };\n}\n\n/**\n * Mount local directories to the virtual file system. Only for Node.js.\n * @param mounts The list of paths to mount.\n */\nfunction callFsInitHook(\n fsInit: undefined | ((fs: typeof FS, info: { sitePackages: string }) => void),\n): PreRunFunc[] {\n if (!fsInit) {\n return [];\n }\n return [\n async (Module) => {\n Module.addRunDependency(\"fsInitHook\");\n try {\n await fsInit(Module.FS, { sitePackages: Module.API.sitePackages });\n } finally {\n Module.removeRunDependency(\"fsInitHook\");\n }\n },\n ];\n}\n\nfunction computeVersionTuple(Module: Module): [number, number, number] {\n const versionInt = Module.HEAPU32[Module._Py_Version >>> 2];\n const major = (versionInt >>> 24) & 0xff;\n const minor = (versionInt >>> 16) & 0xff;\n const micro = (versionInt >>> 8) & 0xff;\n return [major, minor, micro];\n}\n/**\n * Install the Python standard library to the virtual file system.\n *\n * Previously, this was handled by Emscripten's file packager (pyodide.asm.data).\n * However, using the file packager means that we have only one version\n * of the standard library available. We want to be able to use different\n * versions of the standard library, for example:\n *\n * - Use compiled(.pyc) or uncompiled(.py) standard library.\n * - Remove unused modules or add additional modules using bundlers like pyodide-pack.\n *\n * @param stdlibURL The URL for the Python standard library\n */\nfunction installStdlib(stdlibURL: string): PreRunFunc {\n const stdlibPromise: Promise<Uint8Array> = loadBinaryFile(stdlibURL);\n return async (Module: Module) => {\n Module.API.pyVersionTuple = computeVersionTuple(Module);\n const [pymajor, pyminor] = Module.API.pyVersionTuple;\n Module.FS.mkdirTree(\"/lib\");\n Module.API.sitePackages = `/lib/python${pymajor}.${pyminor}/site-packages`;\n Module.FS.mkdirTree(Module.API.sitePackages);\n Module.addRunDependency(\"install-stdlib\");\n\n try {\n const stdlib = await stdlibPromise;\n Module.FS.writeFile(`/lib/python${pymajor}${pyminor}.zip`, stdlib);\n } catch (e) {\n console.error(\"Error occurred while installing the standard library:\");\n console.error(e);\n } finally {\n Module.removeRunDependency(\"install-stdlib\");\n }\n };\n}\n\n/**\n * Initialize the virtual file system, before loading Python interpreter.\n * @private\n */\nfunction getFileSystemInitializationFuncs(config: ConfigType): PreRunFunc[] {\n let stdLibURL;\n if (config.stdLibURL != undefined) {\n stdLibURL = config.stdLibURL;\n } else {\n stdLibURL = config.indexURL + \"python_stdlib.zip\";\n }\n\n return [\n installStdlib(stdLibURL),\n createHomeDirectory(config.env.HOME),\n setEnvironment(config.env),\n initializeNativeFS,\n ...callFsInitHook(config.fsInit),\n ];\n}\n\nfunction getInstantiateWasmFunc(\n indexURL: string,\n): EmscriptenSettings[\"instantiateWasm\"] {\n // @ts-ignore\n if (SOURCEMAP || typeof WasmOffsetConverter !== \"undefined\") {\n // According to the docs:\n //\n // \"Sanitizers or source map is currently not supported if overriding\n // WebAssembly instantiation with Module.instantiateWasm.\"\n // https://emscripten.org/docs/api_reference/module.html?highlight=instantiatewasm#Module.instantiateWasm\n //\n // typeof WasmOffsetConverter !== \"undefined\" checks for asan.\n return;\n }\n const { binary, response } = getBinaryResponse(indexURL + \"pyodide.asm.wasm\");\n const sentinelImportPromise = getSentinelImport();\n return function (\n imports: { [key: string]: { [key: string]: any } },\n successCallback: (\n instance: WebAssembly.Instance,\n module: WebAssembly.Module,\n ) => void,\n ) {\n (async function () {\n imports.sentinel = await sentinelImportPromise;\n try {\n let res: WebAssembly.WebAssemblyInstantiatedSource;\n if (response) {\n res = await WebAssembly.instantiateStreaming(response, imports);\n } else {\n res = await WebAssembly.instantiate(await binary, imports);\n }\n const { instance, module } = res;\n successCallback(instance, module);\n } catch (e) {\n console.warn(\"wasm instantiation failed!\");\n console.warn(e);\n }\n })();\n\n return {}; // Compiling asynchronously, no exports.\n };\n}\n", "/**\n *\n * The Pyodide version.\n *\n * The version here is a Python version, following :pep:`440`. This is different\n * from the version in ``package.json`` which follows the node package manager\n * version convention.\n */\nexport const version: string = \"0.28.1\";\n", "/**\n * The main bootstrap code for loading pyodide.\n */\nimport {\n calculateDirname,\n loadScript,\n initNodeModules,\n resolvePath,\n loadLockFile,\n calculateInstallBaseUrl,\n} from \"./compat\";\n\nimport { createSettings } from \"./emscripten-settings\";\nimport { version as version_ } from \"./version\";\n\nimport type { PyodideAPI } from \"./api.js\";\nimport type {\n TypedArray,\n Module,\n PackageData,\n FSType,\n Lockfile,\n} from \"./types\";\nimport type { EmscriptenSettings } from \"./emscripten-settings\";\nimport type { SnapshotConfig } from \"./snapshot\";\nexport type { PyodideAPI, TypedArray };\nexport type { LockfileInfo, LockfilePackage, Lockfile } from \"./types\";\n\nexport { type PackageData };\n\n/**\n * The Pyodide version.\n *\n * The version here is a Python version, following :pep:`440`. This is different\n * from the version in ``package.json`` which follows the node package manager\n * version convention.\n */\nexport const version: string = version_;\n\ndeclare function _createPyodideModule(\n settings: EmscriptenSettings,\n): Promise<Module>;\n\n// BUILD_ID is generated from hashing together pyodide.asm.js and\n// pyodide.asm.wasm in esbuild.config.outer.mjs\n//\n// It is used to check that memory snapshots were generated by the same build of\n// the runtime that is trying to use them. Attempting to use a snapshot from a\n// different build will fail badly. See logic in snapshot.ts.\ndeclare const BUILD_ID: string;\n\n/**\n * See documentation for loadPyodide.\n * @hidden\n */\nexport type ConfigType = {\n indexURL: string;\n packageCacheDir: string;\n lockFileContents: Lockfile | string | Promise<Lockfile | string>;\n fullStdLib?: boolean;\n stdLibURL?: string;\n stdin?: () => string;\n stdout?: (msg: string) => void;\n stderr?: (msg: string) => void;\n jsglobals?: object;\n _sysExecutable?: string;\n args: string[];\n fsInit?: (FS: FSType, info: { sitePackages: string }) => Promise<void>;\n env: { [key: string]: string };\n packages: string[];\n _makeSnapshot: boolean;\n enableRunUntilComplete: boolean;\n checkAPIVersion: boolean;\n BUILD_ID: string;\n packageBaseUrl?: string;\n cdnUrl: string;\n};\n\n/**\n * Load the main Pyodide wasm module and initialize it.\n *\n * @returns The :ref:`js-api-pyodide` module.\n * @example\n * async function main() {\n * const pyodide = await loadPyodide({\n * fullStdLib: true,\n * stdout: (msg) => console.log(`Pyodide: ${msg}`),\n * });\n * console.log(\"Loaded Pyodide\");\n * }\n * main();\n */\nexport async function loadPyodide(\n options: {\n /**\n * The URL from which Pyodide will load the main Pyodide runtime and\n * packages. It is recommended that you leave this unchanged, providing an\n * incorrect value can cause broken behavior.\n *\n * Default: The url that Pyodide is loaded from with the file name\n * (``pyodide.js`` or ``pyodide.mjs``) removed.\n */\n indexURL?: string;\n\n /**\n * The file path where packages will be cached in node. If a package\n * exists in ``packageCacheDir`` it is loaded from there, otherwise it is\n * downloaded from the JsDelivr CDN and then cached into ``packageCacheDir``.\n * Only applies when running in node; ignored in browsers.\n *\n * Default: same as indexURL\n */\n packageCacheDir?: string;\n\n /**\n * The URL from which Pyodide will load the Pyodide ``pyodide-lock.json`` lock\n * file. You can produce custom lock files with :py:func:`micropip.freeze`.\n * Default: ```${indexURL}/pyodide-lock.json```\n */\n lockFileURL?: string;\n /**\n * The contents of a lockfile. If a string, it should be valid json and\n * ``JSON.parse()`` should return a ``Lockfile`` instance. See\n * :js:interface:`~pyodide.Lockfile` for the schema.\n */\n lockFileContents?: Lockfile | string | Promise<Lockfile | string>;\n /**\n * The base url relative to which a relative value of\n * :js:attr:`~pyodide.LockfilePackage.file_name` is interpreted. If\n * ``lockfileContents`` is provided, then ``lockFileContents`` must be\n * provided explicitly in order to install packages with relative paths.\n *\n * Otherwise, the default is calculated as follows:\n *\n * 1. If `lockFileURL` contains a ``/``, the default is everything before the last\n * ``/`` in ``lockFileURL``.\n * 2. If in the browser, the default is ``location.toString()``.\n * 3. Otherwise, the default is `'.'`.\n */\n packageBaseUrl?: string;\n /**\n * Load the full Python standard library. Setting this to false excludes\n * unvendored modules from the standard library.\n * Default: ``false``\n */\n fullStdLib?: boolean;\n /**\n * The URL from which to load the standard library ``python_stdlib.zip``\n * file. This URL includes the most of the Python standard library. Some\n * stdlib modules were unvendored, and can be loaded separately\n * with ``fullStdLib: true`` option or by their package name.\n * Default: ```${indexURL}/python_stdlib.zip```\n */\n stdLibURL?: string;\n /**\n * Override the standard input callback. Should ask the user for one line of\n * input. The :js:func:`pyodide.setStdin` function is more flexible and\n * should be preferred.\n */\n stdin?: () => string;\n /**\n * Override the standard output callback. The :js:func:`pyodide.setStdout`\n * function is more flexible and should be preferred in most cases, but\n * depending on the ``args`` passed to ``loadPyodide``, Pyodide may write to\n * stdout on startup, which can only be controlled by passing a custom\n * ``stdout`` function.\n */\n stdout?: (msg: string) => void;\n /**\n * Override the standard error output callback. The\n * :js:func:`pyodide.setStderr` function is more flexible and should be\n * preferred in most cases, but depending on the ``args`` passed to\n * ``loadPyodide``, Pyodide may write to stdout on startup, which can only\n * be controlled by passing a custom ``stdout`` function.\n */\n stderr?: (msg: string) => void;\n /**\n * The object that Pyodide will use for the ``js`` module.\n * Default: ``globalThis``\n */\n jsglobals?: object;\n /**\n * Determine the value of ``sys.executable``.\n * @ignore\n */\n _sysExecutable?: string;\n /**\n * Command line arguments to pass to Python on startup. See `Python command\n * line interface options\n * <https://docs.python.org/3.10/using/cmdline.html#interface-options>`_ for\n * more details. Default: ``[]``\n */\n args?: string[];\n /**\n * Environment variables to pass to Python. This can be accessed inside of\n * Python at runtime via :py:data:`os.environ`. Certain environment variables change\n * the way that Python loads:\n * https://docs.python.org/3.10/using/cmdline.html#environment-variables\n * Default: ``{}``.\n * If ``env.HOME`` is undefined, it will be set to a default value of\n * ``\"/home/pyodide\"``\n */\n env?: { [key: string]: string };\n /**\n * A list of packages to load as Pyodide is initializing.\n *\n * This is the same as loading the packages with\n * :js:func:`pyodide.loadPackage` after Pyodide is loaded except using the\n * ``packages`` option is more efficient because the packages are downloaded\n * while Pyodide bootstraps itself.\n */\n packages?: string[];\n /**\n * Opt into the old behavior where :js:func:`PyProxy.toString() <pyodide.ffi.PyProxy.toString>`\n * calls :py:func:`repr` and not :py:class:`str() <str>`. Deprecated.\n * @deprecated\n */\n pyproxyToStringRepr?: boolean;\n /**\n * Make loop.run_until_complete() function correctly using stack switching.\n * Default: ``true``.\n */\n enableRunUntilComplete?: boolean;\n /**\n * If true (default), throw an error if the version of Pyodide core does not\n * match the version of the Pyodide js package.\n */\n checkAPIVersion?: boolean;\n /**\n * This is a hook that allows modification of the file system before the\n * main() function is called and the intereter is started. When this is\n * called, it is guaranteed that there is an empty site-packages directory.\n * @experimental\n */\n fsInit?: (FS: FSType, info: { sitePackages: string }) => Promise<void>;\n /**\n * Opt into the old behavior where JavaScript `null` is converted to `None`\n * instead of `jsnull`. Deprecated.\n * @deprecated\n */\n convertNullToNone?: boolean;\n /** @ignore */\n _makeSnapshot?: boolean;\n /** @ignore */\n _loadSnapshot?:\n | Uint8Array\n | ArrayBuffer\n | PromiseLike<Uint8Array | ArrayBuffer>;\n /** @ignore */\n _snapshotDeserializer?: (obj: any) => any;\n } = {},\n): Promise<PyodideAPI> {\n if (options.lockFileContents && options.lockFileURL) {\n throw new Error(\"Can't pass both lockFileContents and lockFileURL\");\n }\n await initNodeModules();\n\n // Relative paths cause havoc.\n let indexURL = options.indexURL || (await calculateDirname());\n indexURL = resolvePath(indexURL);\n if (!indexURL.endsWith(\"/\")) {\n indexURL += \"/\";\n }\n const options_ = options as ConfigType;\n if (!options.lockFileContents) {\n const lockFileURL = options.lockFileURL ?? indexURL + \"pyodide-lock.json\";\n options_.lockFileContents = loadLockFile(lockFileURL);\n // packageBaseUrl isn't present, try using base location of lockFileUrl. If\n // lockFileURL is relative, use location as the base URL.\n options_.packageBaseUrl ??= calculateInstallBaseUrl(lockFileURL);\n }\n options_.indexURL = indexURL;\n // cdnUrl only for node.\n options_.cdnUrl =\n options_.packageBaseUrl ??\n `https://cdn.jsdelivr.net/pyodide/v${version}/full/`;\n\n if (options.packageCacheDir) {\n let packageCacheDir = resolvePath(options.packageCacheDir);\n if (!packageCacheDir.endsWith(\"/\")) {\n packageCacheDir += \"/\";\n }\n options.packageCacheDir = packageCacheDir;\n }\n\n const default_config = {\n fullStdLib: false,\n jsglobals: globalThis,\n stdin: globalThis.prompt ? globalThis.prompt : undefined,\n args: [],\n env: {},\n packages: [],\n packageCacheDir: options_.packageBaseUrl,\n enableRunUntilComplete: true,\n checkAPIVersion: true,\n BUILD_ID,\n };\n const config = Object.assign(default_config, options_) as ConfigType;\n config.env.HOME ??= \"/home/pyodide\";\n /**\n * `PyErr_Print()` will call `exit()` if the exception is a `SystemError`.\n * This shuts down the Python interpreter, which is a change in behavior from\n * what happened before. In order to avoid this, we set the `inspect` config\n * parameter which prevents `PyErr_Print()` from calling `exit()`. Except in\n * the cli runner, we actually do want to exit. So set default to true and in\n * cli runner we explicitly set it to false.\n */\n config.env.PYTHONINSPECT ??= \"1\";\n const emscriptenSettings = createSettings(config);\n const API = emscriptenSettings.API;\n API.lockFilePromise = Promise.resolve(options_.lockFileContents);\n\n // If the pyodide.asm.js script has been imported, we can skip the dynamic import\n // Users can then do a static import of the script in environments where\n // dynamic importing is not allowed or not desirable, like module-type service workers\n if (typeof _createPyodideModule !== \"function\") {\n const scriptSrc = `${config.indexURL}pyodide.asm.js`;\n await loadScript(scriptSrc);\n }\n\n let snapshot: Uint8Array | undefined = undefined;\n if (options._loadSnapshot) {\n const snp = await options._loadSnapshot;\n if (ArrayBuffer.isView(snp)) {\n snapshot = snp;\n } else {\n snapshot = new Uint8Array(snp);\n }\n emscriptenSettings.noInitialRun = true;\n // @ts-ignore\n emscriptenSettings.INITIAL_MEMORY = snapshot.length;\n }\n\n // _createPyodideModule is specified in the Makefile by the linker flag:\n // `-s EXPORT_NAME=\"'_createPyodideModule'\"`\n const Module = await _createPyodideModule(emscriptenSettings);\n // Handle early exit\n if (emscriptenSettings.exitCode !== undefined) {\n throw new Module.ExitStatus(emscriptenSettings.exitCode);\n }\n if (options.pyproxyToStringRepr) {\n API.setPyProxyToStringMethod(true);\n }\n if (options.convertNullToNone) {\n API.setCompatNullToNone(true);\n }\n\n if (API.version !== version && config.checkAPIVersion) {\n throw new Error(`\\\nPyodide version does not match: '${version}' <==> '${API.version}'. \\\nIf you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.\\\n`);\n }\n // Disable further loading of Emscripten file_packager stuff.\n Module.locateFile = (path: string) => {\n if (path.endsWith(\".so\")) {\n throw new Error(`Failed to find dynamic library \"${path}\"`);\n }\n throw new Error(`Unexpected call to locateFile(\"${path}\")`);\n };\n\n let snapshotConfig: SnapshotConfig | undefined = undefined;\n if (snapshot) {\n snapshotConfig = API.restoreSnapshot(snapshot);\n }\n // runPython works starting after the call to finalizeBootstrap.\n const pyodide = API.finalizeBootstrap(\n snapshotConfig,\n options._snapshotDeserializer,\n );\n API.sys.path.insert(0, \"\");\n\n API._pyodide.set_excepthook();\n await API.packageIndexReady;\n // I think we want this initializeStreams call to happen after\n // packageIndexReady? I don't remember why.\n API.initializeStreams(config.stdin, config.stdout, config.stderr);\n return pyodide;\n}\n"],
5
- "mappings": "uuCAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,iBAAAE,EAAA,YAAAC,ICIA,SAASC,GAAUC,EAAG,CACpB,MAAO,CAAC,MAAM,WAAWA,CAA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CAAI,IAAI,CAC5D,EAEA,IAAIC,EACAJ,IACFI,EAAiBP,EAAI,gBAAgBG,CAAQ,GAG/C,IAAMK,EAAUR,EAAI,kBAClBO,EACArB,EAAQ,qBACV,EACA,OAAAc,EAAI,IAAI,KAAK,OAAO,EAAG,EAAE,EAEzBA,EAAI,SAAS,eAAe,EAC5B,MAAMA,EAAI,kBAGVA,EAAI,kBAAkBH,EAAO,MAAOA,EAAO,OAAQA,EAAO,MAAM,EACzDW,CACT,CA9RsBC,EAAAxB,EAAA,eTzFrB,WAAmB,YAAcyB",
6
- "names": ["pyodide_umd_exports", "__export", "loadPyodide", "version", "_isNumber", "n", "__name", "_capitalize", "str", "_getter", "p", "booleanProps", "numericProps", "stringProps", "arrayProps", "objectProps", "props", "StackFrame", "obj", "i", "v", "fileName", "lineNumber", "columnNumber", "functionName", "argsStartIndex", "argsEndIndex", "args", "locationString", "parts", "j", "k", "stackframe_default", "ErrorStackParser", "CHROME_IE_STACK_REGEXP", "SAFARI_NATIVE_CODE_REGEXP", "__name", "error", "urlLike", "regExp", "parts", "filtered", "line", "sanitizedLine", "location", "locationParts", "functionName", "fileName", "stackframe_default", "functionNameRegex", "matches", "errorStackParser", "error_stack_parser_default", "errorStackParser", "IN_NODE", "IN_NODE_COMMONJS", "__require", "IN_NODE_ESM", "IN_BUN", "IN_DENO", "IN_BROWSER", "IN_BROWSER_MAIN_THREAD", "IN_BROWSER_WEB_WORKER", "IN_SAFARI", "IN_SHELL", "nodeUrlMod", "nodePath", "nodeVmMod", "nodeFSMod", "nodeFsPromisesMod", "initNodeModules", "IN_NODE", "pathSep", "__require", "fs", "crypto", "ws", "child_process", "node_modules", "mod", "__name", "node_resolvePath", "path", "base", "nodePath", "__name", "browser_resolvePath", "resolvePath", "IN_NODE", "IN_SHELL", "x", "pathSep", "node_getBinaryResponse", "_file_sub_resource_hash", "nodeFsPromisesMod", "data", "shell_getBinaryResponse", "browser_getBinaryResponse", "subResourceHash", "url", "getBinaryResponse", "loadBinaryFile", "file_sub_resource_hash", "response", "binary", "r", "loadScript", "IN_BROWSER_MAIN_THREAD", "IN_BROWSER_WEB_WORKER", "e", "nodeLoadScript", "nodeVmMod", "nodeUrlMod", "loadLockFile", "lockFileURL", "initNodeModules", "package_string", "calculateDirname", "IN_NODE_COMMONJS", "err", "fileName", "error_stack_parser_default", "IN_NODE_ESM", "indexOfLastSlash", "calculateInstallBaseUrl", "lockFileURL", "__name", "initializeNativeFS", "module", "FS", "MEMFS", "PATH", "nativeFSAsync", "__name", "mount", "populate", "callback", "local", "remote", "src", "dst", "e", "entries", "isRealDir", "p", "toAbsolute", "root", "check", "path", "stat", "handles", "getFsHandles", "handle", "node", "entry", "file", "parentDirHandle", "writable", "total", "create", "key", "e2", "remove", "relPath", "dirHandle", "collect", "curDirHandle", "result", "relativePath", "sentinelInstancePromise", "module", "sentinel_default", "e", "getSentinelImport", "sentinelInstance", "error_marker", "__name", "val", "createSettings", "config", "settings", "getFileSystemInitializationFuncs", "code", "__name", "path", "getInstantiateWasmFunc", "createHomeDirectory", "Module", "fallbackPath", "e", "setEnvironment", "env", "callFsInitHook", "fsInit", "computeVersionTuple", "versionInt", "major", "minor", "micro", "installStdlib", "stdlibURL", "stdlibPromise", "loadBinaryFile", "pymajor", "pyminor", "stdlib", "stdLibURL", "initializeNativeFS", "indexURL", "binary", "response", "getBinaryResponse", "sentinelImportPromise", "getSentinelImport", "imports", "successCallback", "res", "instance", "module", "version", "version", "loadPyodide", "options", "initNodeModules", "indexURL", "calculateDirname", "resolvePath", "options_", "lockFileURL", "loadLockFile", "calculateInstallBaseUrl", "packageCacheDir", "default_config", "config", "emscriptenSettings", "createSettings", "API", "scriptSrc", "loadScript", "snapshot", "snp", "Module", "path", "snapshotConfig", "pyodide", "__name", "loadPyodide"]
3
+ "sources": ["../src/js/pyodide.umd.ts", "../src/js/vendor/stackframe/stackframe.ts", "../src/js/vendor/stackframe/error-stack-parser.ts", "../src/js/environments.ts", "../src/js/compat.ts", "../src/js/nativefs.ts", "../src/core/sentinel.ts", "../src/js/emscripten-settings.ts", "../src/js/version.ts", "../src/js/common/path.ts", "../src/js/pyodide.ts"],
4
+ "sourcesContent": ["import { loadPyodide, version } from \"./pyodide\";\nimport { type PackageData } from \"./types\";\nexport { loadPyodide, version, type PackageData };\n(globalThis as any).loadPyodide = loadPyodide;\n", "// @ts-nocheck\n// Port of https://github.com/stacktracejs/stackframe/blob/master/stackframe.js.\n// Rewritten to ES6 and removed UMD and CommonJS support.\n\nfunction _isNumber(n) {\n return !isNaN(parseFloat(n)) && isFinite(n);\n}\n\nfunction _capitalize(str) {\n return str.charAt(0).toUpperCase() + str.substring(1);\n}\n\nfunction _getter(p) {\n return function () {\n return this[p];\n };\n}\n\nvar booleanProps = [\"isConstructor\", \"isEval\", \"isNative\", \"isToplevel\"];\nvar numericProps = [\"columnNumber\", \"lineNumber\"];\nvar stringProps = [\"fileName\", \"functionName\", \"source\"];\nvar arrayProps = [\"args\"];\nvar objectProps = [\"evalOrigin\"];\n\nvar props = booleanProps.concat(\n numericProps,\n stringProps,\n arrayProps,\n objectProps,\n);\n\ndeclare namespace StackFrame {\n export interface StackFrameOptions {\n isConstructor?: boolean;\n isEval?: boolean;\n isNative?: boolean;\n isToplevel?: boolean;\n columnNumber?: number;\n lineNumber?: number;\n fileName?: string;\n functionName?: string;\n source?: string;\n args?: any[];\n evalOrigin?: StackFrame;\n }\n}\n\ndeclare class StackFrame {\n constructor(obj: StackFrame.StackFrameOptions);\n\n args?: any[];\n getArgs(): any[] | undefined;\n setArgs(args: any[]): void;\n\n evalOrigin?: StackFrame;\n getEvalOrigin(): StackFrame | undefined;\n setEvalOrigin(stackframe: StackFrame): void;\n\n isConstructor?: boolean;\n getIsConstructor(): boolean | undefined;\n setIsConstructor(isConstructor: boolean): void;\n\n isEval?: boolean;\n getIsEval(): boolean | undefined;\n setIsEval(isEval: boolean): void;\n\n isNative?: boolean;\n getIsNative(): boolean | undefined;\n setIsNative(isNative: boolean): void;\n\n isToplevel?: boolean;\n getIsToplevel(): boolean | undefined;\n setIsToplevel(isToplevel: boolean): void;\n\n columnNumber?: number;\n getColumnNumber(): number | undefined;\n setColumnNumber(columnNumber: number): void;\n\n lineNumber?: number;\n getLineNumber(): number | undefined;\n setLineNumber(lineNumber: number): void;\n\n fileName?: string;\n getFileName(): string | undefined;\n setFileName(fileName: string): void;\n\n functionName?: string;\n getFunctionName(): string | undefined;\n setFunctionName(functionName: string): void;\n\n source?: string;\n getSource(): string | undefined;\n setSource(source: string): void;\n\n toString(): string;\n}\n\nfunction StackFrame(obj) {\n if (!obj) return;\n for (var i = 0; i < props.length; i++) {\n if (obj[props[i]] !== undefined) {\n this[\"set\" + _capitalize(props[i])](obj[props[i]]);\n }\n }\n}\n\nStackFrame.prototype = {\n getArgs: function () {\n return this.args;\n },\n setArgs: function (v) {\n if (Object.prototype.toString.call(v) !== \"[object Array]\") {\n throw new TypeError(\"Args must be an Array\");\n }\n this.args = v;\n },\n\n getEvalOrigin: function () {\n return this.evalOrigin;\n },\n setEvalOrigin: function (v) {\n if (v instanceof StackFrame) {\n this.evalOrigin = v;\n } else if (v instanceof Object) {\n this.evalOrigin = new StackFrame(v);\n } else {\n throw new TypeError(\"Eval Origin must be an Object or StackFrame\");\n }\n },\n\n toString: function () {\n var fileName = this.getFileName() || \"\";\n var lineNumber = this.getLineNumber() || \"\";\n var columnNumber = this.getColumnNumber() || \"\";\n var functionName = this.getFunctionName() || \"\";\n if (this.getIsEval()) {\n if (fileName) {\n return (\n \"[eval] (\" + fileName + \":\" + lineNumber + \":\" + columnNumber + \")\"\n );\n }\n return \"[eval]:\" + lineNumber + \":\" + columnNumber;\n }\n if (functionName) {\n return (\n functionName +\n \" (\" +\n fileName +\n \":\" +\n lineNumber +\n \":\" +\n columnNumber +\n \")\"\n );\n }\n return fileName + \":\" + lineNumber + \":\" + columnNumber;\n },\n};\n\nStackFrame.fromString = function StackFrame$$fromString(str) {\n var argsStartIndex = str.indexOf(\"(\");\n var argsEndIndex = str.lastIndexOf(\")\");\n\n var functionName = str.substring(0, argsStartIndex);\n var args = str.substring(argsStartIndex + 1, argsEndIndex).split(\",\");\n var locationString = str.substring(argsEndIndex + 1);\n\n if (locationString.indexOf(\"@\") === 0) {\n var parts = /@(.+?)(?::(\\d+))?(?::(\\d+))?$/.exec(locationString, \"\");\n var fileName = parts[1];\n var lineNumber = parts[2];\n var columnNumber = parts[3];\n }\n\n return new StackFrame({\n functionName: functionName,\n args: args || undefined,\n fileName: fileName,\n lineNumber: lineNumber || undefined,\n columnNumber: columnNumber || undefined,\n });\n};\n\nfor (var i = 0; i < booleanProps.length; i++) {\n StackFrame.prototype[\"get\" + _capitalize(booleanProps[i])] = _getter(\n booleanProps[i],\n );\n StackFrame.prototype[\"set\" + _capitalize(booleanProps[i])] = (function (p) {\n return function (v) {\n this[p] = Boolean(v);\n };\n })(booleanProps[i]);\n}\n\nfor (var j = 0; j < numericProps.length; j++) {\n StackFrame.prototype[\"get\" + _capitalize(numericProps[j])] = _getter(\n numericProps[j],\n );\n StackFrame.prototype[\"set\" + _capitalize(numericProps[j])] = (function (p) {\n return function (v) {\n if (!_isNumber(v)) {\n throw new TypeError(p + \" must be a Number\");\n }\n this[p] = Number(v);\n };\n })(numericProps[j]);\n}\n\nfor (var k = 0; k < stringProps.length; k++) {\n StackFrame.prototype[\"get\" + _capitalize(stringProps[k])] = _getter(\n stringProps[k],\n );\n StackFrame.prototype[\"set\" + _capitalize(stringProps[k])] = (function (p) {\n return function (v) {\n this[p] = String(v);\n };\n })(stringProps[k]);\n}\n\nexport default StackFrame;\n", "// @ts-nocheck\n// Port of https://github.com/stacktracejs/error-stack-parser\n// Rewritten to ES6 and removed UMD and CommonJS support.\n// Removed old opera support.\n\nimport StackFrame from \"./stackframe\";\n\ndeclare namespace ErrorStackParser {\n export type { StackFrame };\n /**\n * Given an Error object, extract the most information from it.\n *\n * @param {Error} error object\n * @return {Array} of StackFrames\n */\n export function parse(error: Error): StackFrame[];\n}\n\nfunction ErrorStackParser() {\n var CHROME_IE_STACK_REGEXP = /^\\s*at .*(\\S+:\\d+|\\(native\\))/m;\n var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\\[native code])?$/;\n\n return {\n /**\n * Given an Error object, extract the most information from it.\n *\n * @param {Error} error object\n * @return {Array} of StackFrames\n */\n parse: function ErrorStackParser$$parse(error: Error): StackFrame[] {\n if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {\n return this.parseV8OrIE(error);\n } else if (error.stack) {\n return this.parseFFOrSafari(error);\n } else {\n throw new Error(\"Cannot parse given Error object\");\n }\n },\n\n // Separate line and column numbers from a string of the form: (URI:Line:Column)\n extractLocation: function ErrorStackParser$$extractLocation(urlLike) {\n // Fail-fast but return locations like \"(native)\"\n if (urlLike.indexOf(\":\") === -1) {\n return [urlLike];\n }\n\n var regExp = /(.+?)(?::(\\d+))?(?::(\\d+))?$/;\n var parts = regExp.exec(urlLike.replace(/[()]/g, \"\"));\n return [parts[1], parts[2] || undefined, parts[3] || undefined];\n },\n\n parseV8OrIE: function ErrorStackParser$$parseV8OrIE(error) {\n var filtered = error.stack.split(\"\\n\").filter(function (line) {\n return !!line.match(CHROME_IE_STACK_REGEXP);\n }, this);\n\n return filtered.map(function (line) {\n if (line.indexOf(\"(eval \") > -1) {\n // Throw away eval information until we implement stacktrace.js/stackframe#8\n line = line\n .replace(/eval code/g, \"eval\")\n .replace(/(\\(eval at [^()]*)|(,.*$)/g, \"\");\n }\n var sanitizedLine = line\n .replace(/^\\s+/, \"\")\n .replace(/\\(eval code/g, \"(\")\n .replace(/^.*?\\s+/, \"\");\n\n // capture and preserve the parenthesized location \"(/foo/my bar.js:12:87)\" in\n // case it has spaces in it, as the string is split on \\s+ later on\n var location = sanitizedLine.match(/ (\\(.+\\)$)/);\n\n // remove the parenthesized location from the line, if it was matched\n sanitizedLine = location\n ? sanitizedLine.replace(location[0], \"\")\n : sanitizedLine;\n\n // if a location was matched, pass it to extractLocation() otherwise pass all sanitizedLine\n // because this line doesn't have function name\n var locationParts = this.extractLocation(\n location ? location[1] : sanitizedLine,\n );\n var functionName = (location && sanitizedLine) || undefined;\n var fileName =\n [\"eval\", \"<anonymous>\"].indexOf(locationParts[0]) > -1\n ? undefined\n : locationParts[0];\n\n return new StackFrame({\n functionName: functionName,\n fileName: fileName,\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n source: line,\n });\n }, this);\n },\n\n parseFFOrSafari: function ErrorStackParser$$parseFFOrSafari(error) {\n var filtered = error.stack.split(\"\\n\").filter(function (line) {\n return !line.match(SAFARI_NATIVE_CODE_REGEXP);\n }, this);\n\n return filtered.map(function (line) {\n // Throw away eval information until we implement stacktrace.js/stackframe#8\n if (line.indexOf(\" > eval\") > -1) {\n line = line.replace(\n / line (\\d+)(?: > eval line \\d+)* > eval:\\d+:\\d+/g,\n \":$1\",\n );\n }\n\n if (line.indexOf(\"@\") === -1 && line.indexOf(\":\") === -1) {\n // Safari eval frames only have function names and nothing else\n return new StackFrame({\n functionName: line,\n });\n } else {\n var functionNameRegex = /((.*\".+\"[^@]*)?[^@]*)(?:@)/;\n var matches = line.match(functionNameRegex);\n var functionName = matches && matches[1] ? matches[1] : undefined;\n var locationParts = this.extractLocation(\n line.replace(functionNameRegex, \"\"),\n );\n\n return new StackFrame({\n functionName: functionName,\n fileName: locationParts[0],\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n source: line,\n });\n }\n }, this);\n },\n };\n}\n\nconst errorStackParser = new ErrorStackParser();\n\nexport { StackFrame };\nexport default errorStackParser;\n", "// @ts-nocheck\n\n/** @private */\nexport const IN_NODE =\n typeof process === \"object\" &&\n typeof process.versions === \"object\" &&\n typeof process.versions.node === \"string\" &&\n !process.browser; /* This last condition checks if we run the browser shim of process */\n\n/** @private */\nexport const IN_NODE_COMMONJS =\n IN_NODE &&\n typeof module !== \"undefined\" &&\n typeof module.exports !== \"undefined\" &&\n typeof require !== \"undefined\" &&\n typeof __dirname !== \"undefined\";\n\n/** @private */\nexport const IN_NODE_ESM = IN_NODE && !IN_NODE_COMMONJS;\n\n/** @private */\nexport const IN_BUN = typeof globalThis.Bun !== \"undefined\";\n\n/** @private */\nexport const IN_DENO = typeof Deno !== \"undefined\"; // just in case...\n\n/** @private */\nexport const IN_BROWSER = !IN_NODE && !IN_DENO;\n\n/** @private */\nexport const IN_BROWSER_MAIN_THREAD =\n IN_BROWSER &&\n typeof window === \"object\" &&\n typeof document === \"object\" &&\n typeof document.createElement === \"function\" &&\n \"sessionStorage\" in window &&\n typeof importScripts !== \"function\";\n\n/** @private */\nexport const IN_BROWSER_WEB_WORKER =\n IN_BROWSER && typeof importScripts === \"function\" && typeof self === \"object\";\n\n/** @private */\nexport const IN_SAFARI =\n typeof navigator === \"object\" &&\n typeof navigator.userAgent === \"string\" &&\n navigator.userAgent.indexOf(\"Chrome\") == -1 &&\n navigator.userAgent.indexOf(\"Safari\") > -1;\n\n/** @private */\nexport const IN_SHELL = typeof read == \"function\" && typeof load === \"function\";\n\n/**\n * Detects the current environment and returns a record with the results.\n * This function is useful for debugging and testing purposes.\n * @private\n */\nexport function detectEnvironment(): Record<string, boolean> {\n return {\n IN_NODE,\n IN_NODE_COMMONJS,\n IN_NODE_ESM,\n IN_BUN,\n IN_DENO,\n IN_BROWSER,\n IN_BROWSER_MAIN_THREAD,\n IN_BROWSER_WEB_WORKER,\n IN_SAFARI,\n IN_SHELL,\n };\n}\n", "import ErrorStackParser from \"./vendor/stackframe/error-stack-parser\";\nimport {\n IN_NODE,\n IN_NODE_ESM,\n IN_BROWSER_MAIN_THREAD,\n IN_BROWSER_WEB_WORKER,\n IN_NODE_COMMONJS,\n IN_SHELL,\n} from \"./environments\";\nimport { Lockfile } from \"./types\";\n\nlet nodeUrlMod: typeof import(\"node:url\");\nlet nodePath: typeof import(\"node:path\");\nlet nodeVmMod: typeof import(\"node:vm\");\n/** @private */\nexport let nodeFSMod: typeof import(\"node:fs\");\n/** @private */\nexport let nodeFsPromisesMod: typeof import(\"node:fs/promises\");\n\ndeclare function load(a: string): Promise<void>;\ndeclare function read(a: string): string;\ndeclare function readbuffer(a: string): ArrayBuffer;\n\ndeclare var globalThis: {\n importScripts: (url: string) => void;\n document?: typeof document;\n fetch?: typeof fetch;\n location?: URL;\n};\n\n/**\n * If we're in node, it's most convenient to import various node modules on\n * initialization. Otherwise, this does nothing.\n * @private\n */\nexport async function initNodeModules() {\n if (!IN_NODE) {\n return;\n }\n // @ts-ignore\n nodeUrlMod = (await import(\"node:url\")).default;\n nodeFSMod = await import(\"node:fs\");\n nodeFsPromisesMod = await import(\"node:fs/promises\");\n\n // @ts-ignore\n nodeVmMod = (await import(\"node:vm\")).default;\n nodePath = await import(\"node:path\");\n pathSep = nodePath.sep;\n\n // Emscripten uses `require`, so if it's missing (because we were imported as\n // an ES6 module) we need to polyfill `require` with `import`. `import` is\n // async and `require` is synchronous, so we import all packages that might be\n // required up front and define require to look them up in this table.\n\n if (typeof require !== \"undefined\") {\n return;\n }\n // These are all the packages required in pyodide.asm.js. You can get this\n // list with:\n // $ grep -o 'require(\"[a-z]*\")' pyodide.asm.js | sort -u\n const fs = nodeFSMod;\n const crypto = await import(\"node:crypto\");\n const ws = await import(\"ws\");\n const child_process = await import(\"node:child_process\");\n const node_modules: { [mode: string]: any } = {\n fs,\n crypto,\n ws,\n child_process,\n };\n // Since we're in an ES6 module, this is only modifying the module namespace,\n // it's still private to Pyodide.\n (globalThis as any).require = function (mod: string): any {\n return node_modules[mod];\n };\n}\n\nexport function isAbsolute(path: string): boolean {\n return path.includes(\"://\") || path.startsWith(\"/\");\n}\n\nfunction node_resolvePath(path: string, base?: string): string {\n return nodePath.resolve(base || \".\", path);\n}\n\nfunction browser_resolvePath(path: string, base?: string): string {\n if (base === undefined) {\n // @ts-ignore\n base = location;\n }\n return new URL(path, base).toString();\n}\n\nexport let resolvePath: (rest: string, base?: string) => string;\nif (IN_NODE) {\n resolvePath = node_resolvePath;\n} else if (IN_SHELL) {\n resolvePath = (x) => x;\n} else {\n resolvePath = browser_resolvePath;\n}\n\n/**\n * Get the path separator. If we are on Linux or in the browser, it's /.\n * In Windows, it's \\.\n * @private\n */\nexport let pathSep: string;\n\nif (!IN_NODE) {\n pathSep = \"/\";\n}\n\n/**\n * Load a binary file, only for use in Node. If the path explicitly is a URL,\n * then fetch from a URL, else load from the file system.\n * @param indexURL base path to resolve relative paths\n * @param path the path to load\n * @param checksum sha-256 checksum of the package\n * @returns An ArrayBuffer containing the binary data\n * @private\n */\nfunction node_getBinaryResponse(\n path: string,\n _file_sub_resource_hash?: string | undefined, // Ignoring sub resource hash. See issue-2431.\n):\n | { response: Promise<Response>; binary?: undefined }\n | { binary: Promise<Uint8Array> } {\n if (path.startsWith(\"file://\")) {\n // handle file:// with filesystem operations rather than with fetch.\n path = path.slice(\"file://\".length);\n }\n if (path.includes(\"://\")) {\n // If it has a protocol, make a fetch request\n return { response: fetch(path) };\n } else {\n // Otherwise get it from the file system\n return {\n binary: nodeFsPromisesMod\n .readFile(path)\n .then(\n (data: Buffer) =>\n new Uint8Array(data.buffer, data.byteOffset, data.byteLength),\n ),\n };\n }\n}\n\nfunction shell_getBinaryResponse(\n path: string,\n _file_sub_resource_hash?: string | undefined, // Ignoring sub resource hash. See issue-2431.\n):\n | { response: Promise<Response>; binary?: undefined }\n | { binary: Promise<Uint8Array> } {\n if (path.startsWith(\"file://\")) {\n // handle file:// with filesystem operations rather than with fetch.\n path = path.slice(\"file://\".length);\n }\n if (path.includes(\"://\")) {\n // If it has a protocol, make a fetch request\n throw new Error(\"Shell cannot fetch urls\");\n } else {\n // Otherwise get it from the file system\n return {\n binary: Promise.resolve(new Uint8Array(readbuffer(path))),\n };\n }\n}\n\n/**\n * Load a binary file, only for use in browser. Resolves relative paths against\n * indexURL.\n *\n * @param path the path to load\n * @param subResourceHash the sub resource hash for fetch() integrity check\n * @returns A Uint8Array containing the binary data\n * @private\n */\nfunction browser_getBinaryResponse(\n path: string,\n subResourceHash: string | undefined,\n): { response: Promise<Response>; binary?: undefined } {\n const url = new URL(path, location as unknown as URL);\n let options = subResourceHash ? { integrity: subResourceHash } : {};\n return { response: fetch(url, options) };\n}\n\n/** @private */\nexport let getBinaryResponse: (\n path: string,\n file_sub_resource_hash?: string | undefined,\n) =>\n | { response: Promise<Response>; binary?: undefined }\n | { response?: undefined; binary: Promise<Uint8Array> };\nif (IN_NODE) {\n getBinaryResponse = node_getBinaryResponse;\n} else if (IN_SHELL) {\n getBinaryResponse = shell_getBinaryResponse;\n} else {\n getBinaryResponse = browser_getBinaryResponse;\n}\n\nexport async function loadBinaryFile(\n path: string,\n file_sub_resource_hash?: string | undefined,\n): Promise<Uint8Array> {\n const { response, binary } = getBinaryResponse(path, file_sub_resource_hash);\n if (binary) {\n return binary;\n }\n const r = await response;\n if (!r.ok) {\n throw new Error(`Failed to load '${path}': request failed.`);\n }\n return new Uint8Array(await r.arrayBuffer());\n}\n\n/**\n * Currently loadScript is only used once to load `pyodide.asm.js`.\n * @param url\n * @private\n */\nexport let loadScript: (url: string) => Promise<void>;\n\nif (IN_BROWSER_MAIN_THREAD) {\n // browser\n loadScript = async (url) => await import(/* webpackIgnore: true */ url);\n} else if (IN_BROWSER_WEB_WORKER) {\n // webworker\n loadScript = async (url) => {\n try {\n // use importScripts in classic web worker\n globalThis.importScripts(url);\n } catch (e) {\n // importScripts throws TypeError in a module type web worker, use import instead\n if (e instanceof TypeError) {\n await import(/* webpackIgnore: true */ url);\n } else {\n throw e;\n }\n }\n };\n} else if (IN_NODE) {\n loadScript = nodeLoadScript;\n} else if (IN_SHELL) {\n loadScript = load;\n} else {\n throw new Error(\"Cannot determine runtime environment\");\n}\n\n/**\n * Load a text file and executes it as Javascript\n * @param url The path to load. May be a url or a relative file system path.\n * @private\n */\nasync function nodeLoadScript(url: string) {\n if (url.startsWith(\"file://\")) {\n // handle file:// with filesystem operations rather than with fetch.\n url = url.slice(\"file://\".length);\n }\n if (url.includes(\"://\")) {\n // If it's a url, load it with fetch then eval it.\n nodeVmMod.runInThisContext(await (await fetch(url)).text());\n } else {\n // Otherwise, hopefully it is a relative path we can load from the file\n // system.\n await import(/* webpackIgnore: true */ nodeUrlMod.pathToFileURL(url).href);\n }\n}\n\nexport async function loadLockFile(lockFileURL: string): Promise<Lockfile> {\n if (IN_NODE) {\n await initNodeModules();\n const package_string = await nodeFsPromisesMod.readFile(lockFileURL, {\n encoding: \"utf8\",\n });\n return JSON.parse(package_string);\n } else if (IN_SHELL) {\n const package_string = read(lockFileURL);\n return JSON.parse(package_string);\n } else {\n let response = await fetch(lockFileURL);\n return await response.json();\n }\n}\n\n/**\n * Calculate the directory name of the current module.\n * This is used to guess the indexURL when it is not provided.\n */\nexport async function calculateDirname(): Promise<string> {\n if (IN_NODE_COMMONJS) {\n return __dirname;\n }\n\n let err: Error;\n try {\n throw new Error();\n } catch (e) {\n err = e as Error;\n }\n let fileName = ErrorStackParser.parse(err)[0].fileName!;\n\n if (IN_NODE && !fileName.startsWith(\"file://\")) {\n fileName = `file://${fileName}`; // Error stack filenames are not starting with `file://` in `Bun`\n }\n\n if (IN_NODE_ESM) {\n const nodePath = await import(\"node:path\");\n const nodeUrl = await import(\"node:url\");\n\n // FIXME: We would like to use import.meta.url here,\n // but mocha seems to mess with compiling typescript files to ES6.\n return nodeUrl.fileURLToPath(nodePath.dirname(fileName));\n }\n\n const indexOfLastSlash = fileName.lastIndexOf(pathSep);\n if (indexOfLastSlash === -1) {\n throw new Error(\n \"Could not extract indexURL path from pyodide module location\",\n );\n }\n return fileName.slice(0, indexOfLastSlash);\n}\n\n/**\n * Ensure that the directory exists before trying to download files into it (Node.js only).\n * @param dir The directory to ensure exists\n */\nexport async function ensureDirNode(dir?: string) {\n if (!IN_NODE) {\n return;\n }\n if (!dir) {\n return;\n }\n\n try {\n // Check if the `installBaseUrl` directory exists\n await nodeFsPromisesMod.stat(dir); // Use `.stat()` which works even on ASAR archives of Electron apps, while `.access` doesn't.\n } catch {\n // If it doesn't exist, make it. Call mkdir() here only when necessary after checking the existence to avoid an error on read-only file systems. See https://github.com/pyodide/pyodide/issues/4736\n await nodeFsPromisesMod.mkdir(dir, {\n recursive: true,\n });\n }\n}\n\n/**\n * Calculates the install base url for the package manager.\n * exported for testing\n * @param lockFileURL\n * @returns the install base url\n * @private\n */\nexport function calculateInstallBaseUrl(lockFileURL: string) {\n // 1. If the lockfile URL includes a path with slash (file url in Node.js or http url in browser), use the directory of the lockfile URL\n // 2. Otherwise, fallback to the current location\n // 2.1. In the browser, use `location` to get the current location\n // 2.2. In Node.js just use the pwd\n return (\n lockFileURL.substring(0, lockFileURL.lastIndexOf(\"/\") + 1) ||\n globalThis.location?.toString() ||\n \".\"\n );\n}\n", "import { Module } from \"./types\";\n\n/**\n * @private\n */\nasync function syncfs(m: Module, direction: boolean): Promise<void> {\n return new Promise((resolve, reject) => {\n m.FS.syncfs(direction, (err: any) => {\n if (err) {\n reject(err);\n } else {\n resolve();\n }\n });\n });\n}\n\n/**\n * @private\n */\nexport async function syncLocalToRemote(m: Module): Promise<void> {\n return await syncfs(m, false);\n}\n\n/**\n * @private\n */\nexport async function syncRemoteToLocal(m: Module): Promise<void> {\n return await syncfs(m, true);\n}\n\n/**\n * @private\n */\nexport function initializeNativeFS(module: Module) {\n const FS = module.FS;\n const MEMFS = module.FS.filesystems.MEMFS;\n const PATH = module.PATH;\n\n const nativeFSAsync = {\n // DIR_MODE: {{{ cDefine('S_IFDIR') }}} | 511 /* 0777 */,\n // FILE_MODE: {{{ cDefine('S_IFREG') }}} | 511 /* 0777 */,\n DIR_MODE: 16384 | 511,\n FILE_MODE: 32768 | 511,\n mount: function (mount: any) {\n if (!mount.opts.fileSystemHandle) {\n throw new Error(\"opts.fileSystemHandle is required\");\n }\n\n // reuse all of the core MEMFS functionality\n return MEMFS.mount.apply(null, arguments);\n },\n syncfs: async (mount: any, populate: Boolean, callback: Function) => {\n try {\n const local = nativeFSAsync.getLocalSet(mount);\n const remote = await nativeFSAsync.getRemoteSet(mount);\n const src = populate ? remote : local;\n const dst = populate ? local : remote;\n await nativeFSAsync.reconcile(mount, src, dst);\n callback(null);\n } catch (e) {\n callback(e);\n }\n },\n // Returns file set of emscripten's filesystem at the mountpoint.\n getLocalSet: (mount: any) => {\n let entries = Object.create(null);\n\n function isRealDir(p: string) {\n return p !== \".\" && p !== \"..\";\n }\n\n function toAbsolute(root: string) {\n return (p: string) => {\n return PATH.join2(root, p);\n };\n }\n\n let check = FS.readdir(mount.mountpoint)\n .filter(isRealDir)\n .map(toAbsolute(mount.mountpoint));\n\n while (check.length) {\n let path = check.pop();\n let stat = FS.stat(path);\n\n if (FS.isDir(stat.mode)) {\n check.push.apply(\n check,\n FS.readdir(path).filter(isRealDir).map(toAbsolute(path)),\n );\n }\n\n entries[path] = { timestamp: stat.mtime, mode: stat.mode };\n }\n\n return { type: \"local\", entries: entries };\n },\n // Returns file set of the real, on-disk filesystem at the mountpoint.\n getRemoteSet: async (mount: any) => {\n // TODO: this should be a map.\n const entries = Object.create(null);\n\n const handles = await getFsHandles(mount.opts.fileSystemHandle);\n for (const [path, handle] of handles) {\n if (path === \".\") continue;\n\n entries[PATH.join2(mount.mountpoint, path)] = {\n timestamp:\n handle.kind === \"file\"\n ? new Date((await handle.getFile()).lastModified)\n : new Date(),\n mode:\n handle.kind === \"file\"\n ? nativeFSAsync.FILE_MODE\n : nativeFSAsync.DIR_MODE,\n };\n }\n\n return { type: \"remote\", entries, handles };\n },\n loadLocalEntry: (path: string) => {\n const lookup = FS.lookupPath(path);\n const node = lookup.node;\n const stat = FS.stat(path);\n\n if (FS.isDir(stat.mode)) {\n return { timestamp: stat.mtime, mode: stat.mode };\n } else if (FS.isFile(stat.mode)) {\n node.contents = MEMFS.getFileDataAsTypedArray(node);\n return {\n timestamp: stat.mtime,\n mode: stat.mode,\n contents: node.contents,\n };\n } else {\n throw new Error(\"node type not supported\");\n }\n },\n storeLocalEntry: (path: string, entry: any) => {\n if (FS.isDir(entry[\"mode\"])) {\n FS.mkdirTree(path, entry[\"mode\"]);\n } else if (FS.isFile(entry[\"mode\"])) {\n FS.writeFile(path, entry[\"contents\"], { canOwn: true });\n } else {\n throw new Error(\"node type not supported\");\n }\n\n FS.chmod(path, entry[\"mode\"]);\n FS.utime(path, entry[\"timestamp\"], entry[\"timestamp\"]);\n },\n removeLocalEntry: (path: string) => {\n var stat = FS.stat(path);\n\n if (FS.isDir(stat.mode)) {\n FS.rmdir(path);\n } else if (FS.isFile(stat.mode)) {\n FS.unlink(path);\n }\n },\n loadRemoteEntry: async (handle: any) => {\n if (handle.kind === \"file\") {\n const file = await handle.getFile();\n return {\n contents: new Uint8Array(await file.arrayBuffer()),\n mode: nativeFSAsync.FILE_MODE,\n timestamp: new Date(file.lastModified),\n };\n } else if (handle.kind === \"directory\") {\n return {\n mode: nativeFSAsync.DIR_MODE,\n timestamp: new Date(),\n };\n } else {\n throw new Error(\"unknown kind: \" + handle.kind);\n }\n },\n storeRemoteEntry: async (handles: any, path: string, entry: any) => {\n const parentDirHandle = handles.get(PATH.dirname(path));\n const handle = FS.isFile(entry.mode)\n ? await parentDirHandle.getFileHandle(PATH.basename(path), {\n create: true,\n })\n : await parentDirHandle.getDirectoryHandle(PATH.basename(path), {\n create: true,\n });\n if (handle.kind === \"file\") {\n const writable = await handle.createWritable();\n await writable.write(entry.contents);\n await writable.close();\n }\n handles.set(path, handle);\n },\n removeRemoteEntry: async (handles: any, path: string) => {\n const parentDirHandle = handles.get(PATH.dirname(path));\n await parentDirHandle.removeEntry(PATH.basename(path));\n handles.delete(path);\n },\n reconcile: async (mount: any, src: any, dst: any) => {\n let total = 0;\n\n const create: Array<string> = [];\n Object.keys(src.entries).forEach(function (key) {\n const e = src.entries[key];\n const e2 = dst.entries[key];\n if (\n !e2 ||\n (FS.isFile(e.mode) &&\n e[\"timestamp\"].getTime() > e2[\"timestamp\"].getTime())\n ) {\n create.push(key);\n total++;\n }\n });\n // sort paths in ascending order so directory entries are created\n // before the files inside them\n create.sort();\n\n const remove: Array<string> = [];\n Object.keys(dst.entries).forEach(function (key) {\n if (!src.entries[key]) {\n remove.push(key);\n total++;\n }\n });\n // sort paths in descending order so files are deleted before their\n // parent directories\n remove.sort().reverse();\n\n if (!total) {\n return;\n }\n\n const handles = src.type === \"remote\" ? src.handles : dst.handles;\n\n for (const path of create) {\n const relPath = PATH.normalize(\n path.replace(mount.mountpoint, \"/\"),\n ).substring(1);\n if (dst.type === \"local\") {\n const handle = handles.get(relPath);\n const entry = await nativeFSAsync.loadRemoteEntry(handle);\n nativeFSAsync.storeLocalEntry(path, entry);\n } else {\n const entry = nativeFSAsync.loadLocalEntry(path);\n await nativeFSAsync.storeRemoteEntry(handles, relPath, entry);\n }\n }\n\n for (const path of remove) {\n if (dst.type === \"local\") {\n nativeFSAsync.removeLocalEntry(path);\n } else {\n const relPath = PATH.normalize(\n path.replace(mount.mountpoint, \"/\"),\n ).substring(1);\n await nativeFSAsync.removeRemoteEntry(handles, relPath);\n }\n }\n },\n };\n\n module.FS.filesystems.NATIVEFS_ASYNC = nativeFSAsync;\n}\n\nconst getFsHandles = async (dirHandle: any) => {\n const handles: any = [];\n\n async function collect(curDirHandle: any) {\n for await (const entry of curDirHandle.values()) {\n handles.push(entry);\n if (entry.kind === \"directory\") {\n await collect(entry);\n }\n }\n }\n\n await collect(dirHandle);\n\n const result = new Map();\n result.set(\".\", dirHandle);\n for (const handle of handles) {\n const relativePath = (await dirHandle.resolve(handle)).join(\"/\");\n result.set(relativePath, handle);\n }\n return result;\n};\n", "// @ts-ignore Can't find sentinel.wasm or it's corresponding type declarations\nimport sentinelWasm from \"./sentinel.wasm\";\n\ndeclare const sentinelWasm: Uint8Array;\n\nconst sentinelInstancePromise: Promise<WebAssembly.Instance | undefined> =\n (async function () {\n // Starting with iOS 18.3.1, WebKit on iOS has an issue with the garbage\n // collector that breaks the call trampoline. See #130418 and\n // https://bugs.webkit.org/show_bug.cgi?id=293113 for details.\n let isIOS =\n globalThis.navigator &&\n (/iPad|iPhone|iPod/.test(navigator.userAgent) ||\n // Starting with iPadOS 13, iPads might send a platform string that looks like a desktop Mac.\n // To differentiate, we check if the platform is 'MacIntel' (common for Macs and newer iPads)\n // AND if the device has multi-touch capabilities (navigator.maxTouchPoints > 1)\n (navigator.platform === \"MacIntel\" &&\n typeof navigator.maxTouchPoints !== \"undefined\" &&\n navigator.maxTouchPoints > 1));\n if (isIOS) {\n return undefined;\n }\n return undefined;\n try {\n const module = await WebAssembly.compile(sentinelWasm);\n return await WebAssembly.instantiate(module);\n } catch (e) {\n if (e instanceof WebAssembly.CompileError) {\n return undefined;\n }\n throw e;\n }\n })();\n\ntype SentinelInstance<T> = {\n create_sentinel: () => T;\n is_sentinel: (val: any) => val is T;\n};\n\n/**\n * @private\n */\nexport async function getSentinelImport(): Promise<SentinelInstance<Symbol>> {\n const sentinelInstance = await sentinelInstancePromise;\n if (sentinelInstance) {\n return sentinelInstance.exports as SentinelInstance<Symbol>;\n }\n const error_marker = Symbol(\"error marker\");\n return {\n create_sentinel: () => error_marker,\n is_sentinel: (val: any): val is typeof error_marker => val === error_marker,\n };\n}\n", "/** @private */\n\nimport { ConfigType } from \"./pyodide\";\nimport { initializeNativeFS } from \"./nativefs\";\nimport { loadBinaryFile, getBinaryResponse } from \"./compat\";\nimport { API, PreRunFunc, type Module } from \"./types\";\nimport { getSentinelImport } from \"generated/sentinel\";\n\n/**\n * @private\n * @hidden\n */\nexport interface EmscriptenSettings {\n readonly noImageDecoding?: boolean;\n readonly noAudioDecoding?: boolean;\n readonly noWasmDecoding?: boolean;\n readonly preRun: readonly PreRunFunc[];\n readonly print?: (a: string) => void;\n readonly printErr?: (a: string) => void;\n readonly onExit?: (code: number) => void;\n readonly thisProgram?: string;\n readonly arguments: readonly string[];\n readonly instantiateWasm?: (\n imports: { [key: string]: any },\n successCallback: (\n instance: WebAssembly.Instance,\n module: WebAssembly.Module,\n ) => void,\n ) => void;\n readonly API: API;\n readonly locateFile: (file: string) => string;\n\n noInitialRun?: boolean;\n INITIAL_MEMORY?: number;\n exitCode?: number;\n}\n\n/**\n * Get the base settings to use to load Pyodide.\n *\n * @private\n */\nexport function createSettings(config: ConfigType): EmscriptenSettings {\n const settings: EmscriptenSettings = {\n noImageDecoding: true,\n noAudioDecoding: true,\n noWasmDecoding: false,\n preRun: getFileSystemInitializationFuncs(config),\n print: config.stdout,\n printErr: config.stderr,\n onExit(code) {\n settings.exitCode = code;\n },\n thisProgram: config._sysExecutable,\n arguments: config.args,\n API: { config } as API,\n // Emscripten calls locateFile exactly one time with argument\n // pyodide.asm.wasm to get the URL it should download it from.\n //\n // If we set instantiateWasm the return value of locateFile actually is\n // unused, but Emscripten calls it anyways. We set instantiateWasm except\n // when compiling with source maps, see comment in getInstantiateWasmFunc().\n //\n // It also is called when Emscripten tries to find a dependency of a shared\n // library but it failed to find it in the file system. But for us that\n // means dependency resolution has already failed and we want to throw an\n // error anyways.\n locateFile: (path: string) => config.indexURL + path,\n instantiateWasm: getInstantiateWasmFunc(config.indexURL),\n };\n return settings;\n}\n\n/**\n * Make the home directory inside the virtual file system,\n * then change the working directory to it.\n *\n * @param Module The Emscripten Module.\n * @param path The path to the home directory.\n * @private\n */\nfunction createHomeDirectory(path: string): PreRunFunc {\n return function (Module) {\n const fallbackPath = \"/\";\n try {\n Module.FS.mkdirTree(path);\n } catch (e) {\n console.error(`Error occurred while making a home directory '${path}':`);\n console.error(e);\n console.error(`Using '${fallbackPath}' for a home directory instead`);\n path = fallbackPath;\n }\n Module.FS.chdir(path);\n };\n}\n\nfunction setEnvironment(env: { [key: string]: string }): PreRunFunc {\n return function (Module) {\n Object.assign(Module.ENV, env);\n };\n}\n\n/**\n * Mount local directories to the virtual file system. Only for Node.js.\n * @param mounts The list of paths to mount.\n */\nfunction callFsInitHook(\n fsInit: undefined | ((fs: typeof FS, info: { sitePackages: string }) => void),\n): PreRunFunc[] {\n if (!fsInit) {\n return [];\n }\n return [\n async (Module) => {\n Module.addRunDependency(\"fsInitHook\");\n try {\n await fsInit(Module.FS, { sitePackages: Module.API.sitePackages });\n } finally {\n Module.removeRunDependency(\"fsInitHook\");\n }\n },\n ];\n}\n\nfunction computeVersionTuple(Module: Module): [number, number, number] {\n const versionInt = Module.HEAPU32[Module._Py_Version >>> 2];\n const major = (versionInt >>> 24) & 0xff;\n const minor = (versionInt >>> 16) & 0xff;\n const micro = (versionInt >>> 8) & 0xff;\n return [major, minor, micro];\n}\n/**\n * Install the Python standard library to the virtual file system.\n *\n * Previously, this was handled by Emscripten's file packager (pyodide.asm.data).\n * However, using the file packager means that we have only one version\n * of the standard library available. We want to be able to use different\n * versions of the standard library, for example:\n *\n * - Use compiled(.pyc) or uncompiled(.py) standard library.\n * - Remove unused modules or add additional modules using bundlers like pyodide-pack.\n *\n * @param stdlibURL The URL for the Python standard library\n */\nfunction installStdlib(stdlibURL: string): PreRunFunc {\n const stdlibPromise: Promise<Uint8Array> = loadBinaryFile(stdlibURL);\n return async (Module: Module) => {\n Module.API.pyVersionTuple = computeVersionTuple(Module);\n const [pymajor, pyminor] = Module.API.pyVersionTuple;\n Module.FS.mkdirTree(\"/lib\");\n Module.API.sitePackages = `/lib/python${pymajor}.${pyminor}/site-packages`;\n Module.FS.mkdirTree(Module.API.sitePackages);\n Module.addRunDependency(\"install-stdlib\");\n\n try {\n const stdlib = await stdlibPromise;\n Module.FS.writeFile(`/lib/python${pymajor}${pyminor}.zip`, stdlib);\n } catch (e) {\n console.error(\"Error occurred while installing the standard library:\");\n console.error(e);\n } finally {\n Module.removeRunDependency(\"install-stdlib\");\n }\n };\n}\n\n/**\n * Initialize the virtual file system, before loading Python interpreter.\n * @private\n */\nfunction getFileSystemInitializationFuncs(config: ConfigType): PreRunFunc[] {\n let stdLibURL;\n if (config.stdLibURL != undefined) {\n stdLibURL = config.stdLibURL;\n } else {\n stdLibURL = config.indexURL + \"python_stdlib.zip\";\n }\n\n return [\n installStdlib(stdLibURL),\n createHomeDirectory(config.env.HOME),\n setEnvironment(config.env),\n initializeNativeFS,\n ...callFsInitHook(config.fsInit),\n ];\n}\n\nfunction getInstantiateWasmFunc(\n indexURL: string,\n): EmscriptenSettings[\"instantiateWasm\"] {\n // @ts-ignore\n if (SOURCEMAP || typeof WasmOffsetConverter !== \"undefined\") {\n // According to the docs:\n //\n // \"Sanitizers or source map is currently not supported if overriding\n // WebAssembly instantiation with Module.instantiateWasm.\"\n // https://emscripten.org/docs/api_reference/module.html?highlight=instantiatewasm#Module.instantiateWasm\n //\n // typeof WasmOffsetConverter !== \"undefined\" checks for asan.\n return;\n }\n const { binary, response } = getBinaryResponse(indexURL + \"pyodide.asm.wasm\");\n const sentinelImportPromise = getSentinelImport();\n return function (\n imports: { [key: string]: { [key: string]: any } },\n successCallback: (\n instance: WebAssembly.Instance,\n module: WebAssembly.Module,\n ) => void,\n ) {\n (async function () {\n imports.sentinel = await sentinelImportPromise;\n try {\n let res: WebAssembly.WebAssemblyInstantiatedSource;\n if (response) {\n res = await WebAssembly.instantiateStreaming(response, imports);\n } else {\n res = await WebAssembly.instantiate(await binary, imports);\n }\n const { instance, module } = res;\n successCallback(instance, module);\n } catch (e) {\n console.warn(\"wasm instantiation failed!\");\n console.warn(e);\n }\n })();\n\n return {}; // Compiling asynchronously, no exports.\n };\n}\n", "/**\n *\n * The Pyodide version.\n *\n * The version here is a Python version, following :pep:`440`. This is different\n * from the version in ``package.json`` which follows the node package manager\n * version convention.\n */\nexport const version: string = \"0.28.2\";\n", "/**\n * @hidden\n */\nexport function withTrailingSlash<T extends string | undefined>(path: T): T {\n if (path === undefined) {\n return path;\n }\n\n if (path.endsWith(\"/\")) {\n return path;\n }\n return (path + \"/\") as T;\n}\n", "/**\n * The main bootstrap code for loading pyodide.\n */\nimport {\n calculateDirname,\n loadScript,\n initNodeModules,\n resolvePath,\n loadLockFile,\n calculateInstallBaseUrl,\n} from \"./compat\";\n\nimport { createSettings } from \"./emscripten-settings\";\nimport { version as version_ } from \"./version\";\n\nimport type { PyodideAPI } from \"./api.js\";\nimport type {\n TypedArray,\n Module,\n PackageData,\n FSType,\n Lockfile,\n} from \"./types\";\nimport type { EmscriptenSettings } from \"./emscripten-settings\";\nimport type { SnapshotConfig } from \"./snapshot\";\nimport { withTrailingSlash } from \"./common/path\";\nexport type { PyodideAPI, TypedArray, PyodideAPI as PyodideInterface };\nexport type { LockfileInfo, LockfilePackage, Lockfile } from \"./types\";\n\nexport { type PackageData };\n\n/**\n * The Pyodide version.\n *\n * The version here is a Python version, following :pep:`440`. This is different\n * from the version in ``package.json`` which follows the node package manager\n * version convention.\n */\nexport const version: string = version_;\n\ndeclare function _createPyodideModule(\n settings: EmscriptenSettings,\n): Promise<Module>;\n\n// BUILD_ID is generated from hashing together pyodide.asm.js and\n// pyodide.asm.wasm in esbuild.config.outer.mjs\n//\n// It is used to check that memory snapshots were generated by the same build of\n// the runtime that is trying to use them. Attempting to use a snapshot from a\n// different build will fail badly. See logic in snapshot.ts.\ndeclare const BUILD_ID: string;\n\n/**\n * See documentation for loadPyodide.\n * @hidden\n */\nexport type ConfigType = {\n indexURL: string;\n packageCacheDir: string;\n lockFileContents: Lockfile | string | Promise<Lockfile | string>;\n fullStdLib?: boolean;\n stdLibURL?: string;\n stdin?: () => string;\n stdout?: (msg: string) => void;\n stderr?: (msg: string) => void;\n jsglobals?: object;\n _sysExecutable?: string;\n args: string[];\n fsInit?: (FS: FSType, info: { sitePackages: string }) => Promise<void>;\n env: { [key: string]: string };\n packages: string[];\n _makeSnapshot: boolean;\n enableRunUntilComplete: boolean;\n checkAPIVersion: boolean;\n BUILD_ID: string;\n packageBaseUrl?: string;\n cdnUrl: string;\n};\n\n/**\n * Load the main Pyodide wasm module and initialize it.\n *\n * @returns The :ref:`js-api-pyodide` module.\n * @example\n * async function main() {\n * const pyodide = await loadPyodide({\n * fullStdLib: true,\n * stdout: (msg) => console.log(`Pyodide: ${msg}`),\n * });\n * console.log(\"Loaded Pyodide\");\n * }\n * main();\n */\nexport async function loadPyodide(\n options: {\n /**\n * The URL from which Pyodide will load the main Pyodide runtime and\n * packages. It is recommended that you leave this unchanged, providing an\n * incorrect value can cause broken behavior.\n *\n * Default: The url that Pyodide is loaded from with the file name\n * (``pyodide.js`` or ``pyodide.mjs``) removed.\n */\n indexURL?: string;\n\n /**\n * The file path where packages will be cached in node. If a package\n * exists in ``packageCacheDir`` it is loaded from there, otherwise it is\n * downloaded from the JsDelivr CDN and then cached into ``packageCacheDir``.\n * Only applies when running in node; ignored in browsers.\n *\n * Default: same as indexURL\n */\n packageCacheDir?: string;\n\n /**\n * The URL from which Pyodide will load the Pyodide ``pyodide-lock.json`` lock\n * file. You can produce custom lock files with :py:func:`micropip.freeze`.\n * Default: ```${indexURL}/pyodide-lock.json```\n */\n lockFileURL?: string;\n /**\n * The contents of a lockfile. If a string, it should be valid json and\n * ``JSON.parse()`` should return a ``Lockfile`` instance. See\n * :js:interface:`~pyodide.Lockfile` for the schema.\n */\n lockFileContents?: Lockfile | string | Promise<Lockfile | string>;\n /**\n * The base url relative to which a relative value of\n * :js:attr:`~pyodide.LockfilePackage.file_name` is interpreted. If\n * ``lockfileContents`` is provided, then ``lockFileContents`` must be\n * provided explicitly in order to install packages with relative paths.\n *\n * Otherwise, the default is calculated as follows:\n *\n * 1. If `lockFileURL` contains a ``/``, the default is everything before the last\n * ``/`` in ``lockFileURL``.\n * 2. If in the browser, the default is ``location.toString()``.\n * 3. Otherwise, the default is `'.'`.\n */\n packageBaseUrl?: string;\n /**\n * Load the full Python standard library. Setting this to false excludes\n * unvendored modules from the standard library.\n * Default: ``false``\n */\n fullStdLib?: boolean;\n /**\n * The URL from which to load the standard library ``python_stdlib.zip``\n * file. This URL includes the most of the Python standard library. Some\n * stdlib modules were unvendored, and can be loaded separately\n * with ``fullStdLib: true`` option or by their package name.\n * Default: ```${indexURL}/python_stdlib.zip```\n */\n stdLibURL?: string;\n /**\n * Override the standard input callback. Should ask the user for one line of\n * input. The :js:func:`pyodide.setStdin` function is more flexible and\n * should be preferred.\n */\n stdin?: () => string;\n /**\n * Override the standard output callback. The :js:func:`pyodide.setStdout`\n * function is more flexible and should be preferred in most cases, but\n * depending on the ``args`` passed to ``loadPyodide``, Pyodide may write to\n * stdout on startup, which can only be controlled by passing a custom\n * ``stdout`` function.\n */\n stdout?: (msg: string) => void;\n /**\n * Override the standard error output callback. The\n * :js:func:`pyodide.setStderr` function is more flexible and should be\n * preferred in most cases, but depending on the ``args`` passed to\n * ``loadPyodide``, Pyodide may write to stdout on startup, which can only\n * be controlled by passing a custom ``stdout`` function.\n */\n stderr?: (msg: string) => void;\n /**\n * The object that Pyodide will use for the ``js`` module.\n * Default: ``globalThis``\n */\n jsglobals?: object;\n /**\n * Determine the value of ``sys.executable``.\n * @ignore\n */\n _sysExecutable?: string;\n /**\n * Command line arguments to pass to Python on startup. See `Python command\n * line interface options\n * <https://docs.python.org/3.10/using/cmdline.html#interface-options>`_ for\n * more details. Default: ``[]``\n */\n args?: string[];\n /**\n * Environment variables to pass to Python. This can be accessed inside of\n * Python at runtime via :py:data:`os.environ`. Certain environment variables change\n * the way that Python loads:\n * https://docs.python.org/3.10/using/cmdline.html#environment-variables\n * Default: ``{}``.\n * If ``env.HOME`` is undefined, it will be set to a default value of\n * ``\"/home/pyodide\"``\n */\n env?: { [key: string]: string };\n /**\n * A list of packages to load as Pyodide is initializing.\n *\n * This is the same as loading the packages with\n * :js:func:`pyodide.loadPackage` after Pyodide is loaded except using the\n * ``packages`` option is more efficient because the packages are downloaded\n * while Pyodide bootstraps itself.\n */\n packages?: string[];\n /**\n * Opt into the old behavior where :js:func:`PyProxy.toString() <pyodide.ffi.PyProxy.toString>`\n * calls :py:func:`repr` and not :py:class:`str() <str>`. Deprecated.\n * @deprecated\n */\n pyproxyToStringRepr?: boolean;\n /**\n * Make loop.run_until_complete() function correctly using stack switching.\n * Default: ``true``.\n */\n enableRunUntilComplete?: boolean;\n /**\n * If true (default), throw an error if the version of Pyodide core does not\n * match the version of the Pyodide js package.\n */\n checkAPIVersion?: boolean;\n /**\n * This is a hook that allows modification of the file system before the\n * main() function is called and the intereter is started. When this is\n * called, it is guaranteed that there is an empty site-packages directory.\n * @experimental\n */\n fsInit?: (FS: FSType, info: { sitePackages: string }) => Promise<void>;\n /**\n * Opt into the old behavior where JavaScript `null` is converted to `None`\n * instead of `jsnull`. Deprecated.\n * @deprecated\n */\n convertNullToNone?: boolean;\n /** @ignore */\n _makeSnapshot?: boolean;\n /** @ignore */\n _loadSnapshot?:\n | Uint8Array\n | ArrayBuffer\n | PromiseLike<Uint8Array | ArrayBuffer>;\n /** @ignore */\n _snapshotDeserializer?: (obj: any) => any;\n } = {},\n): Promise<PyodideAPI> {\n if (options.lockFileContents && options.lockFileURL) {\n throw new Error(\"Can't pass both lockFileContents and lockFileURL\");\n }\n await initNodeModules();\n\n // Relative paths cause havoc.\n let indexURL = options.indexURL || (await calculateDirname());\n indexURL = withTrailingSlash(resolvePath(indexURL));\n const options_ = options as ConfigType;\n\n options_.packageBaseUrl = withTrailingSlash(options_.packageBaseUrl);\n // cdnUrl only for node. withTrailingSlash is a no-op, but just in case to prevent future human errors.\n options_.cdnUrl = withTrailingSlash(\n options_.packageBaseUrl ??\n `https://cdn.jsdelivr.net/pyodide/v${version}/full/`,\n );\n\n if (!options.lockFileContents) {\n const lockFileURL = options.lockFileURL ?? indexURL + \"pyodide-lock.json\";\n options_.lockFileContents = loadLockFile(lockFileURL);\n // packageBaseUrl isn't present, try using base location of lockFileUrl. If\n // lockFileURL is relative, use location as the base URL.\n options_.packageBaseUrl ??= calculateInstallBaseUrl(lockFileURL);\n }\n options_.indexURL = indexURL;\n\n if (options_.packageCacheDir) {\n options_.packageCacheDir = withTrailingSlash(\n resolvePath(options_.packageCacheDir),\n );\n }\n\n const default_config = {\n fullStdLib: false,\n jsglobals: globalThis,\n stdin: globalThis.prompt ? globalThis.prompt : undefined,\n args: [],\n env: {},\n packages: [],\n packageCacheDir: options_.packageBaseUrl,\n enableRunUntilComplete: true,\n checkAPIVersion: true,\n BUILD_ID,\n };\n const config = Object.assign(default_config, options_) as ConfigType;\n config.env.HOME ??= \"/home/pyodide\";\n /**\n * `PyErr_Print()` will call `exit()` if the exception is a `SystemError`.\n * This shuts down the Python interpreter, which is a change in behavior from\n * what happened before. In order to avoid this, we set the `inspect` config\n * parameter which prevents `PyErr_Print()` from calling `exit()`. Except in\n * the cli runner, we actually do want to exit. So set default to true and in\n * cli runner we explicitly set it to false.\n */\n config.env.PYTHONINSPECT ??= \"1\";\n const emscriptenSettings = createSettings(config);\n const API = emscriptenSettings.API;\n API.lockFilePromise = Promise.resolve(options_.lockFileContents);\n\n // If the pyodide.asm.js script has been imported, we can skip the dynamic import\n // Users can then do a static import of the script in environments where\n // dynamic importing is not allowed or not desirable, like module-type service workers\n if (typeof _createPyodideModule !== \"function\") {\n const scriptSrc = `${config.indexURL}pyodide.asm.js`;\n await loadScript(scriptSrc);\n }\n\n let snapshot: Uint8Array | undefined = undefined;\n if (options._loadSnapshot) {\n const snp = await options._loadSnapshot;\n if (ArrayBuffer.isView(snp)) {\n snapshot = snp;\n } else {\n snapshot = new Uint8Array(snp);\n }\n emscriptenSettings.noInitialRun = true;\n // @ts-ignore\n emscriptenSettings.INITIAL_MEMORY = snapshot.length;\n }\n\n // _createPyodideModule is specified in the Makefile by the linker flag:\n // `-s EXPORT_NAME=\"'_createPyodideModule'\"`\n const Module = await _createPyodideModule(emscriptenSettings);\n // Handle early exit\n if (emscriptenSettings.exitCode !== undefined) {\n throw new Module.ExitStatus(emscriptenSettings.exitCode);\n }\n if (options.pyproxyToStringRepr) {\n API.setPyProxyToStringMethod(true);\n }\n if (options.convertNullToNone) {\n API.setCompatNullToNone(true);\n }\n\n if (API.version !== version && config.checkAPIVersion) {\n throw new Error(`\\\nPyodide version does not match: '${version}' <==> '${API.version}'. \\\nIf you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.\\\n`);\n }\n // Disable further loading of Emscripten file_packager stuff.\n Module.locateFile = (path: string) => {\n if (path.endsWith(\".so\")) {\n throw new Error(`Failed to find dynamic library \"${path}\"`);\n }\n throw new Error(`Unexpected call to locateFile(\"${path}\")`);\n };\n\n let snapshotConfig: SnapshotConfig | undefined = undefined;\n if (snapshot) {\n snapshotConfig = API.restoreSnapshot(snapshot);\n }\n // runPython works starting after the call to finalizeBootstrap.\n const pyodide = API.finalizeBootstrap(\n snapshotConfig,\n options._snapshotDeserializer,\n );\n API.sys.path.insert(0, \"\");\n\n API._pyodide.set_excepthook();\n await API.packageIndexReady;\n // I think we want this initializeStreams call to happen after\n // packageIndexReady? I don't remember why.\n API.initializeStreams(config.stdin, config.stdout, config.stderr);\n return pyodide;\n}\n"],
5
+ "mappings": "uuCAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,iBAAAE,EAAA,YAAAC,ICIA,SAASC,GAAUC,EAAG,CACpB,MAAO,CAAC,MAAM,WAAWA,CAAC,CAAC,GAAK,SAASA,CAAC,CAC5C,CAFSC,EAAAF,GAAA,aAIT,SAASG,EAAYC,EAAK,CACxB,OAAOA,EAAI,OAAO,CAAC,EAAE,YAAY,EAAIA,EAAI,UAAU,CAAC,CACtD,CAFSF,EAAAC,EAAA,eAIT,SAASE,EAAQC,EAAG,CAClB,OAAO,UAAY,CACjB,OAAO,KAAKA,CAAC,CACf,CACF,CAJSJ,EAAAG,EAAA,WAMT,IAAIE,EAAe,CAAC,gBAAiB,SAAU,WAAY,YAAY,EACnEC,EAAe,CAAC,eAAgB,YAAY,EAC5CC,EAAc,CAAC,WAAY,eAAgB,QAAQ,EACnDC,GAAa,CAAC,MAAM,EACpBC,GAAc,CAAC,YAAY,EAE3BC,EAAQL,EAAa,OACvBC,EACAC,EACAC,GACAC,EACF,EAoEA,SAASE,EAAWC,EAAK,CACvB,GAAKA,EACL,QAASC,EAAI,EAAGA,EAAIH,EAAM,OAAQG,IAC5BD,EAAIF,EAAMG,CAAC,CAAC,IAAM,QACpB,KAAK,MAAQZ,EAAYS,EAAMG,CAAC,CAAC,CAAC,EAAED,EAAIF,EAAMG,CAAC,CAAC,CAAC,CAGvD,CAPSb,EAAAW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B,YAAY,OAAOkB,CAAG,EACxBD,EAAWC,EAEXD,EAAW,IAAI,WAAWC,CAAG,EAE/BN,EAAmB,aAAe,GAElCA,EAAmB,eAAiBK,EAAS,MAC/C,CAIA,IAAME,EAAS,MAAM,qBAAqBP,CAAkB,EAE5D,GAAIA,EAAmB,WAAa,OAClC,MAAM,IAAIO,EAAO,WAAWP,EAAmB,QAAQ,EASzD,GAPIZ,EAAQ,qBACVc,EAAI,yBAAyB,EAAI,EAE/Bd,EAAQ,mBACVc,EAAI,oBAAoB,EAAI,EAG1BA,EAAI,UAAYhB,GAAWa,EAAO,gBACpC,MAAM,IAAI,MAAM,oCACeb,CAAO,WAAWgB,EAAI,OAAO,mHAE/D,EAGCK,EAAO,WAAcC,GAAiB,CACpC,MAAIA,EAAK,SAAS,KAAK,EACf,IAAI,MAAM,mCAAmCA,CAAI,GAAG,EAEtD,IAAI,MAAM,kCAAkCA,CAAI,IAAI,CAC5D,EAEA,IAAIC,EACAJ,IACFI,EAAiBP,EAAI,gBAAgBG,CAAQ,GAG/C,IAAMK,EAAUR,EAAI,kBAClBO,EACArB,EAAQ,qBACV,EACA,OAAAc,EAAI,IAAI,KAAK,OAAO,EAAG,EAAE,EAEzBA,EAAI,SAAS,eAAe,EAC5B,MAAMA,EAAI,kBAGVA,EAAI,kBAAkBH,EAAO,MAAOA,EAAO,OAAQA,EAAO,MAAM,EACzDW,CACT,CA7RsBC,EAAAxB,EAAA,eV1FrB,WAAmB,YAAcyB",
6
+ "names": ["pyodide_umd_exports", "__export", "loadPyodide", "version", "_isNumber", "n", "__name", "_capitalize", "str", "_getter", "p", "booleanProps", "numericProps", "stringProps", "arrayProps", "objectProps", "props", "StackFrame", "obj", "i", "v", "fileName", "lineNumber", "columnNumber", "functionName", "argsStartIndex", "argsEndIndex", "args", "locationString", "parts", "j", "k", "stackframe_default", "ErrorStackParser", "CHROME_IE_STACK_REGEXP", "SAFARI_NATIVE_CODE_REGEXP", "__name", "error", "urlLike", "regExp", "parts", "filtered", "line", "sanitizedLine", "location", "locationParts", "functionName", "fileName", "stackframe_default", "functionNameRegex", "matches", "errorStackParser", "error_stack_parser_default", "errorStackParser", "IN_NODE", "IN_NODE_COMMONJS", "__require", "IN_NODE_ESM", "IN_BUN", "IN_DENO", "IN_BROWSER", "IN_BROWSER_MAIN_THREAD", "IN_BROWSER_WEB_WORKER", "IN_SAFARI", "IN_SHELL", "nodeUrlMod", "nodePath", "nodeVmMod", "nodeFSMod", "nodeFsPromisesMod", "initNodeModules", "IN_NODE", "pathSep", "__require", "fs", "crypto", "ws", "child_process", "node_modules", "mod", "__name", "node_resolvePath", "path", "base", "nodePath", "__name", "browser_resolvePath", "resolvePath", "IN_NODE", "IN_SHELL", "x", "pathSep", "node_getBinaryResponse", "_file_sub_resource_hash", "nodeFsPromisesMod", "data", "shell_getBinaryResponse", "browser_getBinaryResponse", "subResourceHash", "url", "getBinaryResponse", "loadBinaryFile", "file_sub_resource_hash", "response", "binary", "r", "loadScript", "IN_BROWSER_MAIN_THREAD", "IN_BROWSER_WEB_WORKER", "e", "nodeLoadScript", "nodeVmMod", "nodeUrlMod", "loadLockFile", "lockFileURL", "initNodeModules", "package_string", "calculateDirname", "IN_NODE_COMMONJS", "err", "fileName", "error_stack_parser_default", "IN_NODE_ESM", "indexOfLastSlash", "calculateInstallBaseUrl", "lockFileURL", "__name", "initializeNativeFS", "module", "FS", "MEMFS", "PATH", "nativeFSAsync", "__name", "mount", "populate", "callback", "local", "remote", "src", "dst", "e", "entries", "isRealDir", "p", "toAbsolute", "root", "check", "path", "stat", "handles", "getFsHandles", "handle", "node", "entry", "file", "parentDirHandle", "writable", "total", "create", "key", "e2", "remove", "relPath", "dirHandle", "collect", "curDirHandle", "result", "relativePath", "sentinelInstancePromise", "module", "sentinel_default", "e", "getSentinelImport", "sentinelInstance", "error_marker", "__name", "val", "createSettings", "config", "settings", "getFileSystemInitializationFuncs", "code", "__name", "path", "getInstantiateWasmFunc", "createHomeDirectory", "Module", "fallbackPath", "e", "setEnvironment", "env", "callFsInitHook", "fsInit", "computeVersionTuple", "versionInt", "major", "minor", "micro", "installStdlib", "stdlibURL", "stdlibPromise", "loadBinaryFile", "pymajor", "pyminor", "stdlib", "stdLibURL", "initializeNativeFS", "indexURL", "binary", "response", "getBinaryResponse", "sentinelImportPromise", "getSentinelImport", "imports", "successCallback", "res", "instance", "module", "version", "withTrailingSlash", "path", "__name", "version", "loadPyodide", "options", "initNodeModules", "indexURL", "calculateDirname", "withTrailingSlash", "resolvePath", "options_", "lockFileURL", "loadLockFile", "calculateInstallBaseUrl", "default_config", "config", "emscriptenSettings", "createSettings", "API", "scriptSrc", "loadScript", "snapshot", "snp", "Module", "path", "snapshotConfig", "pyodide", "__name", "loadPyodide"]
7
7
  }