@vue/compiler-core 3.6.0-alpha.7 → 3.6.0-beta.10

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