Avoid PyWeb as part of stdlib on MicroPython (#2030)

* Avoid PyWeb as part of stdlib on MicroPython

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Andrea Giammarchi
2024-04-17 17:10:23 +02:00
committed by GitHub
parent c653296821
commit cf92996071
6 changed files with 45 additions and 18 deletions

View File

@@ -26,8 +26,8 @@ import { ErrorCode } from "./exceptions.js";
import { robustFetch as fetch, getText } from "./fetch.js";
import { hooks, main, worker, codeFor, createFunction } from "./hooks.js";
import stdlib from "./stdlib.js";
export { stdlib };
import { stdlib, optional } from "./stdlib.js";
export { stdlib, optional };
// generic helper to disambiguate between custom element and script
const isScript = ({ tagName }) => tagName === "SCRIPT";
@@ -168,7 +168,7 @@ for (const [TYPE, interpreter] of TYPES) {
// specific main and worker hooks
const hooks = {
main: {
...codeFor(main),
...codeFor(main, TYPE),
async onReady(wrap, element) {
registerModule(wrap);
@@ -265,7 +265,7 @@ for (const [TYPE, interpreter] of TYPES) {
},
},
worker: {
...codeFor(worker),
...codeFor(worker, TYPE),
// these are lazy getters that returns a composition
// of the current hooks or undefined, if no hook is present
get onReady() {