mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-20 02:37:41 -05:00
This reverts commit b4c686f411.
This commit is contained in:
@@ -9,11 +9,10 @@ import { queryTarget } from "../node_modules/polyscript/esm/script-handler.js";
|
||||
import { dedent, dispatch } from "../node_modules/polyscript/esm/utils.js";
|
||||
import { Hook } from "../node_modules/polyscript/esm/worker/hooks.js";
|
||||
|
||||
import TYPES from "./types.js";
|
||||
import configs from "./config.js";
|
||||
import { ErrorCode } from "./exceptions.js";
|
||||
import sync from "./sync.js";
|
||||
import stdlib from "./stdlib.js";
|
||||
import { ErrorCode } from "./exceptions.js";
|
||||
import { config, plugins, error } from "./config.js";
|
||||
import { robustFetch as fetch, getText } from "./fetch.js";
|
||||
|
||||
const { assign, defineProperty } = Object;
|
||||
@@ -21,6 +20,11 @@ const { assign, defineProperty } = Object;
|
||||
// allows lazy element features on code evaluation
|
||||
let currentElement;
|
||||
|
||||
const TYPES = new Map([
|
||||
["py", "pyodide"],
|
||||
["mpy", "micropython"],
|
||||
]);
|
||||
|
||||
// generic helper to disambiguate between custom element and script
|
||||
const isScript = ({ tagName }) => tagName === "SCRIPT";
|
||||
|
||||
@@ -99,12 +103,7 @@ const workerHooks = {
|
||||
[...hooks.codeAfterRunWorkerAsync].map(dedent).join("\n"),
|
||||
};
|
||||
|
||||
const exportedConfig = {};
|
||||
export { exportedConfig as config };
|
||||
|
||||
for (const [TYPE, interpreter] of TYPES) {
|
||||
const { config, plugins, error } = configs.get(TYPE);
|
||||
|
||||
// create a unique identifier when/if needed
|
||||
let id = 0;
|
||||
const getID = (prefix = TYPE) => `${prefix}-${id++}`;
|
||||
@@ -274,9 +273,6 @@ for (const [TYPE, interpreter] of TYPES) {
|
||||
|
||||
// define py-script only if the config didn't throw an error
|
||||
if (!error) customElements.define(`${TYPE}-script`, PyScriptElement);
|
||||
|
||||
// export the used config without allowing leaks through it
|
||||
exportedConfig[TYPE] = structuredClone(config);
|
||||
}
|
||||
|
||||
// TBD: I think manual worker cases are interesting in pyodide only
|
||||
|
||||
Reference in New Issue
Block a user