feat(compiler): support the three api render-binding forms
- Parse api="name", api="name()", and api="name({ ... })" render bindings
for apis {} (mode "any") blocks, mirroring @click="fn()" syntax.
- Render-bind by calling Task 4's generated server `api` object directly
(api.<name>(args)) rather than re-implementing the fetch/response
transport, spliced into the SSR template via the existing loop/expression
sentinel mechanism so the call runs inside the async render function with
await support.
- A block that is both render-bound and called from code runs twice by
design (no dedup); pinned with a test.
- Fix packages/syntax's attribute-value lexer (readQuoted) to honor
backslash-escaped quotes, needed so an api="..." call expression can
itself contain a quoted string/object literal.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
// WRN editor language server source hash: d42dc4f557c0cb990f1d164708ca5d9ed8ddeabca3270f1b99f175b1f342572e
|
||||
// WRN editor language server source hash: 9614834cb7909e77f707aa31a8cc87ec6193ad642a81ee52870fd6872785fa4e
|
||||
// WRN editor language server generator hash: f593a44aaf05495b789ce7a3086bee1eebb951b884d41c0e017bbcfe5f547e72
|
||||
// @bun @bun-cjs
|
||||
(function(exports, require, module, __filename, __dirname) {var __create = Object.create;
|
||||
@@ -172082,12 +172082,18 @@ function parseHtmlView(src, pos) {
|
||||
if (quote !== '"' && quote !== "'")
|
||||
return fail("Expected a quoted attribute value");
|
||||
i++;
|
||||
const start = i;
|
||||
while (i < src.length && src[i] !== quote)
|
||||
let value = "";
|
||||
while (i < src.length && src[i] !== quote) {
|
||||
if (src[i] === "\\" && i + 1 < src.length) {
|
||||
value += src[i + 1];
|
||||
i += 2;
|
||||
continue;
|
||||
}
|
||||
value += src[i];
|
||||
i++;
|
||||
}
|
||||
if (i >= src.length)
|
||||
return fail("Unterminated attribute value");
|
||||
const value = src.slice(start, i);
|
||||
i++;
|
||||
return value;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user