source: node_modules/@vue/compiler-core/dist/compiler-core.d.ts

Last change on this file was 57e58a3, checked in by ste08 <sjovanoska@…>, 4 months ago

Initial commit

  • Property mode set to 100644
File size: 44.7 KB
Line 
1import { PatchFlags } from '@vue/shared';
2export { generateCodeFrame } from '@vue/shared';
3import { Node as Node$1, Identifier, Function, BlockStatement as BlockStatement$1, Program, ObjectProperty } from '@babel/types';
4import { ParserPlugin } from '@babel/parser';
5
6export declare const FRAGMENT: unique symbol;
7export declare const TELEPORT: unique symbol;
8export declare const SUSPENSE: unique symbol;
9export declare const KEEP_ALIVE: unique symbol;
10export declare const BASE_TRANSITION: unique symbol;
11export declare const OPEN_BLOCK: unique symbol;
12export declare const CREATE_BLOCK: unique symbol;
13export declare const CREATE_ELEMENT_BLOCK: unique symbol;
14export declare const CREATE_VNODE: unique symbol;
15export declare const CREATE_ELEMENT_VNODE: unique symbol;
16export declare const CREATE_COMMENT: unique symbol;
17export declare const CREATE_TEXT: unique symbol;
18export declare const CREATE_STATIC: unique symbol;
19export declare const RESOLVE_COMPONENT: unique symbol;
20export declare const RESOLVE_DYNAMIC_COMPONENT: unique symbol;
21export declare const RESOLVE_DIRECTIVE: unique symbol;
22export declare const RESOLVE_FILTER: unique symbol;
23export declare const WITH_DIRECTIVES: unique symbol;
24export declare const RENDER_LIST: unique symbol;
25export declare const RENDER_SLOT: unique symbol;
26export declare const CREATE_SLOTS: unique symbol;
27export declare const TO_DISPLAY_STRING: unique symbol;
28export declare const MERGE_PROPS: unique symbol;
29export declare const NORMALIZE_CLASS: unique symbol;
30export declare const NORMALIZE_STYLE: unique symbol;
31export declare const NORMALIZE_PROPS: unique symbol;
32export declare const GUARD_REACTIVE_PROPS: unique symbol;
33export declare const TO_HANDLERS: unique symbol;
34export declare const CAMELIZE: unique symbol;
35export declare const CAPITALIZE: unique symbol;
36export declare const TO_HANDLER_KEY: unique symbol;
37export declare const SET_BLOCK_TRACKING: unique symbol;
38/**
39 * @deprecated no longer needed in 3.5+ because we no longer hoist element nodes
40 * but kept for backwards compat
41 */
42export declare const PUSH_SCOPE_ID: unique symbol;
43/**
44 * @deprecated kept for backwards compat
45 */
46export declare const POP_SCOPE_ID: unique symbol;
47export declare const WITH_CTX: unique symbol;
48export declare const UNREF: unique symbol;
49export declare const IS_REF: unique symbol;
50export declare const WITH_MEMO: unique symbol;
51export declare const IS_MEMO_SAME: unique symbol;
52export declare const helperNameMap: Record<symbol, string>;
53export declare function registerRuntimeHelpers(helpers: Record<symbol, string>): void;
54
55type OptionalOptions = 'decodeEntities' | 'whitespace' | 'isNativeTag' | 'isBuiltInComponent' | 'expressionPlugins' | keyof CompilerCompatOptions;
56type MergedParserOptions = Omit<Required<ParserOptions>, OptionalOptions> & Pick<ParserOptions, OptionalOptions>;
57export declare function baseParse(input: string, options?: ParserOptions): RootNode;
58
59type CompilerCompatConfig = Partial<Record<CompilerDeprecationTypes, boolean | 'suppress-warning'>> & {
60 MODE?: 2 | 3;
61};
62interface CompilerCompatOptions {
63 compatConfig?: CompilerCompatConfig;
64}
65export declare enum CompilerDeprecationTypes {
66 COMPILER_IS_ON_ELEMENT = "COMPILER_IS_ON_ELEMENT",
67 COMPILER_V_BIND_SYNC = "COMPILER_V_BIND_SYNC",
68 COMPILER_V_BIND_OBJECT_ORDER = "COMPILER_V_BIND_OBJECT_ORDER",
69 COMPILER_V_ON_NATIVE = "COMPILER_V_ON_NATIVE",
70 COMPILER_V_IF_V_FOR_PRECEDENCE = "COMPILER_V_IF_V_FOR_PRECEDENCE",
71 COMPILER_NATIVE_TEMPLATE = "COMPILER_NATIVE_TEMPLATE",
72 COMPILER_INLINE_TEMPLATE = "COMPILER_INLINE_TEMPLATE",
73 COMPILER_FILTERS = "COMPILER_FILTERS"
74}
75export declare function checkCompatEnabled(key: CompilerDeprecationTypes, context: MergedParserOptions | TransformContext, loc: SourceLocation | null, ...args: any[]): boolean;
76export declare function warnDeprecation(key: CompilerDeprecationTypes, context: MergedParserOptions | TransformContext, loc: SourceLocation | null, ...args: any[]): void;
77
78export type NodeTransform = (node: RootNode | TemplateChildNode, context: TransformContext) => void | (() => void) | (() => void)[];
79export type DirectiveTransform = (dir: DirectiveNode, node: ElementNode, context: TransformContext, augmentor?: (ret: DirectiveTransformResult) => DirectiveTransformResult) => DirectiveTransformResult;
80interface DirectiveTransformResult {
81 props: Property[];
82 needRuntime?: boolean | symbol;
83 ssrTagParts?: TemplateLiteral['elements'];
84}
85export type StructuralDirectiveTransform = (node: ElementNode, dir: DirectiveNode, context: TransformContext) => void | (() => void);
86interface ImportItem {
87 exp: string | ExpressionNode;
88 path: string;
89}
90export interface TransformContext extends Required<Omit<TransformOptions, keyof CompilerCompatOptions>>, CompilerCompatOptions {
91 selfName: string | null;
92 root: RootNode;
93 helpers: Map<symbol, number>;
94 components: Set<string>;
95 directives: Set<string>;
96 hoists: (JSChildNode | null)[];
97 imports: ImportItem[];
98 temps: number;
99 cached: (CacheExpression | null)[];
100 identifiers: {
101 [name: string]: number | undefined;
102 };
103 scopes: {
104 vFor: number;
105 vSlot: number;
106 vPre: number;
107 vOnce: number;
108 };
109 parent: ParentNode | null;
110 grandParent: ParentNode | null;
111 childIndex: number;
112 currentNode: RootNode | TemplateChildNode | null;
113 inVOnce: boolean;
114 helper<T extends symbol>(name: T): T;
115 removeHelper<T extends symbol>(name: T): void;
116 helperString(name: symbol): string;
117 replaceNode(node: TemplateChildNode): void;
118 removeNode(node?: TemplateChildNode): void;
119 onNodeRemoved(): void;
120 addIdentifiers(exp: ExpressionNode | string): void;
121 removeIdentifiers(exp: ExpressionNode | string): void;
122 hoist(exp: string | JSChildNode | ArrayExpression): SimpleExpressionNode;
123 cache(exp: JSChildNode, isVNode?: boolean, inVOnce?: boolean): CacheExpression;
124 constantCache: WeakMap<TemplateChildNode, ConstantTypes>;
125 filters?: Set<string>;
126}
127export declare function createTransformContext(root: RootNode, { filename, prefixIdentifiers, hoistStatic, hmr, cacheHandlers, nodeTransforms, directiveTransforms, transformHoist, isBuiltInComponent, isCustomElement, expressionPlugins, scopeId, slotted, ssr, inSSR, ssrCssVars, bindingMetadata, inline, isTS, onError, onWarn, compatConfig, }: TransformOptions): TransformContext;
128export declare function transform(root: RootNode, options: TransformOptions): void;
129export declare function traverseNode(node: RootNode | TemplateChildNode, context: TransformContext): void;
130export declare function createStructuralDirectiveTransform(name: string | RegExp, fn: StructuralDirectiveTransform): NodeTransform;
131
132export declare const transformElement: NodeTransform;
133export declare function resolveComponentType(node: ComponentNode, context: TransformContext, ssr?: boolean): string | symbol | CallExpression;
134export type PropsExpression = ObjectExpression | CallExpression | ExpressionNode;
135export declare function buildProps(node: ElementNode, context: TransformContext, props: ElementNode['props'] | undefined, isComponent: boolean, isDynamicComponent: boolean, ssr?: boolean): {
136 props: PropsExpression | undefined;
137 directives: DirectiveNode[];
138 patchFlag: number;
139 dynamicPropNames: string[];
140 shouldUseBlock: boolean;
141};
142export declare function buildDirectiveArgs(dir: DirectiveNode, context: TransformContext): ArrayExpression;
143
144export type Namespace = number;
145export declare enum Namespaces {
146 HTML = 0,
147 SVG = 1,
148 MATH_ML = 2
149}
150export declare enum NodeTypes {
151 ROOT = 0,
152 ELEMENT = 1,
153 TEXT = 2,
154 COMMENT = 3,
155 SIMPLE_EXPRESSION = 4,
156 INTERPOLATION = 5,
157 ATTRIBUTE = 6,
158 DIRECTIVE = 7,
159 COMPOUND_EXPRESSION = 8,
160 IF = 9,
161 IF_BRANCH = 10,
162 FOR = 11,
163 TEXT_CALL = 12,
164 VNODE_CALL = 13,
165 JS_CALL_EXPRESSION = 14,
166 JS_OBJECT_EXPRESSION = 15,
167 JS_PROPERTY = 16,
168 JS_ARRAY_EXPRESSION = 17,
169 JS_FUNCTION_EXPRESSION = 18,
170 JS_CONDITIONAL_EXPRESSION = 19,
171 JS_CACHE_EXPRESSION = 20,
172 JS_BLOCK_STATEMENT = 21,
173 JS_TEMPLATE_LITERAL = 22,
174 JS_IF_STATEMENT = 23,
175 JS_ASSIGNMENT_EXPRESSION = 24,
176 JS_SEQUENCE_EXPRESSION = 25,
177 JS_RETURN_STATEMENT = 26
178}
179export declare enum ElementTypes {
180 ELEMENT = 0,
181 COMPONENT = 1,
182 SLOT = 2,
183 TEMPLATE = 3
184}
185export interface Node {
186 type: NodeTypes;
187 loc: SourceLocation;
188}
189export interface SourceLocation {
190 start: Position;
191 end: Position;
192 source: string;
193}
194export interface Position {
195 offset: number;
196 line: number;
197 column: number;
198}
199export type ParentNode = RootNode | ElementNode | IfBranchNode | ForNode;
200export type ExpressionNode = SimpleExpressionNode | CompoundExpressionNode;
201export type TemplateChildNode = ElementNode | InterpolationNode | CompoundExpressionNode | TextNode | CommentNode | IfNode | IfBranchNode | ForNode | TextCallNode;
202export interface RootNode extends Node {
203 type: NodeTypes.ROOT;
204 source: string;
205 children: TemplateChildNode[];
206 helpers: Set<symbol>;
207 components: string[];
208 directives: string[];
209 hoists: (JSChildNode | null)[];
210 imports: ImportItem[];
211 cached: (CacheExpression | null)[];
212 temps: number;
213 ssrHelpers?: symbol[];
214 codegenNode?: TemplateChildNode | JSChildNode | BlockStatement;
215 transformed?: boolean;
216 filters?: string[];
217}
218export type ElementNode = PlainElementNode | ComponentNode | SlotOutletNode | TemplateNode;
219export interface BaseElementNode extends Node {
220 type: NodeTypes.ELEMENT;
221 ns: Namespace;
222 tag: string;
223 tagType: ElementTypes;
224 props: Array<AttributeNode | DirectiveNode>;
225 children: TemplateChildNode[];
226 isSelfClosing?: boolean;
227 innerLoc?: SourceLocation;
228}
229export interface PlainElementNode extends BaseElementNode {
230 tagType: ElementTypes.ELEMENT;
231 codegenNode: VNodeCall | SimpleExpressionNode | CacheExpression | MemoExpression | undefined;
232 ssrCodegenNode?: TemplateLiteral;
233}
234export interface ComponentNode extends BaseElementNode {
235 tagType: ElementTypes.COMPONENT;
236 codegenNode: VNodeCall | CacheExpression | MemoExpression | undefined;
237 ssrCodegenNode?: CallExpression;
238}
239export interface SlotOutletNode extends BaseElementNode {
240 tagType: ElementTypes.SLOT;
241 codegenNode: RenderSlotCall | CacheExpression | undefined;
242 ssrCodegenNode?: CallExpression;
243}
244export interface TemplateNode extends BaseElementNode {
245 tagType: ElementTypes.TEMPLATE;
246 codegenNode: undefined;
247}
248export interface TextNode extends Node {
249 type: NodeTypes.TEXT;
250 content: string;
251}
252export interface CommentNode extends Node {
253 type: NodeTypes.COMMENT;
254 content: string;
255}
256export interface AttributeNode extends Node {
257 type: NodeTypes.ATTRIBUTE;
258 name: string;
259 nameLoc: SourceLocation;
260 value: TextNode | undefined;
261}
262export interface DirectiveNode extends Node {
263 type: NodeTypes.DIRECTIVE;
264 /**
265 * the normalized name without prefix or shorthands, e.g. "bind", "on"
266 */
267 name: string;
268 /**
269 * the raw attribute name, preserving shorthand, and including arg & modifiers
270 * this is only used during parse.
271 */
272 rawName?: string;
273 exp: ExpressionNode | undefined;
274 arg: ExpressionNode | undefined;
275 modifiers: SimpleExpressionNode[];
276 /**
277 * optional property to cache the expression parse result for v-for
278 */
279 forParseResult?: ForParseResult;
280}
281/**
282 * Static types have several levels.
283 * Higher levels implies lower levels. e.g. a node that can be stringified
284 * can always be hoisted and skipped for patch.
285 */
286export declare enum ConstantTypes {
287 NOT_CONSTANT = 0,
288 CAN_SKIP_PATCH = 1,
289 CAN_CACHE = 2,
290 CAN_STRINGIFY = 3
291}
292export interface SimpleExpressionNode extends Node {
293 type: NodeTypes.SIMPLE_EXPRESSION;
294 content: string;
295 isStatic: boolean;
296 constType: ConstantTypes;
297 /**
298 * - `null` means the expression is a simple identifier that doesn't need
299 * parsing
300 * - `false` means there was a parsing error
301 */
302 ast?: Node$1 | null | false;
303 /**
304 * Indicates this is an identifier for a hoist vnode call and points to the
305 * hoisted node.
306 */
307 hoisted?: JSChildNode;
308 /**
309 * an expression parsed as the params of a function will track
310 * the identifiers declared inside the function body.
311 */
312 identifiers?: string[];
313 isHandlerKey?: boolean;
314}
315export interface InterpolationNode extends Node {
316 type: NodeTypes.INTERPOLATION;
317 content: ExpressionNode;
318}
319export interface CompoundExpressionNode extends Node {
320 type: NodeTypes.COMPOUND_EXPRESSION;
321 /**
322 * - `null` means the expression is a simple identifier that doesn't need
323 * parsing
324 * - `false` means there was a parsing error
325 */
326 ast?: Node$1 | null | false;
327 children: (SimpleExpressionNode | CompoundExpressionNode | InterpolationNode | TextNode | string | symbol)[];
328 /**
329 * an expression parsed as the params of a function will track
330 * the identifiers declared inside the function body.
331 */
332 identifiers?: string[];
333 isHandlerKey?: boolean;
334}
335export interface IfNode extends Node {
336 type: NodeTypes.IF;
337 branches: IfBranchNode[];
338 codegenNode?: IfConditionalExpression | CacheExpression;
339}
340export interface IfBranchNode extends Node {
341 type: NodeTypes.IF_BRANCH;
342 condition: ExpressionNode | undefined;
343 children: TemplateChildNode[];
344 userKey?: AttributeNode | DirectiveNode;
345 isTemplateIf?: boolean;
346}
347export interface ForNode extends Node {
348 type: NodeTypes.FOR;
349 source: ExpressionNode;
350 valueAlias: ExpressionNode | undefined;
351 keyAlias: ExpressionNode | undefined;
352 objectIndexAlias: ExpressionNode | undefined;
353 parseResult: ForParseResult;
354 children: TemplateChildNode[];
355 codegenNode?: ForCodegenNode;
356}
357export interface ForParseResult {
358 source: ExpressionNode;
359 value: ExpressionNode | undefined;
360 key: ExpressionNode | undefined;
361 index: ExpressionNode | undefined;
362 finalized: boolean;
363}
364export interface TextCallNode extends Node {
365 type: NodeTypes.TEXT_CALL;
366 content: TextNode | InterpolationNode | CompoundExpressionNode;
367 codegenNode: CallExpression | SimpleExpressionNode;
368}
369export type TemplateTextChildNode = TextNode | InterpolationNode | CompoundExpressionNode;
370export interface VNodeCall extends Node {
371 type: NodeTypes.VNODE_CALL;
372 tag: string | symbol | CallExpression;
373 props: PropsExpression | undefined;
374 children: TemplateChildNode[] | TemplateTextChildNode | SlotsExpression | ForRenderListExpression | SimpleExpressionNode | CacheExpression | undefined;
375 patchFlag: PatchFlags | undefined;
376 dynamicProps: string | SimpleExpressionNode | undefined;
377 directives: DirectiveArguments | undefined;
378 isBlock: boolean;
379 disableTracking: boolean;
380 isComponent: boolean;
381}
382export type JSChildNode = VNodeCall | CallExpression | ObjectExpression | ArrayExpression | ExpressionNode | FunctionExpression | ConditionalExpression | CacheExpression | AssignmentExpression | SequenceExpression;
383export interface CallExpression extends Node {
384 type: NodeTypes.JS_CALL_EXPRESSION;
385 callee: string | symbol;
386 arguments: (string | symbol | JSChildNode | SSRCodegenNode | TemplateChildNode | TemplateChildNode[])[];
387}
388export interface ObjectExpression extends Node {
389 type: NodeTypes.JS_OBJECT_EXPRESSION;
390 properties: Array<Property>;
391}
392export interface Property extends Node {
393 type: NodeTypes.JS_PROPERTY;
394 key: ExpressionNode;
395 value: JSChildNode;
396}
397export interface ArrayExpression extends Node {
398 type: NodeTypes.JS_ARRAY_EXPRESSION;
399 elements: Array<string | Node>;
400}
401export interface FunctionExpression extends Node {
402 type: NodeTypes.JS_FUNCTION_EXPRESSION;
403 params: ExpressionNode | string | (ExpressionNode | string)[] | undefined;
404 returns?: TemplateChildNode | TemplateChildNode[] | JSChildNode;
405 body?: BlockStatement | IfStatement;
406 newline: boolean;
407 /**
408 * This flag is for codegen to determine whether it needs to generate the
409 * withScopeId() wrapper
410 */
411 isSlot: boolean;
412 /**
413 * __COMPAT__ only, indicates a slot function that should be excluded from
414 * the legacy $scopedSlots instance property.
415 */
416 isNonScopedSlot?: boolean;
417}
418export interface ConditionalExpression extends Node {
419 type: NodeTypes.JS_CONDITIONAL_EXPRESSION;
420 test: JSChildNode;
421 consequent: JSChildNode;
422 alternate: JSChildNode;
423 newline: boolean;
424}
425export interface CacheExpression extends Node {
426 type: NodeTypes.JS_CACHE_EXPRESSION;
427 index: number;
428 value: JSChildNode;
429 needPauseTracking: boolean;
430 inVOnce: boolean;
431 needArraySpread: boolean;
432}
433export interface MemoExpression extends CallExpression {
434 callee: typeof WITH_MEMO;
435 arguments: [ExpressionNode, MemoFactory, string, string];
436}
437interface MemoFactory extends FunctionExpression {
438 returns: BlockCodegenNode;
439}
440export type SSRCodegenNode = BlockStatement | TemplateLiteral | IfStatement | AssignmentExpression | ReturnStatement | SequenceExpression;
441export interface BlockStatement extends Node {
442 type: NodeTypes.JS_BLOCK_STATEMENT;
443 body: (JSChildNode | IfStatement)[];
444}
445export interface TemplateLiteral extends Node {
446 type: NodeTypes.JS_TEMPLATE_LITERAL;
447 elements: (string | JSChildNode)[];
448}
449export interface IfStatement extends Node {
450 type: NodeTypes.JS_IF_STATEMENT;
451 test: ExpressionNode;
452 consequent: BlockStatement;
453 alternate: IfStatement | BlockStatement | ReturnStatement | undefined;
454}
455export interface AssignmentExpression extends Node {
456 type: NodeTypes.JS_ASSIGNMENT_EXPRESSION;
457 left: SimpleExpressionNode;
458 right: JSChildNode;
459}
460export interface SequenceExpression extends Node {
461 type: NodeTypes.JS_SEQUENCE_EXPRESSION;
462 expressions: JSChildNode[];
463}
464export interface ReturnStatement extends Node {
465 type: NodeTypes.JS_RETURN_STATEMENT;
466 returns: TemplateChildNode | TemplateChildNode[] | JSChildNode;
467}
468export interface DirectiveArguments extends ArrayExpression {
469 elements: DirectiveArgumentNode[];
470}
471export interface DirectiveArgumentNode extends ArrayExpression {
472 elements: [string] | [string, ExpressionNode] | [string, ExpressionNode, ExpressionNode] | [string, ExpressionNode, ExpressionNode, ObjectExpression];
473}
474export interface RenderSlotCall extends CallExpression {
475 callee: typeof RENDER_SLOT;
476 arguments: [string, string | ExpressionNode] | [string, string | ExpressionNode, PropsExpression] | [
477 string,
478 string | ExpressionNode,
479 PropsExpression | '{}',
480 TemplateChildNode[]
481 ];
482}
483export type SlotsExpression = SlotsObjectExpression | DynamicSlotsExpression;
484export interface SlotsObjectExpression extends ObjectExpression {
485 properties: SlotsObjectProperty[];
486}
487export interface SlotsObjectProperty extends Property {
488 value: SlotFunctionExpression;
489}
490export interface SlotFunctionExpression extends FunctionExpression {
491 returns: TemplateChildNode[] | CacheExpression;
492}
493export interface DynamicSlotsExpression extends CallExpression {
494 callee: typeof CREATE_SLOTS;
495 arguments: [SlotsObjectExpression, DynamicSlotEntries];
496}
497export interface DynamicSlotEntries extends ArrayExpression {
498 elements: (ConditionalDynamicSlotNode | ListDynamicSlotNode)[];
499}
500export interface ConditionalDynamicSlotNode extends ConditionalExpression {
501 consequent: DynamicSlotNode;
502 alternate: DynamicSlotNode | SimpleExpressionNode;
503}
504export interface ListDynamicSlotNode extends CallExpression {
505 callee: typeof RENDER_LIST;
506 arguments: [ExpressionNode, ListDynamicSlotIterator];
507}
508export interface ListDynamicSlotIterator extends FunctionExpression {
509 returns: DynamicSlotNode;
510}
511export interface DynamicSlotNode extends ObjectExpression {
512 properties: [Property, DynamicSlotFnProperty];
513}
514export interface DynamicSlotFnProperty extends Property {
515 value: SlotFunctionExpression;
516}
517export type BlockCodegenNode = VNodeCall | RenderSlotCall;
518export interface IfConditionalExpression extends ConditionalExpression {
519 consequent: BlockCodegenNode | MemoExpression;
520 alternate: BlockCodegenNode | IfConditionalExpression | MemoExpression;
521}
522export interface ForCodegenNode extends VNodeCall {
523 isBlock: true;
524 tag: typeof FRAGMENT;
525 props: undefined;
526 children: ForRenderListExpression;
527 patchFlag: PatchFlags;
528 disableTracking: boolean;
529}
530export interface ForRenderListExpression extends CallExpression {
531 callee: typeof RENDER_LIST;
532 arguments: [ExpressionNode, ForIteratorExpression];
533}
534export interface ForIteratorExpression extends FunctionExpression {
535 returns?: BlockCodegenNode;
536}
537export declare const locStub: SourceLocation;
538export declare function createRoot(children: TemplateChildNode[], source?: string): RootNode;
539export declare function createVNodeCall(context: TransformContext | null, tag: VNodeCall['tag'], props?: VNodeCall['props'], children?: VNodeCall['children'], patchFlag?: VNodeCall['patchFlag'], dynamicProps?: VNodeCall['dynamicProps'], directives?: VNodeCall['directives'], isBlock?: VNodeCall['isBlock'], disableTracking?: VNodeCall['disableTracking'], isComponent?: VNodeCall['isComponent'], loc?: SourceLocation): VNodeCall;
540export declare function createArrayExpression(elements: ArrayExpression['elements'], loc?: SourceLocation): ArrayExpression;
541export declare function createObjectExpression(properties: ObjectExpression['properties'], loc?: SourceLocation): ObjectExpression;
542export declare function createObjectProperty(key: Property['key'] | string, value: Property['value']): Property;
543export declare function createSimpleExpression(content: SimpleExpressionNode['content'], isStatic?: SimpleExpressionNode['isStatic'], loc?: SourceLocation, constType?: ConstantTypes): SimpleExpressionNode;
544export declare function createInterpolation(content: InterpolationNode['content'] | string, loc: SourceLocation): InterpolationNode;
545export declare function createCompoundExpression(children: CompoundExpressionNode['children'], loc?: SourceLocation): CompoundExpressionNode;
546type InferCodegenNodeType<T> = T extends typeof RENDER_SLOT ? RenderSlotCall : CallExpression;
547export declare function createCallExpression<T extends CallExpression['callee']>(callee: T, args?: CallExpression['arguments'], loc?: SourceLocation): InferCodegenNodeType<T>;
548export declare function createFunctionExpression(params: FunctionExpression['params'], returns?: FunctionExpression['returns'], newline?: boolean, isSlot?: boolean, loc?: SourceLocation): FunctionExpression;
549export declare function createConditionalExpression(test: ConditionalExpression['test'], consequent: ConditionalExpression['consequent'], alternate: ConditionalExpression['alternate'], newline?: boolean): ConditionalExpression;
550export declare function createCacheExpression(index: number, value: JSChildNode, needPauseTracking?: boolean, inVOnce?: boolean): CacheExpression;
551export declare function createBlockStatement(body: BlockStatement['body']): BlockStatement;
552export declare function createTemplateLiteral(elements: TemplateLiteral['elements']): TemplateLiteral;
553export declare function createIfStatement(test: IfStatement['test'], consequent: IfStatement['consequent'], alternate?: IfStatement['alternate']): IfStatement;
554export declare function createAssignmentExpression(left: AssignmentExpression['left'], right: AssignmentExpression['right']): AssignmentExpression;
555export declare function createSequenceExpression(expressions: SequenceExpression['expressions']): SequenceExpression;
556export declare function createReturnStatement(returns: ReturnStatement['returns']): ReturnStatement;
557export declare function getVNodeHelper(ssr: boolean, isComponent: boolean): typeof CREATE_VNODE | typeof CREATE_ELEMENT_VNODE;
558export declare function getVNodeBlockHelper(ssr: boolean, isComponent: boolean): typeof CREATE_BLOCK | typeof CREATE_ELEMENT_BLOCK;
559export declare function convertToBlock(node: VNodeCall, { helper, removeHelper, inSSR }: TransformContext): void;
560
561export interface CompilerError extends SyntaxError {
562 code: number | string;
563 loc?: SourceLocation;
564}
565export interface CoreCompilerError extends CompilerError {
566 code: ErrorCodes;
567}
568type InferCompilerError<T> = T extends ErrorCodes ? CoreCompilerError : CompilerError;
569export declare function createCompilerError<T extends number>(code: T, loc?: SourceLocation, messages?: {
570 [code: number]: string;
571}, additionalMessage?: string): InferCompilerError<T>;
572export declare enum ErrorCodes {
573 ABRUPT_CLOSING_OF_EMPTY_COMMENT = 0,
574 CDATA_IN_HTML_CONTENT = 1,
575 DUPLICATE_ATTRIBUTE = 2,
576 END_TAG_WITH_ATTRIBUTES = 3,
577 END_TAG_WITH_TRAILING_SOLIDUS = 4,
578 EOF_BEFORE_TAG_NAME = 5,
579 EOF_IN_CDATA = 6,
580 EOF_IN_COMMENT = 7,
581 EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT = 8,
582 EOF_IN_TAG = 9,
583 INCORRECTLY_CLOSED_COMMENT = 10,
584 INCORRECTLY_OPENED_COMMENT = 11,
585 INVALID_FIRST_CHARACTER_OF_TAG_NAME = 12,
586 MISSING_ATTRIBUTE_VALUE = 13,
587 MISSING_END_TAG_NAME = 14,
588 MISSING_WHITESPACE_BETWEEN_ATTRIBUTES = 15,
589 NESTED_COMMENT = 16,
590 UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME = 17,
591 UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE = 18,
592 UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME = 19,
593 UNEXPECTED_NULL_CHARACTER = 20,
594 UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME = 21,
595 UNEXPECTED_SOLIDUS_IN_TAG = 22,
596 X_INVALID_END_TAG = 23,
597 X_MISSING_END_TAG = 24,
598 X_MISSING_INTERPOLATION_END = 25,
599 X_MISSING_DIRECTIVE_NAME = 26,
600 X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END = 27,
601 X_V_IF_NO_EXPRESSION = 28,
602 X_V_IF_SAME_KEY = 29,
603 X_V_ELSE_NO_ADJACENT_IF = 30,
604 X_V_FOR_NO_EXPRESSION = 31,
605 X_V_FOR_MALFORMED_EXPRESSION = 32,
606 X_V_FOR_TEMPLATE_KEY_PLACEMENT = 33,
607 X_V_BIND_NO_EXPRESSION = 34,
608 X_V_ON_NO_EXPRESSION = 35,
609 X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET = 36,
610 X_V_SLOT_MIXED_SLOT_USAGE = 37,
611 X_V_SLOT_DUPLICATE_SLOT_NAMES = 38,
612 X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN = 39,
613 X_V_SLOT_MISPLACED = 40,
614 X_V_MODEL_NO_EXPRESSION = 41,
615 X_V_MODEL_MALFORMED_EXPRESSION = 42,
616 X_V_MODEL_ON_SCOPE_VARIABLE = 43,
617 X_V_MODEL_ON_PROPS = 44,
618 X_INVALID_EXPRESSION = 45,
619 X_KEEP_ALIVE_INVALID_CHILDREN = 46,
620 X_PREFIX_ID_NOT_SUPPORTED = 47,
621 X_MODULE_MODE_NOT_SUPPORTED = 48,
622 X_CACHE_HANDLER_NOT_SUPPORTED = 49,
623 X_SCOPE_ID_NOT_SUPPORTED = 50,
624 X_VNODE_HOOKS = 51,
625 X_V_BIND_INVALID_SAME_NAME_ARGUMENT = 52,
626 __EXTEND_POINT__ = 53
627}
628export declare const errorMessages: Record<ErrorCodes, string>;
629
630interface ErrorHandlingOptions {
631 onWarn?: (warning: CompilerError) => void;
632 onError?: (error: CompilerError) => void;
633}
634export interface ParserOptions extends ErrorHandlingOptions, CompilerCompatOptions {
635 /**
636 * Base mode is platform agnostic and only parses HTML-like template syntax,
637 * treating all tags the same way. Specific tag parsing behavior can be
638 * configured by higher-level compilers.
639 *
640 * HTML mode adds additional logic for handling special parsing behavior in
641 * `<script>`, `<style>`,`<title>` and `<textarea>`.
642 * The logic is handled inside compiler-core for efficiency.
643 *
644 * SFC mode treats content of all root-level tags except `<template>` as plain
645 * text.
646 */
647 parseMode?: 'base' | 'html' | 'sfc';
648 /**
649 * Specify the root namespace to use when parsing a template.
650 * Defaults to `Namespaces.HTML` (0).
651 */
652 ns?: Namespaces;
653 /**
654 * e.g. platform native elements, e.g. `<div>` for browsers
655 */
656 isNativeTag?: (tag: string) => boolean;
657 /**
658 * e.g. native elements that can self-close, e.g. `<img>`, `<br>`, `<hr>`
659 */
660 isVoidTag?: (tag: string) => boolean;
661 /**
662 * e.g. elements that should preserve whitespace inside, e.g. `<pre>`
663 */
664 isPreTag?: (tag: string) => boolean;
665 /**
666 * Elements that should ignore the first newline token per parinsg spec
667 * e.g. `<textarea>` and `<pre>`
668 */
669 isIgnoreNewlineTag?: (tag: string) => boolean;
670 /**
671 * Platform-specific built-in components e.g. `<Transition>`
672 */
673 isBuiltInComponent?: (tag: string) => symbol | void;
674 /**
675 * Separate option for end users to extend the native elements list
676 */
677 isCustomElement?: (tag: string) => boolean | void;
678 /**
679 * Get tag namespace
680 */
681 getNamespace?: (tag: string, parent: ElementNode | undefined, rootNamespace: Namespace) => Namespace;
682 /**
683 * @default ['{{', '}}']
684 */
685 delimiters?: [string, string];
686 /**
687 * Whitespace handling strategy
688 * @default 'condense'
689 */
690 whitespace?: 'preserve' | 'condense';
691 /**
692 * Only used for DOM compilers that runs in the browser.
693 * In non-browser builds, this option is ignored.
694 */
695 decodeEntities?: (rawText: string, asAttr: boolean) => string;
696 /**
697 * Whether to keep comments in the templates AST.
698 * This defaults to `true` in development and `false` in production builds.
699 */
700 comments?: boolean;
701 /**
702 * Parse JavaScript expressions with Babel.
703 * @default false
704 */
705 prefixIdentifiers?: boolean;
706 /**
707 * A list of parser plugins to enable for `@babel/parser`, which is used to
708 * parse expressions in bindings and interpolations.
709 * https://babeljs.io/docs/en/next/babel-parser#plugins
710 */
711 expressionPlugins?: ParserPlugin[];
712}
713export type HoistTransform = (children: TemplateChildNode[], context: TransformContext, parent: ParentNode) => void;
714export declare enum BindingTypes {
715 /**
716 * returned from data()
717 */
718 DATA = "data",
719 /**
720 * declared as a prop
721 */
722 PROPS = "props",
723 /**
724 * a local alias of a `<script setup>` destructured prop.
725 * the original is stored in __propsAliases of the bindingMetadata object.
726 */
727 PROPS_ALIASED = "props-aliased",
728 /**
729 * a let binding (may or may not be a ref)
730 */
731 SETUP_LET = "setup-let",
732 /**
733 * a const binding that can never be a ref.
734 * these bindings don't need `unref()` calls when processed in inlined
735 * template expressions.
736 */
737 SETUP_CONST = "setup-const",
738 /**
739 * a const binding that does not need `unref()`, but may be mutated.
740 */
741 SETUP_REACTIVE_CONST = "setup-reactive-const",
742 /**
743 * a const binding that may be a ref.
744 */
745 SETUP_MAYBE_REF = "setup-maybe-ref",
746 /**
747 * bindings that are guaranteed to be refs
748 */
749 SETUP_REF = "setup-ref",
750 /**
751 * declared by other options, e.g. computed, inject
752 */
753 OPTIONS = "options",
754 /**
755 * a literal constant, e.g. 'foo', 1, true
756 */
757 LITERAL_CONST = "literal-const"
758}
759export type BindingMetadata = {
760 [key: string]: BindingTypes | undefined;
761} & {
762 __isScriptSetup?: boolean;
763 __propsAliases?: Record<string, string>;
764};
765interface SharedTransformCodegenOptions {
766 /**
767 * Transform expressions like {{ foo }} to `_ctx.foo`.
768 * If this option is false, the generated code will be wrapped in a
769 * `with (this) { ... }` block.
770 * - This is force-enabled in module mode, since modules are by default strict
771 * and cannot use `with`
772 * @default mode === 'module'
773 */
774 prefixIdentifiers?: boolean;
775 /**
776 * Control whether generate SSR-optimized render functions instead.
777 * The resulting function must be attached to the component via the
778 * `ssrRender` option instead of `render`.
779 *
780 * When compiler generates code for SSR's fallback branch, we need to set it to false:
781 * - context.ssr = false
782 *
783 * see `subTransform` in `ssrTransformComponent.ts`
784 */
785 ssr?: boolean;
786 /**
787 * Indicates whether the compiler generates code for SSR,
788 * it is always true when generating code for SSR,
789 * regardless of whether we are generating code for SSR's fallback branch,
790 * this means that when the compiler generates code for SSR's fallback branch:
791 * - context.ssr = false
792 * - context.inSSR = true
793 */
794 inSSR?: boolean;
795 /**
796 * Optional binding metadata analyzed from script - used to optimize
797 * binding access when `prefixIdentifiers` is enabled.
798 */
799 bindingMetadata?: BindingMetadata;
800 /**
801 * Compile the function for inlining inside setup().
802 * This allows the function to directly access setup() local bindings.
803 */
804 inline?: boolean;
805 /**
806 * Indicates that transforms and codegen should try to output valid TS code
807 */
808 isTS?: boolean;
809 /**
810 * Filename for source map generation.
811 * Also used for self-recursive reference in templates
812 * @default 'template.vue.html'
813 */
814 filename?: string;
815}
816export interface TransformOptions extends SharedTransformCodegenOptions, ErrorHandlingOptions, CompilerCompatOptions {
817 /**
818 * An array of node transforms to be applied to every AST node.
819 */
820 nodeTransforms?: NodeTransform[];
821 /**
822 * An object of { name: transform } to be applied to every directive attribute
823 * node found on element nodes.
824 */
825 directiveTransforms?: Record<string, DirectiveTransform | undefined>;
826 /**
827 * An optional hook to transform a node being hoisted.
828 * used by compiler-dom to turn hoisted nodes into stringified HTML vnodes.
829 * @default null
830 */
831 transformHoist?: HoistTransform | null;
832 /**
833 * If the pairing runtime provides additional built-in elements, use this to
834 * mark them as built-in so the compiler will generate component vnodes
835 * for them.
836 */
837 isBuiltInComponent?: (tag: string) => symbol | void;
838 /**
839 * Used by some transforms that expects only native elements
840 */
841 isCustomElement?: (tag: string) => boolean | void;
842 /**
843 * Transform expressions like {{ foo }} to `_ctx.foo`.
844 * If this option is false, the generated code will be wrapped in a
845 * `with (this) { ... }` block.
846 * - This is force-enabled in module mode, since modules are by default strict
847 * and cannot use `with`
848 * @default mode === 'module'
849 */
850 prefixIdentifiers?: boolean;
851 /**
852 * Cache static VNodes and props objects to `_hoisted_x` constants
853 * @default false
854 */
855 hoistStatic?: boolean;
856 /**
857 * Cache v-on handlers to avoid creating new inline functions on each render,
858 * also avoids the need for dynamically patching the handlers by wrapping it.
859 * e.g `@click="foo"` by default is compiled to `{ onClick: foo }`. With this
860 * option it's compiled to:
861 * ```js
862 * { onClick: _cache[0] || (_cache[0] = e => _ctx.foo(e)) }
863 * ```
864 * - Requires "prefixIdentifiers" to be enabled because it relies on scope
865 * analysis to determine if a handler is safe to cache.
866 * @default false
867 */
868 cacheHandlers?: boolean;
869 /**
870 * A list of parser plugins to enable for `@babel/parser`, which is used to
871 * parse expressions in bindings and interpolations.
872 * https://babeljs.io/docs/en/next/babel-parser#plugins
873 */
874 expressionPlugins?: ParserPlugin[];
875 /**
876 * SFC scoped styles ID
877 */
878 scopeId?: string | null;
879 /**
880 * Indicates this SFC template has used :slotted in its styles
881 * Defaults to `true` for backwards compatibility - SFC tooling should set it
882 * to `false` if no `:slotted` usage is detected in `<style>`
883 */
884 slotted?: boolean;
885 /**
886 * SFC `<style vars>` injection string
887 * Should already be an object expression, e.g. `{ 'xxxx-color': color }`
888 * needed to render inline CSS variables on component root
889 */
890 ssrCssVars?: string;
891 /**
892 * Whether to compile the template assuming it needs to handle HMR.
893 * Some edge cases may need to generate different code for HMR to work
894 * correctly, e.g. #6938, #7138
895 */
896 hmr?: boolean;
897}
898export interface CodegenOptions extends SharedTransformCodegenOptions {
899 /**
900 * - `module` mode will generate ES module import statements for helpers
901 * and export the render function as the default export.
902 * - `function` mode will generate a single `const { helpers... } = Vue`
903 * statement and return the render function. It expects `Vue` to be globally
904 * available (or passed by wrapping the code with an IIFE). It is meant to be
905 * used with `new Function(code)()` to generate a render function at runtime.
906 * @default 'function'
907 */
908 mode?: 'module' | 'function';
909 /**
910 * Generate source map?
911 * @default false
912 */
913 sourceMap?: boolean;
914 /**
915 * SFC scoped styles ID
916 */
917 scopeId?: string | null;
918 /**
919 * Option to optimize helper import bindings via variable assignment
920 * (only used for webpack code-split)
921 * @default false
922 */
923 optimizeImports?: boolean;
924 /**
925 * Customize where to import runtime helpers from.
926 * @default 'vue'
927 */
928 runtimeModuleName?: string;
929 /**
930 * Customize where to import ssr runtime helpers from/**
931 * @default 'vue/server-renderer'
932 */
933 ssrRuntimeModuleName?: string;
934 /**
935 * Customize the global variable name of `Vue` to get helpers from
936 * in function mode
937 * @default 'Vue'
938 */
939 runtimeGlobalName?: string;
940}
941export type CompilerOptions = ParserOptions & TransformOptions & CodegenOptions;
942
943/**
944 * The `SourceMapGenerator` type from `source-map-js` is a bit incomplete as it
945 * misses `toJSON()`. We also need to add types for internal properties which we
946 * need to access for better performance.
947 *
948 * Since TS 5.3, dts generation starts to strangely include broken triple slash
949 * references for source-map-js, so we are inlining all source map related types
950 * here to to workaround that.
951 */
952export interface CodegenSourceMapGenerator {
953 setSourceContent(sourceFile: string, sourceContent: string): void;
954 toJSON(): RawSourceMap;
955 _sources: Set<string>;
956 _names: Set<string>;
957 _mappings: {
958 add(mapping: MappingItem): void;
959 };
960}
961export interface RawSourceMap {
962 file?: string;
963 sourceRoot?: string;
964 version: string;
965 sources: string[];
966 names: string[];
967 sourcesContent?: string[];
968 mappings: string;
969}
970interface MappingItem {
971 source: string;
972 generatedLine: number;
973 generatedColumn: number;
974 originalLine: number;
975 originalColumn: number;
976 name: string | null;
977}
978type CodegenNode = TemplateChildNode | JSChildNode | SSRCodegenNode;
979export interface CodegenResult {
980 code: string;
981 preamble: string;
982 ast: RootNode;
983 map?: RawSourceMap;
984}
985export interface CodegenContext extends Omit<Required<CodegenOptions>, 'bindingMetadata' | 'inline'> {
986 source: string;
987 code: string;
988 line: number;
989 column: number;
990 offset: number;
991 indentLevel: number;
992 pure: boolean;
993 map?: CodegenSourceMapGenerator;
994 helper(key: symbol): string;
995 push(code: string, newlineIndex?: number, node?: CodegenNode): void;
996 indent(): void;
997 deindent(withoutNewLine?: boolean): void;
998 newline(): void;
999}
1000export declare function generate(ast: RootNode, options?: CodegenOptions & {
1001 onContextCreated?: (context: CodegenContext) => void;
1002}): CodegenResult;
1003
1004export type TransformPreset = [
1005 NodeTransform[],
1006 Record<string, DirectiveTransform>
1007];
1008export declare function getBaseTransformPreset(prefixIdentifiers?: boolean): TransformPreset;
1009export declare function baseCompile(source: string | RootNode, options?: CompilerOptions): CodegenResult;
1010
1011export declare const isStaticExp: (p: JSChildNode) => p is SimpleExpressionNode;
1012export declare function isCoreComponent(tag: string): symbol | void;
1013export declare const isSimpleIdentifier: (name: string) => boolean;
1014/**
1015 * Simple lexer to check if an expression is a member expression. This is
1016 * lax and only checks validity at the root level (i.e. does not validate exps
1017 * inside square brackets), but it's ok since these are only used on template
1018 * expressions and false positives are invalid expressions in the first place.
1019 */
1020export declare const isMemberExpressionBrowser: (exp: ExpressionNode) => boolean;
1021export declare const isMemberExpressionNode: (exp: ExpressionNode, context: TransformContext) => boolean;
1022export declare const isMemberExpression: (exp: ExpressionNode, context: TransformContext) => boolean;
1023export declare const isFnExpressionBrowser: (exp: ExpressionNode) => boolean;
1024export declare const isFnExpressionNode: (exp: ExpressionNode, context: TransformContext) => boolean;
1025export declare const isFnExpression: (exp: ExpressionNode, context: TransformContext) => boolean;
1026export declare function advancePositionWithClone(pos: Position, source: string, numberOfCharacters?: number): Position;
1027export declare function advancePositionWithMutation(pos: Position, source: string, numberOfCharacters?: number): Position;
1028export declare function assert(condition: boolean, msg?: string): void;
1029export declare function findDir(node: ElementNode, name: string | RegExp, allowEmpty?: boolean): DirectiveNode | undefined;
1030export declare function findProp(node: ElementNode, name: string, dynamicOnly?: boolean, allowEmpty?: boolean): ElementNode['props'][0] | undefined;
1031export declare function isStaticArgOf(arg: DirectiveNode['arg'], name: string): boolean;
1032export declare function hasDynamicKeyVBind(node: ElementNode): boolean;
1033export declare function isText(node: TemplateChildNode): node is TextNode | InterpolationNode;
1034export declare function isVSlot(p: ElementNode['props'][0]): p is DirectiveNode;
1035export declare function isTemplateNode(node: RootNode | TemplateChildNode): node is TemplateNode;
1036export declare function isSlotOutlet(node: RootNode | TemplateChildNode): node is SlotOutletNode;
1037export declare function injectProp(node: VNodeCall | RenderSlotCall, prop: Property, context: TransformContext): void;
1038export declare function toValidAssetId(name: string, type: 'component' | 'directive' | 'filter'): string;
1039export declare function hasScopeRef(node: TemplateChildNode | IfBranchNode | ExpressionNode | CacheExpression | undefined, ids: TransformContext['identifiers']): boolean;
1040export declare function getMemoedVNodeCall(node: BlockCodegenNode | MemoExpression): VNodeCall | RenderSlotCall;
1041export declare const forAliasRE: RegExp;
1042
1043/**
1044 * Return value indicates whether the AST walked can be a constant
1045 */
1046export declare function walkIdentifiers(root: Node$1, onIdentifier: (node: Identifier, parent: Node$1 | null, parentStack: Node$1[], isReference: boolean, isLocal: boolean) => void, includeAll?: boolean, parentStack?: Node$1[], knownIds?: Record<string, number>): void;
1047export declare function isReferencedIdentifier(id: Identifier, parent: Node$1 | null, parentStack: Node$1[]): boolean;
1048export declare function isInDestructureAssignment(parent: Node$1, parentStack: Node$1[]): boolean;
1049export declare function isInNewExpression(parentStack: Node$1[]): boolean;
1050export declare function walkFunctionParams(node: Function, onIdent: (id: Identifier) => void): void;
1051export declare function walkBlockDeclarations(block: BlockStatement$1 | Program, onIdent: (node: Identifier) => void): void;
1052export declare function extractIdentifiers(param: Node$1, nodes?: Identifier[]): Identifier[];
1053export declare const isFunctionType: (node: Node$1) => node is Function;
1054export declare const isStaticProperty: (node: Node$1) => node is ObjectProperty;
1055export declare const isStaticPropertyKey: (node: Node$1, parent: Node$1) => boolean;
1056export declare const TS_NODE_TYPES: string[];
1057export declare function unwrapTSNode(node: Node$1): Node$1;
1058
1059export declare const transformModel: DirectiveTransform;
1060
1061export declare const transformOn: DirectiveTransform;
1062
1063export declare const transformBind: DirectiveTransform;
1064
1065export declare const noopDirectiveTransform: DirectiveTransform;
1066
1067export declare function processIf(node: ElementNode, dir: DirectiveNode, context: TransformContext, processCodegen?: (node: IfNode, branch: IfBranchNode, isRoot: boolean) => (() => void) | undefined): (() => void) | undefined;
1068
1069export declare function processFor(node: ElementNode, dir: DirectiveNode, context: TransformContext, processCodegen?: (forNode: ForNode) => (() => void) | undefined): (() => void) | undefined;
1070export declare function createForLoopParams({ value, key, index }: ForParseResult, memoArgs?: ExpressionNode[]): ExpressionNode[];
1071
1072export declare const transformExpression: NodeTransform;
1073export declare function processExpression(node: SimpleExpressionNode, context: TransformContext, asParams?: boolean, asRawStatements?: boolean, localVars?: Record<string, number>): ExpressionNode;
1074export declare function stringifyExpression(exp: ExpressionNode | string): string;
1075
1076export declare const trackSlotScopes: NodeTransform;
1077export declare const trackVForSlotScopes: NodeTransform;
1078export type SlotFnBuilder = (slotProps: ExpressionNode | undefined, vFor: DirectiveNode | undefined, slotChildren: TemplateChildNode[], loc: SourceLocation) => FunctionExpression;
1079export declare function buildSlots(node: ElementNode, context: TransformContext, buildSlotFn?: SlotFnBuilder): {
1080 slots: SlotsExpression;
1081 hasDynamicSlots: boolean;
1082};
1083
1084interface SlotOutletProcessResult {
1085 slotName: string | ExpressionNode;
1086 slotProps: PropsExpression | undefined;
1087}
1088export declare function processSlotOutlet(node: SlotOutletNode, context: TransformContext): SlotOutletProcessResult;
1089
1090export declare function getConstantType(node: TemplateChildNode | SimpleExpressionNode | CacheExpression, context: TransformContext): ConstantTypes;
1091
Note: See TracBrowser for help on using the repository browser.