Browse Source

[build] 2.0.0-alpha.8

Evan You 9 years ago
parent
commit
a633b3b2d6

+ 16 - 7
dist/vue.common.js

@@ -1407,6 +1407,7 @@ function initLifecycle(vm) {
   vm.$refs = {};
 
   vm._watcher = null;
+  vm._inactive = false;
   vm._isMounted = false;
   vm._isDestroyed = false;
   vm._isBeingDestroyed = false;
@@ -1681,6 +1682,7 @@ function insert(vnode) {
     callHook(vnode.child, 'mounted');
   }
   if (vnode.data.keepAlive) {
+    vnode.child._inactive = false;
     callHook(vnode.child, 'activated');
   }
 }
@@ -1690,6 +1692,7 @@ function destroy(vnode) {
     if (!vnode.data.keepAlive) {
       vnode.child.$destroy();
     } else {
+      vnode.child._inactive = true;
       callHook(vnode.child, 'deactivated');
     }
   }
@@ -2800,7 +2803,7 @@ Object.defineProperty(Vue.prototype, '$isServer', {
   }
 });
 
-Vue.version = '2.0.0-alpha.7';
+Vue.version = '2.0.0-alpha.8';
 
 // attributes that should be using props for binding
 var mustUseProp = makeMap('value,selected,checked,muted');
@@ -3023,7 +3026,8 @@ var nodeOps = Object.freeze({
   setAttribute: setAttribute
 });
 
-var emptyNode = new VNode('', {}, []);
+var emptyData = {};
+var emptyNode = new VNode('', emptyData, []);
 var hooks$1 = ['create', 'update', 'postpatch', 'remove', 'destroy'];
 
 function isUndef(s) {
@@ -3161,7 +3165,7 @@ function createPatchFunction(backend) {
         cbs.destroy[i](vnode);
       }
     }
