@generaltranslation/vue-extractor 0.0.0 → 0.1.0-iris.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.
- package/LICENSE.md +18 -102
- package/dist/detect.d.ts +8 -0
- package/dist/detect.js +2 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -1
- package/dist/inspect.d.ts +9 -0
- package/dist/inspect.js +2 -0
- package/dist/integration.d.ts +69 -0
- package/dist/integration.js +162 -0
- package/dist/integration.js.map +1 -0
- package/dist/internal/config/configFiles.d.ts +6 -0
- package/dist/internal/config/configFiles.js +34 -0
- package/dist/internal/config/configFiles.js.map +1 -0
- package/dist/internal/config/resolveVueCompilerOptions.d.ts +6 -0
- package/dist/internal/config/resolveVueCompilerOptions.js +74 -56
- package/dist/internal/config/resolveVueCompilerOptions.js.map +1 -1
- package/dist/internal/extractFromVueSource.d.ts +4 -3
- package/dist/internal/extractFromVueSource.js +255 -12
- package/dist/internal/extractFromVueSource.js.map +1 -1
- package/dist/internal/project/consumerUsage.d.ts +34 -0
- package/dist/internal/project/consumerUsage.js +1220 -0
- package/dist/internal/project/consumerUsage.js.map +1 -0
- package/dist/internal/project/detectVueProject.d.ts +13 -0
- package/dist/internal/project/detectVueProject.js +65 -0
- package/dist/internal/project/detectVueProject.js.map +1 -0
- package/dist/internal/project/extractFromVueProject.d.ts +10 -0
- package/dist/internal/project/extractFromVueProject.js +579 -0
- package/dist/internal/project/extractFromVueProject.js.map +1 -0
- package/dist/internal/project/inspectVueProject.d.ts +48 -0
- package/dist/internal/project/inspectVueProject.js +143 -0
- package/dist/internal/project/inspectVueProject.js.map +1 -0
- package/dist/internal/project/manifest.d.ts +64 -0
- package/dist/internal/project/manifest.js +270 -0
- package/dist/internal/project/manifest.js.map +1 -0
- package/dist/internal/project/mergeVueProjectExtraction.d.ts +18 -0
- package/dist/internal/project/mergeVueProjectExtraction.js +79 -0
- package/dist/internal/project/mergeVueProjectExtraction.js.map +1 -0
- package/dist/internal/project/moduleResolver.d.ts +18 -0
- package/dist/internal/project/moduleResolver.js +325 -0
- package/dist/internal/project/moduleResolver.js.map +1 -0
- package/dist/internal/project/scopes.d.ts +31 -0
- package/dist/internal/project/scopes.js +182 -0
- package/dist/internal/project/scopes.js.map +1 -0
- package/dist/internal/project/sourcePatterns.d.ts +4 -0
- package/dist/internal/project/sourcePatterns.js +32 -0
- package/dist/internal/project/sourcePatterns.js.map +1 -0
- package/dist/internal/project/viteAliases.d.ts +42 -0
- package/dist/internal/project/viteAliases.js +1020 -0
- package/dist/internal/project/viteAliases.js.map +1 -0
- package/dist/internal/project/vueSourceClassification.d.ts +13 -0
- package/dist/internal/project/vueSourceClassification.js +146 -0
- package/dist/internal/project/vueSourceClassification.js.map +1 -0
- package/dist/internal/project/workspaces.d.ts +31 -0
- package/dist/internal/project/workspaces.js +326 -0
- package/dist/internal/project/workspaces.js.map +1 -0
- package/dist/internal/project/wrapperProvenance.d.ts +21 -0
- package/dist/internal/project/wrapperProvenance.js +287 -0
- package/dist/internal/project/wrapperProvenance.js.map +1 -0
- package/dist/internal/script/analyze.js +252 -85
- package/dist/internal/script/analyze.js.map +1 -1
- package/dist/internal/script/jsx.d.ts +7 -4
- package/dist/internal/script/jsx.js +351 -79
- package/dist/internal/script/jsx.js.map +1 -1
- package/dist/internal/script/localModules.d.ts +23 -2
- package/dist/internal/script/localModules.js +533 -20
- package/dist/internal/script/localModules.js.map +1 -1
- package/dist/internal/script/model.d.ts +9 -2
- package/dist/internal/script/parser.js +2 -1
- package/dist/internal/script/parser.js.map +1 -1
- package/dist/internal/script/runtimeModules.d.ts +10 -0
- package/dist/internal/script/runtimeModules.js +27 -0
- package/dist/internal/script/runtimeModules.js.map +1 -0
- package/dist/internal/stringCalls.js +1 -1
- package/dist/internal/stringCalls.js.map +1 -1
- package/dist/internal/template.js +263 -141
- package/dist/internal/template.js.map +1 -1
- package/dist/internal/types.d.ts +4 -1
- package/dist/internal/utils.d.ts +14 -3
- package/dist/internal/utils.js +63 -3
- package/dist/internal/utils.js.map +1 -1
- package/dist/internal/vueCompiler.d.ts +9 -1
- package/dist/internal/vueCompiler.js +37 -14
- package/dist/internal/vueCompiler.js.map +1 -1
- package/dist/project.d.ts +11 -0
- package/dist/project.js +3 -0
- package/dist/types.d.ts +95 -4
- package/package.json +30 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx.js","names":[],"sources":["../../../src/internal/script/jsx.ts"],"sourcesContent":["import type { NodePath, Scope } from '@babel/traverse';\nimport * as babel from '@babel/types';\nimport {\n HTML_CONTENT_PROPS,\n type GTProp,\n type JsxChild,\n type JsxChildren,\n} from '@generaltranslation/format/types';\nimport { isHTMLTag, isSVGTag } from '@vue/shared';\nimport { isAcceptedPluralForm } from 'generaltranslation/internal';\nimport type { GTComponentName, VueExtractionContext } from '../types.js';\nimport {\n addVueError,\n babelLocation,\n createInlineMetadata,\n type StaticPrimitiveResult,\n unwrapExpression,\n} from '../utils.js';\nimport type { KnownValue } from './model.js';\n\ntype Counter = { value: number };\n\ntype JSXSlotFunction = {\n node:\n | babel.ArrowFunctionExpression\n | babel.FunctionExpression\n | babel.ObjectMethod;\n scope: Scope;\n};\n\ntype JSXSlotLayout = {\n defaultChildren: babel.JSXElement['children'];\n defaultSlot?: JSXSlotFunction;\n namedSlots: Map<string, JSXSlotFunction>;\n};\n\ntype OrdinaryElementShape = {\n /** Component slots stay outside T's source tree. */\n opaque: boolean;\n /** Proven runtime string tag, retained only for catalog readability. */\n tag?: string;\n};\n\n/** Narrow script-analysis capabilities required by rich JSX extraction. */\nexport type VueJSXAnalysis = {\n /** Per-file pragma that replaces Vue's VNode factory, when present. */\n customPragma?: babel.Comment;\n /** Resolves an expression to a proven gt-vue or Vue runtime identity. */\n resolveKnownValue: (\n expression: babel.Expression,\n scope: Scope\n ) => KnownValue | undefined;\n /** Evaluates the side-effect-free primitive subset at this source position. */\n readStaticPrimitive: (\n expression: babel.Node,\n scope: Scope\n ) => StaticPrimitiveResult;\n /** Resolves a safely retained object literal without executing user code. */\n resolveStaticObject: (\n expression: babel.Node,\n scope: Scope\n ) => { node: babel.ObjectExpression; scope: Scope } | undefined;\n /** Returns Babel's lexical scope for a nested function or expression. */\n scopeForNode: (node: babel.Node, fallback: Scope) => Scope;\n};\n\nconst RESERVED_T_PROPS = new Set(['key', 'ref']);\nconst FORMAT_COMPONENTS = new Set<GTComponentName>([\n 'Currency',\n 'DateTime',\n 'Num',\n]);\nconst NON_BRANCH_PROP_NAMES = new Set([\n 'branch',\n 'class',\n 'key',\n 'locales',\n 'n',\n 'ref',\n 'ref-for',\n 'ref-key',\n 'ref_for',\n 'ref_key',\n 'style',\n 'v-slots',\n 'vSlots',\n]);\n\n/**\n * Extracts one statically identified gt-vue `T` JSX element.\n *\n * This serializer follows the VNodes emitted by `@vue/babel-plugin-jsx`:\n * fragments are transparent, JSX text uses the plugin's normalization, and\n * arbitrary component slots remain opaque because gt-vue does not execute\n * user slots while calculating a source hash.\n */\nexport function extractVueJSXTranslation(\n path: NodePath<babel.JSXElement>,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis\n): void {\n if (analysis.customPragma) {\n addVueError(\n context,\n babelLocation(analysis.customPragma.loc),\n 'Found a custom @jsx pragma in a gt-vue JSX translation file',\n 'Use the default Vue JSX VNode factory for files containing gt-vue <T>'\n );\n return;\n }\n const errorCount = context.errors.length;\n const translationContext = readTranslationContext(\n path.node.openingElement,\n path.scope,\n context,\n analysis\n );\n const source = collapseChildren(\n serializeChildren(\n path.node.children,\n { value: 0 },\n path.scope,\n context,\n analysis\n )\n );\n if (context.errors.length !== errorCount) return;\n\n context.results.push({\n dataFormat: 'JSX',\n source,\n metadata: createInlineMetadata(\n context,\n babelLocation(path.node.loc),\n translationContext\n ),\n });\n}\n\n/** Returns whether the visitor is already covered by an outer serialized T. */\nexport function isNestedInVueJSXTranslation(\n path: NodePath<babel.JSXElement>,\n analysis: VueJSXAnalysis\n): boolean {\n let current: NodePath | null = path.parentPath;\n while (current) {\n if (current.isJSXElement()) {\n const element = current.node;\n const identity = resolveElementIdentity(\n element.openingElement.name,\n current.scope,\n analysis\n );\n const containingAttribute = findContainingJSXAttribute(path, current);\n if (\n containingAttribute &&\n !(\n identity?.type === 'component' &&\n (identity.name === 'Branch' || identity.name === 'Plural') &&\n isSlotsAttribute(containingAttribute.node)\n )\n ) {\n // JSX inside an event or ordinary prop is not a child VNode of the\n // surrounding translation. Extract it independently if it is T.\n return false;\n }\n if (identity?.type === 'component') {\n if (identity.name === 'T') return true;\n if (identity.name === 'Var' || FORMAT_COMPONENTS.has(identity.name)) {\n return false;\n }\n // Branch and Plural own stable slots, so an outer T reaches them.\n } else if (\n identity?.type === 'vue-builtin' &&\n (identity.name !== 'Fragment' ||\n isTransparentFragment(element.openingElement.name, identity))\n ) {\n if (\n identity.name === 'Suspense' &&\n containingAttribute &&\n isSlotsAttribute(containingAttribute.node)\n ) {\n // Explicit Suspense slots have separate lifetimes. The outer\n // serializer follows the default slot and excludes fallback, while\n // a T declared in fallback remains an independent translation.\n return false;\n }\n // Vue Fragment aliases and normalized Suspense default content are\n // transparent to the runtime source tree.\n } else if (\n !isLiteralFragment(element.openingElement.name) &&\n !isNativeElement(element.openingElement.name)\n ) {\n // Arbitrary component slots are opaque to the outer translation.\n return false;\n }\n }\n current = current.parentPath;\n }\n return false;\n}\n\n/** Finds an attribute boundary between a nested JSX node and one ancestor. */\nfunction findContainingJSXAttribute(\n path: NodePath,\n ancestor: NodePath<babel.JSXElement>\n): NodePath<babel.JSXAttribute> | undefined {\n let current: NodePath | null = path.parentPath;\n while (current && current !== ancestor) {\n if (\n current.isJSXAttribute() &&\n current.parentPath?.isJSXOpeningElement() &&\n current.parentPath.parentPath === ancestor\n ) {\n return current;\n }\n current = current.parentPath;\n }\n return undefined;\n}\n\nfunction isSlotsAttribute(attribute: babel.JSXAttribute): boolean {\n const name = readAttributeName(attribute.name);\n return name === 'v-slots' || name === 'vSlots';\n}\n\n/** Resolves a JSX tag to the identity tracked by the script analyzer. */\nexport function resolveVueJSXElementIdentity(\n name: babel.JSXElement['openingElement']['name'],\n scope: Scope,\n analysis: VueJSXAnalysis\n): KnownValue | undefined {\n return resolveElementIdentity(name, scope, analysis);\n}\n\n/** Enforces the one supported public shape for a gt-vue variable component. */\nexport function validateVueJSXVariableComponent(\n element: babel.JSXElement,\n component: 'Currency' | 'DateTime' | 'Num' | 'Var',\n context: VueExtractionContext\n): void {\n validateVariableElement(element, component, context);\n}\n\nfunction readTranslationContext(\n element: babel.JSXOpeningElement,\n scope: Scope,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis\n): string | undefined {\n let translationContext: string | undefined;\n let hasContext = false;\n\n for (const attribute of element.attributes) {\n if (attribute.type === 'JSXSpreadAttribute') {\n addVueError(\n context,\n babelLocation(attribute.loc),\n 'Found a spread prop on a gt-vue <T> component in JSX',\n 'Pass context as one explicit static context or $context prop'\n );\n continue;\n }\n const name = readAttributeName(attribute.name);\n if (RESERVED_T_PROPS.has(name)) continue;\n if (name !== 'context' && name !== '$context') {\n addVueError(\n context,\n babelLocation(attribute.loc),\n `Found unsupported prop \"${name}\" on a gt-vue <T> component`,\n 'gt-vue <T> currently supports only context'\n );\n continue;\n }\n if (hasContext) {\n addVueError(\n context,\n babelLocation(attribute.loc),\n 'Found duplicate context props on a gt-vue <T> component',\n 'Pass only one context prop'\n );\n continue;\n }\n hasContext = true;\n const contextExpression =\n attribute.value?.type === 'JSXExpressionContainer' &&\n attribute.value.expression.type !== 'JSXEmptyExpression'\n ? unwrapExpression(attribute.value.expression)\n : undefined;\n if (\n contextExpression?.type === 'ConditionalExpression' ||\n contextExpression?.type === 'LogicalExpression'\n ) {\n addVueError(\n context,\n babelLocation(attribute.loc),\n 'Found conditional context on a gt-vue <T> component',\n 'Use one invariant static context string for this translation'\n );\n continue;\n }\n const value = readJSXAttributePrimitive(attribute, scope, analysis);\n if (!value.ok || typeof value.value !== 'string') {\n addVueError(\n context,\n babelLocation(attribute.loc),\n 'Found a dynamic context on a gt-vue <T> component',\n 'Use a string literal or an immutable static string'\n );\n continue;\n }\n translationContext = value.value;\n }\n return translationContext;\n}\n\nfunction serializeChildren(\n children: Array<\n | babel.JSXText\n | babel.JSXExpressionContainer\n | babel.JSXSpreadChild\n | babel.JSXElement\n | babel.JSXFragment\n >,\n counter: Counter,\n scope: Scope,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis\n): JsxChild[] {\n const result: JsxChild[] = [];\n for (const child of children) {\n for (const serialized of serializeChild(\n child,\n counter,\n scope,\n context,\n analysis\n )) {\n appendSerializedChild(result, serialized);\n }\n }\n return result;\n}\n\nfunction serializeChild(\n child:\n | babel.JSXText\n | babel.JSXExpressionContainer\n | babel.JSXSpreadChild\n | babel.JSXElement\n | babel.JSXFragment,\n counter: Counter,\n scope: Scope,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis\n): JsxChild[] {\n if (child.type === 'JSXText') {\n const text = normalizeJSXText(child.value);\n return text ? [text] : [];\n }\n if (child.type === 'JSXElement') {\n return serializeElement(child, counter, scope, context, analysis);\n }\n if (child.type === 'JSXFragment') {\n return serializeChildren(child.children, counter, scope, context, analysis);\n }\n if (child.type === 'JSXSpreadChild') {\n addVueError(\n context,\n babelLocation(child.loc),\n 'Found a spread child inside a gt-vue <T> component in JSX',\n 'Use static JSX children and wrap one runtime value in a gt-vue variable component'\n );\n return [];\n }\n if (child.expression.type === 'JSXEmptyExpression') return [];\n return serializeExpression(\n child.expression,\n counter,\n scope,\n context,\n analysis\n );\n}\n\nfunction serializeExpression(\n input: babel.Expression,\n counter: Counter,\n scope: Scope,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis\n): JsxChild[] {\n const expression = unwrapExpression(input);\n if (!expression) return [];\n if (expression.type === 'JSXElement') {\n return serializeElement(expression, counter, scope, context, analysis);\n }\n if (expression.type === 'JSXFragment') {\n return serializeChildren(\n expression.children,\n counter,\n scope,\n context,\n analysis\n );\n }\n if (expression.type === 'ArrayExpression') {\n const result: JsxChild[] = [];\n for (const item of expression.elements) {\n if (!item) continue;\n if (item.type === 'SpreadElement') {\n addVueError(\n context,\n babelLocation(item.loc),\n 'Found a spread array child inside a gt-vue <T> component in JSX',\n 'List each static child explicitly'\n );\n continue;\n }\n for (const serialized of serializeExpression(\n item,\n counter,\n scope,\n context,\n analysis\n )) {\n appendSerializedChild(result, serialized);\n }\n }\n return result;\n }\n if (\n expression.type === 'ConditionalExpression' ||\n expression.type === 'LogicalExpression'\n ) {\n addVueError(\n context,\n babelLocation(expression.loc),\n 'Found conditional JSX content inside a gt-vue <T> component',\n 'Move conditional content outside <T>, or use a static Branch or Plural component'\n );\n return [];\n }\n\n const value = analysis.readStaticPrimitive(expression, scope);\n if (!value.ok) {\n addVueError(\n context,\n babelLocation(expression.loc),\n 'Found dynamic JSX content inside a gt-vue <T> component',\n 'Wrap runtime values in <Var>, <Num>, <DateTime>, or <Currency>'\n );\n return [];\n }\n // Vue drops null and boolean JSX children. All other primitive VNode\n // children are stringified by gt-vue before the source is hashed.\n return value.value == null || typeof value.value === 'boolean'\n ? []\n : [String(value.value)];\n}\n\nfunction serializeElement(\n element: babel.JSXElement,\n counter: Counter,\n scope: Scope,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis\n): JsxChild[] {\n const name = element.openingElement.name;\n const identity = resolveElementIdentity(name, scope, analysis);\n if (isTransparentFragment(name, identity)) {\n return serializeChildren(\n element.children,\n counter,\n scope,\n context,\n analysis\n );\n }\n\n counter.value += 1;\n const id = counter.value;\n const component = identity?.type === 'component' ? identity.name : undefined;\n\n validateElementAttributes(element.openingElement, scope, context, analysis);\n if (component === 'T') {\n addVueError(\n context,\n babelLocation(element.loc),\n 'Found a nested gt-vue <T> component inside another <T>',\n 'Split nested translations into sibling <T> components'\n );\n return [];\n }\n if (\n component === 'Var' ||\n component === 'Num' ||\n component === 'DateTime' ||\n component === 'Currency'\n ) {\n validateVariableElement(element, component, context);\n const variable =\n component === 'Num'\n ? { name: 'n', type: 'n' as const }\n : component === 'DateTime'\n ? { name: 'date', type: 'd' as const }\n : component === 'Currency'\n ? { name: 'cost', type: 'c' as const }\n : { name: 'value', type: 'v' as const };\n return [{ i: id, k: `_gt_${variable.name}_${id}`, v: variable.type }];\n }\n if (component === 'Branch' || component === 'Plural') {\n return [\n serializeBranchElement(\n element,\n id,\n component,\n counter,\n scope,\n context,\n analysis\n ),\n ];\n }\n if (identity?.type === 'vue-builtin' && identity.name === 'Suspense') {\n return [\n serializeSuspenseElement(element, id, counter, scope, context, analysis),\n ];\n }\n if (identity?.type === 'vue-builtin' && identity.name === 'Fragment') {\n addVueError(\n context,\n babelLocation(element.loc),\n 'Found a renamed Vue Fragment binding inside a gt-vue JSX translation',\n 'Use <>, literal <Fragment>, or a Vue namespace member such as <Vue.Fragment>; the Vue JSX transform compiles renamed Fragment bindings as component slots'\n );\n return [];\n }\n if (identity?.type === 'vue-builtin') {\n addVueError(\n context,\n babelLocation(element.loc),\n `Found unsupported Vue <${identity.name}> content inside a gt-vue JSX translation`,\n 'Move this Vue builtin outside <T>'\n );\n return [];\n }\n if (!identity && isUnboundNonNativeElement(name, scope)) {\n addVueError(\n context,\n babelLocation(element.loc),\n `Could not determine whether JSX tag <${readElementDisplayName(name) ?? 'unknown'}> is a component or custom element`,\n 'Import or locally bind the component, or move the configured custom element outside <T>'\n );\n return [];\n }\n\n const ordinaryShape = identity\n ? undefined\n : resolveOrdinaryElementShape(name, scope, analysis, new Set());\n if (!identity && !ordinaryShape) {\n addVueError(\n context,\n babelLocation(element.loc),\n `Could not statically resolve whether JSX tag <${readElementDisplayName(name) ?? 'unknown'}> renders an element or component`,\n 'Use a native tag, imported component, defineComponent result, or an immutable tag expression that cannot switch between element and component shapes'\n );\n return [];\n }\n\n const data = readContentProps(\n element.openingElement,\n scope,\n context,\n analysis\n );\n const tag = ordinaryShape?.tag ?? readElementDisplayName(name);\n if (!tag) {\n addVueError(\n context,\n babelLocation(element.loc),\n 'Found unsupported namespaced JSX syntax inside a gt-vue <T> component',\n 'Use a native element or a statically imported component'\n );\n return [];\n }\n if (ordinaryShape?.opaque) {\n return [\n {\n t: tag,\n i: id,\n ...(Object.keys(data).length > 0 && { d: data }),\n },\n ];\n }\n\n const children = serializeChildren(\n element.children,\n counter,\n scope,\n context,\n analysis\n );\n return [\n {\n t: tag,\n i: id,\n ...(Object.keys(data).length > 0 && { d: data }),\n ...(children.length > 0 && { c: collapseChildren(children) }),\n },\n ];\n}\n\n/**\n * Serializes Vue Suspense's normalized default content without evaluating its\n * fallback. Vue requires that default slot to resolve to one VNode root; an\n * ambiguous or multi-root shape is rejected before it can hash differently.\n */\nfunction serializeSuspenseElement(\n element: babel.JSXElement,\n id: number,\n counter: Counter,\n scope: Scope,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis\n): JsxChild {\n const slots = readJSXSlotLayout(\n element,\n scope,\n context,\n analysis,\n 'suspense'\n );\n const directSlot = readDirectSuspenseSlot(element, scope, context, analysis);\n if (directSlot.present) {\n slots.defaultChildren = [];\n slots.defaultSlot = directSlot.slot;\n }\n\n for (const name of slots.namedSlots.keys()) {\n if (name === 'fallback' || name.startsWith('_')) continue;\n addVueError(\n context,\n babelLocation(element.loc),\n `Found unsupported named slot \"${name}\" on Vue <Suspense> inside a gt-vue <T> component`,\n 'Use only the default and fallback Suspense slots'\n );\n }\n\n if (slots.defaultSlot) {\n validateSuspenseSlotRoot(slots.defaultSlot, element, context);\n } else {\n validateSuspenseImplicitRoot(slots.defaultChildren, element, context);\n }\n\n const children = slots.defaultSlot\n ? serializeSlotFunction(slots.defaultSlot, counter, context, analysis)\n : serializeChildren(\n slots.defaultChildren,\n counter,\n scope,\n context,\n analysis\n );\n const data = readContentProps(\n element.openingElement,\n scope,\n context,\n analysis\n );\n return {\n t: 'Suspense',\n i: id,\n ...(Object.keys(data).length > 0 && { d: data }),\n ...(children.length > 0 && { c: collapseChildren(children) }),\n };\n}\n\n/** Reads the unambiguous one-function JSX spelling for a default slot. */\nfunction readDirectSuspenseSlot(\n element: babel.JSXElement,\n scope: Scope,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis\n): { present: boolean; slot?: JSXSlotFunction } {\n if (\n hasExplicitAttribute(element.openingElement, 'v-slots') ||\n hasExplicitAttribute(element.openingElement, 'vSlots')\n ) {\n return { present: false };\n }\n const children = element.children.filter(isMeaningfulJSXChild);\n if (\n children.length !== 1 ||\n children[0]?.type !== 'JSXExpressionContainer' ||\n children[0].expression.type === 'JSXEmptyExpression'\n ) {\n return { present: false };\n }\n const value = unwrapExpression(children[0].expression);\n if (\n !value ||\n (value.type !== 'ArrowFunctionExpression' &&\n value.type !== 'FunctionExpression')\n ) {\n return { present: false };\n }\n if (value.params.length > 0 || value.async || value.generator) {\n addVueError(\n context,\n babelLocation(value.loc),\n 'Found a dynamic or scoped default slot on Vue <Suspense> inside a gt-vue <T> component',\n 'Use a synchronous zero-argument function with static returned content'\n );\n return { present: true };\n }\n return {\n present: true,\n slot: {\n node: value,\n scope: analysis.scopeForNode(value, scope),\n },\n };\n}\n\n/** Enforces the single-root contract for children wrapped by the JSX plugin. */\nfunction validateSuspenseImplicitRoot(\n children: babel.JSXElement['children'],\n element: babel.JSXElement,\n context: VueExtractionContext\n): void {\n const roots = children.filter(isMeaningfulJSXChild);\n if (roots.length > 1) {\n addSuspenseRootError(element, context);\n return;\n }\n const root = roots[0];\n if (\n root?.type === 'JSXExpressionContainer' &&\n root.expression.type !== 'JSXEmptyExpression'\n ) {\n const expression = unwrapExpression(root.expression);\n if (\n expression?.type !== 'JSXElement' &&\n expression?.type !== 'JSXFragment'\n ) {\n addVueError(\n context,\n babelLocation(root.loc),\n 'Could not statically prove the default root of Vue <Suspense> inside a gt-vue <T> component',\n 'Use one JSX element, Fragment, or a static zero-argument default slot'\n );\n }\n }\n}\n\n/** Enforces the single-root contract for an explicit static slot function. */\nfunction validateSuspenseSlotRoot(\n slot: JSXSlotFunction,\n element: babel.JSXElement,\n context: VueExtractionContext\n): void {\n const returned = readStaticSlotReturn(slot);\n const expression = returned && unwrapExpression(returned);\n if (expression?.type !== 'ArrayExpression') return;\n const roots = expression.elements.filter(Boolean);\n if (\n roots.length > 1 ||\n roots.some(\n (root) =>\n root?.type === 'SpreadElement' ||\n (root?.type !== 'JSXElement' && root?.type !== 'JSXFragment')\n )\n ) {\n addSuspenseRootError(element, context);\n }\n}\n\n/** Reports the stable diagnostic shared by all invalid Suspense root shapes. */\nfunction addSuspenseRootError(\n element: babel.JSXElement,\n context: VueExtractionContext\n): void {\n addVueError(\n context,\n babelLocation(element.loc),\n 'Found more than one or an invalid default root inside Vue <Suspense> within a gt-vue <T> component',\n 'Wrap the Suspense default content in one element or Fragment, or move <T> inside <Suspense>'\n );\n}\n\n/** Serializes GT-owned Branch and Plural slots with independent ID scopes. */\nfunction serializeBranchElement(\n element: babel.JSXElement,\n id: number,\n component: 'Branch' | 'Plural',\n counter: Counter,\n scope: Scope,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis\n): JsxChild {\n const slots = readJSXSlotLayout(element, scope, context, analysis);\n if (\n component === 'Plural' &&\n !hasExplicitAttribute(element.openingElement, 'n')\n ) {\n addVueError(\n context,\n babelLocation(element.openingElement.loc),\n 'Found a gt-vue <Plural> component without an n prop',\n 'Pass the numeric selector through <Plural n={count} />'\n );\n }\n\n const children = slots.defaultSlot\n ? serializeSlotFunction(slots.defaultSlot, counter, context, analysis)\n : serializeChildren(\n slots.defaultChildren,\n counter,\n scope,\n context,\n analysis\n );\n const branches: Record<string, JsxChildren> = {};\n for (const [name, slot] of slots.namedSlots) {\n if (name.startsWith('_')) continue;\n if (component === 'Plural' && !isAcceptedPluralForm(name)) continue;\n branches[name] = collapseChildren(\n serializeSlotFunction(slot, { value: id }, context, analysis)\n );\n }\n readBranchAttributeSources(\n element.openingElement,\n component,\n branches,\n scope,\n context,\n analysis\n );\n\n const data = readContentProps(\n element.openingElement,\n scope,\n context,\n analysis\n );\n if (Object.keys(branches).length > 0) {\n data.b = branches;\n data.t = component === 'Plural' ? 'p' : 'b';\n }\n return {\n t: component,\n i: id,\n ...(Object.keys(data).length > 0 && { d: data }),\n ...(children.length > 0 && { c: collapseChildren(children) }),\n };\n}\n\n/** Reconstructs the slots object emitted by the Vue JSX transform. */\nfunction readJSXSlotLayout(\n element: babel.JSXElement,\n scope: Scope,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis,\n owner: 'branch' | 'suspense' = 'branch'\n): JSXSlotLayout {\n const ownerLabel =\n owner === 'suspense' ? 'Vue <Suspense>' : 'a gt-vue JSX branch component';\n const vSlots = element.openingElement.attributes.filter(\n (attribute): attribute is babel.JSXAttribute =>\n attribute.type === 'JSXAttribute' && isSlotsAttribute(attribute)\n );\n if (vSlots.length > 1) {\n addVueError(\n context,\n babelLocation(vSlots[1]!.loc),\n `Found more than one v-slots prop on ${ownerLabel}`,\n 'Pass one static slots object'\n );\n }\n\n const meaningfulChildren = element.children.filter(isMeaningfulJSXChild);\n const objectSlotChild =\n vSlots.length === 0 &&\n meaningfulChildren.length === 1 &&\n meaningfulChildren[0]?.type === 'JSXExpressionContainer' &&\n meaningfulChildren[0].expression.type !== 'JSXEmptyExpression'\n ? analysis.resolveStaticObject(meaningfulChildren[0].expression, scope)\n : undefined;\n if (objectSlotChild) {\n addVueError(\n context,\n babelLocation(meaningfulChildren[0]?.loc),\n 'Found Vue object-slot child syntax in a gt-vue JSX translation',\n 'Pass the static slots object through v-slots so extraction is independent of the JSX enableObjectSlots compiler option'\n );\n }\n const vSlotsObject = vSlots[0]\n ? readSlotsAttributeObject(vSlots[0], scope, context, analysis, ownerLabel)\n : undefined;\n const slotsObject = vSlotsObject;\n const namedSlots = new Map<string, JSXSlotFunction>();\n let defaultSlot: JSXSlotFunction | undefined;\n if (slotsObject) {\n for (const [name, slot] of readStaticSlotObject(\n slotsObject,\n context,\n analysis\n )) {\n if (name === 'default') defaultSlot = slot;\n else namedSlots.set(name, slot);\n }\n }\n\n return {\n defaultChildren: objectSlotChild ? [] : element.children,\n ...(defaultSlot && { defaultSlot }),\n namedSlots,\n };\n}\n\nfunction readSlotsAttributeObject(\n attribute: babel.JSXAttribute,\n scope: Scope,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis,\n ownerLabel: string\n): { node: babel.ObjectExpression; scope: Scope } | undefined {\n const expression =\n attribute.value?.type === 'JSXExpressionContainer' &&\n attribute.value.expression.type !== 'JSXEmptyExpression'\n ? attribute.value.expression\n : undefined;\n const object = expression\n ? analysis.resolveStaticObject(expression, scope)\n : undefined;\n if (!object) {\n addVueError(\n context,\n babelLocation(attribute.loc),\n `Found dynamic v-slots on ${ownerLabel}`,\n 'Use a retained object literal with statically named zero-argument slot functions'\n );\n }\n return object;\n}\n\n/** Reads statically named zero-argument functions from one JSX slots object. */\nfunction readStaticSlotObject(\n object: { node: babel.ObjectExpression; scope: Scope },\n context: VueExtractionContext,\n analysis: VueJSXAnalysis\n): Map<string, JSXSlotFunction> {\n const slots = new Map<string, JSXSlotFunction>();\n for (const property of object.node.properties) {\n if (property.type === 'SpreadElement') {\n addVueError(\n context,\n babelLocation(property.loc),\n 'Found a spread in a gt-vue JSX slots object',\n 'List every static slot explicitly'\n );\n continue;\n }\n const name = readStaticObjectKey(property, object.scope, analysis);\n if (name === undefined) {\n addVueError(\n context,\n babelLocation(property.loc),\n 'Found a dynamic slot name in a gt-vue JSX slots object',\n 'Use a static string slot name'\n );\n continue;\n }\n if (slots.has(name)) {\n addVueError(\n context,\n babelLocation(property.loc),\n `Found duplicate JSX slot \"${name}\" in a gt-vue translation`,\n 'Define every slot once'\n );\n continue;\n }\n const value =\n property.type === 'ObjectMethod'\n ? property\n : unwrapExpression(property.value);\n if (\n !value ||\n (value.type !== 'ArrowFunctionExpression' &&\n value.type !== 'FunctionExpression' &&\n value.type !== 'ObjectMethod') ||\n value.params.length > 0 ||\n value.async ||\n value.generator\n ) {\n addVueError(\n context,\n babelLocation(property.loc),\n `Found a dynamic or scoped JSX slot \"${name}\" in a gt-vue translation`,\n 'Use a synchronous zero-argument function with static returned content'\n );\n continue;\n }\n slots.set(name, {\n node: value,\n scope: analysis.scopeForNode(value, object.scope),\n });\n }\n return slots;\n}\n\nfunction serializeSlotFunction(\n slot: JSXSlotFunction,\n counter: Counter,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis\n): JsxChild[] {\n const returned = readStaticSlotReturn(slot);\n if (!returned) {\n addVueError(\n context,\n babelLocation(slot.node.loc),\n 'Found a JSX slot with a dynamic function body in a gt-vue translation',\n 'Return static slot content directly from the zero-argument function'\n );\n return [];\n }\n return serializeExpression(returned, counter, slot.scope, context, analysis);\n}\n\n/** Returns the expression from a slot body that contains only one return. */\nfunction readStaticSlotReturn(\n slot: JSXSlotFunction\n): babel.Expression | undefined {\n const body = slot.node.body;\n if (body.type !== 'BlockStatement') return body;\n const statements = body.body.filter(\n (statement) => statement.type !== 'EmptyStatement'\n );\n const returned =\n statements.length === 1 && statements[0]?.type === 'ReturnStatement'\n ? statements[0].argument\n : undefined;\n return returned ?? undefined;\n}\n\nfunction readStaticObjectKey(\n property: babel.ObjectMethod | babel.ObjectProperty,\n scope: Scope,\n analysis: VueJSXAnalysis\n): string | undefined {\n if (!property.computed) {\n if (property.key.type === 'Identifier') return property.key.name;\n if (\n property.key.type === 'StringLiteral' ||\n property.key.type === 'NumericLiteral'\n ) {\n return String(property.key.value);\n }\n return undefined;\n }\n const key = analysis.readStaticPrimitive(property.key, scope);\n return key.ok &&\n (typeof key.value === 'string' || typeof key.value === 'number')\n ? String(key.value)\n : undefined;\n}\n\nfunction readBranchAttributeSources(\n element: babel.JSXOpeningElement,\n component: 'Branch' | 'Plural',\n branches: Record<string, JsxChildren>,\n scope: Scope,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis\n): void {\n const seenBranchProps = new Set<string>();\n for (const attribute of element.attributes) {\n if (attribute.type !== 'JSXAttribute') continue;\n const name = readAttributeName(attribute.name);\n if (\n !isBranchPropName(name) ||\n (component === 'Plural' && !isAcceptedPluralForm(name))\n ) {\n continue;\n }\n if (seenBranchProps.has(name)) {\n addVueError(\n context,\n babelLocation(attribute.loc),\n `Found duplicate branch prop \"${name}\" on a gt-vue <${component}> component`,\n 'Pass each branch prop once so Vue JSX compiler options cannot change which value is hashed'\n );\n continue;\n }\n seenBranchProps.add(name);\n if (Object.prototype.hasOwnProperty.call(branches, name)) continue;\n const value = readJSXAttributePrimitive(attribute, scope, analysis);\n if (!value.ok) {\n if (isStaticallyNonBranchAttribute(attribute, scope)) continue;\n addVueError(\n context,\n babelLocation(attribute.loc),\n `Found dynamic branch prop \"${name}\" on a gt-vue <${component}> component`,\n 'Use a static primitive branch prop or a static named slot'\n );\n continue;\n }\n branches[name] =\n value.value == null || typeof value.value === 'boolean'\n ? []\n : String(value.value);\n }\n}\n\nfunction isBranchPropName(name: string): boolean {\n return !(\n NON_BRANCH_PROP_NAMES.has(name) ||\n name.startsWith('aria-') ||\n name.startsWith('data-') ||\n /^on[^a-z]/.test(name)\n );\n}\n\nfunction isStaticallyNonBranchAttribute(\n attribute: babel.JSXAttribute,\n scope: Scope\n): boolean {\n const expression =\n attribute.value?.type === 'JSXExpressionContainer' &&\n attribute.value.expression.type !== 'JSXEmptyExpression'\n ? unwrapExpression(attribute.value.expression)\n : undefined;\n if (!expression) return false;\n if (expression.type === 'Identifier' && expression.name === 'undefined') {\n return !scope.hasBinding('undefined');\n }\n return (\n expression.type === 'ArrayExpression' ||\n expression.type === 'ArrowFunctionExpression' ||\n expression.type === 'ClassExpression' ||\n expression.type === 'FunctionExpression' ||\n expression.type === 'JSXElement' ||\n expression.type === 'JSXFragment' ||\n expression.type === 'NewExpression' ||\n expression.type === 'ObjectExpression' ||\n expression.type === 'RegExpLiteral' ||\n (expression.type === 'UnaryExpression' && expression.operator === 'void')\n );\n}\n\nfunction hasExplicitAttribute(\n element: babel.JSXOpeningElement,\n name: string\n): boolean {\n return element.attributes.some(\n (attribute) =>\n attribute.type === 'JSXAttribute' &&\n readAttributeName(attribute.name) === name\n );\n}\n\nfunction isMeaningfulJSXChild(\n child: babel.JSXElement['children'][number]\n): boolean {\n if (child.type === 'JSXText') return normalizeJSXText(child.value) !== '';\n return !(\n child.type === 'JSXExpressionContainer' &&\n child.expression.type === 'JSXEmptyExpression'\n );\n}\n\nfunction validateVariableElement(\n element: babel.JSXElement,\n component: 'Currency' | 'DateTime' | 'Num' | 'Var',\n context: VueExtractionContext\n): void {\n if (context.validatedVariableComponents.has(element)) return;\n context.validatedVariableComponents.add(element);\n\n const explicitProps = new Set<string>();\n let hasSpread = false;\n for (const attribute of element.openingElement.attributes) {\n if (attribute.type === 'JSXSpreadAttribute') {\n hasSpread = true;\n } else {\n explicitProps.add(readAttributeName(attribute.name));\n }\n }\n if (hasSpread) {\n addVueError(\n context,\n babelLocation(element.openingElement.loc),\n `Found a spread prop on a gt-vue <${component}> component`,\n 'Pass variable component props explicitly'\n );\n }\n if (component === 'Var') {\n for (const prop of ['name', 'value']) {\n if (!explicitProps.has(prop)) continue;\n addVueError(\n context,\n babelLocation(element.openingElement.loc),\n `Found unsupported ${prop} prop on a gt-vue <Var> component`,\n 'Pass the variable as the default child of <Var>'\n );\n }\n return;\n }\n if (!explicitProps.has('value')) {\n addVueError(\n context,\n babelLocation(element.openingElement.loc),\n `Found a gt-vue <${component}> component without a value prop`,\n `Pass the runtime value through <${component} value={value} />`\n );\n }\n if (hasMeaningfulChildren(element.children)) {\n addVueError(\n context,\n babelLocation(element.loc),\n `Found children on a gt-vue <${component}> component`,\n `Use only the required value prop: <${component} value={value} />`\n );\n }\n}\n\nfunction hasMeaningfulChildren(\n children: babel.JSXElement['children']\n): boolean {\n return children.some((child) => {\n if (child.type === 'JSXText') return normalizeJSXText(child.value) !== '';\n return !(\n child.type === 'JSXExpressionContainer' &&\n child.expression.type === 'JSXEmptyExpression'\n );\n });\n}\n\nfunction validateElementAttributes(\n element: babel.JSXOpeningElement,\n scope: Scope,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis\n): void {\n const seenContentProps = new Set<string>();\n for (const attribute of element.attributes) {\n if (attribute.type === 'JSXSpreadAttribute') {\n addVueError(\n context,\n babelLocation(attribute.loc),\n 'Found a spread prop inside a gt-vue <T> component in JSX',\n 'Pass props by static name so their effect on the translation source is known'\n );\n continue;\n }\n const name = readAttributeName(attribute.name);\n if (isVueJSXDirectiveName(name) && !isSlotsAttribute(attribute)) {\n addVueError(\n context,\n babelLocation(attribute.loc),\n `Found Vue JSX directive \"${name}\" inside a gt-vue <T> component`,\n 'Move the directive outside <T> so the translated VNode source stays static'\n );\n continue;\n }\n if (name === 'innerHTML' || name === 'textContent') {\n addVueError(\n context,\n babelLocation(attribute.loc),\n `Found source-shaping prop \"${name}\" inside a gt-vue <T> component`,\n 'Use static JSX children instead'\n );\n continue;\n }\n const contentProp = (\n Object.values(HTML_CONTENT_PROPS) as readonly string[]\n ).includes(name);\n if (!contentProp) continue;\n if (seenContentProps.has(name)) {\n addVueError(\n context,\n babelLocation(attribute.loc),\n `Found duplicate translatable prop \"${name}\" inside a gt-vue <T> component`,\n 'Pass each translatable element prop once so Vue JSX compiler options cannot change which value is hashed'\n );\n continue;\n }\n seenContentProps.add(name);\n const value = readJSXAttributePrimitive(attribute, scope, analysis);\n if (!value.ok) {\n addVueError(\n context,\n babelLocation(attribute.loc),\n `Found dynamic translatable prop \"${name}\" inside a gt-vue <T> component`,\n 'Use a static string for translatable element props'\n );\n }\n }\n}\n\nfunction isVueJSXDirectiveName(name: string): boolean {\n return /^v(?:-|[A-Z])/.test(name);\n}\n\nfunction readContentProps(\n element: babel.JSXOpeningElement,\n scope: Scope,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis\n): GTProp {\n const data: GTProp = {};\n const entries = Object.entries(HTML_CONTENT_PROPS);\n for (const attribute of element.attributes) {\n if (attribute.type !== 'JSXAttribute') continue;\n const name = readAttributeName(attribute.name);\n const entry = entries.find(([, propName]) => propName === name);\n if (!entry) continue;\n const value = readJSXAttributePrimitive(attribute, scope, analysis);\n if (value.ok && typeof value.value === 'string') {\n (data as Record<string, unknown>)[entry[0]] = value.value;\n } else if (!value.ok) {\n // validateElementAttributes owns the single user-facing diagnostic.\n void context;\n }\n }\n return data;\n}\n\nfunction readJSXAttributePrimitive(\n attribute: babel.JSXAttribute,\n scope: Scope,\n analysis: VueJSXAnalysis\n): StaticPrimitiveResult {\n if (!attribute.value) return { ok: true, value: true };\n if (attribute.value.type === 'StringLiteral') {\n return { ok: true, value: normalizeJSXText(attribute.value.value) };\n }\n if (\n attribute.value.type !== 'JSXExpressionContainer' ||\n attribute.value.expression.type === 'JSXEmptyExpression'\n ) {\n return { ok: false };\n }\n return analysis.readStaticPrimitive(attribute.value.expression, scope);\n}\n\nfunction resolveElementIdentity(\n name: babel.JSXElement['openingElement']['name'],\n scope: Scope,\n analysis: VueJSXAnalysis\n): KnownValue | undefined {\n const expression = jsxNameToExpression(name);\n return expression ? analysis.resolveKnownValue(expression, scope) : undefined;\n}\n\nfunction jsxNameToExpression(\n name: babel.JSXElement['openingElement']['name']\n): babel.Expression | undefined {\n if (name.type === 'JSXIdentifier') return babel.identifier(name.name);\n if (name.type === 'JSXNamespacedName') return undefined;\n const object = jsxMemberObjectToExpression(name.object);\n return object\n ? babel.memberExpression(object, babel.identifier(name.property.name))\n : undefined;\n}\n\nfunction jsxMemberObjectToExpression(\n object: babel.JSXMemberExpression['object']\n): babel.Expression | undefined {\n if (object.type === 'JSXIdentifier') return babel.identifier(object.name);\n const parent = jsxMemberObjectToExpression(object.object);\n return parent\n ? babel.memberExpression(parent, babel.identifier(object.property.name))\n : undefined;\n}\n\nfunction isLiteralFragment(\n name: babel.JSXElement['openingElement']['name']\n): boolean {\n // Vue's JSX transforms (verified in 1.4 and 3.0) select the Fragment helper\n // before checking lexical bindings. Consequently literal `<Fragment>` is\n // transparent even when source code declares a same-named local binding.\n return name.type === 'JSXIdentifier' && name.name === 'Fragment';\n}\n\n/** Matches only Fragment spellings the Vue JSX transform keeps transparent. */\nfunction isTransparentFragment(\n name: babel.JSXElement['openingElement']['name'],\n identity: KnownValue | undefined\n): boolean {\n return (\n isLiteralFragment(name) ||\n (identity?.type === 'vue-builtin' &&\n identity.name === 'Fragment' &&\n name.type === 'JSXMemberExpression' &&\n name.property.name === 'Fragment')\n );\n}\n\n/** Detects tags whose VNode type can change with plugin `isCustomElement`. */\nfunction isUnboundNonNativeElement(\n name: babel.JSXElement['openingElement']['name'],\n scope: Scope\n): boolean {\n if (name.type === 'JSXIdentifier') {\n return (\n name.name !== 'Fragment' &&\n !isNativeElement(name) &&\n !scope.hasBinding(name.name)\n );\n }\n if (name.type === 'JSXNamespacedName') return true;\n let object = name.object;\n while (object.type === 'JSXMemberExpression') object = object.object;\n return !scope.hasBinding(object.name);\n}\n\nfunction isNativeElement(\n name: babel.JSXElement['openingElement']['name']\n): boolean {\n return (\n name.type === 'JSXIdentifier' &&\n (isHTMLTag(name.name) || isSVGTag(name.name))\n );\n}\n\n/** Proves whether a non-GT JSX tag is traversable or slot-opaque. */\nfunction resolveOrdinaryElementShape(\n name: babel.JSXElement['openingElement']['name'],\n scope: Scope,\n analysis: VueJSXAnalysis,\n seen: Set<babel.Node>\n): OrdinaryElementShape | undefined {\n if (isNativeElement(name)) {\n return { opaque: false, tag: (name as babel.JSXIdentifier).name };\n }\n if (name.type === 'JSXNamespacedName') return undefined;\n if (name.type === 'JSXMemberExpression') {\n let root = name.object;\n while (root.type === 'JSXMemberExpression') root = root.object;\n const binding = scope.getBinding(root.name);\n return binding?.path.isImportSpecifier() ||\n binding?.path.isImportDefaultSpecifier() ||\n binding?.path.isImportNamespaceSpecifier()\n ? { opaque: true }\n : undefined;\n }\n const binding = scope.getBinding(name.name);\n if (!binding) return undefined;\n if (\n binding.path.isImportSpecifier() ||\n binding.path.isImportDefaultSpecifier() ||\n binding.path.isImportNamespaceSpecifier() ||\n binding.path.isFunctionDeclaration() ||\n binding.path.isClassDeclaration()\n ) {\n return { opaque: true };\n }\n const declaration = binding.path.node;\n return declaration.type === 'VariableDeclarator' && declaration.init\n ? resolveOrdinaryElementExpression(\n declaration.init,\n binding.path.scope,\n analysis,\n seen\n )\n : undefined;\n}\n\n/** Classifies a retained tag expression without executing application code. */\nfunction resolveOrdinaryElementExpression(\n input: babel.Expression,\n scope: Scope,\n analysis: VueJSXAnalysis,\n seen: Set<babel.Node>\n): OrdinaryElementShape | undefined {\n const expression = unwrapExpression(input);\n if (!expression || seen.has(expression)) return undefined;\n const nextSeen = new Set(seen);\n nextSeen.add(expression);\n\n const primitive = analysis.readStaticPrimitive(expression, scope);\n if (primitive.ok) {\n return typeof primitive.value === 'string'\n ? { opaque: false, tag: primitive.value }\n : undefined;\n }\n if (\n expression.type === 'ArrowFunctionExpression' ||\n expression.type === 'FunctionExpression' ||\n expression.type === 'ClassExpression' ||\n expression.type === 'ObjectExpression'\n ) {\n return { opaque: true };\n }\n if (expression.type === 'Identifier') {\n const binding = scope.getBinding(expression.name);\n if (!binding) return undefined;\n if (\n binding.path.isImportSpecifier() ||\n binding.path.isImportDefaultSpecifier() ||\n binding.path.isImportNamespaceSpecifier() ||\n binding.path.isFunctionDeclaration() ||\n binding.path.isClassDeclaration()\n ) {\n return { opaque: true };\n }\n const declaration = binding.path.node;\n return declaration.type === 'VariableDeclarator' && declaration.init\n ? resolveOrdinaryElementExpression(\n declaration.init,\n binding.path.scope,\n analysis,\n nextSeen\n )\n : undefined;\n }\n if (\n expression.type === 'CallExpression' ||\n expression.type === 'OptionalCallExpression'\n ) {\n if (expression.callee.type === 'V8IntrinsicIdentifier') return undefined;\n const callee = analysis.resolveKnownValue(expression.callee, scope);\n if (callee?.type === 'defineComponent') return { opaque: true };\n const argument = expression.arguments[0];\n return callee?.type === 'identity' &&\n expression.arguments.length === 1 &&\n argument &&\n argument.type !== 'SpreadElement' &&\n argument.type !== 'ArgumentPlaceholder'\n ? resolveOrdinaryElementExpression(argument, scope, analysis, nextSeen)\n : undefined;\n }\n if (expression.type === 'ConditionalExpression') {\n return mergeOrdinaryElementShapes(\n resolveOrdinaryElementExpression(\n expression.consequent,\n scope,\n analysis,\n nextSeen\n ),\n resolveOrdinaryElementExpression(\n expression.alternate,\n scope,\n analysis,\n nextSeen\n )\n );\n }\n if (expression.type === 'LogicalExpression') {\n return mergeOrdinaryElementShapes(\n resolveOrdinaryElementExpression(\n expression.left,\n scope,\n analysis,\n nextSeen\n ),\n resolveOrdinaryElementExpression(\n expression.right,\n scope,\n analysis,\n nextSeen\n )\n );\n }\n if (expression.type === 'SequenceExpression') {\n const last = expression.expressions.at(-1);\n return last\n ? resolveOrdinaryElementExpression(last, scope, analysis, nextSeen)\n : undefined;\n }\n return undefined;\n}\n\n/** Combines alternate tags only when they preserve traversal semantics. */\nfunction mergeOrdinaryElementShapes(\n left: OrdinaryElementShape | undefined,\n right: OrdinaryElementShape | undefined\n): OrdinaryElementShape | undefined {\n if (!left || !right || left.opaque !== right.opaque) return undefined;\n return {\n opaque: left.opaque,\n ...(left.tag === right.tag && left.tag !== undefined && { tag: left.tag }),\n };\n}\n\nfunction readElementDisplayName(\n name: babel.JSXElement['openingElement']['name']\n): string | undefined {\n if (name.type === 'JSXIdentifier') return name.name;\n if (name.type === 'JSXNamespacedName') return undefined;\n const object = readMemberDisplayName(name.object);\n return object ? `${object}.${name.property.name}` : undefined;\n}\n\nfunction readMemberDisplayName(\n object: babel.JSXMemberExpression['object']\n): string | undefined {\n if (object.type === 'JSXIdentifier') return object.name;\n const parent = readMemberDisplayName(object.object);\n return parent ? `${parent}.${object.property.name}` : undefined;\n}\n\nfunction readAttributeName(name: babel.JSXAttribute['name']): string {\n return name.type === 'JSXIdentifier'\n ? name.name\n : `${name.namespace.name}:${name.name.name}`;\n}\n\n/** Mirrors `@vue/babel-plugin-jsx`'s JSX text and string-prop transform. */\nfunction normalizeJSXText(text: string): string {\n const lines = text.split(/\\r\\n|\\n|\\r/);\n let lastNonEmptyLine = 0;\n for (let index = 0; index < lines.length; index += 1) {\n if (/[^ \\t]/.test(lines[index]!)) lastNonEmptyLine = index;\n }\n\n let result = '';\n for (let index = 0; index < lines.length; index += 1) {\n const isFirstLine = index === 0;\n const isLastLine = index === lines.length - 1;\n const isLastNonEmptyLine = index === lastNonEmptyLine;\n let line = lines[index]!.replace(/\\t/g, ' ');\n if (!isFirstLine) line = line.replace(/^ +/, '');\n if (!isLastLine) line = line.replace(/ +$/, '');\n if (!line) continue;\n if (!isLastNonEmptyLine) line += ' ';\n result += line;\n }\n return result;\n}\n\nfunction appendSerializedChild(result: JsxChild[], child: JsxChild): void {\n const previous = result.at(-1);\n if (typeof previous === 'string' && typeof child === 'string') {\n result[result.length - 1] = previous + child;\n } else {\n result.push(child);\n }\n}\n\nfunction collapseChildren(children: JsxChild[]): JsxChildren {\n return children.length === 1 ? children[0]! : children;\n}\n"],"mappings":";;;;;;AAkEA,MAAM,mBAAmB,IAAI,IAAI,CAAC,OAAO,MAAM,CAAC;AAChD,MAAM,oBAAoB,IAAI,IAAqB;CACjD;CACA;CACA;CACD,CAAC;AACF,MAAM,wBAAwB,IAAI,IAAI;CACpC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;;;;;;;;;AAUF,SAAgB,yBACd,MACA,SACA,UACM;AACN,KAAI,SAAS,cAAc;AACzB,cACE,SACA,cAAc,SAAS,aAAa,IAAI,EACxC,+DACA,wEACD;AACD;;CAEF,MAAM,aAAa,QAAQ,OAAO;CAClC,MAAM,qBAAqB,uBACzB,KAAK,KAAK,gBACV,KAAK,OACL,SACA,SACD;CACD,MAAM,SAAS,iBACb,kBACE,KAAK,KAAK,UACV,EAAE,OAAO,GAAG,EACZ,KAAK,OACL,SACA,SACD,CACF;AACD,KAAI,QAAQ,OAAO,WAAW,WAAY;AAE1C,SAAQ,QAAQ,KAAK;EACnB,YAAY;EACZ;EACA,UAAU,qBACR,SACA,cAAc,KAAK,KAAK,IAAI,EAC5B,mBACD;EACF,CAAC;;;AAIJ,SAAgB,4BACd,MACA,UACS;CACT,IAAI,UAA2B,KAAK;AACpC,QAAO,SAAS;AAC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,MAAM,QAAQ,SAAS,GAAG;EACpD,MAAM,cAAc,UAAU;EAC9B,MAAM,aAAa,UAAU,MAAM,SAAS;EAC5C,MAAM,qBAAqB,UAAU;EACrC,IAAI,OAAO,MAAM,OAAQ,QAAQ,OAAO,IAAI;AAC5C,MAAI,CAAC,YAAa,QAAO,KAAK,QAAQ,OAAO,GAAG;AAChD,MAAI,CAAC,WAAY,QAAO,KAAK,QAAQ,OAAO,GAAG;AAC/C,MAAI,CAAC,KAAM;AACX,MAAI,CAAC,mBAAoB,SAAQ;AACjC,YAAU;;AAEZ,QAAO;;AAGT,SAAS,sBAAsB,QAAoB,OAAuB;CACxE,MAAM,WAAW,OAAO,GAAG,GAAG;AAC9B,KAAI,OAAO,aAAa,YAAY,OAAO,UAAU,SACnD,QAAO,OAAO,SAAS,KAAK,WAAW;KAEvC,QAAO,KAAK,MAAM;;AAItB,SAAS,iBAAiB,UAAmC;AAC3D,QAAO,SAAS,WAAW,IAAI,SAAS,KAAM"}
|
|
1
|
+
{"version":3,"file":"jsx.js","names":[],"sources":["../../../src/internal/script/jsx.ts"],"sourcesContent":["import type { NodePath, Scope } from '@babel/traverse';\nimport * as babel from '@babel/types';\nimport {\n HTML_CONTENT_PROPS,\n type GTProp,\n type JsxChild,\n type JsxChildren,\n} from '@generaltranslation/format/types';\nimport { isHTMLTag, isSVGTag } from '@vue/shared';\nimport { isAcceptedPluralForm } from 'generaltranslation/internal';\nimport type {\n ExtractionLocation,\n GTComponentName,\n VueExtractionContext,\n} from '../types.js';\nimport {\n addVueError,\n applyStaticTMetadataValue,\n babelLocation,\n createInlineMetadata,\n type ExtractedTMetadata,\n normalizeTMetadataKey,\n type StaticPrimitive,\n type StaticPrimitiveResult,\n type TMetadataKey,\n unwrapExpression,\n} from '../utils.js';\nimport type { KnownValue } from './model.js';\n\ntype Counter = { value: number };\n\n/** Prevents source strings on opposite sides of a JSX comment from merging. */\nconst jsxTextBoundary = Symbol('gt-vue-jsx-text-boundary');\n\ntype SerializedJSXArray = {\n kind: 'array';\n children: SerializedJSXChild[];\n};\n\n/** React persists these as scalar wires but removes them inside child arrays. */\ntype SerializedWireLiteral = boolean | null;\n\ntype SerializedJSXChild =\n | JsxChild\n | SerializedWireLiteral\n | SerializedJSXArray\n | typeof jsxTextBoundary;\n\ntype SerializedSlotResult = {\n children: SerializedJSXChild[];\n /** Vue treats an undefined named-slot result as an absent branch. */\n slotAbsent?: boolean;\n slotTruthy?: boolean;\n};\n\ntype JSXSlotFunction = {\n node:\n | babel.ArrowFunctionExpression\n | babel.FunctionExpression\n | babel.ObjectMethod;\n scope: Scope;\n};\n\ntype JSXSlotLayout = {\n defaultChildren: babel.JSXElement['children'];\n defaultSlot?: JSXSlotFunction;\n namedSlots: Map<string, JSXSlotFunction>;\n};\n\ntype OrdinaryElementShape = {\n /** Whether Vue represents authored JSX children as a default slot. */\n component: boolean;\n /** Proven runtime string tag, retained only for catalog readability. */\n tag?: string;\n};\n\n/** Narrow script-analysis capabilities required by rich JSX extraction. */\nexport type VueJSXAnalysis = {\n /** Per-file pragma that replaces Vue's VNode factory, when present. */\n customPragma?: babel.Comment;\n /** Resolves an expression to a proven gt-vue or Vue runtime identity. */\n resolveKnownValue: (\n expression: babel.Expression,\n scope: Scope\n ) => KnownValue | undefined;\n /** Evaluates the side-effect-free primitive subset at this source position. */\n readStaticPrimitive: (\n expression: babel.Node,\n scope: Scope\n ) => StaticPrimitiveResult;\n /** Resolves a safely retained object literal without executing user code. */\n resolveStaticObject: (\n expression: babel.Node,\n scope: Scope\n ) => { node: babel.ObjectExpression; scope: Scope } | undefined;\n /** Returns Babel's lexical scope for a nested function or expression. */\n scopeForNode: (node: babel.Node, fallback: Scope) => Scope;\n};\n\nconst RESERVED_T_PROPS = new Set(['key', 'ref']);\nconst FORMAT_COMPONENTS = new Set<GTComponentName>([\n 'Currency',\n 'DateTime',\n 'Num',\n]);\nconst NON_BRANCH_PROP_NAMES = new Set([\n 'branch',\n 'class',\n 'key',\n 'locales',\n 'n',\n 'ref',\n 'ref-for',\n 'ref-key',\n 'ref_for',\n 'ref_key',\n 'style',\n 'v-slots',\n 'vSlots',\n]);\n\n/**\n * Extracts one statically identified gt-vue `T` JSX element.\n *\n * This serializer follows the VNodes emitted by `@vue/babel-plugin-jsx` while\n * preserving React's authoritative rich-source contract: authored Fragments\n * are semantic elements, explicit arrays retain array cardinality, JSX text\n * uses the plugin's normalization, and static custom-component default slots\n * participate in the same source tree as React component children. Runtime\n * values remain explicit variable boundaries and named component slots remain\n * outside the outer translation.\n */\nexport function extractVueJSXTranslation(\n path: NodePath<babel.JSXElement>,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis\n): void {\n if (analysis.customPragma) {\n addVueError(\n context,\n babelLocation(analysis.customPragma.loc),\n 'Found a custom @jsx pragma in a gt-vue JSX translation file',\n 'Use the default Vue JSX VNode factory for files containing gt-vue <T>'\n );\n return;\n }\n const errorCount = context.errors.length;\n const translationMetadata = readTranslationMetadata(\n path.node.openingElement,\n path.scope,\n context,\n analysis\n );\n const source = collapseRootChildren(\n serializeChildren(\n path.node.children,\n { value: 0 },\n path.scope,\n context,\n analysis\n )\n );\n if (context.errors.length !== errorCount) return;\n\n context.results.push({\n dataFormat: 'JSX',\n source,\n metadata: createInlineMetadata(\n context,\n babelLocation(path.node.loc),\n translationMetadata\n ),\n });\n}\n\n/** Returns whether the visitor is already covered by an outer serialized T. */\nexport function isNestedInVueJSXTranslation(\n path: NodePath<babel.JSXElement>,\n analysis: VueJSXAnalysis\n): boolean {\n let current: NodePath | null = path.parentPath;\n while (current) {\n if (current.isJSXElement()) {\n const element = current.node;\n const identity = resolveElementIdentity(\n element.openingElement.name,\n current.scope,\n analysis\n );\n const containingAttribute = findContainingJSXAttribute(path, current);\n if (containingAttribute) {\n if (!isSlotsAttribute(containingAttribute.node)) {\n // JSX inside an event or ordinary prop is not a child VNode of the\n // surrounding translation. Extract it independently if it is T.\n return false;\n }\n if (\n identity?.type === 'component' &&\n (identity.name === 'Branch' || identity.name === 'Plural')\n ) {\n // Every stable Branch and Plural slot belongs to the outer source.\n current = current.parentPath;\n continue;\n }\n if (\n identity?.type === 'component' &&\n (identity.name === 'Var' || FORMAT_COMPONENTS.has(identity.name))\n ) {\n return false;\n }\n const slotName = readContainingJSXSlotName(\n path,\n containingAttribute,\n analysis\n );\n // Only a component's default slot belongs to the surrounding rich\n // source. Named slots have independent lifetimes and may contain an\n // independently extracted T. An unresolved key is kept nested so the\n // outer extraction owns the fail-closed diagnostic without emitting a\n // second, misleading catalog entry.\n if (slotName !== 'default') return slotName === undefined;\n }\n if (\n !containingAttribute &&\n identity?.type !== 'component' &&\n (identity?.type !== 'vue-builtin' ||\n usesFragmentComponentSlots(element.openingElement.name, identity))\n ) {\n const shape = identity\n ? { component: true }\n : resolveOrdinaryElementShape(\n element.openingElement.name,\n current.scope,\n analysis,\n new Set()\n );\n if (shape?.component) {\n const objectSlot = readContainingJSXObjectSlotName(\n path,\n current,\n analysis\n );\n if (objectSlot.present && objectSlot.name !== 'default') {\n return objectSlot.name === undefined;\n }\n }\n }\n if (identity?.type === 'component') {\n if (identity.name === 'T') return true;\n if (identity.name === 'Var' || FORMAT_COMPONENTS.has(identity.name)) {\n return false;\n }\n // Branch and Plural own stable slots, so an outer T reaches them.\n } else if (\n identity?.type === 'vue-builtin' &&\n (identity.name !== 'Fragment' ||\n isAuthoredFragment(element.openingElement.name, identity))\n ) {\n // Vue built-ins remain within the outer translation traversal. An\n // authored Fragment contributes a semantic wire element; Suspense\n // contributes its normalized default subtree.\n }\n }\n current = current.parentPath;\n }\n return false;\n}\n\n/** Finds an attribute boundary between a nested JSX node and one ancestor. */\nfunction findContainingJSXAttribute(\n path: NodePath,\n ancestor: NodePath<babel.JSXElement>\n): NodePath<babel.JSXAttribute> | undefined {\n let current: NodePath | null = path.parentPath;\n while (current && current !== ancestor) {\n if (\n current.isJSXAttribute() &&\n current.parentPath?.isJSXOpeningElement() &&\n current.parentPath.parentPath === ancestor\n ) {\n return current;\n }\n current = current.parentPath;\n }\n return undefined;\n}\n\nfunction isSlotsAttribute(attribute: babel.JSXAttribute): boolean {\n const name = readAttributeName(attribute.name);\n return name === 'v-slots' || name === 'vSlots';\n}\n\n/** Returns the direct static slot key containing one nested JSX element. */\nfunction readContainingJSXSlotName(\n path: NodePath,\n attribute: NodePath<babel.JSXAttribute>,\n analysis: VueJSXAnalysis\n): string | undefined {\n const expression =\n attribute.node.value?.type === 'JSXExpressionContainer' &&\n attribute.node.value.expression.type !== 'JSXEmptyExpression'\n ? unwrapExpression(attribute.node.value.expression)\n : undefined;\n if (expression?.type !== 'ObjectExpression') return undefined;\n\n let current: NodePath | null = path.parentPath;\n while (current && current.node !== expression) {\n if (\n current.parentPath?.node === expression &&\n (current.isObjectMethod() || current.isObjectProperty())\n ) {\n return readStaticObjectKey(current.node, attribute.scope, analysis);\n }\n current = current.parentPath;\n }\n return undefined;\n}\n\n/** Classifies a nested element inside Vue's object-child slot spelling. */\nfunction readContainingJSXObjectSlotName(\n path: NodePath,\n element: NodePath<babel.JSXElement>,\n analysis: VueJSXAnalysis\n): { name?: string; present: boolean } {\n const meaningfulChildren = element.node.children.filter(isMeaningfulJSXChild);\n const child = meaningfulChildren[0];\n if (\n meaningfulChildren.length !== 1 ||\n child?.type !== 'JSXExpressionContainer' ||\n child.expression.type === 'JSXEmptyExpression'\n ) {\n return { present: false };\n }\n const object = unwrapExpression(child.expression);\n if (object?.type !== 'ObjectExpression') return { present: false };\n\n let current: NodePath | null = path.parentPath;\n while (current && current.node !== object) {\n if (\n current.parentPath?.node === object &&\n (current.isObjectMethod() || current.isObjectProperty())\n ) {\n return {\n name: readStaticObjectKey(current.node, element.scope, analysis),\n present: true,\n };\n }\n current = current.parentPath;\n }\n return { present: false };\n}\n\n/** Resolves a JSX tag to the identity tracked by the script analyzer. */\nexport function resolveVueJSXElementIdentity(\n name: babel.JSXElement['openingElement']['name'],\n scope: Scope,\n analysis: VueJSXAnalysis\n): KnownValue | undefined {\n return resolveElementIdentity(name, scope, analysis);\n}\n\n/** Enforces the one supported public shape for a gt-vue variable component. */\nexport function validateVueJSXVariableComponent(\n element: babel.JSXElement,\n component: 'Currency' | 'DateTime' | 'Num' | 'Var',\n context: VueExtractionContext\n): void {\n validateVariableElement(element, component, context);\n}\n\nfunction readTranslationMetadata(\n element: babel.JSXOpeningElement,\n scope: Scope,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis\n): ExtractedTMetadata {\n const metadata: ExtractedTMetadata = {};\n const seen = new Set<TMetadataKey>();\n\n for (const attribute of element.attributes) {\n if (attribute.type === 'JSXSpreadAttribute') {\n addVueError(\n context,\n babelLocation(attribute.loc),\n 'Found a spread prop on a gt-vue <T> component in JSX',\n 'Pass each metadata value through an explicit static prop'\n );\n continue;\n }\n const name = readAttributeName(attribute.name);\n if (RESERVED_T_PROPS.has(name)) continue;\n const key = normalizeTMetadataKey(name);\n if (!key) {\n addVueError(\n context,\n babelLocation(attribute.loc),\n `Found unsupported prop \"${name}\" on a gt-vue <T> component`,\n 'Use only static context, id, maxChars, or requiresReview metadata'\n );\n continue;\n }\n if (\n !registerJSXTMetadataKey(key, seen, babelLocation(attribute.loc), context)\n ) {\n continue;\n }\n const contextExpression =\n attribute.value?.type === 'JSXExpressionContainer' &&\n attribute.value.expression.type !== 'JSXEmptyExpression'\n ? unwrapExpression(attribute.value.expression)\n : undefined;\n if (\n key === 'context' &&\n (contextExpression?.type === 'ConditionalExpression' ||\n contextExpression?.type === 'LogicalExpression')\n ) {\n addVueError(\n context,\n babelLocation(attribute.loc),\n 'Found conditional context on a gt-vue <T> component',\n 'Use one invariant static context string for this translation'\n );\n continue;\n }\n const value = readJSXAttributePrimitive(attribute, scope, analysis);\n if (!value.ok || !applyStaticTMetadataValue(metadata, key, value.value)) {\n addInvalidJSXTMetadataValueError(\n key,\n babelLocation(attribute.loc),\n context\n );\n continue;\n }\n }\n return metadata;\n}\n\nfunction registerJSXTMetadataKey(\n key: TMetadataKey,\n seen: Set<TMetadataKey>,\n location: ExtractionLocation | undefined,\n context: VueExtractionContext\n): boolean {\n if (!seen.has(key)) {\n seen.add(key);\n return true;\n }\n addVueError(\n context,\n location,\n `Found duplicate ${key} props on a gt-vue <T> component`,\n `Pass only one ${key} prop or its $-prefixed alias`\n );\n return false;\n}\n\nfunction addInvalidJSXTMetadataValueError(\n key: TMetadataKey,\n location: ExtractionLocation | undefined,\n context: VueExtractionContext\n): void {\n const expected =\n key === 'context' || key === 'id'\n ? 'a static string'\n : key === 'maxChars'\n ? 'a static integer expression'\n : 'a static boolean or a bare requiresReview prop';\n addVueError(\n context,\n location,\n `Found an invalid or dynamic ${key} on a gt-vue <T> component`,\n `Use ${expected}`\n );\n}\n\nfunction serializeChildren(\n children: Array<\n | babel.JSXText\n | babel.JSXExpressionContainer\n | babel.JSXSpreadChild\n | babel.JSXElement\n | babel.JSXFragment\n >,\n counter: Counter,\n scope: Scope,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis\n): SerializedJSXChild[] {\n const result: SerializedJSXChild[] = [];\n const runtimeArgumentCount = children.filter(\n isJSXRuntimeChildArgument\n ).length;\n const preserveScalarWireLiteral = runtimeArgumentCount === 1;\n for (const child of children) {\n for (const serialized of serializeChild(\n child,\n counter,\n scope,\n context,\n analysis,\n preserveScalarWireLiteral\n )) {\n appendSerializedChild(result, serialized);\n }\n }\n return runtimeArgumentCount > 1\n ? [{ kind: 'array', children: result }]\n : result;\n}\n\n/** Whether the Vue JSX transform emits this authored node as a child value. */\nfunction isJSXRuntimeChildArgument(\n child:\n | babel.JSXText\n | babel.JSXExpressionContainer\n | babel.JSXSpreadChild\n | babel.JSXElement\n | babel.JSXFragment\n): boolean {\n if (child.type === 'JSXText') return normalizeJSXText(child.value) !== '';\n return (\n child.type !== 'JSXExpressionContainer' ||\n child.expression.type !== 'JSXEmptyExpression'\n );\n}\n\nfunction serializeChild(\n child:\n | babel.JSXText\n | babel.JSXExpressionContainer\n | babel.JSXSpreadChild\n | babel.JSXElement\n | babel.JSXFragment,\n counter: Counter,\n scope: Scope,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis,\n preserveScalarWireLiteral: boolean\n): SerializedJSXChild[] {\n if (child.type === 'JSXText') {\n const text = normalizeJSXText(child.value);\n return text ? [text] : [];\n }\n if (child.type === 'JSXElement') {\n return serializeElement(child, counter, scope, context, analysis);\n }\n if (child.type === 'JSXFragment') {\n return [serializeJSXFragment(child, counter, scope, context, analysis)];\n }\n if (child.type === 'JSXSpreadChild') {\n addVueError(\n context,\n babelLocation(child.loc),\n 'Found a spread child inside a gt-vue <T> component in JSX',\n 'Use static JSX children and wrap one runtime value in a gt-vue variable component'\n );\n return [];\n }\n if (child.expression.type === 'JSXEmptyExpression') {\n return [jsxTextBoundary];\n }\n return serializeExpression(\n child.expression,\n counter,\n scope,\n context,\n analysis,\n preserveScalarWireLiteral\n );\n}\n\nfunction serializeExpression(\n input: babel.Expression,\n counter: Counter,\n scope: Scope,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis,\n preserveScalarWireLiteral = true\n): SerializedJSXChild[] {\n const expression = unwrapExpression(input);\n if (!expression) return [];\n if (expression.type === 'JSXElement') {\n return serializeElement(expression, counter, scope, context, analysis);\n }\n if (expression.type === 'JSXFragment') {\n return [\n serializeJSXFragment(expression, counter, scope, context, analysis),\n ];\n }\n if (expression.type === 'ArrayExpression') {\n const result: SerializedJSXChild[] = [];\n for (const item of expression.elements) {\n if (!item) continue;\n if (item.type === 'SpreadElement') {\n addVueError(\n context,\n babelLocation(item.loc),\n 'Found a spread array child inside a gt-vue <T> component in JSX',\n 'List each static child explicitly'\n );\n continue;\n }\n for (const serialized of serializeExpression(\n item,\n counter,\n scope,\n context,\n analysis,\n false\n )) {\n appendSerializedChild(result, serialized);\n }\n }\n return [{ kind: 'array', children: result }];\n }\n if (\n expression.type === 'ConditionalExpression' ||\n expression.type === 'LogicalExpression'\n ) {\n addVueError(\n context,\n babelLocation(expression.loc),\n 'Found conditional JSX content inside a gt-vue <T> component',\n 'Move conditional content outside <T>, or use a static Branch or Plural component'\n );\n return [];\n }\n\n const value = analysis.readStaticPrimitive(expression, scope);\n if (!value.ok) {\n addVueError(\n context,\n babelLocation(expression.loc),\n 'Found dynamic JSX content inside a gt-vue <T> component',\n 'Wrap runtime values in <Var>, <Num>, <DateTime>, or <Currency>'\n );\n return [];\n }\n // React preserves a lone boolean/null source as its exact persisted wire,\n // even though neither framework renders a DOM node for it. Once nested in\n // an authored children array, React.Children.map removes those literals.\n if (value.value === null || typeof value.value === 'boolean') {\n return preserveScalarWireLiteral ? [value.value] : [];\n }\n // An explicit undefined behaves like an absent child in both scalar and\n // array positions. Every other primitive is stringified by the runtime.\n return value.value === undefined ? [] : [String(value.value)];\n}\n\nfunction serializeElement(\n element: babel.JSXElement,\n counter: Counter,\n scope: Scope,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis\n): SerializedJSXChild[] {\n const name = element.openingElement.name;\n const identity = resolveElementIdentity(name, scope, analysis);\n if (isAuthoredFragment(name, identity)) {\n return serializeSemanticFragment(\n element,\n counter,\n scope,\n context,\n analysis,\n usesFragmentComponentSlots(name, identity)\n );\n }\n\n counter.value += 1;\n const id = counter.value;\n const component = identity?.type === 'component' ? identity.name : undefined;\n\n validateElementAttributes(element.openingElement, scope, context, analysis);\n if (component === 'T') {\n addVueError(\n context,\n babelLocation(element.loc),\n 'Found a nested gt-vue <T> component inside another <T>',\n 'Split nested translations into sibling <T> components'\n );\n return [];\n }\n if (\n component === 'Var' ||\n component === 'Num' ||\n component === 'DateTime' ||\n component === 'Currency'\n ) {\n validateVariableElement(element, component, context);\n const variable =\n component === 'Num'\n ? { name: 'n', type: 'n' as const }\n : component === 'DateTime'\n ? { name: 'date', type: 'd' as const }\n : component === 'Currency'\n ? { name: 'cost', type: 'c' as const }\n : { name: 'value', type: 'v' as const };\n return [{ i: id, k: `_gt_${variable.name}_${id}`, v: variable.type }];\n }\n if (component === 'Branch' || component === 'Plural') {\n return [\n serializeBranchElement(\n element,\n id,\n component,\n counter,\n scope,\n context,\n analysis\n ),\n ];\n }\n if (identity?.type === 'vue-builtin' && identity.name === 'Suspense') {\n return [\n serializeSuspenseElement(element, id, counter, scope, context, analysis),\n ];\n }\n if (!identity && isUnboundNonNativeElement(name, scope)) {\n addVueError(\n context,\n babelLocation(element.loc),\n `Could not determine whether JSX tag <${readElementDisplayName(name) ?? 'unknown'}> is a component or custom element`,\n 'Import or locally bind the component, or move the configured custom element outside <T>'\n );\n return [];\n }\n\n // Every remaining known identity is a runtime function or object. Vue\n // therefore creates a component VNode whose authored default slot is the\n // equivalent of React `children` and belongs to this rich source tree.\n const ordinaryShape = identity\n ? { component: true }\n : resolveOrdinaryElementShape(name, scope, analysis, new Set());\n if (!identity && !ordinaryShape) {\n addVueError(\n context,\n babelLocation(element.loc),\n `Could not statically resolve whether JSX tag <${readElementDisplayName(name) ?? 'unknown'}> renders an element or component`,\n 'Use a native tag, imported component, defineComponent result, or an immutable tag expression that cannot switch between element and component shapes'\n );\n return [];\n }\n\n const data = readContentProps(\n element.openingElement,\n scope,\n context,\n analysis\n );\n const tag = ordinaryShape?.tag ?? readElementDisplayName(name);\n if (!tag) {\n addVueError(\n context,\n babelLocation(element.loc),\n 'Found unsupported namespaced JSX syntax inside a gt-vue <T> component',\n 'Use a native element or a statically imported component'\n );\n return [];\n }\n const childResult = ordinaryShape?.component\n ? serializeOrdinaryComponentDefault(\n element,\n counter,\n scope,\n context,\n analysis\n )\n : {\n children: serializeChildren(\n element.children,\n counter,\n scope,\n context,\n analysis\n ),\n };\n return [\n {\n t: tag,\n i: id,\n ...(Object.keys(data).length > 0 && { d: data }),\n ...(shouldIncludeElementChildren(\n element,\n childResult.children,\n scope,\n analysis,\n childResult.slotTruthy\n ) && { c: collapseChildren(childResult.children) }),\n },\n ];\n}\n\n/** Serializes the shorthand `<>...</>` spelling as React.Fragment semantics. */\nfunction serializeJSXFragment(\n fragment: babel.JSXFragment,\n counter: Counter,\n scope: Scope,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis\n): JsxChild {\n counter.value += 1;\n const id = counter.value;\n const children = serializeChildren(\n fragment.children,\n counter,\n scope,\n context,\n analysis\n );\n return {\n t: `C${id}`,\n i: id,\n ...(hasTruthyJSXChildren(fragment.children, scope, analysis) && {\n c: collapseChildren(children),\n }),\n };\n}\n\n/** Serializes a Fragment alias that Vue JSX represents as a component slot. */\nfunction serializeSemanticFragment(\n element: babel.JSXElement,\n counter: Counter,\n scope: Scope,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis,\n usesComponentSlots: boolean\n): SerializedJSXChild[] {\n counter.value += 1;\n const id = counter.value;\n validateElementAttributes(element.openingElement, scope, context, analysis);\n const data = readContentProps(\n element.openingElement,\n scope,\n context,\n analysis\n );\n const childResult = usesComponentSlots\n ? serializeOrdinaryComponentDefault(\n element,\n counter,\n scope,\n context,\n analysis\n )\n : {\n children: serializeChildren(\n element.children,\n counter,\n scope,\n context,\n analysis\n ),\n };\n return [\n {\n // Fragment is a Symbol at runtime and therefore uses the anonymous\n // component label. The label is diagnostic-only and excluded from the\n // persisted hash; the boundary and its ID remain semantically relevant.\n t: `C${id}`,\n i: id,\n ...(Object.keys(data).length > 0 && { d: data }),\n ...(shouldIncludeElementChildren(\n element,\n childResult.children,\n scope,\n analysis,\n childResult.slotTruthy\n ) && { c: collapseChildren(childResult.children) }),\n },\n ];\n}\n\n/** Serializes the authored default slot of an ordinary component VNode. */\nfunction serializeOrdinaryComponentDefault(\n element: babel.JSXElement,\n counter: Counter,\n scope: Scope,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis\n): { children: SerializedJSXChild[]; slotTruthy?: boolean } {\n const slotAttributes = element.openingElement.attributes.filter(\n (attribute): attribute is babel.JSXAttribute =>\n attribute.type === 'JSXAttribute' && isSlotsAttribute(attribute)\n );\n if (slotAttributes.length > 1) {\n addVueError(\n context,\n babelLocation(slotAttributes[1]!.loc),\n 'Found more than one v-slots prop on a component inside a gt-vue JSX translation',\n 'Pass one static slots object'\n );\n }\n\n const meaningfulChildren = element.children.filter(isMeaningfulJSXChild);\n const objectSlotChild =\n slotAttributes.length === 0 &&\n meaningfulChildren.length === 1 &&\n meaningfulChildren[0]?.type === 'JSXExpressionContainer' &&\n meaningfulChildren[0].expression.type !== 'JSXEmptyExpression'\n ? analysis.resolveStaticObject(meaningfulChildren[0].expression, scope)\n : undefined;\n const slotsObject = slotAttributes[0]\n ? readSlotsAttributeObject(\n slotAttributes[0],\n scope,\n context,\n analysis,\n 'a component inside a gt-vue JSX translation'\n )\n : objectSlotChild;\n const defaultSlot = slotsObject\n ? readOrdinaryDefaultSlot(slotsObject, context, analysis)\n : { present: false };\n\n if (defaultSlot.present) {\n return defaultSlot.slot\n ? serializeSlotFunction(defaultSlot.slot, counter, context, analysis)\n : { children: [], slotTruthy: false };\n }\n const directSlot = readDirectOrdinaryDefaultSlot(\n element,\n scope,\n context,\n analysis\n );\n if (directSlot.present) {\n return directSlot.slot\n ? serializeSlotFunction(directSlot.slot, counter, context, analysis)\n : { children: [], slotTruthy: false };\n }\n if (objectSlotChild) return { children: [], slotTruthy: false };\n return {\n children: serializeChildren(\n element.children,\n counter,\n scope,\n context,\n analysis\n ),\n };\n}\n\n/** Reads the one-function child Vue JSX compiles as a direct default slot. */\nfunction readDirectOrdinaryDefaultSlot(\n element: babel.JSXElement,\n scope: Scope,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis\n): { present: boolean; slot?: JSXSlotFunction } {\n const children = element.children.filter(isMeaningfulJSXChild);\n if (\n children.length !== 1 ||\n children[0]?.type !== 'JSXExpressionContainer' ||\n children[0].expression.type === 'JSXEmptyExpression'\n ) {\n return { present: false };\n }\n const value = unwrapExpression(children[0].expression);\n if (\n !value ||\n (value.type !== 'ArrowFunctionExpression' &&\n value.type !== 'FunctionExpression')\n ) {\n return { present: false };\n }\n if (value.params.length > 0 || value.async || value.generator) {\n addVueError(\n context,\n babelLocation(value.loc),\n 'Found a dynamic or scoped direct default slot on a component inside a gt-vue JSX translation',\n 'Use a synchronous zero-argument function with static returned content'\n );\n return { present: true };\n }\n return {\n present: true,\n slot: {\n node: value,\n scope: analysis.scopeForNode(value, scope),\n },\n };\n}\n\n/** Reads only the default entry; named slots remain runtime-owned and opaque. */\nfunction readOrdinaryDefaultSlot(\n object: { node: babel.ObjectExpression; scope: Scope },\n context: VueExtractionContext,\n analysis: VueJSXAnalysis\n): { present: boolean; slot?: JSXSlotFunction } {\n let present = false;\n let slot: JSXSlotFunction | undefined;\n\n for (const property of object.node.properties) {\n if (property.type === 'SpreadElement') {\n addVueError(\n context,\n babelLocation(property.loc),\n 'Found a spread in a component slots object inside a gt-vue JSX translation',\n 'List the static default slot explicitly so a spread cannot add or replace it'\n );\n continue;\n }\n const name = readStaticObjectKey(property, object.scope, analysis);\n if (name === undefined) {\n addVueError(\n context,\n babelLocation(property.loc),\n 'Found a dynamic slot name on a component inside a gt-vue JSX translation',\n 'Use a static named slot or an explicit default key'\n );\n continue;\n }\n if (name !== 'default') continue;\n if (present) {\n addVueError(\n context,\n babelLocation(property.loc),\n 'Found duplicate default slots on a component inside a gt-vue JSX translation',\n 'Define the default slot once'\n );\n continue;\n }\n present = true;\n const value =\n property.type === 'ObjectMethod' && property.kind === 'method'\n ? property\n : property.type === 'ObjectProperty'\n ? unwrapExpression(property.value)\n : undefined;\n if (\n !value ||\n (value.type !== 'ArrowFunctionExpression' &&\n value.type !== 'FunctionExpression' &&\n value.type !== 'ObjectMethod') ||\n value.params.length > 0 ||\n value.async ||\n value.generator\n ) {\n addVueError(\n context,\n babelLocation(property.loc),\n 'Found a dynamic or scoped default slot on a component inside a gt-vue JSX translation',\n 'Use a synchronous zero-argument function with static returned content'\n );\n continue;\n }\n slot = {\n node: value,\n scope: analysis.scopeForNode(value, object.scope),\n };\n }\n\n return { present, ...(slot && { slot }) };\n}\n\n/**\n * Serializes Vue Suspense's normalized default content without evaluating its\n * fallback. Vue requires that default slot to resolve to one VNode root; an\n * ambiguous or multi-root shape is rejected before it can hash differently.\n */\nfunction serializeSuspenseElement(\n element: babel.JSXElement,\n id: number,\n counter: Counter,\n scope: Scope,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis\n): JsxChild {\n const slots = readJSXSlotLayout(\n element,\n scope,\n context,\n analysis,\n 'suspense'\n );\n const directSlot = readDirectSuspenseSlot(element, scope, context, analysis);\n if (directSlot.present) {\n slots.defaultChildren = [];\n slots.defaultSlot = directSlot.slot;\n }\n\n for (const name of slots.namedSlots.keys()) {\n if (name === 'fallback' || name.startsWith('_')) continue;\n addVueError(\n context,\n babelLocation(element.loc),\n `Found unsupported named slot \"${name}\" on Vue <Suspense> inside a gt-vue <T> component`,\n 'Use only the default and fallback Suspense slots'\n );\n }\n\n if (slots.defaultSlot) {\n validateSuspenseSlotRoot(slots.defaultSlot, element, context);\n } else {\n validateSuspenseImplicitRoot(slots.defaultChildren, element, context);\n }\n\n const childResult: SerializedSlotResult = slots.defaultSlot\n ? serializeSlotFunction(slots.defaultSlot, counter, context, analysis)\n : {\n children: serializeChildren(\n slots.defaultChildren,\n counter,\n scope,\n context,\n analysis\n ),\n };\n const data = readContentProps(\n element.openingElement,\n scope,\n context,\n analysis\n );\n return {\n t: 'Suspense',\n i: id,\n ...(Object.keys(data).length > 0 && { d: data }),\n ...(shouldIncludeElementChildren(\n element,\n childResult.children,\n scope,\n analysis,\n childResult.slotTruthy\n ) && { c: collapseChildren(childResult.children) }),\n };\n}\n\n/** Reads the unambiguous one-function JSX spelling for a default slot. */\nfunction readDirectSuspenseSlot(\n element: babel.JSXElement,\n scope: Scope,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis\n): { present: boolean; slot?: JSXSlotFunction } {\n if (\n hasExplicitAttribute(element.openingElement, 'v-slots') ||\n hasExplicitAttribute(element.openingElement, 'vSlots')\n ) {\n return { present: false };\n }\n const children = element.children.filter(isMeaningfulJSXChild);\n if (\n children.length !== 1 ||\n children[0]?.type !== 'JSXExpressionContainer' ||\n children[0].expression.type === 'JSXEmptyExpression'\n ) {\n return { present: false };\n }\n const value = unwrapExpression(children[0].expression);\n if (\n !value ||\n (value.type !== 'ArrowFunctionExpression' &&\n value.type !== 'FunctionExpression')\n ) {\n return { present: false };\n }\n if (value.params.length > 0 || value.async || value.generator) {\n addVueError(\n context,\n babelLocation(value.loc),\n 'Found a dynamic or scoped default slot on Vue <Suspense> inside a gt-vue <T> component',\n 'Use a synchronous zero-argument function with static returned content'\n );\n return { present: true };\n }\n return {\n present: true,\n slot: {\n node: value,\n scope: analysis.scopeForNode(value, scope),\n },\n };\n}\n\n/** Enforces the single-root contract for children wrapped by the JSX plugin. */\nfunction validateSuspenseImplicitRoot(\n children: babel.JSXElement['children'],\n element: babel.JSXElement,\n context: VueExtractionContext\n): void {\n const roots = children.filter(isMeaningfulJSXChild);\n if (roots.length > 1) {\n addSuspenseRootError(element, context);\n return;\n }\n const root = roots[0];\n if (\n root?.type === 'JSXExpressionContainer' &&\n root.expression.type !== 'JSXEmptyExpression'\n ) {\n const expression = unwrapExpression(root.expression);\n if (\n expression?.type !== 'JSXElement' &&\n expression?.type !== 'JSXFragment'\n ) {\n addVueError(\n context,\n babelLocation(root.loc),\n 'Could not statically prove the default root of Vue <Suspense> inside a gt-vue <T> component',\n 'Use one JSX element, Fragment, or a static zero-argument default slot'\n );\n }\n }\n}\n\n/** Enforces the single-root contract for an explicit static slot function. */\nfunction validateSuspenseSlotRoot(\n slot: JSXSlotFunction,\n element: babel.JSXElement,\n context: VueExtractionContext\n): void {\n const returned = readStaticSlotReturn(slot);\n const expression = returned && unwrapExpression(returned);\n if (expression?.type !== 'ArrayExpression') return;\n const roots = expression.elements.filter(Boolean);\n if (\n roots.length > 1 ||\n roots.some(\n (root) =>\n root?.type === 'SpreadElement' ||\n (root?.type !== 'JSXElement' && root?.type !== 'JSXFragment')\n )\n ) {\n addSuspenseRootError(element, context);\n }\n}\n\n/** Reports the stable diagnostic shared by all invalid Suspense root shapes. */\nfunction addSuspenseRootError(\n element: babel.JSXElement,\n context: VueExtractionContext\n): void {\n addVueError(\n context,\n babelLocation(element.loc),\n 'Found more than one or an invalid default root inside Vue <Suspense> within a gt-vue <T> component',\n 'Wrap the Suspense default content in one element or Fragment, or move <T> inside <Suspense>'\n );\n}\n\n/** Serializes GT-owned Branch and Plural slots with independent ID scopes. */\nfunction serializeBranchElement(\n element: babel.JSXElement,\n id: number,\n component: 'Branch' | 'Plural',\n counter: Counter,\n scope: Scope,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis\n): JsxChild {\n const slots = readJSXSlotLayout(element, scope, context, analysis);\n if (\n component === 'Plural' &&\n !hasExplicitAttribute(element.openingElement, 'n')\n ) {\n addVueError(\n context,\n babelLocation(element.openingElement.loc),\n 'Found a gt-vue <Plural> component without an n prop',\n 'Pass the numeric selector through <Plural n={count} />'\n );\n }\n\n const childResult: SerializedSlotResult = slots.defaultSlot\n ? serializeSlotFunction(slots.defaultSlot, counter, context, analysis)\n : {\n children: serializeChildren(\n slots.defaultChildren,\n counter,\n scope,\n context,\n analysis\n ),\n };\n const branches: Record<string, JsxChildren> = {};\n for (const [name, slot] of slots.namedSlots) {\n if (name.startsWith('_')) continue;\n if (component === 'Plural' && !isAcceptedPluralForm(name)) continue;\n const result = serializeSlotFunction(\n slot,\n { value: id },\n context,\n analysis\n );\n if (result.slotAbsent) continue;\n branches[name] = collapseChildren(result.children);\n }\n readBranchAttributeSources(\n element.openingElement,\n component,\n branches,\n scope,\n context,\n analysis\n );\n\n const data = readContentProps(\n element.openingElement,\n scope,\n context,\n analysis\n );\n if (Object.keys(branches).length > 0) {\n data.b = branches;\n data.t = component === 'Plural' ? 'p' : 'b';\n }\n return {\n t: component,\n i: id,\n ...(Object.keys(data).length > 0 && { d: data }),\n ...(shouldIncludeElementChildren(\n element,\n childResult.children,\n scope,\n analysis,\n childResult.slotTruthy\n ) && { c: collapseChildren(childResult.children) }),\n };\n}\n\n/** Reconstructs the slots object emitted by the Vue JSX transform. */\nfunction readJSXSlotLayout(\n element: babel.JSXElement,\n scope: Scope,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis,\n owner: 'branch' | 'suspense' = 'branch'\n): JSXSlotLayout {\n const ownerLabel =\n owner === 'suspense' ? 'Vue <Suspense>' : 'a gt-vue JSX branch component';\n const vSlots = element.openingElement.attributes.filter(\n (attribute): attribute is babel.JSXAttribute =>\n attribute.type === 'JSXAttribute' && isSlotsAttribute(attribute)\n );\n if (vSlots.length > 1) {\n addVueError(\n context,\n babelLocation(vSlots[1]!.loc),\n `Found more than one v-slots prop on ${ownerLabel}`,\n 'Pass one static slots object'\n );\n }\n\n const meaningfulChildren = element.children.filter(isMeaningfulJSXChild);\n const objectSlotChild =\n vSlots.length === 0 &&\n meaningfulChildren.length === 1 &&\n meaningfulChildren[0]?.type === 'JSXExpressionContainer' &&\n meaningfulChildren[0].expression.type !== 'JSXEmptyExpression'\n ? analysis.resolveStaticObject(meaningfulChildren[0].expression, scope)\n : undefined;\n if (objectSlotChild) {\n addVueError(\n context,\n babelLocation(meaningfulChildren[0]?.loc),\n 'Found Vue object-slot child syntax in a gt-vue JSX translation',\n 'Pass the static slots object through v-slots so extraction is independent of the JSX enableObjectSlots compiler option'\n );\n }\n const vSlotsObject = vSlots[0]\n ? readSlotsAttributeObject(vSlots[0], scope, context, analysis, ownerLabel)\n : undefined;\n const slotsObject = vSlotsObject;\n const namedSlots = new Map<string, JSXSlotFunction>();\n let defaultSlot: JSXSlotFunction | undefined;\n if (slotsObject) {\n for (const [name, slot] of readStaticSlotObject(\n slotsObject,\n context,\n analysis\n )) {\n if (name === 'default') defaultSlot = slot;\n else namedSlots.set(name, slot);\n }\n }\n\n return {\n defaultChildren: objectSlotChild ? [] : element.children,\n ...(defaultSlot && { defaultSlot }),\n namedSlots,\n };\n}\n\nfunction readSlotsAttributeObject(\n attribute: babel.JSXAttribute,\n scope: Scope,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis,\n ownerLabel: string\n): { node: babel.ObjectExpression; scope: Scope } | undefined {\n const expression =\n attribute.value?.type === 'JSXExpressionContainer' &&\n attribute.value.expression.type !== 'JSXEmptyExpression'\n ? attribute.value.expression\n : undefined;\n const object = expression\n ? analysis.resolveStaticObject(expression, scope)\n : undefined;\n if (!object) {\n addVueError(\n context,\n babelLocation(attribute.loc),\n `Found dynamic v-slots on ${ownerLabel}`,\n 'Use a retained object literal with statically named zero-argument slot functions'\n );\n }\n return object;\n}\n\n/** Reads statically named zero-argument functions from one JSX slots object. */\nfunction readStaticSlotObject(\n object: { node: babel.ObjectExpression; scope: Scope },\n context: VueExtractionContext,\n analysis: VueJSXAnalysis\n): Map<string, JSXSlotFunction> {\n const slots = new Map<string, JSXSlotFunction>();\n for (const property of object.node.properties) {\n if (property.type === 'SpreadElement') {\n addVueError(\n context,\n babelLocation(property.loc),\n 'Found a spread in a gt-vue JSX slots object',\n 'List every static slot explicitly'\n );\n continue;\n }\n const name = readStaticObjectKey(property, object.scope, analysis);\n if (name === undefined) {\n addVueError(\n context,\n babelLocation(property.loc),\n 'Found a dynamic slot name in a gt-vue JSX slots object',\n 'Use a static string slot name'\n );\n continue;\n }\n if (slots.has(name)) {\n addVueError(\n context,\n babelLocation(property.loc),\n `Found duplicate JSX slot \"${name}\" in a gt-vue translation`,\n 'Define every slot once'\n );\n continue;\n }\n const value =\n property.type === 'ObjectMethod'\n ? property\n : unwrapExpression(property.value);\n if (\n !value ||\n (value.type !== 'ArrowFunctionExpression' &&\n value.type !== 'FunctionExpression' &&\n value.type !== 'ObjectMethod') ||\n value.params.length > 0 ||\n value.async ||\n value.generator\n ) {\n addVueError(\n context,\n babelLocation(property.loc),\n `Found a dynamic or scoped JSX slot \"${name}\" in a gt-vue translation`,\n 'Use a synchronous zero-argument function with static returned content'\n );\n continue;\n }\n slots.set(name, {\n node: value,\n scope: analysis.scopeForNode(value, object.scope),\n });\n }\n return slots;\n}\n\nfunction serializeSlotFunction(\n slot: JSXSlotFunction,\n counter: Counter,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis\n): SerializedSlotResult & { slotTruthy: boolean } {\n const returned = readStaticSlotReturn(slot);\n if (!returned) {\n addVueError(\n context,\n babelLocation(slot.node.loc),\n 'Found a JSX slot with a dynamic function body in a gt-vue translation',\n 'Return static slot content directly from the zero-argument function'\n );\n return { children: [], slotTruthy: false };\n }\n const value = unwrapExpression(returned) as babel.Expression | undefined;\n if (!value) return { children: [], slotTruthy: false };\n if (value.type !== 'ArrayExpression') {\n return {\n children: serializeExpression(\n value,\n counter,\n slot.scope,\n context,\n analysis,\n true\n ),\n ...(isUndefinedSlotChild(value, slot.scope, analysis) && {\n slotAbsent: true,\n }),\n slotTruthy: isTruthySlotChild(value, slot.scope, analysis),\n };\n }\n\n // Vue slot functions return a framework-owned array of VNode children. The\n // outer array is not itself authored content: one entry is scalar, multiple\n // entries form React's children array, and a nested array is the authored\n // array value that must retain array cardinality in the persisted wire.\n const children: SerializedJSXChild[] = [];\n const entries = value.elements.filter(\n (entry): entry is babel.Expression | babel.SpreadElement => entry !== null\n );\n for (const entry of entries) {\n if (entry.type === 'SpreadElement') {\n addVueError(\n context,\n babelLocation(entry.loc),\n 'Found a spread in a JSX slot return inside a gt-vue translation',\n 'Return a static list of slot children'\n );\n continue;\n }\n for (const child of serializeExpression(\n entry,\n counter,\n slot.scope,\n context,\n analysis,\n entries.length === 1\n )) {\n appendSerializedChild(children, child);\n }\n }\n return {\n children: entries.length > 1 ? [{ kind: 'array', children }] : children,\n ...(entries.length === 1 &&\n entries[0]!.type !== 'SpreadElement' &&\n isUndefinedSlotChild(entries[0]!, slot.scope, analysis) && {\n slotAbsent: true,\n }),\n slotTruthy:\n entries.length > 1 ||\n (entries.length === 1 &&\n entries[0]!.type !== 'SpreadElement' &&\n isTruthySlotChild(entries[0]!, slot.scope, analysis)),\n };\n}\n\n/** Matches Vue's absent named-slot result without collapsing an authored array. */\nfunction isUndefinedSlotChild(\n input: babel.Expression,\n scope: Scope,\n analysis: VueJSXAnalysis\n): boolean {\n const expression = unwrapExpression(input);\n if (!expression || expression.type === 'ArrayExpression') return false;\n const primitive = analysis.readStaticPrimitive(expression, scope);\n return primitive.ok && primitive.value === undefined;\n}\n\n/** Mirrors React's `props.children` truthiness for one normalized slot entry. */\nfunction isTruthySlotChild(\n input: babel.Expression,\n scope: Scope,\n analysis: VueJSXAnalysis\n): boolean {\n const expression = unwrapExpression(input);\n if (!expression) return false;\n if (\n expression.type === 'ArrayExpression' ||\n expression.type === 'JSXElement' ||\n expression.type === 'JSXFragment'\n ) {\n return true;\n }\n const primitive = analysis.readStaticPrimitive(expression, scope);\n return primitive.ok ? Boolean(primitive.value) : true;\n}\n\n/** Returns the expression from a slot body that contains only one return. */\nfunction readStaticSlotReturn(\n slot: JSXSlotFunction\n): babel.Expression | undefined {\n const body = slot.node.body;\n if (body.type !== 'BlockStatement') return body;\n const statements = body.body.filter(\n (statement) => statement.type !== 'EmptyStatement'\n );\n const returned =\n statements.length === 1 && statements[0]?.type === 'ReturnStatement'\n ? statements[0].argument\n : undefined;\n return returned ?? undefined;\n}\n\nfunction readStaticObjectKey(\n property: babel.ObjectMethod | babel.ObjectProperty,\n scope: Scope,\n analysis: VueJSXAnalysis\n): string | undefined {\n if (!property.computed) {\n if (property.key.type === 'Identifier') return property.key.name;\n if (\n property.key.type === 'StringLiteral' ||\n property.key.type === 'NumericLiteral'\n ) {\n return String(property.key.value);\n }\n return undefined;\n }\n const key = analysis.readStaticPrimitive(property.key, scope);\n return key.ok &&\n (typeof key.value === 'string' || typeof key.value === 'number')\n ? String(key.value)\n : undefined;\n}\n\nfunction readBranchAttributeSources(\n element: babel.JSXOpeningElement,\n component: 'Branch' | 'Plural',\n branches: Record<string, JsxChildren>,\n scope: Scope,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis\n): void {\n const seenBranchProps = new Set<string>();\n for (const attribute of element.attributes) {\n if (attribute.type !== 'JSXAttribute') continue;\n const name = readAttributeName(attribute.name);\n if (\n !isBranchPropName(name) ||\n (component === 'Plural' && !isAcceptedPluralForm(name))\n ) {\n continue;\n }\n if (seenBranchProps.has(name)) {\n addVueError(\n context,\n babelLocation(attribute.loc),\n `Found duplicate branch prop \"${name}\" on a gt-vue <${component}> component`,\n 'Pass each branch prop once so Vue JSX compiler options cannot change which value is hashed'\n );\n continue;\n }\n seenBranchProps.add(name);\n if (Object.prototype.hasOwnProperty.call(branches, name)) continue;\n const value = readJSXAttributePrimitive(attribute, scope, analysis);\n if (!value.ok) {\n if (isStaticallyNonBranchAttribute(attribute, scope)) continue;\n addVueError(\n context,\n babelLocation(attribute.loc),\n `Found dynamic branch prop \"${name}\" on a gt-vue <${component}> component`,\n 'Use a static primitive branch prop or a static named slot'\n );\n continue;\n }\n // Vue omits undefined attributes from the branch registry entirely.\n if (value.value === undefined) continue;\n branches[name] = serializeBranchAttributePrimitive(value.value);\n }\n}\n\n/**\n * Serializes one direct branch prop without applying Vue child normalization.\n *\n * Vue renders boolean and null VNode children empty, but React and gt-vue\n * preserve those direct prop values in the persisted branch wire format. The\n * shared `JsxChildren` type predates those values, so the cast stays confined\n * to this exact catalog boundary. Other primitives retain the established\n * string representation.\n */\nfunction serializeBranchAttributePrimitive(\n value: StaticPrimitive\n): JsxChildren {\n if (value === null || typeof value === 'boolean') {\n return value as unknown as JsxChildren;\n }\n return String(value);\n}\n\nfunction isBranchPropName(name: string): boolean {\n return !(\n NON_BRANCH_PROP_NAMES.has(name) ||\n name.startsWith('aria-') ||\n name.startsWith('data-') ||\n /^on[^a-z]/.test(name)\n );\n}\n\nfunction isStaticallyNonBranchAttribute(\n attribute: babel.JSXAttribute,\n scope: Scope\n): boolean {\n const expression =\n attribute.value?.type === 'JSXExpressionContainer' &&\n attribute.value.expression.type !== 'JSXEmptyExpression'\n ? unwrapExpression(attribute.value.expression)\n : undefined;\n if (!expression) return false;\n if (expression.type === 'Identifier' && expression.name === 'undefined') {\n return !scope.hasBinding('undefined');\n }\n return (\n expression.type === 'ArrayExpression' ||\n expression.type === 'ArrowFunctionExpression' ||\n expression.type === 'ClassExpression' ||\n expression.type === 'FunctionExpression' ||\n expression.type === 'JSXElement' ||\n expression.type === 'JSXFragment' ||\n expression.type === 'NewExpression' ||\n expression.type === 'ObjectExpression' ||\n expression.type === 'RegExpLiteral' ||\n (expression.type === 'UnaryExpression' && expression.operator === 'void')\n );\n}\n\nfunction hasExplicitAttribute(\n element: babel.JSXOpeningElement,\n name: string\n): boolean {\n return element.attributes.some(\n (attribute) =>\n attribute.type === 'JSXAttribute' &&\n readAttributeName(attribute.name) === name\n );\n}\n\nfunction isMeaningfulJSXChild(\n child: babel.JSXElement['children'][number]\n): boolean {\n if (child.type === 'JSXText') return normalizeJSXText(child.value) !== '';\n return !(\n child.type === 'JSXExpressionContainer' &&\n child.expression.type === 'JSXEmptyExpression'\n );\n}\n\nfunction validateVariableElement(\n element: babel.JSXElement,\n component: 'Currency' | 'DateTime' | 'Num' | 'Var',\n context: VueExtractionContext\n): void {\n if (context.validatedVariableComponents.has(element)) return;\n context.validatedVariableComponents.add(element);\n\n const explicitProps = new Set<string>();\n let hasSpread = false;\n for (const attribute of element.openingElement.attributes) {\n if (attribute.type === 'JSXSpreadAttribute') {\n hasSpread = true;\n } else {\n explicitProps.add(readAttributeName(attribute.name));\n }\n }\n if (hasSpread) {\n addVueError(\n context,\n babelLocation(element.openingElement.loc),\n `Found a spread prop on a gt-vue <${component}> component`,\n 'Pass variable component props explicitly'\n );\n }\n if (component === 'Var') {\n for (const prop of ['name', 'value']) {\n if (!explicitProps.has(prop)) continue;\n addVueError(\n context,\n babelLocation(element.openingElement.loc),\n `Found unsupported ${prop} prop on a gt-vue <Var> component`,\n 'Pass the variable as the default child of <Var>'\n );\n }\n return;\n }\n if (!explicitProps.has('value')) {\n addVueError(\n context,\n babelLocation(element.openingElement.loc),\n `Found a gt-vue <${component}> component without a value prop`,\n `Pass the runtime value through <${component} value={value} />`\n );\n }\n if (explicitProps.has('name')) {\n addVueError(\n context,\n babelLocation(element.openingElement.loc),\n `Found unsupported name prop on a gt-vue <${component}> component`,\n 'Remove name; named variables are not supported by gt-vue yet'\n );\n }\n if (hasMeaningfulChildren(element.children)) {\n addVueError(\n context,\n babelLocation(element.loc),\n `Found children on a gt-vue <${component}> component`,\n `Use only the required value prop: <${component} value={value} />`\n );\n }\n}\n\nfunction hasMeaningfulChildren(\n children: babel.JSXElement['children']\n): boolean {\n return children.some((child) => {\n if (child.type === 'JSXText') return normalizeJSXText(child.value) !== '';\n return !(\n child.type === 'JSXExpressionContainer' &&\n child.expression.type === 'JSXEmptyExpression'\n );\n });\n}\n\nfunction validateElementAttributes(\n element: babel.JSXOpeningElement,\n scope: Scope,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis\n): void {\n const seenContentProps = new Set<string>();\n for (const attribute of element.attributes) {\n if (attribute.type === 'JSXSpreadAttribute') {\n addVueError(\n context,\n babelLocation(attribute.loc),\n 'Found a spread prop inside a gt-vue <T> component in JSX',\n 'Pass props by static name so their effect on the translation source is known'\n );\n continue;\n }\n const name = readAttributeName(attribute.name);\n if (isVueJSXDirectiveName(name) && !isSlotsAttribute(attribute)) {\n addVueError(\n context,\n babelLocation(attribute.loc),\n `Found Vue JSX directive \"${name}\" inside a gt-vue <T> component`,\n 'Move the directive outside <T> so the translated VNode source stays static'\n );\n continue;\n }\n if (name === 'innerHTML' || name === 'textContent') {\n addVueError(\n context,\n babelLocation(attribute.loc),\n `Found source-shaping prop \"${name}\" inside a gt-vue <T> component`,\n 'Use static JSX children instead'\n );\n continue;\n }\n const contentProp = (\n Object.values(HTML_CONTENT_PROPS) as readonly string[]\n ).includes(name);\n if (!contentProp) continue;\n if (seenContentProps.has(name)) {\n addVueError(\n context,\n babelLocation(attribute.loc),\n `Found duplicate translatable prop \"${name}\" inside a gt-vue <T> component`,\n 'Pass each translatable element prop once so Vue JSX compiler options cannot change which value is hashed'\n );\n continue;\n }\n seenContentProps.add(name);\n const value = readJSXAttributePrimitive(attribute, scope, analysis);\n if (!value.ok) {\n addVueError(\n context,\n babelLocation(attribute.loc),\n `Found dynamic translatable prop \"${name}\" inside a gt-vue <T> component`,\n 'Use a static string for translatable element props'\n );\n }\n }\n}\n\nfunction isVueJSXDirectiveName(name: string): boolean {\n return /^v(?:-|[A-Z])/.test(name);\n}\n\nfunction readContentProps(\n element: babel.JSXOpeningElement,\n scope: Scope,\n context: VueExtractionContext,\n analysis: VueJSXAnalysis\n): GTProp {\n const data: GTProp = {};\n const entries = Object.entries(HTML_CONTENT_PROPS);\n for (const attribute of element.attributes) {\n if (attribute.type !== 'JSXAttribute') continue;\n const name = readAttributeName(attribute.name);\n const entry = entries.find(([, propName]) => propName === name);\n if (!entry) continue;\n const value = readJSXAttributePrimitive(attribute, scope, analysis);\n if (value.ok && typeof value.value === 'string') {\n (data as Record<string, unknown>)[entry[0]] = value.value;\n } else if (!value.ok) {\n // validateElementAttributes owns the single user-facing diagnostic.\n void context;\n }\n }\n return data;\n}\n\nfunction readJSXAttributePrimitive(\n attribute: babel.JSXAttribute,\n scope: Scope,\n analysis: VueJSXAnalysis\n): StaticPrimitiveResult {\n if (!attribute.value) return { ok: true, value: true };\n if (attribute.value.type === 'StringLiteral') {\n return { ok: true, value: normalizeJSXText(attribute.value.value) };\n }\n if (\n attribute.value.type !== 'JSXExpressionContainer' ||\n attribute.value.expression.type === 'JSXEmptyExpression'\n ) {\n return { ok: false };\n }\n return analysis.readStaticPrimitive(attribute.value.expression, scope);\n}\n\nfunction resolveElementIdentity(\n name: babel.JSXElement['openingElement']['name'],\n scope: Scope,\n analysis: VueJSXAnalysis\n): KnownValue | undefined {\n // Vue JSX emits intrinsic HTML and SVG names as string VNodes before it\n // consults lexical bindings, even when an import uses the same local name.\n if (isNativeElement(name)) return undefined;\n const expression = jsxNameToExpression(name);\n return expression ? analysis.resolveKnownValue(expression, scope) : undefined;\n}\n\nfunction jsxNameToExpression(\n name: babel.JSXElement['openingElement']['name']\n): babel.Expression | undefined {\n if (name.type === 'JSXIdentifier') return babel.identifier(name.name);\n if (name.type === 'JSXNamespacedName') return undefined;\n const object = jsxMemberObjectToExpression(name.object);\n return object\n ? babel.memberExpression(object, babel.identifier(name.property.name))\n : undefined;\n}\n\nfunction jsxMemberObjectToExpression(\n object: babel.JSXMemberExpression['object']\n): babel.Expression | undefined {\n if (object.type === 'JSXIdentifier') return babel.identifier(object.name);\n const parent = jsxMemberObjectToExpression(object.object);\n return parent\n ? babel.memberExpression(parent, babel.identifier(object.property.name))\n : undefined;\n}\n\nfunction isLiteralFragment(\n name: babel.JSXElement['openingElement']['name']\n): boolean {\n // Vue's JSX transforms (verified in 1.4 and 3.0) select the Fragment helper\n // before checking lexical bindings. Consequently literal `<Fragment>` is\n // semantic Fragment syntax even when source declares a same-named binding.\n return name.type === 'JSXIdentifier' && name.name === 'Fragment';\n}\n\n/** Matches Fragment spellings that create a semantic authored boundary. */\nfunction isAuthoredFragment(\n name: babel.JSXElement['openingElement']['name'],\n identity: KnownValue | undefined\n): boolean {\n return (\n isLiteralFragment(name) ||\n (identity?.type === 'vue-builtin' && identity.name === 'Fragment')\n );\n}\n\n/** Detects Fragment aliases the JSX transform compiles through component slots. */\nfunction usesFragmentComponentSlots(\n name: babel.JSXElement['openingElement']['name'],\n identity: KnownValue | undefined\n): boolean {\n return (\n identity?.type === 'vue-builtin' &&\n identity.name === 'Fragment' &&\n !isLiteralFragment(name) &&\n !(name.type === 'JSXMemberExpression' && name.property.name === 'Fragment')\n );\n}\n\n/** Detects tags whose VNode type can change with plugin `isCustomElement`. */\nfunction isUnboundNonNativeElement(\n name: babel.JSXElement['openingElement']['name'],\n scope: Scope\n): boolean {\n if (name.type === 'JSXIdentifier') {\n return (\n name.name !== 'Fragment' &&\n !isNativeElement(name) &&\n !scope.hasBinding(name.name)\n );\n }\n if (name.type === 'JSXNamespacedName') return true;\n let object = name.object;\n while (object.type === 'JSXMemberExpression') object = object.object;\n return !scope.hasBinding(object.name);\n}\n\nfunction isNativeElement(\n name: babel.JSXElement['openingElement']['name']\n): boolean {\n return (\n name.type === 'JSXIdentifier' &&\n (isHTMLTag(name.name) || isSVGTag(name.name))\n );\n}\n\n/** Proves whether a non-GT JSX tag is an element or component VNode. */\nfunction resolveOrdinaryElementShape(\n name: babel.JSXElement['openingElement']['name'],\n scope: Scope,\n analysis: VueJSXAnalysis,\n seen: Set<babel.Node>\n): OrdinaryElementShape | undefined {\n if (isNativeElement(name)) {\n return { component: false, tag: (name as babel.JSXIdentifier).name };\n }\n if (name.type === 'JSXNamespacedName') return undefined;\n if (name.type === 'JSXMemberExpression') {\n let root = name.object;\n while (root.type === 'JSXMemberExpression') root = root.object;\n const binding = scope.getBinding(root.name);\n return binding?.path.isImportSpecifier() ||\n binding?.path.isImportDefaultSpecifier() ||\n binding?.path.isImportNamespaceSpecifier()\n ? { component: true }\n : undefined;\n }\n const binding = scope.getBinding(name.name);\n if (!binding) return undefined;\n if (\n binding.path.isImportSpecifier() ||\n binding.path.isImportDefaultSpecifier() ||\n binding.path.isImportNamespaceSpecifier() ||\n binding.path.isFunctionDeclaration() ||\n binding.path.isClassDeclaration()\n ) {\n return { component: true };\n }\n const declaration = binding.path.node;\n return declaration.type === 'VariableDeclarator' && declaration.init\n ? resolveOrdinaryElementExpression(\n declaration.init,\n binding.path.scope,\n analysis,\n seen\n )\n : undefined;\n}\n\n/** Classifies a retained tag expression without executing application code. */\nfunction resolveOrdinaryElementExpression(\n input: babel.Expression,\n scope: Scope,\n analysis: VueJSXAnalysis,\n seen: Set<babel.Node>\n): OrdinaryElementShape | undefined {\n const expression = unwrapExpression(input);\n if (!expression || seen.has(expression)) return undefined;\n const nextSeen = new Set(seen);\n nextSeen.add(expression);\n\n const primitive = analysis.readStaticPrimitive(expression, scope);\n if (primitive.ok) {\n return typeof primitive.value === 'string'\n ? { component: false, tag: primitive.value }\n : undefined;\n }\n if (\n expression.type === 'ArrowFunctionExpression' ||\n expression.type === 'FunctionExpression' ||\n expression.type === 'ClassExpression' ||\n expression.type === 'ObjectExpression'\n ) {\n return { component: true };\n }\n if (expression.type === 'Identifier') {\n const binding = scope.getBinding(expression.name);\n if (!binding) return undefined;\n if (\n binding.path.isImportSpecifier() ||\n binding.path.isImportDefaultSpecifier() ||\n binding.path.isImportNamespaceSpecifier() ||\n binding.path.isFunctionDeclaration() ||\n binding.path.isClassDeclaration()\n ) {\n return { component: true };\n }\n const declaration = binding.path.node;\n return declaration.type === 'VariableDeclarator' && declaration.init\n ? resolveOrdinaryElementExpression(\n declaration.init,\n binding.path.scope,\n analysis,\n nextSeen\n )\n : undefined;\n }\n if (\n expression.type === 'CallExpression' ||\n expression.type === 'OptionalCallExpression'\n ) {\n if (expression.callee.type === 'V8IntrinsicIdentifier') return undefined;\n const callee = analysis.resolveKnownValue(expression.callee, scope);\n if (callee?.type === 'defineComponent') return { component: true };\n const argument = expression.arguments[0];\n return callee?.type === 'identity' &&\n expression.arguments.length === 1 &&\n argument &&\n argument.type !== 'SpreadElement' &&\n argument.type !== 'ArgumentPlaceholder'\n ? resolveOrdinaryElementExpression(argument, scope, analysis, nextSeen)\n : undefined;\n }\n if (expression.type === 'ConditionalExpression') {\n return mergeOrdinaryElementShapes(\n resolveOrdinaryElementExpression(\n expression.consequent,\n scope,\n analysis,\n nextSeen\n ),\n resolveOrdinaryElementExpression(\n expression.alternate,\n scope,\n analysis,\n nextSeen\n )\n );\n }\n if (expression.type === 'LogicalExpression') {\n return mergeOrdinaryElementShapes(\n resolveOrdinaryElementExpression(\n expression.left,\n scope,\n analysis,\n nextSeen\n ),\n resolveOrdinaryElementExpression(\n expression.right,\n scope,\n analysis,\n nextSeen\n )\n );\n }\n if (expression.type === 'SequenceExpression') {\n const last = expression.expressions.at(-1);\n return last\n ? resolveOrdinaryElementExpression(last, scope, analysis, nextSeen)\n : undefined;\n }\n return undefined;\n}\n\n/** Combines alternate tags only when they preserve traversal semantics. */\nfunction mergeOrdinaryElementShapes(\n left: OrdinaryElementShape | undefined,\n right: OrdinaryElementShape | undefined\n): OrdinaryElementShape | undefined {\n if (!left || !right || left.component !== right.component) return undefined;\n return {\n component: left.component,\n ...(left.tag === right.tag && left.tag !== undefined && { tag: left.tag }),\n };\n}\n\nfunction readElementDisplayName(\n name: babel.JSXElement['openingElement']['name']\n): string | undefined {\n if (name.type === 'JSXIdentifier') return name.name;\n if (name.type === 'JSXNamespacedName') return undefined;\n const object = readMemberDisplayName(name.object);\n return object ? `${object}.${name.property.name}` : undefined;\n}\n\nfunction readMemberDisplayName(\n object: babel.JSXMemberExpression['object']\n): string | undefined {\n if (object.type === 'JSXIdentifier') return object.name;\n const parent = readMemberDisplayName(object.object);\n return parent ? `${parent}.${object.property.name}` : undefined;\n}\n\nfunction readAttributeName(name: babel.JSXAttribute['name']): string {\n return name.type === 'JSXIdentifier'\n ? name.name\n : `${name.namespace.name}:${name.name.name}`;\n}\n\n/** Mirrors `@vue/babel-plugin-jsx`'s JSX text and string-prop transform. */\nfunction normalizeJSXText(text: string): string {\n const lines = text.split(/\\r\\n|\\n|\\r/);\n let lastNonEmptyLine = 0;\n for (let index = 0; index < lines.length; index += 1) {\n if (/[^ \\t]/.test(lines[index]!)) lastNonEmptyLine = index;\n }\n\n let result = '';\n for (let index = 0; index < lines.length; index += 1) {\n const isFirstLine = index === 0;\n const isLastLine = index === lines.length - 1;\n const isLastNonEmptyLine = index === lastNonEmptyLine;\n let line = lines[index]!.replace(/\\t/g, ' ');\n if (!isFirstLine) line = line.replace(/^ +/, '');\n if (!isLastLine) line = line.replace(/ +$/, '');\n if (!line) continue;\n if (!isLastNonEmptyLine) line += ' ';\n result += line;\n }\n return result;\n}\n\nfunction appendSerializedChild(\n result: SerializedJSXChild[],\n child: SerializedJSXChild\n): void {\n if (child === jsxTextBoundary) {\n if (result.at(-1) !== jsxTextBoundary) result.push(child);\n return;\n }\n // React preserves each authored child as a separate array entry, including\n // adjacent string expressions. gt-vue's runtime does the same for distinct\n // Vue Text VNodes, so merging here would change the persisted source hash.\n result.push(child);\n}\n\n/**\n * Mirrors the truthiness guard in React's `addGTIdentifier()`.\n *\n * JSX emits a scalar for one authored child and an array for multiple children.\n * Arrays are truthy even when React.Children later removes all of their values;\n * a sole primitive instead controls the guard with its original runtime value.\n */\nfunction hasTruthyJSXChildren(\n children: babel.JSXElement['children'],\n scope: Scope,\n analysis: VueJSXAnalysis\n): boolean {\n const runtimeChildren = children.filter(isJSXRuntimeChildArgument);\n if (runtimeChildren.length !== 1) return runtimeChildren.length > 1;\n\n const child = runtimeChildren[0]!;\n if (child.type === 'JSXText') {\n return Boolean(normalizeJSXText(child.value));\n }\n if (\n child.type === 'JSXElement' ||\n child.type === 'JSXFragment' ||\n child.type === 'JSXSpreadChild'\n ) {\n return true;\n }\n if (child.expression.type === 'JSXEmptyExpression') return false;\n const expression = unwrapExpression(child.expression);\n if (!expression) return false;\n if (expression.type === 'ArrayExpression') return true;\n if (expression.type === 'JSXElement' || expression.type === 'JSXFragment') {\n return true;\n }\n const primitive = analysis.readStaticPrimitive(expression, scope);\n return primitive.ok ? Boolean(primitive.value) : true;\n}\n\n/** Includes direct children or a statically selected Vue default slot. */\nfunction shouldIncludeElementChildren(\n element: babel.JSXElement,\n children: SerializedJSXChild[],\n scope: Scope,\n analysis: VueJSXAnalysis,\n slotTruthy?: boolean\n): boolean {\n if (slotTruthy !== undefined) return slotTruthy;\n return element.children.some(isJSXRuntimeChildArgument)\n ? hasTruthyJSXChildren(element.children, scope, analysis)\n : children.some(hasSerializedValue);\n}\n\nfunction hasSerializedValue(child: SerializedJSXChild): boolean {\n return child !== jsxTextBoundary;\n}\n\nfunction isSerializedJSXArray(\n child: SerializedJSXChild\n): child is SerializedJSXArray {\n return (\n child !== jsxTextBoundary &&\n typeof child === 'object' &&\n child !== null &&\n 'kind' in child &&\n child.kind === 'array'\n );\n}\n\n/** Flattens explicit nested arrays exactly as React.Children.map does. */\nfunction flattenSerializedChildren(children: SerializedJSXChild[]): JsxChild[] {\n const flattened: JsxChild[] = [];\n for (const child of children) {\n if (child === jsxTextBoundary) continue;\n if (isSerializedJSXArray(child)) {\n flattened.push(...flattenSerializedChildren(child.children));\n } else {\n flattened.push(child as JsxChild);\n }\n }\n return flattened;\n}\n\nfunction collapseChildren(children: SerializedJSXChild[]): JsxChildren {\n const structuralChildren = children.filter(\n (child) => child !== jsxTextBoundary\n );\n if (\n structuralChildren.length === 1 &&\n isSerializedJSXArray(structuralChildren[0]!)\n ) {\n return flattenSerializedChildren(structuralChildren[0]!.children);\n }\n const visibleChildren = flattenSerializedChildren(children);\n return visibleChildren.length === 1 ? visibleChildren[0]! : visibleChildren;\n}\n\n/** Distinguishes a missing T slot from an explicitly authored empty array. */\nfunction collapseRootChildren(\n children: SerializedJSXChild[]\n): JsxChildren | undefined {\n return children.some(hasSerializedValue)\n ? collapseChildren(children)\n : undefined;\n}\n"],"mappings":";;;;;;;AAgCA,MAAM,kBAAkB,OAAO,2BAA2B;AAmE1D,MAAM,mBAAmB,IAAI,IAAI,CAAC,OAAO,MAAM,CAAC;AAChD,MAAM,oBAAoB,IAAI,IAAqB;CACjD;CACA;CACA;CACD,CAAC;AACF,MAAM,wBAAwB,IAAI,IAAI;CACpC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;;;;;;;;;;;;AAaF,SAAgB,yBACd,MACA,SACA,UACM;AACN,KAAI,SAAS,cAAc;AACzB,cACE,SACA,cAAc,SAAS,aAAa,IAAI,EACxC,+DACA,wEACD;AACD;;CAEF,MAAM,aAAa,QAAQ,OAAO;CAClC,MAAM,sBAAsB,wBAC1B,KAAK,KAAK,gBACV,KAAK,OACL,SACA,SACD;CACD,MAAM,SAAS,qBACb,kBACE,KAAK,KAAK,UACV,EAAE,OAAO,GAAG,EACZ,KAAK,OACL,SACA,SACD,CACF;AACD,KAAI,QAAQ,OAAO,WAAW,WAAY;AAE1C,SAAQ,QAAQ,KAAK;EACnB,YAAY;EACZ;EACA,UAAU,qBACR,SACA,cAAc,KAAK,KAAK,IAAI,EAC5B,oBACD;EACF,CAAC;;;AAIJ,SAAgB,4BACd,MACA,UACS;CACT,IAAI,UAA2B,KAAK;AACp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AS,0BAA0B,UAA4C;CAC7E,MAAM,YAAwB,EAAE;AAChC,MAAK,MAAM,SAAS,UAAU;AAC5B,MAAI,UAAU,gBAAiB;AAC/B,MAAI,qBAAqB,MAAM,CAC7B,WAAU,KAAK,GAAG,0BAA0B,MAAM,SAAS,CAAC;MAE5D,WAAU,KAAK,MAAkB;;AAGrC,QAAO;;AAGT,SAAS,iBAAiB,UAA6C;CACrE,MAAM,qBAAqB,SAAS,QACjC,UAAU,UAAU,gBACtB;AACD,KACE,mBAAmB,WAAW,KAC9B,qBAAqB,mBAAmB,GAAI,CAE5C,QAAO,0BAA0B,mBAAmB,GAAI,SAAS;CAEnE,MAAM,kBAAkB,0BAA0B,SAAS;AAC3D,QAAO,gBAAgB,WAAW,IAAI,gBAAgB,KAAM;;;AAI9D,SAAS,qBACP,UACyB;AACzB,QAAO,SAAS,KAAK,mBAAmB,GACpC,iBAAiB,SAAS,GAC1B,KAAA"}
|
|
@@ -49,6 +49,10 @@ export type LocalExportTarget = {
|
|
|
49
49
|
originKey: string;
|
|
50
50
|
source: ExternalModuleName;
|
|
51
51
|
type: 'external-namespace';
|
|
52
|
+
} | {
|
|
53
|
+
/** A statically proven export from an official non-Vue GT runtime. */
|
|
54
|
+
originKey: string;
|
|
55
|
+
type: 'ordinary-external';
|
|
52
56
|
} | {
|
|
53
57
|
modulePath: string;
|
|
54
58
|
originKey: string;
|
|
@@ -56,7 +60,13 @@ export type LocalExportTarget = {
|
|
|
56
60
|
};
|
|
57
61
|
/** Result of resolving one named export through a local ESM graph. */
|
|
58
62
|
export type LocalExportResolution = {
|
|
59
|
-
status: 'absent' | 'ambiguous'
|
|
63
|
+
status: 'absent' | 'ambiguous';
|
|
64
|
+
} | {
|
|
65
|
+
gtExportName?: string | '*';
|
|
66
|
+
hasGTSourceReference?: boolean;
|
|
67
|
+
/** Fully resolved targets recovered from an otherwise invalid module. */
|
|
68
|
+
recoveredTargets?: LocalExportTarget[];
|
|
69
|
+
status: 'invalid';
|
|
60
70
|
} | {
|
|
61
71
|
status: 'resolved';
|
|
62
72
|
target: LocalExportTarget;
|
|
@@ -64,17 +74,28 @@ export type LocalExportResolution = {
|
|
|
64
74
|
/** Read-only local source resolver used by the Vue script analyzer. */
|
|
65
75
|
export type LocalModuleResolver = {
|
|
66
76
|
getRecord(filePath: string): LocalModuleRecord | undefined;
|
|
77
|
+
/** Returns the exact GT leaf behind an export, excluding namespace containers. */
|
|
78
|
+
getGTExportName(filePath: string, exportName: string): string | '*' | undefined;
|
|
67
79
|
/** Whether the caller supplied project-specific bare-specifier semantics. */
|
|
68
80
|
hasCustomResolver: boolean;
|
|
81
|
+
/** Whether a resolved module belongs to project source rather than an install. */
|
|
82
|
+
isProjectModule(filePath: string): boolean;
|
|
69
83
|
listExportNames(filePath: string): string[];
|
|
84
|
+
/** Whether a named export is statically connected to the gt-vue runtime. */
|
|
85
|
+
hasGTExportReference(filePath: string, exportName: string): boolean;
|
|
70
86
|
resolveExport(filePath: string, exportName: string): LocalExportResolution;
|
|
71
87
|
resolveModule(importer: string, specifier: string): string | undefined;
|
|
72
88
|
};
|
|
89
|
+
/** Package-provenance behavior that is broader than source extraction. */
|
|
90
|
+
export type LocalModuleResolverOptions = {
|
|
91
|
+
/** Includes gt-vue setup and locale APIs that extraction never calls. */
|
|
92
|
+
recognizeAllGTRuntimeExports?: boolean;
|
|
93
|
+
};
|
|
73
94
|
/**
|
|
74
95
|
* Creates a cycle-safe ESM resolver for local source files and index barrels.
|
|
75
96
|
*
|
|
76
97
|
* The resolver reads and parses source text but never imports or executes it.
|
|
77
98
|
* Bare aliases are accepted only through the caller's explicit resolver hook.
|
|
78
99
|
*/
|
|
79
|
-
export declare function createLocalModuleResolver(resolveModuleOption: VueExtractionOptions['resolveModule']): LocalModuleResolver;
|
|
100
|
+
export declare function createLocalModuleResolver(resolveModuleOption: VueExtractionOptions['resolveModule'], options?: LocalModuleResolverOptions): LocalModuleResolver;
|
|
80
101
|
export {};
|