mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-22 11:45:28 -05:00
* kill unwrapped_remote (#1490) * kill unwrapped_remote * linting * don't use callKwargs for python plugins * fix tests and improve types * Bringing PyScript.next PoC to the main project * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Madhur Tandon <20173739+madhur-tandon@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
58 lines
1.7 KiB
JavaScript
58 lines
1.7 KiB
JavaScript
// ⚠️ Part of this file is automatically generated
|
|
// The :RUNTIMES comment is a delimiter and no code should be written/changed after
|
|
// See rollup/build_runtimes.cjs to know more
|
|
|
|
import { base } from "./runtime/_utils.js";
|
|
|
|
/** @type {Map<string, object>} */
|
|
export const registry = new Map();
|
|
|
|
/** @type {Map<string, object>} */
|
|
export const configs = new Map();
|
|
|
|
/** @type {string[]} */
|
|
export const selectors = [];
|
|
|
|
/** @type {string[]} */
|
|
export const prefixes = [];
|
|
|
|
export const runtime = new Proxy(new Map(), {
|
|
get(map, id) {
|
|
if (!map.has(id)) {
|
|
const [type, ...rest] = id.split("@");
|
|
const runtime = registry.get(type);
|
|
const url = /^https?:\/\//i.test(rest)
|
|
? rest[0]
|
|
: runtime.module(...rest);
|
|
map.set(id, {
|
|
url,
|
|
module: import(url),
|
|
engine: runtime.engine.bind(runtime),
|
|
});
|
|
}
|
|
const { url, module, engine } = map.get(id);
|
|
return (config, baseURL) =>
|
|
module.then((module) => {
|
|
configs.set(id, config);
|
|
const fetch = config?.fetch;
|
|
if (fetch) base.set(fetch, baseURL);
|
|
return engine(module, config, url);
|
|
});
|
|
},
|
|
});
|
|
|
|
const register = (runtime) => {
|
|
for (const type of [].concat(runtime.type)) {
|
|
registry.set(type, runtime);
|
|
selectors.push(`script[type="${type}"]`);
|
|
prefixes.push(`${type}-`);
|
|
}
|
|
};
|
|
|
|
//:RUNTIMES
|
|
import micropython from "./runtime/micropython.js";
|
|
import pyodide from "./runtime/pyodide.js";
|
|
import ruby from "./runtime/ruby.js";
|
|
import wasmoon from "./runtime/wasmoon.js";
|
|
for (const runtime of [micropython, pyodide, ruby, wasmoon]) register(runtime);
|