feat(wasm): route D zero-author-JS frontend + plan route E
Auto-mount via bridge mount/data-mq and client_embed; expand DOM/form effects; drop hello loader JS; add web-client-site. Document that C+D cover mid-size interactivity but not most JS apps—route E covers routing, storage, lists, WebSocket, and richer DOM/timers. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
4c27c8afeb
commit
a9d30cdf4a
30 files changed
+1769
-213
No files matched your search
+38
-4
@@ -1,11 +1,16 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* WASM ABI smoke (C1/C3): boot counter.mq.md, call bump twice.
|
||||
* WASM ABI + bridge helpers smoke (C1/C3/D1).
|
||||
* Usage: node tests/wasm/smoke.mjs [path/to/marqdo_wasm.wasm]
|
||||
*/
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import { fileURLToPath } from "url";
|
||||
import { fileURLToPath, pathToFileURL } from "url";
|
||||
import {
|
||||
normalizeMountOptions,
|
||||
eventArgsFromDom,
|
||||
applyDomPatch,
|
||||
} from "../../crates/marqdo-wasm/js/marqdo-bridge.js";
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const root = path.resolve(__dirname, "../..");
|
||||
@@ -67,8 +72,8 @@ if (!Array.isArray(b.value) || b.value.length < 1) {
|
||||
console.error("expected wire list", b.value);
|
||||
process.exit(1);
|
||||
}
|
||||
const c1 = call("bump", {});
|
||||
const c2 = call("bump", {});
|
||||
const c1 = call("bump", { event: "click" });
|
||||
const c2 = call("bump", { event: "click", value: "x" });
|
||||
if (!c1.ok || !c2.ok) {
|
||||
console.error("call failed", c1, c2);
|
||||
process.exit(1);
|
||||
@@ -77,4 +82,33 @@ if (c2.value?.set_text?.["#count"] !== "2") {
|
||||
console.error("expected count 2, got", c2.value);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const norm = normalizeMountOptions({
|
||||
dataset: {
|
||||
mqWasm: "./w.wasm",
|
||||
mqSourceUrl: "./c.mq.md",
|
||||
mqReady: "#log",
|
||||
mqEnable: "#a,#b",
|
||||
},
|
||||
});
|
||||
if (norm.wasmUrl !== "./w.wasm" || norm.sourceUrl !== "./c.mq.md") {
|
||||
console.error("normalizeMountOptions failed", norm);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const args = eventArgsFromDom(
|
||||
{ type: "input", target: { value: "Ada", id: "name" } },
|
||||
"",
|
||||
);
|
||||
if (args.value !== "Ada" || args.event !== "input") {
|
||||
console.error("eventArgsFromDom failed", args);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// DOM patch without document should no-op
|
||||
applyDomPatch({ set_text: { "#x": "y" }, set_value: { "#i": "1" } });
|
||||
|
||||
console.log("wasm smoke ok");
|
||||
console.log("bridge helpers ok");
|
||||
// silence unused
|
||||
void pathToFileURL;
|
||||
Reference in new issue
Block a user