pyodide 0.28.0-alpha.3 → 0.28.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/ffi.d.ts +4 -1
- package/package.json +2 -2
- package/pyodide-lock.json +1 -1
- package/pyodide.asm.js +1 -1
- package/pyodide.asm.wasm +0 -0
- package/pyodide.d.ts +141 -40
- package/pyodide.js +3 -3
- package/pyodide.js.map +4 -4
- package/pyodide.mjs +3 -3
- package/pyodide.mjs.map +4 -4
- package/python_stdlib.zip +0 -0
package/pyodide.asm.wasm
CHANGED
|
Binary file
|
package/pyodide.d.ts
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
// Generated by dts-bundle-generator v8.1.2
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* The Pyodide version.
|
|
6
|
-
*
|
|
7
|
-
* The version here is a Python version, following :pep:`440`. This is different
|
|
8
|
-
* from the version in ``package.json`` which follows the node package manager
|
|
9
|
-
* version convention.
|
|
10
|
-
*/
|
|
11
|
-
export declare const version: string;
|
|
12
3
|
interface CanvasInterface {
|
|
13
4
|
setCanvas2D(canvas: HTMLCanvasElement): void;
|
|
14
5
|
getCanvas2D(): HTMLCanvasElement | undefined;
|
|
@@ -35,6 +26,9 @@ declare function setStderr(options?: {
|
|
|
35
26
|
write?: (buffer: Uint8Array) => number;
|
|
36
27
|
isatty?: boolean;
|
|
37
28
|
}): void;
|
|
29
|
+
/**
|
|
30
|
+
* @docgroup pyodide.ffi
|
|
31
|
+
*/
|
|
38
32
|
/** @deprecated Use `import type { TypedArray } from "pyodide/ffi"` instead */
|
|
39
33
|
export type TypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array;
|
|
40
34
|
type FSNode = {
|
|
@@ -44,7 +38,9 @@ type FSNode = {
|
|
|
44
38
|
mode: number;
|
|
45
39
|
};
|
|
46
40
|
type FSStream = {
|
|
47
|
-
tty?:
|
|
41
|
+
tty?: {
|
|
42
|
+
ops: object;
|
|
43
|
+
};
|
|
48
44
|
seekable?: boolean;
|
|
49
45
|
stream_ops: FSStreamOps;
|
|
50
46
|
node: FSNode;
|
|
@@ -87,6 +83,7 @@ interface FSType {
|
|
|
87
83
|
utime: (path: string, atime: number, mtime: number) => void;
|
|
88
84
|
rmdir: (path: string) => void;
|
|
89
85
|
mount: (type: any, opts: any, mountpoint: string) => any;
|
|
86
|
+
unmount: (mountpoint: string) => any;
|
|
90
87
|
write: (stream: FSStream, buffer: any, offset: number, length: number, position?: number) => number;
|
|
91
88
|
close: (stream: FSStream) => void;
|
|
92
89
|
ErrnoError: {
|
|
@@ -94,19 +91,88 @@ interface FSType {
|
|
|
94
91
|
};
|
|
95
92
|
registerDevice<T>(dev: number, ops: FSStreamOpsGen<T>): void;
|
|
96
93
|
syncfs(dir: boolean, oncomplete: (val: void) => void): void;
|
|
97
|
-
findObject(a: string, dontResolveLastLink?: boolean): any;
|
|
98
|
-
readFile(a: string): Uint8Array;
|
|
99
94
|
}
|
|
100
|
-
|
|
101
|
-
|
|
95
|
+
/**
|
|
96
|
+
* The lockfile platform info. The ``abi_version`` field is used to check if the
|
|
97
|
+
* lockfile is compatible with the interpreter. The remaining fields are
|
|
98
|
+
* informational.
|
|
99
|
+
*/
|
|
100
|
+
interface LockfileInfo {
|
|
101
|
+
/**
|
|
102
|
+
* Machine architecture. At present, only can be wasm32. Pyodide has no wasm64
|
|
103
|
+
* build.
|
|
104
|
+
*/
|
|
105
|
+
arch: "wasm32";
|
|
106
|
+
/**
|
|
107
|
+
* The ABI version is structured as ``yyyy_patch``. For the lockfile to be
|
|
108
|
+
* compatible with the current interpreter this field must match exactly with
|
|
109
|
+
* the ABI version of the interpreter.
|
|
110
|
+
*/
|
|
111
|
+
abi_version: string;
|
|
112
|
+
/**
|
|
113
|
+
* The Emscripten versions for instance, `emscripten_4_0_9`. Different
|
|
114
|
+
* Emscripten versions have different ABIs so if this changes ``abi_version``
|
|
115
|
+
* must also change.
|
|
116
|
+
*/
|
|
102
117
|
platform: string;
|
|
118
|
+
/**
|
|
119
|
+
* The Pyodide version the lockfile was made with. Informational only, has no
|
|
120
|
+
* compatibility implications. May be removed in the future.
|
|
121
|
+
*/
|
|
103
122
|
version: string;
|
|
123
|
+
/**
|
|
124
|
+
* The Python version this lock file was made with. If the minor version
|
|
125
|
+
* changes (e.g, 3.12 to 3.13) this changes the ABI and the ``abi_version``
|
|
126
|
+
* must change too. Patch versions do not imply a change to the
|
|
127
|
+
* ``abi_version``.
|
|
128
|
+
*/
|
|
104
129
|
python: string;
|
|
105
|
-
}
|
|
106
|
-
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* A package entry in the lock file.
|
|
133
|
+
*/
|
|
134
|
+
interface LockfilePackage {
|
|
135
|
+
/**
|
|
136
|
+
* The unnormalized name of the package.
|
|
137
|
+
*/
|
|
138
|
+
name: string;
|
|
139
|
+
version: string;
|
|
140
|
+
/**
|
|
141
|
+
* The file name or url of the package wheel. If it's relative, it will be
|
|
142
|
+
* resolved with respect to ``packageBaseUrl``. If there is no
|
|
143
|
+
* ``packageBaseUrl``, attempting to install a package with a relative
|
|
144
|
+
* ``file_name`` will fail.
|
|
145
|
+
*/
|
|
146
|
+
file_name: string;
|
|
147
|
+
package_type: PackageType;
|
|
148
|
+
/**
|
|
149
|
+
* The installation directory. Will be ``site`` except for certain system
|
|
150
|
+
* dynamic libraries that need to go on the global LD_LIBRARY_PATH.
|
|
151
|
+
*/
|
|
152
|
+
install_dir: "site" | "dynlib";
|
|
153
|
+
/**
|
|
154
|
+
* Integrity. Must be present unless ``checkIntegrity: false`` is passed to
|
|
155
|
+
* ``loadPyodide``.
|
|
156
|
+
*/
|
|
157
|
+
sha256: string;
|
|
158
|
+
/**
|
|
159
|
+
* The set of imports provided by this package as best we can tell. Used by
|
|
160
|
+
* :js:func:`pyodide.loadPackagesFromImports` to work out what packages to
|
|
161
|
+
* install.
|
|
162
|
+
*/
|
|
163
|
+
imports: string[];
|
|
164
|
+
/**
|
|
165
|
+
* The set of dependencies of this package.
|
|
166
|
+
*/
|
|
167
|
+
depends: string[];
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* The type of a package lockfile.
|
|
171
|
+
*/
|
|
172
|
+
interface Lockfile {
|
|
107
173
|
info: LockfileInfo;
|
|
108
|
-
packages: Record<string,
|
|
109
|
-
}
|
|
174
|
+
packages: Record<string, LockfilePackage>;
|
|
175
|
+
}
|
|
110
176
|
type PackageType = "package" | "cpython_module" | "shared_library" | "static_library";
|
|
111
177
|
interface PackageData {
|
|
112
178
|
name: string;
|
|
@@ -116,16 +182,6 @@ interface PackageData {
|
|
|
116
182
|
packageType: PackageType;
|
|
117
183
|
}
|
|
118
184
|
type LoadedPackages = Record<string, string>;
|
|
119
|
-
type InternalPackageData = {
|
|
120
|
-
name: string;
|
|
121
|
-
version: string;
|
|
122
|
-
file_name: string;
|
|
123
|
-
package_type: PackageType;
|
|
124
|
-
install_dir: string;
|
|
125
|
-
sha256: string;
|
|
126
|
-
imports: string[];
|
|
127
|
-
depends: string[];
|
|
128
|
-
};
|
|
129
185
|
/** @deprecated Use `import type { PyProxy } from "pyodide/ffi"` instead */
|
|
130
186
|
interface PyProxy {
|
|
131
187
|
[x: string]: any;
|
|
@@ -159,7 +215,7 @@ declare class PyProxy {
|
|
|
159
215
|
get type(): string;
|
|
160
216
|
/**
|
|
161
217
|
* Returns `str(o)` (unless `pyproxyToStringRepr: true` was passed to
|
|
162
|
-
* :js:func:`~
|
|
218
|
+
* :js:func:`~exports.loadPyodide` in which case it will return `repr(o)`)
|
|
163
219
|
*/
|
|
164
220
|
toString(): string;
|
|
165
221
|
/**
|
|
@@ -1094,7 +1150,7 @@ declare class PythonError extends Error {
|
|
|
1094
1150
|
type NativeFS = {
|
|
1095
1151
|
syncfs: () => Promise<void>;
|
|
1096
1152
|
};
|
|
1097
|
-
declare class
|
|
1153
|
+
declare class PyodideAPI_ {
|
|
1098
1154
|
/** @hidden */
|
|
1099
1155
|
static version: string;
|
|
1100
1156
|
/** @hidden */
|
|
@@ -1472,9 +1528,7 @@ declare class PyodideAPI {
|
|
|
1472
1528
|
*/
|
|
1473
1529
|
static setDebug(debug: boolean): boolean;
|
|
1474
1530
|
/**
|
|
1475
|
-
*
|
|
1476
|
-
* @param param0
|
|
1477
|
-
* @returns
|
|
1531
|
+
* @private
|
|
1478
1532
|
*/
|
|
1479
1533
|
static makeMemorySnapshot({ serializer, }?: {
|
|
1480
1534
|
serializer?: (obj: any) => any;
|
|
@@ -1485,9 +1539,27 @@ declare class PyodideAPI {
|
|
|
1485
1539
|
* <https://github.com/pyodide/pyodide-lock>`_ repository.
|
|
1486
1540
|
*/
|
|
1487
1541
|
static get lockfile(): Lockfile;
|
|
1542
|
+
/**
|
|
1543
|
+
* Returns the URL or path with respect to which relative paths in the lock
|
|
1544
|
+
* file are resolved, or undefined.
|
|
1545
|
+
*/
|
|
1546
|
+
static get lockfileBaseUrl(): string | undefined;
|
|
1488
1547
|
}
|
|
1489
|
-
/**
|
|
1490
|
-
|
|
1548
|
+
/**
|
|
1549
|
+
* The return type of :js:func:`~exports.loadPyodide`. See
|
|
1550
|
+
* :ref:`the pyodide api docs <js-api-pyodide>` for more information.
|
|
1551
|
+
* @hidetype
|
|
1552
|
+
* @docgroup exports
|
|
1553
|
+
*/
|
|
1554
|
+
export type PyodideAPI = typeof PyodideAPI_;
|
|
1555
|
+
/**
|
|
1556
|
+
* The Pyodide version.
|
|
1557
|
+
*
|
|
1558
|
+
* The version here is a Python version, following :pep:`440`. This is different
|
|
1559
|
+
* from the version in ``package.json`` which follows the node package manager
|
|
1560
|
+
* version convention.
|
|
1561
|
+
*/
|
|
1562
|
+
export declare const version: string;
|
|
1491
1563
|
/**
|
|
1492
1564
|
* See documentation for loadPyodide.
|
|
1493
1565
|
* @hidden
|
|
@@ -1495,7 +1567,7 @@ export type PyodideInterface = typeof PyodideAPI;
|
|
|
1495
1567
|
type ConfigType = {
|
|
1496
1568
|
indexURL: string;
|
|
1497
1569
|
packageCacheDir: string;
|
|
1498
|
-
|
|
1570
|
+
lockFileContents: Lockfile | string | Promise<Lockfile | string>;
|
|
1499
1571
|
fullStdLib?: boolean;
|
|
1500
1572
|
stdLibURL?: string;
|
|
1501
1573
|
stdin?: () => string;
|
|
@@ -1515,6 +1587,8 @@ type ConfigType = {
|
|
|
1515
1587
|
enableRunUntilComplete: boolean;
|
|
1516
1588
|
checkAPIVersion: boolean;
|
|
1517
1589
|
BUILD_ID: string;
|
|
1590
|
+
packageBaseUrl?: string;
|
|
1591
|
+
cdnUrl: string;
|
|
1518
1592
|
};
|
|
1519
1593
|
/**
|
|
1520
1594
|
* Load the main Pyodide wasm module and initialize it.
|
|
@@ -1555,6 +1629,26 @@ export declare function loadPyodide(options?: {
|
|
|
1555
1629
|
* Default: ```${indexURL}/pyodide-lock.json```
|
|
1556
1630
|
*/
|
|
1557
1631
|
lockFileURL?: string;
|
|
1632
|
+
/**
|
|
1633
|
+
* The contents of a lockfile. If a string, it should be valid json and
|
|
1634
|
+
* ``JSON.parse()`` should return a ``Lockfile`` instance. See
|
|
1635
|
+
* :js:interface:`~pyodide.Lockfile` for the schema.
|
|
1636
|
+
*/
|
|
1637
|
+
lockFileContents?: Lockfile | string | Promise<Lockfile | string>;
|
|
1638
|
+
/**
|
|
1639
|
+
* The base url relative to which a relative value of
|
|
1640
|
+
* :js:attr:`~pyodide.LockfilePackage.file_name` is interpreted. If
|
|
1641
|
+
* ``lockfileContents`` is provided, then ``lockFileContents`` must be
|
|
1642
|
+
* provided explicitly in order to install packages with relative paths.
|
|
1643
|
+
*
|
|
1644
|
+
* Otherwise, the default is calculated as follows:
|
|
1645
|
+
*
|
|
1646
|
+
* 1. If `lockFileURL` contains a ``/``, the default is everything before the last
|
|
1647
|
+
* ``/`` in ``lockFileURL``.
|
|
1648
|
+
* 2. If in the browser, the default is ``location.toString()``.
|
|
1649
|
+
* 3. Otherwise, the default is `'.'`.
|
|
1650
|
+
*/
|
|
1651
|
+
packageBaseUrl?: string;
|
|
1558
1652
|
/**
|
|
1559
1653
|
* Load the full Python standard library. Setting this to false excludes
|
|
1560
1654
|
* unvendored modules from the standard library.
|
|
@@ -1631,12 +1725,13 @@ export declare function loadPyodide(options?: {
|
|
|
1631
1725
|
packages?: string[];
|
|
1632
1726
|
/**
|
|
1633
1727
|
* Opt into the old behavior where :js:func:`PyProxy.toString() <pyodide.ffi.PyProxy.toString>`
|
|
1634
|
-
* calls :py:func:`repr` and not :py:class:`str() <str>`.
|
|
1728
|
+
* calls :py:func:`repr` and not :py:class:`str() <str>`. Deprecated.
|
|
1635
1729
|
* @deprecated
|
|
1636
1730
|
*/
|
|
1637
1731
|
pyproxyToStringRepr?: boolean;
|
|
1638
1732
|
/**
|
|
1639
|
-
* Make loop.run_until_complete() function correctly using stack switching
|
|
1733
|
+
* Make loop.run_until_complete() function correctly using stack switching.
|
|
1734
|
+
* Default: ``true``.
|
|
1640
1735
|
*/
|
|
1641
1736
|
enableRunUntilComplete?: boolean;
|
|
1642
1737
|
/**
|
|
@@ -1653,13 +1748,19 @@ export declare function loadPyodide(options?: {
|
|
|
1653
1748
|
fsInit?: (FS: FSType, info: {
|
|
1654
1749
|
sitePackages: string;
|
|
1655
1750
|
}) => Promise<void>;
|
|
1751
|
+
/**
|
|
1752
|
+
* Opt into the old behavior where JavaScript `null` is converted to `None`
|
|
1753
|
+
* instead of `jsnull`. Deprecated.
|
|
1754
|
+
* @deprecated
|
|
1755
|
+
*/
|
|
1756
|
+
convertNullToNone?: boolean;
|
|
1656
1757
|
/** @ignore */
|
|
1657
1758
|
_makeSnapshot?: boolean;
|
|
1658
1759
|
/** @ignore */
|
|
1659
1760
|
_loadSnapshot?: Uint8Array | ArrayBuffer | PromiseLike<Uint8Array | ArrayBuffer>;
|
|
1660
1761
|
/** @ignore */
|
|
1661
1762
|
_snapshotDeserializer?: (obj: any) => any;
|
|
1662
|
-
}): Promise<
|
|
1763
|
+
}): Promise<PyodideAPI>;
|
|
1663
1764
|
|
|
1664
1765
|
export type {};
|
|
1665
|
-
export type {PackageData};
|
|
1766
|
+
export type {Lockfile, LockfileInfo, LockfilePackage, PackageData};
|
package/pyodide.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var loadPyodide=(()=>{var
|
|
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
|
|
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 D({functionName:n});var a=/((.*".+"[^@]*)?[^@]*)(?:@)/,c=n.match(a),l=c&&c[1]?c[1]:void 0,d=this.extractLocation(n.replace(a,""));return new D({functionName:l,fileName:d[0],lineNumber:d[1],columnNumber:d[2],source:n})},this)},"ErrorStackParser$$parseFFOrSafari")}}o(me,"ErrorStackParser");var pe=new me;var H=pe;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 f<"u"&&typeof __dirname<"u",V=y&&!U,Ce=typeof globalThis.Bun<"u",ge=typeof Deno<"u",z=!y&&!ge,q=z&&typeof window=="object"&&typeof document=="object"&&typeof document.createElement=="function"&&"sessionStorage"in window&&typeof importScripts!="function",J=z&&typeof importScripts=="function"&&typeof self=="object",Me=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 K,C,G,Y,M;async function W(){if(!y||(K=(await import(/* webpackIgnore */"node:url")).default,Y=await import(/* webpackIgnore */"node:fs"),M=await import(/* webpackIgnore */"node:fs/promises"),G=(await import(/* webpackIgnore */"node:vm")).default,C=await import(/* webpackIgnore */"node:path"),B=C.sep,typeof f<"u"))return;let e=Y,t=await import(/* webpackIgnore */"node:crypto"),r=await import(/* webpackIgnore */"ws"),i=await import(/* webpackIgnore */"node:child_process"),s={fs:e,crypto:t,ws:r,child_process:i};globalThis.require=function(n){return s[n]}}o(W,"initNodeModules");function ye(e,t){return C.resolve(t||".",e)}o(ye,"node_resolvePath");function be(e,t){return t===void 0&&(t=location),new URL(e,t).toString()}o(be,"browser_resolvePath");var A;y?A=ye:R?A=o(e=>e,"resolvePath"):A=be;var B;y||(B="/");function ve(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(ve,"node_getBinaryResponse");function he(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(he,"shell_getBinaryResponse");function Se(e,t){let r=new URL(e,location);return{response:fetch(r,t?{integrity:t}:{})}}o(Se,"browser_getBinaryResponse");var _;y?_=ve:R?_=he:_=Se;async function X(e,t){let{response:r,binary:i}=_(e,t);if(i)return i;let s=await r;if(!s.ok)throw new Error(`Failed to load '${e}': request failed.`);return new Uint8Array(await s.arrayBuffer())}o(X,"loadBinaryFile");var x;if(q)x=o(async e=>await import(/* webpackIgnore */e),"loadScript");else if(J)x=o(async e=>{try{globalThis.importScripts(e)}catch(t){if(t instanceof TypeError)await import(/* webpackIgnore */e);else throw t}},"loadScript");else if(y)x=we;else if(R)x=load;else throw new Error("Cannot determine runtime environment");async function we(e){e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?G.runInThisContext(await(await fetch(e)).text()):await import(/* webpackIgnore */K.pathToFileURL(e).href)}o(we,"nodeLoadScript");async function Q(e){if(y){await W();let t=await M.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(Q,"loadLockFile");async function Z(){if(U)return __dirname;let e;try{throw new Error}catch(i){e=i}let t=H.parse(e)[0].fileName;if(y&&!t.startsWith("file://")&&(t=`file://${t}`),V){let i=await import(/* webpackIgnore */"node:path");return(await import(/* webpackIgnore */"node:url")).fileURLToPath(i.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(Z,"calculateDirname");function ee(e){let t=e.FS,r=e.FS.filesystems.MEMFS,i=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,a,c)=>{try{let l=s.getLocalSet(n),d=await s.getRemoteSet(n),u=a?d:l,g=a?l:d;await s.reconcile(n,u,g),c(null)}catch(l){c(l)}},"syncfs"),getLocalSet:o(n=>{let a=Object.create(null);function c(u){return u!=="."&&u!==".."}o(c,"isRealDir");function l(u){return g=>i.join2(u,g)}o(l,"toAbsolute");let d=t.readdir(n.mountpoint).filter(c).map(l(n.mountpoint));for(;d.length;){let u=d.pop(),g=t.stat(u);t.isDir(g.mode)&&d.push.apply(d,t.readdir(u).filter(c).map(l(u))),a[u]={timestamp:g.mtime,mode:g.mode}}return{type:"local",entries:a}},"getLocalSet"),getRemoteSet:o(async n=>{let a=Object.create(null),c=await Ee(n.opts.fileSystemHandle);for(let[l,d]of c)l!=="."&&(a[i.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:a,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,a)=>{if(t.isDir(a.mode))t.mkdirTree(n,a.mode);else if(t.isFile(a.mode))t.writeFile(n,a.contents,{canOwn:!0});else throw new Error("node type not supported");t.chmod(n,a.mode),t.utime(n,a.timestamp,a.timestamp)},"storeLocalEntry"),removeLocalEntry:o(n=>{var a=t.stat(n);t.isDir(a.mode)?t.rmdir(n):t.isFile(a.mode)&&t.unlink(n)},"removeLocalEntry"),loadRemoteEntry:o(async n=>{if(n.kind==="file"){let a=await n.getFile();return{contents:new Uint8Array(await a.arrayBuffer()),mode:s.FILE_MODE,timestamp:new Date(a.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,a,c)=>{let l=n.get(i.dirname(a)),d=t.isFile(c.mode)?await l.getFileHandle(i.basename(a),{create:!0}):await l.getDirectoryHandle(i.basename(a),{create:!0});if(d.kind==="file"){let u=await d.createWritable();await u.write(c.contents),await u.close()}n.set(a,d)},"storeRemoteEntry"),removeRemoteEntry:o(async(n,a)=>{await n.get(i.dirname(a)).removeEntry(i.basename(a)),n.delete(a)},"removeRemoteEntry"),reconcile:o(async(n,a,c)=>{let l=0,d=[];Object.keys(a.entries).forEach(function(m){let v=a.entries[m],P=c.entries[m];(!P||t.isFile(v.mode)&&v.timestamp.getTime()>P.timestamp.getTime())&&(d.push(m),l++)}),d.sort();let u=[];if(Object.keys(c.entries).forEach(function(m){a.entries[m]||(u.push(m),l++)}),u.sort().reverse(),!l)return;let g=a.type==="remote"?a.handles:c.handles;for(let m of d){let v=i.normalize(m.replace(n.mountpoint,"/")).substring(1);if(c.type==="local"){let P=g.get(v),ne=await s.loadRemoteEntry(P);s.storeLocalEntry(m,ne)}else{let P=s.loadLocalEntry(m);await s.storeRemoteEntry(g,v,P)}}for(let m of u)if(c.type==="local")s.removeLocalEntry(m);else{let v=i.normalize(m.replace(n.mountpoint,"/")).substring(1);await s.removeRemoteEntry(g,v)}},"reconcile")};e.FS.filesystems.NATIVEFS_ASYNC=s}o(ee,"initializeNativeFS");var Ee=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 i=new Map;i.set(".",e);for(let s of t){let n=(await e.resolve(s)).join("/");i.set(n,s)}return i},"getFsHandles");function te(e){let t={noImageDecoding:!0,noAudioDecoding:!0,noWasmDecoding:!1,preRun:_e(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:ke(e.indexURL)};return t}o(te,"createSettings");function Pe(e){return function(t){let r="/";try{t.FS.mkdirTree(e)}catch(i){console.error(`Error occurred while making a home directory '${e}':`),console.error(i),console.error(`Using '${r}' for a home directory instead`),e=r}t.FS.chdir(e)}}o(Pe,"createHomeDirectory");function Ne(e){return function(t){Object.assign(t.ENV,e)}}o(Ne,"setEnvironment");function Fe(e){return e?[async t=>{t.addRunDependency("fsInitHook");try{await e(t.FS,{sitePackages:t.API.sitePackages})}finally{t.removeRunDependency("fsInitHook")}}]:[]}o(Fe,"callFsInitHook");function Ie(e){let t=e.HEAPU32[e._Py_Version>>>2],r=t>>>24&255,i=t>>>16&255,s=t>>>8&255;return[r,i,s]}o(Ie,"computeVersionTuple");function xe(e){let t=X(e);return async r=>{r.API.pyVersionTuple=Ie(r);let[i,s]=r.API.pyVersionTuple;r.FS.mkdirTree("/lib"),r.API.sitePackages=`/lib/python${i}.${s}/site-packages`,r.FS.mkdirTree(r.API.sitePackages),r.addRunDependency("install-stdlib");try{let n=await t;r.FS.writeFile(`/lib/python${i}${s}.zip`,n)}catch(n){console.error("Error occurred while installing the standard library:"),console.error(n)}finally{r.removeRunDependency("install-stdlib")}}}o(xe,"installStdlib");function _e(e){let t;return e.stdLibURL!=null?t=e.stdLibURL:t=e.indexURL+"python_stdlib.zip",[xe(t),Pe(e.env.HOME),Ne(e.env),ee,...Fe(e.fsInit)]}o(_e,"getFileSystemInitializationFuncs");function ke(e){if(typeof WasmOffsetConverter<"u")return;let{binary:t,response:r}=_(e+"pyodide.asm.wasm");return function(i,s){return async function(){try{let n;r?n=await WebAssembly.instantiateStreaming(r,i):n=await WebAssembly.instantiate(await t,i);let{instance:a,module:c}=n;s(a,c)}catch(n){console.warn("wasm instantiation failed!"),console.warn(n)}}(),{}}}o(ke,"getInstantiateWasmFunc");var O="0.28.0a3";async function $(e={}){await W();let t=e.indexURL||await Z();t=A(t),t.endsWith("/")||(t+="/"),e.indexURL=t;let r={fullStdLib:!1,jsglobals:globalThis,stdin:globalThis.prompt?globalThis.prompt:void 0,lockFileURL:t+"pyodide-lock.json",args:[],env:{},packageCacheDir:t,packages:[],enableRunUntilComplete:!1,checkAPIVersion:!0,BUILD_ID:"db051977a6193ca15a86fbe914aa4eae8a52219915f5c5d8a6be4afbc5c5391e"},i=Object.assign(r,e);i.env.HOME??="/home/pyodide",i.env.PYTHONINSPECT??="1";let s=te(i),n=s.API;if(n.lockFilePromise=Q(i.lockFileURL),typeof _createPyodideModule!="function"){let u=`${i.indexURL}pyodide.asm.js`;await x(u)}let a;if(e._loadSnapshot){let u=await e._loadSnapshot;ArrayBuffer.isView(u)?a=u:a=new Uint8Array(u),s.noInitialRun=!0,s.INITIAL_MEMORY=a.length}let c=await _createPyodideModule(s);if(s.exitCode!==void 0)throw new c.ExitStatus(s.exitCode);if(e.pyproxyToStringRepr&&n.setPyProxyToStringMethod(!0),n.version!==O&&i.checkAPIVersion)throw new Error(`Pyodide version does not match: '${O}' <==> '${n.version}'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.`);c.locateFile=u=>{throw new Error("Didn't expect to load any more file_packager files!")};let l;a&&(l=n.restoreSnapshot(a));let d=n.finalizeBootstrap(l,e._snapshotDeserializer);return n.sys.path.insert(0,""),d.version.includes("dev")||n.setCdnUrl(`https://cdn.jsdelivr.net/pyodide/v${d.version}/full/`),n._pyodide.set_excepthook(),await n.packageIndexReady,n.initializeStreams(i.stdin,i.stdout,i.stderr),d}o($,"loadPyodide");globalThis.loadPyodide=$;return le(Re);})();
|
|
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);})();
|
|
4
4
|
try{Object.assign(exports,loadPyodide)}catch(_){}
|
|
5
5
|
globalThis.loadPyodide=loadPyodide.loadPyodide;
|
|
6
6
|
//# sourceMappingURL=pyodide.js.map
|