Browse Source

first file annotated!

dev
Evan You 9 years ago
parent
commit
8ed2f8e6fb
  1. 4
      .babelrc
  2. 8
      src/entries/web-compiler.js

4
.babelrc

@ -7,6 +7,10 @@
"presets": ["es2015-rollup-vue"]
}
},
"plugins": [
"syntax-flow",
"transform-flow-strip-types"
],
"ignore": [
"dist/*.js"
]

8
src/entries/web-compiler.js

@ -1,3 +1,5 @@
/* @flow */
import { extend } from 'shared/util'
import { compile as baseCompile } from 'compiler/index'
import directives from 'web/compiler/directives/index'
@ -15,14 +17,14 @@ const baseOptions = {
getTagNamespace
}
export function compile (template, options) {
export function compile (template: string, options: Object): Object {
options = options
? extend(extend({}, baseOptions), options)
: baseOptions
return baseCompile(template, options)
}
export function compileToFunctions (template, options = {}) {
export function compileToFunctions (template: string, options: Object = {}): Object {
options.preserveWhitespace = options.preserveWhitespace !== false
const cache = options.preserveWhitespace ? cache1 : cache2
if (cache[template]) {
@ -31,7 +33,7 @@ export function compileToFunctions (template, options = {}) {
const res = {}
const compiled = compile(template, options)
res.render = new Function(compiled.render)
const l = compiled.staticRenderFns.length
const l: number = compiled.staticRenderFns.length
if (l) {
res.staticRenderFns = new Array(l)
for (let i = 0; i < l; i++) {

Loading…
Cancel
Save