-    if (isDef(i = vnode.child)) {
+    if (isDef(i = vnode.child) && !data.keepAlive) {
       invokeDestroyHook(i._vnode);
     }
     if (isDef(i = vnode.children)) {
@@ -3291,13 +3295,18 @@ function createPatchFunction(backend) {
     if (oldVnode === vnode) return;
     var i = void 0,
         hook = void 0;
-    if (isDef(i = vnode.data) && isDef(hook = i.hook) && isDef(i = hook.prepatch)) {
-      i(oldVnode, vnode);
+    var hasData = isDef(i = vnode.data);
+    if (hasData) {
+      // ensure the oldVnode also has data during patch
+      oldVnode.data = oldVnode.data || emptyData;
+      if (isDef(hook = i.hook) && isDef(i = hook.prepatch)) {
+        i(oldVnode, vnode);
+      }
     }
     var elm = vnode.elm = oldVnode.elm;
     var oldCh = oldVnode.children;
     var ch = vnode.children;
-    if (isDef(vnode.data)) {
+    if (hasData) {
       for (i = 0; i < cbs.update.length; ++i) {
         cbs.update[i](oldVnode, vnode);
       }if (isDef(hook) && isDef(i = hook.update)) i(oldVnode, vnode);
@@ -3316,7 +3325,7 @@ function createPatchFunction(backend) {
     } else if (oldVnode.text !== vnode.text) {
       nodeOps.setTextContent(elm, vnode.text);
     }
-    if (isDef(vnode.data)) {
+    if (hasData) {
       for (i = 0; i < cbs.postpatch.length; ++i) {
         cbs.postpatch[i](oldVnode, vnode);
       }if (isDef(hook) && isDef(i = hook.postpatch)) i(oldVnode, vnode);

+ 17 - 8
dist/vue.js

@@ -1,5 +1,5 @@
 /*!
- * Vue.js v2.0.0-alpha.7
+ * Vue.js v2.0.0-alpha.8
  * (c) 2014-2016 Evan You
  * Released under the MIT License.
  */
@@ -1414,6 +1414,7 @@
     vm.$refs = {};
 
     vm._watcher = null;
+    vm._inactive = false;
     vm._isMounted = false;
     vm._isDestroyed = false;
     vm._isBeingDestroyed = false;
@@ -1688,6 +1689,7 @@
       callHook(vnode.child, 'mounted');
     }
     if (vnode.data.keepAlive) {
+      vnode.child._inactive = false;
       callHook(vnode.child, 'activated');
     }
   }
@@ -1697,6 +1699,7 @@
       if (!vnode.data.keepAlive) {
         vnode.child.$destroy();
       } else {
+        vnode.child._inactive = true;
         callHook(vnode.child, 'deactivated');
       }
     }
@@ -2805,7 +2808,7 @@
     }
   });
 
-  Vue.version = '2.0.0-alpha.7';
+  Vue.version = '2.0.0-alpha.8';
 
   // attributes that should be using props for binding
   var mustUseProp = makeMap('value,selected,checked,muted');
@@ -3028,7 +3031,8 @@ var nodeOps = Object.freeze({
     setAttribute: setAttribute
   });
 
-  var emptyNode = new VNode('', {}, []);
+  var emptyData = {};
+  var emptyNode = new VNode('', emptyData, []);
   var hooks$1 = ['create', 'update', 'postpatch', 'remove', 'destroy'];
 
   function isUndef(s) {
@@ -3166,7 +3170,7 @@ var nodeOps = Object.freeze({
           cbs.destroy[i](vnode);
         }
       }
-      if (isDef(i = vnode.child)) {
+      if (isDef(i = vnode.child) && !data.keepAlive) {
         invokeDestroyHook(i._vnode);
       }
       if (isDef(i = vnode.children)) {
@@ -3296,13 +3300,18 @@ var nodeOps = Object.freeze({
       if (oldVnode === vnode) return;
       var i = void 0,
           hook = void 0;
-      if (isDef(i = vnode.data) && isDef(hook = i.hook) && isDef(i = hook.prepatch)) {
-        i(oldVnode, vnode);
+      var hasData = isDef(i = vnode.data);
+      if (hasData) {
+        // ensure the oldVnode also has data during patch
+        oldVnode.data = oldVnode.data || emptyData;
+        if (isDef(hook = i.hook) && isDef(i = hook.prepatch)) {
+          i(oldVnode, vnode);
+        }
       }
       var elm = vnode.elm = oldVnode.elm;
       var oldCh = oldVnode.children;
       var ch = vnode.children;
-      if (isDef(vnode.data)) {
+      if (hasData) {
         for (i = 0; i < cbs.update.length; ++i) {
           cbs.update[i](oldVnode, vnode);
         }if (isDef(hook) && isDef(i = hook.update)) i(oldVnode, vnode);
@@ -3321,7 +3330,7 @@ var nodeOps = Object.freeze({
       } else if (oldVnode.text !== vnode.text) {
         nodeOps.setTextContent(elm, vnode.text);
       }
-      if (isDef(vnode.data)) {
+      if (hasData) {
         for (i = 0; i < cbs.postpatch.length; ++i) {
           cbs.postpatch[i](oldVnode, vnode);
         }if (isDef(hook) && isDef(i = hook.postpatch)) i(oldVnode, vnode);

File diff suppressed because it is too large
+ 1 - 1
dist/vue.min.js


+ 3 - 0
packages/vue-server-renderer/index.js

@@ -2224,6 +2224,7 @@ function initLifecycle(vm) {
   vm.$refs = {};
 
   vm._watcher = null;
+  vm._inactive = false;
   vm._isMounted = false;
   vm._isDestroyed = false;
   vm._isBeingDestroyed = false;
@@ -2576,6 +2577,7 @@ function insert(vnode) {
     callHook(vnode.child, 'mounted');
   }
   if (vnode.data.keepAlive) {
+    vnode.child._inactive = false;
     callHook(vnode.child, 'activated');
   }
 }
@@ -2585,6 +2587,7 @@ function destroy(vnode) {
     if (!vnode.data.keepAlive) {
       vnode.child.$destroy();
     } else {
+      vnode.child._inactive = true;
       callHook(vnode.child, 'deactivated');
     }
   }

+ 1 - 1
packages/vue-server-renderer/package.json

@@ -1,6 +1,6 @@
 {
   "name": "vue-server-renderer",
-  "version": "2.0.0-alpha.7",
+  "version": "2.0.0-alpha.8",
   "description": "server renderer for Vue 2.0",
   "main": "index.js",
   "repository": {

+ 6 - 48
packages/vue-template-compiler/index.js

@@ -2,7 +2,10 @@
 
 Object.defineProperty(exports, '__esModule', { value: true });
 
+function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
+
 var entities = require('entities');
+var deindent = _interopDefault(require('de-indent'));
 
 /**
  * Convert a value to a string that is actually rendered.
@@ -1415,6 +1418,7 @@ function initLifecycle(vm) {
   vm.$refs = {};
 
   vm._watcher = null;
+  vm._inactive = false;
   vm._isMounted = false;
   vm._isDestroyed = false;
   vm._isBeingDestroyed = false;
@@ -1689,6 +1693,7 @@ function insert(vnode) {
     callHook(vnode.child, 'mounted');
   }
   if (vnode.data.keepAlive) {
+    vnode.child._inactive = false;
     callHook(vnode.child, 'activated');
   }
 }
@@ -1698,6 +1703,7 @@ function destroy(vnode) {
     if (!vnode.data.keepAlive) {
       vnode.child.$destroy();
     } else {
+      vnode.child._inactive = true;
       callHook(vnode.child, 'deactivated');
     }
   }
@@ -4185,54 +4191,6 @@ function makeFunction(code) {
   }
 }
 
-var splitRE$1 = /\r?\n/g;
-var emptyRE = /^\s*$/;
-var needFixRE = /^(\r?\n)*[\t\s]/;
-
-function deindent(str) {
-  if (!needFixRE.test(str)) {
-    return str;
-  }
-  var lines = str.split(splitRE$1);
-  var min = Infinity;
-  var type = void 0,
-      cur = void 0,
-      c = void 0;
-  for (var i = 0; i < lines.length; i++) {
-    var line = lines[i];
-    if (!emptyRE.test(line)) {
-      if (!type) {
-        c = line.charAt(0);
-        if (c === ' ' || c === '\t') {
-          type = c;
-          cur = count(line, type);
-          if (cur < min) {
-            min = cur;
-          }
-        } else {
-          return str;
-        }
-      } else {
-        cur = count(line, type);
-        if (cur < min) {
-          min = cur;
-        }
-      }
-    }
-  }
-  return lines.map(function (line) {
-    return line.slice(min);
-  }).join('\n');
-}
-
-function count(line, type) {
-  var i = 0;
-  while (line.charAt(i) === type) {
-    i++;
-  }
-  return i;
-}
-
 var splitRE = /\r?\n/g;
 var isSpecialTag$1 = makeMap('script,style,template', true);
 

+ 1 - 1
packages/vue-template-compiler/package.json

@@ -1,6 +1,6 @@
 {
   "name": "vue-template-compiler",
-  "version": "2.0.0-alpha.7",
+  "version": "2.0.0-alpha.8",
   "description": "template compiler for Vue 2.0",
   "main": "index.js",
   "repository": {

+ 1 - 1
src/core/index.js

@@ -8,6 +8,6 @@ Object.defineProperty(Vue.prototype, '$isServer', {
   get: () => config._isServer
 })
 
-Vue.version = '2.0.0-alpha.7'
+Vue.version = '2.0.0-alpha.8'
 
 export default Vue

Some files were not shown because too many files changed in this diff