Files
pyscript/pyscript.core/esm/interpreter/micropython.js
2023-06-19 12:06:15 +02:00

34 lines
870 B
JavaScript

import { fetchPaths, stdio } from "./_utils.js";
import {
run,
runAsync,
runEvent,
runWorker,
runWorkerAsync,
writeFile,
} from "./_python.js";
const type = "micropython";
// REQUIRES INTEGRATION TEST
/* c8 ignore start */
export default {
type,
module: (version = "1.20.0-239") =>
`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;
},
run,
runAsync,
runEvent,
runWorker,
runWorkerAsync,
writeFile,
};
/* c8 ignore stop */