fix: harden generated identifiers and types
Quality / quality (ubuntu-latest) (push) Failing after 12m50s
Quality / quality (windows-latest) (push) Canceled after 0s

This commit is contained in:
2026-08-03 00:02:37 +05:30
parent 586a6db8ff
commit b3e9b99e13
3 changed files with 19 additions and 0 deletions
+7
View File
@@ -1566,6 +1566,13 @@ const JS_RESERVED = new Set([
"enum",
"with",
"debugger",
"implements",
"interface",
"package",
"private",
"protected",
"public",
"static",
]);
/** A JS reference for a prop/state name (reserved words get a `__p_` prefix). */
+11
View File
@@ -1387,3 +1387,14 @@ test("style blocks compile with stable page/component/layout metadata", () => {
expect(layout).toContain("export const __wrnexusStyles");
expect(page).toMatch(/data-wrnexus-style-id="wrn-page-[a-z0-9]+"/);
});
test("strict-mode reserved prop names compile through safe local references", () => {
const output = compileWireFile(`component Visibility {
props { private: boolean = false }
view { {#if private}<span>Private</span>{/if} }
}`);
expect(output).toContain("const __p_private: boolean");
expect(output).toContain("(__p_private) ?");
expect(output).not.toContain("const private:");
});