Browse Source

annotate entries

dev
Evan You 9 years ago
parent
commit
b926b9e7cd
  1. 7
      .eslintrc
  2. 1
      package.json
  3. 9
      src/entries/web-runtime-with-compiler.js
  4. 4
      src/entries/web-runtime.js
  5. 7
      src/entries/web-server-renderer.js

7
.eslintrc

@ -1,5 +1,10 @@
{
"root": true,
"parser": "babel-eslint",
"extends": "vue"
"extends": "vue",
"plugins": ["flow-vars"],
"rules": {
"flow-vars/define-flow-type": 1,
"flow-vars/use-flow-type": 1
}
}

1
package.json

@ -49,6 +49,7 @@
"entities": "1.1.x",
"eslint": "2.9.x",
"eslint-config-vue": "1.0.x",
"eslint-plugin-flow-vars": "^0.4.0",
"flow-bin": "^0.24.2",
"http-server": "0.9.x",
"isparta-loader": "2.0.x",

9
src/entries/web-runtime-with-compiler.js

@ -1,3 +1,5 @@
/* @flow */
import config from 'core/config'
import { warn, cached } from 'core/util/index'
import { query } from 'web/util/index'
@ -7,7 +9,7 @@ import { compileToFunctions } from './web-compiler'
const idToTemplate = cached(id => query(id).innerHTML)
const mount = Vue.prototype.$mount
Vue.prototype.$mount = function (el) {
Vue.prototype.$mount = function (el?: string | Element): Vue {
el = el && query(el)
const options = this.$options
// resolve template/el and convert to render function
@ -42,11 +44,8 @@ Vue.prototype.$mount = function (el) {
/**
* Get outerHTML of elements, taking care
* of SVG elements in IE as well.
*
* @param {Element} el
* @return {String}
*/
function getOuterHTML (el) {
function getOuterHTML (el: Element): string {
if (el.outerHTML) {
return el.outerHTML
} else {

4
src/entries/web-runtime.js

@ -1,3 +1,5 @@
/* @flow */
import Vue from 'core/index'
import config from 'core/config'
import { createPatchFunction } from 'core/vdom/patch'
@ -22,7 +24,7 @@ Vue.prototype.__patch__ = config._isServer
: createPatchFunction({ nodeOps, modules })
// wrap mount
Vue.prototype.$mount = function (el) {
Vue.prototype.$mount = function (el?: string | Element): Vue {
this.$el = el && query(el)
return this._mount()
}

7
src/entries/web-server-renderer.js

@ -1,9 +1,14 @@
/* @flow */
import { createRenderer } from 'server/create-renderer'
import { isUnaryTag } from 'web/util/index'
import modules from 'web/server/modules/index'
import baseDirectives from 'web/server/directives/index'
export default function publicCreateRenderer (options = {}) {
export default function publicCreateRenderer (options?: Object = {}): {
renderToString: Function,
renderToStream: Function
} {
// user can provide server-side implementations for custom directives
// when creating the renderer.
const directives = Object.assign(baseDirectives, options.directives)

Loading…
Cancel
Save