Browse Source

add semis to flow decls for better syntax highlighting

dev
Evan You 8 years ago
parent
commit
26953f5cac
  1. 34
      flow/compiler.js
  2. 2
      flow/component.js
  3. 2
      flow/global-api.js
  4. 4
      flow/options.js
  5. 8
      flow/ssr.js
  6. 10
      flow/vnode.js

34
flow/compiler.js

@ -18,20 +18,16 @@ declare type CompilerOptions = {
// runtime user-configurable // runtime user-configurable
delimiters?: [string, string]; // template delimiters delimiters?: [string, string]; // template delimiters
} };
declare type CompiledResult = { declare type CompiledResult = {
ast: ?ASTElement; ast: ?ASTElement;
render: string; render: string;
staticRenderFns: Array<string>; staticRenderFns: Array<string>;
stringRenderFns?: Array<string>;
errors?: Array<string>; errors?: Array<string>;
tips?: Array<string>; tips?: Array<string>;
} };
declare type CompiledFunctionResult = {
render: Function;
staticRenderFns: Array<Function>;
}
declare type ModuleOptions = { declare type ModuleOptions = {
preTransformNode: (el: ASTElement) => void; preTransformNode: (el: ASTElement) => void;
@ -40,19 +36,19 @@ declare type ModuleOptions = {
genData: (el: ASTElement) => string; // generate extra data string for an element genData: (el: ASTElement) => string; // generate extra data string for an element
transformCode?: (el: ASTElement, code: string) => string; // further transform generated code for an element transformCode?: (el: ASTElement, code: string) => string; // further transform generated code for an element
staticKeys?: Array<string>; // AST properties to be considered static staticKeys?: Array<string>; // AST properties to be considered static
} };
declare type ASTModifiers = { [key: string]: boolean } declare type ASTModifiers = { [key: string]: boolean };
declare type ASTIfConditions = Array<{ exp: ?string; block: ASTElement }> declare type ASTIfConditions = Array<{ exp: ?string; block: ASTElement }>;
declare type ASTElementHandler = { declare type ASTElementHandler = {
value: string; value: string;
modifiers: ?ASTModifiers; modifiers: ?ASTModifiers;
} };
declare type ASTElementHandlers = { declare type ASTElementHandlers = {
[key: string]: ASTElementHandler | Array<ASTElementHandler>; [key: string]: ASTElementHandler | Array<ASTElementHandler>;
} };
declare type ASTDirective = { declare type ASTDirective = {
name: string; name: string;
@ -60,9 +56,9 @@ declare type ASTDirective = {
value: string; value: string;
arg: ?string; arg: ?string;
modifiers: ?ASTModifiers; modifiers: ?ASTModifiers;
} };
declare type ASTNode = ASTElement | ASTText | ASTExpression declare type ASTNode = ASTElement | ASTText | ASTExpression;
declare type ASTElement = { declare type ASTElement = {
type: 1; type: 1;
@ -138,7 +134,7 @@ declare type ASTElement = {
// weex specific // weex specific
appendAsTree?: boolean; appendAsTree?: boolean;
} };
declare type ASTExpression = { declare type ASTExpression = {
type: 2; type: 2;
@ -148,7 +144,7 @@ declare type ASTExpression = {
// 2.4 ssr optimization // 2.4 ssr optimization
ssrOptimizable?: boolean; ssrOptimizable?: boolean;
ssrOptimizableRoot?: boolean; ssrOptimizableRoot?: boolean;
} };
declare type ASTText = { declare type ASTText = {
type: 3; type: 3;
@ -157,7 +153,7 @@ declare type ASTText = {
// 2.4 ssr optimization // 2.4 ssr optimization
ssrOptimizable?: boolean; ssrOptimizable?: boolean;
ssrOptimizableRoot?: boolean; ssrOptimizableRoot?: boolean;
} };
// SFC-parser related declarations // SFC-parser related declarations
@ -176,7 +172,7 @@ declare type SFCCustomBlock = {
end?: number; end?: number;
src?: string; src?: string;
attrs: {[attribute:string]: string}; attrs: {[attribute:string]: string};
} };
declare type SFCBlock = { declare type SFCBlock = {
type: string; type: string;
@ -187,4 +183,4 @@ declare type SFCBlock = {
src?: string; src?: string;
scoped?: boolean; scoped?: boolean;
module?: string | boolean; module?: string | boolean;
} };

2
flow/component.js

@ -110,4 +110,4 @@ declare interface Component {
// allow dynamic method registration // allow dynamic method registration
[key: string]: any [key: string]: any
} };

2
flow/global-api.js

@ -18,4 +18,4 @@ declare interface GlobalAPI {
// allow dynamic method registration // allow dynamic method registration
[key: string]: any [key: string]: any
} };

4
flow/options.js

@ -10,7 +10,7 @@ declare type InternalComponentOptions = {
_refElm: ?Node; _refElm: ?Node;
render?: Function; render?: Function;
staticRenderFns?: Array<Function> staticRenderFns?: Array<Function>
} };
declare type ComponentOptions = { declare type ComponentOptions = {
// data // data
@ -80,7 +80,7 @@ declare type ComponentOptions = {
_base: Class<Component>; _base: Class<Component>;
_parentElm: ?Node; _parentElm: ?Node;
_refElm: ?Node; _refElm: ?Node;
} };
declare type PropOptions = { declare type PropOptions = {
type: Function | Array<Function> | null; type: Function | Array<Function> | null;

8
flow/ssr.js

@ -3,7 +3,7 @@ declare type ComponentWithCacheContext = {
bufferIndex: number; bufferIndex: number;
buffer: Array<string>; buffer: Array<string>;
key: string; key: string;
} };
declare type ElementContext = { declare type ElementContext = {
type: 'Element'; type: 'Element';
@ -11,11 +11,11 @@ declare type ElementContext = {
rendered: number; rendered: number;
endTag: string; endTag: string;
total: number; total: number;
} };
declare type ComponentContext = { declare type ComponentContext = {
type: 'Component'; type: 'Component';
prevActive: Component; prevActive: Component;
} };
declare type RenderState = ComponentContext | ComponentWithCacheContext | ElementContext declare type RenderState = ComponentContext | ComponentWithCacheContext | ElementContext;

10
flow/vnode.js

@ -1,4 +1,4 @@
declare type VNodeChildren = Array<?VNode | string | VNodeChildren> | string declare type VNodeChildren = Array<?VNode | string | VNodeChildren> | string;
declare type VNodeComponentOptions = { declare type VNodeComponentOptions = {
Ctor: Class<Component>; Ctor: Class<Component>;
@ -6,7 +6,7 @@ declare type VNodeComponentOptions = {
listeners: ?Object; listeners: ?Object;
children: ?Array<VNode>; children: ?Array<VNode>;
tag?: string; tag?: string;
} };
declare type MountedComponentVNode = { declare type MountedComponentVNode = {
context: Component; context: Component;
@ -14,7 +14,7 @@ declare type MountedComponentVNode = {
componentInstance: Component; componentInstance: Component;
parent: VNode; parent: VNode;
data: VNodeData; data: VNodeData;
} };
// interface for vnodes in update modules // interface for vnodes in update modules
declare type VNodeWithData = { declare type VNodeWithData = {
@ -29,7 +29,7 @@ declare type VNodeWithData = {
parent?: VNodeWithData; parent?: VNodeWithData;
componentInstance?: Component; componentInstance?: Component;
isRootInsert: boolean; isRootInsert: boolean;
} };
declare interface VNodeData { declare interface VNodeData {
key?: string | number; key?: string | number;
@ -61,7 +61,7 @@ declare interface VNodeData {
value: any; value: any;
callback: Function; callback: Function;
}; };
} };
declare type VNodeDirective = { declare type VNodeDirective = {
name: string; name: string;

Loading…
Cancel
Save