release: WRNexusJS 0.3.0

This commit is contained in:
2026-07-22 17:29:08 +05:30
parent 13dfa31d19
commit 07d8fb59d6
145 changed files with 9664 additions and 3881 deletions
+42
View File
@@ -996,6 +996,24 @@ component Accordion {
expect(output).not.toContain('${(isOpen(index)) ? " open" : ""}');
});
test("data-for parser supports optional stable key expressions", async () => {
const { parseForExpr } = await import("../src/codegen.ts");
expect(parseForExpr("item, index in items key item.id")).toEqual({
item: "item",
index: "index",
list: "items",
key: "item.id",
});
expect(parseForExpr("item in items")).toEqual({
item: "item",
index: undefined,
list: "items",
key: undefined,
});
});
test("server-rendered each locals work in reactive handlers", async () => {
const firstLocals = Buffer.from(
JSON.stringify({
@@ -1063,3 +1081,27 @@ test("server-rendered each locals work in reactive handlers", async () => {
expect(articles[1]!.querySelector("span")?.classList.contains("open")).toBe(true);
});
test("WRN 0.3 metadata, computed values, loaders, and actions compile additively", () => {
const source = `page Dashboard {
runtime = "universal"
hydrate = "idle"
state count = 2
computed { doubled = count * 2 }
effect { console.log(doubled) }
security { auth = "required" }
load server { return { count: 2 } }
load client { return { refreshed: true } }
action save(input) { return input }
view { <button @click="count++">{doubled}</button> }
}`;
const output = compileWireFile(source);
expect(output).toContain('export const __wrnexusRuntime = "universal"');
expect(output).toContain('export const __wrnexusHydrate = "idle"');
expect(output).toContain("export async function __wrnexusLoad");
expect(output).toContain("export async function __wrnexusClientLoad");
expect(output).toContain("export async function save(input)");
expect(output).toContain("export const __wrnexusActions");
expect(output).toContain('data-wrn-hydrate="idle"');
});