@vue/compiler-core 3.6.0-beta.9 → 3.6.0-rc.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,7 +1,6 @@
1
1
  import { Namespace, Namespaces, PatchFlags, generateCodeFrame } from "@vue/shared";
2
2
  import { BlockStatement as BlockStatement$1, Function, Identifier, Node as Node$1, ObjectProperty, Program, SwitchCase } from "@babel/types";
3
3
  import { ParserPlugin } from "@babel/parser";
4
-
5
4
  //#region temp/packages/compiler-core/src/runtimeHelpers.d.ts
6
5
  export declare const FRAGMENT: unique symbol;
7
6
  export declare const TELEPORT: unique symbol;
@@ -36,13 +35,13 @@ export declare const CAPITALIZE: unique symbol;
36
35
  export declare const TO_HANDLER_KEY: unique symbol;
37
36
  export declare const SET_BLOCK_TRACKING: unique symbol;
38
37
  /**
39
- * @deprecated no longer needed in 3.5+ because we no longer hoist element nodes
40
- * but kept for backwards compat
41
- */
38
+ * @deprecated no longer needed in 3.5+ because we no longer hoist element nodes
39
+ * but kept for backwards compat
40
+ */
42
41
  export declare const PUSH_SCOPE_ID: unique symbol;
43
42
  /**
44
- * @deprecated kept for backwards compat
45
- */
43
+ * @deprecated kept for backwards compat
44
+ */
46
45
  export declare const POP_SCOPE_ID: unique symbol;
47
46
  export declare const WITH_CTX: unique symbol;
48
47
  export declare const UNREF: unique symbol;
@@ -90,6 +89,7 @@ export interface ImportItem {
90
89
  exp: SimpleExpressionNode;
91
90
  path: string;
92
91
  }
