Files
pyscript/pyscript.core/test/mocked/pyodide.mjs
Andrea Giammarchi 339e40063a WIP: Bringing PyScript.next PoC to the main project (#1507)
* 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>
2023-06-05 21:52:28 +02:00

41 lines
955 B
JavaScript

import { basename, dirname } from "node:path";
let target;
export const setTarget = (value) => {
target = value;
};
export const python = { content: "", target: null, packages: null };
export const loadPyodide = () => ({
loadPackage() {},
pyimport() {
return {
install(packages) {
python.packages = packages;
},
destroy() {},
};
},
runPython(content) {
python.content = content;
if (target) {
document.currentScript.target = target;
target = void 0;
}
python.target = document.currentScript.target;
},
FS: {
mkdirTree() {},
writeFile() {},
analyzePath: (path) => ({
parentPath: dirname(path),
name: basename(path),
}),
},
_module: {
PATH: { dirname },
PATH_FS: {
resolve: (path) => path,
},
},
});