Comparing version 0.26.0-alpha.2 to 0.26.0-dev.0
@@ -999,3 +999,3 @@ // Generated by dts-bundle-generator v8.1.1 | ||
* the actual Python exception that caused this error as | ||
* :py:data:`sys.last_value`. | ||
* :py:data:`sys.last_exc`. | ||
* | ||
@@ -1009,3 +1009,3 @@ * See :ref:`type translations of errors <type-translations-errors>` for more | ||
* If you make a :js:class:`~pyodide.ffi.PyProxy` of | ||
* :py:data:`sys.last_value`, you should be especially careful to | ||
* :py:data:`sys.last_exc`, you should be especially careful to | ||
* :js:meth:`~pyodide.ffi.PyProxy.destroy` it when you are done. You may leak a large | ||
@@ -1021,3 +1021,3 @@ * amount of memory including the local variables of all the stack frames in | ||
* The address of the error we are wrapping. We may later compare this | ||
* against sys.last_value. | ||
* against sys.last_exc. | ||
* WARNING: we don't own a reference to this pointer, dereferencing it | ||
@@ -1024,0 +1024,0 @@ * may be a use-after-free error! |
{ | ||
"name": "pyodide", | ||
"version": "0.26.0-alpha.2", | ||
"version": "0.26.0-dev.0", | ||
"description": "The Pyodide JavaScript package", | ||
@@ -84,3 +84,3 @@ "keywords": [ | ||
"test": "npm-run-all test:*", | ||
"test:unit": "cross-env TEST_NODE=1 ts-mocha --node-option=experimental-loader=./test/loader.mjs --node-option=experimental-wasm-stack-switching -p tsconfig.test.json test/unit/**/*.test.*", | ||
"test:unit": "cross-env TEST_NODE=1 ts-mocha --exit --node-option=experimental-loader=./test/loader.mjs --node-option=experimental-wasm-stack-switching -p tsconfig.test.json test/unit/**/*.test.*", | ||
"test:node": "cross-env TEST_NODE=1 mocha test/integration/**/*.test.js", | ||
@@ -87,0 +87,0 @@ "test:browser": "mocha test/integration/**/*.test.js", |
@@ -940,3 +940,3 @@ // Generated by dts-bundle-generator v8.1.1 | ||
* The address of the error we are wrapping. We may later compare this | ||
* against sys.last_value. | ||
* against sys.last_exc. | ||
* WARNING: we don't own a reference to this pointer, dereferencing it | ||
@@ -1159,32 +1159,2 @@ * may be a use-after-free error! | ||
/** | ||
* Runs a Python code string like :js:func:`pyodide.runPython` but with stack | ||
* switching enabled. Code executed in this way can use | ||
* :py:meth:`PyodideFuture.syncify() <pyodide.webloop.PyodideFuture.syncify>` | ||
* to block until a :py:class:`~asyncio.Future` or :js:class:`Promise` is | ||
* resolved. Only works in runtimes with JS Promise Integration enabled. | ||
* | ||
* .. admonition:: Experimental | ||
* :class: warning | ||
* | ||
* This feature is not yet stable. | ||
* | ||
* @experimental | ||
* @param code The Python code to run | ||
* @param options | ||
* @param options.globals An optional Python dictionary to use as the globals. | ||
* Defaults to :js:attr:`pyodide.globals`. | ||
* @param options.locals An optional Python dictionary to use as the locals. | ||
* Defaults to the same as ``globals``. | ||
* @param options.filename An optional string to use as the file name. | ||
* Defaults to ``"<exec>"``. If a custom file name is given, the | ||
* traceback for any exception that is thrown will show source lines | ||
* (unless the given file name starts with ``<`` and ends with ``>``). | ||
* @returns The result of the Python code translated to JavaScript. | ||
*/ | ||
static runPythonSyncifying(code: string, options?: { | ||
globals?: PyProxy; | ||
locals?: PyProxy; | ||
filename?: string; | ||
}): Promise<any>; | ||
/** | ||
* Registers the JavaScript object ``module`` as a JavaScript module named | ||
@@ -1303,11 +1273,23 @@ * ``name``. This module can then be imported from Python using the standard | ||
* Mounts a :js:class:`FileSystemDirectoryHandle` into the target directory. | ||
* Currently it's only possible to acquire a | ||
* :js:class:`FileSystemDirectoryHandle` in Chrome. | ||
* | ||
* @param path The absolute path in the Emscripten file system to mount the | ||
* native directory. If the directory does not exist, it will be created. If it | ||
* does exist, it must be empty. | ||
* @param fileSystemHandle A handle returned by :js:func:`navigator.storage.getDirectory() <getDirectory>` | ||
* or :js:func:`window.showDirectoryPicker() <showDirectoryPicker>`. | ||
* native directory. If the directory does not exist, it will be created. If | ||
* it does exist, it must be empty. | ||
* @param fileSystemHandle A handle returned by | ||
* :js:func:`navigator.storage.getDirectory() <getDirectory>` or | ||
* :js:func:`window.showDirectoryPicker() <showDirectoryPicker>`. | ||
*/ | ||
static mountNativeFS(path: string, fileSystemHandle: FileSystemDirectoryHandle): Promise<NativeFS>; | ||
/** | ||
* Mounts a host directory into Pyodide file system. Only works in node. | ||
* | ||
* @param emscriptenPath The absolute path in the Emscripten file system to | ||
* mount the native directory. If the directory does not exist, it will be | ||
* created. If it does exist, it must be empty. | ||
* @param hostPath The host path to mount. It must be a directory that exists. | ||
*/ | ||
static mountNodeFS(emscriptenPath: string, hostPath: string): void; | ||
/** | ||
* Tell Pyodide about Comlink. | ||
@@ -1314,0 +1296,0 @@ * Necessary to enable importing Comlink proxies into Python. |
@@ -1,2 +0,2 @@ | ||
"use strict";var loadPyodide=(()=>{var se=Object.create;var _=Object.defineProperty;var ce=Object.getOwnPropertyDescriptor;var le=Object.getOwnPropertyNames;var de=Object.getPrototypeOf,fe=Object.prototype.hasOwnProperty;var f=(t,e)=>_(t,"name",{value:e,configurable:!0}),g=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,c)=>(typeof require<"u"?require:e)[c]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var $=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ue=(t,e)=>{for(var c in e)_(t,c,{get:e[c],enumerable:!0})},U=(t,e,c,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of le(e))!fe.call(t,a)&&a!==c&&_(t,a,{get:()=>e[a],enumerable:!(o=ce(e,a))||o.enumerable});return t};var v=(t,e,c)=>(c=t!=null?se(de(t)):{},U(e||!t||!t.__esModule?_(c,"default",{value:t,enumerable:!0}):c,t)),pe=t=>U(_({},"__esModule",{value:!0}),t);var C=$((N,M)=>{(function(t,e){"use strict";typeof define=="function"&&define.amd?define("stackframe",[],e):typeof N=="object"?M.exports=e():t.StackFrame=e()})(N,function(){"use strict";function t(d){return!isNaN(parseFloat(d))&&isFinite(d)}f(t,"_isNumber");function e(d){return d.charAt(0).toUpperCase()+d.substring(1)}f(e,"_capitalize");function c(d){return function(){return this[d]}}f(c,"_getter");var o=["isConstructor","isEval","isNative","isToplevel"],a=["columnNumber","lineNumber"],r=["fileName","functionName","source"],n=["args"],u=["evalOrigin"],i=o.concat(a,r,n,u);function s(d){if(d)for(var y=0;y<i.length;y++)d[i[y]]!==void 0&&this["set"+e(i[y])](d[i[y]])}f(s,"StackFrame"),s.prototype={getArgs:function(){return this.args},setArgs:function(d){if(Object.prototype.toString.call(d)!=="[object Array]")throw new TypeError("Args must be an Array");this.args=d},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(d){if(d instanceof s)this.evalOrigin=d;else if(d instanceof Object)this.evalOrigin=new s(d);else throw new TypeError("Eval Origin must be an Object or StackFrame")},toString:function(){var d=this.getFileName()||"",y=this.getLineNumber()||"",w=this.getColumnNumber()||"",E=this.getFunctionName()||"";return this.getIsEval()?d?"[eval] ("+d+":"+y+":"+w+")":"[eval]:"+y+":"+w:E?E+" ("+d+":"+y+":"+w+")":d+":"+y+":"+w}},s.fromString=f(function(y){var w=y.indexOf("("),E=y.lastIndexOf(")"),re=y.substring(0,w),ne=y.substring(w+1,E).split(","),T=y.substring(E+1);if(T.indexOf("@")===0)var R=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(T,""),ie=R[1],oe=R[2],ae=R[3];return new s({functionName:re,args:ne||void 0,fileName:ie,lineNumber:oe||void 0,columnNumber:ae||void 0})},"StackFrame$$fromString");for(var l=0;l<o.length;l++)s.prototype["get"+e(o[l])]=c(o[l]),s.prototype["set"+e(o[l])]=function(d){return function(y){this[d]=!!y}}(o[l]);for(var m=0;m<a.length;m++)s.prototype["get"+e(a[m])]=c(a[m]),s.prototype["set"+e(a[m])]=function(d){return function(y){if(!t(y))throw new TypeError(d+" must be a Number");this[d]=Number(y)}}(a[m]);for(var p=0;p<r.length;p++)s.prototype["get"+e(r[p])]=c(r[p]),s.prototype["set"+e(r[p])]=function(d){return function(y){this[d]=String(y)}}(r[p]);return s})});var j=$((P,B)=>{(function(t,e){"use strict";typeof define=="function"&&define.amd?define("error-stack-parser",["stackframe"],e):typeof P=="object"?B.exports=e(C()):t.ErrorStackParser=e(t.StackFrame)})(P,f(function(e){"use strict";var c=/(^|@)\S+:\d+/,o=/^\s*at .*(\S+:\d+|\(native\))/m,a=/^(eval@)?(\[native code])?$/;return{parse:f(function(n){if(typeof n.stacktrace<"u"||typeof n["opera#sourceloc"]<"u")return this.parseOpera(n);if(n.stack&&n.stack.match(o))return this.parseV8OrIE(n);if(n.stack)return this.parseFFOrSafari(n);throw new Error("Cannot parse given Error object")},"ErrorStackParser$$parse"),extractLocation:f(function(n){if(n.indexOf(":")===-1)return[n];var u=/(.+?)(?::(\d+))?(?::(\d+))?$/,i=u.exec(n.replace(/[()]/g,""));return[i[1],i[2]||void 0,i[3]||void 0]},"ErrorStackParser$$extractLocation"),parseV8OrIE:f(function(n){var u=n.stack.split(` | ||
"use strict";var loadPyodide=(()=>{var ce=Object.create;var _=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var de=Object.getOwnPropertyNames;var fe=Object.getPrototypeOf,ue=Object.prototype.hasOwnProperty;var f=(t,e)=>_(t,"name",{value:e,configurable:!0}),g=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,c)=>(typeof require<"u"?require:e)[c]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var $=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),pe=(t,e)=>{for(var c in e)_(t,c,{get:e[c],enumerable:!0})},U=(t,e,c,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of de(e))!ue.call(t,a)&&a!==c&&_(t,a,{get:()=>e[a],enumerable:!(o=le(e,a))||o.enumerable});return t};var h=(t,e,c)=>(c=t!=null?ce(fe(t)):{},U(e||!t||!t.__esModule?_(c,"default",{value:t,enumerable:!0}):c,t)),me=t=>U(_({},"__esModule",{value:!0}),t);var C=$((N,M)=>{(function(t,e){"use strict";typeof define=="function"&&define.amd?define("stackframe",[],e):typeof N=="object"?M.exports=e():t.StackFrame=e()})(N,function(){"use strict";function t(d){return!isNaN(parseFloat(d))&&isFinite(d)}f(t,"_isNumber");function e(d){return d.charAt(0).toUpperCase()+d.substring(1)}f(e,"_capitalize");function c(d){return function(){return this[d]}}f(c,"_getter");var o=["isConstructor","isEval","isNative","isToplevel"],a=["columnNumber","lineNumber"],r=["fileName","functionName","source"],n=["args"],u=["evalOrigin"],i=o.concat(a,r,n,u);function s(d){if(d)for(var y=0;y<i.length;y++)d[i[y]]!==void 0&&this["set"+e(i[y])](d[i[y]])}f(s,"StackFrame"),s.prototype={getArgs:function(){return this.args},setArgs:function(d){if(Object.prototype.toString.call(d)!=="[object Array]")throw new TypeError("Args must be an Array");this.args=d},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(d){if(d instanceof s)this.evalOrigin=d;else if(d instanceof Object)this.evalOrigin=new s(d);else throw new TypeError("Eval Origin must be an Object or StackFrame")},toString:function(){var d=this.getFileName()||"",y=this.getLineNumber()||"",w=this.getColumnNumber()||"",E=this.getFunctionName()||"";return this.getIsEval()?d?"[eval] ("+d+":"+y+":"+w+")":"[eval]:"+y+":"+w:E?E+" ("+d+":"+y+":"+w+")":d+":"+y+":"+w}},s.fromString=f(function(y){var w=y.indexOf("("),E=y.lastIndexOf(")"),ne=y.substring(0,w),ie=y.substring(w+1,E).split(","),T=y.substring(E+1);if(T.indexOf("@")===0)var R=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(T,""),oe=R[1],ae=R[2],se=R[3];return new s({functionName:ne,args:ie||void 0,fileName:oe,lineNumber:ae||void 0,columnNumber:se||void 0})},"StackFrame$$fromString");for(var l=0;l<o.length;l++)s.prototype["get"+e(o[l])]=c(o[l]),s.prototype["set"+e(o[l])]=function(d){return function(y){this[d]=!!y}}(o[l]);for(var m=0;m<a.length;m++)s.prototype["get"+e(a[m])]=c(a[m]),s.prototype["set"+e(a[m])]=function(d){return function(y){if(!t(y))throw new TypeError(d+" must be a Number");this[d]=Number(y)}}(a[m]);for(var p=0;p<r.length;p++)s.prototype["get"+e(r[p])]=c(r[p]),s.prototype["set"+e(r[p])]=function(d){return function(y){this[d]=String(y)}}(r[p]);return s})});var j=$((x,B)=>{(function(t,e){"use strict";typeof define=="function"&&define.amd?define("error-stack-parser",["stackframe"],e):typeof x=="object"?B.exports=e(C()):t.ErrorStackParser=e(t.StackFrame)})(x,f(function(e){"use strict";var c=/(^|@)\S+:\d+/,o=/^\s*at .*(\S+:\d+|\(native\))/m,a=/^(eval@)?(\[native code])?$/;return{parse:f(function(n){if(typeof n.stacktrace<"u"||typeof n["opera#sourceloc"]<"u")return this.parseOpera(n);if(n.stack&&n.stack.match(o))return this.parseV8OrIE(n);if(n.stack)return this.parseFFOrSafari(n);throw new Error("Cannot parse given Error object")},"ErrorStackParser$$parse"),extractLocation:f(function(n){if(n.indexOf(":")===-1)return[n];var u=/(.+?)(?::(\d+))?(?::(\d+))?$/,i=u.exec(n.replace(/[()]/g,""));return[i[1],i[2]||void 0,i[3]||void 0]},"ErrorStackParser$$extractLocation"),parseV8OrIE:f(function(n){var u=n.stack.split(` | ||
`).filter(function(i){return!!i.match(o)},this);return u.map(function(i){i.indexOf("(eval ")>-1&&(i=i.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));var s=i.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),l=s.match(/ (\(.+\)$)/);s=l?s.replace(l[0],""):s;var m=this.extractLocation(l?l[1]:s),p=l&&s||void 0,d=["eval","<anonymous>"].indexOf(m[0])>-1?void 0:m[0];return new e({functionName:p,fileName:d,lineNumber:m[1],columnNumber:m[2],source:i})},this)},"ErrorStackParser$$parseV8OrIE"),parseFFOrSafari:f(function(n){var u=n.stack.split(` | ||
@@ -9,7 +9,7 @@ `).filter(function(i){return!i.match(a)},this);return u.map(function(i){if(i.indexOf(" > eval")>-1&&(i=i.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),i.indexOf("@")===-1&&i.indexOf(":")===-1)return new e({functionName:i});var s=/((.*".+"[^@]*)?[^@]*)(?:@)/,l=i.match(s),m=l&&l[1]?l[1]:void 0,p=this.extractLocation(i.replace(s,""));return new e({functionName:m,fileName:p[0],lineNumber:p[1],columnNumber:p[2],source:i})},this)},"ErrorStackParser$$parseFFOrSafari"),parseOpera:f(function(n){return!n.stacktrace||n.message.indexOf(` | ||
`),s=[],l=0,m=i.length;l<m;l+=2){var p=u.exec(i[l]);p&&s.push(new e({functionName:p[3]||void 0,fileName:p[2],lineNumber:p[1],source:i[l]}))}return s},"ErrorStackParser$$parseOpera10"),parseOpera11:f(function(n){var u=n.stack.split(` | ||
`).filter(function(i){return!!i.match(c)&&!i.match(/^Error created at/)},this);return u.map(function(i){var s=i.split("@"),l=this.extractLocation(s.pop()),m=s.shift()||"",p=m.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,d;m.match(/\(([^)]*)\)/)&&(d=m.replace(/^[^(]+\(([^)]*)\)$/,"$1"));var y=d===void 0||d==="[arguments not available]"?void 0:d.split(",");return new e({functionName:p,args:y,fileName:l[0],lineNumber:l[1],columnNumber:l[2],source:i})},this)},"ErrorStackParser$$parseOpera11")}},"ErrorStackParser"))});var ke={};ue(ke,{loadPyodide:()=>I,version:()=>b});var V=v(j());var h=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&typeof process.browser>"u",x=h&&typeof module<"u"&&typeof module.exports<"u"&&typeof g<"u"&&typeof __dirname<"u",W=h&&!x,me=typeof Deno<"u",H=!h&&!me,z=H&&typeof window<"u"&&typeof document<"u"&&typeof document.createElement<"u"&&typeof sessionStorage<"u",q=H&&typeof importScripts<"u"&&typeof self<"u";var K,F,X,L;async function D(){if(!h||(K=(await import(/* webpackIgnore */"url")).default,L=await import(/* webpackIgnore */"fs/promises"),X=(await import(/* webpackIgnore */"vm")).default,F=await import(/* webpackIgnore */"path"),A=F.sep,typeof g<"u"))return;let t=await import(/* webpackIgnore */"fs"),e=await import(/* webpackIgnore */"crypto"),c=await import(/* webpackIgnore */"ws"),o=await import(/* webpackIgnore */"child_process"),a={fs:t,crypto:e,ws:c,child_process:o};globalThis.require=function(r){return a[r]}}f(D,"initNodeModules");function ye(t,e){return F.resolve(e||".",t)}f(ye,"node_resolvePath");function ge(t,e){return e===void 0&&(e=location),new URL(t,e).toString()}f(ge,"browser_resolvePath");var k;h?k=ye:k=ge;var A;h||(A="/");function ve(t,e){return t.startsWith("file://")&&(t=t.slice(7)),t.includes("://")?{response:fetch(t)}:{binary:L.readFile(t).then(c=>new Uint8Array(c.buffer,c.byteOffset,c.byteLength))}}f(ve,"node_getBinaryResponse");function he(t,e){let c=new URL(t,location);return{response:fetch(c,e?{integrity:e}:{})}}f(he,"browser_getBinaryResponse");var O;h?O=ve:O=he;async function G(t,e){let{response:c,binary:o}=O(t,e);if(o)return o;let a=await c;if(!a.ok)throw new Error(`Failed to load '${t}': request failed.`);return new Uint8Array(await a.arrayBuffer())}f(G,"loadBinaryFile");var S;if(z)S=f(async t=>await import(/* webpackIgnore */t),"loadScript");else if(q)S=f(async t=>{try{globalThis.importScripts(t)}catch(e){if(e instanceof TypeError)await import(/* webpackIgnore */t);else throw e}},"loadScript");else if(h)S=we;else throw new Error("Cannot determine runtime environment");async function we(t){t.startsWith("file://")&&(t=t.slice(7)),t.includes("://")?X.runInThisContext(await(await fetch(t)).text()):await import(/* webpackIgnore */K.pathToFileURL(t).href)}f(we,"nodeLoadScript");async function J(t){if(h){await D();let e=await L.readFile(t);return JSON.parse(e)}else return await(await fetch(t)).json()}f(J,"loadLockFile");async function Y(){if(x)return __dirname;let t;try{throw new Error}catch(o){t=o}let e=V.default.parse(t)[0].fileName;if(W){let o=await import(/* webpackIgnore */"path");return(await import(/* webpackIgnore */"url")).fileURLToPath(o.dirname(e))}let c=e.lastIndexOf(A);if(c===-1)throw new Error("Could not extract indexURL path from pyodide module location");return e.slice(0,c)}f(Y,"calculateDirname");function Q(t){let e=t.FS,c=t.FS.filesystems.MEMFS,o=t.PATH,a={DIR_MODE:16895,FILE_MODE:33279,mount:function(r){if(!r.opts.fileSystemHandle)throw new Error("opts.fileSystemHandle is required");return c.mount.apply(null,arguments)},syncfs:async(r,n,u)=>{try{let i=a.getLocalSet(r),s=await a.getRemoteSet(r),l=n?s:i,m=n?i:s;await a.reconcile(r,l,m),u(null)}catch(i){u(i)}},getLocalSet:r=>{let n=Object.create(null);function u(l){return l!=="."&&l!==".."}f(u,"isRealDir");function i(l){return m=>o.join2(l,m)}f(i,"toAbsolute");let s=e.readdir(r.mountpoint).filter(u).map(i(r.mountpoint));for(;s.length;){let l=s.pop(),m=e.stat(l);e.isDir(m.mode)&&s.push.apply(s,e.readdir(l).filter(u).map(i(l))),n[l]={timestamp:m.mtime,mode:m.mode}}return{type:"local",entries:n}},getRemoteSet:async r=>{let n=Object.create(null),u=await be(r.opts.fileSystemHandle);for(let[i,s]of u)i!=="."&&(n[o.join2(r.mountpoint,i)]={timestamp:s.kind==="file"?(await s.getFile()).lastModifiedDate:new Date,mode:s.kind==="file"?a.FILE_MODE:a.DIR_MODE});return{type:"remote",entries:n,handles:u}},loadLocalEntry:r=>{let u=e.lookupPath(r).node,i=e.stat(r);if(e.isDir(i.mode))return{timestamp:i.mtime,mode:i.mode};if(e.isFile(i.mode))return u.contents=c.getFileDataAsTypedArray(u),{timestamp:i.mtime,mode:i.mode,contents:u.contents};throw new Error("node type not supported")},storeLocalEntry:(r,n)=>{if(e.isDir(n.mode))e.mkdirTree(r,n.mode);else if(e.isFile(n.mode))e.writeFile(r,n.contents,{canOwn:!0});else throw new Error("node type not supported");e.chmod(r,n.mode),e.utime(r,n.timestamp,n.timestamp)},removeLocalEntry:r=>{var n=e.stat(r);e.isDir(n.mode)?e.rmdir(r):e.isFile(n.mode)&&e.unlink(r)},loadRemoteEntry:async r=>{if(r.kind==="file"){let n=await r.getFile();return{contents:new Uint8Array(await n.arrayBuffer()),mode:a.FILE_MODE,timestamp:n.lastModifiedDate}}else{if(r.kind==="directory")return{mode:a.DIR_MODE,timestamp:new Date};throw new Error("unknown kind: "+r.kind)}},storeRemoteEntry:async(r,n,u)=>{let i=r.get(o.dirname(n)),s=e.isFile(u.mode)?await i.getFileHandle(o.basename(n),{create:!0}):await i.getDirectoryHandle(o.basename(n),{create:!0});if(s.kind==="file"){let l=await s.createWritable();await l.write(u.contents),await l.close()}r.set(n,s)},removeRemoteEntry:async(r,n)=>{await r.get(o.dirname(n)).removeEntry(o.basename(n)),r.delete(n)},reconcile:async(r,n,u)=>{let i=0,s=[];Object.keys(n.entries).forEach(function(p){let d=n.entries[p],y=u.entries[p];(!y||e.isFile(d.mode)&&d.timestamp.getTime()>y.timestamp.getTime())&&(s.push(p),i++)}),s.sort();let l=[];if(Object.keys(u.entries).forEach(function(p){n.entries[p]||(l.push(p),i++)}),l.sort().reverse(),!i)return;let m=n.type==="remote"?n.handles:u.handles;for(let p of s){let d=o.normalize(p.replace(r.mountpoint,"/")).substring(1);if(u.type==="local"){let y=m.get(d),w=await a.loadRemoteEntry(y);a.storeLocalEntry(p,w)}else{let y=a.loadLocalEntry(p);await a.storeRemoteEntry(m,d,y)}}for(let p of l)if(u.type==="local")a.removeLocalEntry(p);else{let d=o.normalize(p.replace(r.mountpoint,"/")).substring(1);await a.removeRemoteEntry(m,d)}}};t.FS.filesystems.NATIVEFS_ASYNC=a}f(Q,"initializeNativeFS");var be=f(async t=>{let e=[];async function c(a){for await(let r of a.values())e.push(r),r.kind==="directory"&&await c(r)}f(c,"collect"),await c(t);let o=new Map;o.set(".",t);for(let a of e){let r=(await t.resolve(a)).join("/");o.set(r,a)}return o},"getFsHandles");function Z(){let t={};return t.noImageDecoding=!0,t.noAudioDecoding=!0,t.noWasmDecoding=!1,t.preRun=[],t.quit=(e,c)=>{throw t.exited={status:e,toThrow:c},c},t}f(Z,"createModule");function Ee(t,e){t.preRun.push(function(){let c="/";try{t.FS.mkdirTree(e)}catch(o){console.error(`Error occurred while making a home directory '${e}':`),console.error(o),console.error(`Using '${c}' for a home directory instead`),e=c}t.FS.chdir(e)})}f(Ee,"createHomeDirectory");function _e(t,e){t.preRun.push(function(){Object.assign(t.ENV,e)})}f(_e,"setEnvironment");function Se(t,e){t.preRun.push(()=>{for(let c of e)t.FS.mkdirTree(c),t.FS.mount(t.FS.filesystems.NODEFS,{root:c},c)})}f(Se,"mountLocalDirectories");function Oe(t,e){let c=G(e);t.preRun.push(()=>{let o=t._py_version_major(),a=t._py_version_minor();t.FS.mkdirTree("/lib"),t.FS.mkdirTree(`/lib/python${o}.${a}/site-packages`),t.addRunDependency("install-stdlib"),c.then(r=>{t.FS.writeFile(`/lib/python${o}${a}.zip`,r)}).catch(r=>{console.error("Error occurred while installing the standard library:"),console.error(r)}).finally(()=>{t.removeRunDependency("install-stdlib")})})}f(Oe,"installStdlib");function ee(t,e){let c;e.stdLibURL!=null?c=e.stdLibURL:c=e.indexURL+"python_stdlib.zip",Oe(t,c),Ee(t,e.env.HOME),_e(t,e.env),Se(t,e._node_mounts),t.preRun.push(()=>Q(t))}f(ee,"initializeFileSystem");function te(t,e){let{binary:c,response:o}=O(e+"pyodide.asm.wasm");t.instantiateWasm=function(a,r){return async function(){try{let n;o?n=await WebAssembly.instantiateStreaming(o,a):n=await WebAssembly.instantiate(await c,a);let{instance:u,module:i}=n;typeof WasmOffsetConverter<"u"&&(wasmOffsetConverter=new WasmOffsetConverter(wasmBinary,i)),r(u,i)}catch(n){console.warn("wasm instantiation failed!"),console.warn(n)}}(),{}}}f(te,"preloadWasm");var b="0.26.0a2";async function I(t={}){await D();let e=t.indexURL||await Y();e=k(e),e.endsWith("/")||(e+="/"),t.indexURL=e;let c={fullStdLib:!1,jsglobals:globalThis,stdin:globalThis.prompt?globalThis.prompt:void 0,lockFileURL:e+"pyodide-lock.json",args:[],_node_mounts:[],env:{},packageCacheDir:e,packages:[]},o=Object.assign(c,t);o.env.HOME||(o.env.HOME="/home/pyodide");let a=Z();a.print=o.stdout,a.printErr=o.stderr,a.arguments=o.args;let r={config:o};a.API=r,r.lockFilePromise=J(o.lockFileURL),te(a,e),ee(a,o);let n=new Promise(s=>a.postRun=s);if(a.locateFile=s=>o.indexURL+s,typeof _createPyodideModule!="function"){let s=`${o.indexURL}pyodide.asm.js`;await S(s)}if(await _createPyodideModule(a),await n,a.exited)throw a.exited.toThrow;if(t.pyproxyToStringRepr&&r.setPyProxyToStringMethod(!0),r.version!==b)throw new Error(`Pyodide version does not match: '${b}' <==> '${r.version}'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.`);a.locateFile=s=>{throw new Error("Didn't expect to load any more file_packager files!")};let u=r.finalizeBootstrap();if(u.version.includes("dev")||r.setCdnUrl(`https://cdn.jsdelivr.net/pyodide/v${u.version}/full/`),await r.packageIndexReady,r._pyodide._importhook.register_module_not_found_hook(r._import_name_to_package_name,r.lockfile_unvendored_stdlibs_and_test),r.lockfile_info.version!==b)throw new Error(`Lock file version doesn't match Pyodide version. | ||
`).filter(function(i){return!!i.match(c)&&!i.match(/^Error created at/)},this);return u.map(function(i){var s=i.split("@"),l=this.extractLocation(s.pop()),m=s.shift()||"",p=m.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,d;m.match(/\(([^)]*)\)/)&&(d=m.replace(/^[^(]+\(([^)]*)\)$/,"$1"));var y=d===void 0||d==="[arguments not available]"?void 0:d.split(",");return new e({functionName:p,args:y,fileName:l[0],lineNumber:l[1],columnNumber:l[2],source:i})},this)},"ErrorStackParser$$parseOpera11")}},"ErrorStackParser"))});var Re={};pe(Re,{loadPyodide:()=>I,version:()=>b});var K=h(j());var v=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&typeof process.browser>"u",P=v&&typeof module<"u"&&typeof module.exports<"u"&&typeof g<"u"&&typeof __dirname<"u",W=v&&!P,ye=typeof Deno<"u",H=!v&&!ye,z=H&&typeof window<"u"&&typeof document<"u"&&typeof document.createElement<"u"&&typeof sessionStorage<"u",q=H&&typeof importScripts<"u"&&typeof self<"u";var X,F,G,V,L;async function D(){if(!v||(X=(await import(/* webpackIgnore */"node:url")).default,V=await import(/* webpackIgnore */"node:fs"),L=await import(/* webpackIgnore */"node:fs/promises"),G=(await import(/* webpackIgnore */"node:vm")).default,F=await import(/* webpackIgnore */"node:path"),A=F.sep,typeof g<"u"))return;let t=V,e=await import(/* webpackIgnore */"node:crypto"),c=await import(/* webpackIgnore */"ws"),o=await import(/* webpackIgnore */"node:child_process"),a={fs:t,crypto:e,ws:c,child_process:o};globalThis.require=function(r){return a[r]}}f(D,"initNodeModules");function ge(t,e){return F.resolve(e||".",t)}f(ge,"node_resolvePath");function he(t,e){return e===void 0&&(e=location),new URL(t,e).toString()}f(he,"browser_resolvePath");var O;v?O=ge:O=he;var A;v||(A="/");function ve(t,e){return t.startsWith("file://")&&(t=t.slice(7)),t.includes("://")?{response:fetch(t)}:{binary:L.readFile(t).then(c=>new Uint8Array(c.buffer,c.byteOffset,c.byteLength))}}f(ve,"node_getBinaryResponse");function we(t,e){let c=new URL(t,location);return{response:fetch(c,e?{integrity:e}:{})}}f(we,"browser_getBinaryResponse");var k;v?k=ve:k=we;async function J(t,e){let{response:c,binary:o}=k(t,e);if(o)return o;let a=await c;if(!a.ok)throw new Error(`Failed to load '${t}': request failed.`);return new Uint8Array(await a.arrayBuffer())}f(J,"loadBinaryFile");var S;if(z)S=f(async t=>await import(/* webpackIgnore */t),"loadScript");else if(q)S=f(async t=>{try{globalThis.importScripts(t)}catch(e){if(e instanceof TypeError)await import(/* webpackIgnore */t);else throw e}},"loadScript");else if(v)S=be;else throw new Error("Cannot determine runtime environment");async function be(t){t.startsWith("file://")&&(t=t.slice(7)),t.includes("://")?G.runInThisContext(await(await fetch(t)).text()):await import(/* webpackIgnore */X.pathToFileURL(t).href)}f(be,"nodeLoadScript");async function Y(t){if(v){await D();let e=await L.readFile(t,{encoding:"utf8"});return JSON.parse(e)}else return await(await fetch(t)).json()}f(Y,"loadLockFile");async function Q(){if(P)return __dirname;let t;try{throw new Error}catch(o){t=o}let e=K.default.parse(t)[0].fileName;if(W){let o=await import(/* webpackIgnore */"node:path");return(await import(/* webpackIgnore */"node:url")).fileURLToPath(o.dirname(e))}let c=e.lastIndexOf(A);if(c===-1)throw new Error("Could not extract indexURL path from pyodide module location");return e.slice(0,c)}f(Q,"calculateDirname");function Z(t){let e=t.FS,c=t.FS.filesystems.MEMFS,o=t.PATH,a={DIR_MODE:16895,FILE_MODE:33279,mount:function(r){if(!r.opts.fileSystemHandle)throw new Error("opts.fileSystemHandle is required");return c.mount.apply(null,arguments)},syncfs:async(r,n,u)=>{try{let i=a.getLocalSet(r),s=await a.getRemoteSet(r),l=n?s:i,m=n?i:s;await a.reconcile(r,l,m),u(null)}catch(i){u(i)}},getLocalSet:r=>{let n=Object.create(null);function u(l){return l!=="."&&l!==".."}f(u,"isRealDir");function i(l){return m=>o.join2(l,m)}f(i,"toAbsolute");let s=e.readdir(r.mountpoint).filter(u).map(i(r.mountpoint));for(;s.length;){let l=s.pop(),m=e.stat(l);e.isDir(m.mode)&&s.push.apply(s,e.readdir(l).filter(u).map(i(l))),n[l]={timestamp:m.mtime,mode:m.mode}}return{type:"local",entries:n}},getRemoteSet:async r=>{let n=Object.create(null),u=await Ee(r.opts.fileSystemHandle);for(let[i,s]of u)i!=="."&&(n[o.join2(r.mountpoint,i)]={timestamp:s.kind==="file"?(await s.getFile()).lastModifiedDate:new Date,mode:s.kind==="file"?a.FILE_MODE:a.DIR_MODE});return{type:"remote",entries:n,handles:u}},loadLocalEntry:r=>{let u=e.lookupPath(r).node,i=e.stat(r);if(e.isDir(i.mode))return{timestamp:i.mtime,mode:i.mode};if(e.isFile(i.mode))return u.contents=c.getFileDataAsTypedArray(u),{timestamp:i.mtime,mode:i.mode,contents:u.contents};throw new Error("node type not supported")},storeLocalEntry:(r,n)=>{if(e.isDir(n.mode))e.mkdirTree(r,n.mode);else if(e.isFile(n.mode))e.writeFile(r,n.contents,{canOwn:!0});else throw new Error("node type not supported");e.chmod(r,n.mode),e.utime(r,n.timestamp,n.timestamp)},removeLocalEntry:r=>{var n=e.stat(r);e.isDir(n.mode)?e.rmdir(r):e.isFile(n.mode)&&e.unlink(r)},loadRemoteEntry:async r=>{if(r.kind==="file"){let n=await r.getFile();return{contents:new Uint8Array(await n.arrayBuffer()),mode:a.FILE_MODE,timestamp:n.lastModifiedDate}}else{if(r.kind==="directory")return{mode:a.DIR_MODE,timestamp:new Date};throw new Error("unknown kind: "+r.kind)}},storeRemoteEntry:async(r,n,u)=>{let i=r.get(o.dirname(n)),s=e.isFile(u.mode)?await i.getFileHandle(o.basename(n),{create:!0}):await i.getDirectoryHandle(o.basename(n),{create:!0});if(s.kind==="file"){let l=await s.createWritable();await l.write(u.contents),await l.close()}r.set(n,s)},removeRemoteEntry:async(r,n)=>{await r.get(o.dirname(n)).removeEntry(o.basename(n)),r.delete(n)},reconcile:async(r,n,u)=>{let i=0,s=[];Object.keys(n.entries).forEach(function(p){let d=n.entries[p],y=u.entries[p];(!y||e.isFile(d.mode)&&d.timestamp.getTime()>y.timestamp.getTime())&&(s.push(p),i++)}),s.sort();let l=[];if(Object.keys(u.entries).forEach(function(p){n.entries[p]||(l.push(p),i++)}),l.sort().reverse(),!i)return;let m=n.type==="remote"?n.handles:u.handles;for(let p of s){let d=o.normalize(p.replace(r.mountpoint,"/")).substring(1);if(u.type==="local"){let y=m.get(d),w=await a.loadRemoteEntry(y);a.storeLocalEntry(p,w)}else{let y=a.loadLocalEntry(p);await a.storeRemoteEntry(m,d,y)}}for(let p of l)if(u.type==="local")a.removeLocalEntry(p);else{let d=o.normalize(p.replace(r.mountpoint,"/")).substring(1);await a.removeRemoteEntry(m,d)}}};t.FS.filesystems.NATIVEFS_ASYNC=a}f(Z,"initializeNativeFS");var Ee=f(async t=>{let e=[];async function c(a){for await(let r of a.values())e.push(r),r.kind==="directory"&&await c(r)}f(c,"collect"),await c(t);let o=new Map;o.set(".",t);for(let a of e){let r=(await t.resolve(a)).join("/");o.set(r,a)}return o},"getFsHandles");function ee(){let t={};return t.noImageDecoding=!0,t.noAudioDecoding=!0,t.noWasmDecoding=!1,t.preRun=[],t.quit=(e,c)=>{throw t.exited={status:e,toThrow:c},c},t}f(ee,"createModule");function _e(t,e){t.preRun.push(function(){let c="/";try{t.FS.mkdirTree(e)}catch(o){console.error(`Error occurred while making a home directory '${e}':`),console.error(o),console.error(`Using '${c}' for a home directory instead`),e=c}t.FS.chdir(e)})}f(_e,"createHomeDirectory");function Se(t,e){t.preRun.push(function(){Object.assign(t.ENV,e)})}f(Se,"setEnvironment");function ke(t,e){t.preRun.push(()=>{for(let c of e)t.FS.mkdirTree(c),t.FS.mount(t.FS.filesystems.NODEFS,{root:c},c)})}f(ke,"mountLocalDirectories");function Oe(t,e){let c=J(e);t.preRun.push(()=>{let o=t._py_version_major(),a=t._py_version_minor();t.FS.mkdirTree("/lib"),t.FS.mkdirTree(`/lib/python${o}.${a}/site-packages`),t.addRunDependency("install-stdlib"),c.then(r=>{t.FS.writeFile(`/lib/python${o}${a}.zip`,r)}).catch(r=>{console.error("Error occurred while installing the standard library:"),console.error(r)}).finally(()=>{t.removeRunDependency("install-stdlib")})})}f(Oe,"installStdlib");function te(t,e){let c;e.stdLibURL!=null?c=e.stdLibURL:c=e.indexURL+"python_stdlib.zip",Oe(t,c),_e(t,e.env.HOME),Se(t,e.env),ke(t,e._node_mounts),t.preRun.push(()=>Z(t))}f(te,"initializeFileSystem");function re(t,e){let{binary:c,response:o}=k(e+"pyodide.asm.wasm");t.instantiateWasm=function(a,r){return async function(){try{let n;o?n=await WebAssembly.instantiateStreaming(o,a):n=await WebAssembly.instantiate(await c,a);let{instance:u,module:i}=n;typeof WasmOffsetConverter<"u"&&(wasmOffsetConverter=new WasmOffsetConverter(wasmBinary,i)),r(u,i)}catch(n){console.warn("wasm instantiation failed!"),console.warn(n)}}(),{}}}f(re,"preloadWasm");var b="0.26.0.dev0";async function I(t={}){await D();let e=t.indexURL||await Q();e=O(e),e.endsWith("/")||(e+="/"),t.indexURL=e;let c={fullStdLib:!1,jsglobals:globalThis,stdin:globalThis.prompt?globalThis.prompt:void 0,lockFileURL:e+"pyodide-lock.json",args:[],_node_mounts:[],env:{},packageCacheDir:e,packages:[]},o=Object.assign(c,t);o.env.HOME||(o.env.HOME="/home/pyodide");let a=ee();a.print=o.stdout,a.printErr=o.stderr,a.arguments=o.args;let r={config:o};a.API=r,r.lockFilePromise=Y(o.lockFileURL),re(a,e),te(a,o);let n=new Promise(s=>a.postRun=s);if(a.locateFile=s=>o.indexURL+s,typeof _createPyodideModule!="function"){let s=`${o.indexURL}pyodide.asm.js`;await S(s)}if(await _createPyodideModule(a),await n,a.exited)throw a.exited.toThrow;if(t.pyproxyToStringRepr&&r.setPyProxyToStringMethod(!0),r.version!==b)throw new Error(`Pyodide version does not match: '${b}' <==> '${r.version}'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.`);a.locateFile=s=>{throw new Error("Didn't expect to load any more file_packager files!")};let u=r.finalizeBootstrap();if(u.version.includes("dev")||r.setCdnUrl(`https://cdn.jsdelivr.net/pyodide/v${u.version}/full/`),await r.packageIndexReady,r._pyodide.set_excepthook(),r._pyodide._importhook.register_module_not_found_hook(r._import_name_to_package_name,r.lockfile_unvendored_stdlibs_and_test),r.lockfile_info.version!==b)throw new Error(`Lock file version doesn't match Pyodide version. | ||
lockfile version: ${r.lockfile_info.version} | ||
pyodide version: ${b}`);return r.package_loader.init_loaded_packages(),o.fullStdLib&&await u.loadPackage(r.lockfile_unvendored_stdlibs),r.initializeStreams(o.stdin,o.stdout,o.stderr),u}f(I,"loadPyodide");globalThis.loadPyodide=I;return pe(ke);})(); | ||
pyodide version: ${b}`);return r.package_loader.init_loaded_packages(),o.fullStdLib&&await u.loadPackage(r.lockfile_unvendored_stdlibs),r.initializeStreams(o.stdin,o.stdout,o.stderr),u}f(I,"loadPyodide");globalThis.loadPyodide=I;return me(Re);})(); | ||
try{Object.assign(exports,loadPyodide)}catch(_){} | ||
globalThis.loadPyodide=loadPyodide.loadPyodide; | ||
//# sourceMappingURL=pyodide.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13920887
7081