fix(custom-widgets): harden v2 authoring

This commit is contained in:
Thomas Camlong committed 2026-07-20 22:16:18 +02:00
1 parent ee832ad3c6
commit 7c66c912e7
171 files changed
+20311 -50527

No files matched your search

@@ -37,10 +37,16 @@ export function containsEscapingCallback(node: AstNode): boolean {
if (node.type === "ArrowFunctionExpression") return true;
if (node.type === "CallExpression") {
const callee = nodeOf(node.callee);
const arguments_ = nodesOf(node.arguments);
if (callee?.type === "ArrowFunctionExpression") {
if (arguments_.length > 0) return true;
const body = nodeOf(callee.body);
return body ? containsEscapingCallbackChildren(body) : false;
}
if (callee && containsEscapingCallback(callee)) return true;
const property = callee?.type === "MemberExpression" ? nodeOf(callee.property) : null;
const method = property?.type === "Identifier" ? String(property.name) : staticPropertyName(property);
return nodesOf(node.arguments).some((argument) => {
return arguments_.some((argument) => {
if (argument.type !== "ArrowFunctionExpression" || !method || !callbackCollectionMethods.has(method)) {
return containsEscapingCallback(argument);
}