Przeglądaj źródła

add semis to flow decls for better syntax highlighting

Evan You 9 lat temu
rodzic
commit
26953f5cac
6 zmienionych plików z 28 dodań i 32 usunięć
  1. 15 19
      flow/compiler.js
  2. 1 1
      flow/component.js
  3. 1 1
      flow/global-api.js
  4. 2 2
      flow/options.js
  5. 4 4
      flow/ssr.js
  6. 5 5
      flow/vnode.js

+ 15 - 19
flow/compiler.js

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

+ 1 - 1
flow/component.js

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

+ 1 - 1
flow/global-api.js

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

+ 2 - 2
flow/options.js

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

+ 4 - 4
flow/ssr.js

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

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