Skip to content

Commit

Permalink
build: add patchs for vue and vue-resize
Browse files Browse the repository at this point in the history
  • Loading branch information
rocka committed Apr 12, 2020
1 parent 856cdfd commit f820d77
Show file tree
Hide file tree
Showing 3 changed files with 259 additions and 0 deletions.
12 changes: 12 additions & 0 deletions patches/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Applied patchs

## `vue`

- [vuejs/vue#9962](https://github.com/vuejs/vue/pull/9962)
- [vuejs/vue#10085](https://github.com/vuejs/vue/pull/10085)
- [vuejs/vue#10142](https://github.com/vuejs/vue/pull/10142)
- [vuejs/vue#11178](https://github.com/vuejs/vue/pull/11178)

## `vue-resize`

- [Akryum/vue-resize#62](https://github.com/Akryum/vue-resize/pull/62)
232 changes: 232 additions & 0 deletions patches/vue+2.6.11.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
diff --git a/node_modules/vue/dist/vue.runtime.common.dev.js b/node_modules/vue/dist/vue.runtime.common.dev.js
index 604657c..5f0b1c8 100644
--- a/node_modules/vue/dist/vue.runtime.common.dev.js
+++ b/node_modules/vue/dist/vue.runtime.common.dev.js
@@ -4814,7 +4814,7 @@ function defineComputed (
function createComputedGetter (key) {
return function computedGetter () {
var watcher = this._computedWatchers && this._computedWatchers[key];
- if (watcher) {
+ if (watcher && watcher.active) {
if (watcher.dirty) {
watcher.evaluate();
}
@@ -5251,9 +5251,9 @@ function pruneCache (keepAliveInstance, filter) {
var keys = keepAliveInstance.keys;
var _vnode = keepAliveInstance._vnode;
for (var key in cache) {
- var cachedNode = cache[key];
- if (cachedNode) {
- var name = getComponentName(cachedNode.componentOptions);
+ const entry = cache[key]
+ if (entry) {
+ const name = entry.name
if (name && !filter(name)) {
pruneCacheEntry(cache, key, keys, _vnode);
}
@@ -5267,9 +5267,9 @@ function pruneCacheEntry (
keys,
current
) {
- var cached$$1 = cache[key];
- if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
- cached$$1.componentInstance.$destroy();
+ const entry = cache[key]
+ if (entry && (!current || entry.tag !== current.tag)) {
+ entry.componentInstance.$destroy()
}
cache[key] = null;
remove(keys, key);
@@ -5300,7 +5300,10 @@ var KeepAlive = {

mounted: function mounted () {
var this$1 = this;
-
+ if (this.putEntry) {
+ this.putEntry()
+ this.putEntry = null
+ }
this.$watch('include', function (val) {
pruneCache(this$1, function (name) { return matches(val, name); });
});
@@ -5309,6 +5312,13 @@ var KeepAlive = {
});
},

+ updated: function updated() {
+ if (this.putEntry) {
+ this.putEntry()
+ this.putEntry = null
+ }
+ },
+
render: function render () {
var slot = this.$slots.default;
var vnode = getFirstComponentChild(slot);
@@ -5337,16 +5347,25 @@ var KeepAlive = {
? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
: vnode.key;
if (cache[key]) {
- vnode.componentInstance = cache[key].componentInstance;
+ var { _isDestroyed } = cache[key].componentInstance
+ if (_isDestroyed) cache[key] = vnode
+ else vnode.componentInstance = cache[key].componentInstance
// make current key freshest
remove(keys, key);
keys.push(key);
} else {
- cache[key] = vnode;
- keys.push(key);
- // prune oldest entry
- if (this.max && keys.length > parseInt(this.max)) {
- pruneCacheEntry(cache, keys[0], keys, this._vnode);
+ this.putEntry = () => {
+ const { tag, componentInstance } = vnode
+ cache[key] = {
+ name,
+ tag,
+ componentInstance
+ }
+ keys.push(key)
+ // prune oldest entry
+ if (this.max && keys.length > parseInt(this.max)) {
+ pruneCacheEntry(cache, keys[0], keys, this._vnode)
+ }
}
}

@@ -6924,7 +6943,7 @@ function updateDOMListeners (oldVnode, vnode) {
}
var on = vnode.data.on || {};
var oldOn = oldVnode.data.on || {};
- target$1 = vnode.elm;
+ target$1 = vnode.elm || oldVnode.elm
normalizeEvents(on);
updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
target$1 = undefined;
@@ -6932,7 +6951,8 @@ function updateDOMListeners (oldVnode, vnode) {

var events = {
create: updateDOMListeners,
- update: updateDOMListeners
+ update: updateDOMListeners,
+ destroy: (vnode) => updateDOMListeners(vnode, emptyNode)
};

/* */
diff --git a/node_modules/vue/dist/vue.runtime.esm.js b/node_modules/vue/dist/vue.runtime.esm.js
index e475f27..0681b95 100644
--- a/node_modules/vue/dist/vue.runtime.esm.js
+++ b/node_modules/vue/dist/vue.runtime.esm.js
@@ -4831,7 +4831,7 @@ function defineComputed (
function createComputedGetter (key) {
return function computedGetter () {
var watcher = this._computedWatchers && this._computedWatchers[key];
- if (watcher) {
+ if (watcher && watcher.active) {
if (watcher.dirty) {
watcher.evaluate();
}
@@ -5271,9 +5271,9 @@ function pruneCache (keepAliveInstance, filter) {
var keys = keepAliveInstance.keys;
var _vnode = keepAliveInstance._vnode;
for (var key in cache) {
- var cachedNode = cache[key];
- if (cachedNode) {
- var name = getComponentName(cachedNode.componentOptions);
+ const entry = cache[key]
+ if (entry) {
+ const name = entry.name
if (name && !filter(name)) {
pruneCacheEntry(cache, key, keys, _vnode);
}
@@ -5287,9 +5287,9 @@ function pruneCacheEntry (
keys,
current
) {
- var cached$$1 = cache[key];
- if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
- cached$$1.componentInstance.$destroy();
+ const entry = cache[key]
+ if (entry && (!current || entry.tag !== current.tag)) {
+ entry.componentInstance.$destroy()
}
cache[key] = null;
remove(keys, key);
@@ -5320,7 +5320,10 @@ var KeepAlive = {

mounted: function mounted () {
var this$1 = this;
-
+ if (this.putEntry) {
+ this.putEntry()
+ this.putEntry = null
+ }
this.$watch('include', function (val) {
pruneCache(this$1, function (name) { return matches(val, name); });
});
@@ -5329,6 +5332,13 @@ var KeepAlive = {
});
},

+ updated: function updated() {
+ if (this.putEntry) {
+ this.putEntry()
+ this.putEntry = null
+ }
+ },
+
render: function render () {
var slot = this.$slots.default;
var vnode = getFirstComponentChild(slot);
@@ -5357,16 +5367,25 @@ var KeepAlive = {
? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
: vnode.key;
if (cache[key]) {
- vnode.componentInstance = cache[key].componentInstance;
+ var { _isDestroyed } = cache[key].componentInstance
+ if (_isDestroyed) cache[key] = vnode
+ else vnode.componentInstance = cache[key].componentInstance
// make current key freshest
remove(keys, key);
keys.push(key);
} else {
- cache[key] = vnode;
- keys.push(key);
- // prune oldest entry
- if (this.max && keys.length > parseInt(this.max)) {
- pruneCacheEntry(cache, keys[0], keys, this._vnode);
+ this.putEntry = () => {
+ const { tag, componentInstance } = vnode
+ cache[key] = {
+ name,
+ tag,
+ componentInstance
+ }
+ keys.push(key)
+ // prune oldest entry
+ if (this.max && keys.length > parseInt(this.max)) {
+ pruneCacheEntry(cache, keys[0], keys, this._vnode)
+ }
}
}

@@ -6946,7 +6965,7 @@ function updateDOMListeners (oldVnode, vnode) {
}
var on = vnode.data.on || {};
var oldOn = oldVnode.data.on || {};
- target$1 = vnode.elm;
+ target$1 = vnode.elm || oldVnode.elm
normalizeEvents(on);
updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
target$1 = undefined;
@@ -6954,7 +6973,8 @@ function updateDOMListeners (oldVnode, vnode) {

var events = {
create: updateDOMListeners,
- update: updateDOMListeners
+ update: updateDOMListeners,
+ destroy: (vnode) => updateDOMListeners(vnode, emptyNode)
};

/* */
15 changes: 15 additions & 0 deletions patches/vue-resize+0.4.5.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/node_modules/vue-resize/dist/vue-resize.esm.js b/node_modules/vue-resize/dist/vue-resize.esm.js
index b394524..395ba7d 100644
--- a/node_modules/vue-resize/dist/vue-resize.esm.js
+++ b/node_modules/vue-resize/dist/vue-resize.esm.js
@@ -55,7 +55,9 @@ var ResizeObserver = { render: function render() {
if (!isIE && this._resizeObject.contentDocument) {
this._resizeObject.contentDocument.defaultView.removeEventListener('resize', this.compareAndNotify);
}
- delete this._resizeObject.onload;
+ this.$el.removeChild(this._resizeObject);
+ this._resizeObject.onload = null;
+ this._resizeObject = null;
}
}
},

0 comments on commit f820d77

Please sign in to comment.