|
1 | 1 | declare type CompilerOptions = { |
2 | | - warn?: Function, // allow customizing warning in different environments, e.g. node |
3 | | - isIE?: boolean, // for detecting IE SVG innerHTML bug |
4 | | - expectHTML?: boolean, // only false for non-web builds |
5 | | - modules?: Array<ModuleOptions>, // platform specific modules, e.g. style, class |
6 | | - staticKeys?: string, // a list of AST properties to be considered static, for optimization |
7 | | - directives?: { [key: string]: Function }, // platform specific directives |
8 | | - isUnaryTag?: (tag: string) => ?boolean, // check if a tag is unary for the platform |
9 | | - isReservedTag?: (tag: string) => ?boolean, // check if a tag is a native for the platform |
10 | | - mustUseProp?: (attr: string) => ?boolean, // check if an attribute should be bound as a property |
11 | | - getTagNamespace?: (tag: string) => ?string, // check the namespace for a tag |
12 | | - transforms?: Array<Function>, // a list of transforms on parsed AST before codegen |
13 | | - preserveWhitespace?: boolean, |
| 2 | + warn?: Function; // allow customizing warning in different environments; e.g. node |
| 3 | + isIE?: boolean; // for detecting IE SVG innerHTML bug |
| 4 | + expectHTML?: boolean; // only false for non-web builds |
| 5 | + modules?: Array<ModuleOptions>; // platform specific modules; e.g. style; class |
| 6 | + staticKeys?: string; // a list of AST properties to be considered static; for optimization |
| 7 | + directives?: { [key: string]: Function }; // platform specific directives |
| 8 | + isUnaryTag?: (tag: string) => ?boolean; // check if a tag is unary for the platform |
| 9 | + isReservedTag?: (tag: string) => ?boolean; // check if a tag is a native for the platform |
| 10 | + mustUseProp?: (attr: string) => ?boolean; // check if an attribute should be bound as a property |
| 11 | + getTagNamespace?: (tag: string) => ?string; // check the namespace for a tag |
| 12 | + transforms?: Array<Function>; // a list of transforms on parsed AST before codegen |
| 13 | + preserveWhitespace?: boolean; |
| 14 | + shouldDecodeAttr?: boolean; |
14 | 15 |
|
15 | 16 | // runtime user-configurable |
16 | | - delimiters?: [string, string] // template delimiters |
| 17 | + delimiters?: [string, string]; // template delimiters |
17 | 18 | } |
18 | 19 |
|
19 | 20 | declare type CompiledResult = { |
20 | | - ast: ?ASTElement, |
21 | | - render: string, |
22 | | - staticRenderFns: Array<string>, |
23 | | - errors?: Array<string> |
| 21 | + ast: ?ASTElement; |
| 22 | + render: string; |
| 23 | + staticRenderFns: Array<string>; |
| 24 | + errors?: Array<string>; |
24 | 25 | } |
25 | 26 |
|
26 | 27 | declare type CompiledFunctionResult = { |
27 | | - render: Function, |
28 | | - staticRenderFns: Array<Function> |
| 28 | + render: Function; |
| 29 | + staticRenderFns: Array<Function>; |
29 | 30 | } |
30 | 31 |
|
31 | 32 | declare type ModuleOptions = { |
32 | | - transformNode: (el: ASTElement) => void, // transform an element's AST node |
33 | | - genData: (el: ASTElement) => string, // generate extra data string for an element |
34 | | - transformCode?: (el: ASTElement, code: string) => string, // further transform generated code for an element |
35 | | - staticKeys?: Array<string> // AST properties to be considered static |
| 33 | + transformNode: (el: ASTElement) => void; // transform an element's AST node |
| 34 | + genData: (el: ASTElement) => string; // generate extra data string for an element |
| 35 | + transformCode?: (el: ASTElement, code: string) => string; // further transform generated code for an element |
| 36 | + staticKeys?: Array<string>; // AST properties to be considered static |
36 | 37 | } |
37 | 38 |
|
38 | 39 | declare type ASTElementHandler = { |
39 | | - value: string, |
40 | | - modifiers: ?{ [key: string]: true } |
| 40 | + value: string; |
| 41 | + modifiers: ?{ [key: string]: true }; |
41 | 42 | } |
42 | 43 |
|
43 | 44 | declare type ASTElementHandlers = { |
44 | | - [key: string]: ASTElementHandler | Array<ASTElementHandler> |
| 45 | + [key: string]: ASTElementHandler | Array<ASTElementHandler>; |
45 | 46 | } |
46 | 47 |
|
47 | 48 | declare type ASTElementHooks = { [key: string]: Array<string> } |
48 | 49 |
|
49 | 50 | declare type ASTDirective = { |
50 | | - name: string, |
51 | | - value: ?string, |
52 | | - arg: ?string, |
53 | | - modifiers: ?{ [key: string]: true } |
| 51 | + name: string; |
| 52 | + value: ?string; |
| 53 | + arg: ?string; |
| 54 | + modifiers: ?{ [key: string]: true }; |
54 | 55 | } |
55 | 56 |
|
56 | 57 | declare type ASTNode = ASTElement | ASTText | ASTExpression |
57 | 58 |
|
58 | 59 | declare type ASTElement = { |
59 | | - type: 1, |
60 | | - tag: string, |
61 | | - attrsList: Array<{ name: string, value: string }>, |
62 | | - attrsMap: { [key: string]: string | null }, |
63 | | - parent: ASTElement | void, |
64 | | - children: Array<ASTNode>, |
65 | | - |
66 | | - static?: boolean, |
67 | | - staticRoot?: boolean, |
68 | | - staticProcessed?: boolean, |
69 | | - |
70 | | - text?: string, |
71 | | - attrs?: Array<{ name: string, value: string }>, |
72 | | - props?: Array<{ name: string, value: string }>, |
73 | | - staticAttrs?: Array<{ name: string, value: string }>, |
74 | | - plain?: boolean, |
75 | | - pre?: true, |
76 | | - ns?: string, |
77 | | - |
78 | | - component?: string, |
79 | | - keepAlive?: boolean, |
80 | | - inlineTemplate?: true, |
81 | | - transitionMode?: string | null, |
82 | | - slotName?: ?string, |
83 | | - slotTarget?: ?string, |
84 | | - |
85 | | - ref?: string, |
86 | | - refInFor?: boolean, |
87 | | - |
88 | | - if?: string, |
89 | | - ifProcessed?: boolean, |
90 | | - else?: true, |
91 | | - elseBlock?: ASTElement, |
92 | | - |
93 | | - for?: string, |
94 | | - forProcessed?: boolean, |
95 | | - key?: string, |
96 | | - alias?: string, |
97 | | - iterator1?: string, |
98 | | - iterator2?: string, |
99 | | - |
100 | | - staticClass?: string, |
101 | | - classBinding?: string, |
102 | | - styleBinding?: string, |
103 | | - hooks?: ASTElementHooks, |
104 | | - events?: ASTElementHandlers, |
105 | | - nativeEvents?: ASTElementHandlers, |
106 | | - |
107 | | - transition?: string | true, |
108 | | - transitionOnAppear?: boolean, |
109 | | - |
110 | | - directives?: Array<ASTDirective>, |
111 | | - |
112 | | - forbidden?: true, |
113 | | - once?: true |
| 60 | + type: 1; |
| 61 | + tag: string; |
| 62 | + attrsList: Array<{ name: string; value: string }>; |
| 63 | + attrsMap: { [key: string]: string | null }; |
| 64 | + parent: ASTElement | void; |
| 65 | + children: Array<ASTNode>; |
| 66 | + |
| 67 | + static?: boolean; |
| 68 | + staticRoot?: boolean; |
| 69 | + staticProcessed?: boolean; |
| 70 | + |
| 71 | + text?: string; |
| 72 | + attrs?: Array<{ name: string; value: string }>; |
| 73 | + props?: Array<{ name: string; value: string }>; |
| 74 | + staticAttrs?: Array<{ name: string; value: string }>; |
| 75 | + plain?: boolean; |
| 76 | + pre?: true; |
| 77 | + ns?: string; |
| 78 | + |
| 79 | + component?: string; |
| 80 | + keepAlive?: boolean; |
| 81 | + inlineTemplate?: true; |
| 82 | + transitionMode?: string | null; |
| 83 | + slotName?: ?string; |
| 84 | + slotTarget?: ?string; |
| 85 | + |
| 86 | + ref?: string; |
| 87 | + refInFor?: boolean; |
| 88 | + |
| 89 | + if?: string; |
| 90 | + ifProcessed?: boolean; |
| 91 | + else?: true; |
| 92 | + elseBlock?: ASTElement; |
| 93 | + |
| 94 | + for?: string; |
| 95 | + forProcessed?: boolean; |
| 96 | + key?: string; |
| 97 | + alias?: string; |
| 98 | + iterator1?: string; |
| 99 | + iterator2?: string; |
| 100 | + |
| 101 | + staticClass?: string; |
| 102 | + classBinding?: string; |
| 103 | + styleBinding?: string; |
| 104 | + hooks?: ASTElementHooks; |
| 105 | + events?: ASTElementHandlers; |
| 106 | + nativeEvents?: ASTElementHandlers; |
| 107 | + |
| 108 | + transition?: string | true; |
| 109 | + transitionOnAppear?: boolean; |
| 110 | + |
| 111 | + directives?: Array<ASTDirective>; |
| 112 | + |
| 113 | + forbidden?: true; |
| 114 | + once?: true; |
114 | 115 | } |
115 | 116 |
|
116 | 117 | declare type ASTExpression = { |
117 | | - type: 2, |
118 | | - expression: string, |
119 | | - text: string, |
120 | | - static?: boolean |
| 118 | + type: 2; |
| 119 | + expression: string; |
| 120 | + text: string; |
| 121 | + static?: boolean; |
121 | 122 | } |
122 | 123 |
|
123 | 124 | declare type ASTText = { |
124 | | - type: 3, |
125 | | - text: string, |
126 | | - static?: boolean |
| 125 | + type: 3; |
| 126 | + text: string; |
| 127 | + static?: boolean; |
127 | 128 | } |
128 | 129 |
|
129 | 130 | // SFC-parser related declarations |
130 | 131 |
|
131 | 132 | // an object format describing a single-file component. |
132 | 133 | declare type SFCDescriptor = { |
133 | | - template: ?SFCBlock, |
134 | | - script: ?SFCBlock, |
135 | | - styles: Array<SFCBlock> |
| 134 | + template: ?SFCBlock; |
| 135 | + script: ?SFCBlock; |
| 136 | + styles: Array<SFCBlock>; |
136 | 137 | } |
137 | 138 |
|
138 | 139 | declare type SFCBlock = { |
139 | | - type: string, |
140 | | - content: string, |
141 | | - start?: number, |
142 | | - end?: number, |
143 | | - lang?: string, |
144 | | - src?: string, |
145 | | - scoped?: boolean |
| 140 | + type: string; |
| 141 | + content: string; |
| 142 | + start?: number; |
| 143 | + end?: number; |
| 144 | + lang?: string; |
| 145 | + src?: string; |
| 146 | + scoped?: boolean; |
146 | 147 | } |
0 commit comments