@@ -6,7 +6,8 @@ declare type CompilerOptions = {
66 isUnaryTag ?: ( tag : string ) => ?boolean ; // check if a tag is unary for the platform
77 canBeLeftOpenTag ?: ( tag : string ) => ?boolean ; // check if a tag can be left opened
88 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
1011 optimize ? : boolean ; // optimize static content?
1112
1213 // web specific
@@ -18,6 +19,7 @@ declare type CompilerOptions = {
1819 shouldDecodeTags ? : boolean ;
1920 shouldDecodeNewlines ? : boolean ;
2021 shouldDecodeNewlinesForHref ? : boolean ;
22+ outputSourceRange ? : boolean ;
2123
2224 // runtime user-configurable
2325 delimiters ? : [ string , string ] ; // template delimiters
@@ -27,13 +29,19 @@ declare type CompilerOptions = {
2729 scopeId ? : string ;
2830} ;
2931
32+ declare type WarningMessage = {
33+ msg : string ;
34+ start ? : number ;
35+ end ? : number ;
36+ } ;
37+
3038declare type CompiledResult = {
3139 ast : ?ASTElement ;
3240 render: string ;
3341 staticRenderFns: Array < string > ;
3442 stringRenderFns ?: Array < string > ;
35- errors ?: Array < string > ;
36- tips ?: Array < string > ;
43+ errors ?: Array < string | WarningMessage > ;
44+ tips ?: Array < string | WarningMessage > ;
3745} ;
3846
3947declare type ModuleOptions = {
@@ -53,11 +61,14 @@ declare type ModuleOptions = {
5361declare type ASTModifiers = { [ key : string ] : boolean } ;
5462declare type ASTIfCondition = { exp : ?string ; block : ASTElement } ;
5563declare type ASTIfConditions = Array < ASTIfCondition > ;
64+ declare type ASTAttr = { name : string ; value : any ; start ?: number ; end ?: number } ;
5665
5766declare type ASTElementHandler = {
5867 value : string ;
5968 params ?: Array < any > ;
6069 modifiers : ?ASTModifiers ;
70+ start ?: number ;
71+ end ?: number ;
6172} ;
6273
6374declare type ASTElementHandlers = {
@@ -70,18 +81,24 @@ declare type ASTDirective = {
7081 value : string ;
7182 arg : ?string ;
7283 modifiers : ?ASTModifiers ;
84+ start ?: number ;
85+ end ?: number ;
7386} ;
7487
75- declare type ASTNode = ASTElement | ASTText | ASTExpression ;
88+ declare type ASTNode = ASTElement | ASTText | ASTExpression
7689
7790declare type ASTElement = {
7891 type : 1 ;
7992 tag : string ;
80- attrsList : Array < { name : string ; value : any } > ;
93+ attrsList : Array < ASTAttr > ;
8194 attrsMap : { [ key : string ] : any } ;
95+ rawAttrsMap : { [ key : string ] : ASTAttr } ;
8296 parent : ASTElement | void ;
8397 children : Array < ASTNode > ;
8498
99+ start ? : number ;
100+ end ? : number ;
101+
85102 processed ? : true ;
86103
87104 static ? : boolean ;
@@ -91,8 +108,8 @@ declare type ASTElement = {
91108 hasBindings ? : boolean ;
92109
93110 text ? : string ;
94- attrs ?: Array < { name : string ; value : any } > ;
95- props ?: Array < { name : string ; value : string } > ;
111+ attrs ?: Array < ASTAttr > ;
112+ props ?: Array < ASTAttr > ;
96113 plain ? : boolean ;
97114 pre ? : true ;
98115 ns ? : string ;
@@ -150,6 +167,9 @@ declare type ASTElement = {
150167
151168 // weex specific
152169 appendAsTree ? : boolean ;
170+
171+ // 2.6 $slot check
172+ has$Slot ? : boolean
153173} ;
154174
155175declare type ASTExpression = {
@@ -160,6 +180,10 @@ declare type ASTExpression = {
160180 static ? : boolean ;
161181 // 2.4 ssr optimization
162182 ssrOptimizability ? : number ;
183+ start ? : number ;
184+ end ? : number ;
185+ // 2.6 $slot check
186+ has$Slot ? : boolean
163187} ;
164188
165189declare type ASTText = {
@@ -169,6 +193,10 @@ declare type ASTText = {
169193 isComment ? : boolean ;
170194 // 2.4 ssr optimization
171195 ssrOptimizability ? : number ;
196+ start ? : number ;
197+ end ? : number ;
198+ // 2.6 $slot check
199+ has$Slot ? : boolean
172200} ;
173201
174202// SFC-parser related declarations
@@ -179,7 +207,8 @@ declare type SFCDescriptor = {
179207 script: ?SFCBlock ;
180208 styles: Array < SFCBlock > ;
181209 customBlocks: Array < SFCBlock > ;
182- } ;
210+ errors: Array < string | WarningMessage > ;
211+ }
183212
184213declare type SFCBlock = {
185214 type : string ;
0 commit comments