@@ -6,7 +6,8 @@ declare type CompilerOptions = {
6
6
isUnaryTag ?: ( tag : string ) => ?boolean ; // check if a tag is unary for the platform
7
7
canBeLeftOpenTag ?: ( tag : string ) => ?boolean ; // check if a tag can be left opened
8
8
isReservedTag ?: ( tag : string ) => ?boolean ; // check if a tag is a native for the platform
9
- preserveWhitespace ?: boolean ; // preserve whitespace between elements?
9
+ preserveWhitespace ?: boolean ; // preserve whitespace between elements? (Deprecated)
10
+ whitespace ? : 'preserve' | 'condense' ; // whitespace handling strategy
10
11
optimize ? : boolean ; // optimize static content?
11
12
12
13
// web specific
@@ -18,6 +19,7 @@ declare type CompilerOptions = {
18
19
shouldDecodeTags ? : boolean ;
19
20
shouldDecodeNewlines ? : boolean ;
20
21
shouldDecodeNewlinesForHref ? : boolean ;
22
+ outputSourceRange ? : boolean ;
21
23
22
24
// runtime user-configurable
23
25
delimiters ? : [ string , string ] ; // template delimiters
@@ -27,13 +29,19 @@ declare type CompilerOptions = {
27
29
scopeId ? : string ;
28
30
} ;
29
31
32
+ declare type WarningMessage = {
33
+ msg : string ;
34
+ start ? : number ;
35
+ end ? : number ;
36
+ } ;
37
+
30
38
declare type CompiledResult = {
31
39
ast : ?ASTElement ;
32
40
render: string ;
33
41
staticRenderFns: Array < string > ;
34
42
stringRenderFns ?: Array < string > ;
35
- errors ?: Array < string > ;
36
- tips ?: Array < string > ;
43
+ errors ?: Array < string | WarningMessage > ;
44
+ tips ?: Array < string | WarningMessage > ;
37
45
} ;
38
46
39
47
declare type ModuleOptions = {
@@ -53,11 +61,14 @@ declare type ModuleOptions = {
53
61
declare type ASTModifiers = { [ key : string ] : boolean } ;
54
62
declare type ASTIfCondition = { exp : ?string ; block : ASTElement } ;
55
63
declare type ASTIfConditions = Array < ASTIfCondition > ;
64
+ declare type ASTAttr = { name : string ; value : any ; start ?: number ; end ?: number } ;
56
65
57
66
declare type ASTElementHandler = {
58
67
value : string ;
59
68
params ?: Array < any > ;
60
69
modifiers : ?ASTModifiers ;
70
+ start ?: number ;
71
+ end ?: number ;
61
72
} ;
62
73
63
74
declare type ASTElementHandlers = {
@@ -70,18 +81,24 @@ declare type ASTDirective = {
70
81
value : string ;
71
82
arg : ?string ;
72
83
modifiers : ?ASTModifiers ;
84
+ start ?: number ;
85
+ end ?: number ;
73
86
} ;
74
87
75
- declare type ASTNode = ASTElement | ASTText | ASTExpression ;
88
+ declare type ASTNode = ASTElement | ASTText | ASTExpression
76
89
77
90
declare type ASTElement = {
78
91
type : 1 ;
79
92
tag : string ;
80
- attrsList : Array < { name : string ; value : any } > ;
93
+ attrsList : Array < ASTAttr > ;
81
94
attrsMap : { [ key : string ] : any } ;
95
+ rawAttrsMap : { [ key : string ] : ASTAttr } ;
82
96
parent : ASTElement | void ;
83
97
children : Array < ASTNode > ;
84
98
99
+ start ? : number ;
100
+ end ? : number ;
101
+
85
102
processed ? : true ;
86
103
87
104
static ? : boolean ;
@@ -91,8 +108,8 @@ declare type ASTElement = {
91
108
hasBindings ? : boolean ;
92
109
93
110
text ? : string ;
94
- attrs ?: Array < { name : string ; value : any } > ;
95
- props ?: Array < { name : string ; value : string } > ;
111
+ attrs ?: Array < ASTAttr > ;
112
+ props ?: Array < ASTAttr > ;
96
113
plain ? : boolean ;
97
114
pre ? : true ;
98
115
ns ? : string ;
@@ -150,6 +167,9 @@ declare type ASTElement = {
150
167
151
168
// weex specific
152
169
appendAsTree ? : boolean ;
170
+
171
+ // 2.6 $slot check
172
+ has$Slot ? : boolean
153
173
} ;
154
174
155
175
declare type ASTExpression = {
@@ -160,6 +180,10 @@ declare type ASTExpression = {
160
180
static ? : boolean ;
161
181
// 2.4 ssr optimization
162
182
ssrOptimizability ? : number ;
183
+ start ? : number ;
184
+ end ? : number ;
185
+ // 2.6 $slot check
186
+ has$Slot ? : boolean
163
187
} ;
164
188
165
189
declare type ASTText = {
@@ -169,6 +193,10 @@ declare type ASTText = {
169
193
isComment ? : boolean ;
170
194
// 2.4 ssr optimization
171
195
ssrOptimizability ? : number ;
196
+ start ? : number ;
197
+ end ? : number ;
198
+ // 2.6 $slot check
199
+ has$Slot ? : boolean
172
200
} ;
173
201
174
202
// SFC-parser related declarations
@@ -179,7 +207,8 @@ declare type SFCDescriptor = {
179
207
script: ?SFCBlock ;
180
208
styles: Array < SFCBlock > ;
181
209
customBlocks: Array < SFCBlock > ;
182
- } ;
210
+ errors: Array < string | WarningMessage > ;
211
+ }
183
212
184
213
declare type SFCBlock = {
185
214
type : string ;
0 commit comments