Browse Source

upgrade flow

dev
Evan You 8 years ago
parent
commit
c994e5cf48
  1. 22
      flow/component.js
  2. 1
      flow/modules.js
  3. 6
      src/core/instance/render-helpers/render-list.js
  4. 2
      src/core/observer/index.js
  5. 4
      src/server/bundle-renderer/create-bundle-renderer.js
  6. 2
      src/server/create-renderer.js
  7. 2
      src/server/optimizing-compiler/codegen.js
  8. 9
      src/server/optimizing-compiler/runtime-helpers.js
  9. 2
      src/server/render-context.js
  10. 2
      src/server/render.js
  11. 6
      src/shared/util.js

22
flow/component.js

@ -69,16 +69,34 @@ declare interface Component {
_provided: ?Object;
// private methods
// lifecycle
_init: Function;
_mount: (el?: Element | void, hydrating?: boolean) => Component;
_update: (vnode: VNode, hydrating?: boolean) => void;
// rendering
_render: () => VNode;
__patch__: (a: Element | VNode | void, b: VNode) => any;
__patch__: (
a: Element | VNode | void,
b: VNode,
hydrating?: boolean,
removeOnly?: boolean,
parentElm?: any,
refElm?: any
) => any;
// createElement
// _c is internal that accepts `normalizationType` optimization hint
_c: (vnode?: VNode, data?: VNodeData, children?: VNodeChildren, normalizationType?: number) => VNode | void;
_c: (
vnode?: VNode,
data?: VNodeData,
children?: VNodeChildren,
normalizationType?: number
) => VNode | void;
// renderStatic
_m: (index: number, isInFor?: boolean) => VNode | VNodeChildren;
// markOnce

1
flow/modules.js

@ -10,6 +10,7 @@ declare module 'source-map' {
toString(): string;
}
declare class SourceMapConsumer {
constructor (map: Object): void;
originalPositionFor(position: { line: number; column: number; }): {
source: ?string;
line: ?number;

6
src/core/instance/render-helpers/render-list.js

@ -7,7 +7,11 @@ import { isObject, isDef } from 'core/util/index'
*/
export function renderList (
val: any,
render: () => VNode
render: (
val: any,
keyOrIndex: string | number,
index?: number
) => VNode
): ?Array<VNode> {
let ret: ?Array<VNode>, i, l, keys, key
if (Array.isArray(val) || typeof val === 'string') {

2
src/core/observer/index.js

@ -80,7 +80,7 @@ export class Observer {
* Augment an target Object or Array by intercepting
* the prototype chain using __proto__
*/
function protoAugment (target, src: Object) {
function protoAugment (target, src: Object, keys: any) {
/* eslint-disable no-proto */
target.__proto__ = src
/* eslint-enable no-proto */

4
src/server/bundle-renderer/create-bundle-renderer.js

@ -27,7 +27,9 @@ type RenderBundle = {
modules?: { [filename: string]: Array<string> };
};
export function createBundleRendererCreator (createRenderer: () => Renderer) {
export function createBundleRendererCreator (
createRenderer: (options?: RenderOptions) => Renderer
) {
return function createBundleRenderer (
bundle: string | RenderBundle,
rendererOptions?: RenderOptions = {}

2
src/server/create-renderer.js

@ -18,7 +18,7 @@ type RenderCache = {
};
export type RenderOptions = {
modules?: Array<(vnode: VNode) => string>;
modules?: Array<(vnode: VNode) => ?string>;
directives?: Object;
isUnaryTag?: Function;
cache?: RenderCache;

2
src/server/optimizing-compiler/codegen.js

@ -97,7 +97,7 @@ function genSSRChildren (el, state, checkSkip) {
function genSSRNode (el, state) {
return el.type === 1
? genSSRElement(el, state)
: genText(el, state)
: genText(el)
}
function genChildrenAsStringNode (el, state) {

9
src/server/optimizing-compiler/runtime-helpers.js

@ -71,7 +71,14 @@ function renderStringNode (
return new StringNode(open, close, children, normalizationType)
}
function renderStringList (val: any, render: () => string): string {
function renderStringList (
val: any,
render: (
val: any,
keyOrIndex: string | number,
index?: number
) => string
): string {
let ret = ''
let i, l, keys, key
if (Array.isArray(val) || typeof val === 'string') {

2
src/server/render-context.js

@ -28,7 +28,7 @@ export class RenderContext {
next: () => void;
done: () => void;
modules: Array<() => ?string>;
modules: Array<(node: VNode) => ?string>;
directives: Object;
isUnaryTag: (tag: string) => boolean;

2
src/server/render.js

@ -343,7 +343,7 @@ function renderStartingTag (node: VNode, context) {
}
export function createRenderFunction (
modules: Array<Function>,
modules: Array<(node: VNode) => ?string>,
directives: Object,
isUnaryTag: Function,
cache: any

6
src/shared/util.js

@ -202,13 +202,15 @@ export function toObject (arr: Array<any>): Object {
/**
* Perform no operation.
* Stubbing args to make Flow happy without leaving useless transpiled code
* with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/)
*/
export function noop () {}
export function noop (a?: any, b?: any, c?: any) {}
/**
* Always return false.
*/
export const no = () => false
export const no = (a?: any, b?: any, c?: any) => false
/**
* Return same value

Loading…
Cancel
Save