pyodide 0.28.3 → 0.29.1
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/console-v2.html +393 -0
- package/package.json +14 -26
- package/pyodide-lock.json +1 -1
- package/pyodide.asm.js +1 -1
- package/pyodide.asm.wasm +0 -0
- package/pyodide.d.ts +47 -88
- package/pyodide.js +3 -3
- package/pyodide.js.map +3 -3
- package/pyodide.mjs +3 -3
- package/pyodide.mjs.map +3 -3
- package/python_stdlib.zip +0 -0
package/pyodide.asm.wasm
CHANGED
|
Binary file
|
package/pyodide.d.ts
CHANGED
|
@@ -31,21 +31,6 @@ declare function setStderr(options?: {
|
|
|
31
31
|
*/
|
|
32
32
|
/** @deprecated Use `import type { TypedArray } from "pyodide/ffi"` instead */
|
|
33
33
|
export type TypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array;
|
|
34
|
-
type FSNode = {
|
|
35
|
-
timestamp: number;
|
|
36
|
-
rdev: number;
|
|
37
|
-
contents: Uint8Array;
|
|
38
|
-
mode: number;
|
|
39
|
-
};
|
|
40
|
-
type FSStream = {
|
|
41
|
-
tty?: {
|
|
42
|
-
ops: object;
|
|
43
|
-
};
|
|
44
|
-
seekable?: boolean;
|
|
45
|
-
stream_ops: FSStreamOps;
|
|
46
|
-
node: FSNode;
|
|
47
|
-
};
|
|
48
|
-
type FSStreamOps = FSStreamOpsGen<FSStream>;
|
|
49
34
|
type FSStreamOpsGen<T> = {
|
|
50
35
|
open: (a: T) => void;
|
|
51
36
|
close: (a: T) => void;
|
|
@@ -55,25 +40,10 @@ type FSStreamOpsGen<T> = {
|
|
|
55
40
|
};
|
|
56
41
|
/** @deprecated Use `import type { PyodideFSType } from "pyodide/ffi"` instead */
|
|
57
42
|
interface PyodideFSType {
|
|
58
|
-
mkdirTree: (path: string, mode?: number) => void;
|
|
59
|
-
createDevice: ((parent: string, name: string, input?: (() => number | null) | null, output?: ((code: number) => void) | null) => FSNode) & {
|
|
60
|
-
major: number;
|
|
61
|
-
};
|
|
62
|
-
lookupPath: (path: string, options?: {
|
|
63
|
-
follow_mount?: boolean;
|
|
64
|
-
}) => {
|
|
65
|
-
node: FSNode;
|
|
66
|
-
};
|
|
67
|
-
open: (path: string, flags: string | number, mode?: number) => FSStream;
|
|
68
43
|
filesystems: any;
|
|
69
|
-
isMountpoint: (node: FSNode) => boolean;
|
|
70
|
-
closeStream: (fd: number) => void;
|
|
71
44
|
registerDevice<T>(dev: number, ops: FSStreamOpsGen<T>): void;
|
|
72
|
-
writeFile: (path: string, contents: any, o?: {
|
|
73
|
-
canOwn?: boolean;
|
|
74
|
-
}) => void;
|
|
75
45
|
}
|
|
76
|
-
type FSType =
|
|
46
|
+
type FSType = typeof FS & PyodideFSType;
|
|
77
47
|
/**
|
|
78
48
|
* The lockfile platform info. The ``abi_version`` field is used to check if the
|
|
79
49
|
* lockfile is compatible with the interpreter. The remaining fields are
|
|
@@ -1543,50 +1513,10 @@ export type PyodideAPI = typeof PyodideAPI_;
|
|
|
1543
1513
|
*/
|
|
1544
1514
|
export declare const version: string;
|
|
1545
1515
|
/**
|
|
1546
|
-
*
|
|
1547
|
-
* @hidden
|
|
1516
|
+
* The configuration options for loading Pyodide.
|
|
1548
1517
|
*/
|
|
1549
|
-
type
|
|
1550
|
-
|
|
1551
|
-
packageCacheDir: string;
|
|
1552
|
-
lockFileContents: Lockfile | string | Promise<Lockfile | string>;
|
|
1553
|
-
fullStdLib?: boolean;
|
|
1554
|
-
stdLibURL?: string;
|
|
1555
|
-
stdin?: () => string;
|
|
1556
|
-
stdout?: (msg: string) => void;
|
|
1557
|
-
stderr?: (msg: string) => void;
|
|
1558
|
-
jsglobals?: object;
|
|
1559
|
-
_sysExecutable?: string;
|
|
1560
|
-
args: string[];
|
|
1561
|
-
fsInit?: (FS: FSType, info: {
|
|
1562
|
-
sitePackages: string;
|
|
1563
|
-
}) => Promise<void>;
|
|
1564
|
-
env: {
|
|
1565
|
-
[key: string]: string;
|
|
1566
|
-
};
|
|
1567
|
-
packages: string[];
|
|
1568
|
-
_makeSnapshot: boolean;
|
|
1569
|
-
enableRunUntilComplete: boolean;
|
|
1570
|
-
checkAPIVersion: boolean;
|
|
1571
|
-
BUILD_ID: string;
|
|
1572
|
-
packageBaseUrl?: string;
|
|
1573
|
-
cdnUrl: string;
|
|
1574
|
-
};
|
|
1575
|
-
/**
|
|
1576
|
-
* Load the main Pyodide wasm module and initialize it.
|
|
1577
|
-
*
|
|
1578
|
-
* @returns The :ref:`js-api-pyodide` module.
|
|
1579
|
-
* @example
|
|
1580
|
-
* async function main() {
|
|
1581
|
-
* const pyodide = await loadPyodide({
|
|
1582
|
-
* fullStdLib: true,
|
|
1583
|
-
* stdout: (msg) => console.log(`Pyodide: ${msg}`),
|
|
1584
|
-
* });
|
|
1585
|
-
* console.log("Loaded Pyodide");
|
|
1586
|
-
* }
|
|
1587
|
-
* main();
|
|
1588
|
-
*/
|
|
1589
|
-
export declare function loadPyodide(options?: {
|
|
1518
|
+
/** @deprecated Use `import type { PyodideConfig } from "pyodide/ffi"` instead */
|
|
1519
|
+
interface PyodideConfig {
|
|
1590
1520
|
/**
|
|
1591
1521
|
* The URL from which Pyodide will load the main Pyodide runtime and
|
|
1592
1522
|
* packages. It is recommended that you leave this unchanged, providing an
|
|
@@ -1650,7 +1580,7 @@ export declare function loadPyodide(options?: {
|
|
|
1650
1580
|
* input. The :js:func:`pyodide.setStdin` function is more flexible and
|
|
1651
1581
|
* should be preferred.
|
|
1652
1582
|
*/
|
|
1653
|
-
stdin?: () => string;
|
|
1583
|
+
stdin?: () => string | null;
|
|
1654
1584
|
/**
|
|
1655
1585
|
* Override the standard output callback. The :js:func:`pyodide.setStdout`
|
|
1656
1586
|
* function is more flexible and should be preferred in most cases, but
|
|
@@ -1672,11 +1602,6 @@ export declare function loadPyodide(options?: {
|
|
|
1672
1602
|
* Default: ``globalThis``
|
|
1673
1603
|
*/
|
|
1674
1604
|
jsglobals?: object;
|
|
1675
|
-
/**
|
|
1676
|
-
* Determine the value of ``sys.executable``.
|
|
1677
|
-
* @ignore
|
|
1678
|
-
*/
|
|
1679
|
-
_sysExecutable?: string;
|
|
1680
1605
|
/**
|
|
1681
1606
|
* Command line arguments to pass to Python on startup. See `Python command
|
|
1682
1607
|
* line interface options
|
|
@@ -1705,12 +1630,6 @@ export declare function loadPyodide(options?: {
|
|
|
1705
1630
|
* while Pyodide bootstraps itself.
|
|
1706
1631
|
*/
|
|
1707
1632
|
packages?: string[];
|
|
1708
|
-
/**
|
|
1709
|
-
* Opt into the old behavior where :js:func:`PyProxy.toString() <pyodide.ffi.PyProxy.toString>`
|
|
1710
|
-
* calls :py:func:`repr` and not :py:class:`str() <str>`. Deprecated.
|
|
1711
|
-
* @deprecated
|
|
1712
|
-
*/
|
|
1713
|
-
pyproxyToStringRepr?: boolean;
|
|
1714
1633
|
/**
|
|
1715
1634
|
* Make loop.run_until_complete() function correctly using stack switching.
|
|
1716
1635
|
* Default: ``true``.
|
|
@@ -1730,23 +1649,63 @@ export declare function loadPyodide(options?: {
|
|
|
1730
1649
|
fsInit?: (FS: FSType, info: {
|
|
1731
1650
|
sitePackages: string;
|
|
1732
1651
|
}) => Promise<void>;
|
|
1652
|
+
/**
|
|
1653
|
+
* Opt into the old behavior where :js:func:`PyProxy.toString() <pyodide.ffi.PyProxy.toString>`
|
|
1654
|
+
* calls :py:func:`repr` and not :py:class:`str() <str>`. Deprecated.
|
|
1655
|
+
* @deprecated
|
|
1656
|
+
*/
|
|
1657
|
+
pyproxyToStringRepr?: boolean;
|
|
1733
1658
|
/**
|
|
1734
1659
|
* Opt into the old behavior where JavaScript `null` is converted to `None`
|
|
1735
1660
|
* instead of `jsnull`. Deprecated.
|
|
1736
1661
|
* @deprecated
|
|
1737
1662
|
*/
|
|
1738
1663
|
convertNullToNone?: boolean;
|
|
1664
|
+
/**
|
|
1665
|
+
* Opt into the old behavior where Python dictionaries are converted to
|
|
1666
|
+
* LiteralMap instead of Object.
|
|
1667
|
+
* @deprecated
|
|
1668
|
+
*/
|
|
1669
|
+
toJsLiteralMap?: boolean;
|
|
1670
|
+
/**
|
|
1671
|
+
* Determine the value of ``sys.executable``.
|
|
1672
|
+
* @ignore
|
|
1673
|
+
*/
|
|
1674
|
+
_sysExecutable?: string;
|
|
1739
1675
|
/** @ignore */
|
|
1740
1676
|
_makeSnapshot?: boolean;
|
|
1741
1677
|
/** @ignore */
|
|
1742
1678
|
_loadSnapshot?: Uint8Array | ArrayBuffer | PromiseLike<Uint8Array | ArrayBuffer>;
|
|
1743
1679
|
/** @ignore */
|
|
1744
1680
|
_snapshotDeserializer?: (obj: any) => any;
|
|
1745
|
-
|
|
1681
|
+
/** @ignore */
|
|
1682
|
+
BUILD_ID?: string;
|
|
1683
|
+
/** @ignore */
|
|
1684
|
+
cdnUrl?: string;
|
|
1685
|
+
}
|
|
1686
|
+
/**
|
|
1687
|
+
* @hidden
|
|
1688
|
+
*/
|
|
1689
|
+
export type PyodideConfigWithDefaults = Required<PyodideConfig>;
|
|
1690
|
+
/**
|
|
1691
|
+
* Load the main Pyodide wasm module and initialize it.
|
|
1692
|
+
*
|
|
1693
|
+
* @returns The :ref:`js-api-pyodide` module.
|
|
1694
|
+
* @example
|
|
1695
|
+
* async function main() {
|
|
1696
|
+
* const pyodide = await loadPyodide({
|
|
1697
|
+
* fullStdLib: true,
|
|
1698
|
+
* stdout: (msg) => console.log(`Pyodide: ${msg}`),
|
|
1699
|
+
* });
|
|
1700
|
+
* console.log("Loaded Pyodide");
|
|
1701
|
+
* }
|
|
1702
|
+
* main();
|
|
1703
|
+
*/
|
|
1704
|
+
export declare function loadPyodide(options?: PyodideConfig): Promise<PyodideAPI>;
|
|
1746
1705
|
|
|
1747
1706
|
export type {
|
|
1748
1707
|
PyodideAPI as PyodideInterface,
|
|
1749
1708
|
};
|
|
1750
1709
|
|
|
1751
1710
|
export type {};
|
|
1752
|
-
export type {Lockfile, LockfileInfo, LockfilePackage, PackageData};
|
|
1711
|
+
export type {Lockfile, LockfileInfo, LockfilePackage, PackageData, PyodideConfig};
|
package/pyodide.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var loadPyodide=(()=>{var
|
|
2
|
-
`).filter(function(
|
|
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)))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.3";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:"cc7a4bb4c6f36f12592fef0934292b5fddb0e313ca5dc4a5a9519bb7610c67e3"},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);})();
|
|
1
|
+
"use strict";var loadPyodide=(()=>{var re=Object.create;var F=Object.defineProperty;var ie=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var ae=Object.getPrototypeOf,se=Object.prototype.hasOwnProperty;var o=(e,t)=>F(e,"name",{value:t,configurable:!0}),m=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var le=(e,t)=>{for(var n in t)F(e,n,{get:t[n],enumerable:!0})},$=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of oe(t))!se.call(e,a)&&a!==n&&F(e,a,{get:()=>t[a],enumerable:!(i=ie(t,a))||i.enumerable});return e};var b=(e,t,n)=>(n=e!=null?re(ae(e)):{},$(t||!e||!e.__esModule?F(n,"default",{value:e,enumerable:!0}):n,e)),ce=e=>$(F({},"__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 n=>{for(var i=n.length,a=new Uint8Array((i-(n[i-1]=="=")-(n[i-2]=="="))*3/4|0),r=0,s=0;r<i;){var l=e[n.charCodeAt(r++)],c=e[n.charCodeAt(r++)],d=e[n.charCodeAt(r++)],u=e[n.charCodeAt(r++)];a[s++]=l<<2|c>>4,a[s++]=c<<4|d>>2,a[s++]=d<<6|u}return a}})();var $e={};le($e,{loadPyodide:()=>B,version:()=>x});function de(e){return!isNaN(parseFloat(e))&&isFinite(e)}o(de,"_isNumber");function N(e){return e.charAt(0).toUpperCase()+e.substring(1)}o(N,"_capitalize");function T(e){return function(){return this[e]}}o(T,"_getter");var I=["isConstructor","isEval","isNative","isToplevel"],w=["columnNumber","lineNumber"],_=["fileName","functionName","source"],ue=["args"],fe=["evalOrigin"],D=I.concat(w,_,ue,fe);function y(e){if(e)for(var t=0;t<D.length;t++)e[D[t]]!==void 0&&this["set"+N(D[t])](e[D[t]])}o(y,"StackFrame");y.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 y)this.evalOrigin=e;else if(e instanceof Object)this.evalOrigin=new y(e);else throw new TypeError("Eval Origin must be an Object or StackFrame")},"setEvalOrigin"),toString:o(function(){var e=this.getFileName()||"",t=this.getLineNumber()||"",n=this.getColumnNumber()||"",i=this.getFunctionName()||"";return this.getIsEval()?e?"[eval] ("+e+":"+t+":"+n+")":"[eval]:"+t+":"+n:i?i+" ("+e+":"+t+":"+n+")":e+":"+t+":"+n},"toString")};y.fromString=o(function(t){var n=t.indexOf("("),i=t.lastIndexOf(")"),a=t.substring(0,n),r=t.substring(n+1,i).split(","),s=t.substring(i+1);if(s.indexOf("@")===0)var l=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(s,""),c=l[1],d=l[2],u=l[3];return new y({functionName:a,args:r||void 0,fileName:c,lineNumber:d||void 0,columnNumber:u||void 0})},"StackFrame$$fromString");for(P=0;P<I.length;P++)y.prototype["get"+N(I[P])]=T(I[P]),y.prototype["set"+N(I[P])]=function(e){return function(t){this[e]=!!t}}(I[P]);var P;for(E=0;E<w.length;E++)y.prototype["get"+N(w[E])]=T(w[E]),y.prototype["set"+N(w[E])]=function(e){return function(t){if(!de(t))throw new TypeError(e+" must be a Number");this[e]=Number(t)}}(w[E]);var E;for(h=0;h<_.length;h++)y.prototype["get"+N(_[h])]=T(_[h]),y.prototype["set"+N(_[h])]=function(e){return function(t){this[e]=String(t)}}(_[h]);var h,L=y;function me(){var e=/^\s*at .*(\S+:\d+|\(native\))/m,t=/^(eval@)?(\[native code])?$/;return{parse:o(function(i){if(i.stack&&i.stack.match(e))return this.parseV8OrIE(i);if(i.stack)return this.parseFFOrSafari(i);throw new Error("Cannot parse given Error object")},"ErrorStackParser$$parse"),extractLocation:o(function(i){if(i.indexOf(":")===-1)return[i];var a=/(.+?)(?::(\d+))?(?::(\d+))?$/,r=a.exec(i.replace(/[()]/g,""));return[r[1],r[2]||void 0,r[3]||void 0]},"ErrorStackParser$$extractLocation"),parseV8OrIE:o(function(i){var a=i.stack.split(`
|
|
2
|
+
`).filter(function(r){return!!r.match(e)},this);return a.map(function(r){r.indexOf("(eval ")>-1&&(r=r.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));var s=r.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),l=s.match(/ (\(.+\)$)/);s=l?s.replace(l[0],""):s;var c=this.extractLocation(l?l[1]:s),d=l&&s||void 0,u=["eval","<anonymous>"].indexOf(c[0])>-1?void 0:c[0];return new L({functionName:d,fileName:u,lineNumber:c[1],columnNumber:c[2],source:r})},this)},"ErrorStackParser$$parseV8OrIE"),parseFFOrSafari:o(function(i){var a=i.stack.split(`
|
|
3
|
+
`).filter(function(r){return!r.match(t)},this);return a.map(function(r){if(r.indexOf(" > eval")>-1&&(r=r.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),r.indexOf("@")===-1&&r.indexOf(":")===-1)return new L({functionName:r});var s=/((.*".+"[^@]*)?[^@]*)(?:@)/,l=r.match(s),c=l&&l[1]?l[1]:void 0,d=this.extractLocation(r.replace(s,""));return new L({functionName:c,fileName:d[0],lineNumber:d[1],columnNumber:d[2],source:r})},this)},"ErrorStackParser$$parseFFOrSafari")}}o(me,"ErrorStackParser");var pe=new me;var j=pe;function ye(){if(typeof API<"u"&&API!==globalThis.API)return API.runtimeEnv;let e=typeof Bun<"u",t=typeof Deno<"u",n=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&!process.browser,i=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Chrome")===-1&&navigator.userAgent.indexOf("Safari")>-1;return ge({IN_BUN:e,IN_DENO:t,IN_NODE:n,IN_SAFARI:i,IN_SHELL:typeof read=="function"&&typeof load=="function"})}o(ye,"getGlobalRuntimeEnv");var f=ye();function ge(e){let t=e.IN_NODE&&typeof module<"u"&&module.exports&&typeof m=="function"&&typeof __dirname=="string",n=e.IN_NODE&&!t,i=!e.IN_NODE&&!e.IN_DENO&&!e.IN_BUN,a=i&&typeof window<"u"&&typeof window.document<"u"&&typeof document.createElement=="function"&&"sessionStorage"in window&&typeof globalThis.importScripts!="function",r=i&&typeof globalThis.WorkerGlobalScope<"u"&&typeof globalThis.self<"u"&&globalThis.self instanceof globalThis.WorkerGlobalScope;return{...e,IN_BROWSER:i,IN_BROWSER_MAIN_THREAD:a,IN_BROWSER_WEB_WORKER:r,IN_NODE_COMMONJS:t,IN_NODE_ESM:n}}o(ge,"calculateDerivedFlags");var z,C,J,V,U;async function W(){if(!f.IN_NODE||(z=(await import(/* webpackIgnore */"node:url")).default,V=await import(/* webpackIgnore */"node:fs"),U=await import(/* webpackIgnore */"node:fs/promises"),J=(await import(/* webpackIgnore */"node:vm")).default,C=await import(/* webpackIgnore */"node:path"),M=C.sep,typeof m<"u"))return;let e=V,t=await import(/* webpackIgnore */"node:crypto"),n=await import(/* webpackIgnore */"ws"),i=await import(/* webpackIgnore */"node:child_process"),a={fs:e,crypto:t,ws:n,child_process:i};globalThis.require=function(r){return a[r]}}o(W,"initNodeModules");function be(e,t){return C.resolve(t||".",e)}o(be,"node_resolvePath");function ve(e,t){return t===void 0&&(t=location),new URL(e,t).toString()}o(ve,"browser_resolvePath");var R;f.IN_NODE?R=be:f.IN_SHELL?R=o(e=>e,"resolvePath"):R=ve;var M;f.IN_NODE||(M="/");function Pe(e,t){return e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?{response:fetch(e)}:{binary:U.readFile(e).then(n=>new Uint8Array(n.buffer,n.byteOffset,n.byteLength))}}o(Pe,"node_getBinaryResponse");function Ee(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(Ee,"shell_getBinaryResponse");function he(e,t){let n=new URL(e,location);return{response:fetch(n,t?{integrity:t}:{})}}o(he,"browser_getBinaryResponse");var A;f.IN_NODE?A=Pe:f.IN_SHELL?A=Ee:A=he;async function q(e,t){let{response:n,binary:i}=A(e,t);if(i)return i;let a=await n;if(!a.ok)throw new Error(`Failed to load '${e}': request failed.`);return new Uint8Array(await a.arrayBuffer())}o(q,"loadBinaryFile");var k;if(f.IN_BROWSER_MAIN_THREAD)k=o(async e=>await import(/* webpackIgnore */e),"loadScript");else if(f.IN_BROWSER_WEB_WORKER)k=o(async e=>{try{globalThis.importScripts(e)}catch(t){if(t instanceof TypeError)await import(/* webpackIgnore */e);else throw t}},"loadScript");else if(f.IN_NODE)k=Ne;else if(f.IN_SHELL)k=load;else throw new Error("Cannot determine runtime environment");async function Ne(e){e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?J.runInThisContext(await(await fetch(e)).text()):await import(/* webpackIgnore */z.pathToFileURL(e).href)}o(Ne,"nodeLoadScript");async function G(e){if(f.IN_NODE){await W();let t=await U.readFile(e,{encoding:"utf8"});return JSON.parse(t)}else if(f.IN_SHELL){let t=read(e);return JSON.parse(t)}else return await(await fetch(e)).json()}o(G,"loadLockFile");async function K(){if(f.IN_NODE_COMMONJS)return __dirname;let e;try{throw new Error}catch(i){e=i}let t=j.parse(e)[0].fileName;if(f.IN_NODE&&!t.startsWith("file://")&&(t=`file://${t}`),f.IN_NODE_ESM){let i=await import(/* webpackIgnore */"node:path");return(await import(/* webpackIgnore */"node:url")).fileURLToPath(i.dirname(t))}let n=t.lastIndexOf(M);if(n===-1)throw new Error("Could not extract indexURL path from pyodide module location. Please pass the indexURL explicitly to loadPyodide.");return t.slice(0,n)}o(K,"calculateDirname");function Y(e){return e.substring(0,e.lastIndexOf("/")+1)||globalThis.location?.toString()||"."}o(Y,"calculateInstallBaseUrl");function X(e){let t=e.FS,n=e.FS.filesystems.MEMFS,i=e.PATH,a={DIR_MODE:16895,FILE_MODE:33279,mount:o(function(r){if(!r.opts.fileSystemHandle)throw new Error("opts.fileSystemHandle is required");return n.mount.apply(null,arguments)},"mount"),syncfs:o(async(r,s,l)=>{try{let c=a.getLocalSet(r),d=await a.getRemoteSet(r),u=s?d:c,g=s?c:d;await a.reconcile(r,u,g),l(null)}catch(c){l(c)}},"syncfs"),getLocalSet:o(r=>{let s=Object.create(null);function l(u){return u!=="."&&u!==".."}o(l,"isRealDir");function c(u){return g=>i.join2(u,g)}o(c,"toAbsolute");let d=t.readdir(r.mountpoint).filter(l).map(c(r.mountpoint));for(;d.length;){let u=d.pop(),g=t.stat(u);t.isDir(g.mode)&&d.push.apply(d,t.readdir(u).filter(l).map(c(u))),s[u]={timestamp:g.mtime,mode:g.mode}}return{type:"local",entries:s}},"getLocalSet"),getRemoteSet:o(async r=>{let s=Object.create(null),l=await Se(r.opts.fileSystemHandle);for(let[c,d]of l)c!=="."&&(s[i.join2(r.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:s,handles:l}},"getRemoteSet"),loadLocalEntry:o(r=>{let l=t.lookupPath(r,{}).node,c=t.stat(r);if(t.isDir(c.mode))return{timestamp:c.mtime,mode:c.mode};if(t.isFile(c.mode))return l.contents=n.getFileDataAsTypedArray(l),{timestamp:c.mtime,mode:c.mode,contents:l.contents};throw new Error("node type not supported")},"loadLocalEntry"),storeLocalEntry:o((r,s)=>{if(t.isDir(s.mode))t.mkdirTree(r,s.mode);else if(t.isFile(s.mode))t.writeFile(r,s.contents,{canOwn:!0});else throw new Error("node type not supported");t.chmod(r,s.mode),t.utime(r,s.timestamp,s.timestamp)},"storeLocalEntry"),removeLocalEntry:o(r=>{var s=t.stat(r);t.isDir(s.mode)?t.rmdir(r):t.isFile(s.mode)&&t.unlink(r)},"removeLocalEntry"),loadRemoteEntry:o(async r=>{if(r.kind==="file"){let s=await r.getFile();return{contents:new Uint8Array(await s.arrayBuffer()),mode:a.FILE_MODE,timestamp:new Date(s.lastModified)}}else{if(r.kind==="directory")return{mode:a.DIR_MODE,timestamp:new Date};throw new Error("unknown kind: "+r.kind)}},"loadRemoteEntry"),storeRemoteEntry:o(async(r,s,l)=>{let c=r.get(i.dirname(s)),d=t.isFile(l.mode)?await c.getFileHandle(i.basename(s),{create:!0}):await c.getDirectoryHandle(i.basename(s),{create:!0});if(d.kind==="file"){let u=await d.createWritable();await u.write(l.contents),await u.close()}r.set(s,d)},"storeRemoteEntry"),removeRemoteEntry:o(async(r,s)=>{await r.get(i.dirname(s)).removeEntry(i.basename(s)),r.delete(s)},"removeRemoteEntry"),reconcile:o(async(r,s,l)=>{let c=0,d=[];Object.keys(s.entries).forEach(function(p){let v=s.entries[p],S=l.entries[p];(!S||t.isFile(v.mode)&&v.timestamp.getTime()>S.timestamp.getTime())&&(d.push(p),c++)}),d.sort();let u=[];if(Object.keys(l.entries).forEach(function(p){s.entries[p]||(u.push(p),c++)}),u.sort().reverse(),!c)return;let g=s.type==="remote"?s.handles:l.handles;for(let p of d){let v=i.normalize(p.replace(r.mountpoint,"/")).substring(1);if(l.type==="local"){let S=g.get(v),ne=await a.loadRemoteEntry(S);a.storeLocalEntry(p,ne)}else{let S=a.loadLocalEntry(p);await a.storeRemoteEntry(g,v,S)}}for(let p of u)if(l.type==="local")a.removeLocalEntry(p);else{let v=i.normalize(p.replace(r.mountpoint,"/")).substring(1);await a.removeRemoteEntry(g,v)}},"reconcile")};e.FS.filesystems.NATIVEFS_ASYNC=a}o(X,"initializeNativeFS");var Se=o(async e=>{let t=[];async function n(a){for await(let r of a.values())t.push(r),r.kind==="directory"&&await n(r)}o(n,"collect"),await n(e);let i=new Map;i.set(".",e);for(let a of t){let r=(await e.resolve(a)).join("/");i.set(r,a)}return i},"getFsHandles");var Q=H("AGFzbQEAAAABDANfAGAAAW9gAW8BfwMDAgECByECD2NyZWF0ZV9zZW50aW5lbAAAC2lzX3NlbnRpbmVsAAEKEwIHAPsBAPsbCwkAIAD7GvsUAAs=");var we=async function(){if(!(globalThis.navigator&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&typeof navigator.maxTouchPoints<"u"&&navigator.maxTouchPoints>1)))try{let t=await WebAssembly.compile(Q);return await WebAssembly.instantiate(t)}catch(t){if(t instanceof WebAssembly.CompileError)return;throw t}}();async function Z(){let e=await we;if(e)return e.exports;let t=Symbol("error marker");return{create_sentinel:o(()=>t,"create_sentinel"),is_sentinel:o(n=>n===t,"is_sentinel")}}o(Z,"getSentinelImport");function ee(e){let t={config:e,runtimeEnv:f},n={noImageDecoding:!0,noAudioDecoding:!0,noWasmDecoding:!1,preRun:Oe(e),print:e.stdout,printErr:e.stderr,onExit(i){n.exitCode=i},thisProgram:e._sysExecutable,arguments:e.args,API:t,locateFile:o(i=>e.indexURL+i,"locateFile"),instantiateWasm:xe(e.indexURL)};return n}o(ee,"createSettings");function _e(e){return function(t){let n="/";try{t.FS.mkdirTree(e)}catch(i){console.error(`Error occurred while making a home directory '${e}':`),console.error(i),console.error(`Using '${n}' for a home directory instead`),e=n}t.FS.chdir(e)}}o(_e,"createHomeDirectory");function ke(e){return function(t){Object.assign(t.ENV,e)}}o(ke,"setEnvironment");function Re(e){return e?[async t=>{t.addRunDependency("fsInitHook");try{await e(t.FS,{sitePackages:t.API.sitePackages})}finally{t.removeRunDependency("fsInitHook")}}]:[]}o(Re,"callFsInitHook");function Ae(e){let t=e.HEAPU32[e._Py_Version>>>2],n=t>>>24&255,i=t>>>16&255,a=t>>>8&255;return[n,i,a]}o(Ae,"computeVersionTuple");function Fe(e){let t=q(e);return async n=>{n.API.pyVersionTuple=Ae(n);let[i,a]=n.API.pyVersionTuple;n.FS.mkdirTree("/lib"),n.API.sitePackages=`/lib/python${i}.${a}/site-packages`,n.FS.mkdirTree(n.API.sitePackages),n.addRunDependency("install-stdlib");try{let r=await t;n.FS.writeFile(`/lib/python${i}${a}.zip`,r)}catch(r){console.error("Error occurred while installing the standard library:"),console.error(r)}finally{n.removeRunDependency("install-stdlib")}}}o(Fe,"installStdlib");function Oe(e){let t;return e.stdLibURL!=null?t=e.stdLibURL:t=e.indexURL+"python_stdlib.zip",[Fe(t),_e(e.env.HOME),ke(e.env),X,...Re(e.fsInit)]}o(Oe,"getFileSystemInitializationFuncs");function xe(e){if(typeof WasmOffsetConverter<"u")return;let{binary:t,response:n}=A(e+"pyodide.asm.wasm"),i=Z();return function(a,r){return async function(){a.sentinel=await i;try{let s;n?s=await WebAssembly.instantiateStreaming(n,a):s=await WebAssembly.instantiate(await t,a);let{instance:l,module:c}=s;r(l,c)}catch(s){console.warn("wasm instantiation failed!"),console.warn(s)}}(),{}}}o(xe,"getInstantiateWasmFunc");var te="0.29.1";function O(e){return e===void 0||e.endsWith("/")?e:e+"/"}o(O,"withTrailingSlash");var x=te;async function De(e={}){if(await W(),e.lockFileContents&&e.lockFileURL)throw new Error("Can't pass both lockFileContents and lockFileURL");let t=e.indexURL||await K();if(t=O(R(t)),e.packageBaseUrl=O(e.packageBaseUrl),e.cdnUrl=O(e.packageBaseUrl??`https://cdn.jsdelivr.net/pyodide/v${x}/full/`),!e.lockFileContents){let a=e.lockFileURL??t+"pyodide-lock.json";e.lockFileContents=G(a),e.packageBaseUrl??=Y(a)}e.indexURL=t,e.packageCacheDir&&(e.packageCacheDir=O(R(e.packageCacheDir)));let n={fullStdLib:!1,jsglobals:globalThis,stdin:globalThis.prompt?()=>globalThis.prompt():void 0,args:[],env:{},packages:[],packageCacheDir:e.packageBaseUrl,enableRunUntilComplete:!0,checkAPIVersion:!0,BUILD_ID:"15650dcb90bdff1ec9ab10398b799c17113d70be6a0ebf1d1a7d5dc7db9b5b8c"},i=Object.assign(n,e);return i.env.HOME??="/home/pyodide",i.env.PYTHONINSPECT??="1",i}o(De,"initializeConfiguration");function Le(e){let t=ee(e),n=t.API;return n.lockFilePromise=Promise.resolve(e.lockFileContents),t}o(Le,"createEmscriptenSettings");async function Te(e){if(typeof _createPyodideModule!="function"){let t=`${e.indexURL}pyodide.asm.js`;await k(t)}}o(Te,"loadWasmScript");async function Ce(e,t){if(!e._loadSnapshot)return;let n=await e._loadSnapshot,i=ArrayBuffer.isView(n)?n:new Uint8Array(n);return t.noInitialRun=!0,t.INITIAL_MEMORY=i.length,i}o(Ce,"prepareSnapshot");async function Ue(e){let t=await _createPyodideModule(e);if(e.exitCode!==void 0)throw new t.ExitStatus(e.exitCode);return t}o(Ue,"createPyodideModule");function We(e,t){let n=e.API;if(t.pyproxyToStringRepr&&n.setPyProxyToStringMethod(!0),t.convertNullToNone&&n.setCompatNullToNone(!0),t.toJsLiteralMap&&n.setCompatToJsLiteralMap(!0),n.version!==x&&t.checkAPIVersion)throw new Error(`Pyodide version does not match: '${x}' <==> '${n.version}'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.`);e.locateFile=i=>{throw i.endsWith(".so")?new Error(`Failed to find dynamic library "${i}"`):new Error(`Unexpected call to locateFile("${i}")`)}}o(We,"configureAPI");function Me(e,t,n){let i=e.API,a;return t&&(a=i.restoreSnapshot(t)),i.finalizeBootstrap(a,n._snapshotDeserializer)}o(Me,"bootstrapPyodide");async function Be(e,t){let n=e._api;return n.sys.path.insert(0,""),n._pyodide.set_excepthook(),await n.packageIndexReady,n.initializeStreams(t.stdin,t.stdout,t.stderr),e}o(Be,"finalizeSetup");async function B(e={}){let t=await De(e),n=Le(t);await Te(t);let i=await Ce(t,n),a=await Ue(n);We(a,t);let r=Me(a,i,t);return await Be(r,t)}o(B,"loadPyodide");globalThis.loadPyodide=B;return ce($e);})();
|
|
4
4
|
try{Object.assign(exports,loadPyodide)}catch(_){}
|
|
5
5
|
globalThis.loadPyodide=loadPyodide.loadPyodide;
|
|
6
6
|
//# sourceMappingURL=pyodide.js.map
|