@vue/compiler-core 3.4.0-alpha.3 → 3.4.0-beta.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.
- package/dist/compiler-core.cjs.js +658 -371
- package/dist/compiler-core.cjs.prod.js +658 -369
- package/dist/compiler-core.d.ts +38 -15
- package/dist/compiler-core.esm-bundler.js +384 -144
- package/package.json +4 -4
package/dist/compiler-core.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Node as Node$1, Identifier, Function, BlockStatement as BlockStatement$1, Program, ObjectProperty } from '@babel/types';
|
|
1
2
|
import { ParserPlugin } from '@babel/parser';
|
|
2
3
|
import { RawSourceMap, SourceMapGenerator } from 'source-map-js';
|
|
3
|
-
import { Node as Node$1, Identifier, Function, BlockStatement as BlockStatement$1, Program, ObjectProperty } from '@babel/types';
|
|
4
4
|
export { generateCodeFrame } from '@vue/shared';
|
|
5
5
|
|
|
6
6
|
export declare const FRAGMENT: unique symbol;
|
|
@@ -45,7 +45,7 @@ export declare const IS_MEMO_SAME: unique symbol;
|
|
|
45
45
|
export declare const helperNameMap: Record<symbol, string>;
|
|
46
46
|
export declare function registerRuntimeHelpers(helpers: Record<symbol, string>): void;
|
|
47
47
|
|
|
48
|
-
type OptionalOptions = 'decodeEntities' | 'whitespace' | 'isNativeTag' | 'isBuiltInComponent' | keyof CompilerCompatOptions;
|
|
48
|
+
type OptionalOptions = 'decodeEntities' | 'whitespace' | 'isNativeTag' | 'isBuiltInComponent' | 'expressionPlugins' | keyof CompilerCompatOptions;
|
|
49
49
|
type MergedParserOptions = Omit<Required<ParserOptions>, OptionalOptions> & Pick<ParserOptions, OptionalOptions>;
|
|
50
50
|
export declare function baseParse(input: string, options?: ParserOptions): RootNode;
|
|
51
51
|
|
|
@@ -55,7 +55,7 @@ type CompilerCompatConfig = Partial<Record<CompilerDeprecationTypes, boolean | '
|
|
|
55
55
|
interface CompilerCompatOptions {
|
|
56
56
|
compatConfig?: CompilerCompatConfig;
|
|
57
57
|
}
|
|
58
|
-
export declare
|
|
58
|
+
export declare enum CompilerDeprecationTypes {
|
|
59
59
|
COMPILER_IS_ON_ELEMENT = "COMPILER_IS_ON_ELEMENT",
|
|
60
60
|
COMPILER_V_BIND_SYNC = "COMPILER_V_BIND_SYNC",
|
|
61
61
|
COMPILER_V_BIND_OBJECT_ORDER = "COMPILER_V_BIND_OBJECT_ORDER",
|
|
@@ -80,7 +80,7 @@ interface ImportItem {
|
|
|
80
80
|
exp: string | ExpressionNode;
|
|
81
81
|
path: string;
|
|
82
82
|
}
|
|
83
|
-
export interface TransformContext extends Required<Omit<TransformOptions,
|
|
83
|
+
export interface TransformContext extends Required<Omit<TransformOptions, keyof CompilerCompatOptions>>, CompilerCompatOptions {
|
|
84
84
|
selfName: string | null;
|
|
85
85
|
root: RootNode;
|
|
86
86
|
helpers: Map<symbol, number>;
|
|
@@ -134,12 +134,12 @@ export declare function buildProps(node: ElementNode, context: TransformContext,
|
|
|
134
134
|
export declare function buildDirectiveArgs(dir: DirectiveNode, context: TransformContext): ArrayExpression;
|
|
135
135
|
|
|
136
136
|
export type Namespace = number;
|
|
137
|
-
export declare
|
|
137
|
+
export declare enum Namespaces {
|
|
138
138
|
HTML = 0,
|
|
139
139
|
SVG = 1,
|
|
140
140
|
MATH_ML = 2
|
|
141
141
|
}
|
|
142
|
-
export declare
|
|
142
|
+
export declare enum NodeTypes {
|
|
143
143
|
ROOT = 0,
|
|
144
144
|
ELEMENT = 1,
|
|
145
145
|
TEXT = 2,
|
|
@@ -168,7 +168,7 @@ export declare const enum NodeTypes {
|
|
|
168
168
|
JS_SEQUENCE_EXPRESSION = 25,
|
|
169
169
|
JS_RETURN_STATEMENT = 26
|
|
170
170
|
}
|
|
171
|
-
export declare
|
|
171
|
+
export declare enum ElementTypes {
|
|
172
172
|
ELEMENT = 0,
|
|
173
173
|
COMPONENT = 1,
|
|
174
174
|
SLOT = 2,
|
|
@@ -275,7 +275,7 @@ export interface DirectiveNode extends Node {
|
|
|
275
275
|
* Higher levels implies lower levels. e.g. a node that can be stringified
|
|
276
276
|
* can always be hoisted and skipped for patch.
|
|
277
277
|
*/
|
|
278
|
-
export declare
|
|
278
|
+
export declare enum ConstantTypes {
|
|
279
279
|
NOT_CONSTANT = 0,
|
|
280
280
|
CAN_SKIP_PATCH = 1,
|
|
281
281
|
CAN_HOIST = 2,
|
|
@@ -286,6 +286,12 @@ export interface SimpleExpressionNode extends Node {
|
|
|
286
286
|
content: string;
|
|
287
287
|
isStatic: boolean;
|
|
288
288
|
constType: ConstantTypes;
|
|
289
|
+
/**
|
|
290
|
+
* - `null` means the expression is a simple identifier that doesn't need
|
|
291
|
+
* parsing
|
|
292
|
+
* - `false` means there was a parsing error
|
|
293
|
+
*/
|
|
294
|
+
ast?: Node$1 | null | false;
|
|
289
295
|
/**
|
|
290
296
|
* Indicates this is an identifier for a hoist vnode call and points to the
|
|
291
297
|
* hoisted node.
|
|
@@ -304,6 +310,12 @@ export interface InterpolationNode extends Node {
|
|
|
304
310
|
}
|
|
305
311
|
export interface CompoundExpressionNode extends Node {
|
|
306
312
|
type: NodeTypes.COMPOUND_EXPRESSION;
|
|
313
|
+
/**
|
|
314
|
+
* - `null` means the expression is a simple identifier that doesn't need
|
|
315
|
+
* parsing
|
|
316
|
+
* - `false` means there was a parsing error
|
|
317
|
+
*/
|
|
318
|
+
ast?: Node$1 | null | false;
|
|
307
319
|
children: (SimpleExpressionNode | CompoundExpressionNode | InterpolationNode | TextNode | string | symbol)[];
|
|
308
320
|
/**
|
|
309
321
|
* an expression parsed as the params of a function will track
|
|
@@ -547,7 +559,7 @@ type InferCompilerError<T> = T extends ErrorCodes ? CoreCompilerError : Compiler
|
|
|
547
559
|
export declare function createCompilerError<T extends number>(code: T, loc?: SourceLocation, messages?: {
|
|
548
560
|
[code: number]: string;
|
|
549
561
|
}, additionalMessage?: string): InferCompilerError<T>;
|
|
550
|
-
export declare
|
|
562
|
+
export declare enum ErrorCodes {
|
|
551
563
|
ABRUPT_CLOSING_OF_EMPTY_COMMENT = 0,
|
|
552
564
|
CDATA_IN_HTML_CONTENT = 1,
|
|
553
565
|
DUPLICATE_ATTRIBUTE = 2,
|
|
@@ -599,9 +611,8 @@ export declare const enum ErrorCodes {
|
|
|
599
611
|
X_MODULE_MODE_NOT_SUPPORTED = 48,
|
|
600
612
|
X_CACHE_HANDLER_NOT_SUPPORTED = 49,
|
|
601
613
|
X_SCOPE_ID_NOT_SUPPORTED = 50,
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
__EXTEND_POINT__ = 53
|
|
614
|
+
X_VNODE_HOOKS = 51,
|
|
615
|
+
__EXTEND_POINT__ = 52
|
|
605
616
|
}
|
|
606
617
|
export declare const errorMessages: Record<ErrorCodes, string>;
|
|
607
618
|
|
|
@@ -624,8 +635,8 @@ export interface ParserOptions extends ErrorHandlingOptions, CompilerCompatOptio
|
|
|
624
635
|
*/
|
|
625
636
|
parseMode?: 'base' | 'html' | 'sfc';
|
|
626
637
|
/**
|
|
627
|
-
* Specify the root
|
|
628
|
-
* Defaults to `
|
|
638
|
+
* Specify the root namespace to use when parsing a template.
|
|
639
|
+
* Defaults to `Namespaces.HTML` (0).
|
|
629
640
|
*/
|
|
630
641
|
ns?: Namespaces;
|
|
631
642
|
/**
|
|
@@ -670,9 +681,20 @@ export interface ParserOptions extends ErrorHandlingOptions, CompilerCompatOptio
|
|
|
670
681
|
* This defaults to `true` in development and `false` in production builds.
|
|
671
682
|
*/
|
|
672
683
|
comments?: boolean;
|
|
684
|
+
/**
|
|
685
|
+
* Parse JavaScript expressions with Babel.
|
|
686
|
+
* @default false
|
|
687
|
+
*/
|
|
688
|
+
prefixIdentifiers?: boolean;
|
|
689
|
+
/**
|
|
690
|
+
* A list of parser plugins to enable for `@babel/parser`, which is used to
|
|
691
|
+
* parse expressions in bindings and interpolations.
|
|
692
|
+
* https://babeljs.io/docs/en/next/babel-parser#plugins
|
|
693
|
+
*/
|
|
694
|
+
expressionPlugins?: ParserPlugin[];
|
|
673
695
|
}
|
|
674
696
|
export type HoistTransform = (children: TemplateChildNode[], context: TransformContext, parent: ParentNode) => void;
|
|
675
|
-
export declare
|
|
697
|
+
export declare enum BindingTypes {
|
|
676
698
|
/**
|
|
677
699
|
* returned from data()
|
|
678
700
|
*/
|
|
@@ -973,6 +995,7 @@ export declare const isFunctionType: (node: Node$1) => node is Function;
|
|
|
973
995
|
export declare const isStaticProperty: (node: Node$1) => node is ObjectProperty;
|
|
974
996
|
export declare const isStaticPropertyKey: (node: Node$1, parent: Node$1) => boolean;
|
|
975
997
|
export declare const TS_NODE_TYPES: string[];
|
|
998
|
+
export declare function unwrapTSNode(node: Node$1): Node$1;
|
|
976
999
|
|
|
977
1000
|
export declare const transformModel: DirectiveTransform;
|
|
978
1001
|
|