92
+ type IdentifierScopeType = "local" | "slot";
93
93
  export interface TransformContext extends Required<Omit<TransformOptions, keyof CompilerCompatOptions>>, CompilerCompatOptions {
94
94
  selfName: string | null;
95
95
  root: RootNode;
@@ -103,6 +103,9 @@ export interface TransformContext extends Required<Omit<TransformOptions, keyof
103
103
  identifiers: {
104
104
  [name: string]: number | undefined;
105
105
  };
106
+ identifierScopes: {
107
+ [name: string]: IdentifierScopeType[] | undefined;
108
+ };
106
109
  scopes: {
107
110
  vFor: number;
108
111
  vSlot: number;
@@ -120,38 +123,17 @@ export interface TransformContext extends Required<Omit<TransformOptions, keyof
120
123
  replaceNode(node: TemplateChildNode): void;
121
124
  removeNode(node?: TemplateChildNode): void;
122
125
  onNodeRemoved(): void;
123
- addIdentifiers(exp: ExpressionNode | string): void;
126
+ addIdentifiers(exp: ExpressionNode | string, type?: IdentifierScopeType): void;
124
127
  removeIdentifiers(exp: ExpressionNode | string): void;
128
+ isSlotScopeIdentifier(name: string): boolean;
125
129
  hoist(exp: string | JSChildNode | ArrayExpression): SimpleExpressionNode;
126
130
  cache(exp: JSChildNode, isVNode?: boolean, inVOnce?: boolean): CacheExpression;
127
131
  constantCache: WeakMap<TemplateChildNode, ConstantTypes>;
132
+ vForMemoKeyedNodes: WeakSet<ElementNode>;
128
133
  filters?: Set<string>;
129
134
  }
130
135
  export declare function getSelfName(filename: string): string | null;
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;
136
+ 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;
155
137
  export declare function transform(root: RootNode, options: TransformOptions): void;
156
138
  export declare function traverseNode(node: RootNode | TemplateChildNode, context: TransformContext): void;
157
139
  export declare function createStructuralDirectiveTransform(name: string | RegExp, fn: StructuralDirectiveTransform): NodeTransform;
@@ -166,6 +148,8 @@ export declare function buildProps(node: ElementNode, context: TransformContext,
166
148
  patchFlag: number;
167
149
  dynamicPropNames: string[];
168
150
  shouldUseBlock: boolean;
151
+ needsPatch: boolean;
152
+ isBlockRequired: boolean;
169
153
  };
170
154
  export declare function buildDirectiveArgs(dir: DirectiveNode, context: TransformContext): ArrayExpression;
171
155
  //#endregion
@@ -286,27 +270,27 @@ export interface AttributeNode extends Node {
286
270
  export interface DirectiveNode extends Node {
287
271
  type: NodeTypes.DIRECTIVE;
288
272
  /**
289
- * the normalized name without prefix or shorthands, e.g. "bind", "on"
290
- */
273
+ * the normalized name without prefix or shorthands, e.g. "bind", "on"
274
+ */
291
275
  name: string;
292
276
  /**
293
- * the raw attribute name, preserving shorthand, and including arg & modifiers
294
- * this is only used during parse.
295
- */
277
+ * the raw attribute name, preserving shorthand, and including arg & modifiers
278
+ * this is only used during parse.
279
+ */
296
280
  rawName?: string;
297
281
  exp: ExpressionNode | undefined;
298
282
  arg: ExpressionNode | undefined;
299
283
  modifiers: SimpleExpressionNode[];
300
284
  /**
301
- * optional property to cache the expression parse result for v-for
302
- */
285
+ * optional property to cache the expression parse result for v-for
286
+ */
303
287
  forParseResult?: ForParseResult;
304
288
  }
305
289
  /**
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
- */
290
+ * Static types have several levels.
291
+ * Higher levels implies lower levels. e.g. a node that can be stringified
292
+ * can always be hoisted and skipped for patch.
293
+ */
310
294
  export declare enum ConstantTypes {
311
295
  NOT_CONSTANT = 0,
312
296
  CAN_SKIP_PATCH = 1,
@@ -319,20 +303,20 @@ export interface SimpleExpressionNode extends Node {
319
303
  isStatic: boolean;
320
304
  constType: ConstantTypes;
321
305
  /**
322
- * - `null` means the expression is a simple identifier that doesn't need
323
- * parsing
324
- * - `false` means there was a parsing error
325
- */
306
+ * - `null` means the expression is a simple identifier that doesn't need
307
+ * parsing
308
+ * - `false` means there was a parsing error
309
+ */
326
310
  ast?: Node$1 | null | false;
327
311
  /**
328
- * Indicates this is an identifier for a hoist vnode call and points to the
329
- * hoisted node.
330
- */
312
+ * Indicates this is an identifier for a hoist vnode call and points to the
313
+ * hoisted node.
314
+ */
331
315
  hoisted?: JSChildNode;
332
316
  /**
333
- * an expression parsed as the params of a function will track
334
- * the identifiers declared inside the function body.
335
- */
317
+ * an expression parsed as the params of a function will track
318
+ * the identifiers declared inside the function body.
319
+ */
336
320
  identifiers?: string[];
337
321
  isHandlerKey?: boolean;
338
322
  }
@@ -343,16 +327,16 @@ export interface InterpolationNode extends Node {
343
327
  export interface CompoundExpressionNode extends Node {
344
328
  type: NodeTypes.COMPOUND_EXPRESSION;
345
329
  /**
346
- * - `null` means the expression is a simple identifier that doesn't need
347
- * parsing
348
- * - `false` means there was a parsing error
349
- */
330
+ * - `null` means the expression is a simple identifier that doesn't need
331
+ * parsing
332
+ * - `false` means there was a parsing error
333
+ */
350
334
  ast?: Node$1 | null | false;
351
335
  children: (SimpleExpressionNode | CompoundExpressionNode | InterpolationNode | TextNode | string | symbol)[];
352
336
  /**
353
- * an expression parsed as the params of a function will track
354
- * the identifiers declared inside the function body.
355
- */
337
+ * an expression parsed as the params of a function will track
338
+ * the identifiers declared inside the function body.
339
+ */
356
340
  identifiers?: string[];
357
341
  isHandlerKey?: boolean;
358
342
  }
@@ -399,6 +383,10 @@ export interface VNodeCall extends Node {
399
383
  patchFlag: PatchFlags | undefined;
400
384
  dynamicProps: string | SimpleExpressionNode | undefined;
401
385
  directives: DirectiveArguments | undefined;
386
+ /** Whether this vnode must be patched if a later transform makes it non-block. */
387
+ needsPatch?: boolean;
388
+ /** Whether a later transform must preserve this vnode as a block. */
389
+ isBlockRequired?: boolean;
402
390
  isBlock: boolean;
403
391
  disableTracking: boolean;
404
392
  isComponent: boolean;
@@ -429,14 +417,14 @@ export interface FunctionExpression extends Node {
429
417
  body?: BlockStatement | IfStatement;
430
418
  newline: boolean;
431
419
  /**
432
- * This flag is for codegen to determine whether it needs to generate the
433
- * withScopeId() wrapper
434
- */
420
+ * This flag is for codegen to determine whether it needs to generate the
421
+ * withScopeId() wrapper
422
+ */
435
423
  isSlot: boolean;
436
424
  /**
437
- * __COMPAT__ only, indicates a slot function that should be excluded from
438
- * the legacy $scopedSlots instance property.
439
- */
425
+ * __COMPAT__ only, indicates a slot function that should be excluded from
426
+ * the legacy $scopedSlots instance property.
427
+ */
440
428
  isNonScopedSlot?: boolean;
441
429
  }
442
430
  export interface ConditionalExpression extends Node {
@@ -497,7 +485,7 @@ export interface DirectiveArgumentNode extends ArrayExpression {
497
485
  }
498
486
  export interface RenderSlotCall extends CallExpression {
499
487
  callee: typeof RENDER_SLOT;
500
- arguments: [string, string | ExpressionNode] | [string, string | ExpressionNode, PropsExpression] | [string, string | ExpressionNode, PropsExpression | "{}", TemplateChildNode[]];
488
+ arguments: [string, string | ExpressionNode] | [string, string | ExpressionNode, PropsExpression | "{}"] | [string, string | ExpressionNode, PropsExpression | "{}", FunctionExpression | string] | [string, string | ExpressionNode, PropsExpression | "{}", FunctionExpression | string, string] | [string, string | ExpressionNode, PropsExpression | "{}", FunctionExpression | string, string, JSChildNode];
501
489
  }
502
490
  export type SlotsExpression = SlotsObjectExpression | DynamicSlotsExpression;
503
491
  export interface SlotsObjectExpression extends ObjectExpression {
@@ -575,11 +563,7 @@ export declare function createSequenceExpression(expressions: SequenceExpression
575
563
  export declare function createReturnStatement(returns: ReturnStatement["returns"]): ReturnStatement;
576
564
  export declare function getVNodeHelper(ssr: boolean, isComponent: boolean): typeof CREATE_VNODE | typeof CREATE_ELEMENT_VNODE;
577
565
  export declare function getVNodeBlockHelper(ssr: boolean, isComponent: boolean): typeof CREATE_BLOCK | typeof CREATE_ELEMENT_BLOCK;
578
- export declare function convertToBlock(node: VNodeCall, {
579
- helper,
580
- removeHelper,
581
- inSSR
582
- }: TransformContext): void;
566
+ export declare function convertToBlock(node: VNodeCall, { helper, removeHelper, inSSR }: TransformContext): void;
583
567
  //#endregion
584
568
  //#region temp/packages/compiler-core/src/errors.d.ts
585
569
  export interface CompilerError extends SyntaxError {
@@ -661,127 +645,127 @@ interface ErrorHandlingOptions {
661
645
  }
662
646
  export interface ParserOptions extends ErrorHandlingOptions, CompilerCompatOptions {
663
647
  /**
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
- */
648
+ * Base mode is platform agnostic and only parses HTML-like template syntax,
649
+ * treating all tags the same way. Specific tag parsing behavior can be
650
+ * configured by higher-level compilers.
651
+ *
652
+ * HTML mode adds additional logic for handling special parsing behavior in
653
+ * `<script>`, `<style>`,`<title>` and `<textarea>`.
654
+ * The logic is handled inside compiler-core for efficiency.
655
+ *
656
+ * SFC mode treats content of all root-level tags except `<template>` as plain
657
+ * text.
658
+ */
675
659
  parseMode?: "base" | "html" | "sfc";
676
660
  /**
677
- * Specify the root namespace to use when parsing a template.
678
- * Defaults to `Namespaces.HTML` (0).
679
- */
661
+ * Specify the root namespace to use when parsing a template.
662
+ * Defaults to `Namespaces.HTML` (0).
663
+ */
680
664
  ns?: Namespaces;
681
665
  /**
682
- * e.g. platform native elements, e.g. `<div>` for browsers
683
- */
666
+ * e.g. platform native elements, e.g. `<div>` for browsers
667
+ */
684
668
  isNativeTag?: (tag: string) => boolean;
685
669
  /**
686
- * e.g. native elements that can self-close, e.g. `<img>`, `<br>`, `<hr>`
687
- */
670
+ * e.g. native elements that can self-close, e.g. `<img>`, `<br>`, `<hr>`
671
+ */
688
672
  isVoidTag?: (tag: string) => boolean;
689
673
  /**
690
- * e.g. elements that should preserve whitespace inside, e.g. `<pre>`
691
- */
674
+ * e.g. elements that should preserve whitespace inside, e.g. `<pre>`
675
+ */
692
676
  isPreTag?: (tag: string) => boolean;
693
677
  /**
694
- * Elements that should ignore the first newline token per parinsg spec
695
- * e.g. `<textarea>` and `<pre>`
696
- */
678
+ * Elements that should ignore the first newline token per parinsg spec
679
+ * e.g. `<textarea>` and `<pre>`
680
+ */
697
681
  isIgnoreNewlineTag?: (tag: string) => boolean;
698
682
  /**
699
- * Platform-specific built-in components e.g. `<Transition>`
700
- */
683
+ * Platform-specific built-in components e.g. `<Transition>`
684
+ */
701
685
  isBuiltInComponent?: (tag: string) => symbol | void;
702
686
  /**
703
- * Separate option for end users to extend the native elements list
704
- */
687
+ * Separate option for end users to extend the native elements list
688
+ */
705
689
  isCustomElement?: (tag: string) => boolean | void;
706
690
  /**
707
- * Get tag namespace
708
- */
691
+ * Get tag namespace
692
+ */
709
693
  getNamespace?: (tag: string, parent: ElementNode | undefined, rootNamespace: Namespace) => Namespace;
710
694
  /**
711
- * @default ['{{', '}}']
712
- */
695
+ * @default ['{{', '}}']
696
+ */
713
697
  delimiters?: [string, string];
714
698
  /**
715
- * Whitespace handling strategy
716
- * @default 'condense'
717
- */
699
+ * Whitespace handling strategy
700
+ * @default 'condense'
701
+ */
718
702
  whitespace?: "preserve" | "condense";
719
703
  /**
720
- * Only used for DOM compilers that runs in the browser.
721
- * In non-browser builds, this option is ignored.
722
- */
704
+ * Only used for DOM compilers that runs in the browser.
705
+ * In non-browser builds, this option is ignored.
706
+ */
723
707
  decodeEntities?: (rawText: string, asAttr: boolean) => string;
724
708
  /**
725
- * Whether to keep comments in the templates AST.
726
- * This defaults to `true` in development and `false` in production builds.
727
- */
709
+ * Whether to keep comments in the templates AST.
710
+ * This defaults to `true` in development and `false` in production builds.
711
+ */
728
712
  comments?: boolean;
729
713
  /**
730
- * Parse JavaScript expressions with Babel.
731
- * @default false
732
- */
714
+ * Parse JavaScript expressions with Babel.
715
+ * @default false
716
+ */
733
717
  prefixIdentifiers?: boolean;
734
718
  /**
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
- */
719
+ * A list of parser plugins to enable for `@babel/parser`, which is used to
720
+ * parse expressions in bindings and interpolations.
721
+ * https://babeljs.io/docs/en/next/babel-parser#plugins
722
+ */
739
723
  expressionPlugins?: ParserPlugin[];
740
724
  }
741
725
  export type HoistTransform = (children: TemplateChildNode[], context: TransformContext, parent: ParentNode) => void;
742
726
  export declare enum BindingTypes {
743
727
  /**
744
- * returned from data()
745
- */
728
+ * returned from data()
729
+ */
746
730
  DATA = "data",
747
731
  /**
748
- * declared as a prop
749
- */
732
+ * declared as a prop
733
+ */
750
734
  PROPS = "props",
751
735
  /**
752
- * a local alias of a `<script setup>` destructured prop.
753
- * the original is stored in __propsAliases of the bindingMetadata object.
754
- */
736
+ * a local alias of a `<script setup>` destructured prop.
737
+ * the original is stored in __propsAliases of the bindingMetadata object.
738
+ */
755
739
  PROPS_ALIASED = "props-aliased",
756
740
  /**
757
- * a let binding (may or may not be a ref)
758
- */
741
+ * a let binding (may or may not be a ref)
742
+ */
759
743
  SETUP_LET = "setup-let",
760
744
  /**
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
- */
745
+ * a const binding that can never be a ref.
746
+ * these bindings don't need `unref()` calls when processed in inlined
747
+ * template expressions.
748
+ */
765
749
  SETUP_CONST = "setup-const",
766
750
  /**
767
- * a const binding that does not need `unref()`, but may be mutated.
768
- */
751
+ * a const binding that does not need `unref()`, but may be mutated.
752
+ */
769
753
  SETUP_REACTIVE_CONST = "setup-reactive-const",
770
754
  /**
771
- * a const binding that may be a ref.
772
- */
755
+ * a const binding that may be a ref.
756
+ */
773
757
  SETUP_MAYBE_REF = "setup-maybe-ref",
774
758
  /**
775
- * bindings that are guaranteed to be refs
776
- */
759
+ * bindings that are guaranteed to be refs
760
+ */
777
761
  SETUP_REF = "setup-ref",
778
762
  /**
779
- * declared by other options, e.g. computed, inject
780
- */
763
+ * declared by other options, e.g. computed, inject
764
+ */
781
765
  OPTIONS = "options",
782
766
  /**
783
- * a literal constant, e.g. 'foo', 1, true
784
- */
767
+ * a literal constant, e.g. 'foo', 1, true
768
+ */
785
769
  LITERAL_CONST = "literal-const"
786
770
  }
787
771
  export type BindingMetadata = {
@@ -792,192 +776,194 @@ export type BindingMetadata = {
792
776
  };
793
777
  interface SharedTransformCodegenOptions {
794
778
  /**
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
- */
779
+ * Transform expressions like {{ foo }} to `_ctx.foo`.
780
+ * If this option is false, the generated code will be wrapped in a
781
+ * `with (this) { ... }` block.
782
+ * - This is force-enabled in module mode, since modules are by default strict
783
+ * and cannot use `with`
784
+ * @default mode === 'module'
785
+ */
802
786
  prefixIdentifiers?: boolean;
803
787
  /**
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
- */
788
+ * A list of parser plugins to enable for `@babel/parser`, which is used to
789
+ * parse expressions in bindings and interpolations.
790
+ * https://babeljs.io/docs/en/next/babel-parser#plugins
791
+ */
808
792
  expressionPlugins?: ParserPlugin[];
809
793
  /**
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
- */
794
+ * Control whether generate SSR-optimized render functions instead.
795
+ * The resulting function must be attached to the component via the
796
+ * `ssrRender` option instead of `render`.
797
+ *
798
+ * When compiler generates code for SSR's fallback branch, we need to set it to false:
799
+ * - context.ssr = false
800
+ *
801
+ * see `subTransform` in `ssrTransformComponent.ts`
802
+ */
819
803
  ssr?: boolean;
820
804
  /**
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
- */
805
+ * Indicates whether the compiler generates code for SSR,
806
+ * it is always true when generating code for SSR,
807
+ * regardless of whether we are generating code for SSR's fallback branch,
808
+ * this means that when the compiler generates code for SSR's fallback branch:
809
+ * - context.ssr = false
810
+ * - context.inSSR = true
811
+ */
828
812
  inSSR?: boolean;
829
813
  /**
830
- * Optional binding metadata analyzed from script - used to optimize
831
- * binding access when `prefixIdentifiers` is enabled.
832
- */
814
+ * Optional binding metadata analyzed from script - used to optimize
815
+ * binding access when `prefixIdentifiers` is enabled.
816
+ */
833
817
  bindingMetadata?: BindingMetadata;
834
818
  /**
835
- * Compile the function for inlining inside setup().
836
- * This allows the function to directly access setup() local bindings.
837
- */
819
+ * Compile the function for inlining inside setup().
820
+ * This allows the function to directly access setup() local bindings.
821
+ */
838
822
  inline?: boolean;
839
823
  /**
840
- * Indicates that transforms and codegen should try to output valid TS code
841
- */
824
+ * Indicates that transforms and codegen should try to output valid TS code
825
+ */
842
826
  isTS?: boolean;
843
827
  /**
844
- * Filename for source map generation.
845
- * Also used for self-recursive reference in templates
846
- * @default 'template.vue.html'
847
- */
828
+ * Filename for source map generation.
829
+ * Also used for self-recursive reference in templates
830
+ * @default 'template.vue.html'
831
+ */
848
832
  filename?: string;
849
833
  }
850
834
  export interface TransformOptions extends SharedTransformCodegenOptions, ErrorHandlingOptions, CompilerCompatOptions {
851
835
  /**
852
- * An array of node transforms to be applied to every AST node.
853
- */
836
+ * An array of node transforms to be applied to every AST node.
837
+ */
854
838
  nodeTransforms?: NodeTransform[];
855
839
  /**
856
- * An object of { name: transform } to be applied to every directive attribute
857
- * node found on element nodes.
858
- */
840
+ * An object of { name: transform } to be applied to every directive attribute
841
+ * node found on element nodes.
842
+ */
859
843
  directiveTransforms?: Record<string, DirectiveTransform | undefined>;
860
844
  /**
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
- */
845
+ * An optional hook to transform a node being hoisted.
846
+ * used by compiler-dom to turn hoisted nodes into stringified HTML vnodes.
847
+ * @default null
848
+ */
865
849
  transformHoist?: HoistTransform | null;
866
850
  /**
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
- */
851
+ * If the pairing runtime provides additional built-in elements, use this to
852
+ * mark them as built-in so the compiler will generate component vnodes
853
+ * for them.
854
+ */
871
855
  isBuiltInComponent?: (tag: string) => symbol | void;
872
856
  /**
873
- * Used by some transforms that expects only native elements
874
- */
857
+ * Used by some transforms that expects only native elements
858
+ */
875
859
  isCustomElement?: (tag: string) => boolean | void;
876
860
  /**
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
- */
861
+ * Transform expressions like {{ foo }} to `_ctx.foo`.
862
+ * If this option is false, the generated code will be wrapped in a
863
+ * `with (this) { ... }` block.
864
+ * - This is force-enabled in module mode, since modules are by default strict
865
+ * and cannot use `with`
866
+ * @default mode === 'module'
867
+ */
884
868
  prefixIdentifiers?: boolean;
885
869
  /**
886
- * Cache static VNodes and props objects to `_hoisted_x` constants
887
- * @default false
888
- */
870
+ * Cache static VNodes and props objects to `_hoisted_x` constants
871
+ * @default false
872
+ */
889
873
  hoistStatic?: boolean;
890
874
  /**
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
- */
875
+ * Cache v-on handlers to avoid creating new inline functions on each render,
876
+ * also avoids the need for dynamically patching the handlers by wrapping it.
877
+ * e.g `@click="foo"` by default is compiled to `{ onClick: foo }`. With this
878
+ * option it's compiled to:
879
+ * ```js
880
+ * { onClick: _cache[0] || (_cache[0] = e => _ctx.foo(e)) }
881
+ * ```
882
+ * - Requires "prefixIdentifiers" to be enabled because it relies on scope
883
+ * analysis to determine if a handler is safe to cache.
884
+ * @default false
885
+ */
902
886
  cacheHandlers?: boolean;
903
887
  /**
904
- * SFC scoped styles ID
905
- */
888
+ * SFC scoped styles ID
889
+ */
906
890
  scopeId?: string | null;
907
891
  /**
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
- */
892
+ * Indicates this SFC template has used :slotted in its styles
893
+ * Defaults to `true` for backwards compatibility - SFC tooling should set it
894
+ * to `false` if no `:slotted` usage is detected in `<style>`
895
+ */
912
896
  slotted?: boolean;
913
897
  /**
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
- */
898
+ * SFC `<style vars>` injection string
899
+ * Should already be an object expression, e.g. `{ 'xxxx-color': color }`
900
+ * needed to render inline CSS variables on component root
901
+ */
918
902
  ssrCssVars?: string;
919
903
  /**
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
- */
904
+ * Whether to compile the template assuming it needs to handle HMR.
905
+ * Some edge cases may need to generate different code for HMR to work
906
+ * correctly, e.g. #6938, #7138
907
+ */
924
908
  hmr?: boolean;
925
909
  }
926
910
  export interface CodegenOptions extends SharedTransformCodegenOptions {
927
911
  /**
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
- */
912
+ * - `module` mode will generate ES module import statements for helpers
913
+ * and export the render function as the default export.
914
+ * - `function` mode will generate a single `const { helpers... } = Vue`
915
+ * statement and return the render function. It expects `Vue` to be globally
916
+ * available (or passed by wrapping the code with an IIFE). It is meant to be
917
+ * used with `new Function(code)()` to generate a render function at runtime.
918
+ * @default 'function'
919
+ */
936
920
  mode?: "module" | "function";
937
921
  /**
938
- * Generate source map?
939
- * @default false
940
- */
922
+ * Generate source map?
923
+ * @default false
924
+ */
941
925
  sourceMap?: boolean;
942
926
  /**
943
- * SFC scoped styles ID
944
- */
927
+ * SFC scoped styles ID
928
+ */
945
929
  scopeId?: string | null;
946
930
  /**
947
- * Option to optimize helper import bindings via variable assignment
948
- * (only used for webpack code-split)
949
- * @default false
950
- */
931
+ * Option to optimize helper import bindings via variable assignment
932
+ * (only used for webpack code-split)
933
+ * @default false
934
+ */
951
935
  optimizeImports?: boolean;
952
936
  /**
953
- * Customize where to import runtime helpers from.
954
- * @default 'vue'
955
- */
937
+ * Customize where to import runtime helpers from.
938
+ * @default 'vue'
939
+ */
956
940
  runtimeModuleName?: string;
957
941
  /**
958
- * Customize where to import ssr runtime helpers from/**
959
- * @default 'vue/server-renderer'
960
- */
942
+ * Customize where to import ssr runtime helpers from/**
943
+ * @default 'vue/server-renderer'
944
+ */
961
945
  ssrRuntimeModuleName?: string;
962
946
  /**
963
- * Customize the global variable name of `Vue` to get helpers from
964
- * in function mode
965
- * @default 'Vue'
966
- */
947
+ * Customize the global variable name of `Vue` to get helpers from
948
+ * in function mode
949
+ * @default 'Vue'
950
+ */
967
951
  runtimeGlobalName?: string;
968
952
  }
969
- export type CompilerOptions = ParserOptions & TransformOptions & CodegenOptions;
953
+ export type CompilerOptions = ParserOptions & TransformOptions & CodegenOptions & {
954
+ vapor?: boolean;
955
+ };
970
956
  //#endregion
971
957
  //#region temp/packages/compiler-core/src/codegen.d.ts
972
958
  /**
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
- */
959
+ * The `SourceMapGenerator` type from `source-map-js` is a bit incomplete as it
960
+ * misses `toJSON()`. We also need to add types for internal properties which we
961
+ * need to access for better performance.
962
+ *
963
+ * Since TS 5.3, dts generation starts to strangely include broken triple slash
964
+ * references for source-map-js, so we are inlining all source map related types
965
+ * here to workaround that.
966
+ */
981
967
  export interface CodegenSourceMapGenerator {
982
968
  setSourceContent(sourceFile: string, sourceContent: string): void;
983
969
  toJSON(): RawSourceMap;
@@ -1055,11 +1041,11 @@ export declare function isCoreComponent(tag: string): symbol | void;
1055
1041
  export declare const isSimpleIdentifier: (name: string) => boolean;
1056
1042
  export declare const validFirstIdentCharRE: RegExp;
1057
1043
  /**
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
- */
1044
+ * Simple lexer to check if an expression is a member expression. This is
1045
+ * lax and only checks validity at the root level (i.e. does not validate exps
1046
+ * inside square brackets), but it's ok since these are only used on template
1047
+ * expressions and false positives are invalid expressions in the first place.
1048
+ */
1063
1049
  export declare const isMemberExpressionBrowser: (exp: ExpressionNode) => boolean;
1064
1050
  export declare const isMemberExpressionNode: (exp: ExpressionNode, context: Pick<TransformContext, "expressionPlugins">) => boolean;
1065
1051
  export declare const isMemberExpression: (exp: ExpressionNode, context: Pick<TransformContext, "expressionPlugins">) => boolean;
@@ -1093,8 +1079,8 @@ export declare function isCommentOrWhitespace(node: TemplateChildNode): boolean;
1093
1079
  //#endregion
1094
1080
  //#region temp/packages/compiler-core/src/babelUtils.d.ts
1095
1081
  /**
1096
- * Return value indicates whether the AST walked can be a constant
1097
- */
1082
+ * Return value indicates whether the AST walked can be a constant
1083
+ */
1098
1084
  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;
1099
1085
  export declare function isReferencedIdentifier(id: Identifier, parent: Node$1 | null, parentStack: Node$1[]): boolean;
1100
1086
  export declare function isInDestructureAssignment(parent: Node$1, parentStack: Node$1[]): boolean;
@@ -1127,11 +1113,7 @@ export declare function processIf(node: ElementNode, dir: DirectiveNode, context
1127
1113
  //#endregion
1128
1114
  //#region temp/packages/compiler-core/src/transforms/vFor.d.ts
1129
1115
  export declare function processFor(node: ElementNode, dir: DirectiveNode, context: TransformContext, processCodegen?: (forNode: ForNode) => (() => void) | undefined): (() => void) | undefined;
1130
- export declare function createForLoopParams({
1131
- value,
1132
- key,
1133
- index
1134
- }: ForParseResult, memoArgs?: ExpressionNode[]): ExpressionNode[];
1116
+ export declare function createForLoopParams({ value, key, index }: ForParseResult, memoArgs?: ExpressionNode[]): ExpressionNode[];
1135
1117
  //#endregion
1136
1118
  //#region temp/packages/compiler-core/src/transforms/transformExpression.d.ts
1137
1119
  export declare const isLiteralWhitelisted: (key: string) => boolean;
@@ -1161,4 +1143,4 @@ export declare function processSlotOutlet(node: SlotOutletNode, context: Transfo
1161
1143
  //#region temp/packages/compiler-core/src/transforms/cacheStatic.d.ts
1162
1144
  export declare function getConstantType(node: TemplateChildNode | SimpleExpressionNode | CacheExpression, context: TransformContext): ConstantTypes;
1163
1145
  //#endregion
1164
- export { generateCodeFrame, };
1146
+ export { generateCodeFrame };