release: WRNexusJS 0.2.39

This commit is contained in:
2026-07-15 13:22:20 +05:30
parent 98445c2ec7
commit 29bbeefe92
61 changed files with 481 additions and 132 deletions
+9 -1
View File
@@ -1232,6 +1232,11 @@ function generateComponent(ast: PageAst): string {
};
const ctx: CompCtx = { stateNames, resolveExpr };
const serverFunctions = ast.functions
.map((body) => body.trim())
.filter(Boolean)
.join("\n\n");
const viewCode = ast.view.map((node) => renderComponentNode(node, ctx)).join("");
const styles = ast.styles.map((body) => body.trim()).filter(Boolean);
const styleTag =
@@ -1262,7 +1267,7 @@ function generateComponent(ast: PageAst): string {
);
}
for (const state of ast.states) {
decls.push(` const ${nameRefs.get(state.name)} = (${resolveExpr(state.expr)});`);
decls.push(` let ${nameRefs.get(state.name)} = (${resolveExpr(state.expr)});`);
}
const returnExpr = needsScope
@@ -1402,10 +1407,13 @@ function __wireRaw(v: any): string {
}`);
}
const serverFunctionSource = serverFunctions ? `${serverFunctions}\n` : "";
out.push(
`export function render(props: Record<string, any> = {}): string {\n` +
` const __p = props || {};\n` +
(decls.length > 0 ? decls.join("\n") + "\n" : "") +
serverFunctionSource +
scopeLine +
` return ${returnExpr};\n` +
`}`,