mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-20 18:55:29 -05:00
PyScript Core Documentation (#1560)
This commit is contained in:
committed by
GitHub
parent
bf6470c046
commit
9121071ba3
@@ -1,11 +1,5 @@
|
||||
import { fetchPaths, stdio } from "./_utils.js";
|
||||
import {
|
||||
run,
|
||||
runAsync,
|
||||
setGlobal,
|
||||
deleteGlobal,
|
||||
writeFile,
|
||||
} from "./_python.js";
|
||||
import { run, setGlobal, deleteGlobal, writeFile } from "./_python.js";
|
||||
|
||||
const type = "micropython";
|
||||
|
||||
@@ -13,19 +7,23 @@ const type = "micropython";
|
||||
/* c8 ignore start */
|
||||
export default {
|
||||
type,
|
||||
module: (version = "1.20.0-253") =>
|
||||
module: (version = "1.20.0-268") =>
|
||||
`https://cdn.jsdelivr.net/npm/@micropython/micropython-webassembly-pyscript@${version}/micropython.mjs`,
|
||||
async engine({ loadMicroPython }, config, url) {
|
||||
const { stderr, stdout, get } = stdio();
|
||||
url = url.replace(/\.m?js$/, ".wasm");
|
||||
const runtime = await get(loadMicroPython({ stderr, stdout, url }));
|
||||
if (config.fetch) await fetchPaths(this, runtime, config.fetch);
|
||||
return runtime;
|
||||
const interpreter = await get(loadMicroPython({ stderr, stdout, url }));
|
||||
if (config.fetch) await fetchPaths(this, interpreter, config.fetch);
|
||||
return interpreter;
|
||||
},
|
||||
setGlobal,
|
||||
deleteGlobal,
|
||||
run,
|
||||
runAsync,
|
||||
// TODO: MicroPython doesn't have a Pyodide like top-level await,
|
||||
// this method should still not throw errors once invoked
|
||||
async runAsync(...args) {
|
||||
return this.run(...args);
|
||||
},
|
||||
writeFile,
|
||||
};
|
||||
/* c8 ignore stop */
|
||||
|
||||
Reference in New Issue
Block a user