pyodide 0.23.0-alpha.1 → 0.23.0
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.html +34 -9
- package/ffi.d.ts +807 -0
- package/package.json +5 -7
- package/pyodide.asm.js +3 -3
- package/pyodide.asm.wasm +0 -0
- package/pyodide.d.ts +718 -279
- package/pyodide.js +1 -1
- package/pyodide.js.map +1 -1
- package/pyodide.mjs +1 -1
- package/pyodide.mjs.map +1 -1
- package/python_stdlib.zip +0 -0
- package/repodata.json +1 -1
- package/pyodide.asm.data +0 -0
- package/pyodide_py.tar +0 -0
package/console.html
CHANGED
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
href="https://cdn.jsdelivr.net/npm/jquery.terminal@2.35.2/css/jquery.terminal.min.css"
|
|
10
10
|
rel="stylesheet"
|
|
11
11
|
/>
|
|
12
|
-
<script src="./pyodide.js"></script>
|
|
13
12
|
<style>
|
|
14
13
|
.terminal {
|
|
15
14
|
--size: 1.5;
|
|
@@ -67,11 +66,31 @@
|
|
|
67
66
|
<div id="loading"></div>
|
|
68
67
|
<script>
|
|
69
68
|
"use strict";
|
|
69
|
+
|
|
70
70
|
function sleep(s) {
|
|
71
71
|
return new Promise((resolve) => setTimeout(resolve, s));
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
async function main() {
|
|
75
|
+
let indexURL = "./";
|
|
76
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
77
|
+
const buildParam = urlParams.get("build");
|
|
78
|
+
if (buildParam) {
|
|
79
|
+
if (["full", "debug", "pyc"].includes(buildParam)) {
|
|
80
|
+
indexURL = indexURL.replace(
|
|
81
|
+
"/full/",
|
|
82
|
+
"/" + urlParams.get("build") + "/",
|
|
83
|
+
);
|
|
84
|
+
} else {
|
|
85
|
+
console.warn(
|
|
86
|
+
'Invalid URL parameter: build="' +
|
|
87
|
+
buildParam +
|
|
88
|
+
'". Using default "full".',
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const { loadPyodide } = await import(indexURL + "pyodide.mjs");
|
|
93
|
+
|
|
75
94
|
let term;
|
|
76
95
|
globalThis.pyodide = await loadPyodide({
|
|
77
96
|
stdin: () => {
|
|
@@ -130,7 +149,8 @@
|
|
|
130
149
|
term.pause();
|
|
131
150
|
// multiline should be split (useful when pasting)
|
|
132
151
|
for (const c of command.split("\n")) {
|
|
133
|
-
|
|
152
|
+
const escaped = c.replaceAll(/\u00a0/g, " ");
|
|
153
|
+
let fut = pyconsole.push(escaped);
|
|
134
154
|
term.set_prompt(fut.syntax_check === "incomplete" ? ps2 : ps1);
|
|
135
155
|
switch (fut.syntax_check) {
|
|
136
156
|
case "syntax-error":
|
|
@@ -158,7 +178,7 @@
|
|
|
158
178
|
}),
|
|
159
179
|
);
|
|
160
180
|
}
|
|
161
|
-
if (pyodide.
|
|
181
|
+
if (value instanceof pyodide.ffi.PyProxy) {
|
|
162
182
|
value.destroy();
|
|
163
183
|
}
|
|
164
184
|
} catch (e) {
|
|
@@ -211,12 +231,17 @@
|
|
|
211
231
|
};
|
|
212
232
|
term.ready = Promise.resolve();
|
|
213
233
|
pyodide._api.on_fatal = async (e) => {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
234
|
+
if (e.name === "Exit") {
|
|
235
|
+
term.error(e);
|
|
236
|
+
term.error("Pyodide exited and can no longer be used.");
|
|
237
|
+
} else {
|
|
238
|
+
term.error(
|
|
239
|
+
"Pyodide has suffered a fatal error. Please report this to the Pyodide maintainers.",
|
|
240
|
+
);
|
|
241
|
+
term.error("The cause of the fatal error was:");
|
|
242
|
+
term.error(e);
|
|
243
|
+
term.error("Look in the browser console for more details.");
|
|
244
|
+
}
|
|
220
245
|
await term.ready;
|
|
221
246
|
term.pause();
|
|
222
247
|
await sleep(15);
|