Skip to content

Commit b6fb485

Browse files
committed
rename compiler module export names
1 parent 026198c commit b6fb485

File tree

6 files changed

+29
-26
lines changed

6 files changed

+29
-26
lines changed

flow/compiler.js

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
declare type CompilerOptions = {
2-
warn?: Function,
3-
isIE?: boolean,
4-
expectHTML?: boolean,
5-
preserveWhitespace?: boolean,
6-
modules?: Array<ModuleOptions>,
7-
staticKeys?: string,
8-
directives?: { [key: string]: Function },
9-
isUnaryTag?: (tag: string) => ?boolean,
10-
isReservedTag?: (tag: string) => ?boolean,
11-
mustUseProp?: (attr: string) => ?boolean,
12-
getTagNamespace?: (tag: string) => ?string,
13-
delimiters?: [string, string]
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+
14+
// runtime user-configurable
15+
preserveWhitespace?: boolean, // whether to keep whitespaces between elements
16+
delimiters?: [string, string] // template delimiters
1417
}
1518

1619
declare type ModuleOptions = {
17-
staticKeys?: Array<string>,
18-
parse: (el: ASTElement) => void,
19-
genData: (el: ASTElement) => string,
20-
transformElement?: (el: ASTElement, code: string) => string
20+
transformNode: (el: ASTElement) => void, // transform an element's AST node
21+
genData: (el: ASTElement) => string, // generate extra data string for an element
22+
transformCode?: (el: ASTElement, code: string) => string, // further transform generated code for an element
23+
staticKeys?: Array<string> // AST properties to be considered static
2124
}
2225

2326
declare type ASTElementHandler = {

src/compiler/codegen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function genElement (el: ASTElement): string {
7474
}
7575
// platform modules
7676
for (let i = 0; i < platformModules.length; i++) {
77-
const transform = platformModules[i].transformElement
77+
const transform = platformModules[i].transformCode
7878
if (transform) {
7979
code = transform(el, code)
8080
}

src/compiler/parser/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export function parse (
116116
processSlot(element)
117117
processComponent(element)
118118
for (let i = 0; i < platformModules.length; i++) {
119-
platformModules[i].parse(element, options)
119+
platformModules[i].transformNode(element, options)
120120
}
121121
processAttrs(element)
122122
}

src/platforms/web/compiler/modules/class.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
baseWarn
88
} from 'compiler/helpers'
99

10-
function parse (el: ASTElement, options: CompilerOptions) {
10+
function transformNode (el: ASTElement, options: CompilerOptions) {
1111
const warn = options.warn || baseWarn
1212
const staticClass = getAndRemoveAttr(el, 'class')
1313
if (process.env.NODE_ENV !== 'production' && staticClass) {
@@ -40,6 +40,6 @@ function genData (el: ASTElement): string {
4040

4141
export default {
4242
staticKeys: ['staticClass'],
43-
parse,
43+
transformNode,
4444
genData
4545
}

src/platforms/web/compiler/modules/style.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
getBindingAttr
55
} from 'compiler/helpers'
66

7-
function parse (el: ASTElement) {
7+
function transformNode (el: ASTElement) {
88
const styleBinding = getBindingAttr(el, 'style', false /* getStatic */)
99
if (styleBinding) {
1010
el.styleBinding = styleBinding
@@ -18,6 +18,6 @@ function genData (el: ASTElement): string {
1818
}
1919

2020
export default {
21-
parse,
21+
transformNode,
2222
genData
2323
}

src/platforms/web/compiler/modules/transition.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
getBindingAttr
55
} from 'compiler/helpers'
66

7-
function parse (el: ASTElement) {
7+
function transformNode (el: ASTElement) {
88
let transition = getBindingAttr(el, 'transition')
99
if (transition === '""') {
1010
transition = true
@@ -24,7 +24,7 @@ function genData (el: ASTElement): string {
2424
: ''
2525
}
2626

27-
function transformElement (el: ASTElement, code: string): string {
27+
function transformCode (el: ASTElement, code: string): string {
2828
return el.transitionMode
2929
? `_h(_e('TransitionControl',{props:{mode:${
3030
el.transitionMode
@@ -33,7 +33,7 @@ function transformElement (el: ASTElement, code: string): string {
3333
}
3434

3535
export default {
36-
parse,
36+
transformNode,
3737
genData,
38-
transformElement
38+
transformCode
3939
}

0 commit comments

Comments
 (0)