Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/core.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/core.js.map

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions esm/interpreter/micropython.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { fetchFiles, fetchPaths, stdio, writeFile } from './_utils.js';
import { registerJSModule, run, runAsync, runEvent } from './_python.js';

const { stringify } = JSON;
const type = 'micropython';

// REQUIRES INTEGRATION TEST
Expand All @@ -15,6 +16,14 @@ export default {
const interpreter = await get(loadMicroPython({ stderr, stdout, url }));
if (config.files) await fetchFiles(this, interpreter, config.files);
if (config.fetch) await fetchPaths(this, interpreter, config.fetch);
if (config.packages) {
run(interpreter, `
import mip
for pkg in ${stringify(config.packages)}:
mip.install(pkg)
del mip
`);
}
return interpreter;
},
registerJSModule,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@
"sticky-module": "^0.1.0"
},
"worker": {
"blob": "sha256-FnsW6rel2dFIXuccz8Y2c8l+P9M3qO9J98MZ3hd28jk="
"blob": "sha256-HE0ZIi5Ns0KdhN+fjvqQdMJhjihRtgW+mCjE76WH+U0="
}
}
14 changes: 14 additions & 0 deletions test/mpy-config.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="module" src="../core.js"></script>
</head>
<body>
<script type="micropython" config="./mpy_config.toml">
from mpy_config import test
print(test)
</script>
</body>
</html>
1 change: 1 addition & 0 deletions test/mpy_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test = "OK"
1 change: 1 addition & 0 deletions test/mpy_config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
packages = ["http://localhost:8080/test/mpy_config.py"]