Refresh UI components and showcase; release updated framework packages
This commit is contained in:
1 parent
d800228585
commit
c77f5e1cec
293 files changed
+22544
-35778
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@wrnexus/compiler",
|
||||
"version": "0.8.29",
|
||||
"version": "0.8.30",
|
||||
"type": "module",
|
||||
"main": "src/index.ts",
|
||||
"exports": {
|
||||
|
||||
@@ -211,9 +211,7 @@ function __wrnRaw(v: unknown): string {
|
||||
return String(v == null ? "" : v);
|
||||
}
|
||||
|
||||
function __wrnexusEncodeControl(value: unknown): string {
|
||||
return __WrnexusBuffer.from(JSON.stringify(value), "utf8").toString("base64");
|
||||
}
|
||||
import { encodeControlTemplate as __wrnexusEncodeControl } from "@wrnexus/core";
|
||||
|
||||
function __wrnexusSerializeScopeValue(value: unknown): string {
|
||||
if (value === undefined) {
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import { expect, test } from "bun:test";
|
||||
import { compile } from "../src/index.ts";
|
||||
import { runWithRequestContext } from "@wrnexus/core";
|
||||
import { renderDocument } from "@wrnexus/ssr";
|
||||
|
||||
test("deep conditional components render each branch once with bounded document size", async () => {
|
||||
let view = "<p>Leaf</p>";
|
||||
for (let i = 0; i < 12; i++) view = `{#if open}${view}{:else}<i>Closed</i>{/if}`;
|
||||
const source = `component Nested {\n state open = true\n view { ${view} }\n }`;
|
||||
const code = new Bun.Transpiler({ loader: "ts" }).transformSync(compile(source, "Nested.wrn").code);
|
||||
const mod = await import("data:text/javascript;base64," + Buffer.from(code).toString("base64"));
|
||||
runWithRequestContext({} as never, () => {
|
||||
const body = mod.render({});
|
||||
const document = renderDocument({ meta: {}, body });
|
||||
expect(body).toContain("<p>Leaf</p>");
|
||||
expect(document.length).toBeLessThan(30000);
|
||||
const registry = JSON.parse(document.match(/data-wrn-controls[^>]*>(.*?)<\/script>/s)![1]!);
|
||||
expect(registry).toHaveLength(12);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user