Skip to content

Commit b06d09f

Browse files
committed
types: adjust weex flow types
1 parent 5c2ce00 commit b06d09f

File tree

10 files changed

+25
-29
lines changed

10 files changed

+25
-29
lines changed

Diff for: flow/compiler.js

+9-13
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,30 @@
1-
// global flag to be compiled away
2-
declare var __WEEX__: boolean;
3-
41
declare type CompilerOptions = {
52
warn?: Function; // allow customizing warning in different environments; e.g. node
6-
expectHTML?: boolean; // only false for non-web builds
73
modules?: Array<ModuleOptions>; // platform specific modules; e.g. style; class
8-
staticKeys?: string; // a list of AST properties to be considered static; for optimization
94
directives?: { [key: string]: Function }; // platform specific directives
5+
staticKeys?: string; // a list of AST properties to be considered static; for optimization
106
isUnaryTag?: (tag: string) => ?boolean; // check if a tag is unary for the platform
117
canBeLeftOpenTag?: (tag: string) => ?boolean; // check if a tag can be left opened
128
isReservedTag?: (tag: string) => ?boolean; // check if a tag is a native for the platform
9+
preserveWhitespace?: boolean; // preserve whitespace between elements?
10+
optimize?: boolean; // optimize static content?
11+
12+
// web specific
1313
mustUseProp?: (tag: string, type: ?string, name: string) => boolean; // check if an attribute should be bound as a property
1414
isPreTag?: (attr: string) => ?boolean; // check if a tag needs to preserve whitespace
1515
getTagNamespace?: (tag: string) => ?string; // check the namespace for a tag
16-
transforms?: Array<Function>; // a list of transforms on parsed AST before codegen
17-
preserveWhitespace?: boolean;
16+
expectHTML?: boolean; // only false for non-web builds
1817
isFromDOM?: boolean;
1918
shouldDecodeTags?: boolean;
2019
shouldDecodeNewlines?: boolean;
2120
shouldDecodeNewlinesForHref?: boolean;
22-
optimize?: boolean;
23-
24-
// for ssr optimization compiler
25-
scopeId?: string;
2621

2722
// runtime user-configurable
2823
delimiters?: [string, string]; // template delimiters
24+
comments?: boolean; // preserve comments in template
2925

30-
// allow user kept comments
31-
comments?: boolean
26+
// for ssr optimization compiler
27+
scopeId?: string;
3228
};
3329

3430
declare type CompiledResult = {

Diff for: flow/weex.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// global flag to be compiled away
2+
declare var __WEEX__: boolean;
3+
4+
declare type WeexCompilerOptions = CompilerOptions & {
5+
// whether to compile special template for <recycle-list>
6+
recyclable?: boolean;
7+
};
8+
9+
declare type WeexCompiledResult = CompiledResult & {
10+
'@render'?: string;
11+
};

Diff for: src/platforms/weex/compiler/index.js

-9
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,6 @@ import {
1414
getTagNamespace
1515
} from '../util/index'
1616

17-
export type WeexCompilerOptions = CompilerOptions & {
18-
// whether to compile special template for <recycle-list>
19-
recyclable?: boolean;
20-
};
21-
22-
export type WeexCompiledResult = CompiledResult & {
23-
'@render'?: string;
24-
};
25-
2617
export const baseOptions: WeexCompilerOptions = {
2718
modules,
2819
directives,

Diff for: src/platforms/weex/compiler/modules/recycle-list/component.js

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import { addAttr } from 'compiler/helpers'
44
import { RECYCLE_LIST_MARKER } from 'weex/util/index'
5-
import type { WeexCompilerOptions } from 'weex/compiler/index'
65

76
// mark components as inside recycle-list so that we know we need to invoke
87
// their special @render function instead of render in create-component.js

Diff for: src/platforms/weex/compiler/modules/recycle-list/index.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/* @flow */
22

3-
import type { WeexCompilerOptions } from 'weex/compiler/index'
43
import { postTransformComponent } from './component'
54
import { postTransformText } from './text'
65
import { preTransformVBind } from './v-bind'

Diff for: src/platforms/weex/compiler/modules/recycle-list/text.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function genText (node: ASTNode) {
1313
return JSON.stringify(value)
1414
}
1515

16-
export function postTransformText (el: ASTElement, options: CompilerOptions) {
16+
export function postTransformText (el: ASTElement, options: WeexCompilerOptions) {
1717
// weex <text> can only contain text, so the parser
1818
// always generates a single child.
1919
if (el.children.length) {

Diff for: src/platforms/weex/compiler/modules/recycle-list/v-bind.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function parseAttrName (name: string): string {
88
return camelize(name.replace(bindRE, ''))
99
}
1010

11-
export function preTransformVBind (el: ASTElement, options: CompilerOptions) {
11+
export function preTransformVBind (el: ASTElement, options: WeexCompilerOptions) {
1212
for (const attr in el.attrsMap) {
1313
if (bindRE.test(attr)) {
1414
const name: string = parseAttrName(attr)

Diff for: src/platforms/weex/compiler/modules/recycle-list/v-for.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { forAliasRE, forIteratorRE, stripParensRE } from 'compiler/parser/index'
44
import { getAndRemoveAttr } from 'compiler/helpers'
55

6-
export function preTransformVFor (el: ASTElement, options: CompilerOptions) {
6+
export function preTransformVFor (el: ASTElement, options: WeexCompilerOptions) {
77
const exp = getAndRemoveAttr(el, 'v-for')
88
if (!exp) {
99
return

Diff for: src/platforms/weex/compiler/modules/recycle-list/v-if.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function getPrevMatch (el: ASTElement): any {
1818
}
1919
}
2020

21-
export function preTransformVIf (el: ASTElement, options: CompilerOptions) {
21+
export function preTransformVIf (el: ASTElement, options: WeexCompilerOptions) {
2222
if (hasConditionDirective(el)) {
2323
let exp
2424
const ifExp = getAndRemoveAttr(el, 'v-if', true /* remove from attrsMap */)

Diff for: src/platforms/weex/compiler/modules/recycle-list/v-on.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function parseHandlerParams (handler: ASTElementHandler) {
99
}
1010
}
1111

12-
export function postTransformVOn (el: ASTElement, options: CompilerOptions) {
12+
export function postTransformVOn (el: ASTElement, options: WeexCompilerOptions) {
1313
const events: ASTElementHandlers | void = el.events
1414
if (!events) {
1515
return

0 commit comments

Comments
 (0)