mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-19 18:27:29 -05:00
committed by
GitHub
parent
b528ba67a9
commit
eaa6711756
54
core/package-lock.json
generated
54
core/package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@pyscript/core",
|
"name": "@pyscript/core",
|
||||||
"version": "0.6.64",
|
"version": "0.6.65",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@pyscript/core",
|
"name": "@pyscript/core",
|
||||||
"version": "0.6.64",
|
"version": "0.6.65",
|
||||||
"license": "APACHE-2.0",
|
"license": "APACHE-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ungap/with-resolvers": "^0.1.0",
|
"@ungap/with-resolvers": "^0.1.0",
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
"@webreflection/utils": "^0.1.1",
|
"@webreflection/utils": "^0.1.1",
|
||||||
"add-promise-listener": "^0.1.3",
|
"add-promise-listener": "^0.1.3",
|
||||||
"basic-devtools": "^0.1.6",
|
"basic-devtools": "^0.1.6",
|
||||||
"polyscript": "^0.18.1",
|
"polyscript": "^0.18.3",
|
||||||
"sticky-module": "^0.1.1",
|
"sticky-module": "^0.1.1",
|
||||||
"to-json-callback": "^0.1.1",
|
"to-json-callback": "^0.1.1",
|
||||||
"type-checked-collections": "^0.1.7"
|
"type-checked-collections": "^0.1.7"
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
"@codemirror/language": "^6.11.2",
|
"@codemirror/language": "^6.11.2",
|
||||||
"@codemirror/state": "^6.5.2",
|
"@codemirror/state": "^6.5.2",
|
||||||
"@codemirror/view": "^6.38.0",
|
"@codemirror/view": "^6.38.0",
|
||||||
"@playwright/test": "^1.53.2",
|
"@playwright/test": "^1.54.0",
|
||||||
"@rollup/plugin-commonjs": "^28.0.6",
|
"@rollup/plugin-commonjs": "^28.0.6",
|
||||||
"@rollup/plugin-node-resolve": "^16.0.1",
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
||||||
"@rollup/plugin-terser": "^0.4.4",
|
"@rollup/plugin-terser": "^0.4.4",
|
||||||
@@ -624,13 +624,13 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@playwright/test": {
|
"node_modules/@playwright/test": {
|
||||||
"version": "1.53.2",
|
"version": "1.54.0",
|
||||||
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.53.2.tgz",
|
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.54.0.tgz",
|
||||||
"integrity": "sha512-tEB2U5z74ebBeyfGNZ3Jfg29AnW+5HlWhvHtb/Mqco9pFdZU1ZLNdVb2UtB5CvmiilNr2ZfVH/qMmAROG/XTzw==",
|
"integrity": "sha512-6Mnd5daQmLivaLu5kxUg6FxPtXY4sXsS5SUwKjWNy4ISe4pKraNHoFxcsaTFiNUULbjy0Vlb5HT86QuM0Jy1pQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"playwright": "1.53.2"
|
"playwright": "1.54.0"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"playwright": "cli.js"
|
"playwright": "cli.js"
|
||||||
@@ -1397,14 +1397,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/coincident": {
|
"node_modules/coincident": {
|
||||||
"version": "4.0.19",
|
"version": "4.0.21",
|
||||||
"resolved": "https://registry.npmjs.org/coincident/-/coincident-4.0.19.tgz",
|
"resolved": "https://registry.npmjs.org/coincident/-/coincident-4.0.21.tgz",
|
||||||
"integrity": "sha512-4AepKY1917fgARiwz+tg3Q8Jd2ZCZ+6uw5+20AqdfRIAuntNCwcQw/hM6I0/egqgQZ+uiHDbhkWpYiJ5epd+RQ==",
|
"integrity": "sha512-pT0MbJ2fhOEGEAlG0wVctaueisWW5zk3WA4vK+yQMDB8ZtJQUlHsMWtWTwmVAFavKt5sQfhO7eF4kLKNdn3erA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@webreflection/utils": "^0.1.1",
|
"@webreflection/utils": "^0.1.1",
|
||||||
"next-resolver": "^0.1.4",
|
"next-resolver": "^0.1.4",
|
||||||
"reflected-ffi": "^0.5.7"
|
"reflected-ffi": "^0.5.9"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"coincident": "cli.cjs"
|
"coincident": "cli.cjs"
|
||||||
@@ -2719,13 +2719,13 @@
|
|||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
"node_modules/playwright": {
|
"node_modules/playwright": {
|
||||||
"version": "1.53.2",
|
"version": "1.54.0",
|
||||||
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.53.2.tgz",
|
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.54.0.tgz",
|
||||||
"integrity": "sha512-6K/qQxVFuVQhRQhFsVZ9fGeatxirtrpPgxzBYWyZLEXJzqYwuL4fuNmfOfD5et1tJE4GScKyPNeLhZeRwuTU3A==",
|
"integrity": "sha512-y9yzHmXRwEUOpghM7XGcA38GjWuTOUMaTIcm/5rHcYVjh5MSp9qQMRRMc/+p1cx+csoPnX4wkxAF61v5VKirxg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"playwright-core": "1.53.2"
|
"playwright-core": "1.54.0"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"playwright": "cli.js"
|
"playwright": "cli.js"
|
||||||
@@ -2738,9 +2738,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/playwright-core": {
|
"node_modules/playwright-core": {
|
||||||
"version": "1.53.2",
|
"version": "1.54.0",
|
||||||
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.53.2.tgz",
|
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.54.0.tgz",
|
||||||
"integrity": "sha512-ox/OytMy+2w1jcYEYlOo1Hhp8hZkLCximMTUTMBXjGUA1KoFfiSZ+DU+3a739jsPY0yoKH2TFy9S2fsJas8yAw==",
|
"integrity": "sha512-uiWpWaJh3R3etpJ0QrpligEMl62Dk1iSAB6NUXylvmQz+e3eipXHDHvOvydDAssb5Oqo0E818qdn0L9GcJSTyA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"bin": {
|
"bin": {
|
||||||
@@ -2751,9 +2751,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/polyscript": {
|
"node_modules/polyscript": {
|
||||||
"version": "0.18.1",
|
"version": "0.18.3",
|
||||||
"resolved": "https://registry.npmjs.org/polyscript/-/polyscript-0.18.1.tgz",
|
"resolved": "https://registry.npmjs.org/polyscript/-/polyscript-0.18.3.tgz",
|
||||||
"integrity": "sha512-eOO8dYqNPk6lrnw0nFZnTh81k+dbcZ/2qsrbn3xX2m3+RSDrCksav9YX9WlZtqTGOeIoMM1133QGrAnS4fnUZA==",
|
"integrity": "sha512-0iB4AmSbTZh2cJZSzP7EkeNa0Im6tVUN6+3eBUtrkMzL1vtcpSrtIVEs0X1fZ5xWHdmczafHx5PPoMe1zSXE9g==",
|
||||||
"license": "APACHE-2.0",
|
"license": "APACHE-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@webreflection/fetch": "^0.1.5",
|
"@webreflection/fetch": "^0.1.5",
|
||||||
@@ -2761,9 +2761,9 @@
|
|||||||
"@webreflection/utils": "^0.1.1",
|
"@webreflection/utils": "^0.1.1",
|
||||||
"basic-devtools": "^0.1.6",
|
"basic-devtools": "^0.1.6",
|
||||||
"codedent": "^0.1.2",
|
"codedent": "^0.1.2",
|
||||||
"coincident": "^4.0.19",
|
"coincident": "^4.0.21",
|
||||||
"html-escaper": "^3.0.3",
|
"html-escaper": "^3.0.3",
|
||||||
"reflected-ffi": "^0.5.7",
|
"reflected-ffi": "^0.5.8",
|
||||||
"sticky-module": "^0.1.1",
|
"sticky-module": "^0.1.1",
|
||||||
"to-json-callback": "^0.1.1"
|
"to-json-callback": "^0.1.1"
|
||||||
}
|
}
|
||||||
@@ -3447,9 +3447,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/reflected-ffi": {
|
"node_modules/reflected-ffi": {
|
||||||
"version": "0.5.7",
|
"version": "0.5.9",
|
||||||
"resolved": "https://registry.npmjs.org/reflected-ffi/-/reflected-ffi-0.5.7.tgz",
|
"resolved": "https://registry.npmjs.org/reflected-ffi/-/reflected-ffi-0.5.9.tgz",
|
||||||
"integrity": "sha512-U4GiS/JVK7WUla4QseKfhsS2nQBAtL3ehmtM0W0Ffj1kzD0XboqdxclN3ufWRz/wPQ9Cp0ivVWwdrdl5yQqzgA==",
|
"integrity": "sha512-0BH/0dbg7GsZQH7rdY/Fw3pz/FHhX2JsH4kw5hTMVKj6CQRzjH1WrYXRKJ0mkI1z84Iu5SDCfO6b8X+cDw3KaA==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/resolve": {
|
"node_modules/resolve": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pyscript/core",
|
"name": "@pyscript/core",
|
||||||
"version": "0.6.64",
|
"version": "0.6.65",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"description": "PyScript",
|
"description": "PyScript",
|
||||||
"module": "./index.js",
|
"module": "./index.js",
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
"@webreflection/utils": "^0.1.1",
|
"@webreflection/utils": "^0.1.1",
|
||||||
"add-promise-listener": "^0.1.3",
|
"add-promise-listener": "^0.1.3",
|
||||||
"basic-devtools": "^0.1.6",
|
"basic-devtools": "^0.1.6",
|
||||||
"polyscript": "^0.18.1",
|
"polyscript": "^0.18.3",
|
||||||
"sticky-module": "^0.1.1",
|
"sticky-module": "^0.1.1",
|
||||||
"to-json-callback": "^0.1.1",
|
"to-json-callback": "^0.1.1",
|
||||||
"type-checked-collections": "^0.1.7"
|
"type-checked-collections": "^0.1.7"
|
||||||
@@ -81,7 +81,7 @@
|
|||||||
"@codemirror/language": "^6.11.2",
|
"@codemirror/language": "^6.11.2",
|
||||||
"@codemirror/state": "^6.5.2",
|
"@codemirror/state": "^6.5.2",
|
||||||
"@codemirror/view": "^6.38.0",
|
"@codemirror/view": "^6.38.0",
|
||||||
"@playwright/test": "^1.53.2",
|
"@playwright/test": "^1.54.0",
|
||||||
"@rollup/plugin-commonjs": "^28.0.6",
|
"@rollup/plugin-commonjs": "^28.0.6",
|
||||||
"@rollup/plugin-node-resolve": "^16.0.1",
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
||||||
"@rollup/plugin-terser": "^0.4.4",
|
"@rollup/plugin-terser": "^0.4.4",
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ const getRelatedScript = (target, type) => {
|
|||||||
return editor?.parentNode?.previousElementSibling;
|
return editor?.parentNode?.previousElementSibling;
|
||||||
};
|
};
|
||||||
|
|
||||||
async function execute({ currentTarget }) {
|
async function execute({ currentTarget, script }) {
|
||||||
const { env, pySrc, outDiv } = this;
|
const { env, pySrc, outDiv } = this;
|
||||||
const hasRunButton = !!currentTarget;
|
const hasRunButton = !!currentTarget;
|
||||||
|
|
||||||
@@ -91,14 +91,13 @@ async function execute({ currentTarget }) {
|
|||||||
// creation and destruction of editors on the fly
|
// creation and destruction of editors on the fly
|
||||||
if (hasRunButton) {
|
if (hasRunButton) {
|
||||||
for (const type of TYPES.keys()) {
|
for (const type of TYPES.keys()) {
|
||||||
const script = getRelatedScript(currentTarget, type);
|
script = getRelatedScript(currentTarget, type);
|
||||||
if (script) {
|
if (script) break;
|
||||||
defineProperties(script, { xworker: { value: xworker } });
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defineProperties(script, { xworker: { value: xworker } });
|
||||||
|
|
||||||
const { sync } = xworker;
|
const { sync } = xworker;
|
||||||
const { promise, resolve } = withResolvers();
|
const { promise, resolve } = withResolvers();
|
||||||
envs.set(env, promise);
|
envs.set(env, promise);
|
||||||
@@ -157,6 +156,20 @@ async function execute({ currentTarget }) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const replaceScript = (script, type) => {
|
||||||
|
script.xworker?.terminate();
|
||||||
|
const clone = script.cloneNode(true);
|
||||||
|
clone.type = `${type}-editor`;
|
||||||
|
const editor = editors.get(script);
|
||||||
|
if (editor) {
|
||||||
|
const content = editor.state.doc.toString();
|
||||||
|
clone.textContent = content;
|
||||||
|
editors.delete(script);
|
||||||
|
script.nextElementSibling.remove();
|
||||||
|
}
|
||||||
|
script.replaceWith(clone);
|
||||||
|
};
|
||||||
|
|
||||||
const makeRunButton = (handler, type) => {
|
const makeRunButton = (handler, type) => {
|
||||||
const runButton = document.createElement("button");
|
const runButton = document.createElement("button");
|
||||||
runButton.className = `absolute ${type}-editor-run-button`;
|
runButton.className = `absolute ${type}-editor-run-button`;
|
||||||
@@ -169,15 +182,25 @@ const makeRunButton = (handler, type) => {
|
|||||||
) {
|
) {
|
||||||
const script = getRelatedScript(runButton, type);
|
const script = getRelatedScript(runButton, type);
|
||||||
if (script) {
|
if (script) {
|
||||||
const editor = editors.get(script);
|
const env = script.getAttribute("env");
|
||||||
const content = editor.state.doc.toString();
|
// remove the bootstrapped env which could be one or shared
|
||||||
const clone = script.cloneNode(true);
|
if (env) {
|
||||||
clone.type = `${type}-editor`;
|
for (const [key, value] of TYPES) {
|
||||||
clone.textContent = content;
|
if (key === type) {
|
||||||
script.xworker.terminate();
|
configs.delete(`${value}-${env}`);
|
||||||
script.nextElementSibling.remove();
|
envs.delete(`${value}-${env}`);
|
||||||
script.replaceWith(clone);
|
break;
|
||||||
editors.delete(script);
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// lonley script without setup node should be replaced
|
||||||
|
if (script.xworker) replaceScript(script, type);
|
||||||
|
// all scripts sharing the same env should be replaced
|
||||||
|
else {
|
||||||
|
const sel = `script[type^="${type}-editor"][env="${env}"]`;
|
||||||
|
for (const script of document.querySelectorAll(sel))
|
||||||
|
replaceScript(script, type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -365,7 +388,7 @@ const init = async (script, type, interpreter) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (isSetup) {
|
if (isSetup) {
|
||||||
await context.handleEvent({ currentTarget: null });
|
await context.handleEvent({ currentTarget: null, script });
|
||||||
notifyEditor();
|
notifyEditor();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user