@nuxt/webpack-builder 3.20.2 → 3.21.1

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