Evan You 10 лет назад
Родитель
Сommit
0ab0600599

+ 6 - 6
build/build.js

@@ -16,17 +16,17 @@ var banner =
 
 // update main file
 var main = fs
-  .readFileSync('src/index.js', 'utf-8')
+  .readFileSync('src/runtime/index.js', 'utf-8')
   .replace(/Vue\.version = '[\d\.]+'/, "Vue.version = '" + version + "'")
-fs.writeFileSync('src/index.js', main)
+fs.writeFileSync('src/runtime/index.js', main)
 
 // CommonJS build.
 // this is used as the "main" field in package.json
 // and used by bundlers like Webpack and Browserify.
-// doesn't come with the compiler because it's meant to be
+// runtime only, because it's meant to be
 // used with vue-loader which pre-compiles the template.
 rollup.rollup({
-  entry: 'src/index.js',
+  entry: 'src/runtime/index.js',
   plugins: [babel()]
 })
 .then(function (bundle) {
@@ -38,7 +38,7 @@ rollup.rollup({
 // Standalone Dev Build
 .then(function () {
   return rollup.rollup({
-    entry: 'src/with-compiler.js',
+    entry: 'src/runtime-with-compiler.js',
     plugins: [
       alias({
         entities: './entity-decoder'
@@ -60,7 +60,7 @@ rollup.rollup({
 .then(function () {
   // Standalone Production Build
   return rollup.rollup({
-    entry: 'src/with-compiler.js',
+    entry: 'src/runtime-with-compiler.js',
     plugins: [
       alias({
         entities: './entity-decoder'

+ 1 - 1
build/dev-entry.js

@@ -1 +1 @@
-module.exports = require('../src/with-compiler')['default']
+module.exports = require('../src/runtime-with-compiler')['default']

+ 1 - 2
src/compiler/codegen/events.js

@@ -1,5 +1,4 @@
-import { isArray } from '../../util/index'
-
+const isArray = Array.isArray
 const simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['.*?'\]|\[".*?"\]|\[\d+\]|\[[A-Za-z_$][\w$]*\])*$/
 
 // keyCode aliases

+ 6 - 4
src/with-compiler.js → src/runtime-with-compiler.js

@@ -1,12 +1,14 @@
-import config from './config'
+import config from './runtime/config'
 import { compile } from './compiler/index'
-import { getOuterHTML, query } from './util/index'
-import Component from './instance/index'
+import { getOuterHTML, extend, query } from './runtime/util/index'
+import Instance from './runtime/index'
 
 export default function Vue (options) {
   if (!options.render) {
     const template = options.template || getOuterHTML(query(options.el))
     options.render = compile(template, config.preserveWhiteSpace)
   }
-  return new Component(options)
+  return new Instance(options)
 }
+
+extend(Vue, Instance)

+ 0 - 0
src/config.js → src/runtime/config.js


+ 2 - 0
src/index.js → src/runtime/index.js

@@ -1,3 +1,5 @@
 import Vue from './instance/index'
 
+Vue.version = '2.0.0'
+
 export default Vue

+ 0 - 0
src/instance/index.js → src/runtime/instance/index.js


+ 0 - 0
src/instance/internal/state.js → src/runtime/instance/internal/state.js


+ 0 - 0
src/observer/array.js → src/runtime/observer/array.js


+ 0 - 0
src/observer/batcher.js → src/runtime/observer/batcher.js


+ 0 - 0
src/observer/dep.js → src/runtime/observer/dep.js


+ 0 - 0
src/observer/index.js → src/runtime/observer/index.js


+ 0 - 0
src/observer/watcher.js → src/runtime/observer/watcher.js


+ 0 - 0
src/util/debug.js → src/runtime/util/debug.js


+ 0 - 0
src/util/dom.js → src/runtime/util/dom.js


+ 0 - 0
src/util/env.js → src/runtime/util/env.js


+ 0 - 0
src/util/index.js → src/runtime/util/index.js


+ 0 - 0
src/util/lang.js → src/runtime/util/lang.js


+ 0 - 0
src/util/options.js → src/runtime/util/options.js


+ 0 - 0
src/vdom/dom.js → src/runtime/vdom/dom.js


+ 0 - 0
src/vdom/h.js → src/runtime/vdom/h.js


+ 0 - 0
src/vdom/index.js → src/runtime/vdom/index.js


+ 0 - 0
src/vdom/modules/attrs.js → src/runtime/vdom/modules/attrs.js


+ 0 - 0
src/vdom/modules/class.js → src/runtime/vdom/modules/class.js


+ 0 - 0
src/vdom/modules/events.js → src/runtime/vdom/modules/events.js


+ 0 - 0
src/vdom/modules/props.js → src/runtime/vdom/modules/props.js


+ 0 - 0
src/vdom/modules/style.js → src/runtime/vdom/modules/style.js


+ 0 - 0
src/vdom/patch.js → src/runtime/vdom/patch.js


+ 0 - 0
src/vdom/vnode.js → src/runtime/vdom/vnode.js