feat(csr): diagnose missing output binding functions

This commit is contained in:
2026-08-09 13:06:56 +05:30
parent 35cd28aad4
commit 709a38feb4
2 changed files with 49 additions and 0 deletions
+14
View File
@@ -210,6 +210,17 @@ export const REACTIVE_RUNTIME = String.raw`
// CustomEvent can be unavailable in minimal DOM test environments.
}
}
function warnMissingBindingFunction(statement, resolve, element) {
var match = /^\s*([A-Za-z_$][\w$]*)\s*\(/.exec(statement || "");
if (!match || typeof resolve(match[1]) === "function") return;
warnOnce(
"WRN-DEV-BINDING-MISSING",
"Component binding calls '" + match[1] + "', but that function does not exist in the parent scope.",
element,
{ binding: statement, functionName: match[1] },
);
}
/*__WRNEXUS_DEV_END__*/
function scheduleUpdateHook(element, callback) {
@@ -2514,6 +2525,9 @@ export const REACTIVE_RUNTIME = String.raw`
locals.event = undefined;
locals.$event = undefined;
try {
/*__WRNEXUS_DEV_START__*/
warnMissingBindingFunction(outStmt, function (name) { return peekScope(name); }, componentRoot);
/*__WRNEXUS_DEV_END__*/
return runStmt(outStmt, locals);
} catch (error) {
console.error(