what-compiler 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/babel-plugin.js"],
4
- "sourcesContent": ["/**\n * What Framework Babel Plugin \u2014 Fine-Grained Only\n *\n * JSX \u2192 template() + insert() + effect() calls\n * Static HTML extracted to module-level templates, dynamic expressions wrapped in effects.\n * Components run ONCE. All reactivity is signal-driven.\n *\n * Output:\n * const _tmpl$1 = template('<div class=\"container\"><h1>Title</h1><p></p></div>');\n * function App() {\n * const _el$ = _tmpl$1();\n * insert(_el$.childNodes[1], () => desc());\n * return _el$;\n * }\n *\n * Template calls are hoisted to module scope \u2014 each unique HTML string gets one\n * top-level const. Component functions just clone: `const _el$ = _tmpl$1()`.\n */\n\nconst EVENT_MODIFIERS = new Set(['preventDefault', 'stopPropagation', 'once', 'capture', 'passive', 'self']);\nconst EVENT_OPTION_MODIFIERS = new Set(['once', 'capture', 'passive']);\nconst VOID_HTML_ELEMENTS = new Set([\n 'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input',\n 'link', 'meta', 'param', 'source', 'track', 'wbr'\n]);\n\n// Events that use document-level delegation for performance.\n// The compiler emits `el.$$click = handler` instead of addEventListener.\n// A one-time document listener walks event.target upward to find the handler.\nconst DELEGATED_EVENTS = new Set([\n 'click', 'input', 'change', 'keydown', 'keyup', 'submit',\n 'focusin', 'focusout', 'mousedown', 'mouseup',\n]);\n\n// Known non-reactive call expressions \u2014 these should NOT be wrapped in effects\n// unless their arguments contain signal reads.\nconst SAFE_GLOBAL_CALLS = new Set([\n 'Math', 'Number', 'String', 'Boolean', 'parseInt', 'parseFloat',\n 'isNaN', 'isFinite', 'encodeURIComponent', 'decodeURIComponent',\n 'encodeURI', 'decodeURI', 'JSON', 'Date', 'Array', 'Object',\n 'console', 'RegExp',\n]);\n\n// Known signal-creating functions\nconst SIGNAL_CREATORS = new Set([\n 'useSignal', 'signal', 'computed', 'useComputed', 'useState', 'useReducer',\n 'createResource', 'useSWR', 'useQuery', 'useInfiniteQuery',\n]);\n\n// Normalize JSX text per React/Babel rules:\n// - Split on newlines, treat tabs as spaces.\n// - For interior lines: trim leading and trailing horizontal whitespace.\n// - For the first line: only trim trailing whitespace.\n// - For the last line: only trim leading whitespace.\n// - Skip lines that are entirely whitespace (don't add a separator space).\n// - Join the remaining non-empty lines with single spaces.\n//\n// This preserves leading/trailing single-line whitespace that sits next to\n// an expression like `{count} items` \u2014 without this, the space is eaten and\n// the rendered output reads `5items`.\nfunction normalizeJsxText(value) {\n // Single-line text (no newlines): preserve the original (just tabs->spaces).\n // This keeps the space in cases like `{a} {b}` where the JSXText is \" \".\n if (!/[\\r\\n]/.test(value)) {\n return value.replace(/\\t/g, ' ');\n }\n const lines = value.split(/\\r\\n|\\n|\\r/);\n let lastNonEmpty = -1;\n for (let i = 0; i < lines.length; i++) {\n if (/[^ \\t]/.test(lines[i])) lastNonEmpty = i;\n }\n if (lastNonEmpty === -1) return '';\n let out = '';\n for (let i = 0; i < lines.length; i++) {\n let line = lines[i].replace(/\\t/g, ' ');\n const isFirst = i === 0;\n const isLast = i === lines.length - 1;\n if (!isFirst) line = line.replace(/^ +/, '');\n if (!isLast) line = line.replace(/ +$/, '');\n if (!line) continue;\n if (i !== lastNonEmpty) line += ' ';\n out += line;\n }\n return out;\n}\n\nexport default function whatBabelPlugin({ types: t }) {\n // =====================================================\n // Shared utilities\n // =====================================================\n\n // Warn-once tracking for unknown event modifier segments. Keyed by\n // `${filename}::${segment}` so each typo is reported at most once per file\n // per compile process. Without the filename in the key, the same typo in\n // two different files would silently warn for the first file only \u2014\n // problematic in long-running Vite dev servers.\n const _unknownModifierWarned = new Set();\n const _forInfoWarned = new Set();\n\n function hasEventModifiers(name, state) {\n // Any `__` in an `on*` attribute is intended as modifier syntax \u2014 even\n // if every segment is unknown. Returning false there would emit the\n // attribute as a plain delegated-event property (e.g.\n // `el.$$onclick__totalyWrong = handler`), which never fires. Instead,\n // always route through the modifier-handling branch so the parser can\n // warn about the typo and drop the unknown segments.\n if (!name.includes('__')) return false;\n if (!name.startsWith('on')) return false;\n const parts = name.split('__');\n const tail = parts.slice(1).filter(s => s !== '');\n if (tail.length === 0) return false;\n if (process.env.NODE_ENV !== 'production') {\n const unknown = tail.filter(m => !EVENT_MODIFIERS.has(m));\n const filename = (state && (state.filename || (state.file && state.file.opts && state.file.opts.filename))) || '<unknown>';\n for (const m of unknown) {\n const key = `${filename}::${m}`;\n if (!_unknownModifierWarned.has(key)) {\n _unknownModifierWarned.add(key);\n console.warn(\n `[what-compiler] Unknown event modifier \"__${m}\" in attribute \"${name}\" (${filename}). ` +\n `Known modifiers: ${[...EVENT_MODIFIERS].join(', ')}. ` +\n `Unknown segments are ignored.`\n );\n }\n }\n }\n return true;\n }\n\n function parseEventModifiers(name) {\n // Support both '|' (template strings) and '__' (JSX-safe) as modifier delimiters\n const delimiter = name.includes('|') ? '|' : '__';\n const parts = name.split(delimiter);\n const eventName = parts[0];\n const modifiers = parts.slice(1).filter(m => EVENT_MODIFIERS.has(m));\n return { eventName, modifiers };\n }\n\n function isBindingAttribute(name) {\n return name.startsWith('bind:');\n }\n\n function getBindingProperty(name) {\n return name.slice(5);\n }\n\n function isComponent(name) {\n return /^[A-Z]/.test(name);\n }\n\n function isVoidHtmlElement(name) {\n return VOID_HTML_ELEMENTS.has(String(name).toLowerCase());\n }\n\n function getAttributeValue(value) {\n if (!value) return t.booleanLiteral(true);\n if (t.isJSXExpressionContainer(value)) return value.expression;\n if (t.isStringLiteral(value)) return value;\n return t.stringLiteral(value.value || '');\n }\n\n function normalizeAttrName(attrName) {\n if (attrName === 'className') return 'class';\n if (attrName === 'htmlFor') return 'for';\n return attrName;\n }\n\n // Safely extract attribute name, handling JSXNamespacedName (e.g., client:idle, bind:value)\n function getAttrName(attr) {\n if (t.isJSXNamespacedName(attr.name)) {\n return `${attr.name.namespace.name}:${attr.name.name.name}`;\n }\n return typeof attr.name.name === 'string' ? attr.name.name : String(attr.name.name);\n }\n\n function createEventHandler(handler, modifiers) {\n if (modifiers.length === 0) return handler;\n\n let wrappedHandler = handler;\n\n for (const mod of modifiers) {\n switch (mod) {\n case 'preventDefault':\n wrappedHandler = t.arrowFunctionExpression(\n [t.identifier('e')],\n t.blockStatement([\n t.expressionStatement(\n t.callExpression(\n t.memberExpression(t.identifier('e'), t.identifier('preventDefault')),\n []\n )\n ),\n t.expressionStatement(\n t.callExpression(wrappedHandler, [t.identifier('e')])\n )\n ])\n );\n break;\n\n case 'stopPropagation':\n wrappedHandler = t.arrowFunctionExpression(\n [t.identifier('e')],\n t.blockStatement([\n t.expressionStatement(\n t.callExpression(\n t.memberExpression(t.identifier('e'), t.identifier('stopPropagation')),\n []\n )\n ),\n t.expressionStatement(\n t.callExpression(wrappedHandler, [t.identifier('e')])\n )\n ])\n );\n break;\n\n case 'self':\n wrappedHandler = t.arrowFunctionExpression(\n [t.identifier('e')],\n t.blockStatement([\n t.ifStatement(\n t.binaryExpression(\n '===',\n t.memberExpression(t.identifier('e'), t.identifier('target')),\n t.memberExpression(t.identifier('e'), t.identifier('currentTarget'))\n ),\n t.expressionStatement(\n t.callExpression(wrappedHandler, [t.identifier('e')])\n )\n )\n ])\n );\n break;\n\n case 'once':\n case 'capture':\n case 'passive':\n break;\n }\n }\n\n return wrappedHandler;\n }\n\n // =====================================================\n // Reactivity Detection \u2014 Signal-Aware\n // =====================================================\n\n // Check if an identifier is known to be a signal (from useSignal/signal/computed/useState)\n function isSignalIdentifier(name, signalNames) {\n return signalNames.has(name);\n }\n\n // Collect signal identifiers using Babel's scope analysis.\n // Walks the scope chain from the given path upward, collecting signals\n // defined in each lexical scope (function/block).\n function collectSignalNamesFromScope(path) {\n const signalNames = new Set();\n\n // Helper: extract signal names from a VariableDeclarator node\n function extractFromDeclarator(decl) {\n const init = decl.init;\n if (!init || !t.isCallExpression(init)) return;\n\n const callee = init.callee;\n let calleeName = '';\n if (t.isIdentifier(callee)) {\n calleeName = callee.name;\n } else if (t.isMemberExpression(callee) && t.isIdentifier(callee.property)) {\n calleeName = callee.property.name;\n }\n\n if (SIGNAL_CREATORS.has(calleeName)) {\n const id = decl.id;\n if (t.isIdentifier(id)) {\n signalNames.add(id.name);\n } else if (t.isArrayPattern(id)) {\n for (const el of id.elements) {\n if (t.isIdentifier(el)) signalNames.add(el.name);\n }\n } else if (t.isObjectPattern(id)) {\n for (const prop of id.properties) {\n if (t.isObjectProperty(prop) && t.isIdentifier(prop.value)) {\n signalNames.add(prop.value.name);\n }\n }\n }\n }\n }\n\n // Walk up the scope chain using Babel's scope API.\n let scope = path.scope;\n while (scope) {\n // Check all variable bindings in this scope.\n for (const binding of Object.values(scope.bindings)) {\n if (binding.path.isVariableDeclarator()) {\n extractFromDeclarator(binding.path.node);\n }\n }\n // Scan this scope's own function params (destructured props) ONCE per\n // scope \u2014 not once per binding. The old per-binding rescan made this\n // O(params \u00D7 bindings) per scope per JSXElement. (AUDIT-2026-06-06 H2)\n const fnNode = scope.path && scope.path.node;\n if (fnNode && fnNode.params) {\n for (const param of fnNode.params) {\n if (t.isObjectPattern(param)) {\n for (const prop of param.properties) {\n if (t.isObjectProperty(prop) && t.isIdentifier(prop.value)) {\n signalNames.add(prop.value.name);\n } else if (t.isRestElement(prop) && t.isIdentifier(prop.argument)) {\n signalNames.add(prop.argument.name);\n }\n }\n }\n }\n }\n scope = scope.parent;\n }\n\n return signalNames;\n }\n\n // Legacy wrapper for backward compat (used in collectSignalNames calls)\n function collectSignalNames(path) {\n return collectSignalNamesFromScope(path);\n }\n\n // Check if a call expression is a safe (non-reactive) global call\n function isSafeGlobalCall(expr) {\n if (!t.isCallExpression(expr)) return false;\n const callee = expr.callee;\n\n // Math.max(), Number.parseInt(), etc.\n if (t.isMemberExpression(callee) && t.isIdentifier(callee.object)) {\n return SAFE_GLOBAL_CALLS.has(callee.object.name);\n }\n\n // parseInt(), isNaN(), etc.\n if (t.isIdentifier(callee)) {\n return SAFE_GLOBAL_CALLS.has(callee.name);\n }\n\n return false;\n }\n\n // Check if an expression's reactivity is uncertain \u2014 e.g., a non-signal function call\n // whose arguments happen to contain signal reads. The function itself may not produce\n // a reactive result, so the compiler wraps it conservatively.\n function isUncertainReactive(expr, signalNames, importedIds) {\n if (!signalNames) return false;\n if (t.isCallExpression(expr)) {\n // Callee is a known signal \u2014 definitely reactive, not uncertain\n if (t.isIdentifier(expr.callee) && isSignalIdentifier(expr.callee.name, signalNames)) {\n return false;\n }\n // Imported identifier called as function \u2014 definitely reactive (not uncertain)\n if (importedIds && t.isIdentifier(expr.callee) && importedIds.has(expr.callee.name) &&\n !SAFE_GLOBAL_CALLS.has(expr.callee.name)) {\n return false;\n }\n // Callee is a member of a known signal \u2014 definitely reactive\n if (t.isMemberExpression(expr.callee) && t.isIdentifier(expr.callee.object) &&\n isSignalIdentifier(expr.callee.object.name, signalNames)) {\n return false;\n }\n // Safe global call (Math.max, etc.) with reactive args \u2014 still deterministic, not uncertain\n if (isSafeGlobalCall(expr)) return false;\n // Unknown function call \u2014 if args are reactive, the wrapping is uncertain\n if (expr.arguments.some(arg => isPotentiallyReactive(arg, signalNames, importedIds))) {\n return true;\n }\n }\n return false;\n }\n\n // Check if an expression is potentially reactive (reads a signal)\n // importedIds: Set of identifiers imported from other modules \u2014 any imported\n // function call is conservatively treated as potentially reactive since the\n // imported binding could be a signal from another file.\n function isPotentiallyReactive(expr, signalNames, importedIds) {\n if (!signalNames) signalNames = new Set();\n\n if (t.isCallExpression(expr)) {\n // If callee is a known signal identifier being called (signal read), it's reactive\n if (t.isIdentifier(expr.callee) && isSignalIdentifier(expr.callee.name, signalNames)) {\n return true;\n }\n // Imported identifier called as a function \u2014 conservatively reactive.\n // Handles: import { count } from './store'; ... {count()} in JSX\n if (importedIds && t.isIdentifier(expr.callee) && importedIds.has(expr.callee.name)) {\n // Exclude known safe globals that happen to also be imported\n if (!SAFE_GLOBAL_CALLS.has(expr.callee.name)) {\n return true;\n }\n }\n // member.call() \u2014 e.g., data(), isLoading()\n if (t.isMemberExpression(expr.callee)) {\n // Check if the object is a signal\n if (t.isIdentifier(expr.callee.object) && isSignalIdentifier(expr.callee.object.name, signalNames)) {\n return true;\n }\n }\n // Safe global calls like Math.max \u2014 only reactive if their args are\n if (isSafeGlobalCall(expr)) {\n return expr.arguments.some(arg => isPotentiallyReactive(arg, signalNames, importedIds));\n }\n // Unknown call \u2014 check if callee or args contain signal reads\n if (t.isIdentifier(expr.callee)) {\n // Could be a function that reads signals internally\n // Be conservative: if it's not a known safe call and not a signal, still check args\n return expr.arguments.some(arg => isPotentiallyReactive(arg, signalNames, importedIds));\n }\n // For any other call expression, check recursively\n return isPotentiallyReactive(expr.callee, signalNames, importedIds) ||\n expr.arguments.some(arg => isPotentiallyReactive(arg, signalNames, importedIds));\n }\n\n if (t.isIdentifier(expr)) {\n return isSignalIdentifier(expr.name, signalNames) ||\n (importedIds && importedIds.has(expr.name));\n }\n\n if (t.isMemberExpression(expr)) {\n return isPotentiallyReactive(expr.object, signalNames, importedIds);\n }\n\n if (t.isConditionalExpression(expr)) {\n return isPotentiallyReactive(expr.test, signalNames, importedIds) ||\n isPotentiallyReactive(expr.consequent, signalNames, importedIds) ||\n isPotentiallyReactive(expr.alternate, signalNames, importedIds);\n }\n\n if (t.isBinaryExpression(expr) || t.isLogicalExpression(expr)) {\n return isPotentiallyReactive(expr.left, signalNames, importedIds) ||\n isPotentiallyReactive(expr.right, signalNames, importedIds);\n }\n\n if (t.isUnaryExpression(expr)) {\n return isPotentiallyReactive(expr.argument, signalNames, importedIds);\n }\n\n if (t.isTemplateLiteral(expr)) {\n return expr.expressions.some(e => isPotentiallyReactive(e, signalNames, importedIds));\n }\n\n if (t.isObjectExpression(expr)) {\n return expr.properties.some(prop =>\n t.isObjectProperty(prop) && isPotentiallyReactive(prop.value, signalNames, importedIds)\n );\n }\n\n if (t.isArrayExpression(expr)) {\n return expr.elements.some(el => el && isPotentiallyReactive(el, signalNames, importedIds));\n }\n\n if (t.isArrowFunctionExpression(expr) || t.isFunctionExpression(expr)) {\n // Function expressions are not reactive themselves \u2014 they're callbacks\n return false;\n }\n\n return false;\n }\n\n // --- Auto-lower .map() to mapArray ---\n // Detects: source().map((item) => <Comp key={expr} .../>)\n // or wrapped in an arrow: () => source().map(...)\n // Also walks into ternary (cond ? a.map(...) : fallback) and\n // logical (cond && a.map(...)) expressions so React-style\n // conditional list patterns get keyed reconciliation.\n // Produces: _$mapArray(source, (item) => <Comp .../>, { key: item => expr })\n function tryLowerMapToMapArray(expr, state) {\n // Unwrap arrow function: () => source().map(...)\n let mapCall = expr;\n let wrappedInArrow = false;\n if (t.isArrowFunctionExpression(expr) && expr.params.length === 0) {\n mapCall = expr.body;\n wrappedInArrow = true;\n }\n\n // Walk into ternary: cond ? arr().map(...) : fallback\n if (t.isConditionalExpression(mapCall)) {\n const loweredCon = tryLowerMapCall(mapCall.consequent, state);\n const loweredAlt = tryLowerMapCall(mapCall.alternate, state);\n if (loweredCon || loweredAlt) {\n const result = t.conditionalExpression(\n mapCall.test,\n loweredCon || mapCall.consequent,\n loweredAlt || mapCall.alternate\n );\n return wrappedInArrow ? t.arrowFunctionExpression([], result) : result;\n }\n return null;\n }\n\n // Walk into logical: cond && arr().map(...)\n if (t.isLogicalExpression(mapCall) && (mapCall.operator === '&&' || mapCall.operator === '||')) {\n const loweredRight = tryLowerMapCall(mapCall.right, state);\n if (loweredRight) {\n const result = t.logicalExpression(mapCall.operator, mapCall.left, loweredRight);\n return wrappedInArrow ? t.arrowFunctionExpression([], result) : result;\n }\n return null;\n }\n\n // Direct .map() call\n const lowered = tryLowerMapCall(mapCall, state);\n return lowered;\n }\n\n // Core .map() lowering \u2014 extracted so it can be called per-branch\n function tryLowerMapCall(mapCall, state) {\n // Check: something.map(fn)\n if (!t.isCallExpression(mapCall)) return null;\n if (!t.isMemberExpression(mapCall.callee)) return null;\n if (!t.isIdentifier(mapCall.callee.property, { name: 'map' })) return null;\n if (mapCall.arguments.length < 1) return null;\n\n const mapFn = mapCall.arguments[0];\n if (!t.isArrowFunctionExpression(mapFn) && !t.isFunctionExpression(mapFn)) return null;\n\n // Get the map callback's return expression\n let returnExpr = null;\n if (t.isArrowFunctionExpression(mapFn)) {\n if (t.isExpression(mapFn.body)) {\n returnExpr = mapFn.body;\n } else if (t.isBlockStatement(mapFn.body)) {\n const ret = mapFn.body.body.find(s => t.isReturnStatement(s));\n if (ret) returnExpr = ret.argument;\n }\n } else if (t.isFunctionExpression(mapFn)) {\n const ret = mapFn.body.body.find(s => t.isReturnStatement(s));\n if (ret) returnExpr = ret.argument;\n }\n\n if (!returnExpr) return null;\n\n // Check if the return is JSX with a `key` prop\n if (!t.isJSXElement(returnExpr)) return null;\n const attrs = returnExpr.openingElement.attributes;\n let keyAttr = null;\n for (const attr of attrs) {\n if (t.isJSXAttribute(attr) && getAttrName(attr) === 'key') {\n keyAttr = attr;\n break;\n }\n }\n if (!keyAttr) {\n // JSX returned without a key \u2014 bail out, but warn at compile time so\n // users notice they're missing keyed reconciliation. Only warn in dev\n // (production builds are noiseless).\n if (process.env.NODE_ENV !== 'production') {\n const loc = returnExpr.loc;\n const fileName = state.filename || state.file?.opts?.filename || '<unknown>';\n const lineInfo = loc ? `:${loc.start.line}:${loc.start.column}` : '';\n console.warn(\n `[what-compiler] .map() returning JSX without a \\`key\\` prop at ${fileName}${lineInfo}. ` +\n `Without a key, the list cannot use keyed reconciliation \u2014 items are re-created on every update. ` +\n `Add key={...} to enable efficient updates.`\n );\n }\n return null;\n }\n\n // Extract the key expression\n const keyValue = getAttributeValue(keyAttr.value);\n if (!keyValue) return null;\n\n // Remove the key prop from the JSX element (mapArray handles keying, not the DOM)\n returnExpr.openingElement.attributes = attrs.filter(a => a !== keyAttr);\n\n // Build the source: the object before .map() \u2014 wrap in an arrow for reactive access\n const sourceObj = mapCall.callee.object;\n const source = t.arrowFunctionExpression([], sourceObj);\n\n // Build the key function: (item) => keyExpr.\n // Clone both the parameter and the key expression \u2014 the parameter is shared\n // with the user's map callback AST and keyValue may be referenced elsewhere\n // in the tree. Cloning insulates this new arrow from later mutations.\n const itemParam = mapFn.params[0] ? t.cloneNode(mapFn.params[0], true) : t.identifier('_item');\n const keyFn = t.arrowFunctionExpression([itemParam], t.cloneNode(keyValue, true));\n\n // Build: _$mapArray(source, mapFn, { key: keyFn, raw: true })\n // raw: true means mapFn receives the raw item value (not a signal accessor),\n // matching user-authored .map() semantics where `item.prop` accesses values directly.\n return t.callExpression(t.identifier('_$mapArray'), [\n source,\n mapFn,\n t.objectExpression([\n t.objectProperty(t.identifier('key'), keyFn),\n t.objectProperty(t.identifier('raw'), t.booleanLiteral(true))\n ])\n ]);\n }\n\n // =====================================================\n // Fine-Grained Mode (template + insert + effect)\n // =====================================================\n\n // Check if a JSX child is static (no expressions)\n function isStaticChild(child) {\n if (t.isJSXText(child)) return true;\n if (t.isJSXExpressionContainer(child)) return false;\n if (t.isJSXElement(child)) {\n const el = child.openingElement;\n const tagName = el.name.name;\n if (isComponent(tagName)) return false;\n for (const attr of el.attributes) {\n if (t.isJSXSpreadAttribute(attr)) return false;\n const value = attr.value;\n if (t.isJSXExpressionContainer(value)) return false;\n }\n return child.children.every(isStaticChild);\n }\n return false;\n }\n\n // Check if an attribute value is dynamic\n function isDynamicAttr(attr) {\n if (t.isJSXSpreadAttribute(attr)) return true;\n if (!attr.value) return false;\n return t.isJSXExpressionContainer(attr.value);\n }\n\n // Extract static HTML from JSX element for template()\n function extractStaticHTML(node) {\n if (t.isJSXText(node)) {\n const text = normalizeJsxText(node.value);\n return text ? escapeHTML(text) : '';\n }\n\n if (t.isJSXExpressionContainer(node)) {\n if (t.isJSXEmptyExpression(node.expression)) return '';\n return '<!--$-->';\n }\n\n if (!t.isJSXElement(node)) return '';\n\n const el = node.openingElement;\n const tagName = el.name.name;\n\n if (isComponent(tagName)) return '';\n\n let html = `<${tagName}`;\n\n for (const attr of el.attributes) {\n if (t.isJSXSpreadAttribute(attr)) continue;\n const name = getAttrName(attr);\n if (name === 'key') continue;\n if (name.startsWith('on') || name.startsWith('bind:') || name.includes('|')) continue;\n\n let domName = name;\n if (name === 'className') domName = 'class';\n if (name === 'htmlFor') domName = 'for';\n\n if (!attr.value) {\n html += ` ${domName}`;\n } else if (t.isStringLiteral(attr.value)) {\n html += ` ${domName}=\"${escapeAttr(attr.value.value)}\"`;\n } else if (t.isJSXExpressionContainer(attr.value)) {\n continue; // Dynamic attr \u2014 set via effect\n }\n }\n\n const selfClosing = node.openingElement.selfClosing;\n if (selfClosing && isVoidHtmlElement(tagName)) {\n html += '>';\n return html;\n }\n\n if (selfClosing) {\n html += `></${tagName}>`;\n return html;\n }\n\n html += '>';\n\n for (const child of node.children) {\n if (t.isJSXText(child)) {\n const text = normalizeJsxText(child.value);\n if (text) html += escapeHTML(text);\n } else if (t.isJSXExpressionContainer(child)) {\n if (!t.isJSXEmptyExpression(child.expression)) {\n html += '<!--$-->';\n }\n } else if (t.isJSXElement(child)) {\n if (isComponent(child.openingElement.name.name)) {\n html += '<!--$-->';\n } else {\n html += extractStaticHTML(child);\n }\n }\n }\n\n html += `</${tagName}>`;\n return html;\n }\n\n function escapeHTML(str) {\n return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\n }\n\n function escapeAttr(str) {\n return str.replace(/&/g, '&amp;').replace(/\"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\n }\n\n // Analyze JSX tree and generate fine-grained output\n function transformElementFineGrained(path, state) {\n const { node } = path;\n const openingElement = node.openingElement;\n const tagName = openingElement.name.name;\n\n // Control flow components \u2014 check before generic isComponent since they start uppercase\n if (tagName === 'For') {\n return transformForFineGrained(path, state);\n }\n if (tagName === 'Show') {\n return transformShowFineGrained(path, state);\n }\n\n if (isComponent(tagName)) {\n return transformComponentFineGrained(path, state);\n }\n\n const attributes = openingElement.attributes;\n const children = node.children;\n\n // Check if this entire subtree is purely static\n const allChildrenStatic = children.every(isStaticChild);\n const allAttrsStatic = attributes.every(attr => !isDynamicAttr(attr));\n const noEvents = attributes.every(attr => {\n if (t.isJSXSpreadAttribute(attr)) return false;\n const name = getAttrName(attr);\n return !name?.startsWith('on') && !name?.startsWith('bind:');\n });\n\n if (allChildrenStatic && allAttrsStatic && noEvents) {\n // Fully static element \u2014 extract to template, return clone call\n const html = extractStaticHTML(node);\n if (html) {\n const tmplId = getOrCreateTemplate(state, html);\n state.needsTemplate = true;\n return t.callExpression(t.identifier(tmplId), []);\n }\n }\n\n // Mixed static/dynamic element \u2014 extract template, add effects for dynamic parts\n const html = extractStaticHTML(node);\n if (!html) {\n // Template extraction failed \u2014 emit a detailed compile warning and use h() as fallback\n const loc = node.loc;\n const fileName = state.filename || state.file?.opts?.filename || '<unknown>';\n const lineInfo = loc ? `:${loc.start.line}:${loc.start.column}` : '';\n console.warn(\n `[what-compiler] Could not extract template for <${tagName}> at ${fileName}${lineInfo}. ` +\n `Falling back to h() for this element. ` +\n `This element could not be statically analyzed. Consider simplifying the JSX.`\n );\n state.needsH = true;\n return transformElementAsH(path, state);\n }\n\n const tmplId = getOrCreateTemplate(state, html);\n state.needsTemplate = true;\n\n const elId = state.nextVarId();\n\n // Build statements: _el$ = _tmpl$1()\n // NO IIFE wrapping \u2014 statements are inlined into the containing function\n const statements = [\n t.variableDeclaration('const', [\n t.variableDeclarator(t.identifier(elId), t.callExpression(t.identifier(tmplId), []))\n ])\n ];\n\n // Apply dynamic attributes and events\n applyDynamicAttrs(statements, elId, attributes, state);\n\n // Handle dynamic children\n applyDynamicChildren(statements, elId, children, node, state);\n\n // Instead of wrapping in an IIFE, store setup statements for hoisting.\n // The JSXElement visitor will insert them before the enclosing statement.\n if (!state._pendingSetup) state._pendingSetup = [];\n state._pendingSetup.push(...statements);\n return t.identifier(elId);\n }\n\n // Fallback: transform element using h() when template extraction fails\n function transformElementAsH(path, state) {\n const { node } = path;\n const openingElement = node.openingElement;\n const tagName = openingElement.name.name;\n const attributes = openingElement.attributes;\n const children = node.children;\n\n const props = [];\n for (const attr of attributes) {\n if (t.isJSXSpreadAttribute(attr)) continue;\n const attrName = getAttrName(attr);\n const value = getAttributeValue(attr.value);\n let domAttrName = normalizeAttrName(attrName);\n props.push(\n t.objectProperty(\n /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(domAttrName)\n ? t.identifier(domAttrName)\n : t.stringLiteral(domAttrName),\n value\n )\n );\n }\n\n const transformedChildren = [];\n for (const child of children) {\n if (t.isJSXText(child)) {\n const text = normalizeJsxText(child.value);\n if (text) transformedChildren.push(t.stringLiteral(text));\n } else if (t.isJSXExpressionContainer(child)) {\n if (!t.isJSXEmptyExpression(child.expression)) {\n transformedChildren.push(child.expression);\n }\n } else if (t.isJSXElement(child)) {\n transformedChildren.push(transformElementFineGrained({ node: child }, state));\n } else if (t.isJSXFragment(child)) {\n transformedChildren.push(transformFragmentFineGrained({ node: child }, state));\n }\n }\n\n const propsExpr = props.length > 0 ? t.objectExpression(props) : t.nullLiteral();\n return t.callExpression(t.identifier('h'), [t.stringLiteral(tagName), propsExpr, ...transformedChildren]);\n }\n\n function applyDynamicAttrs(statements, elId, attributes, state) {\n function buildSetPropCall(propName, valueExpr) {\n state.needsSetProp = true;\n return t.callExpression(t.identifier('_$setProp'), [\n t.identifier(elId),\n t.stringLiteral(propName),\n valueExpr\n ]);\n }\n\n for (const attr of attributes) {\n if (t.isJSXSpreadAttribute(attr)) {\n state.needsSpread = true;\n statements.push(\n t.expressionStatement(\n t.callExpression(t.identifier('_$spread'), [t.identifier(elId), attr.argument])\n )\n );\n continue;\n }\n\n const attrName = getAttrName(attr);\n\n // Strip key prop \u2014 WhatFW has no virtual DOM, so key is meaningless (issue #6)\n if (attrName === 'key') continue;\n\n // Ref handling \u2014 assign element to ref object/callback\n if (attrName === 'ref') {\n const refExpr = getAttributeValue(attr.value);\n // Generate: typeof ref === 'function' ? ref(el) : ref.current = el\n statements.push(\n t.expressionStatement(\n t.conditionalExpression(\n t.binaryExpression('===',\n t.unaryExpression('typeof', refExpr),\n t.stringLiteral('function')\n ),\n t.callExpression(t.cloneNode(refExpr), [t.identifier(elId)]),\n t.assignmentExpression('=',\n t.memberExpression(t.cloneNode(refExpr), t.identifier('current')),\n t.identifier(elId)\n )\n )\n )\n );\n continue;\n }\n\n // Event handlers\n if (attrName.startsWith('on') && !attrName.includes('|') && !hasEventModifiers(attrName, state)) {\n const event = attrName.slice(2).toLowerCase();\n const handler = getAttributeValue(attr.value);\n\n if (DELEGATED_EVENTS.has(event)) {\n // Use event delegation: el.$$click = handler (matches runtime lookup)\n state.needsDelegation = true;\n if (!state.delegatedEvents) state.delegatedEvents = new Set();\n state.delegatedEvents.add(event);\n statements.push(\n t.expressionStatement(\n t.assignmentExpression('=',\n t.memberExpression(\n t.identifier(elId),\n t.identifier(`$$${event}`)\n ),\n handler\n )\n )\n );\n } else {\n // Non-delegated: use per-element addEventListener\n statements.push(\n t.expressionStatement(\n t.callExpression(\n t.memberExpression(t.identifier(elId), t.identifier('addEventListener')),\n [t.stringLiteral(event), handler]\n )\n )\n );\n }\n continue;\n }\n\n // Event with modifiers (pipe '|' or JSX-safe double underscore '__')\n if (attrName.startsWith('on') && (attrName.includes('|') || hasEventModifiers(attrName, state))) {\n const { eventName, modifiers } = parseEventModifiers(attrName);\n const handler = getAttributeValue(attr.value);\n const wrappedHandler = createEventHandler(handler, modifiers);\n const event = eventName.slice(2).toLowerCase();\n\n const optionMods = modifiers.filter(m => EVENT_OPTION_MODIFIERS.has(m));\n const addEventArgs = [t.stringLiteral(event), wrappedHandler];\n if (optionMods.length > 0) {\n const optsProps = optionMods.map(m =>\n t.objectProperty(t.identifier(m), t.booleanLiteral(true))\n );\n addEventArgs.push(t.objectExpression(optsProps));\n }\n\n statements.push(\n t.expressionStatement(\n t.callExpression(\n t.memberExpression(t.identifier(elId), t.identifier('addEventListener')),\n addEventArgs\n )\n )\n );\n continue;\n }\n\n // Binding\n if (isBindingAttribute(attrName)) {\n const bindProp = getBindingProperty(attrName);\n const signalExpr = attr.value.expression;\n state.needsEffect = true;\n\n if (bindProp === 'value') {\n statements.push(\n t.expressionStatement(\n t.callExpression(t.identifier('_$effect'), [\n t.arrowFunctionExpression([], t.assignmentExpression('=',\n t.memberExpression(t.identifier(elId), t.identifier('value')),\n t.callExpression(t.cloneNode(signalExpr), [])\n ))\n ])\n )\n );\n statements.push(\n t.expressionStatement(\n t.callExpression(\n t.memberExpression(t.identifier(elId), t.identifier('addEventListener')),\n [\n t.stringLiteral('input'),\n t.arrowFunctionExpression(\n [t.identifier('e')],\n t.callExpression(\n t.memberExpression(t.cloneNode(signalExpr), t.identifier('set')),\n [t.memberExpression(\n t.memberExpression(t.identifier('e'), t.identifier('target')),\n t.identifier('value')\n )]\n )\n )\n ]\n )\n )\n );\n } else if (bindProp === 'checked') {\n state.needsEffect = true;\n statements.push(\n t.expressionStatement(\n t.callExpression(t.identifier('_$effect'), [\n t.arrowFunctionExpression([], t.assignmentExpression('=',\n t.memberExpression(t.identifier(elId), t.identifier('checked')),\n t.callExpression(t.cloneNode(signalExpr), [])\n ))\n ])\n )\n );\n statements.push(\n t.expressionStatement(\n t.callExpression(\n t.memberExpression(t.identifier(elId), t.identifier('addEventListener')),\n [\n t.stringLiteral('change'),\n t.arrowFunctionExpression(\n [t.identifier('e')],\n t.callExpression(\n t.memberExpression(t.cloneNode(signalExpr), t.identifier('set')),\n [t.memberExpression(\n t.memberExpression(t.identifier('e'), t.identifier('target')),\n t.identifier('checked')\n )]\n )\n )\n ]\n )\n )\n );\n }\n continue;\n }\n\n // Dynamic attribute (expression)\n if (t.isJSXExpressionContainer(attr.value)) {\n const expr = attr.value.expression;\n const domName = normalizeAttrName(attrName);\n\n if (isPotentiallyReactive(expr, state.signalNames, state.importedIdentifiers)) {\n state.needsEffect = true;\n // Auto-invoke bare signal/imported identifiers: value={name} -> name()\n const valueExpr = t.isIdentifier(expr) &&\n (isSignalIdentifier(expr.name, state.signalNames) ||\n (state.importedIdentifiers && state.importedIdentifiers.has(expr.name)))\n ? t.callExpression(expr, [])\n : expr;\n const effectCall = t.callExpression(t.identifier('_$effect'), [\n t.arrowFunctionExpression([], buildSetPropCall(domName, valueExpr))\n ]);\n // In dev mode, add a leading comment when the effect wrapping is uncertain\n // (non-signal function call whose args happen to contain signal reads)\n if (isUncertainReactive(expr, state.signalNames, state.importedIdentifiers)) {\n t.addComment(effectCall, 'leading',\n ' @what-dev: effect wrapping may be unnecessary \u2014 expression contains a non-signal function call with reactive args ',\n false\n );\n }\n statements.push(t.expressionStatement(effectCall));\n } else {\n // Static expression (no signal calls) \u2014 set once\n statements.push(t.expressionStatement(buildSetPropCall(domName, expr)));\n }\n }\n }\n }\n\n function applyDynamicChildren(statements, elId, children, parentNode, state) {\n // Two-pass approach: first collect all children needing DOM references,\n // then pre-capture markers before any _$insert() calls shift indices.\n // This fixes issue #1: childNodes index shifting with multiple dynamic children.\n\n // --- Pass 1: Scan children and collect entries ---\n const entries = [];\n let childIndex = 0;\n\n for (const child of children) {\n if (t.isJSXText(child)) {\n const text = normalizeJsxText(child.value);\n if (text) childIndex++;\n continue;\n }\n\n if (t.isJSXExpressionContainer(child)) {\n if (t.isJSXEmptyExpression(child.expression)) continue;\n entries.push({ type: 'expression', child, childIndex });\n childIndex++;\n continue;\n }\n\n if (t.isJSXElement(child)) {\n const childTag = child.openingElement.name.name;\n if (isComponent(childTag) || childTag === 'For' || childTag === 'Show') {\n entries.push({ type: 'component', child, childIndex });\n childIndex++;\n } else {\n const hasAnythingDynamic = child.openingElement.attributes.some(isDynamicAttr) ||\n child.openingElement.attributes.some(a => !t.isJSXSpreadAttribute(a) && getAttrName(a)?.startsWith('on')) ||\n !child.children.every(isStaticChild);\n\n entries.push({ type: 'static', child, childIndex, hasAnythingDynamic });\n childIndex++;\n }\n continue;\n }\n\n if (t.isJSXFragment(child)) {\n entries.push({ type: 'fragment', child });\n }\n }\n\n // --- Pre-capture marker references if needed ---\n // When there are multiple entries needing DOM refs and at least one _$insert(),\n // capture all markers upfront to avoid index shifting after DOM mutations.\n const entriesNeedingRef = entries.filter(e =>\n e.type === 'expression' || e.type === 'component' ||\n (e.type === 'static' && e.hasAnythingDynamic)\n );\n // Pre-capture whenever 2+ children need a DOM ref. Beyond preventing index\n // shift after insert() mutations, the shared O(n) cursor walk below replaces\n // per-child `el.firstChild.nextSibling\u2026`-from-root access, which was O(n\u00B2) in\n // both compile time and emitted size for elements with many dynamic\n // children. (AUDIT-2026-06-06 H2)\n const needsPreCapture = entriesNeedingRef.length >= 2;\n\n const markerVars = new Map(); // childIndex \u2192 variable name\n if (needsPreCapture) {\n // Chain each marker from the PREVIOUS captured cursor instead of\n // re-walking `el.firstChild.nextSibling\u2026` from the root for every child.\n // entriesNeedingRef is in ascending childIndex order, so the per-marker\n // deltas sum to O(n) total instead of O(n\u00B2). This was the dominant\n // quadratic in compile time and emitted-bundle size for large elements.\n // (AUDIT-2026-06-06 H2)\n let prevVar = null;\n let prevIndex = 0;\n for (const entry of entriesNeedingRef) {\n const idx = entry.childIndex;\n const markerVar = state.nextVarId();\n markerVars.set(idx, markerVar);\n let init;\n if (prevVar === null) {\n init = buildChildAccess(elId, idx);\n } else {\n init = t.identifier(prevVar);\n for (let i = prevIndex; i < idx; i++) {\n init = t.memberExpression(init, t.identifier('nextSibling'));\n }\n }\n statements.push(\n t.variableDeclaration('const', [\n t.variableDeclarator(t.identifier(markerVar), init)\n ])\n );\n prevVar = markerVar;\n prevIndex = idx;\n }\n }\n\n // Helper: get a marker reference (pre-captured var or inline access)\n function getMarker(idx) {\n if (markerVars.has(idx)) {\n return t.identifier(markerVars.get(idx));\n }\n return buildChildAccess(elId, idx);\n }\n\n // --- Pass 2: Generate code using stable references ---\n for (const entry of entries) {\n if (entry.type === 'expression') {\n let expr = entry.child.expression;\n const marker = getMarker(entry.childIndex);\n state.needsInsert = true;\n\n // Auto-lower .map() to mapArray when the callback returns keyed JSX.\n // Pattern: source().map(item => <Comp key={...} />) or source().map((item, i) => ...)\n const mapResult = tryLowerMapToMapArray(expr, state);\n if (mapResult) {\n state.needsMapArray = true;\n // A bare _$mapArray(...) call is a self-managing inserter (it tracks\n // its source internally) and an arrow is already reactive \u2014 pass both\n // raw. But when lowering produced a ternary/logical wrapping the call\n // (e.g. cond ? _$mapArray(...) : fallback), the surrounding condition\n // must stay reactive, so wrap the whole expression in () => and let\n // _$insert re-evaluate it on change. Without this the condition is read\n // exactly once and never re-tracks. (AUDIT-2026-06-06 H1)\n const isBareMapArray = t.isCallExpression(mapResult) && t.isIdentifier(mapResult.callee) &&\n (mapResult.callee.name === '_$mapArray' || mapResult.callee.name === 'mapArray');\n const isArrowAlready = t.isArrowFunctionExpression(mapResult);\n const insertArg = (isBareMapArray || isArrowAlready)\n ? mapResult\n : t.arrowFunctionExpression([], mapResult);\n statements.push(\n t.expressionStatement(\n t.callExpression(t.identifier('_$insert'), [\n t.identifier(elId),\n insertArg,\n marker\n ])\n )\n );\n continue;\n }\n\n // mapArray() calls return self-managing inserters \u2014 pass directly, never wrap in () =>\n const isMapArrayCall = t.isCallExpression(expr) && t.isIdentifier(expr.callee) &&\n (expr.callee.name === 'mapArray' || expr.callee.name === '_$mapArray');\n if (isMapArrayCall) {\n state.needsMapArray = true;\n if (expr.callee.name === 'mapArray') expr.callee.name = '_$mapArray';\n statements.push(\n t.expressionStatement(\n t.callExpression(t.identifier('_$insert'), [\n t.identifier(elId),\n expr,\n marker\n ])\n )\n );\n continue;\n }\n\n if (isPotentiallyReactive(expr, state.signalNames, state.importedIdentifiers)) {\n const insertCall = t.callExpression(t.identifier('_$insert'), [\n t.identifier(elId),\n t.arrowFunctionExpression([], expr),\n marker\n ]);\n if (isUncertainReactive(expr, state.signalNames, state.importedIdentifiers)) {\n t.addComment(insertCall, 'leading',\n ' @what-dev: reactive wrapping may be unnecessary \u2014 expression contains a non-signal function call with reactive args ',\n false\n );\n }\n statements.push(t.expressionStatement(insertCall));\n } else {\n statements.push(\n t.expressionStatement(\n t.callExpression(t.identifier('_$insert'), [\n t.identifier(elId),\n expr,\n marker\n ])\n )\n );\n }\n continue;\n }\n\n if (entry.type === 'component') {\n const transformed = transformElementFineGrained({ node: entry.child }, state);\n const marker = getMarker(entry.childIndex);\n state.needsInsert = true;\n statements.push(\n t.expressionStatement(\n t.callExpression(t.identifier('_$insert'), [\n t.identifier(elId),\n transformed,\n marker\n ])\n )\n );\n continue;\n }\n\n if (entry.type === 'static' && entry.hasAnythingDynamic) {\n // Static child with dynamic content \u2014 get element reference\n let childElRef;\n if (markerVars.has(entry.childIndex)) {\n childElRef = markerVars.get(entry.childIndex);\n } else {\n childElRef = state.nextVarId();\n statements.push(\n t.variableDeclaration('const', [\n t.variableDeclarator(\n t.identifier(childElRef),\n buildChildAccess(elId, entry.childIndex)\n )\n ])\n );\n }\n applyDynamicAttrs(statements, childElRef, entry.child.openingElement.attributes, state);\n applyDynamicChildren(statements, childElRef, entry.child.children, entry.child, state);\n continue;\n }\n\n if (entry.type === 'fragment') {\n for (const fChild of entry.child.children) {\n if (t.isJSXExpressionContainer(fChild) && !t.isJSXEmptyExpression(fChild.expression)) {\n state.needsInsert = true;\n const expr = fChild.expression;\n if (isPotentiallyReactive(expr, state.signalNames, state.importedIdentifiers)) {\n statements.push(\n t.expressionStatement(\n t.callExpression(t.identifier('_$insert'), [\n t.identifier(elId),\n t.arrowFunctionExpression([], expr)\n ])\n )\n );\n } else {\n statements.push(\n t.expressionStatement(\n t.callExpression(t.identifier('_$insert'), [\n t.identifier(elId),\n expr\n ])\n )\n );\n }\n }\n }\n }\n }\n }\n\n function buildChildAccess(elId, index) {\n // Use firstChild/nextSibling chains instead of childNodes[N]\n // This is more robust with whitespace text nodes\n if (index === 0) {\n return t.memberExpression(t.identifier(elId), t.identifier('firstChild'));\n }\n // Chain .nextSibling for subsequent indices\n let expr = t.memberExpression(t.identifier(elId), t.identifier('firstChild'));\n for (let i = 0; i < index; i++) {\n expr = t.memberExpression(expr, t.identifier('nextSibling'));\n }\n return expr;\n }\n\n function transformComponentFineGrained(path, state) {\n const { node } = path;\n const openingElement = node.openingElement;\n const componentName = openingElement.name.name;\n const attributes = openingElement.attributes;\n const children = node.children;\n\n // Check for client: directive (islands)\n let clientDirective = null;\n const filteredAttrs = [];\n\n for (const attr of attributes) {\n if (t.isJSXAttribute(attr)) {\n // Handle both simple names and namespaced names (client:idle)\n let name;\n if (t.isJSXNamespacedName(attr.name)) {\n name = `${attr.name.namespace.name}:${attr.name.name.name}`;\n } else {\n name = attr.name.name;\n }\n if (name && typeof name === 'string' && name.startsWith('client:')) {\n const mode = name.slice(7);\n if (attr.value) {\n clientDirective = { type: mode, value: attr.value.value };\n } else {\n clientDirective = { type: mode };\n }\n continue;\n }\n }\n filteredAttrs.push(attr);\n }\n\n if (clientDirective) {\n state.needsCreateComponent = true;\n state.needsIsland = true;\n\n const islandProps = [\n t.objectProperty(t.identifier('component'), t.identifier(componentName)),\n t.objectProperty(t.identifier('mode'), t.stringLiteral(clientDirective.type)),\n ];\n\n if (clientDirective.value) {\n islandProps.push(\n t.objectProperty(t.identifier('mediaQuery'), t.stringLiteral(clientDirective.value))\n );\n }\n\n for (const attr of filteredAttrs) {\n if (t.isJSXSpreadAttribute(attr)) continue;\n const attrName = getAttrName(attr);\n const value = getAttributeValue(attr.value);\n islandProps.push(t.objectProperty(t.identifier(attrName), value));\n }\n\n return t.callExpression(\n t.identifier('_$createComponent'),\n [t.identifier('Island'), t.objectExpression(islandProps), t.arrayExpression([])]\n );\n }\n\n // Regular component \u2014 use _$createComponent to instantiate, component runs once\n state.needsCreateComponent = true;\n\n const props = [];\n let hasSpread = false;\n let spreadExpr = null;\n\n for (const attr of filteredAttrs) {\n if (t.isJSXSpreadAttribute(attr)) {\n hasSpread = true;\n spreadExpr = attr.argument;\n continue;\n }\n\n const attrName = getAttrName(attr);\n\n // Strip key prop \u2014 WhatFW has no virtual DOM, so key is meaningless (issue #6)\n if (attrName === 'key') continue;\n\n // Handle bind: attributes for components\n if (isBindingAttribute(attrName)) {\n const bindProp = getBindingProperty(attrName);\n const signalExpr = attr.value.expression;\n\n if (bindProp === 'value') {\n props.push(\n t.objectProperty(t.identifier('value'), t.callExpression(t.cloneNode(signalExpr), []))\n );\n props.push(\n t.objectProperty(\n t.identifier('onInput'),\n t.arrowFunctionExpression(\n [t.identifier('e')],\n t.callExpression(\n t.memberExpression(t.cloneNode(signalExpr), t.identifier('set')),\n [t.memberExpression(\n t.memberExpression(t.identifier('e'), t.identifier('target')),\n t.identifier('value')\n )]\n )\n )\n )\n );\n } else if (bindProp === 'checked') {\n props.push(\n t.objectProperty(t.identifier('checked'), t.callExpression(t.cloneNode(signalExpr), []))\n );\n props.push(\n t.objectProperty(\n t.identifier('onChange'),\n t.arrowFunctionExpression(\n [t.identifier('e')],\n t.callExpression(\n t.memberExpression(t.cloneNode(signalExpr), t.identifier('set')),\n [t.memberExpression(\n t.memberExpression(t.identifier('e'), t.identifier('target')),\n t.identifier('checked')\n )]\n )\n )\n )\n );\n }\n continue;\n }\n\n // Handle event modifiers on components\n if (attrName.startsWith('on') && (attrName.includes('|') || hasEventModifiers(attrName, state))) {\n const { eventName, modifiers } = parseEventModifiers(attrName);\n const handler = getAttributeValue(attr.value);\n const wrappedHandler = createEventHandler(handler, modifiers);\n props.push(t.objectProperty(t.identifier(eventName), wrappedHandler));\n continue;\n }\n\n const value = getAttributeValue(attr.value);\n\n props.push(\n t.objectProperty(\n /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(attrName)\n ? t.identifier(attrName)\n : t.stringLiteral(attrName),\n value\n )\n );\n }\n\n // Transform children\n const transformedChildren = [];\n for (const child of children) {\n if (t.isJSXText(child)) {\n const text = normalizeJsxText(child.value);\n if (text) transformedChildren.push(t.stringLiteral(text));\n } else if (t.isJSXExpressionContainer(child)) {\n if (!t.isJSXEmptyExpression(child.expression)) {\n transformedChildren.push(child.expression);\n }\n } else if (t.isJSXElement(child)) {\n transformedChildren.push(transformElementFineGrained({ node: child }, state));\n } else if (t.isJSXFragment(child)) {\n transformedChildren.push(transformFragmentFineGrained({ node: child }, state));\n }\n }\n\n let propsExpr;\n if (hasSpread) {\n if (props.length > 0) {\n propsExpr = t.callExpression(\n t.memberExpression(t.identifier('Object'), t.identifier('assign')),\n [t.objectExpression([]), spreadExpr, t.objectExpression(props)]\n );\n } else {\n propsExpr = spreadExpr;\n }\n } else if (props.length > 0) {\n propsExpr = t.objectExpression(props);\n } else {\n propsExpr = t.nullLiteral();\n }\n\n const childrenArray = transformedChildren.length > 0\n ? t.arrayExpression(transformedChildren)\n : t.arrayExpression([]);\n\n return t.callExpression(t.identifier('_$createComponent'), [t.identifier(componentName), propsExpr, childrenArray]);\n }\n\n function transformForFineGrained(path, state) {\n const { node } = path;\n const attributes = node.openingElement.attributes;\n const children = node.children;\n\n // <For each={data} key={item => item.id}>{(item) => <Row />}</For>\n // \u2192 mapArray(data, (item) => ..., { key: item => item.id })\n //\n // NOTE: <For> is supported but .map() with a key prop is the preferred\n // pattern for list rendering. The compiler auto-lowers .map() to\n // _$mapArray with raw mode, which is simpler and matches JS idioms.\n // <For> is useful when you need signal-wrapped item accessors (keyed\n // mode without raw), so that item updates don't recreate DOM nodes.\n if (process.env.NODE_ENV !== 'production') {\n const fileName = state.filename || state.file?.opts?.filename || '<unknown>';\n if (!_forInfoWarned.has(fileName)) {\n _forInfoWarned.add(fileName);\n const loc = node.loc;\n const lineInfo = loc ? `:${loc.start.line}:${loc.start.column}` : '';\n console.info(\n `[what-compiler] <For> at ${fileName}${lineInfo}: consider using .map() with a key prop instead. ` +\n `The compiler auto-lowers .map() to efficient keyed reconciliation. ` +\n `<For> is only needed for signal-wrapped item accessors (advanced).`\n );\n }\n }\n\n let eachExpr = null;\n let keyExpr = null;\n for (const attr of attributes) {\n if (t.isJSXAttribute(attr)) {\n const name = getAttrName(attr);\n if (name === 'each') eachExpr = getAttributeValue(attr.value);\n else if (name === 'key') keyExpr = getAttributeValue(attr.value);\n }\n }\n\n if (!eachExpr) {\n console.warn('[what-compiler] <For> element missing \"each\" attribute.');\n state.needsH = true;\n return transformElementAsH(path, state);\n }\n\n let renderFn = null;\n for (const child of children) {\n if (t.isJSXExpressionContainer(child) && !t.isJSXEmptyExpression(child.expression)) {\n renderFn = child.expression;\n break;\n }\n }\n\n if (!renderFn) {\n console.warn('[what-compiler] <For> element missing render function child.');\n state.needsH = true;\n return transformElementAsH(path, state);\n }\n\n state.needsMapArray = true;\n const args = [eachExpr, renderFn];\n if (keyExpr) {\n args.push(t.objectExpression([\n t.objectProperty(t.identifier('key'), keyExpr)\n ]));\n }\n return t.callExpression(t.identifier('_$mapArray'), args);\n }\n\n function transformShowFineGrained(path, state) {\n // <Show when={cond} fallback={alt}>{content}</Show>\n // \u2192 () => cond() ? content : (fallback || null)\n // This compiles to a reactive expression that insert() wraps in an effect.\n const { node } = path;\n const attributes = node.openingElement.attributes;\n const children = node.children;\n\n let whenExpr = null;\n let fallbackExpr = null;\n for (const attr of attributes) {\n if (t.isJSXAttribute(attr)) {\n const name = getAttrName(attr);\n if (name === 'when') whenExpr = getAttributeValue(attr.value);\n else if (name === 'fallback') fallbackExpr = getAttributeValue(attr.value);\n }\n }\n\n if (!whenExpr) {\n // <Show> without a when prop has no defined semantics \u2014 fail loudly at\n // build time so the user fixes their source instead of seeing runtime\n // confusion. buildCodeFrameError pins the error to the JSX location.\n throw path.buildCodeFrameError(\n '<Show> requires a \"when\" prop. Example: <Show when={isOpen} fallback={null}>...</Show>'\n );\n }\n\n // Extract the content \u2014 either a render function child or static JSX children\n let contentExpr = null;\n for (const child of children) {\n if (t.isJSXExpressionContainer(child) && !t.isJSXEmptyExpression(child.expression)) {\n // Render function: {() => <div>...</div>} or {(value) => <div>{value}</div>}\n contentExpr = child.expression;\n break;\n }\n }\n\n if (!contentExpr) {\n // Static children \u2014 collect and transform them\n const transformedChildren = [];\n for (const child of children) {\n if (t.isJSXText(child)) {\n const text = normalizeJsxText(child.value);\n if (text) transformedChildren.push(t.stringLiteral(text));\n } else if (t.isJSXElement(child)) {\n transformedChildren.push(transformElementFineGrained({ node: child }, state));\n }\n }\n if (transformedChildren.length === 1) {\n contentExpr = transformedChildren[0];\n } else if (transformedChildren.length > 1) {\n contentExpr = t.arrayExpression(transformedChildren);\n } else {\n contentExpr = t.nullLiteral();\n }\n }\n\n // Build:\n // () => { const _v = <condition>; return _v ? <consequent> : <alternate>; }\n // Hoisting into a local prevents double-evaluation of the `when` signal\n // (the consequent's render callback also needs the resolved value).\n //\n // `whenExpr` shape determines how we form the condition:\n // - call expression \u2192 use as-is <Show when={cond()}>\n // - arrow w/ expression body \u2192 use the body <Show when={() => x > 5}>\n // - identifier that looks like a signal/import <Show when={isOpen}>\n // \u2192 invoke it as accessor: isOpen()\n // - anything else (member, literal, logical, etc.) <Show when={user.isAdmin}>\n // \u2192 use the raw expression. Do NOT invoke \u2014\n // non-functions would throw at runtime.\n let condition;\n if (t.isCallExpression(whenExpr)) {\n condition = whenExpr;\n } else if (t.isArrowFunctionExpression(whenExpr) && t.isExpression(whenExpr.body)) {\n condition = whenExpr.body;\n } else if (\n t.isIdentifier(whenExpr) &&\n (\n (state.signalNames && isSignalIdentifier(whenExpr.name, state.signalNames)) ||\n (state.importedIdentifiers && state.importedIdentifiers.has(whenExpr.name))\n )\n ) {\n condition = t.callExpression(whenExpr, []);\n } else {\n // Plain boolean expression \u2014 member access, literal, logical, etc.\n condition = whenExpr;\n }\n\n const vId = path.scope\n ? path.scope.generateUidIdentifier('v')\n : t.identifier('_v');\n\n const consequent = t.isFunction(contentExpr)\n ? t.callExpression(contentExpr, [t.cloneNode(vId)])\n : contentExpr;\n const alternate = fallbackExpr || t.nullLiteral();\n\n return t.arrowFunctionExpression([], t.blockStatement([\n t.variableDeclaration('const', [\n t.variableDeclarator(vId, condition)\n ]),\n t.returnStatement(\n t.conditionalExpression(t.cloneNode(vId), consequent, alternate)\n )\n ]));\n }\n\n function transformFragmentFineGrained(path, state) {\n const { node } = path;\n const children = node.children;\n\n const transformed = [];\n for (const child of children) {\n if (t.isJSXText(child)) {\n const text = normalizeJsxText(child.value);\n if (text) transformed.push(t.stringLiteral(text));\n } else if (t.isJSXExpressionContainer(child)) {\n if (!t.isJSXEmptyExpression(child.expression)) {\n transformed.push(child.expression);\n }\n } else if (t.isJSXElement(child)) {\n transformed.push(transformElementFineGrained({ node: child }, state));\n } else if (t.isJSXFragment(child)) {\n transformed.push(transformFragmentFineGrained({ node: child }, state));\n }\n }\n\n if (transformed.length === 1) return transformed[0];\n return t.arrayExpression(transformed);\n }\n\n // Template deduplication: same HTML string \u2192 same module-level const\n function getOrCreateTemplate(state, html) {\n if (state.templateMap.has(html)) {\n return state.templateMap.get(html);\n }\n const id = `_tmpl$${state.templateCount++}`;\n state.templateMap.set(html, id);\n state.templates.push({ id, html });\n return id;\n }\n\n // =====================================================\n // Plugin entry\n // =====================================================\n\n return {\n name: 'what-jsx-transform',\n\n visitor: {\n Program: {\n enter(path, state) {\n // Fine-grained mode state\n state.needsTemplate = false;\n state.needsInsert = false;\n state.needsEffect = false;\n state.needsMapArray = false;\n state.needsSpread = false;\n state.needsSetProp = false;\n state.needsH = false;\n state.needsCreateComponent = false;\n state.needsFragment = false;\n state.needsIsland = false;\n state.needsDelegation = false;\n state.delegatedEvents = new Set();\n state.templates = [];\n state.templateMap = new Map(); // html \u2192 template id (deduplication)\n state.templateCount = 0;\n state._varCounter = 0;\n state._pendingSetup = [];\n state.nextVarId = () => `_el$${state._varCounter++}`;\n\n // Collect signal names for smart reactivity detection\n state.signalNames = new Set();\n\n // --- Imported Signal Tracking ---\n // Only mark imports as potentially reactive if they come from known\n // reactive sources: what-framework, what-framework/*, relative paths\n // (user stores), or functions matching use*/create* naming conventions.\n // This prevents over-wrapping of utility imports (lodash, etc.).\n state.importedIdentifiers = new Set();\n for (const node of path.node.body) {\n if (t.isImportDeclaration(node)) {\n const source = node.source.value;\n const isReactiveSource =\n source === 'what-framework' ||\n source.startsWith('what-framework/') ||\n source === 'what-core' ||\n source.startsWith('what-core/') ||\n source.startsWith('./') ||\n source.startsWith('../');\n\n for (const spec of node.specifiers) {\n let localName = null;\n if (t.isImportSpecifier(spec) && t.isIdentifier(spec.local)) {\n localName = spec.local.name;\n } else if (t.isImportDefaultSpecifier(spec) && t.isIdentifier(spec.local)) {\n localName = spec.local.name;\n } else if (t.isImportNamespaceSpecifier(spec) && t.isIdentifier(spec.local)) {\n localName = spec.local.name;\n }\n\n if (localName) {\n // Mark as reactive if from a reactive source, or if the name\n // matches use*/create* conventions (hooks/signal creators)\n if (isReactiveSource || /^(use|create)[A-Z]/.test(localName)) {\n state.importedIdentifiers.add(localName);\n }\n }\n }\n }\n }\n\n path.traverse({\n VariableDeclarator(declPath) {\n const init = declPath.node.init;\n if (!init || !t.isCallExpression(init)) return;\n\n const callee = init.callee;\n let calleeName = '';\n if (t.isIdentifier(callee)) {\n calleeName = callee.name;\n } else if (t.isMemberExpression(callee) && t.isIdentifier(callee.property)) {\n calleeName = callee.property.name;\n }\n\n if (SIGNAL_CREATORS.has(calleeName)) {\n const id = declPath.node.id;\n if (t.isIdentifier(id)) {\n state.signalNames.add(id.name);\n } else if (t.isArrayPattern(id)) {\n for (const el of id.elements) {\n if (t.isIdentifier(el)) state.signalNames.add(el.name);\n }\n } else if (t.isObjectPattern(id)) {\n for (const prop of id.properties) {\n if (t.isObjectProperty(prop) && t.isIdentifier(prop.value)) {\n state.signalNames.add(prop.value.name);\n }\n }\n }\n }\n }\n });\n },\n\n exit(path, state) {\n // Insert template declarations at top of program (hoisted to module scope)\n for (const tmpl of state.templates.reverse()) {\n path.unshiftContainer('body',\n t.variableDeclaration('const', [\n t.variableDeclarator(\n t.identifier(tmpl.id),\n t.callExpression(t.identifier('_$template'), [t.stringLiteral(tmpl.html)])\n )\n ])\n );\n }\n\n // Build fine-grained imports\n const fgSpecifiers = [];\n if (state.needsTemplate) {\n fgSpecifiers.push(\n t.importSpecifier(t.identifier('_$template'), t.identifier('template'))\n );\n }\n if (state.needsInsert) {\n fgSpecifiers.push(\n t.importSpecifier(t.identifier('_$insert'), t.identifier('insert'))\n );\n }\n if (state.needsEffect) {\n fgSpecifiers.push(\n t.importSpecifier(t.identifier('_$effect'), t.identifier('effect'))\n );\n }\n if (state.needsMapArray) {\n fgSpecifiers.push(\n t.importSpecifier(t.identifier('_$mapArray'), t.identifier('mapArray'))\n );\n }\n if (state.needsSpread) {\n fgSpecifiers.push(\n t.importSpecifier(t.identifier('_$spread'), t.identifier('spread'))\n );\n }\n if (state.needsSetProp) {\n fgSpecifiers.push(\n t.importSpecifier(t.identifier('_$setProp'), t.identifier('setProp'))\n );\n }\n if (state.needsCreateComponent) {\n fgSpecifiers.push(\n t.importSpecifier(t.identifier('_$createComponent'), t.identifier('_$createComponent'))\n );\n }\n if (state.needsDelegation) {\n fgSpecifiers.push(\n t.importSpecifier(t.identifier('_$delegateEvents'), t.identifier('delegateEvents'))\n );\n }\n\n // Core imports (h/Fragment/Island for components)\n const coreSpecifiers = [];\n if (state.needsH) {\n coreSpecifiers.push(\n t.importSpecifier(t.identifier('h'), t.identifier('h'))\n );\n }\n if (state.needsFragment) {\n coreSpecifiers.push(\n t.importSpecifier(t.identifier('Fragment'), t.identifier('Fragment'))\n );\n }\n if (state.needsIsland) {\n coreSpecifiers.push(\n t.importSpecifier(t.identifier('Island'), t.identifier('Island'))\n );\n }\n\n if (fgSpecifiers.length > 0) {\n let existingRenderImport = null;\n for (const node of path.node.body) {\n if (t.isImportDeclaration(node) && (\n node.source.value === 'what-framework/render' ||\n node.source.value === 'what-core/render'\n )) {\n existingRenderImport = node;\n break;\n }\n }\n\n if (existingRenderImport) {\n const existingNames = new Set(\n existingRenderImport.specifiers\n .filter(s => t.isImportSpecifier(s))\n .map(s => s.imported.name)\n );\n for (const spec of fgSpecifiers) {\n if (!existingNames.has(spec.imported.name)) {\n existingRenderImport.specifiers.push(spec);\n }\n }\n } else {\n path.unshiftContainer('body',\n t.importDeclaration(fgSpecifiers, t.stringLiteral('what-framework/render'))\n );\n }\n }\n\n if (coreSpecifiers.length > 0) {\n addCoreImports(path, t, coreSpecifiers);\n }\n\n // Emit event delegation setup call if any delegated events were used\n if (state.needsDelegation && state.delegatedEvents && state.delegatedEvents.size > 0) {\n const eventArray = t.arrayExpression(\n [...state.delegatedEvents].map(e => t.stringLiteral(e))\n );\n path.pushContainer('body',\n t.expressionStatement(\n t.callExpression(t.identifier('_$delegateEvents'), [eventArray])\n )\n );\n }\n }\n },\n\n JSXElement(path, state) {\n // FIX-1: Use scope-aware signal detection instead of file-global.\n // Memoize per Babel scope: every JSXElement in the same scope yields the\n // same signal-name set, so without this the full scope-chain walk ran\n // once per element \u2014 O(n\u00B2) compile time for a large single component.\n // (AUDIT-2026-06-06 H2)\n const scope = path.scope;\n let cache = state._signalNamesCache;\n if (!cache) cache = state._signalNamesCache = new WeakMap();\n let names = cache.get(scope);\n if (!names) {\n names = collectSignalNamesFromScope(path);\n cache.set(scope, names);\n }\n state.signalNames = names;\n state._pendingSetup = [];\n const transformed = transformElementFineGrained(path, state);\n const pending = state._pendingSetup;\n state._pendingSetup = [];\n\n if (pending.length > 0) {\n // Find the enclosing statement to hoist setup before it,\n // but only if it's in the SAME function scope. Crossing into\n // an inner arrow/function (e.g., .map(item => <JSX/>)) would\n // hoist references to closure variables out of scope.\n let stmtPath = path;\n let crossedFunctionBoundary = false;\n while (stmtPath && !stmtPath.isStatement()) {\n if (stmtPath.isArrowFunctionExpression() || stmtPath.isFunctionExpression()) {\n crossedFunctionBoundary = true;\n }\n stmtPath = stmtPath.parentPath;\n }\n // We can safely hoist setup as siblings of `stmtPath` ONLY if\n // `stmtPath` lives inside a statement list (BlockStatement.body or\n // Program.body). For single-statement positions like\n // `if (cond) return <jsx/>;` or `while (x) return <jsx/>;`,\n // Babel's `insertBefore` wraps the parent into a block lazily and\n // multi-statement inserts end up split across scopes, leaving the\n // `_$insert(_el$N, ...)` call outside the block that declares\n // `const _el$N`. This is a TDZ/ReferenceError at runtime.\n //\n // To guarantee that ALL setup statements and the returned reference\n // share one lexical block, require that `stmtPath.listKey` points\n // at a statement list. Otherwise fall through to the IIFE path,\n // which is always safe.\n const inStatementList =\n stmtPath\n && stmtPath.isStatement()\n && (stmtPath.listKey === 'body' || stmtPath.listKey === 'consequent')\n && Array.isArray(stmtPath.container);\n if (inStatementList && !crossedFunctionBoundary) {\n // Same function scope \u2014 safe to hoist setup before the enclosing\n // statement. Works for return statements too: `insertBefore`\n // places setup above `return <jsx/>` without wrapping in an IIFE.\n stmtPath.insertBefore(pending);\n path.replaceWith(transformed);\n } else {\n // Crossed a function boundary or no enclosing statement found \u2014\n // fall back to IIFE so closure variables remain in scope.\n pending.push(t.returnStatement(transformed));\n path.replaceWith(\n t.callExpression(\n t.arrowFunctionExpression([], t.blockStatement(pending)),\n []\n )\n );\n }\n } else {\n path.replaceWith(transformed);\n }\n },\n\n JSXFragment(path, state) {\n const transformed = transformFragmentFineGrained(path, state);\n path.replaceWith(transformed);\n }\n }\n };\n}\n\nfunction addCoreImports(path, t, coreSpecifiers) {\n let existingImport = null;\n for (const node of path.node.body) {\n if (t.isImportDeclaration(node) && (\n node.source.value === 'what-core' || node.source.value === 'what-framework'\n )) {\n existingImport = node;\n break;\n }\n }\n\n if (existingImport) {\n const existingNames = new Set(\n existingImport.specifiers\n .filter(s => t.isImportSpecifier(s))\n .map(s => s.imported.name)\n );\n for (const spec of coreSpecifiers) {\n if (!existingNames.has(spec.imported.name)) {\n existingImport.specifiers.push(spec);\n }\n }\n } else {\n const importDecl = t.importDeclaration(\n coreSpecifiers,\n t.stringLiteral('what-framework')\n );\n path.unshiftContainer('body', importDecl);\n }\n}\n"],
5
- "mappings": "AAmBA,IAAMA,GAAkB,IAAI,IAAI,CAAC,iBAAkB,kBAAmB,OAAQ,UAAW,UAAW,MAAM,CAAC,EACrGC,GAAyB,IAAI,IAAI,CAAC,OAAQ,UAAW,SAAS,CAAC,EAC/DC,GAAqB,IAAI,IAAI,CACjC,OAAQ,OAAQ,KAAM,MAAO,QAAS,KAAM,MAAO,QACnD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GwK,EAAgB,CAC/C,IAAIU,EAAiB,KACrB,QAAWxG,KAAQ7C,EAAK,KAAK,KAC3B,GAAI7B,EAAE,oBAAoB0E,CAAI,IAC5BA,EAAK,OAAO,QAAU,aAAeA,EAAK,OAAO,QAAU,kBAC1D,CACDwG,EAAiBxG,EACjB,KACF,CAGF,GAAIwG,EAAgB,CAClB,IAAMR,EAAgB,IAAI,IACxBQ,EAAe,WACZ,OAAO5K,GAAKN,EAAE,kBAAkBM,CAAC,CAAC,EAClC,IAAIA,GAAKA,EAAE,SAAS,IAAI,CAC7B,EACA,QAAW6J,KAAQK,EACZE,EAAc,IAAIP,EAAK,SAAS,IAAI,GACvCe,EAAe,WAAW,KAAKf,CAAI,CAGzC,KAAO,CACL,IAAMgB,EAAanL,EAAE,kBACnBwK,EACAxK,EAAE,cAAc,gBAAgB,CAClC,EACA6B,EAAK,iBAAiB,OAAQsJ,CAAU,CAC1C,CACF",
6
- "names": ["EVENT_MODIFIERS", "EVENT_OPTION_MODIFIERS", "VOID_HTML_ELEMENTS", "DELEGATED_EVENTS", "SAFE_GLOBAL_CALLS", "SIGNAL_CREATORS", "normalizeJsxText", "value", "lines", "lastNonEmpty", "i", "out", "line", "isFirst", "isLast", "whatBabelPlugin", "t", "_unknownModifierWarned", "_forInfoWarned", "hasEventModifiers", "name", "state", "s", "parseEventModifiers", "delimiter", "parts", "eventName", "modifiers", "m", "isBindingAttribute", "getBindingProperty", "isComponent", "isVoidHtmlElement", "getAttributeValue", "normalizeAttrName", "attrName", "getAttrName", "attr", "createEventHandler", "handler", "wrappedHandler", "mod", "isSignalIdentifier", "signalNames", "collectSignalNamesFromScope", "path", "extractFromDeclarator", "decl", "init", "callee", "calleeName", "id", "el", "prop", "scope", "binding", "fnNode", "param", "collectSignalNames", "isSafeGlobalCall", "expr", "isUncertainReactive", "importedIds", "arg", "isPotentiallyReactive", "e", "tryLowerMapToMapArray", "mapCall", "wrappedInArrow", "loweredCon", "tryLowerMapCall", "loweredAlt", "result", "loweredRight", "mapFn", "returnExpr", "ret", "attrs", "keyAttr", "keyValue", "a", "sourceObj", "source", "itemParam", "keyFn", "isStaticChild", "child", "tagName", "isDynamicAttr", "extractStaticHTML", "node", "text", "escapeHTML", "html", "domName", "escapeAttr", "selfClosing", "str", "transformElementFineGrained", "openingElement", "transformForFineGrained", "transformShowFineGrained", "transformComponentFineGrained", "attributes", "children", "allChildrenStatic", "allAttrsStatic", "noEvents", "tmplId", "getOrCreateTemplate", "loc", "fileName", "lineInfo", "transformElementAsH", "elId", "statements", "applyDynamicAttrs", "applyDynamicChildren", "props", "domAttrName", "transformedChildren", "transformFragmentFineGrained", "propsExpr", "buildSetPropCall", "propName", "valueExpr", "refExpr", "event", "optionMods", "addEventArgs", "optsProps", "bindProp", "signalExpr", "effectCall", "parentNode", "entries", "childIndex", "childTag", "hasAnythingDynamic", "entriesNeedingRef", "needsPreCapture", "markerVars", "prevVar", "prevIndex", "entry", "idx", "markerVar", "buildChildAccess", "getMarker", "marker", "mapResult", "isBareMapArray", "isArrowAlready", "insertArg", "insertCall", "transformed", "childElRef", "fChild", "index", "componentName", "clientDirective", "filteredAttrs", "mode", "islandProps", "hasSpread", "spreadExpr", "childrenArray", "eachExpr", "keyExpr", "renderFn", "args", "whenExpr", "fallbackExpr", "contentExpr", "condition", "vId", "consequent", "alternate", "isReactiveSource", "spec", "localName", "declPath", "tmpl", "fgSpecifiers", "coreSpecifiers", "existingRenderImport", "existingNames", "addCoreImports", "eventArray", "cache", "names", "pending", "stmtPath", "crossedFunctionBoundary", "existingImport", "importDecl"]
4
+ "sourcesContent": ["/**\n * What Framework Babel Plugin \u2014 Fine-Grained Only\n *\n * JSX \u2192 template() + insert() + effect() calls\n * Static HTML extracted to module-level templates, dynamic expressions wrapped in effects.\n * Components run ONCE. All reactivity is signal-driven.\n *\n * Output:\n * const _tmpl$1 = template('<div class=\"container\"><h1>Title</h1><p></p></div>');\n * function App() {\n * const _el$ = _tmpl$1();\n * insert(_el$.childNodes[1], () => desc());\n * return _el$;\n * }\n *\n * Template calls are hoisted to module scope \u2014 each unique HTML string gets one\n * top-level const. Component functions just clone: `const _el$ = _tmpl$1()`.\n */\n\nconst EVENT_MODIFIERS = new Set(['preventDefault', 'stopPropagation', 'once', 'capture', 'passive', 'self']);\nconst EVENT_OPTION_MODIFIERS = new Set(['once', 'capture', 'passive']);\nconst VOID_HTML_ELEMENTS = new Set([\n 'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input',\n 'link', 'meta', 'param', 'source', 'track', 'wbr'\n]);\n\n// Events that use document-level delegation for performance.\n// The compiler emits `el.$$click = handler` instead of addEventListener.\n// A one-time document listener walks event.target upward to find the handler.\nconst DELEGATED_EVENTS = new Set([\n 'click', 'input', 'change', 'keydown', 'keyup', 'submit',\n 'focusin', 'focusout', 'mousedown', 'mouseup',\n]);\n\n// Known non-reactive call expressions \u2014 these should NOT be wrapped in effects\n// unless their arguments contain signal reads.\nconst SAFE_GLOBAL_CALLS = new Set([\n 'Math', 'Number', 'String', 'Boolean', 'parseInt', 'parseFloat',\n 'isNaN', 'isFinite', 'encodeURIComponent', 'decodeURIComponent',\n 'encodeURI', 'decodeURI', 'JSON', 'Date', 'Array', 'Object',\n 'console', 'RegExp',\n]);\n\n// Known signal-creating functions\nconst SIGNAL_CREATORS = new Set([\n 'useSignal', 'signal', 'computed', 'useComputed', 'useState', 'useReducer',\n 'createResource', 'useSWR', 'useQuery', 'useInfiniteQuery',\n]);\n\n// Normalize JSX text per React/Babel rules:\n// - Split on newlines, treat tabs as spaces.\n// - For interior lines: trim leading and trailing horizontal whitespace.\n// - For the first line: only trim trailing whitespace.\n// - For the last line: only trim leading whitespace.\n// - Skip lines that are entirely whitespace (don't add a separator space).\n// - Join the remaining non-empty lines with single spaces.\n//\n// This preserves leading/trailing single-line whitespace that sits next to\n// an expression like `{count} items` \u2014 without this, the space is eaten and\n// the rendered output reads `5items`.\nfunction normalizeJsxText(value) {\n // Single-line text (no newlines): preserve the original (just tabs->spaces).\n // This keeps the space in cases like `{a} {b}` where the JSXText is \" \".\n if (!/[\\r\\n]/.test(value)) {\n return value.replace(/\\t/g, ' ');\n }\n const lines = value.split(/\\r\\n|\\n|\\r/);\n let lastNonEmpty = -1;\n for (let i = 0; i < lines.length; i++) {\n if (/[^ \\t]/.test(lines[i])) lastNonEmpty = i;\n }\n if (lastNonEmpty === -1) return '';\n let out = '';\n for (let i = 0; i < lines.length; i++) {\n let line = lines[i].replace(/\\t/g, ' ');\n const isFirst = i === 0;\n const isLast = i === lines.length - 1;\n if (!isFirst) line = line.replace(/^ +/, '');\n if (!isLast) line = line.replace(/ +$/, '');\n if (!line) continue;\n if (i !== lastNonEmpty) line += ' ';\n out += line;\n }\n return out;\n}\n\nexport default function whatBabelPlugin({ types: t }) {\n // =====================================================\n // Shared utilities\n // =====================================================\n\n // Warn-once tracking for unknown event modifier segments. Keyed by\n // `${filename}::${segment}` so each typo is reported at most once per file\n // per compile process. Without the filename in the key, the same typo in\n // two different files would silently warn for the first file only \u2014\n // problematic in long-running Vite dev servers.\n const _unknownModifierWarned = new Set();\n const _forInfoWarned = new Set();\n\n function hasEventModifiers(name, state) {\n // Any `__` in an `on*` attribute is intended as modifier syntax \u2014 even\n // if every segment is unknown. Returning false there would emit the\n // attribute as a plain delegated-event property (e.g.\n // `el.$$onclick__totalyWrong = handler`), which never fires. Instead,\n // always route through the modifier-handling branch so the parser can\n // warn about the typo and drop the unknown segments.\n if (!name.includes('__')) return false;\n if (!name.startsWith('on')) return false;\n const parts = name.split('__');\n const tail = parts.slice(1).filter(s => s !== '');\n if (tail.length === 0) return false;\n if (process.env.NODE_ENV !== 'production') {\n const unknown = tail.filter(m => !EVENT_MODIFIERS.has(m));\n const filename = (state && (state.filename || (state.file && state.file.opts && state.file.opts.filename))) || '<unknown>';\n for (const m of unknown) {\n const key = `${filename}::${m}`;\n if (!_unknownModifierWarned.has(key)) {\n _unknownModifierWarned.add(key);\n console.warn(\n `[what-compiler] Unknown event modifier \"__${m}\" in attribute \"${name}\" (${filename}). ` +\n `Known modifiers: ${[...EVENT_MODIFIERS].join(', ')}. ` +\n `Unknown segments are ignored.`\n );\n }\n }\n }\n return true;\n }\n\n function parseEventModifiers(name) {\n // Support both '|' (template strings) and '__' (JSX-safe) as modifier delimiters\n const delimiter = name.includes('|') ? '|' : '__';\n const parts = name.split(delimiter);\n const eventName = parts[0];\n const modifiers = parts.slice(1).filter(m => EVENT_MODIFIERS.has(m));\n return { eventName, modifiers };\n }\n\n function isBindingAttribute(name) {\n return name.startsWith('bind:');\n }\n\n function getBindingProperty(name) {\n return name.slice(5);\n }\n\n function isComponent(name) {\n return /^[A-Z]/.test(name);\n }\n\n function isVoidHtmlElement(name) {\n return VOID_HTML_ELEMENTS.has(String(name).toLowerCase());\n }\n\n function getAttributeValue(value) {\n if (!value) return t.booleanLiteral(true);\n if (t.isJSXExpressionContainer(value)) return value.expression;\n if (t.isStringLiteral(value)) return value;\n return t.stringLiteral(value.value || '');\n }\n\n function normalizeAttrName(attrName) {\n if (attrName === 'className') return 'class';\n if (attrName === 'htmlFor') return 'for';\n return attrName;\n }\n\n // Safely extract attribute name, handling JSXNamespacedName (e.g., client:idle, bind:value)\n function getAttrName(attr) {\n if (t.isJSXNamespacedName(attr.name)) {\n return `${attr.name.namespace.name}:${attr.name.name.name}`;\n }\n return typeof attr.name.name === 'string' ? attr.name.name : String(attr.name.name);\n }\n\n function createEventHandler(handler, modifiers) {\n if (modifiers.length === 0) return handler;\n\n let wrappedHandler = handler;\n\n for (const mod of modifiers) {\n switch (mod) {\n case 'preventDefault':\n wrappedHandler = t.arrowFunctionExpression(\n [t.identifier('e')],\n t.blockStatement([\n t.expressionStatement(\n t.callExpression(\n t.memberExpression(t.identifier('e'), t.identifier('preventDefault')),\n []\n )\n ),\n t.expressionStatement(\n t.callExpression(wrappedHandler, [t.identifier('e')])\n )\n ])\n );\n break;\n\n case 'stopPropagation':\n wrappedHandler = t.arrowFunctionExpression(\n [t.identifier('e')],\n t.blockStatement([\n t.expressionStatement(\n t.callExpression(\n t.memberExpression(t.identifier('e'), t.identifier('stopPropagation')),\n []\n )\n ),\n t.expressionStatement(\n t.callExpression(wrappedHandler, [t.identifier('e')])\n )\n ])\n );\n break;\n\n case 'self':\n wrappedHandler = t.arrowFunctionExpression(\n [t.identifier('e')],\n t.blockStatement([\n t.ifStatement(\n t.binaryExpression(\n '===',\n t.memberExpression(t.identifier('e'), t.identifier('target')),\n t.memberExpression(t.identifier('e'), t.identifier('currentTarget'))\n ),\n t.expressionStatement(\n t.callExpression(wrappedHandler, [t.identifier('e')])\n )\n )\n ])\n );\n break;\n\n case 'once':\n case 'capture':\n case 'passive':\n break;\n }\n }\n\n return wrappedHandler;\n }\n\n // =====================================================\n // Reactivity Detection \u2014 Signal-Aware\n // =====================================================\n\n // Check if an identifier is known to be a signal (from useSignal/signal/computed/useState)\n function isSignalIdentifier(name, signalNames) {\n return signalNames.has(name);\n }\n\n // Collect signal identifiers using Babel's scope analysis.\n // Walks the scope chain from the given path upward, collecting signals\n // defined in each lexical scope (function/block).\n function collectSignalNamesFromScope(path) {\n const signalNames = new Set();\n\n // Helper: extract signal names from a VariableDeclarator node\n function extractFromDeclarator(decl) {\n const init = decl.init;\n if (!init || !t.isCallExpression(init)) return;\n\n const callee = init.callee;\n let calleeName = '';\n if (t.isIdentifier(callee)) {\n calleeName = callee.name;\n } else if (t.isMemberExpression(callee) && t.isIdentifier(callee.property)) {\n calleeName = callee.property.name;\n }\n\n if (SIGNAL_CREATORS.has(calleeName)) {\n const id = decl.id;\n if (t.isIdentifier(id)) {\n signalNames.add(id.name);\n } else if (t.isArrayPattern(id)) {\n for (const el of id.elements) {\n if (t.isIdentifier(el)) signalNames.add(el.name);\n }\n } else if (t.isObjectPattern(id)) {\n for (const prop of id.properties) {\n if (t.isObjectProperty(prop) && t.isIdentifier(prop.value)) {\n signalNames.add(prop.value.name);\n }\n }\n }\n }\n }\n\n // Walk up the scope chain using Babel's scope API.\n let scope = path.scope;\n while (scope) {\n // Check all variable bindings in this scope.\n for (const binding of Object.values(scope.bindings)) {\n if (binding.path.isVariableDeclarator()) {\n extractFromDeclarator(binding.path.node);\n }\n }\n // Scan this scope's own function params (destructured props) ONCE per\n // scope \u2014 not once per binding. The old per-binding rescan made this\n // O(params \u00D7 bindings) per scope per JSXElement. (AUDIT-2026-06-06 H2)\n const fnNode = scope.path && scope.path.node;\n if (fnNode && fnNode.params) {\n for (const param of fnNode.params) {\n if (t.isObjectPattern(param)) {\n for (const prop of param.properties) {\n if (t.isObjectProperty(prop) && t.isIdentifier(prop.value)) {\n signalNames.add(prop.value.name);\n } else if (t.isRestElement(prop) && t.isIdentifier(prop.argument)) {\n signalNames.add(prop.argument.name);\n }\n }\n }\n }\n }\n scope = scope.parent;\n }\n\n return signalNames;\n }\n\n // Legacy wrapper for backward compat (used in collectSignalNames calls)\n function collectSignalNames(path) {\n return collectSignalNamesFromScope(path);\n }\n\n // Check if a call expression is a safe (non-reactive) global call\n function isSafeGlobalCall(expr) {\n if (!t.isCallExpression(expr)) return false;\n const callee = expr.callee;\n\n // Math.max(), Number.parseInt(), etc.\n if (t.isMemberExpression(callee) && t.isIdentifier(callee.object)) {\n return SAFE_GLOBAL_CALLS.has(callee.object.name);\n }\n\n // parseInt(), isNaN(), etc.\n if (t.isIdentifier(callee)) {\n return SAFE_GLOBAL_CALLS.has(callee.name);\n }\n\n return false;\n }\n\n // Check if an expression's reactivity is uncertain \u2014 e.g., a non-signal function call\n // whose arguments happen to contain signal reads. The function itself may not produce\n // a reactive result, so the compiler wraps it conservatively.\n function isUncertainReactive(expr, signalNames, importedIds) {\n if (!signalNames) return false;\n if (t.isCallExpression(expr)) {\n // Callee is a known signal \u2014 definitely reactive, not uncertain\n if (t.isIdentifier(expr.callee) && isSignalIdentifier(expr.callee.name, signalNames)) {\n return false;\n }\n // Imported identifier called as function \u2014 definitely reactive (not uncertain)\n if (importedIds && t.isIdentifier(expr.callee) && importedIds.has(expr.callee.name) &&\n !SAFE_GLOBAL_CALLS.has(expr.callee.name)) {\n return false;\n }\n // Callee is a member of a known signal \u2014 definitely reactive\n if (t.isMemberExpression(expr.callee) && t.isIdentifier(expr.callee.object) &&\n isSignalIdentifier(expr.callee.object.name, signalNames)) {\n return false;\n }\n // Safe global call (Math.max, etc.) with reactive args \u2014 still deterministic, not uncertain\n if (isSafeGlobalCall(expr)) return false;\n // Unknown function call \u2014 if args are reactive, the wrapping is uncertain\n if (expr.arguments.some(arg => isPotentiallyReactive(arg, signalNames, importedIds))) {\n return true;\n }\n }\n return false;\n }\n\n // Check if an expression is potentially reactive (reads a signal)\n // importedIds: Set of identifiers imported from other modules \u2014 any imported\n // function call is conservatively treated as potentially reactive since the\n // imported binding could be a signal from another file.\n function isPotentiallyReactive(expr, signalNames, importedIds) {\n if (!signalNames) signalNames = new Set();\n\n if (t.isCallExpression(expr)) {\n // If callee is a known signal identifier being called (signal read), it's reactive\n if (t.isIdentifier(expr.callee) && isSignalIdentifier(expr.callee.name, signalNames)) {\n return true;\n }\n // Imported identifier called as a function \u2014 conservatively reactive.\n // Handles: import { count } from './store'; ... {count()} in JSX\n if (importedIds && t.isIdentifier(expr.callee) && importedIds.has(expr.callee.name)) {\n // Exclude known safe globals that happen to also be imported\n if (!SAFE_GLOBAL_CALLS.has(expr.callee.name)) {\n return true;\n }\n }\n // member.call() \u2014 e.g., data(), isLoading()\n if (t.isMemberExpression(expr.callee)) {\n // Check if the object is a signal\n if (t.isIdentifier(expr.callee.object) && isSignalIdentifier(expr.callee.object.name, signalNames)) {\n return true;\n }\n }\n // Safe global calls like Math.max \u2014 only reactive if their args are\n if (isSafeGlobalCall(expr)) {\n return expr.arguments.some(arg => isPotentiallyReactive(arg, signalNames, importedIds));\n }\n // Unknown call \u2014 check if callee or args contain signal reads\n if (t.isIdentifier(expr.callee)) {\n // Could be a function that reads signals internally\n // Be conservative: if it's not a known safe call and not a signal, still check args\n return expr.arguments.some(arg => isPotentiallyReactive(arg, signalNames, importedIds));\n }\n // For any other call expression, check recursively\n return isPotentiallyReactive(expr.callee, signalNames, importedIds) ||\n expr.arguments.some(arg => isPotentiallyReactive(arg, signalNames, importedIds));\n }\n\n if (t.isIdentifier(expr)) {\n return isSignalIdentifier(expr.name, signalNames) ||\n (importedIds && importedIds.has(expr.name));\n }\n\n if (t.isMemberExpression(expr)) {\n return isPotentiallyReactive(expr.object, signalNames, importedIds);\n }\n\n if (t.isConditionalExpression(expr)) {\n return isPotentiallyReactive(expr.test, signalNames, importedIds) ||\n isPotentiallyReactive(expr.consequent, signalNames, importedIds) ||\n isPotentiallyReactive(expr.alternate, signalNames, importedIds);\n }\n\n if (t.isBinaryExpression(expr) || t.isLogicalExpression(expr)) {\n return isPotentiallyReactive(expr.left, signalNames, importedIds) ||\n isPotentiallyReactive(expr.right, signalNames, importedIds);\n }\n\n if (t.isUnaryExpression(expr)) {\n return isPotentiallyReactive(expr.argument, signalNames, importedIds);\n }\n\n if (t.isTemplateLiteral(expr)) {\n return expr.expressions.some(e => isPotentiallyReactive(e, signalNames, importedIds));\n }\n\n if (t.isObjectExpression(expr)) {\n return expr.properties.some(prop =>\n t.isObjectProperty(prop) && isPotentiallyReactive(prop.value, signalNames, importedIds)\n );\n }\n\n if (t.isArrayExpression(expr)) {\n return expr.elements.some(el => el && isPotentiallyReactive(el, signalNames, importedIds));\n }\n\n if (t.isArrowFunctionExpression(expr) || t.isFunctionExpression(expr)) {\n // Function expressions are not reactive themselves \u2014 they're callbacks\n return false;\n }\n\n return false;\n }\n\n // --- Auto-lower .map() to mapArray ---\n // Detects: source().map((item) => <Comp key={expr} .../>)\n // or wrapped in an arrow: () => source().map(...)\n // Also walks into ternary (cond ? a.map(...) : fallback) and\n // logical (cond && a.map(...)) expressions so React-style\n // conditional list patterns get keyed reconciliation.\n // Produces: _$mapArray(source, (item) => <Comp .../>, { key: item => expr })\n function tryLowerMapToMapArray(expr, state) {\n // Unwrap arrow function: () => source().map(...)\n let mapCall = expr;\n let wrappedInArrow = false;\n if (t.isArrowFunctionExpression(expr) && expr.params.length === 0) {\n mapCall = expr.body;\n wrappedInArrow = true;\n }\n\n // Walk into ternary: cond ? arr().map(...) : fallback\n if (t.isConditionalExpression(mapCall)) {\n const loweredCon = tryLowerMapCall(mapCall.consequent, state);\n const loweredAlt = tryLowerMapCall(mapCall.alternate, state);\n if (loweredCon || loweredAlt) {\n const result = t.conditionalExpression(\n mapCall.test,\n loweredCon || mapCall.consequent,\n loweredAlt || mapCall.alternate\n );\n return wrappedInArrow ? t.arrowFunctionExpression([], result) : result;\n }\n return null;\n }\n\n // Walk into logical: cond && arr().map(...)\n if (t.isLogicalExpression(mapCall) && (mapCall.operator === '&&' || mapCall.operator === '||')) {\n const loweredRight = tryLowerMapCall(mapCall.right, state);\n if (loweredRight) {\n const result = t.logicalExpression(mapCall.operator, mapCall.left, loweredRight);\n return wrappedInArrow ? t.arrowFunctionExpression([], result) : result;\n }\n return null;\n }\n\n // Direct .map() call\n const lowered = tryLowerMapCall(mapCall, state);\n return lowered;\n }\n\n // Core .map() lowering \u2014 extracted so it can be called per-branch\n function tryLowerMapCall(mapCall, state) {\n // Check: something.map(fn)\n if (!t.isCallExpression(mapCall)) return null;\n if (!t.isMemberExpression(mapCall.callee)) return null;\n if (!t.isIdentifier(mapCall.callee.property, { name: 'map' })) return null;\n if (mapCall.arguments.length < 1) return null;\n\n const mapFn = mapCall.arguments[0];\n if (!t.isArrowFunctionExpression(mapFn) && !t.isFunctionExpression(mapFn)) return null;\n\n // Get the map callback's return expression\n let returnExpr = null;\n if (t.isArrowFunctionExpression(mapFn)) {\n if (t.isExpression(mapFn.body)) {\n returnExpr = mapFn.body;\n } else if (t.isBlockStatement(mapFn.body)) {\n const ret = mapFn.body.body.find(s => t.isReturnStatement(s));\n if (ret) returnExpr = ret.argument;\n }\n } else if (t.isFunctionExpression(mapFn)) {\n const ret = mapFn.body.body.find(s => t.isReturnStatement(s));\n if (ret) returnExpr = ret.argument;\n }\n\n if (!returnExpr) return null;\n\n // Check if the return is JSX with a `key` prop\n if (!t.isJSXElement(returnExpr)) return null;\n const attrs = returnExpr.openingElement.attributes;\n let keyAttr = null;\n for (const attr of attrs) {\n if (t.isJSXAttribute(attr) && getAttrName(attr) === 'key') {\n keyAttr = attr;\n break;\n }\n }\n if (!keyAttr) {\n // JSX returned without a key \u2014 bail out, but warn at compile time so\n // users notice they're missing keyed reconciliation. Only warn in dev\n // (production builds are noiseless).\n if (process.env.NODE_ENV !== 'production') {\n const loc = returnExpr.loc;\n const fileName = state.filename || state.file?.opts?.filename || '<unknown>';\n const lineInfo = loc ? `:${loc.start.line}:${loc.start.column}` : '';\n console.warn(\n `[what-compiler] .map() returning JSX without a \\`key\\` prop at ${fileName}${lineInfo}. ` +\n `Without a key, the list cannot use keyed reconciliation \u2014 items are re-created on every update. ` +\n `Add key={...} to enable efficient updates.`\n );\n }\n return null;\n }\n\n // Extract the key expression\n const keyValue = getAttributeValue(keyAttr.value);\n if (!keyValue) return null;\n\n // Remove the key prop from the JSX element (mapArray handles keying, not the DOM)\n returnExpr.openingElement.attributes = attrs.filter(a => a !== keyAttr);\n\n // Build the source: the object before .map() \u2014 wrap in an arrow for reactive access\n const sourceObj = mapCall.callee.object;\n const source = t.arrowFunctionExpression([], sourceObj);\n\n // Build the key function: (item) => keyExpr.\n // Clone both the parameter and the key expression \u2014 the parameter is shared\n // with the user's map callback AST and keyValue may be referenced elsewhere\n // in the tree. Cloning insulates this new arrow from later mutations.\n const itemParam = mapFn.params[0] ? t.cloneNode(mapFn.params[0], true) : t.identifier('_item');\n const keyFn = t.arrowFunctionExpression([itemParam], t.cloneNode(keyValue, true));\n\n // Build: _$mapArray(source, mapFn, { key: keyFn, raw: true })\n // raw: true means mapFn receives the raw item value (not a signal accessor),\n // matching user-authored .map() semantics where `item.prop` accesses values directly.\n return t.callExpression(t.identifier('_$mapArray'), [\n source,\n mapFn,\n t.objectExpression([\n t.objectProperty(t.identifier('key'), keyFn),\n t.objectProperty(t.identifier('raw'), t.booleanLiteral(true))\n ])\n ]);\n }\n\n // =====================================================\n // Fine-Grained Mode (template + insert + effect)\n // =====================================================\n\n // Check if a JSX child is static (no expressions)\n function isStaticChild(child) {\n if (t.isJSXText(child)) return true;\n if (t.isJSXExpressionContainer(child)) return false;\n if (t.isJSXElement(child)) {\n const el = child.openingElement;\n const tagName = el.name.name;\n if (isComponent(tagName)) return false;\n for (const attr of el.attributes) {\n if (t.isJSXSpreadAttribute(attr)) return false;\n const value = attr.value;\n if (t.isJSXExpressionContainer(value)) return false;\n }\n return child.children.every(isStaticChild);\n }\n return false;\n }\n\n // Check if an attribute value is dynamic\n function isDynamicAttr(attr) {\n if (t.isJSXSpreadAttribute(attr)) return true;\n if (!attr.value) return false;\n return t.isJSXExpressionContainer(attr.value);\n }\n\n // Extract static HTML from JSX element for template()\n function extractStaticHTML(node) {\n if (t.isJSXText(node)) {\n const text = normalizeJsxText(node.value);\n return text ? escapeHTML(text) : '';\n }\n\n if (t.isJSXExpressionContainer(node)) {\n if (t.isJSXEmptyExpression(node.expression)) return '';\n return '<!--$-->';\n }\n\n if (!t.isJSXElement(node)) return '';\n\n const el = node.openingElement;\n const tagName = el.name.name;\n\n if (isComponent(tagName)) return '';\n\n let html = `<${tagName}`;\n\n for (const attr of el.attributes) {\n if (t.isJSXSpreadAttribute(attr)) continue;\n const name = getAttrName(attr);\n if (name === 'key') continue;\n if (name.startsWith('on') || name.startsWith('bind:') || name.includes('|')) continue;\n\n let domName = name;\n if (name === 'className') domName = 'class';\n if (name === 'htmlFor') domName = 'for';\n\n if (!attr.value) {\n html += ` ${domName}`;\n } else if (t.isStringLiteral(attr.value)) {\n html += ` ${domName}=\"${escapeAttr(attr.value.value)}\"`;\n } else if (t.isJSXExpressionContainer(attr.value)) {\n continue; // Dynamic attr \u2014 set via effect\n }\n }\n\n const selfClosing = node.openingElement.selfClosing;\n if (selfClosing && isVoidHtmlElement(tagName)) {\n html += '>';\n return html;\n }\n\n if (selfClosing) {\n html += `></${tagName}>`;\n return html;\n }\n\n html += '>';\n\n for (const child of node.children) {\n if (t.isJSXText(child)) {\n const text = normalizeJsxText(child.value);\n if (text) html += escapeHTML(text);\n } else if (t.isJSXExpressionContainer(child)) {\n if (!t.isJSXEmptyExpression(child.expression)) {\n html += '<!--$-->';\n }\n } else if (t.isJSXElement(child)) {\n if (isComponent(child.openingElement.name.name)) {\n html += '<!--$-->';\n } else {\n html += extractStaticHTML(child);\n }\n }\n }\n\n html += `</${tagName}>`;\n return html;\n }\n\n function escapeHTML(str) {\n return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\n }\n\n function escapeAttr(str) {\n return str.replace(/&/g, '&amp;').replace(/\"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\n }\n\n // Analyze JSX tree and generate fine-grained output\n function transformElementFineGrained(path, state) {\n const { node } = path;\n const openingElement = node.openingElement;\n const tagName = openingElement.name.name;\n\n // Control flow components \u2014 check before generic isComponent since they start uppercase\n if (tagName === 'For') {\n return transformForFineGrained(path, state);\n }\n if (tagName === 'Show') {\n return transformShowFineGrained(path, state);\n }\n\n if (isComponent(tagName)) {\n return transformComponentFineGrained(path, state);\n }\n\n const attributes = openingElement.attributes;\n const children = node.children;\n\n // Check if this entire subtree is purely static\n const allChildrenStatic = children.every(isStaticChild);\n const allAttrsStatic = attributes.every(attr => !isDynamicAttr(attr));\n const noEvents = attributes.every(attr => {\n if (t.isJSXSpreadAttribute(attr)) return false;\n const name = getAttrName(attr);\n return !name?.startsWith('on') && !name?.startsWith('bind:');\n });\n\n if (allChildrenStatic && allAttrsStatic && noEvents) {\n // Fully static element \u2014 extract to template, return clone call\n const html = extractStaticHTML(node);\n if (html) {\n const tmplId = getOrCreateTemplate(state, html);\n state.needsTemplate = true;\n return t.callExpression(t.identifier(tmplId), []);\n }\n }\n\n // Mixed static/dynamic element \u2014 extract template, add effects for dynamic parts\n const html = extractStaticHTML(node);\n if (!html) {\n // Template extraction failed \u2014 emit a detailed compile warning and use h() as fallback\n const loc = node.loc;\n const fileName = state.filename || state.file?.opts?.filename || '<unknown>';\n const lineInfo = loc ? `:${loc.start.line}:${loc.start.column}` : '';\n console.warn(\n `[what-compiler] Could not extract template for <${tagName}> at ${fileName}${lineInfo}. ` +\n `Falling back to h() for this element. ` +\n `This element could not be statically analyzed. Consider simplifying the JSX.`\n );\n state.needsH = true;\n return transformElementAsH(path, state);\n }\n\n const tmplId = getOrCreateTemplate(state, html);\n state.needsTemplate = true;\n\n const elId = state.nextVarId();\n\n // Build statements: _el$ = _tmpl$1()\n // NO IIFE wrapping \u2014 statements are inlined into the containing function\n const statements = [\n t.variableDeclaration('const', [\n t.variableDeclarator(t.identifier(elId), t.callExpression(t.identifier(tmplId), []))\n ])\n ];\n\n // Apply dynamic attributes and events\n applyDynamicAttrs(statements, elId, attributes, state, tagName);\n\n // Handle dynamic children\n applyDynamicChildren(statements, elId, children, node, state);\n\n // Instead of wrapping in an IIFE, store setup statements for hoisting.\n // The JSXElement visitor will insert them before the enclosing statement.\n if (!state._pendingSetup) state._pendingSetup = [];\n state._pendingSetup.push(...statements);\n return t.identifier(elId);\n }\n\n // Fallback: transform element using h() when template extraction fails\n function transformElementAsH(path, state) {\n const { node } = path;\n const openingElement = node.openingElement;\n const tagName = openingElement.name.name;\n const attributes = openingElement.attributes;\n const children = node.children;\n\n const props = [];\n for (const attr of attributes) {\n if (t.isJSXSpreadAttribute(attr)) continue;\n const attrName = getAttrName(attr);\n const value = getAttributeValue(attr.value);\n let domAttrName = normalizeAttrName(attrName);\n props.push(\n t.objectProperty(\n /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(domAttrName)\n ? t.identifier(domAttrName)\n : t.stringLiteral(domAttrName),\n value\n )\n );\n }\n\n const transformedChildren = [];\n for (const child of children) {\n if (t.isJSXText(child)) {\n const text = normalizeJsxText(child.value);\n if (text) transformedChildren.push(t.stringLiteral(text));\n } else if (t.isJSXExpressionContainer(child)) {\n if (!t.isJSXEmptyExpression(child.expression)) {\n transformedChildren.push(child.expression);\n }\n } else if (t.isJSXElement(child)) {\n transformedChildren.push(transformElementFineGrained({ node: child }, state));\n } else if (t.isJSXFragment(child)) {\n transformedChildren.push(transformFragmentFineGrained({ node: child }, state));\n }\n }\n\n const propsExpr = props.length > 0 ? t.objectExpression(props) : t.nullLiteral();\n return t.callExpression(t.identifier('h'), [t.stringLiteral(tagName), propsExpr, ...transformedChildren]);\n }\n\n // Tags where `value` / `checked` are live DOM properties the user expects a\n // dynamic binding to drive (input.value, select.value, input.checked, ...).\n // Other tags keep the generic setProp path (e.g. <div value={x}> sets an\n // attribute, <li value={n}> hits the `key in el` property branch).\n const VALUE_PROP_TAGS = new Set(['input', 'textarea', 'select', 'option']);\n\n function applyDynamicAttrs(statements, elId, attributes, state, tagName) {\n // Specialized monomorphic setters for statically-known attribute names\n // (SPRINT v0.11 C2). The generic _$setProp re-dispatches on the key string\n // (ref/key/url/class/style/innerHTML/boolean/...) on EVERY reactive update;\n // when the compiler knows the name it emits the direct helper instead.\n // SECURITY: URL attributes (href/src/action/formaction) and innerHTML/\n // dangerouslySetInnerHTML intentionally fall through to _$setProp \u2014 URL\n // sanitization and the { __html } enforcement live there.\n function buildSetPropCall(propName, valueExpr) {\n if (propName === 'class') {\n // normalizeAttrName already mapped className \u2192 class\n state.needsSetClass = true;\n return t.callExpression(t.identifier('_$setClass'), [t.identifier(elId), valueExpr]);\n }\n if (propName === 'style') {\n state.needsSetStyle = true;\n return t.callExpression(t.identifier('_$setStyle'), [t.identifier(elId), valueExpr]);\n }\n if (propName === 'value' && tagName && VALUE_PROP_TAGS.has(tagName)) {\n state.needsSetValue = true;\n return t.callExpression(t.identifier('_$setValue'), [t.identifier(elId), valueExpr]);\n }\n if (propName === 'checked' && tagName === 'input') {\n // Live property write \u2014 matches bind:checked semantics. (The old\n // setAttribute('checked') path only set the DEFAULT-checked state,\n // which stops reflecting once the user has toggled the input.)\n // A helper (not a raw `.checked =`) so function values still get\n // reactive-accessor treatment, like every other setter.\n state.needsSetChecked = true;\n return t.callExpression(t.identifier('_$setChecked'), [t.identifier(elId), valueExpr]);\n }\n if (propName.startsWith('data-') || propName.startsWith('aria-')) {\n state.needsSetAttr = true;\n return t.callExpression(t.identifier('_$setAttr'), [\n t.identifier(elId),\n t.stringLiteral(propName),\n valueExpr\n ]);\n }\n state.needsSetProp = true;\n return t.callExpression(t.identifier('_$setProp'), [\n t.identifier(elId),\n t.stringLiteral(propName),\n valueExpr\n ]);\n }\n\n // Lazy delegation init (C6): the first element of a module that assigns a\n // delegated `$$event` handler also calls the once-guarded _$delegate$()\n // helper at construction time. Emitted at most once per element.\n let delegateInitEmitted = false;\n function emitDelegateInit() {\n if (delegateInitEmitted) return;\n delegateInitEmitted = true;\n statements.push(\n t.expressionStatement(t.callExpression(t.identifier('_$delegate$'), []))\n );\n }\n\n for (const attr of attributes) {\n if (t.isJSXSpreadAttribute(attr)) {\n state.needsSpread = true;\n statements.push(\n t.expressionStatement(\n t.callExpression(t.identifier('_$spread'), [t.identifier(elId), attr.argument])\n )\n );\n continue;\n }\n\n const attrName = getAttrName(attr);\n\n // Strip key prop \u2014 WhatFW has no virtual DOM, so key is meaningless (issue #6)\n if (attrName === 'key') continue;\n\n // Ref handling \u2014 assign element to ref object/callback\n if (attrName === 'ref') {\n const refExpr = getAttributeValue(attr.value);\n // Generate: typeof ref === 'function' ? ref(el) : ref.current = el\n statements.push(\n t.expressionStatement(\n t.conditionalExpression(\n t.binaryExpression('===',\n t.unaryExpression('typeof', refExpr),\n t.stringLiteral('function')\n ),\n t.callExpression(t.cloneNode(refExpr), [t.identifier(elId)]),\n t.assignmentExpression('=',\n t.memberExpression(t.cloneNode(refExpr), t.identifier('current')),\n t.identifier(elId)\n )\n )\n )\n );\n continue;\n }\n\n // Event handlers\n if (attrName.startsWith('on') && !attrName.includes('|') && !hasEventModifiers(attrName, state)) {\n const event = attrName.slice(2).toLowerCase();\n const handler = getAttributeValue(attr.value);\n\n if (DELEGATED_EVENTS.has(event)) {\n // Use event delegation: el.$$click = handler (matches runtime lookup)\n state.needsDelegation = true;\n if (!state.delegatedEvents) state.delegatedEvents = new Set();\n state.delegatedEvents.add(event);\n emitDelegateInit();\n statements.push(\n t.expressionStatement(\n t.assignmentExpression('=',\n t.memberExpression(\n t.identifier(elId),\n t.identifier(`$$${event}`)\n ),\n handler\n )\n )\n );\n } else {\n // Non-delegated: use per-element addEventListener\n statements.push(\n t.expressionStatement(\n t.callExpression(\n t.memberExpression(t.identifier(elId), t.identifier('addEventListener')),\n [t.stringLiteral(event), handler]\n )\n )\n );\n }\n continue;\n }\n\n // Event with modifiers (pipe '|' or JSX-safe double underscore '__')\n if (attrName.startsWith('on') && (attrName.includes('|') || hasEventModifiers(attrName, state))) {\n const { eventName, modifiers } = parseEventModifiers(attrName);\n const handler = getAttributeValue(attr.value);\n const wrappedHandler = createEventHandler(handler, modifiers);\n const event = eventName.slice(2).toLowerCase();\n\n const optionMods = modifiers.filter(m => EVENT_OPTION_MODIFIERS.has(m));\n const addEventArgs = [t.stringLiteral(event), wrappedHandler];\n if (optionMods.length > 0) {\n const optsProps = optionMods.map(m =>\n t.objectProperty(t.identifier(m), t.booleanLiteral(true))\n );\n addEventArgs.push(t.objectExpression(optsProps));\n }\n\n statements.push(\n t.expressionStatement(\n t.callExpression(\n t.memberExpression(t.identifier(elId), t.identifier('addEventListener')),\n addEventArgs\n )\n )\n );\n continue;\n }\n\n // Binding\n if (isBindingAttribute(attrName)) {\n const bindProp = getBindingProperty(attrName);\n const signalExpr = attr.value.expression;\n state.needsEffect = true;\n\n if (bindProp === 'value') {\n statements.push(\n t.expressionStatement(\n t.callExpression(t.identifier('_$effect'), [\n t.arrowFunctionExpression([], t.assignmentExpression('=',\n t.memberExpression(t.identifier(elId), t.identifier('value')),\n t.callExpression(t.cloneNode(signalExpr), [])\n ))\n ])\n )\n );\n statements.push(\n t.expressionStatement(\n t.callExpression(\n t.memberExpression(t.identifier(elId), t.identifier('addEventListener')),\n [\n t.stringLiteral('input'),\n t.arrowFunctionExpression(\n [t.identifier('e')],\n t.callExpression(\n t.memberExpression(t.cloneNode(signalExpr), t.identifier('set')),\n [t.memberExpression(\n t.memberExpression(t.identifier('e'), t.identifier('target')),\n t.identifier('value')\n )]\n )\n )\n ]\n )\n )\n );\n } else if (bindProp === 'checked') {\n state.needsEffect = true;\n statements.push(\n t.expressionStatement(\n t.callExpression(t.identifier('_$effect'), [\n t.arrowFunctionExpression([], t.assignmentExpression('=',\n t.memberExpression(t.identifier(elId), t.identifier('checked')),\n t.callExpression(t.cloneNode(signalExpr), [])\n ))\n ])\n )\n );\n statements.push(\n t.expressionStatement(\n t.callExpression(\n t.memberExpression(t.identifier(elId), t.identifier('addEventListener')),\n [\n t.stringLiteral('change'),\n t.arrowFunctionExpression(\n [t.identifier('e')],\n t.callExpression(\n t.memberExpression(t.cloneNode(signalExpr), t.identifier('set')),\n [t.memberExpression(\n t.memberExpression(t.identifier('e'), t.identifier('target')),\n t.identifier('checked')\n )]\n )\n )\n ]\n )\n )\n );\n }\n continue;\n }\n\n // Dynamic attribute (expression)\n if (t.isJSXExpressionContainer(attr.value)) {\n const expr = attr.value.expression;\n const domName = normalizeAttrName(attrName);\n\n if (isPotentiallyReactive(expr, state.signalNames, state.importedIdentifiers)) {\n state.needsEffect = true;\n // Auto-invoke bare signal/imported identifiers: value={name} -> name()\n const valueExpr = t.isIdentifier(expr) &&\n (isSignalIdentifier(expr.name, state.signalNames) ||\n (state.importedIdentifiers && state.importedIdentifiers.has(expr.name)))\n ? t.callExpression(expr, [])\n : expr;\n const effectCall = t.callExpression(t.identifier('_$effect'), [\n t.arrowFunctionExpression([], buildSetPropCall(domName, valueExpr))\n ]);\n // In dev mode, add a leading comment when the effect wrapping is uncertain\n // (non-signal function call whose args happen to contain signal reads)\n if (isUncertainReactive(expr, state.signalNames, state.importedIdentifiers)) {\n t.addComment(effectCall, 'leading',\n ' @what-dev: effect wrapping may be unnecessary \u2014 expression contains a non-signal function call with reactive args ',\n false\n );\n }\n statements.push(t.expressionStatement(effectCall));\n } else {\n // Static expression (no signal calls) \u2014 set once\n statements.push(t.expressionStatement(buildSetPropCall(domName, expr)));\n }\n }\n }\n }\n\n // =====================================================\n // Branch Memoization (SPRINT v0.11 C1)\n // =====================================================\n // `_$insert(el, () => cond() ? <A/> : <B/>)` re-creates the taken branch's\n // DOM tree (and re-registers every effect inside it) on EVERY re-evaluation\n // of the insert effect \u2014 including writes to signals read by the condition\n // that do NOT flip which branch is taken (e.g. `count() > 5` while count\n // goes 6 \u2192 7). Solid solves this by memoizing the condition: route the\n // condition through an eager, equality-gated memo so the insert effect\n // depends on the *memo* instead of the raw signals:\n //\n // const _c$0 = _$memo(() => !!(count() > 5));\n // _$insert(_el$, () => _c$0() ? <A/> : <B/>, marker);\n //\n // The memo re-evaluates on every count write, but only NOTIFIES when its\n // value changes \u2014 so branch DOM is recreated exactly on real flips.\n //\n // Semantics preserved:\n // - Ternary tests only matter for truthiness \u2192 memoize `!!test`.\n // - `a && b` / `a || b` render the LEFT operand's VALUE when it\n // short-circuits (`{0 && <div/>}` renders \"0\"), so the left side is\n // memoized by value (Object.is) \u2014 never coerced.\n // - Branch-internal reactivity (signals read inside <A/>) is fine-grained\n // and unaffected; plain-value branches read in the insert arrow are\n // still tracked by the insert effect directly.\n\n // Does this expression produce DOM when evaluated? (raw JSX still present at\n // this stage, or an already-lowered _$mapArray list). Only then is branch\n // memoization worth the extra memo node.\n function buildsDOM(node) {\n if (!node || typeof node !== 'object') return false;\n if (Array.isArray(node)) return node.some(buildsDOM);\n if (node.type === 'JSXElement' || node.type === 'JSXFragment') return true;\n if (node.type === 'CallExpression' && node.callee &&\n node.callee.type === 'Identifier' &&\n (node.callee.name === '_$mapArray' || node.callee.name === 'mapArray')) {\n return true;\n }\n for (const key of Object.keys(node)) {\n if (key === 'loc' || key === 'start' || key === 'end' || key === 'leadingComments' ||\n key === 'trailingComments' || key === 'innerComments') continue;\n const v = node[key];\n if (v && typeof v === 'object' && buildsDOM(v)) return true;\n }\n return false;\n }\n\n // If `expr` is a conditional (ternary / && / ||) with a reactive test and a\n // DOM-producing branch, hoist the test into `const _c$N = _$memo(...)` (pushed\n // onto `statements`) and return the expression rewritten to read the memo.\n // Otherwise returns `expr` unchanged.\n function memoizeBranchCondition(expr, statements, state) {\n let testExpr = null;\n let isTernary = false;\n if (t.isConditionalExpression(expr)) {\n testExpr = expr.test;\n isTernary = true;\n } else if (t.isLogicalExpression(expr) && (expr.operator === '&&' || expr.operator === '||')) {\n testExpr = expr.left;\n } else {\n return expr;\n }\n\n if (!isPotentiallyReactive(testExpr, state.signalNames, state.importedIdentifiers)) return expr;\n\n const branches = isTernary ? [expr.consequent, expr.alternate] : [expr.right];\n if (!branches.some(buildsDOM)) return expr;\n\n const condId = state.nextMemoId();\n state.needsMemo = true;\n // Ternary: only truthiness matters in test position \u2192 gate on !!test so\n // value changes that don't flip truthiness (5 \u2192 6) never notify.\n // Logical: the left VALUE is rendered on short-circuit \u2192 gate on the value.\n const memoBody = isTernary\n ? t.unaryExpression('!', t.unaryExpression('!', testExpr))\n : testExpr;\n statements.push(\n t.variableDeclaration('const', [\n t.variableDeclarator(\n t.identifier(condId),\n t.callExpression(t.identifier('_$memo'), [\n t.arrowFunctionExpression([], memoBody)\n ])\n )\n ])\n );\n\n const condRead = t.callExpression(t.identifier(condId), []);\n return isTernary\n ? t.conditionalExpression(condRead, expr.consequent, expr.alternate)\n : t.logicalExpression(expr.operator, condRead, expr.right);\n }\n\n function applyDynamicChildren(statements, elId, children, parentNode, state) {\n // Two-pass approach: first collect all children needing DOM references,\n // then pre-capture markers before any _$insert() calls shift indices.\n // This fixes issue #1: childNodes index shifting with multiple dynamic children.\n\n // --- Pass 1: Scan children and collect entries ---\n const entries = [];\n let childIndex = 0;\n\n for (const child of children) {\n if (t.isJSXText(child)) {\n const text = normalizeJsxText(child.value);\n if (text) childIndex++;\n continue;\n }\n\n if (t.isJSXExpressionContainer(child)) {\n if (t.isJSXEmptyExpression(child.expression)) continue;\n entries.push({ type: 'expression', child, childIndex });\n childIndex++;\n continue;\n }\n\n if (t.isJSXElement(child)) {\n const childTag = child.openingElement.name.name;\n if (isComponent(childTag) || childTag === 'For' || childTag === 'Show') {\n entries.push({ type: 'component', child, childIndex });\n childIndex++;\n } else {\n const hasAnythingDynamic = child.openingElement.attributes.some(isDynamicAttr) ||\n child.openingElement.attributes.some(a => !t.isJSXSpreadAttribute(a) && getAttrName(a)?.startsWith('on')) ||\n !child.children.every(isStaticChild);\n\n entries.push({ type: 'static', child, childIndex, hasAnythingDynamic });\n childIndex++;\n }\n continue;\n }\n\n if (t.isJSXFragment(child)) {\n entries.push({ type: 'fragment', child });\n }\n }\n\n // --- Pre-capture marker references if needed ---\n // When there are multiple entries needing DOM refs and at least one _$insert(),\n // capture all markers upfront to avoid index shifting after DOM mutations.\n const entriesNeedingRef = entries.filter(e =>\n e.type === 'expression' || e.type === 'component' ||\n (e.type === 'static' && e.hasAnythingDynamic)\n );\n // Pre-capture whenever 2+ children need a DOM ref. Beyond preventing index\n // shift after insert() mutations, the shared O(n) cursor walk below replaces\n // per-child `el.firstChild.nextSibling\u2026`-from-root access, which was O(n\u00B2) in\n // both compile time and emitted size for elements with many dynamic\n // children. (AUDIT-2026-06-06 H2)\n const needsPreCapture = entriesNeedingRef.length >= 2;\n\n const markerVars = new Map(); // childIndex \u2192 variable name\n if (needsPreCapture) {\n // Chain each marker from the PREVIOUS captured cursor instead of\n // re-walking `el.firstChild.nextSibling\u2026` from the root for every child.\n // entriesNeedingRef is in ascending childIndex order, so the per-marker\n // deltas sum to O(n) total instead of O(n\u00B2). This was the dominant\n // quadratic in compile time and emitted-bundle size for large elements.\n // (AUDIT-2026-06-06 H2)\n let prevVar = null;\n let prevIndex = 0;\n for (const entry of entriesNeedingRef) {\n const idx = entry.childIndex;\n const markerVar = state.nextVarId();\n markerVars.set(idx, markerVar);\n let init;\n if (prevVar === null) {\n init = buildChildAccess(elId, idx);\n } else {\n init = t.identifier(prevVar);\n for (let i = prevIndex; i < idx; i++) {\n init = t.memberExpression(init, t.identifier('nextSibling'));\n }\n }\n statements.push(\n t.variableDeclaration('const', [\n t.variableDeclarator(t.identifier(markerVar), init)\n ])\n );\n prevVar = markerVar;\n prevIndex = idx;\n }\n }\n\n // Helper: get a marker reference (pre-captured var or inline access)\n function getMarker(idx) {\n if (markerVars.has(idx)) {\n return t.identifier(markerVars.get(idx));\n }\n return buildChildAccess(elId, idx);\n }\n\n // --- Pass 2: Generate code using stable references ---\n for (const entry of entries) {\n if (entry.type === 'expression') {\n let expr = entry.child.expression;\n const marker = getMarker(entry.childIndex);\n state.needsInsert = true;\n\n // Auto-lower .map() to mapArray when the callback returns keyed JSX.\n // Pattern: source().map(item => <Comp key={...} />) or source().map((item, i) => ...)\n let mapResult = tryLowerMapToMapArray(expr, state);\n if (mapResult) {\n state.needsMapArray = true;\n // A bare _$mapArray(...) call is a self-managing inserter (it tracks\n // its source internally) and an arrow is already reactive \u2014 pass both\n // raw. But when lowering produced a ternary/logical wrapping the call\n // (e.g. cond ? _$mapArray(...) : fallback), the surrounding condition\n // must stay reactive, so wrap the whole expression in () => and let\n // _$insert re-evaluate it on change. Without this the condition is read\n // exactly once and never re-tracks. (AUDIT-2026-06-06 H1)\n const isBareMapArray = t.isCallExpression(mapResult) && t.isIdentifier(mapResult.callee) &&\n (mapResult.callee.name === '_$mapArray' || mapResult.callee.name === 'mapArray');\n const isArrowAlready = t.isArrowFunctionExpression(mapResult);\n // Branch memoization (C1): when the lowered result is a conditional\n // around the list (cond ? _$mapArray(...) : fallback), memoize the\n // condition so non-flip writes don't tear down and recreate the\n // entire list inserter.\n if (isArrowAlready && t.isExpression(mapResult.body)) {\n mapResult.body = memoizeBranchCondition(mapResult.body, statements, state);\n } else if (!isBareMapArray && !isArrowAlready) {\n mapResult = memoizeBranchCondition(mapResult, statements, state);\n }\n const insertArg = (isBareMapArray || isArrowAlready)\n ? mapResult\n : t.arrowFunctionExpression([], mapResult);\n statements.push(\n t.expressionStatement(\n t.callExpression(t.identifier('_$insert'), [\n t.identifier(elId),\n insertArg,\n marker\n ])\n )\n );\n continue;\n }\n\n // mapArray() calls return self-managing inserters \u2014 pass directly, never wrap in () =>\n const isMapArrayCall = t.isCallExpression(expr) && t.isIdentifier(expr.callee) &&\n (expr.callee.name === 'mapArray' || expr.callee.name === '_$mapArray');\n if (isMapArrayCall) {\n state.needsMapArray = true;\n if (expr.callee.name === 'mapArray') expr.callee.name = '_$mapArray';\n statements.push(\n t.expressionStatement(\n t.callExpression(t.identifier('_$insert'), [\n t.identifier(elId),\n expr,\n marker\n ])\n )\n );\n continue;\n }\n\n if (isPotentiallyReactive(expr, state.signalNames, state.importedIdentifiers)) {\n // Branch memoization (C1): conditional children only rebuild branch\n // DOM when the condition actually flips.\n expr = memoizeBranchCondition(expr, statements, state);\n const insertCall = t.callExpression(t.identifier('_$insert'), [\n t.identifier(elId),\n t.arrowFunctionExpression([], expr),\n marker\n ]);\n if (isUncertainReactive(expr, state.signalNames, state.importedIdentifiers)) {\n t.addComment(insertCall, 'leading',\n ' @what-dev: reactive wrapping may be unnecessary \u2014 expression contains a non-signal function call with reactive args ',\n false\n );\n }\n statements.push(t.expressionStatement(insertCall));\n } else {\n statements.push(\n t.expressionStatement(\n t.callExpression(t.identifier('_$insert'), [\n t.identifier(elId),\n expr,\n marker\n ])\n )\n );\n }\n continue;\n }\n\n if (entry.type === 'component') {\n const transformed = transformElementFineGrained({ node: entry.child }, state);\n const marker = getMarker(entry.childIndex);\n state.needsInsert = true;\n statements.push(\n t.expressionStatement(\n t.callExpression(t.identifier('_$insert'), [\n t.identifier(elId),\n transformed,\n marker\n ])\n )\n );\n continue;\n }\n\n if (entry.type === 'static' && entry.hasAnythingDynamic) {\n // Static child with dynamic content \u2014 get element reference\n let childElRef;\n if (markerVars.has(entry.childIndex)) {\n childElRef = markerVars.get(entry.childIndex);\n } else {\n childElRef = state.nextVarId();\n statements.push(\n t.variableDeclaration('const', [\n t.variableDeclarator(\n t.identifier(childElRef),\n buildChildAccess(elId, entry.childIndex)\n )\n ])\n );\n }\n applyDynamicAttrs(statements, childElRef, entry.child.openingElement.attributes, state, entry.child.openingElement.name.name);\n applyDynamicChildren(statements, childElRef, entry.child.children, entry.child, state);\n continue;\n }\n\n if (entry.type === 'fragment') {\n for (const fChild of entry.child.children) {\n if (t.isJSXExpressionContainer(fChild) && !t.isJSXEmptyExpression(fChild.expression)) {\n state.needsInsert = true;\n let expr = fChild.expression;\n if (isPotentiallyReactive(expr, state.signalNames, state.importedIdentifiers)) {\n expr = memoizeBranchCondition(expr, statements, state); // (C1)\n statements.push(\n t.expressionStatement(\n t.callExpression(t.identifier('_$insert'), [\n t.identifier(elId),\n t.arrowFunctionExpression([], expr)\n ])\n )\n );\n } else {\n statements.push(\n t.expressionStatement(\n t.callExpression(t.identifier('_$insert'), [\n t.identifier(elId),\n expr\n ])\n )\n );\n }\n }\n }\n }\n }\n }\n\n function buildChildAccess(elId, index) {\n // Use firstChild/nextSibling chains instead of childNodes[N]\n // This is more robust with whitespace text nodes\n if (index === 0) {\n return t.memberExpression(t.identifier(elId), t.identifier('firstChild'));\n }\n // Chain .nextSibling for subsequent indices\n let expr = t.memberExpression(t.identifier(elId), t.identifier('firstChild'));\n for (let i = 0; i < index; i++) {\n expr = t.memberExpression(expr, t.identifier('nextSibling'));\n }\n return expr;\n }\n\n function transformComponentFineGrained(path, state) {\n const { node } = path;\n const openingElement = node.openingElement;\n const componentName = openingElement.name.name;\n const attributes = openingElement.attributes;\n const children = node.children;\n\n // Check for client: directive (islands)\n let clientDirective = null;\n const filteredAttrs = [];\n\n for (const attr of attributes) {\n if (t.isJSXAttribute(attr)) {\n // Handle both simple names and namespaced names (client:idle)\n let name;\n if (t.isJSXNamespacedName(attr.name)) {\n name = `${attr.name.namespace.name}:${attr.name.name.name}`;\n } else {\n name = attr.name.name;\n }\n if (name && typeof name === 'string' && name.startsWith('client:')) {\n const mode = name.slice(7);\n if (attr.value) {\n clientDirective = { type: mode, value: attr.value.value };\n } else {\n clientDirective = { type: mode };\n }\n continue;\n }\n }\n filteredAttrs.push(attr);\n }\n\n if (clientDirective) {\n state.needsCreateComponent = true;\n state.needsIsland = true;\n\n const islandProps = [\n t.objectProperty(t.identifier('component'), t.identifier(componentName)),\n t.objectProperty(t.identifier('mode'), t.stringLiteral(clientDirective.type)),\n ];\n\n if (clientDirective.value) {\n islandProps.push(\n t.objectProperty(t.identifier('mediaQuery'), t.stringLiteral(clientDirective.value))\n );\n }\n\n for (const attr of filteredAttrs) {\n if (t.isJSXSpreadAttribute(attr)) continue;\n const attrName = getAttrName(attr);\n const value = getAttributeValue(attr.value);\n islandProps.push(t.objectProperty(t.identifier(attrName), value));\n }\n\n return t.callExpression(\n t.identifier('_$createComponent'),\n [t.identifier('Island'), t.objectExpression(islandProps), t.arrayExpression([])]\n );\n }\n\n // Regular component \u2014 use _$createComponent to instantiate, component runs once\n state.needsCreateComponent = true;\n\n const props = [];\n let hasSpread = false;\n let spreadExpr = null;\n\n for (const attr of filteredAttrs) {\n if (t.isJSXSpreadAttribute(attr)) {\n hasSpread = true;\n spreadExpr = attr.argument;\n continue;\n }\n\n const attrName = getAttrName(attr);\n\n // Strip key prop \u2014 WhatFW has no virtual DOM, so key is meaningless (issue #6)\n if (attrName === 'key') continue;\n\n // Handle bind: attributes for components\n if (isBindingAttribute(attrName)) {\n const bindProp = getBindingProperty(attrName);\n const signalExpr = attr.value.expression;\n\n if (bindProp === 'value') {\n props.push(\n t.objectProperty(t.identifier('value'), t.callExpression(t.cloneNode(signalExpr), []))\n );\n props.push(\n t.objectProperty(\n t.identifier('onInput'),\n t.arrowFunctionExpression(\n [t.identifier('e')],\n t.callExpression(\n t.memberExpression(t.cloneNode(signalExpr), t.identifier('set')),\n [t.memberExpression(\n t.memberExpression(t.identifier('e'), t.identifier('target')),\n t.identifier('value')\n )]\n )\n )\n )\n );\n } else if (bindProp === 'checked') {\n props.push(\n t.objectProperty(t.identifier('checked'), t.callExpression(t.cloneNode(signalExpr), []))\n );\n props.push(\n t.objectProperty(\n t.identifier('onChange'),\n t.arrowFunctionExpression(\n [t.identifier('e')],\n t.callExpression(\n t.memberExpression(t.cloneNode(signalExpr), t.identifier('set')),\n [t.memberExpression(\n t.memberExpression(t.identifier('e'), t.identifier('target')),\n t.identifier('checked')\n )]\n )\n )\n )\n );\n }\n continue;\n }\n\n // Handle event modifiers on components\n if (attrName.startsWith('on') && (attrName.includes('|') || hasEventModifiers(attrName, state))) {\n const { eventName, modifiers } = parseEventModifiers(attrName);\n const handler = getAttributeValue(attr.value);\n const wrappedHandler = createEventHandler(handler, modifiers);\n props.push(t.objectProperty(t.identifier(eventName), wrappedHandler));\n continue;\n }\n\n const value = getAttributeValue(attr.value);\n\n props.push(\n t.objectProperty(\n /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(attrName)\n ? t.identifier(attrName)\n : t.stringLiteral(attrName),\n value\n )\n );\n }\n\n // Transform children\n const transformedChildren = [];\n for (const child of children) {\n if (t.isJSXText(child)) {\n const text = normalizeJsxText(child.value);\n if (text) transformedChildren.push(t.stringLiteral(text));\n } else if (t.isJSXExpressionContainer(child)) {\n if (!t.isJSXEmptyExpression(child.expression)) {\n transformedChildren.push(child.expression);\n }\n } else if (t.isJSXElement(child)) {\n transformedChildren.push(transformElementFineGrained({ node: child }, state));\n } else if (t.isJSXFragment(child)) {\n transformedChildren.push(transformFragmentFineGrained({ node: child }, state));\n }\n }\n\n let propsExpr;\n if (hasSpread) {\n if (props.length > 0) {\n propsExpr = t.callExpression(\n t.memberExpression(t.identifier('Object'), t.identifier('assign')),\n [t.objectExpression([]), spreadExpr, t.objectExpression(props)]\n );\n } else {\n propsExpr = spreadExpr;\n }\n } else if (props.length > 0) {\n propsExpr = t.objectExpression(props);\n } else {\n propsExpr = t.nullLiteral();\n }\n\n const childrenArray = transformedChildren.length > 0\n ? t.arrayExpression(transformedChildren)\n : t.arrayExpression([]);\n\n return t.callExpression(t.identifier('_$createComponent'), [t.identifier(componentName), propsExpr, childrenArray]);\n }\n\n function transformForFineGrained(path, state) {\n const { node } = path;\n const attributes = node.openingElement.attributes;\n const children = node.children;\n\n // <For each={data} key={item => item.id}>{(item) => <Row />}</For>\n // \u2192 mapArray(data, (item) => ..., { key: item => item.id })\n //\n // NOTE: <For> is supported but .map() with a key prop is the preferred\n // pattern for list rendering. The compiler auto-lowers .map() to\n // _$mapArray with raw mode, which is simpler and matches JS idioms.\n // <For> is useful when you need signal-wrapped item accessors (keyed\n // mode without raw), so that item updates don't recreate DOM nodes.\n if (process.env.NODE_ENV !== 'production') {\n const fileName = state.filename || state.file?.opts?.filename || '<unknown>';\n if (!_forInfoWarned.has(fileName)) {\n _forInfoWarned.add(fileName);\n const loc = node.loc;\n const lineInfo = loc ? `:${loc.start.line}:${loc.start.column}` : '';\n console.info(\n `[what-compiler] <For> at ${fileName}${lineInfo}: consider using .map() with a key prop instead. ` +\n `The compiler auto-lowers .map() to efficient keyed reconciliation. ` +\n `<For> is only needed for signal-wrapped item accessors (advanced).`\n );\n }\n }\n\n let eachExpr = null;\n let keyExpr = null;\n for (const attr of attributes) {\n if (t.isJSXAttribute(attr)) {\n const name = getAttrName(attr);\n if (name === 'each') eachExpr = getAttributeValue(attr.value);\n else if (name === 'key') keyExpr = getAttributeValue(attr.value);\n }\n }\n\n if (!eachExpr) {\n console.warn('[what-compiler] <For> element missing \"each\" attribute.');\n state.needsH = true;\n return transformElementAsH(path, state);\n }\n\n let renderFn = null;\n for (const child of children) {\n if (t.isJSXExpressionContainer(child) && !t.isJSXEmptyExpression(child.expression)) {\n renderFn = child.expression;\n break;\n }\n }\n\n if (!renderFn) {\n console.warn('[what-compiler] <For> element missing render function child.');\n state.needsH = true;\n return transformElementAsH(path, state);\n }\n\n state.needsMapArray = true;\n const args = [eachExpr, renderFn];\n if (keyExpr) {\n args.push(t.objectExpression([\n t.objectProperty(t.identifier('key'), keyExpr)\n ]));\n }\n return t.callExpression(t.identifier('_$mapArray'), args);\n }\n\n function transformShowFineGrained(path, state) {\n // <Show when={cond} fallback={alt}>{content}</Show>\n // \u2192 () => cond() ? content : (fallback || null)\n // This compiles to a reactive expression that insert() wraps in an effect.\n const { node } = path;\n const attributes = node.openingElement.attributes;\n const children = node.children;\n\n let whenExpr = null;\n let fallbackExpr = null;\n for (const attr of attributes) {\n if (t.isJSXAttribute(attr)) {\n const name = getAttrName(attr);\n if (name === 'when') whenExpr = getAttributeValue(attr.value);\n else if (name === 'fallback') fallbackExpr = getAttributeValue(attr.value);\n }\n }\n\n if (!whenExpr) {\n // <Show> without a when prop has no defined semantics \u2014 fail loudly at\n // build time so the user fixes their source instead of seeing runtime\n // confusion. buildCodeFrameError pins the error to the JSX location.\n throw path.buildCodeFrameError(\n '<Show> requires a \"when\" prop. Example: <Show when={isOpen} fallback={null}>...</Show>'\n );\n }\n\n // Extract the content \u2014 either a render function child or static JSX children\n let contentExpr = null;\n for (const child of children) {\n if (t.isJSXExpressionContainer(child) && !t.isJSXEmptyExpression(child.expression)) {\n // Render function: {() => <div>...</div>} or {(value) => <div>{value}</div>}\n contentExpr = child.expression;\n break;\n }\n }\n\n if (!contentExpr) {\n // Static children \u2014 collect and transform them\n const transformedChildren = [];\n for (const child of children) {\n if (t.isJSXText(child)) {\n const text = normalizeJsxText(child.value);\n if (text) transformedChildren.push(t.stringLiteral(text));\n } else if (t.isJSXElement(child)) {\n transformedChildren.push(transformElementFineGrained({ node: child }, state));\n }\n }\n if (transformedChildren.length === 1) {\n contentExpr = transformedChildren[0];\n } else if (transformedChildren.length > 1) {\n contentExpr = t.arrayExpression(transformedChildren);\n } else {\n contentExpr = t.nullLiteral();\n }\n }\n\n // Build:\n // () => { const _v = <condition>; return _v ? <consequent> : <alternate>; }\n // Hoisting into a local prevents double-evaluation of the `when` signal\n // (the consequent's render callback also needs the resolved value).\n //\n // `whenExpr` shape determines how we form the condition:\n // - call expression \u2192 use as-is <Show when={cond()}>\n // - arrow w/ expression body \u2192 use the body <Show when={() => x > 5}>\n // - identifier that looks like a signal/import <Show when={isOpen}>\n // \u2192 invoke it as accessor: isOpen()\n // - anything else (member, literal, logical, etc.) <Show when={user.isAdmin}>\n // \u2192 use the raw expression. Do NOT invoke \u2014\n // non-functions would throw at runtime.\n let condition;\n if (t.isCallExpression(whenExpr)) {\n condition = whenExpr;\n } else if (t.isArrowFunctionExpression(whenExpr) && t.isExpression(whenExpr.body)) {\n condition = whenExpr.body;\n } else if (\n t.isIdentifier(whenExpr) &&\n (\n (state.signalNames && isSignalIdentifier(whenExpr.name, state.signalNames)) ||\n (state.importedIdentifiers && state.importedIdentifiers.has(whenExpr.name))\n )\n ) {\n condition = t.callExpression(whenExpr, []);\n } else {\n // Plain boolean expression \u2014 member access, literal, logical, etc.\n condition = whenExpr;\n }\n\n const vId = path.scope\n ? path.scope.generateUidIdentifier('v')\n : t.identifier('_v');\n\n const contentIsFn = t.isFunction(contentExpr);\n const consequent = contentIsFn\n ? t.callExpression(contentExpr, [t.cloneNode(vId)])\n : contentExpr;\n const alternate = fallbackExpr || t.nullLiteral();\n\n // Branch memoization (SPRINT v0.11 C1): route a reactive `when` through an\n // equality-gated memo so the insert effect only re-fires (recreating the\n // taken branch's DOM) when the condition actually changes \u2014 not on every\n // write to a signal the condition happens to read.\n // - Render-function children receive the resolved value (`{v => ...}`),\n // so the memo is VALUE-gated (Object.is): identity changes re-render,\n // matching pre-memo semantics.\n // - Static children only use the value for truthiness \u2192 gate on !!cond\n // so e.g. `when={items().length}` doesn't re-render on 2 \u2192 3.\n if (isPotentiallyReactive(condition, state.signalNames, state.importedIdentifiers)) {\n const condId = state.nextMemoId();\n state.needsMemo = true;\n const memoBody = contentIsFn\n ? condition\n : t.unaryExpression('!', t.unaryExpression('!', condition));\n if (!state._pendingSetup) state._pendingSetup = [];\n state._pendingSetup.push(\n t.variableDeclaration('const', [\n t.variableDeclarator(\n t.identifier(condId),\n t.callExpression(t.identifier('_$memo'), [\n t.arrowFunctionExpression([], memoBody)\n ])\n )\n ])\n );\n condition = t.callExpression(t.identifier(condId), []);\n }\n\n return t.arrowFunctionExpression([], t.blockStatement([\n t.variableDeclaration('const', [\n t.variableDeclarator(vId, condition)\n ]),\n t.returnStatement(\n t.conditionalExpression(t.cloneNode(vId), consequent, alternate)\n )\n ]));\n }\n\n // A fragment-as-root returns an array (or single value) that the runtime\n // mounts element-by-element (createDOM / insert). Unlike the element-child\n // path there's no host element to _$insert into with a marker, so reactive\n // children must instead be emitted as `() => expr` arrows \u2014 the runtime's\n // createDOM/insert treat a function array-item as a reactive binding (it\n // wraps it in an effect with comment markers). Without this, a bare dynamic\n // expression like `{count()}` is evaluated exactly once and never updates.\n //\n // This applies the SAME lowering the element-child expression path uses:\n // - tryLowerMapToMapArray for keyed `items().map(...)` \u2192 _$mapArray\n // - memoizeBranchCondition for reactive ternary/&&/|| (node-identity stable\n // branches: the taken branch's DOM is only rebuilt when the condition\n // actually flips, not on every read of a signal the condition touches)\n // - reactive expressions wrapped in `() =>` so the runtime tracks them\n // Memo (_$memo) declarations are pushed into state._pendingSetup, which\n // transformJsxRoot drains into the enclosing scope. (SPRINT v0.11)\n function lowerFragmentExprChild(expr, state) {\n if (!state._pendingSetup) state._pendingSetup = [];\n const setup = state._pendingSetup;\n\n // Auto-lower .map() to mapArray when the callback returns keyed JSX.\n const mapResult = tryLowerMapToMapArray(expr, state);\n if (mapResult) {\n state.needsMapArray = true;\n // A bare _$mapArray(...) is a self-managing inserter and an arrow is\n // already reactive \u2014 emit as-is. A ternary/logical wrapping the call\n // keeps its condition reactive via a () => wrapper (and memoization).\n const isBareMapArray = t.isCallExpression(mapResult) && t.isIdentifier(mapResult.callee) &&\n (mapResult.callee.name === '_$mapArray' || mapResult.callee.name === 'mapArray');\n const isArrowAlready = t.isArrowFunctionExpression(mapResult);\n if (isArrowAlready && t.isExpression(mapResult.body)) {\n mapResult.body = memoizeBranchCondition(mapResult.body, setup, state);\n return mapResult;\n }\n if (isBareMapArray) return mapResult;\n const memoized = memoizeBranchCondition(mapResult, setup, state);\n return t.arrowFunctionExpression([], memoized);\n }\n\n // mapArray() calls are self-managing inserters \u2014 pass directly.\n const isMapArrayCall = t.isCallExpression(expr) && t.isIdentifier(expr.callee) &&\n (expr.callee.name === 'mapArray' || expr.callee.name === '_$mapArray');\n if (isMapArrayCall) {\n state.needsMapArray = true;\n if (expr.callee.name === 'mapArray') expr.callee.name = '_$mapArray';\n return expr;\n }\n\n if (isPotentiallyReactive(expr, state.signalNames, state.importedIdentifiers)) {\n // Branch memoization (C1): conditional/logical children only rebuild the\n // taken branch's DOM when the condition actually flips.\n expr = memoizeBranchCondition(expr, setup, state);\n return t.arrowFunctionExpression([], expr);\n }\n\n // Static \u2014 emit verbatim.\n return expr;\n }\n\n function transformFragmentFineGrained(path, state) {\n const { node } = path;\n const children = node.children;\n\n const transformed = [];\n for (const child of children) {\n if (t.isJSXText(child)) {\n const text = normalizeJsxText(child.value);\n if (text) transformed.push(t.stringLiteral(text));\n } else if (t.isJSXExpressionContainer(child)) {\n if (!t.isJSXEmptyExpression(child.expression)) {\n transformed.push(lowerFragmentExprChild(child.expression, state));\n }\n } else if (t.isJSXElement(child)) {\n transformed.push(transformElementFineGrained({ node: child }, state));\n } else if (t.isJSXFragment(child)) {\n transformed.push(transformFragmentFineGrained({ node: child }, state));\n }\n }\n\n if (transformed.length === 1) return transformed[0];\n return t.arrayExpression(transformed);\n }\n\n // Template deduplication: same HTML string \u2192 same module-level const\n function getOrCreateTemplate(state, html) {\n if (state.templateMap.has(html)) {\n return state.templateMap.get(html);\n }\n const id = `_tmpl$${state.templateCount++}`;\n state.templateMap.set(html, id);\n state.templates.push({ id, html });\n return id;\n }\n\n // Shared driver for top-level JSX roots (elements AND fragments).\n //\n // transformElementFineGrained does NOT emit IIFEs: it pushes setup\n // statements (`const _el$N = _tmpl$X(); _el$N.$$click = ...; _$insert(...)`)\n // into state._pendingSetup and returns the bare `_el$N` identifier. Whoever\n // visits the JSX root is responsible for draining _pendingSetup and placing\n // those statements somewhere the returned reference can see them.\n //\n // The JSXElement visitor always did this; the JSXFragment visitor did not,\n // so fragments whose element children had dynamic parts (event handlers,\n // dynamic attrs/children) compiled to references to _el$N variables that\n // were never declared \u2014 a runtime ReferenceError. Both visitors now share\n // this driver. (SPRINT v0.11: composes with C1 branch memoization and C2\n // specialized setters \u2014 memo/setter statements ride in _pendingSetup too.)\n function transformJsxRoot(path, state, transform) {\n // FIX-1: Use scope-aware signal detection instead of file-global.\n // Memoize per Babel scope: every JSX root in the same scope yields the\n // same signal-name set, so without this the full scope-chain walk ran\n // once per element \u2014 O(n\u00B2) compile time for a large single component.\n // (AUDIT-2026-06-06 H2)\n const scope = path.scope;\n let cache = state._signalNamesCache;\n if (!cache) cache = state._signalNamesCache = new WeakMap();\n let names = cache.get(scope);\n if (!names) {\n names = collectSignalNamesFromScope(path);\n cache.set(scope, names);\n }\n state.signalNames = names;\n state._pendingSetup = [];\n const transformed = transform(path, state);\n const pending = state._pendingSetup;\n state._pendingSetup = [];\n\n if (pending.length > 0) {\n // Find the enclosing statement to hoist setup before it,\n // but only if it's in the SAME function scope. Crossing into\n // an inner arrow/function (e.g., .map(item => <JSX/>)) would\n // hoist references to closure variables out of scope.\n let stmtPath = path;\n let crossedFunctionBoundary = false;\n while (stmtPath && !stmtPath.isStatement()) {\n if (stmtPath.isArrowFunctionExpression() || stmtPath.isFunctionExpression()) {\n crossedFunctionBoundary = true;\n }\n stmtPath = stmtPath.parentPath;\n }\n // We can safely hoist setup as siblings of `stmtPath` ONLY if\n // `stmtPath` lives inside a statement list (BlockStatement.body or\n // Program.body). For single-statement positions like\n // `if (cond) return <jsx/>;` or `while (x) return <jsx/>;`,\n // Babel's `insertBefore` wraps the parent into a block lazily and\n // multi-statement inserts end up split across scopes, leaving the\n // `_$insert(_el$N, ...)` call outside the block that declares\n // `const _el$N`. This is a TDZ/ReferenceError at runtime.\n //\n // To guarantee that ALL setup statements and the returned reference\n // share one lexical block, require that `stmtPath.listKey` points\n // at a statement list. Otherwise fall through to the IIFE path,\n // which is always safe.\n const inStatementList =\n stmtPath\n && stmtPath.isStatement()\n && (stmtPath.listKey === 'body' || stmtPath.listKey === 'consequent')\n && Array.isArray(stmtPath.container);\n if (inStatementList && !crossedFunctionBoundary) {\n // Same function scope \u2014 safe to hoist setup before the enclosing\n // statement. Works for return statements too: `insertBefore`\n // places setup above `return <jsx/>` without wrapping in an IIFE.\n stmtPath.insertBefore(pending);\n path.replaceWith(transformed);\n } else {\n // Crossed a function boundary or no enclosing statement found \u2014\n // fall back to IIFE so closure variables remain in scope.\n pending.push(t.returnStatement(transformed));\n path.replaceWith(\n t.callExpression(\n t.arrowFunctionExpression([], t.blockStatement(pending)),\n []\n )\n );\n }\n } else {\n path.replaceWith(transformed);\n }\n }\n\n // =====================================================\n // Plugin entry\n // =====================================================\n\n return {\n name: 'what-jsx-transform',\n\n visitor: {\n Program: {\n enter(path, state) {\n // Fine-grained mode state\n state.needsTemplate = false;\n state.needsInsert = false;\n state.needsEffect = false;\n state.needsMapArray = false;\n state.needsSpread = false;\n state.needsSetProp = false;\n state.needsMemo = false; // branch memoization (C1)\n state.needsSetClass = false; // specialized setters (C2)\n state.needsSetStyle = false;\n state.needsSetAttr = false;\n state.needsSetValue = false;\n state.needsSetChecked = false;\n state.needsH = false;\n state.needsCreateComponent = false;\n state.needsFragment = false;\n state.needsIsland = false;\n state.needsDelegation = false;\n state.delegatedEvents = new Set();\n state.templates = [];\n state.templateMap = new Map(); // html \u2192 template id (deduplication)\n state.templateCount = 0;\n state._varCounter = 0;\n state._memoCounter = 0;\n state._pendingSetup = [];\n state.nextVarId = () => `_el$${state._varCounter++}`;\n state.nextMemoId = () => `_c$${state._memoCounter++}`;\n\n // Collect signal names for smart reactivity detection\n state.signalNames = new Set();\n\n // --- Imported Signal Tracking ---\n // Only mark imports as potentially reactive if they come from known\n // reactive sources: what-framework, what-framework/*, relative paths\n // (user stores), or functions matching use*/create* naming conventions.\n // This prevents over-wrapping of utility imports (lodash, etc.).\n state.importedIdentifiers = new Set();\n for (const node of path.node.body) {\n if (t.isImportDeclaration(node)) {\n const source = node.source.value;\n const isReactiveSource =\n source === 'what-framework' ||\n source.startsWith('what-framework/') ||\n source === 'what-core' ||\n source.startsWith('what-core/') ||\n source.startsWith('./') ||\n source.startsWith('../');\n\n for (const spec of node.specifiers) {\n let localName = null;\n if (t.isImportSpecifier(spec) && t.isIdentifier(spec.local)) {\n localName = spec.local.name;\n } else if (t.isImportDefaultSpecifier(spec) && t.isIdentifier(spec.local)) {\n localName = spec.local.name;\n } else if (t.isImportNamespaceSpecifier(spec) && t.isIdentifier(spec.local)) {\n localName = spec.local.name;\n }\n\n if (localName) {\n // Mark as reactive if from a reactive source, or if the name\n // matches use*/create* conventions (hooks/signal creators)\n if (isReactiveSource || /^(use|create)[A-Z]/.test(localName)) {\n state.importedIdentifiers.add(localName);\n }\n }\n }\n }\n }\n\n path.traverse({\n VariableDeclarator(declPath) {\n const init = declPath.node.init;\n if (!init || !t.isCallExpression(init)) return;\n\n const callee = init.callee;\n let calleeName = '';\n if (t.isIdentifier(callee)) {\n calleeName = callee.name;\n } else if (t.isMemberExpression(callee) && t.isIdentifier(callee.property)) {\n calleeName = callee.property.name;\n }\n\n if (SIGNAL_CREATORS.has(calleeName)) {\n const id = declPath.node.id;\n if (t.isIdentifier(id)) {\n state.signalNames.add(id.name);\n } else if (t.isArrayPattern(id)) {\n for (const el of id.elements) {\n if (t.isIdentifier(el)) state.signalNames.add(el.name);\n }\n } else if (t.isObjectPattern(id)) {\n for (const prop of id.properties) {\n if (t.isObjectProperty(prop) && t.isIdentifier(prop.value)) {\n state.signalNames.add(prop.value.name);\n }\n }\n }\n }\n }\n });\n },\n\n exit(path, state) {\n // Insert template declarations at top of program (hoisted to module scope)\n for (const tmpl of state.templates.reverse()) {\n // /* @__PURE__ */ marks the hoisted call as side-effect-free so\n // bundlers (esbuild/rollup/terser) can drop templates whose\n // components are tree-shaken away. (SPRINT v0.11 C6)\n const tmplCall = t.callExpression(t.identifier('_$template'), [t.stringLiteral(tmpl.html)]);\n t.addComment(tmplCall, 'leading', ' @__PURE__ ');\n path.unshiftContainer('body',\n t.variableDeclaration('const', [\n t.variableDeclarator(t.identifier(tmpl.id), tmplCall)\n ])\n );\n }\n\n // Build fine-grained imports\n const fgSpecifiers = [];\n if (state.needsTemplate) {\n // Import the compiler-internal `_$template` export, NOT the public\n // `template` export. The public one warns in dev (\"template() is a\n // compiler internal... XSS\") \u2014 compiled output must never trip that\n // guard; the warning exists for *hand-written* template() calls\n // with dynamic strings. (SPRINT v0.11 C5)\n fgSpecifiers.push(\n t.importSpecifier(t.identifier('_$template'), t.identifier('_$template'))\n );\n }\n if (state.needsInsert) {\n fgSpecifiers.push(\n t.importSpecifier(t.identifier('_$insert'), t.identifier('insert'))\n );\n }\n if (state.needsEffect) {\n fgSpecifiers.push(\n t.importSpecifier(t.identifier('_$effect'), t.identifier('effect'))\n );\n }\n if (state.needsMapArray) {\n fgSpecifiers.push(\n t.importSpecifier(t.identifier('_$mapArray'), t.identifier('mapArray'))\n );\n }\n if (state.needsSpread) {\n fgSpecifiers.push(\n t.importSpecifier(t.identifier('_$spread'), t.identifier('spread'))\n );\n }\n if (state.needsSetProp) {\n fgSpecifiers.push(\n t.importSpecifier(t.identifier('_$setProp'), t.identifier('setProp'))\n );\n }\n if (state.needsMemo) {\n fgSpecifiers.push(\n t.importSpecifier(t.identifier('_$memo'), t.identifier('memo'))\n );\n }\n if (state.needsSetClass) {\n fgSpecifiers.push(\n t.importSpecifier(t.identifier('_$setClass'), t.identifier('setClass'))\n );\n }\n if (state.needsSetStyle) {\n fgSpecifiers.push(\n t.importSpecifier(t.identifier('_$setStyle'), t.identifier('setStyle'))\n );\n }\n if (state.needsSetAttr) {\n fgSpecifiers.push(\n t.importSpecifier(t.identifier('_$setAttr'), t.identifier('setAttr'))\n );\n }\n if (state.needsSetValue) {\n fgSpecifiers.push(\n t.importSpecifier(t.identifier('_$setValue'), t.identifier('setValue'))\n );\n }\n if (state.needsSetChecked) {\n fgSpecifiers.push(\n t.importSpecifier(t.identifier('_$setChecked'), t.identifier('setChecked'))\n );\n }\n if (state.needsCreateComponent) {\n fgSpecifiers.push(\n t.importSpecifier(t.identifier('_$createComponent'), t.identifier('_$createComponent'))\n );\n }\n if (state.needsDelegation) {\n fgSpecifiers.push(\n t.importSpecifier(t.identifier('_$delegateEvents'), t.identifier('delegateEvents'))\n );\n }\n\n // Core imports (h/Fragment/Island for components)\n const coreSpecifiers = [];\n if (state.needsH) {\n coreSpecifiers.push(\n t.importSpecifier(t.identifier('h'), t.identifier('h'))\n );\n }\n if (state.needsFragment) {\n coreSpecifiers.push(\n t.importSpecifier(t.identifier('Fragment'), t.identifier('Fragment'))\n );\n }\n if (state.needsIsland) {\n coreSpecifiers.push(\n t.importSpecifier(t.identifier('Island'), t.identifier('Island'))\n );\n }\n\n if (fgSpecifiers.length > 0) {\n let existingRenderImport = null;\n for (const node of path.node.body) {\n if (t.isImportDeclaration(node) && (\n node.source.value === 'what-framework/render' ||\n node.source.value === 'what-core/render'\n )) {\n existingRenderImport = node;\n break;\n }\n }\n\n if (existingRenderImport) {\n const existingNames = new Set(\n existingRenderImport.specifiers\n .filter(s => t.isImportSpecifier(s))\n .map(s => s.imported.name)\n );\n for (const spec of fgSpecifiers) {\n if (!existingNames.has(spec.imported.name)) {\n existingRenderImport.specifiers.push(spec);\n }\n }\n } else {\n path.unshiftContainer('body',\n t.importDeclaration(fgSpecifiers, t.stringLiteral('what-framework/render'))\n );\n }\n }\n\n if (coreSpecifiers.length > 0) {\n addCoreImports(path, t, coreSpecifiers);\n }\n\n // Emit LAZY event delegation setup if any delegated events were used.\n // Previously this was a bare module-top-level `_$delegateEvents([...])`\n // call \u2014 a side effect that (a) prevented bundlers from tree-shaking\n // modules whose components are never used, and (b) attached document\n // listeners at import time even when no component ever mounted.\n // Instead we emit a once-guarded helper that each element setup calls\n // at construction time; unused modules carry only dead declarations\n // that DCE removes. (SPRINT v0.11 C6)\n if (state.needsDelegation && state.delegatedEvents && state.delegatedEvents.size > 0) {\n const eventArray = t.arrayExpression(\n [...state.delegatedEvents].map(e => t.stringLiteral(e))\n );\n // function _$delegate$() { if (_$delegated$) return; _$delegated$ = true; _$delegateEvents([...]); }\n const helperFn = t.functionDeclaration(\n t.identifier('_$delegate$'),\n [],\n t.blockStatement([\n t.ifStatement(\n t.identifier('_$delegated$'),\n t.returnStatement()\n ),\n t.expressionStatement(\n t.assignmentExpression('=', t.identifier('_$delegated$'), t.booleanLiteral(true))\n ),\n t.expressionStatement(\n t.callExpression(t.identifier('_$delegateEvents'), [eventArray])\n ),\n ])\n );\n // Unshift so `let _$delegated$ = false` executes before any\n // top-level component construction (e.g. a same-module mount()).\n path.unshiftContainer('body', [\n t.variableDeclaration('let', [\n t.variableDeclarator(t.identifier('_$delegated$'), t.booleanLiteral(false))\n ]),\n helperFn,\n ]);\n }\n }\n },\n\n JSXElement(path, state) {\n transformJsxRoot(path, state, transformElementFineGrained);\n },\n\n JSXFragment(path, state) {\n // Fragments share the element driver: their element children push\n // `const _el$N = ...` setup into _pendingSetup, which MUST be drained\n // here (hoisted or IIFE-wrapped) or the emitted `_el$N` references\n // are never declared (ReferenceError at runtime).\n transformJsxRoot(path, state, transformFragmentFineGrained);\n }\n }\n };\n}\n\nfunction addCoreImports(path, t, coreSpecifiers) {\n let existingImport = null;\n for (const node of path.node.body) {\n if (t.isImportDeclaration(node) && (\n node.source.value === 'what-core' || node.source.value === 'what-framework'\n )) {\n existingImport = node;\n break;\n }\n }\n\n if (existingImport) {\n const existingNames = new Set(\n existingImport.specifiers\n .filter(s => t.isImportSpecifier(s))\n .map(s => s.imported.name)\n );\n for (const spec of coreSpecifiers) {\n if (!existingNames.has(spec.imported.name)) {\n existingImport.specifiers.push(spec);\n }\n }\n } else {\n const importDecl = t.importDeclaration(\n coreSpecifiers,\n t.stringLiteral('what-framework')\n );\n path.unshiftContainer('body', importDecl);\n }\n}\n"],
5
+ "mappings": "AAmBA,IAAMA,GAAk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AI7B,EAAE,oBAAoB0E,CAAI,IAC5BA,EAAK,OAAO,QAAU,aAAeA,EAAK,OAAO,QAAU,kBAC1D,CACD4H,EAAiB5H,EACjB,KACF,CAGF,GAAI4H,EAAgB,CAClB,IAAMJ,EAAgB,IAAI,IACxBI,EAAe,WACZ,OAAOhM,GAAKN,EAAE,kBAAkBM,CAAC,CAAC,EAClC,IAAIA,GAAKA,EAAE,SAAS,IAAI,CAC7B,EACA,QAAWoL,KAAQM,EACZE,EAAc,IAAIR,EAAK,SAAS,IAAI,GACvCY,EAAe,WAAW,KAAKZ,CAAI,CAGzC,KAAO,CACL,IAAMa,EAAavM,EAAE,kBACnBgM,EACAhM,EAAE,cAAc,gBAAgB,CAClC,EACA6B,EAAK,iBAAiB,OAAQ0K,CAAU,CAC1C,CACF",
6
+ "names": ["EVENT_MODIFIERS", "EVENT_OPTION_MODIFIERS", "VOID_HTML_ELEMENTS", "DELEGATED_EVENTS", "SAFE_GLOBAL_CALLS", "SIGNAL_CREATORS", "normalizeJsxText", "value", "lines", "lastNonEmpty", "i", "out", "line", "isFirst", "isLast", "whatBabelPlugin", "t", "_unknownModifierWarned", "_forInfoWarned", "hasEventModifiers", "name", "state", "s", "parseEventModifiers", "delimiter", "parts", "eventName", "modifiers", "m", "isBindingAttribute", "getBindingProperty", "isComponent", "isVoidHtmlElement", "getAttributeValue", "normalizeAttrName", "attrName", "getAttrName", "attr", "createEventHandler", "handler", "wrappedHandler", "mod", "isSignalIdentifier", "signalNames", "collectSignalNamesFromScope", "path", "extractFromDeclarator", "decl", "init", "callee", "calleeName", "id", "el", "prop", "scope", "binding", "fnNode", "param", "collectSignalNames", "isSafeGlobalCall", "expr", "isUncertainReactive", "importedIds", "arg", "isPotentiallyReactive", "e", "tryLowerMapToMapArray", "mapCall", "wrappedInArrow", "loweredCon", "tryLowerMapCall", "loweredAlt", "result", "loweredRight", "mapFn", "returnExpr", "ret", "attrs", "keyAttr", "keyValue", "a", "sourceObj", "source", "itemParam", "keyFn", "isStaticChild", "child", "tagName", "isDynamicAttr", "extractStaticHTML", "node", "text", "escapeHTML", "html", "domName", "escapeAttr", "selfClosing", "str", "transformElementFineGrained", "openingElement", "transformForFineGrained", "transformShowFineGrained", "transformComponentFineGrained", "attributes", "children", "allChildrenStatic", "allAttrsStatic", "noEvents", "tmplId", "getOrCreateTemplate", "loc", "fileName", "lineInfo", "transformElementAsH", "elId", "statements", "applyDynamicAttrs", "applyDynamicChildren", "props", "domAttrName", "transformedChildren", "transformFragmentFineGrained", "propsExpr", "VALUE_PROP_TAGS", "buildSetPropCall", "propName", "valueExpr", "delegateInitEmitted", "emitDelegateInit", "refExpr", "event", "optionMods", "addEventArgs", "optsProps", "bindProp", "signalExpr", "effectCall", "buildsDOM", "key", "v", "memoizeBranchCondition", "testExpr", "isTernary", "condId", "memoBody", "condRead", "parentNode", "entries", "childIndex", "childTag", "hasAnythingDynamic", "entriesNeedingRef", "needsPreCapture", "markerVars", "prevVar", "prevIndex", "entry", "idx", "markerVar", "buildChildAccess", "getMarker", "marker", "mapResult", "isBareMapArray", "isArrowAlready", "insertArg", "insertCall", "transformed", "childElRef", "fChild", "index", "componentName", "clientDirective", "filteredAttrs", "mode", "islandProps", "hasSpread", "spreadExpr", "childrenArray", "eachExpr", "keyExpr", "renderFn", "args", "whenExpr", "fallbackExpr", "contentExpr", "condition", "vId", "contentIsFn", "consequent", "alternate", "lowerFragmentExprChild", "setup", "memoized", "transformJsxRoot", "transform", "cache", "names", "pending", "stmtPath", "crossedFunctionBoundary", "isReactiveSource", "spec", "localName", "declPath", "tmpl", "tmplCall", "fgSpecifiers", "coreSpecifiers", "existingRenderImport", "existingNames", "addCoreImports", "eventArray", "helperFn", "existingImport", "importDecl"]
7
7
  }