release: WRNexusJS 0.6.0

This commit is contained in:
2026-08-01 01:09:58 +05:30
parent 3e565e8d03
commit 687d345882
502 changed files with 33038 additions and 11358 deletions
@@ -128,3 +128,24 @@ test("extracts declared events and validates component event bindings", () => {
["wrn-unknown-component-event"],
);
});
test("extracts v0.6 optional props, declared union options, and outputs", () => {
const metadata = parseComponentMetadata(`component Dialog {
outputs { confirm(payload: string) cancel() }
props {
title: string
description?: string
size: "small" | "large" = "small"
}
view { <div></div> }
}`);
assert.deepEqual(metadata.events, ["confirm", "cancel"]);
assert.deepEqual(
metadata.props.map(({ name, required, options }) => ({ name, required, options })),
[
{ name: "title", required: true, options: [] },
{ name: "description", required: false, options: [] },
{ name: "size", required: false, options: ["small", "large"] },
],
);
});
+10
View File
@@ -245,3 +245,13 @@ test("expands inline if blocks around HTML", () => {
assert.equal(formatWrn(source, options), expected);
assert.equal(formatWrn(expected, options), expected);
});
test("formats v0.6 grouped state and outputs blocks", () => {
const source = `component Demo {\nprops { title: string open: boolean = false }\nstate { count: number = 0 loading = false }\noutputs { confirm(payload: ConfirmPayload) cancel() }\nview { <div/> }\n}`;
const formatted = formatWrn(source, { tabSize: 2, insertSpaces: true });
assert.match(formatted, /\n {2}state \{\n {4}count: number = 0\n {4}loading = false\n {2}\}/);
assert.match(
formatted,
/\n {2}outputs \{\n {4}confirm\(payload: ConfirmPayload\)\n {4}cancel\(\)\n {2}\}/,
);
});