import { SourceLocation } from '@lytjs/common-error'; declare const NodeTypes: { readonly ROOT: 0; readonly ELEMENT: 1; readonly TEXT: 2; readonly COMMENT: 3; readonly INTERPOLATION: 4; readonly ATTRIBUTE: 5; readonly DIRECTIVE: 6; readonly SIMPLE_EXPRESSION: 7; readonly COMPOUND_EXPRESSION: 8; readonly VNODE_CALL: 9; readonly JS_CALL_EXPRESSION: 10; readonly JS_OBJECT_EXPRESSION: 11; readonly JS_PROPERTY: 12; readonly JS_ARRAY_EXPRESSION: 13; readonly JS_FUNCTION_EXPRESSION: 14; readonly JS_CONDITIONAL_EXPRESSION: 15; readonly JS_CACHE_EXPRESSION: 16; }; declare const ElementTypes: { readonly ELEMENT: 0; readonly COMPONENT: 1; readonly SLOT: 2; readonly TEMPLATE: 3; }; declare const ConstantTypes: { readonly NOT_CONSTANT: 0; readonly CAN_SKIP_PATCH: 1; readonly CAN_HOIST: 2; readonly CAN_STRINGIFY: 3; }; declare const TagType: { readonly Start: 0; readonly End: 1; }; declare const TextModes: { readonly DATA: 0; readonly RCDATA: 1; readonly RAWTEXT: 2; readonly CDATA: 3; }; declare const BindingTypes: { readonly DATA: "data"; readonly PROPS: "props"; readonly SETUP: "setup"; readonly LITERAL_CONST: "literal-const"; }; declare const helperNameMap: Record; interface BaseNode { type: (typeof NodeTypes)[keyof typeof NodeTypes]; loc: SourceLocation; } interface RootNode extends BaseNode { type: typeof NodeTypes.ROOT; children: TemplateChildNode[]; helpers: string[]; components: string[]; directives: string[]; hoists: JSChildNode[]; codegenNode: JSChildNode | undefined; imports: string[]; cached: number; temps: number; ssrHelpers?: string[]; } interface ElementNode extends BaseNode { type: typeof NodeTypes.ELEMENT; ns: number; tag: string; tagType: (typeof ElementTypes)[keyof typeof ElementTypes]; isSelfClosing: boolean; props: (AttributeNode | DirectiveNode)[]; children: TemplateChildNode[]; codegenNode: VNodeCall | undefined; patchFlag: number; patchFlagForChildren?: number; dynamicChildren?: JSChildNode[]; isStatic: boolean; isBlock: boolean; ref: string | undefined; scopeId: string | undefined; slots: TemplateChildNode[] | undefined; slotScopeNodes: TemplateChildNode[]; cachedIndex?: number; onceId?: number; } interface TextNode extends BaseNode { type: typeof NodeTypes.TEXT; content: string; isStatic: boolean; } interface CommentNode extends BaseNode { type: typeof NodeTypes.COMMENT; content: string; } interface InterpolationNode extends BaseNode { type: typeof NodeTypes.INTERPOLATION; content: ExpressionNode; isStatic: boolean; } interface AttributeNode extends BaseNode { type: typeof NodeTypes.ATTRIBUTE; name: string; value: TextNode | undefined; } interface DirectiveNode extends BaseNode { type: typeof NodeTypes.DIRECTIVE; name: string; arg: ExpressionNode | undefined; exp: ExpressionNode | undefined; modifiers: string[]; } interface SimpleExpressionNode extends BaseNode { type: typeof NodeTypes.SIMPLE_EXPRESSION; content: string; isStatic: boolean; isConstant: boolean; identifiers?: string[]; } interface CompoundExpressionNode extends BaseNode { type: typeof NodeTypes.COMPOUND_EXPRESSION; children: (TemplateChildNode | SimpleExpressionNode | string)[]; identifiers?: string[]; isConstant: boolean; } interface VNodeCall extends BaseNode { type: typeof NodeTypes.VNODE_CALL; tag: string | JSChildNode; props: JSChildNode | undefined; children: JSChildNode | TemplateChildNode[] | string | undefined; patchFlag: string | number | undefined; dynamicProps: JSChildNode | undefined; directives: JSChildNode[] | undefined; isBlock: boolean; disableTracking: boolean; isComponent: boolean; } interface JSCallExpression extends BaseNode { type: typeof NodeTypes.JS_CALL_EXPRESSION; callee: string | symbol; arguments: (JSChildNode | string | TemplateChildNode | TemplateChildNode[])[]; } interface JSObjectExpression extends BaseNode { type: typeof NodeTypes.JS_OBJECT_EXPRESSION; properties: JSProperty[]; } interface JSProperty extends BaseNode { type: typeof NodeTypes.JS_PROPERTY; key: JSChildNode; value: JSChildNode; } interface JSArrayExpression extends BaseNode { type: typeof NodeTypes.JS_ARRAY_EXPRESSION; elements: JSChildNode[]; } interface JSFunctionExpression extends BaseNode { type: typeof NodeTypes.JS_FUNCTION_EXPRESSION; params: (string | JSChildNode)[]; returns: JSChildNode | TemplateChildNode | TemplateChildNode[]; body?: JSChildNode; newline: boolean; isSlot: boolean; } interface JSConditionalExpression extends BaseNode { type: typeof NodeTypes.JS_CONDITIONAL_EXPRESSION; test: JSChildNode | string; consequent: JSChildNode | TemplateChildNode | TemplateChildNode[]; alternate: JSChildNode | TemplateChildNode | TemplateChildNode[] | undefined; newline: boolean; } interface JSCacheExpression extends BaseNode { type: typeof NodeTypes.JS_CACHE_EXPRESSION; index: number; value: JSChildNode; } type JSChildNode = VNodeCall | JSCallExpression | JSObjectExpression | JSProperty | JSArrayExpression | JSFunctionExpression | JSConditionalExpression | JSCacheExpression | SimpleExpressionNode | CompoundExpressionNode; type TemplateChildNode = ElementNode | TextNode | CommentNode | InterpolationNode | SimpleExpressionNode | CompoundExpressionNode | JSChildNode; type ExpressionNode = SimpleExpressionNode | CompoundExpressionNode; type ParentNode = RootNode | ElementNode; type Property = JSProperty | { key: string; value: string; }; type NodeTransform = (node: RootNode | ElementNode | TextNode | InterpolationNode | CommentNode, context: TransformContext) => void | (() => void) | (() => void)[]; type DirectiveTransform = (dir: DirectiveNode, node: ElementNode, context: TransformContext) => DirectiveTransformResult; interface DirectiveTransformResult { props: Property[]; needRuntime?: boolean | string | symbol; } interface ParserOptions { isCustomElement?: (tag: string) => boolean; isNativeTag?: (tag: string) => boolean; getTextMode?: (tag: string, ns: number) => (typeof TextModes)[keyof typeof TextModes]; decodeEntities?: (text: string, strict: boolean) => string; onError?: (error: Error) => void; comments?: boolean; /** * 是否启用裸指令名解析("所见即所得"模式)。默认为 true。 * 设为 false 时,所有裸指令名将被视为普通 HTML 属性。 */ bareDirectives?: boolean; } interface TransformOptions { nodeTransforms?: NodeTransform[]; directiveTransforms?: Record; isBuiltInComponent?: (tag: string) => symbol | undefined; isCustomElement?: (tag: string) => boolean; expressionPlugins?: string[]; scopeId?: string | null; slotted?: boolean; ssr?: boolean; inSSR?: boolean; ssrCssVars?: string[]; bindingMetadata?: BindingMetadata; inline?: boolean; isTS?: boolean; onError?: (error: Error) => void; onWarn?: (warning: string) => void; } interface CodegenOptions { mode?: 'module' | 'function'; prefixIdentifiers?: boolean; sourceMap?: boolean; filename?: string; scopeId?: string | null; optimizeImports?: boolean; runtimeGlobalName?: string; runtimeModuleName?: string; ssrRuntimeModuleName?: string; ssr?: boolean; inSSR?: boolean; isTS?: boolean; emitStatic?: boolean; } interface CompilerOptions extends ParserOptions, TransformOptions, CodegenOptions { whitespace?: 'condense' | 'preserve'; /** 渲染模式:'vnode' 使用 VNode diff,'signal' 使用 Signal + 直接 DOM 操作,'vapor' 是 'signal' 的别名 */ rendererMode?: 'vnode' | 'signal' | 'vapor'; /** SSR 编译模式:启用后跳过客户端专用指令(v-on, v-model, v-show),生成 renderToString 格式代码 */ ssrMode?: boolean; /** * Phase 1.1: Signal 模式代码优化 * 启用后使用优化版本的代码生成器,生成更紧凑的代码 * - 短导入别名:effect -> e, setText -> x 等 * - 合并多个 effect 为单个 effect * - 更短的变量名:_div -> _0 * 默认为 true */ optimizeSignal?: boolean; } interface BindingMetadata { [key: string]: BindingMetadataValue | undefined; } type BindingMetadataValue = { type: typeof BindingTypes.DATA; declared?: boolean; } | { type: typeof BindingTypes.PROPS; declared?: boolean; } | { type: typeof BindingTypes.SETUP; declared?: boolean; } | { type: typeof BindingTypes.LITERAL_CONST; }; interface TransformContext { readonly self: TransformContext; parent: ParentNode | null; rootNode: RootNode; helpers: Map; components: Set; directives: Set; hoists: JSChildNode[]; temps: number; cached: number; identifiers: Set; scopes: { vFor: number; vOnce: number; }[]; filters?: Set; childIndex: number; __counters?: Record; helper(name: T): T; helperString(name: string): string; replaceNode(node: TemplateChildNode): void; removeNode(node: TemplateChildNode | null): void; onNodeRemoved(): void; addIdentifiers(exp: ExpressionNode | string): void; removeIdentifiers(exp: ExpressionNode | string): void; addHoist(node: JSChildNode): void; addTemp(): number; addCache(index: number): void; currentNode: RootNode | TemplateChildNode | null; error(msg: string, node?: BaseNode): void; } interface RawSourceMap { version: number; file: string; sourceRoot?: string; sources: string[]; sourcesContent: string[]; names: string[]; mappings: string; } interface CodegenResult { code: string; preamble: string; ast: RootNode; /** Source map(RawSourceMap 格式) */ map?: RawSourceMap; } export { type AttributeNode as A, type BaseNode as B, type CodegenOptions as C, type DirectiveNode as D, type ElementNode as E, type TransformOptions as F, helperNameMap as G, type InterpolationNode as I, type JSArrayExpression as J, type NodeTransform as N, type ParentNode as P, type RawSourceMap as R, type SimpleExpressionNode as S, TagType as T, type VNodeCall as V, type BindingMetadata as a, BindingTypes as b, type CodegenResult as c, type CommentNode as d, type CompilerOptions as e, type CompoundExpressionNode as f, ConstantTypes as g, type DirectiveTransform as h, type DirectiveTransformResult as i, ElementTypes as j, type ExpressionNode as k, type JSCacheExpression as l, type JSCallExpression as m, type JSChildNode as n, type JSConditionalExpression as o, type JSFunctionExpression as p, type JSObjectExpression as q, type JSProperty as r, NodeTypes as s, type ParserOptions as t, type Property as u, type RootNode as v, type TemplateChildNode as w, TextModes as x, type TextNode as y, type TransformContext as z };