@vue/compiler-core 3.3.0-alpha.1 → 3.3.0-alpha.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,18 +1,18 @@
1
1
  import { ParserPlugin } from '@babel/parser';
2
- import { RawSourceMap, SourceMapGenerator } from 'source-map';
2
+ import { RawSourceMap, SourceMapGenerator } from 'source-map-js';
3
3
  import { Node as Node$1, Identifier, Function, BlockStatement as BlockStatement$1, Program, ObjectProperty } from '@babel/types';
4
4
  export { generateCodeFrame } from '@vue/shared';
5
5
 
6
- export type OptionalOptions = 'whitespace' | 'isNativeTag' | 'isBuiltInComponent' | keyof CompilerCompatOptions;
7
- export type MergedParserOptions = Omit<Required<ParserOptions>, OptionalOptions> & Pick<ParserOptions, OptionalOptions>;
8
- declare const enum TextModes {
6
+ type OptionalOptions = 'whitespace' | 'isNativeTag' | 'isBuiltInComponent' | keyof CompilerCompatOptions;
7
+ type MergedParserOptions = Omit<Required<ParserOptions>, OptionalOptions> & Pick<ParserOptions, OptionalOptions>;
8
+ export declare const enum TextModes {
9
9
  DATA = 0,
10
10
  RCDATA = 1,
11
11
  RAWTEXT = 2,
12
12
  CDATA = 3,
13
13
  ATTRIBUTE_VALUE = 4
14
14
  }
15
- export interface ParserContext {
15
+ interface ParserContext {
16
16
  options: MergedParserOptions;
17
17
  readonly originalSource: string;
18
18
  source: string;
@@ -23,15 +23,15 @@ export interface ParserContext {
23
23
  inVPre: boolean;
24
24
  onWarn: NonNullable<ErrorHandlingOptions['onWarn']>;
25
25
  }
26
- declare function baseParse(content: string, options?: ParserOptions): RootNode;
26
+ export declare function baseParse(content: string, options?: ParserOptions): RootNode;
27
27
 
28
- export type CompilerCompatConfig = Partial<Record<CompilerDeprecationTypes, boolean | 'suppress-warning'>> & {
28
+ type CompilerCompatConfig = Partial<Record<CompilerDeprecationTypes, boolean | 'suppress-warning'>> & {
29
29
  MODE?: 2 | 3;
30
30
  };
31
- export interface CompilerCompatOptions {
31
+ interface CompilerCompatOptions {
32
32
  compatConfig?: CompilerCompatConfig;
33
33
  }
34
- declare const enum CompilerDeprecationTypes {
34
+ export declare const enum CompilerDeprecationTypes {
35
35
  COMPILER_IS_ON_ELEMENT = "COMPILER_IS_ON_ELEMENT",
36
36
  COMPILER_V_BIND_SYNC = "COMPILER_V_BIND_SYNC",
37
37
  COMPILER_V_BIND_PROP = "COMPILER_V_BIND_PROP",
@@ -42,18 +42,18 @@ declare const enum CompilerDeprecationTypes {
42
42
  COMPILER_INLINE_TEMPLATE = "COMPILER_INLINE_TEMPLATE",
43
43
  COMPILER_FILTERS = "COMPILER_FILTER"
44
44
  }
45
- declare function checkCompatEnabled(key: CompilerDeprecationTypes, context: ParserContext | TransformContext, loc: SourceLocation | null, ...args: any[]): boolean;
46
- declare function warnDeprecation(key: CompilerDeprecationTypes, context: ParserContext | TransformContext, loc: SourceLocation | null, ...args: any[]): void;
45
+ export declare function checkCompatEnabled(key: CompilerDeprecationTypes, context: ParserContext | TransformContext, loc: SourceLocation | null, ...args: any[]): boolean;
46
+ export declare function warnDeprecation(key: CompilerDeprecationTypes, context: ParserContext | TransformContext, loc: SourceLocation | null, ...args: any[]): void;
47
47
 
48
48
  export type NodeTransform = (node: RootNode | TemplateChildNode, context: TransformContext) => void | (() => void) | (() => void)[];
49
49
  export type DirectiveTransform = (dir: DirectiveNode, node: ElementNode, context: TransformContext, augmentor?: (ret: DirectiveTransformResult) => DirectiveTransformResult) => DirectiveTransformResult;
50
- export interface DirectiveTransformResult {
50
+ interface DirectiveTransformResult {
51
51
  props: Property[];
52
52
  needRuntime?: boolean | symbol;
53
53
  ssrTagParts?: TemplateLiteral['elements'];
54
54
  }
55
55
  export type StructuralDirectiveTransform = (node: ElementNode, dir: DirectiveNode, context: TransformContext) => void | (() => void);
56
- export interface ImportItem {
56
+ interface ImportItem {
57
57
  exp: string | ExpressionNode;
58
58
  path: string;
59
59
  }
@@ -93,79 +93,79 @@ export interface TransformContext extends Required<Omit<TransformOptions, 'filen
93
93
  constantCache: Map<TemplateChildNode, ConstantTypes>;
94
94
  filters?: Set<string>;
95
95
  }
96
- declare function createTransformContext(root: RootNode, { filename, prefixIdentifiers, hoistStatic, cacheHandlers, nodeTransforms, directiveTransforms, transformHoist, isBuiltInComponent, isCustomElement, expressionPlugins, scopeId, slotted, ssr, inSSR, ssrCssVars, bindingMetadata, inline, isTS, onError, onWarn, compatConfig }: TransformOptions): TransformContext;
97
- declare function transform(root: RootNode, options: TransformOptions): void;
98
- declare function traverseNode(node: RootNode | TemplateChildNode, context: TransformContext): void;
99
- declare function createStructuralDirectiveTransform(name: string | RegExp, fn: StructuralDirectiveTransform): NodeTransform;
96
+ export declare function createTransformContext(root: RootNode, { filename, prefixIdentifiers, hoistStatic, cacheHandlers, nodeTransforms, directiveTransforms, transformHoist, isBuiltInComponent, isCustomElement, expressionPlugins, scopeId, slotted, ssr, inSSR, ssrCssVars, bindingMetadata, inline, isTS, onError, onWarn, compatConfig }: TransformOptions): TransformContext;
97
+ export declare function transform(root: RootNode, options: TransformOptions): void;
98
+ export declare function traverseNode(node: RootNode | TemplateChildNode, context: TransformContext): void;
99
+ export declare function createStructuralDirectiveTransform(name: string | RegExp, fn: StructuralDirectiveTransform): NodeTransform;
100
100
 
101
- declare function processFor(node: ElementNode, dir: DirectiveNode, context: TransformContext, processCodegen?: (forNode: ForNode) => (() => void) | undefined): (() => void) | undefined;
102
- export interface ForParseResult {
101
+ export declare function processFor(node: ElementNode, dir: DirectiveNode, context: TransformContext, processCodegen?: (forNode: ForNode) => (() => void) | undefined): (() => void) | undefined;
102
+ interface ForParseResult {
103
103
  source: ExpressionNode;
104
104
  value: ExpressionNode | undefined;
105
105
  key: ExpressionNode | undefined;
106
106
  index: ExpressionNode | undefined;
107
107
  }
108
- declare function createForLoopParams({ value, key, index }: ForParseResult, memoArgs?: ExpressionNode[]): ExpressionNode[];
108
+ export declare function createForLoopParams({ value, key, index }: ForParseResult, memoArgs?: ExpressionNode[]): ExpressionNode[];
109
109
 
110
- declare const FRAGMENT: unique symbol;
111
- declare const TELEPORT: unique symbol;
112
- declare const SUSPENSE: unique symbol;
113
- declare const KEEP_ALIVE: unique symbol;
114
- declare const BASE_TRANSITION: unique symbol;
115
- declare const OPEN_BLOCK: unique symbol;
116
- declare const CREATE_BLOCK: unique symbol;
117
- declare const CREATE_ELEMENT_BLOCK: unique symbol;
118
- declare const CREATE_VNODE: unique symbol;
119
- declare const CREATE_ELEMENT_VNODE: unique symbol;
120
- declare const CREATE_COMMENT: unique symbol;
121
- declare const CREATE_TEXT: unique symbol;
122
- declare const CREATE_STATIC: unique symbol;
123
- declare const RESOLVE_COMPONENT: unique symbol;
124
- declare const RESOLVE_DYNAMIC_COMPONENT: unique symbol;
125
- declare const RESOLVE_DIRECTIVE: unique symbol;
126
- declare const RESOLVE_FILTER: unique symbol;
127
- declare const WITH_DIRECTIVES: unique symbol;
128
- declare const RENDER_LIST: unique symbol;
129
- declare const RENDER_SLOT: unique symbol;
130
- declare const CREATE_SLOTS: unique symbol;
131
- declare const TO_DISPLAY_STRING: unique symbol;
132
- declare const MERGE_PROPS: unique symbol;
133
- declare const NORMALIZE_CLASS: unique symbol;
134
- declare const NORMALIZE_STYLE: unique symbol;
135
- declare const NORMALIZE_PROPS: unique symbol;
136
- declare const GUARD_REACTIVE_PROPS: unique symbol;
137
- declare const TO_HANDLERS: unique symbol;
138
- declare const CAMELIZE: unique symbol;
139
- declare const CAPITALIZE: unique symbol;
140
- declare const TO_HANDLER_KEY: unique symbol;
141
- declare const SET_BLOCK_TRACKING: unique symbol;
142
- declare const PUSH_SCOPE_ID: unique symbol;
143
- declare const POP_SCOPE_ID: unique symbol;
144
- declare const WITH_CTX: unique symbol;
145
- declare const UNREF: unique symbol;
146
- declare const IS_REF: unique symbol;
147
- declare const WITH_MEMO: unique symbol;
148
- declare const IS_MEMO_SAME: unique symbol;
149
- declare const helperNameMap: Record<symbol, string>;
150
- declare function registerRuntimeHelpers(helpers: Record<symbol, string>): void;
110
+ export declare const FRAGMENT: unique symbol;
111
+ export declare const TELEPORT: unique symbol;
112
+ export declare const SUSPENSE: unique symbol;
113
+ export declare const KEEP_ALIVE: unique symbol;
114
+ export declare const BASE_TRANSITION: unique symbol;
115
+ export declare const OPEN_BLOCK: unique symbol;
116
+ export declare const CREATE_BLOCK: unique symbol;
117
+ export declare const CREATE_ELEMENT_BLOCK: unique symbol;
118
+ export declare const CREATE_VNODE: unique symbol;
119
+ export declare const CREATE_ELEMENT_VNODE: unique symbol;
120
+ export declare const CREATE_COMMENT: unique symbol;
121
+ export declare const CREATE_TEXT: unique symbol;
122
+ export declare const CREATE_STATIC: unique symbol;
123
+ export declare const RESOLVE_COMPONENT: unique symbol;
124
+ export declare const RESOLVE_DYNAMIC_COMPONENT: unique symbol;
125
+ export declare const RESOLVE_DIRECTIVE: unique symbol;
126
+ export declare const RESOLVE_FILTER: unique symbol;
127
+ export declare const WITH_DIRECTIVES: unique symbol;
128
+ export declare const RENDER_LIST: unique symbol;
129
+ export declare const RENDER_SLOT: unique symbol;
130
+ export declare const CREATE_SLOTS: unique symbol;
131
+ export declare const TO_DISPLAY_STRING: unique symbol;
132
+ export declare const MERGE_PROPS: unique symbol;
133
+ export declare const NORMALIZE_CLASS: unique symbol;
134
+ export declare const NORMALIZE_STYLE: unique symbol;
135
+ export declare const NORMALIZE_PROPS: unique symbol;
136
+ export declare const GUARD_REACTIVE_PROPS: unique symbol;
137
+ export declare const TO_HANDLERS: unique symbol;
138
+ export declare const CAMELIZE: unique symbol;
139
+ export declare const CAPITALIZE: unique symbol;
140
+ export declare const TO_HANDLER_KEY: unique symbol;
141
+ export declare const SET_BLOCK_TRACKING: unique symbol;
142
+ export declare const PUSH_SCOPE_ID: unique symbol;
143
+ export declare const POP_SCOPE_ID: unique symbol;
144
+ export declare const WITH_CTX: unique symbol;
145
+ export declare const UNREF: unique symbol;
146
+ export declare const IS_REF: unique symbol;
147
+ export declare const WITH_MEMO: unique symbol;
148
+ export declare const IS_MEMO_SAME: unique symbol;
149
+ export declare const helperNameMap: Record<symbol, string>;
150
+ export declare function registerRuntimeHelpers(helpers: Record<symbol, string>): void;
151
151
 
152
- declare const transformElement: NodeTransform;
153
- declare function resolveComponentType(node: ComponentNode, context: TransformContext, ssr?: boolean): string | symbol | CallExpression;
152
+ export declare const transformElement: NodeTransform;
153
+ export declare function resolveComponentType(node: ComponentNode, context: TransformContext, ssr?: boolean): string | symbol | CallExpression;
154
154
  export type PropsExpression = ObjectExpression | CallExpression | ExpressionNode;
155
- declare function buildProps(node: ElementNode, context: TransformContext, props: (DirectiveNode | AttributeNode)[] | undefined, isComponent: boolean, isDynamicComponent: boolean, ssr?: boolean): {
155
+ export declare function buildProps(node: ElementNode, context: TransformContext, props: (DirectiveNode | AttributeNode)[] | undefined, isComponent: boolean, isDynamicComponent: boolean, ssr?: boolean): {
156
156
  props: PropsExpression | undefined;
157
157
  directives: DirectiveNode[];
158
158
  patchFlag: number;
159
159
  dynamicPropNames: string[];
160
160
  shouldUseBlock: boolean;
161
161
  };
162
- declare function buildDirectiveArgs(dir: DirectiveNode, context: TransformContext): ArrayExpression;
162
+ export declare function buildDirectiveArgs(dir: DirectiveNode, context: TransformContext): ArrayExpression;
163
163
 
164
164
  export type Namespace = number;
165
- declare const enum Namespaces {
165
+ export declare const enum Namespaces {
166
166
  HTML = 0
167
167
  }
168
- declare const enum NodeTypes {
168
+ export declare const enum NodeTypes {
169
169
  ROOT = 0,
170
170
  ELEMENT = 1,
171
171
  TEXT = 2,
@@ -194,7 +194,7 @@ declare const enum NodeTypes {
194
194
  JS_SEQUENCE_EXPRESSION = 25,
195
195
  JS_RETURN_STATEMENT = 26
196
196
  }
197
- declare const enum ElementTypes {
197
+ export declare const enum ElementTypes {
198
198
  ELEMENT = 0,
199
199
  COMPONENT = 1,
200
200
  SLOT = 2,
@@ -289,7 +289,7 @@ export interface DirectiveNode extends Node {
289
289
  * Higher levels implies lower levels. e.g. a node that can be stringified
290
290
  * can always be hoisted and skipped for patch.
291
291
  */
292
- declare const enum ConstantTypes {
292
+ export declare const enum ConstantTypes {
293
293
  NOT_CONSTANT = 0,
294
294
  CAN_SKIP_PATCH = 1,
295
295
  CAN_HOIST = 2,
@@ -419,7 +419,7 @@ export interface MemoExpression extends CallExpression {
419
419
  callee: typeof WITH_MEMO;
420
420
  arguments: [ExpressionNode, MemoFactory, string, string];
421
421
  }
422
- export interface MemoFactory extends FunctionExpression {
422
+ interface MemoFactory extends FunctionExpression {
423
423
  returns: BlockCodegenNode;
424
424
  }
425
425
  export type SSRCodegenNode = BlockStatement | TemplateLiteral | IfStatement | AssignmentExpression | ReturnStatement | SequenceExpression;
@@ -519,26 +519,29 @@ export interface ForRenderListExpression extends CallExpression {
519
519
  export interface ForIteratorExpression extends FunctionExpression {
520
520
  returns: BlockCodegenNode;
521
521
  }
522
- declare const locStub: SourceLocation;
523
- declare function createRoot(children: TemplateChildNode[], loc?: SourceLocation): RootNode;
524
- 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;
525
- declare function createArrayExpression(elements: ArrayExpression['elements'], loc?: SourceLocation): ArrayExpression;
526
- declare function createObjectExpression(properties: ObjectExpression['properties'], loc?: SourceLocation): ObjectExpression;
527
- declare function createObjectProperty(key: Property['key'] | string, value: Property['value']): Property;
528
- declare function createSimpleExpression(content: SimpleExpressionNode['content'], isStatic?: SimpleExpressionNode['isStatic'], loc?: SourceLocation, constType?: ConstantTypes): SimpleExpressionNode;
529
- declare function createInterpolation(content: InterpolationNode['content'] | string, loc: SourceLocation): InterpolationNode;
530
- declare function createCompoundExpression(children: CompoundExpressionNode['children'], loc?: SourceLocation): CompoundExpressionNode;
531
- export type InferCodegenNodeType<T> = T extends typeof RENDER_SLOT ? RenderSlotCall : CallExpression;
532
- declare function createCallExpression<T extends CallExpression['callee']>(callee: T, args?: CallExpression['arguments'], loc?: SourceLocation): InferCodegenNodeType<T>;
533
- declare function createFunctionExpression(params: FunctionExpression['params'], returns?: FunctionExpression['returns'], newline?: boolean, isSlot?: boolean, loc?: SourceLocation): FunctionExpression;
534
- declare function createConditionalExpression(test: ConditionalExpression['test'], consequent: ConditionalExpression['consequent'], alternate: ConditionalExpression['alternate'], newline?: boolean): ConditionalExpression;
535
- declare function createCacheExpression(index: number, value: JSChildNode, isVNode?: boolean): CacheExpression;
536
- declare function createBlockStatement(body: BlockStatement['body']): BlockStatement;
537
- declare function createTemplateLiteral(elements: TemplateLiteral['elements']): TemplateLiteral;
538
- declare function createIfStatement(test: IfStatement['test'], consequent: IfStatement['consequent'], alternate?: IfStatement['alternate']): IfStatement;
539
- declare function createAssignmentExpression(left: AssignmentExpression['left'], right: AssignmentExpression['right']): AssignmentExpression;
540
- declare function createSequenceExpression(expressions: SequenceExpression['expressions']): SequenceExpression;
541
- declare function createReturnStatement(returns: ReturnStatement['returns']): ReturnStatement;
522
+ export declare const locStub: SourceLocation;
523
+ export declare function createRoot(children: TemplateChildNode[], loc?: SourceLocation): RootNode;
524
+ export 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;
525
+ export declare function createArrayExpression(elements: ArrayExpression['elements'], loc?: SourceLocation): ArrayExpression;
526
+ export declare function createObjectExpression(properties: ObjectExpression['properties'], loc?: SourceLocation): ObjectExpression;
527
+ export declare function createObjectProperty(key: Property['key'] | string, value: Property['value']): Property;
528
+ export declare function createSimpleExpression(content: SimpleExpressionNode['content'], isStatic?: SimpleExpressionNode['isStatic'], loc?: SourceLocation, constType?: ConstantTypes): SimpleExpressionNode;
529
+ export declare function createInterpolation(content: InterpolationNode['content'] | string, loc: SourceLocation): InterpolationNode;
530
+ export declare function createCompoundExpression(children: CompoundExpressionNode['children'], loc?: SourceLocation): CompoundExpressionNode;
531
+ type InferCodegenNodeType<T> = T extends typeof RENDER_SLOT ? RenderSlotCall : CallExpression;
532
+ export declare function createCallExpression<T extends CallExpression['callee']>(callee: T, args?: CallExpression['arguments'], loc?: SourceLocation): InferCodegenNodeType<T>;
533
+ export declare function createFunctionExpression(params: FunctionExpression['params'], returns?: FunctionExpression['returns'], newline?: boolean, isSlot?: boolean, loc?: SourceLocation): FunctionExpression;
534
+ export declare function createConditionalExpression(test: ConditionalExpression['test'], consequent: ConditionalExpression['consequent'], alternate: ConditionalExpression['alternate'], newline?: boolean): ConditionalExpression;
535
+ export declare function createCacheExpression(index: number, value: JSChildNode, isVNode?: boolean): CacheExpression;
536
+ export declare function createBlockStatement(body: BlockStatement['body']): BlockStatement;
537
+ export declare function createTemplateLiteral(elements: TemplateLiteral['elements']): TemplateLiteral;
538
+ export declare function createIfStatement(test: IfStatement['test'], consequent: IfStatement['consequent'], alternate?: IfStatement['alternate']): IfStatement;
539
+ export declare function createAssignmentExpression(left: AssignmentExpression['left'], right: AssignmentExpression['right']): AssignmentExpression;
540
+ export declare function createSequenceExpression(expressions: SequenceExpression['expressions']): SequenceExpression;
541
+ export declare function createReturnStatement(returns: ReturnStatement['returns']): ReturnStatement;
542
+ export declare function getVNodeHelper(ssr: boolean, isComponent: boolean): typeof CREATE_VNODE | typeof CREATE_ELEMENT_VNODE;
543
+ export declare function getVNodeBlockHelper(ssr: boolean, isComponent: boolean): typeof CREATE_BLOCK | typeof CREATE_ELEMENT_BLOCK;
544
+ export declare function convertToBlock(node: VNodeCall, { helper, removeHelper, inSSR }: TransformContext): void;
542
545
 
543
546
  export interface CompilerError extends SyntaxError {
544
547
  code: number | string;
@@ -547,11 +550,11 @@ export interface CompilerError extends SyntaxError {
547
550
  export interface CoreCompilerError extends CompilerError {
548
551
  code: ErrorCodes;
549
552
  }
550
- export type InferCompilerError<T> = T extends ErrorCodes ? CoreCompilerError : CompilerError;
551
- declare function createCompilerError<T extends number>(code: T, loc?: SourceLocation, messages?: {
553
+ type InferCompilerError<T> = T extends ErrorCodes ? CoreCompilerError : CompilerError;
554
+ export declare function createCompilerError<T extends number>(code: T, loc?: SourceLocation, messages?: {
552
555
  [code: number]: string;
553
556
  }, additionalMessage?: string): InferCompilerError<T>;
554
- declare const enum ErrorCodes {
557
+ export declare const enum ErrorCodes {
555
558
  ABRUPT_CLOSING_OF_EMPTY_COMMENT = 0,
556
559
  CDATA_IN_HTML_CONTENT = 1,
557
560
  DUPLICATE_ATTRIBUTE = 2,
@@ -606,7 +609,7 @@ declare const enum ErrorCodes {
606
609
  __EXTEND_POINT__ = 51
607
610
  }
608
611
 
609
- export interface ErrorHandlingOptions {
612
+ interface ErrorHandlingOptions {
610
613
  onWarn?: (warning: CompilerError) => void;
611
614
  onError?: (error: CompilerError) => void;
612
615
  }
@@ -658,7 +661,7 @@ export interface ParserOptions extends ErrorHandlingOptions, CompilerCompatOptio
658
661
  comments?: boolean;
659
662
  }
660
663
  export type HoistTransform = (children: TemplateChildNode[], context: TransformContext, parent: ParentNode) => void;
661
- declare const enum BindingTypes {
664
+ export declare const enum BindingTypes {
662
665
  /**
663
666
  * returned from data()
664
667
  */
@@ -697,7 +700,11 @@ declare const enum BindingTypes {
697
700
  /**
698
701
  * declared by other options, e.g. computed, inject
699
702
  */
700
- OPTIONS = "options"
703
+ OPTIONS = "options",
704
+ /**
705
+ * a literal constant, e.g. 'foo', 1, true
706
+ */
707
+ LITERAL_CONST = "literal-const"
701
708
  }
702
709
  export type BindingMetadata = {
703
710
  [key: string]: BindingTypes | undefined;
@@ -705,7 +712,7 @@ export type BindingMetadata = {
705
712
  __isScriptSetup?: boolean;
706
713
  __propsAliases?: Record<string, string>;
707
714
  };
708
- export interface SharedTransformCodegenOptions {
715
+ interface SharedTransformCodegenOptions {
709
716
  /**
710
717
  * Transform expressions like {{ foo }} to `_ctx.foo`.
711
718
  * If this option is false, the generated code will be wrapped in a
@@ -877,7 +884,7 @@ export interface CodegenOptions extends SharedTransformCodegenOptions {
877
884
  }
878
885
  export type CompilerOptions = ParserOptions & TransformOptions & CodegenOptions;
879
886
 
880
- export type CodegenNode = TemplateChildNode | JSChildNode | SSRCodegenNode;
887
+ type CodegenNode = TemplateChildNode | JSChildNode | SSRCodegenNode;
881
888
  export interface CodegenResult {
882
889
  code: string;
883
890
  preamble: string;
@@ -899,7 +906,7 @@ export interface CodegenContext extends Omit<Required<CodegenOptions>, 'bindingM
899
906
  deindent(withoutNewLine?: boolean): void;
900
907
  newline(): void;
901
908
  }
902
- declare function generate(ast: RootNode, options?: CodegenOptions & {
909
+ export declare function generate(ast: RootNode, options?: CodegenOptions & {
903
910
  onContextCreated?: (context: CodegenContext) => void;
904
911
  }): CodegenResult;
905
912
 
@@ -907,80 +914,77 @@ export type TransformPreset = [
907
914
  NodeTransform[],
908
915
  Record<string, DirectiveTransform>
909
916
  ];
910
- declare function getBaseTransformPreset(prefixIdentifiers?: boolean): TransformPreset;
911
- declare function baseCompile(template: string | RootNode, options?: CompilerOptions): CodegenResult;
917
+ export declare function getBaseTransformPreset(prefixIdentifiers?: boolean): TransformPreset;
918
+ export declare function baseCompile(template: string | RootNode, options?: CompilerOptions): CodegenResult;
912
919
 
913
- declare const isStaticExp: (p: JSChildNode) => p is SimpleExpressionNode;
914
- declare const isBuiltInType: (tag: string, expected: string) => boolean;
915
- declare function isCoreComponent(tag: string): symbol | void;
916
- declare const isSimpleIdentifier: (name: string) => boolean;
920
+ export declare const isStaticExp: (p: JSChildNode) => p is SimpleExpressionNode;
921
+ export declare const isBuiltInType: (tag: string, expected: string) => boolean;
922
+ export declare function isCoreComponent(tag: string): symbol | void;
923
+ export declare const isSimpleIdentifier: (name: string) => boolean;
917
924
  /**
918
925
  * Simple lexer to check if an expression is a member expression. This is
919
926
  * lax and only checks validity at the root level (i.e. does not validate exps
920
927
  * inside square brackets), but it's ok since these are only used on template
921
928
  * expressions and false positives are invalid expressions in the first place.
922
929
  */
923
- declare const isMemberExpressionBrowser: (path: string) => boolean;
924
- declare const isMemberExpressionNode: (path: string, context: TransformContext) => boolean;
925
- declare const isMemberExpression: (path: string, context: TransformContext) => boolean;
926
- declare function getInnerRange(loc: SourceLocation, offset: number, length: number): SourceLocation;
927
- declare function advancePositionWithClone(pos: Position, source: string, numberOfCharacters?: number): Position;
928
- declare function advancePositionWithMutation(pos: Position, source: string, numberOfCharacters?: number): Position;
929
- declare function assert(condition: boolean, msg?: string): void;
930
- declare function findDir(node: ElementNode, name: string | RegExp, allowEmpty?: boolean): DirectiveNode | undefined;
931
- declare function findProp(node: ElementNode, name: string, dynamicOnly?: boolean, allowEmpty?: boolean): ElementNode['props'][0] | undefined;
932
- declare function isStaticArgOf(arg: DirectiveNode['arg'], name: string): boolean;
933
- declare function hasDynamicKeyVBind(node: ElementNode): boolean;
934
- declare function isText(node: TemplateChildNode): node is TextNode | InterpolationNode;
935
- declare function isVSlot(p: ElementNode['props'][0]): p is DirectiveNode;
936
- declare function isTemplateNode(node: RootNode | TemplateChildNode): node is TemplateNode;
937
- declare function isSlotOutlet(node: RootNode | TemplateChildNode): node is SlotOutletNode;
938
- declare function getVNodeHelper(ssr: boolean, isComponent: boolean): typeof CREATE_VNODE | typeof CREATE_ELEMENT_VNODE;
939
- declare function getVNodeBlockHelper(ssr: boolean, isComponent: boolean): typeof CREATE_BLOCK | typeof CREATE_ELEMENT_BLOCK;
940
- declare function injectProp(node: VNodeCall | RenderSlotCall, prop: Property, context: TransformContext): void;
941
- declare function toValidAssetId(name: string, type: 'component' | 'directive' | 'filter'): string;
942
- declare function hasScopeRef(node: TemplateChildNode | IfBranchNode | ExpressionNode | undefined, ids: TransformContext['identifiers']): boolean;
943
- declare function getMemoedVNodeCall(node: BlockCodegenNode | MemoExpression): VNodeCall | RenderSlotCall;
944
- declare function makeBlock(node: VNodeCall, { helper, removeHelper, inSSR }: TransformContext): void;
930
+ export declare const isMemberExpressionBrowser: (path: string) => boolean;
931
+ export declare const isMemberExpressionNode: (path: string, context: TransformContext) => boolean;
932
+ export declare const isMemberExpression: (path: string, context: TransformContext) => boolean;
933
+ export declare function getInnerRange(loc: SourceLocation, offset: number, length: number): SourceLocation;
934
+ export declare function advancePositionWithClone(pos: Position, source: string, numberOfCharacters?: number): Position;
935
+ export declare function advancePositionWithMutation(pos: Position, source: string, numberOfCharacters?: number): Position;
936
+ export declare function assert(condition: boolean, msg?: string): void;
937
+ export declare function findDir(node: ElementNode, name: string | RegExp, allowEmpty?: boolean): DirectiveNode | undefined;
938
+ export declare function findProp(node: ElementNode, name: string, dynamicOnly?: boolean, allowEmpty?: boolean): ElementNode['props'][0] | undefined;
939
+ export declare function isStaticArgOf(arg: DirectiveNode['arg'], name: string): boolean;
940
+ export declare function hasDynamicKeyVBind(node: ElementNode): boolean;
941
+ export declare function isText(node: TemplateChildNode): node is TextNode | InterpolationNode;
942
+ export declare function isVSlot(p: ElementNode['props'][0]): p is DirectiveNode;
943
+ export declare function isTemplateNode(node: RootNode | TemplateChildNode): node is TemplateNode;
944
+ export declare function isSlotOutlet(node: RootNode | TemplateChildNode): node is SlotOutletNode;
945
+ export declare function injectProp(node: VNodeCall | RenderSlotCall, prop: Property, context: TransformContext): void;
946
+ export declare function toValidAssetId(name: string, type: 'component' | 'directive' | 'filter'): string;
947
+ export declare function hasScopeRef(node: TemplateChildNode | IfBranchNode | ExpressionNode | undefined, ids: TransformContext['identifiers']): boolean;
948
+ export declare function getMemoedVNodeCall(node: BlockCodegenNode | MemoExpression): VNodeCall | RenderSlotCall;
945
949
 
946
- declare function walkIdentifiers(root: Node$1, onIdentifier: (node: Identifier, parent: Node$1, parentStack: Node$1[], isReference: boolean, isLocal: boolean) => void, includeAll?: boolean, parentStack?: Node$1[], knownIds?: Record<string, number>): void;
947
- declare function isReferencedIdentifier(id: Identifier, parent: Node$1 | null, parentStack: Node$1[]): boolean;
948
- declare function isInDestructureAssignment(parent: Node$1, parentStack: Node$1[]): boolean;
949
- declare function walkFunctionParams(node: Function, onIdent: (id: Identifier) => void): void;
950
- declare function walkBlockDeclarations(block: BlockStatement$1 | Program, onIdent: (node: Identifier) => void): void;
951
- declare function extractIdentifiers(param: Node$1, nodes?: Identifier[]): Identifier[];
952
- declare const isFunctionType: (node: Node$1) => node is Function;
953
- declare const isStaticProperty: (node: Node$1) => node is ObjectProperty;
954
- declare const isStaticPropertyKey: (node: Node$1, parent: Node$1) => boolean;
950
+ export declare function walkIdentifiers(root: Node$1, onIdentifier: (node: Identifier, parent: Node$1, parentStack: Node$1[], isReference: boolean, isLocal: boolean) => void, includeAll?: boolean, parentStack?: Node$1[], knownIds?: Record<string, number>): void;
951
+ export declare function isReferencedIdentifier(id: Identifier, parent: Node$1 | null, parentStack: Node$1[]): boolean;
952
+ export declare function isInDestructureAssignment(parent: Node$1, parentStack: Node$1[]): boolean;
953
+ export declare function walkFunctionParams(node: Function, onIdent: (id: Identifier) => void): void;
954
+ export declare function walkBlockDeclarations(block: BlockStatement$1 | Program, onIdent: (node: Identifier) => void): void;
955
+ export declare function extractIdentifiers(param: Node$1, nodes?: Identifier[]): Identifier[];
956
+ export declare const isFunctionType: (node: Node$1) => node is Function;
957
+ export declare const isStaticProperty: (node: Node$1) => node is ObjectProperty;
958
+ export declare const isStaticPropertyKey: (node: Node$1, parent: Node$1) => boolean;
959
+ export declare const TS_NODE_TYPES: string[];
955
960
 
956
- declare const transformModel: DirectiveTransform;
961
+ export declare const transformModel: DirectiveTransform;
957
962
 
958
- declare const transformOn: DirectiveTransform;
963
+ export declare const transformOn: DirectiveTransform;
959
964
 
960
- declare const transformBind: DirectiveTransform;
965
+ export declare const transformBind: DirectiveTransform;
961
966
 
962
- declare const noopDirectiveTransform: DirectiveTransform;
967
+ export declare const noopDirectiveTransform: DirectiveTransform;
963
968
 
964
- declare function processIf(node: ElementNode, dir: DirectiveNode, context: TransformContext, processCodegen?: (node: IfNode, branch: IfBranchNode, isRoot: boolean) => (() => void) | undefined): (() => void) | undefined;
969
+ export declare function processIf(node: ElementNode, dir: DirectiveNode, context: TransformContext, processCodegen?: (node: IfNode, branch: IfBranchNode, isRoot: boolean) => (() => void) | undefined): (() => void) | undefined;
965
970
 
966
- declare const transformExpression: NodeTransform;
967
- declare function processExpression(node: SimpleExpressionNode, context: TransformContext, asParams?: boolean, asRawStatements?: boolean, localVars?: Record<string, number>): ExpressionNode;
968
- declare function stringifyExpression(exp: ExpressionNode | string): string;
971
+ export declare const transformExpression: NodeTransform;
972
+ export declare function processExpression(node: SimpleExpressionNode, context: TransformContext, asParams?: boolean, asRawStatements?: boolean, localVars?: Record<string, number>): ExpressionNode;
973
+ export declare function stringifyExpression(exp: ExpressionNode | string): string;
969
974
 
970
- declare const trackSlotScopes: NodeTransform;
971
- declare const trackVForSlotScopes: NodeTransform;
975
+ export declare const trackSlotScopes: NodeTransform;
976
+ export declare const trackVForSlotScopes: NodeTransform;
972
977
  export type SlotFnBuilder = (slotProps: ExpressionNode | undefined, slotChildren: TemplateChildNode[], loc: SourceLocation) => FunctionExpression;
973
- declare function buildSlots(node: ElementNode, context: TransformContext, buildSlotFn?: SlotFnBuilder): {
978
+ export declare function buildSlots(node: ElementNode, context: TransformContext, buildSlotFn?: SlotFnBuilder): {
974
979
  slots: SlotsExpression;
975
980
  hasDynamicSlots: boolean;
976
981
  };
977
982
 
978
- export interface SlotOutletProcessResult {
983
+ interface SlotOutletProcessResult {
979
984
  slotName: string | ExpressionNode;
980
985
  slotProps: PropsExpression | undefined;
981
986
  }
982
- declare function processSlotOutlet(node: SlotOutletNode, context: TransformContext): SlotOutletProcessResult;
987
+ export declare function processSlotOutlet(node: SlotOutletNode, context: TransformContext): SlotOutletProcessResult;
983
988
 
984
- declare function getConstantType(node: TemplateChildNode | SimpleExpressionNode, context: TransformContext): ConstantTypes;
989
+ export declare function getConstantType(node: TemplateChildNode | SimpleExpressionNode, context: TransformContext): ConstantTypes;
985
990
 
986
- export { BASE_TRANSITION, BindingTypes, CAMELIZE, CAPITALIZE, CREATE_BLOCK, CREATE_COMMENT, CREATE_ELEMENT_BLOCK, CREATE_ELEMENT_VNODE, CREATE_SLOTS, CREATE_STATIC, CREATE_TEXT, CREATE_VNODE, CompilerDeprecationTypes, ConstantTypes, ElementTypes, ErrorCodes, FRAGMENT, GUARD_REACTIVE_PROPS, IS_MEMO_SAME, IS_REF, KEEP_ALIVE, MERGE_PROPS, NORMALIZE_CLASS, NORMALIZE_PROPS, NORMALIZE_STYLE, Namespaces, NodeTypes, OPEN_BLOCK, POP_SCOPE_ID, PUSH_SCOPE_ID, RENDER_LIST, RENDER_SLOT, RESOLVE_COMPONENT, RESOLVE_DIRECTIVE, RESOLVE_DYNAMIC_COMPONENT, RESOLVE_FILTER, SET_BLOCK_TRACKING, SUSPENSE, TELEPORT, TO_DISPLAY_STRING, TO_HANDLERS, TO_HANDLER_KEY, TextModes, UNREF, WITH_CTX, WITH_DIRECTIVES, WITH_MEMO, advancePositionWithClone, advancePositionWithMutation, assert, baseCompile, baseParse, buildDirectiveArgs, buildProps, buildSlots, checkCompatEnabled, createArrayExpression, createAssignmentExpression, createBlockStatement, createCacheExpression, createCallExpression, createCompilerError, createCompoundExpression, createConditionalExpression, createForLoopParams, createFunctionExpression, createIfStatement, createInterpolation, createObjectExpression, createObjectProperty, createReturnStatement, createRoot, createSequenceExpression, createSimpleExpression, createStructuralDirectiveTransform, createTemplateLiteral, createTransformContext, createVNodeCall, extractIdentifiers, findDir, findProp, generate, getBaseTransformPreset, getConstantType, getInnerRange, getMemoedVNodeCall, getVNodeBlockHelper, getVNodeHelper, hasDynamicKeyVBind, hasScopeRef, helperNameMap, injectProp, isBuiltInType, isCoreComponent, isFunctionType, isInDestructureAssignment, isMemberExpression, isMemberExpressionBrowser, isMemberExpressionNode, isReferencedIdentifier, isSimpleIdentifier, isSlotOutlet, isStaticArgOf, isStaticExp, isStaticProperty, isStaticPropertyKey, isTemplateNode, isText, isVSlot, locStub, makeBlock, noopDirectiveTransform, processExpression, processFor, processIf, processSlotOutlet, registerRuntimeHelpers, resolveComponentType, stringifyExpression, toValidAssetId, trackSlotScopes, trackVForSlotScopes, transform, transformBind, transformElement, transformExpression, transformModel, transformOn, traverseNode, walkBlockDeclarations, walkFunctionParams, walkIdentifiers, warnDeprecation };