@vue/compiler-core 3.6.0-rc.5 → 3.6.0-rc.7
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.
- package/dist/compiler-core.cjs.js +249 -223
- package/dist/compiler-core.cjs.prod.js +235 -216
- package/dist/compiler-core.d.ts +244 -276
- package/dist/compiler-core.esm-bundler.js +159 -148
- package/package.json +2 -2
package/dist/compiler-core.d.ts
CHANGED
|
@@ -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;
|
|
@@ -134,30 +133,7 @@ export interface TransformContext extends Required<Omit<TransformOptions, keyof
|
|
|
134
133
|
filters?: Set<string>;
|
|
135
134
|
}
|
|
136
135
|
export declare function getSelfName(filename: string): string | null;
|
|
137
|
-
export declare function createTransformContext(root: RootNode, {
|
|
138
|
-
filename,
|
|
139
|
-
prefixIdentifiers,
|
|
140
|
-
hoistStatic,
|
|
141
|
-
hmr,
|
|
142
|
-
cacheHandlers,
|
|
143
|
-
nodeTransforms,
|
|
144
|
-
directiveTransforms,
|
|
145
|
-
transformHoist,
|
|
146
|
-
isBuiltInComponent,
|
|
147
|
-
isCustomElement,
|
|
148
|
-
expressionPlugins,
|
|
149
|
-
scopeId,
|
|
150
|
-
slotted,
|
|
151
|
-
ssr,
|
|
152
|
-
inSSR,
|
|
153
|
-
ssrCssVars,
|
|
154
|
-
bindingMetadata,
|
|
155
|
-
inline,
|
|
156
|
-
isTS,
|
|
157
|
-
onError,
|
|
158
|
-
onWarn,
|
|
159
|
-
compatConfig
|
|
160
|
-
}: 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;
|
|
161
137
|
export declare function transform(root: RootNode, options: TransformOptions): void;
|
|
162
138
|
export declare function traverseNode(node: RootNode | TemplateChildNode, context: TransformContext): void;
|
|
163
139
|
export declare function createStructuralDirectiveTransform(name: string | RegExp, fn: StructuralDirectiveTransform): NodeTransform;
|
|
@@ -294,27 +270,27 @@ export interface AttributeNode extends Node {
|
|
|
294
270
|
export interface DirectiveNode extends Node {
|
|
295
271
|
type: NodeTypes.DIRECTIVE;
|
|
296
272
|
/**
|
|
297
|
-
|
|
298
|
-
|
|
273
|
+
* the normalized name without prefix or shorthands, e.g. "bind", "on"
|
|
274
|
+
*/
|
|
299
275
|
name: string;
|
|
300
276
|
/**
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
277
|
+
* the raw attribute name, preserving shorthand, and including arg & modifiers
|
|
278
|
+
* this is only used during parse.
|
|
279
|
+
*/
|
|
304
280
|
rawName?: string;
|
|
305
281
|
exp: ExpressionNode | undefined;
|
|
306
282
|
arg: ExpressionNode | undefined;
|
|
307
283
|
modifiers: SimpleExpressionNode[];
|
|
308
284
|
/**
|
|
309
|
-
|
|
310
|
-
|
|
285
|
+
* optional property to cache the expression parse result for v-for
|
|
286
|
+
*/
|
|
311
287
|
forParseResult?: ForParseResult;
|
|
312
288
|
}
|
|
313
289
|
/**
|
|
314
|
-
* Static types have several levels.
|
|
315
|
-
* Higher levels implies lower levels. e.g. a node that can be stringified
|
|
316
|
-
* can always be hoisted and skipped for patch.
|
|
317
|
-
*/
|
|
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
|
+
*/
|
|
318
294
|
export declare enum ConstantTypes {
|
|
319
295
|
NOT_CONSTANT = 0,
|
|
320
296
|
CAN_SKIP_PATCH = 1,
|
|
@@ -327,20 +303,20 @@ export interface SimpleExpressionNode extends Node {
|
|
|
327
303
|
isStatic: boolean;
|
|
328
304
|
constType: ConstantTypes;
|
|
329
305
|
/**
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
306
|
+
* - `null` means the expression is a simple identifier that doesn't need
|
|
307
|
+
* parsing
|
|
308
|
+
* - `false` means there was a parsing error
|
|
309
|
+
*/
|
|
334
310
|
ast?: Node$1 | null | false;
|
|
335
311
|
/**
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
312
|
+
* Indicates this is an identifier for a hoist vnode call and points to the
|
|
313
|
+
* hoisted node.
|
|
314
|
+
*/
|
|
339
315
|
hoisted?: JSChildNode;
|
|
340
316
|
/**
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
317
|
+
* an expression parsed as the params of a function will track
|
|
318
|
+
* the identifiers declared inside the function body.
|
|
319
|
+
*/
|
|
344
320
|
identifiers?: string[];
|
|
345
321
|
isHandlerKey?: boolean;
|
|
346
322
|
}
|
|
@@ -351,16 +327,16 @@ export interface InterpolationNode extends Node {
|
|
|
351
327
|
export interface CompoundExpressionNode extends Node {
|
|
352
328
|
type: NodeTypes.COMPOUND_EXPRESSION;
|
|
353
329
|
/**
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
330
|
+
* - `null` means the expression is a simple identifier that doesn't need
|
|
331
|
+
* parsing
|
|
332
|
+
* - `false` means there was a parsing error
|
|
333
|
+
*/
|
|
358
334
|
ast?: Node$1 | null | false;
|
|
359
335
|
children: (SimpleExpressionNode | CompoundExpressionNode | InterpolationNode | TextNode | string | symbol)[];
|
|
360
336
|
/**
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
337
|
+
* an expression parsed as the params of a function will track
|
|
338
|
+
* the identifiers declared inside the function body.
|
|
339
|
+
*/
|
|
364
340
|
identifiers?: string[];
|
|
365
341
|
isHandlerKey?: boolean;
|
|
366
342
|
}
|
|
@@ -441,14 +417,14 @@ export interface FunctionExpression extends Node {
|
|
|
441
417
|
body?: BlockStatement | IfStatement;
|
|
442
418
|
newline: boolean;
|
|
443
419
|
/**
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
420
|
+
* This flag is for codegen to determine whether it needs to generate the
|
|
421
|
+
* withScopeId() wrapper
|
|
422
|
+
*/
|
|
447
423
|
isSlot: boolean;
|
|
448
424
|
/**
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
425
|
+
* __COMPAT__ only, indicates a slot function that should be excluded from
|
|
426
|
+
* the legacy $scopedSlots instance property.
|
|
427
|
+
*/
|
|
452
428
|
isNonScopedSlot?: boolean;
|
|
453
429
|
}
|
|
454
430
|
export interface ConditionalExpression extends Node {
|
|
@@ -587,11 +563,7 @@ export declare function createSequenceExpression(expressions: SequenceExpression
|
|
|
587
563
|
export declare function createReturnStatement(returns: ReturnStatement["returns"]): ReturnStatement;
|
|
588
564
|
export declare function getVNodeHelper(ssr: boolean, isComponent: boolean): typeof CREATE_VNODE | typeof CREATE_ELEMENT_VNODE;
|
|
589
565
|
export declare function getVNodeBlockHelper(ssr: boolean, isComponent: boolean): typeof CREATE_BLOCK | typeof CREATE_ELEMENT_BLOCK;
|
|
590
|
-
export declare function convertToBlock(node: VNodeCall, {
|
|
591
|
-
helper,
|
|
592
|
-
removeHelper,
|
|
593
|
-
inSSR
|
|
594
|
-
}: TransformContext): void;
|
|
566
|
+
export declare function convertToBlock(node: VNodeCall, { helper, removeHelper, inSSR }: TransformContext): void;
|
|
595
567
|
//#endregion
|
|
596
568
|
//#region temp/packages/compiler-core/src/errors.d.ts
|
|
597
569
|
export interface CompilerError extends SyntaxError {
|
|
@@ -673,127 +645,127 @@ interface ErrorHandlingOptions {
|
|
|
673
645
|
}
|
|
674
646
|
export interface ParserOptions extends ErrorHandlingOptions, CompilerCompatOptions {
|
|
675
647
|
/**
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
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
|
+
*/
|
|
687
659
|
parseMode?: "base" | "html" | "sfc";
|
|
688
660
|
/**
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
661
|
+
* Specify the root namespace to use when parsing a template.
|
|
662
|
+
* Defaults to `Namespaces.HTML` (0).
|
|
663
|
+
*/
|
|
692
664
|
ns?: Namespaces;
|
|
693
665
|
/**
|
|
694
|
-
|
|
695
|
-
|
|
666
|
+
* e.g. platform native elements, e.g. `<div>` for browsers
|
|
667
|
+
*/
|
|
696
668
|
isNativeTag?: (tag: string) => boolean;
|
|
697
669
|
/**
|
|
698
|
-
|
|
699
|
-
|
|
670
|
+
* e.g. native elements that can self-close, e.g. `<img>`, `<br>`, `<hr>`
|
|
671
|
+
*/
|
|
700
672
|
isVoidTag?: (tag: string) => boolean;
|
|
701
673
|
/**
|
|
702
|
-
|
|
703
|
-
|
|
674
|
+
* e.g. elements that should preserve whitespace inside, e.g. `<pre>`
|
|
675
|
+
*/
|
|
704
676
|
isPreTag?: (tag: string) => boolean;
|
|
705
677
|
/**
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
678
|
+
* Elements that should ignore the first newline token per parinsg spec
|
|
679
|
+
* e.g. `<textarea>` and `<pre>`
|
|
680
|
+
*/
|
|
709
681
|
isIgnoreNewlineTag?: (tag: string) => boolean;
|
|
710
682
|
/**
|
|
711
|
-
|
|
712
|
-
|
|
683
|
+
* Platform-specific built-in components e.g. `<Transition>`
|
|
684
|
+
*/
|
|
713
685
|
isBuiltInComponent?: (tag: string) => symbol | void;
|
|
714
686
|
/**
|
|
715
|
-
|
|
716
|
-
|
|
687
|
+
* Separate option for end users to extend the native elements list
|
|
688
|
+
*/
|
|
717
689
|
isCustomElement?: (tag: string) => boolean | void;
|
|
718
690
|
/**
|
|
719
|
-
|
|
720
|
-
|
|
691
|
+
* Get tag namespace
|
|
692
|
+
*/
|
|
721
693
|
getNamespace?: (tag: string, parent: ElementNode | undefined, rootNamespace: Namespace) => Namespace;
|
|
722
694
|
/**
|
|
723
|
-
|
|
724
|
-
|
|
695
|
+
* @default ['{{', '}}']
|
|
696
|
+
*/
|
|
725
697
|
delimiters?: [string, string];
|
|
726
698
|
/**
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
699
|
+
* Whitespace handling strategy
|
|
700
|
+
* @default 'condense'
|
|
701
|
+
*/
|
|
730
702
|
whitespace?: "preserve" | "condense";
|
|
731
703
|
/**
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
704
|
+
* Only used for DOM compilers that runs in the browser.
|
|
705
|
+
* In non-browser builds, this option is ignored.
|
|
706
|
+
*/
|
|
735
707
|
decodeEntities?: (rawText: string, asAttr: boolean) => string;
|
|
736
708
|
/**
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
709
|
+
* Whether to keep comments in the templates AST.
|
|
710
|
+
* This defaults to `true` in development and `false` in production builds.
|
|
711
|
+
*/
|
|
740
712
|
comments?: boolean;
|
|
741
713
|
/**
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
714
|
+
* Parse JavaScript expressions with Babel.
|
|
715
|
+
* @default false
|
|
716
|
+
*/
|
|
745
717
|
prefixIdentifiers?: boolean;
|
|
746
718
|
/**
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
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
|
+
*/
|
|
751
723
|
expressionPlugins?: ParserPlugin[];
|
|
752
724
|
}
|
|
753
725
|
export type HoistTransform = (children: TemplateChildNode[], context: TransformContext, parent: ParentNode) => void;
|
|
754
726
|
export declare enum BindingTypes {
|
|
755
727
|
/**
|
|
756
|
-
|
|
757
|
-
|
|
728
|
+
* returned from data()
|
|
729
|
+
*/
|
|
758
730
|
DATA = "data",
|
|
759
731
|
/**
|
|
760
|
-
|
|
761
|
-
|
|
732
|
+
* declared as a prop
|
|
733
|
+
*/
|
|
762
734
|
PROPS = "props",
|
|
763
735
|
/**
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
736
|
+
* a local alias of a `<script setup>` destructured prop.
|
|
737
|
+
* the original is stored in __propsAliases of the bindingMetadata object.
|
|
738
|
+
*/
|
|
767
739
|
PROPS_ALIASED = "props-aliased",
|
|
768
740
|
/**
|
|
769
|
-
|
|
770
|
-
|
|
741
|
+
* a let binding (may or may not be a ref)
|
|
742
|
+
*/
|
|
771
743
|
SETUP_LET = "setup-let",
|
|
772
744
|
/**
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
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
|
+
*/
|
|
777
749
|
SETUP_CONST = "setup-const",
|
|
778
750
|
/**
|
|
779
|
-
|
|
780
|
-
|
|
751
|
+
* a const binding that does not need `unref()`, but may be mutated.
|
|
752
|
+
*/
|
|
781
753
|
SETUP_REACTIVE_CONST = "setup-reactive-const",
|
|
782
754
|
/**
|
|
783
|
-
|
|
784
|
-
|
|
755
|
+
* a const binding that may be a ref.
|
|
756
|
+
*/
|
|
785
757
|
SETUP_MAYBE_REF = "setup-maybe-ref",
|
|
786
758
|
/**
|
|
787
|
-
|
|
788
|
-
|
|
759
|
+
* bindings that are guaranteed to be refs
|
|
760
|
+
*/
|
|
789
761
|
SETUP_REF = "setup-ref",
|
|
790
762
|
/**
|
|
791
|
-
|
|
792
|
-
|
|
763
|
+
* declared by other options, e.g. computed, inject
|
|
764
|
+
*/
|
|
793
765
|
OPTIONS = "options",
|
|
794
766
|
/**
|
|
795
|
-
|
|
796
|
-
|
|
767
|
+
* a literal constant, e.g. 'foo', 1, true
|
|
768
|
+
*/
|
|
797
769
|
LITERAL_CONST = "literal-const"
|
|
798
770
|
}
|
|
799
771
|
export type BindingMetadata = {
|
|
@@ -804,192 +776,192 @@ export type BindingMetadata = {
|
|
|
804
776
|
};
|
|
805
777
|
interface SharedTransformCodegenOptions {
|
|
806
778
|
/**
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
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
|
+
*/
|
|
814
786
|
prefixIdentifiers?: boolean;
|
|
815
787
|
/**
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
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
|
+
*/
|
|
820
792
|
expressionPlugins?: ParserPlugin[];
|
|
821
793
|
/**
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
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
|
+
*/
|
|
831
803
|
ssr?: boolean;
|
|
832
804
|
/**
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
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
|
+
*/
|
|
840
812
|
inSSR?: boolean;
|
|
841
813
|
/**
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
814
|
+
* Optional binding metadata analyzed from script - used to optimize
|
|
815
|
+
* binding access when `prefixIdentifiers` is enabled.
|
|
816
|
+
*/
|
|
845
817
|
bindingMetadata?: BindingMetadata;
|
|
846
818
|
/**
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
819
|
+
* Compile the function for inlining inside setup().
|
|
820
|
+
* This allows the function to directly access setup() local bindings.
|
|
821
|
+
*/
|
|
850
822
|
inline?: boolean;
|
|
851
823
|
/**
|
|
852
|
-
|
|
853
|
-
|
|
824
|
+
* Indicates that transforms and codegen should try to output valid TS code
|
|
825
|
+
*/
|
|
854
826
|
isTS?: boolean;
|
|
855
827
|
/**
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
828
|
+
* Filename for source map generation.
|
|
829
|
+
* Also used for self-recursive reference in templates
|
|
830
|
+
* @default 'template.vue.html'
|
|
831
|
+
*/
|
|
860
832
|
filename?: string;
|
|
861
833
|
}
|
|
862
834
|
export interface TransformOptions extends SharedTransformCodegenOptions, ErrorHandlingOptions, CompilerCompatOptions {
|
|
863
835
|
/**
|
|
864
|
-
|
|
865
|
-
|
|
836
|
+
* An array of node transforms to be applied to every AST node.
|
|
837
|
+
*/
|
|
866
838
|
nodeTransforms?: NodeTransform[];
|
|
867
839
|
/**
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
840
|
+
* An object of { name: transform } to be applied to every directive attribute
|
|
841
|
+
* node found on element nodes.
|
|
842
|
+
*/
|
|
871
843
|
directiveTransforms?: Record<string, DirectiveTransform | undefined>;
|
|
872
844
|
/**
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
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
|
+
*/
|
|
877
849
|
transformHoist?: HoistTransform | null;
|
|
878
850
|
/**
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
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
|
+
*/
|
|
883
855
|
isBuiltInComponent?: (tag: string) => symbol | void;
|
|
884
856
|
/**
|
|
885
|
-
|
|
886
|
-
|
|
857
|
+
* Used by some transforms that expects only native elements
|
|
858
|
+
*/
|
|
887
859
|
isCustomElement?: (tag: string) => boolean | void;
|
|
888
860
|
/**
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
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
|
+
*/
|
|
896
868
|
prefixIdentifiers?: boolean;
|
|
897
869
|
/**
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
870
|
+
* Cache static VNodes and props objects to `_hoisted_x` constants
|
|
871
|
+
* @default false
|
|
872
|
+
*/
|
|
901
873
|
hoistStatic?: boolean;
|
|
902
874
|
/**
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
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
|
+
*/
|
|
914
886
|
cacheHandlers?: boolean;
|
|
915
887
|
/**
|
|
916
|
-
|
|
917
|
-
|
|
888
|
+
* SFC scoped styles ID
|
|
889
|
+
*/
|
|
918
890
|
scopeId?: string | null;
|
|
919
891
|
/**
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
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
|
+
*/
|
|
924
896
|
slotted?: boolean;
|
|
925
897
|
/**
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
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
|
+
*/
|
|
930
902
|
ssrCssVars?: string;
|
|
931
903
|
/**
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
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
|
+
*/
|
|
936
908
|
hmr?: boolean;
|
|
937
909
|
}
|
|
938
910
|
export interface CodegenOptions extends SharedTransformCodegenOptions {
|
|
939
911
|
/**
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
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
|
+
*/
|
|
948
920
|
mode?: "module" | "function";
|
|
949
921
|
/**
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
922
|
+
* Generate source map?
|
|
923
|
+
* @default false
|
|
924
|
+
*/
|
|
953
925
|
sourceMap?: boolean;
|
|
954
926
|
/**
|
|
955
|
-
|
|
956
|
-
|
|
927
|
+
* SFC scoped styles ID
|
|
928
|
+
*/
|
|
957
929
|
scopeId?: string | null;
|
|
958
930
|
/**
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
931
|
+
* Option to optimize helper import bindings via variable assignment
|
|
932
|
+
* (only used for webpack code-split)
|
|
933
|
+
* @default false
|
|
934
|
+
*/
|
|
963
935
|
optimizeImports?: boolean;
|
|
964
936
|
/**
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
937
|
+
* Customize where to import runtime helpers from.
|
|
938
|
+
* @default 'vue'
|
|
939
|
+
*/
|
|
968
940
|
runtimeModuleName?: string;
|
|
969
941
|
/**
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
942
|
+
* Customize where to import ssr runtime helpers from/**
|
|
943
|
+
* @default 'vue/server-renderer'
|
|
944
|
+
*/
|
|
973
945
|
ssrRuntimeModuleName?: string;
|
|
974
946
|
/**
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
947
|
+
* Customize the global variable name of `Vue` to get helpers from
|
|
948
|
+
* in function mode
|
|
949
|
+
* @default 'Vue'
|
|
950
|
+
*/
|
|
979
951
|
runtimeGlobalName?: string;
|
|
980
952
|
}
|
|
981
953
|
export type CompilerOptions = ParserOptions & TransformOptions & CodegenOptions;
|
|
982
954
|
//#endregion
|
|
983
955
|
//#region temp/packages/compiler-core/src/codegen.d.ts
|
|
984
956
|
/**
|
|
985
|
-
* The `SourceMapGenerator` type from `source-map-js` is a bit incomplete as it
|
|
986
|
-
* misses `toJSON()`. We also need to add types for internal properties which we
|
|
987
|
-
* need to access for better performance.
|
|
988
|
-
*
|
|
989
|
-
* Since TS 5.3, dts generation starts to strangely include broken triple slash
|
|
990
|
-
* references for source-map-js, so we are inlining all source map related types
|
|
991
|
-
* here to workaround that.
|
|
992
|
-
*/
|
|
957
|
+
* The `SourceMapGenerator` type from `source-map-js` is a bit incomplete as it
|
|
958
|
+
* misses `toJSON()`. We also need to add types for internal properties which we
|
|
959
|
+
* need to access for better performance.
|
|
960
|
+
*
|
|
961
|
+
* Since TS 5.3, dts generation starts to strangely include broken triple slash
|
|
962
|
+
* references for source-map-js, so we are inlining all source map related types
|
|
963
|
+
* here to workaround that.
|
|
964
|
+
*/
|
|
993
965
|
export interface CodegenSourceMapGenerator {
|
|
994
966
|
setSourceContent(sourceFile: string, sourceContent: string): void;
|
|
995
967
|
toJSON(): RawSourceMap;
|
|
@@ -1067,11 +1039,11 @@ export declare function isCoreComponent(tag: string): symbol | void;
|
|
|
1067
1039
|
export declare const isSimpleIdentifier: (name: string) => boolean;
|
|
1068
1040
|
export declare const validFirstIdentCharRE: RegExp;
|
|
1069
1041
|
/**
|
|
1070
|
-
* Simple lexer to check if an expression is a member expression. This is
|
|
1071
|
-
* lax and only checks validity at the root level (i.e. does not validate exps
|
|
1072
|
-
* inside square brackets), but it's ok since these are only used on template
|
|
1073
|
-
* expressions and false positives are invalid expressions in the first place.
|
|
1074
|
-
*/
|
|
1042
|
+
* Simple lexer to check if an expression is a member expression. This is
|
|
1043
|
+
* lax and only checks validity at the root level (i.e. does not validate exps
|
|
1044
|
+
* inside square brackets), but it's ok since these are only used on template
|
|
1045
|
+
* expressions and false positives are invalid expressions in the first place.
|
|
1046
|
+
*/
|
|
1075
1047
|
export declare const isMemberExpressionBrowser: (exp: ExpressionNode) => boolean;
|
|
1076
1048
|
export declare const isMemberExpressionNode: (exp: ExpressionNode, context: Pick<TransformContext, "expressionPlugins">) => boolean;
|
|
1077
1049
|
export declare const isMemberExpression: (exp: ExpressionNode, context: Pick<TransformContext, "expressionPlugins">) => boolean;
|
|
@@ -1105,8 +1077,8 @@ export declare function isCommentOrWhitespace(node: TemplateChildNode): boolean;
|
|
|
1105
1077
|
//#endregion
|
|
1106
1078
|
//#region temp/packages/compiler-core/src/babelUtils.d.ts
|
|
1107
1079
|
/**
|
|
1108
|
-
* Return value indicates whether the AST walked can be a constant
|
|
1109
|
-
*/
|
|
1080
|
+
* Return value indicates whether the AST walked can be a constant
|
|
1081
|
+
*/
|
|
1110
1082
|
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;
|
|
1111
1083
|
export declare function isReferencedIdentifier(id: Identifier, parent: Node$1 | null, parentStack: Node$1[]): boolean;
|
|
1112
1084
|
export declare function isInDestructureAssignment(parent: Node$1, parentStack: Node$1[]): boolean;
|
|
@@ -1139,11 +1111,7 @@ export declare function processIf(node: ElementNode, dir: DirectiveNode, context
|
|
|
1139
1111
|
//#endregion
|
|
1140
1112
|
//#region temp/packages/compiler-core/src/transforms/vFor.d.ts
|
|
1141
1113
|
export declare function processFor(node: ElementNode, dir: DirectiveNode, context: TransformContext, processCodegen?: (forNode: ForNode) => (() => void) | undefined): (() => void) | undefined;
|
|
1142
|
-
export declare function createForLoopParams({
|
|
1143
|
-
value,
|
|
1144
|
-
key,
|
|
1145
|
-
index
|
|
1146
|
-
}: ForParseResult, memoArgs?: ExpressionNode[]): ExpressionNode[];
|
|
1114
|
+
export declare function createForLoopParams({ value, key, index }: ForParseResult, memoArgs?: ExpressionNode[]): ExpressionNode[];
|
|
1147
1115
|
//#endregion
|
|
1148
1116
|
//#region temp/packages/compiler-core/src/transforms/transformExpression.d.ts
|
|
1149
1117
|
export declare const isLiteralWhitelisted: (key: string) => boolean;
|
|
@@ -1173,4 +1141,4 @@ export declare function processSlotOutlet(node: SlotOutletNode, context: Transfo
|
|
|
1173
1141
|
//#region temp/packages/compiler-core/src/transforms/cacheStatic.d.ts
|
|
1174
1142
|
export declare function getConstantType(node: TemplateChildNode | SimpleExpressionNode | CacheExpression, context: TransformContext): ConstantTypes;
|
|
1175
1143
|
//#endregion
|
|
1176
|
-
export { generateCodeFrame
|
|
1144
|
+
export { generateCodeFrame };
|