@pyscript/core 0.6.35 → 0.6.36
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/dist/{codemirror-Bpb6Ey5f.js → codemirror-7hplgyVJ.js} +2 -2
- package/dist/{codemirror-Bpb6Ey5f.js.map → codemirror-7hplgyVJ.js.map} +1 -1
- package/dist/{codemirror_commands-SZdOE5nU.js → codemirror_commands-D39x9C5q.js} +2 -2
- package/dist/{codemirror_commands-SZdOE5nU.js.map → codemirror_commands-D39x9C5q.js.map} +1 -1
- package/dist/{codemirror_lang-python-CT4R7aU5.js → codemirror_lang-python-Q-yAwxyf.js} +2 -2
- package/dist/{codemirror_lang-python-CT4R7aU5.js.map → codemirror_lang-python-Q-yAwxyf.js.map} +1 -1
- package/dist/{codemirror_language-0XdDQPdy.js → codemirror_language-CCfjGGWm.js} +2 -2
- package/dist/{codemirror_language-0XdDQPdy.js.map → codemirror_language-CCfjGGWm.js.map} +1 -1
- package/dist/codemirror_view-Bw06hiJi.js +2 -0
- package/dist/codemirror_view-Bw06hiJi.js.map +1 -0
- package/dist/core-CY38q33K.js +4 -0
- package/dist/core-CY38q33K.js.map +1 -0
- package/dist/core.js +1 -1
- package/dist/{deprecations-manager-D2oeE--a.js → deprecations-manager-apTdS2vL.js} +2 -2
- package/dist/{deprecations-manager-D2oeE--a.js.map → deprecations-manager-apTdS2vL.js.map} +1 -1
- package/dist/{donkey-BrIehEwe.js → donkey-CEUHpyBi.js} +2 -2
- package/dist/{donkey-BrIehEwe.js.map → donkey-CEUHpyBi.js.map} +1 -1
- package/dist/{error-CGGNJnMJ.js → error-BnJRaZX6.js} +2 -2
- package/dist/{error-CGGNJnMJ.js.map → error-BnJRaZX6.js.map} +1 -1
- package/dist/{index-BI1TrUla.js → index-DNWf5Jlg.js} +2 -2
- package/dist/{index-BI1TrUla.js.map → index-DNWf5Jlg.js.map} +1 -1
- package/dist/{mpy-49r-ARjR.js → mpy-CcFbuP4l.js} +2 -2
- package/dist/{mpy-49r-ARjR.js.map → mpy-CcFbuP4l.js.map} +1 -1
- package/dist/{py-editor-Dil8sfoT.js → py-editor-B257doLW.js} +2 -2
- package/dist/{py-editor-Dil8sfoT.js.map → py-editor-B257doLW.js.map} +1 -1
- package/dist/py-game-COQWxJ4-.js +2 -0
- package/dist/py-game-COQWxJ4-.js.map +1 -0
- package/dist/{py-DZ9P39Fr.js → py-hOIacH0d.js} +2 -2
- package/dist/{py-DZ9P39Fr.js.map → py-hOIacH0d.js.map} +1 -1
- package/dist/{py-terminal-D4qhEdOa.js → py-terminal-flqGFKNk.js} +2 -2
- package/dist/{py-terminal-D4qhEdOa.js.map → py-terminal-flqGFKNk.js.map} +1 -1
- package/dist/toml-DiUM0_qs.js.map +1 -1
- package/dist/zip-DPXsOtR5.js.map +1 -1
- package/package.json +7 -7
- package/src/plugins/py-game.js +35 -4
- package/types/core.d.ts +1 -1
- package/dist/codemirror_view-ZQwfolI2.js +0 -2
- package/dist/codemirror_view-ZQwfolI2.js.map +0 -1
- package/dist/core-DlvYU3OZ.js +0 -4
- package/dist/core-DlvYU3OZ.js.map +0 -1
- package/dist/py-game-wZnH0cJT.js +0 -2
- package/dist/py-game-wZnH0cJT.js.map +0 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pyscript/core",
|
3
|
-
"version": "0.6.
|
3
|
+
"version": "0.6.36",
|
4
4
|
"type": "module",
|
5
5
|
"description": "PyScript",
|
6
6
|
"module": "./index.js",
|
@@ -66,7 +66,7 @@
|
|
66
66
|
"@webreflection/idb-map": "^0.3.2",
|
67
67
|
"add-promise-listener": "^0.1.3",
|
68
68
|
"basic-devtools": "^0.1.6",
|
69
|
-
"polyscript": "^0.16.
|
69
|
+
"polyscript": "^0.16.21",
|
70
70
|
"sabayon": "^0.6.6",
|
71
71
|
"sticky-module": "^0.1.1",
|
72
72
|
"to-json-callback": "^0.1.1",
|
@@ -77,9 +77,9 @@
|
|
77
77
|
"@codemirror/lang-python": "^6.1.7",
|
78
78
|
"@codemirror/language": "^6.10.8",
|
79
79
|
"@codemirror/state": "^6.5.2",
|
80
|
-
"@codemirror/view": "^6.36.
|
80
|
+
"@codemirror/view": "^6.36.4",
|
81
81
|
"@playwright/test": "1.45.3",
|
82
|
-
"@rollup/plugin-commonjs": "^28.0.
|
82
|
+
"@rollup/plugin-commonjs": "^28.0.3",
|
83
83
|
"@rollup/plugin-node-resolve": "^16.0.0",
|
84
84
|
"@rollup/plugin-terser": "^0.4.4",
|
85
85
|
"@webreflection/toml-j0.4": "^1.1.3",
|
@@ -90,14 +90,14 @@
|
|
90
90
|
"chokidar": "^4.0.3",
|
91
91
|
"codedent": "^0.1.2",
|
92
92
|
"codemirror": "^6.0.1",
|
93
|
-
"eslint": "^9.
|
93
|
+
"eslint": "^9.22.0",
|
94
94
|
"flatted": "^3.3.3",
|
95
|
-
"rollup": "^4.
|
95
|
+
"rollup": "^4.35.0",
|
96
96
|
"rollup-plugin-postcss": "^4.0.2",
|
97
97
|
"rollup-plugin-string": "^3.0.0",
|
98
98
|
"static-handler": "^0.5.3",
|
99
99
|
"string-width": "^7.2.0",
|
100
|
-
"typescript": "^5.
|
100
|
+
"typescript": "^5.8.2",
|
101
101
|
"xterm-readline": "^1.1.2"
|
102
102
|
},
|
103
103
|
"repository": {
|
package/src/plugins/py-game.js
CHANGED
@@ -1,9 +1,16 @@
|
|
1
|
-
import {
|
1
|
+
import {
|
2
|
+
dedent,
|
3
|
+
define,
|
4
|
+
createProgress,
|
5
|
+
loadProgress,
|
6
|
+
} from "polyscript/exports";
|
2
7
|
|
3
8
|
import { stdlib } from "../core.js";
|
4
9
|
import { configDetails } from "../config.js";
|
5
10
|
import { getText } from "../fetch.js";
|
6
11
|
|
12
|
+
const progress = createProgress("py-game");
|
13
|
+
|
7
14
|
let toBeWarned = true;
|
8
15
|
|
9
16
|
const hooks = {
|
@@ -13,10 +20,11 @@ const hooks = {
|
|
13
20
|
toBeWarned = false;
|
14
21
|
console.warn("⚠️ EXPERIMENTAL `py-game` FEATURE");
|
15
22
|
}
|
23
|
+
|
24
|
+
let config = {};
|
16
25
|
if (script.hasAttribute("config")) {
|
17
26
|
const value = script.getAttribute("config");
|
18
|
-
const { json, toml, text } = configDetails(value);
|
19
|
-
let config = {};
|
27
|
+
const { json, toml, text, url } = await configDetails(value);
|
20
28
|
if (json) config = JSON.parse(text);
|
21
29
|
else if (toml) {
|
22
30
|
const { parse } = await import(
|
@@ -31,6 +39,13 @@ const hooks = {
|
|
31
39
|
});
|
32
40
|
micropip.destroy();
|
33
41
|
}
|
42
|
+
await loadProgress(
|
43
|
+
"py-game",
|
44
|
+
progress,
|
45
|
+
wrap.interpreter,
|
46
|
+
config,
|
47
|
+
url || location.href,
|
48
|
+
);
|
34
49
|
}
|
35
50
|
|
36
51
|
wrap.interpreter.registerJsModule("_pyscript", {
|
@@ -54,7 +69,23 @@ const hooks = {
|
|
54
69
|
const target = script.getAttribute("target") || "canvas";
|
55
70
|
const canvas = document.getElementById(target);
|
56
71
|
wrap.interpreter.canvas.setCanvas2D(canvas);
|
57
|
-
|
72
|
+
|
73
|
+
// allow 3rd party to hook themselves right before
|
74
|
+
// the code gets executed
|
75
|
+
const event = new CustomEvent("py-game", {
|
76
|
+
bubbles: true,
|
77
|
+
cancelable: true,
|
78
|
+
detail: {
|
79
|
+
canvas,
|
80
|
+
code,
|
81
|
+
config,
|
82
|
+
wrap,
|
83
|
+
},
|
84
|
+
});
|
85
|
+
script.dispatchEvent(event);
|
86
|
+
// run only if the default was not prevented
|
87
|
+
if (!event.defaultPrevented)
|
88
|
+
await wrap.interpreter.runPythonAsync(code);
|
58
89
|
},
|
59
90
|
},
|
60
91
|
};
|
package/types/core.d.ts
CHANGED
@@ -63,5 +63,5 @@ declare const exportedHooks: {
|
|
63
63
|
};
|
64
64
|
};
|
65
65
|
declare const exportedConfig: {};
|
66
|
-
declare const exportedWhenDefined:
|
66
|
+
declare const exportedWhenDefined: (type: string) => Promise<object>;
|
67
67
|
export { codemirror, stdlib, optional, inputFailure, TYPES, relative_url, exportedPyWorker as PyWorker, exportedMPWorker as MPWorker, exportedHooks as hooks, exportedConfig as config, exportedWhenDefined as whenDefined };
|