pyodide 0.22.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 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
- let fut = pyconsole.push(c);
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.isPyProxy(value)) {
181
+ if (value instanceof pyodide.ffi.PyProxy) {
162
182
  value.destroy();
163
183
  }
164
184
  } catch (e) {