chore: fit the loop-locals fix within the production gate

Three things the gate caught that the test suite could not.

The runtime size budget: writing `data-wrn-loop-locals` on client-rendered
loop items pushed reactive-runtime.ts to 51,603 against a 51,400 budget that
had only 125 bytes of headroom. Trimmed the encoder to the
btoa/encodeURIComponent idiom, recovering 65 bytes and leaving the smallest
form that still handles non-ASCII, then raised the budget to 51,600 with the
reason recorded in the file's own convention -- the remaining 263 bytes buy a
correctness fix, not a feature.

The VS Code extension bundles its own copy of the compiler, so the syntax and
compiler fixes made it stale. Rebuilt.

And a bug in the new test: `\{` inside a template literal is an unnecessary
escape, so the "brace inside a regex" case was testing an unescaped brace.
`\{` tests the case it was written for.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-22 12:08:07 +05:30
co-authored by Claude Opus 5
parent 2d0df4efc9
commit 2299a0726d
6 changed files with 256 additions and 36 deletions
+4 -13
View File
@@ -999,20 +999,11 @@ export const REACTIVE_RUNTIME = String.raw`
var json = JSON.stringify(locals);
if (json === undefined) return;
var bytes = new TextEncoder().encode(json);
var binary = "";
for (var index = 0; index < bytes.length; index++) {
binary += String.fromCharCode(bytes[index]);
}
node.setAttribute("data-wrn-loop-locals", window.btoa(binary));
node.setAttribute(
"data-wrn-loop-locals",
window.btoa(unescape(encodeURIComponent(json))),
);
} catch (error) {
/*
* A value that will not serialise (a cycle, a DOM node) must not take
* the whole loop down -- the item still renders, and a handler naming
* that local fails on its own terms rather than silently.
*/
console.error("[wrnexus] failed to encode loop locals", error);
}
}