From 1762a66204d4856e0725f09f12e4da16f403bf09 Mon Sep 17 00:00:00 2001 From: Evan You Date: Mon, 19 Nov 2018 00:22:21 -0500 Subject: [PATCH 001/553] chore: update sponsors --- BACKERS.md | 10 +++------- README.md | 12 +----------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/BACKERS.md b/BACKERS.md index 50d51e64ff7..d5d43ce95dc 100644 --- a/BACKERS.md +++ b/BACKERS.md @@ -302,6 +302,7 @@ Funds donated via Patreon go directly to support Evan You's full-time work on Vu - Ernest Sim - Blaise Laflamme - Dilettant +- Sean Ferguson

Backers via Patreon

@@ -310,7 +311,6 @@ Funds donated via Patreon go directly to support Evan You's full-time work on Vu - Luca Borghini - kazuya kawaguchi - Keisuke KITA -- Jack Barham - Santa Cruz - Simon East - Benjamin Listwon @@ -336,8 +336,8 @@ Funds donated via Patreon go directly to support Evan You's full-time work on Vu - Edithvale - Intevation GmbH - Luiz Eduardo Tanure Bacelar +- Chengzhi Yin - Zoran Knezevic -- Pascal Germain - Pierre Vanhulst - Jon Hobbs-Smith - Akiho Nagao @@ -359,7 +359,6 @@ Funds donated via Patreon go directly to support Evan You's full-time work on Vu - Guilherme S L de Souza - Rob Yedlin - Daniel Waghorn -- Eric Githinji - Chih-Hsuan, Fan - Jordan Oroshiba - Cliff Hess @@ -377,7 +376,6 @@ Funds donated via Patreon go directly to support Evan You's full-time work on Vu - Alexander Weiher - Daniel Cook - Shinya Katayama -- Brendan Long - Jere Sjöroos - Wakana Seki - David Ang @@ -402,7 +400,6 @@ Funds donated via Patreon go directly to support Evan You's full-time work on Vu - Chris Calo - Milan Zivkovic - Christo Crampton -- Jason Rys - Johnny Austin - Aaron Hung - Soichiro Isshiki @@ -410,8 +407,7 @@ Funds donated via Patreon go directly to support Evan You's full-time work on Vu - Rob Mellett - Abraham Arango - Marko Bošković -- Chris Lind -- Andrej +- Andrej Noskaj - Ed Linklater - Garion Herman - Chris Bemister diff --git a/README.md b/README.md index f6c0880b996..90324104b6b 100644 --- a/README.md +++ b/README.md @@ -74,17 +74,7 @@ Funds donated via Patreon go directly to support Evan You's full-time work on Vu

Platinum Sponsors (China)

- - - - - - -
- - - -
+

Gold Sponsors

From 6cc070063bd211229dff5108c99f7d11b6778550 Mon Sep 17 00:00:00 2001 From: Evan You Date: Mon, 26 Nov 2018 09:51:30 -0500 Subject: [PATCH 002/553] chore: update sponsors --- BACKERS.md | 36 ++++++++++++++++++++++++++++-------- README.md | 21 ++++++++++++++++++--- 2 files changed, 46 insertions(+), 11 deletions(-) diff --git a/BACKERS.md b/BACKERS.md index d5d43ce95dc..94709825ac7 100644 --- a/BACKERS.md +++ b/BACKERS.md @@ -21,7 +21,7 @@ Funds donated via Patreon go directly to support Evan You's full-time work on Vu

- +

Platinum via Patreon

@@ -62,6 +62,26 @@ Funds donated via Patreon go directly to support Evan You's full-time work on Vu + +

Platinum Sponsors (China)

+ + + + + + + +
+ + + + + + + +
+ +

Platinum via OpenCollective

@@ -295,13 +315,13 @@ Funds donated via Patreon go directly to support Evan You's full-time work on Vu - Wasim Khamlichi -- errorrik +- errorrik - Alex Balashov - Konstantin Levinski - Evan Leonardi - Ernest Sim - Blaise Laflamme -- Dilettant +- Dilettant - Sean Ferguson @@ -321,10 +341,10 @@ Funds donated via Patreon go directly to support Evan You's full-time work on Vu - Kirk Lewis - Karol F - Miljan Aleksic -- 叶解 +- 叶解 - Jake Ingman - Barbara Liau -- 4 +- 4 - Jarek Tkaczyk - David Hess - Niannian Modisette @@ -333,7 +353,7 @@ Funds donated via Patreon go directly to support Evan You's full-time work on Vu - Duncan J Kenzie - Mike Margerum - Guy Gavergun -- Edithvale +- Edithvale - Intevation GmbH - Luiz Eduardo Tanure Bacelar - Chengzhi Yin @@ -379,12 +399,12 @@ Funds donated via Patreon go directly to support Evan You's full-time work on Vu - Jere Sjöroos - Wakana Seki - David Ang -- Dom +- Dom - Ben Hong - David Kaplan - John Cleveland - Jaeyoung Lee -- Amor +- Amor - Tom Ootes - Andy Foster - Blake Campbell diff --git a/README.md b/README.md index 90324104b6b..aeaccb5967e 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Funds donated via Patreon go directly to support Evan You's full-time work on Vu

- +

Platinum Sponsors

@@ -72,9 +72,24 @@ Funds donated via Patreon go directly to support Evan You's full-time work on Vu -

Platinum Sponsors (China)

- +

Platinum Sponsors (China)

+ + + + + + + +
+ + + + + + + +

Gold Sponsors

From 69730fac8f2c1f43e56a82c8b2ce24827a2a5e1e Mon Sep 17 00:00:00 2001 From: william-pan Date: Fri, 30 Nov 2018 05:37:01 +0800 Subject: [PATCH 003/553] chore: update badge for Vue CLI 3 (#8640) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index aeaccb5967e..6d589e4da06 100644 --- a/README.md +++ b/README.md @@ -253,7 +253,7 @@ Vue.js supports all browsers that are [ES5-compliant](http://kangax.github.io/co [vue-router-status]: https://img.shields.io/npm/v/vue-router.svg [vuex-status]: https://img.shields.io/npm/v/vuex.svg -[vue-cli-status]: https://img.shields.io/npm/v/vue-cli.svg +[vue-cli-status]: https://img.shields.io/npm/v/@vue/cli.svg [vue-loader-status]: https://img.shields.io/npm/v/vue-loader.svg [vue-server-renderer-status]: https://img.shields.io/npm/v/vue-server-renderer.svg [vue-class-component-status]: https://img.shields.io/npm/v/vue-class-component.svg @@ -262,7 +262,7 @@ Vue.js supports all browsers that are [ES5-compliant](http://kangax.github.io/co [vue-router-package]: https://npmjs.com/package/vue-router [vuex-package]: https://npmjs.com/package/vuex -[vue-cli-package]: https://npmjs.com/package/vue-cli +[vue-cli-package]: https://npmjs.com/package/@vue/cli [vue-loader-package]: https://npmjs.com/package/vue-loader [vue-server-renderer-package]: https://npmjs.com/package/vue-server-renderer [vue-class-component-package]: https://npmjs.com/package/vue-class-component From 7b7164c11cbb74ed44ee086f0a82acfcc1ff47a2 Mon Sep 17 00:00:00 2001 From: Evan You Date: Thu, 29 Nov 2018 18:09:37 -0500 Subject: [PATCH 004/553] fix(v-model): avoid duplicate model transforms This happens when a component directly passes down its own data object to a child component. Fix #8436. --- src/core/vdom/create-component.js | 14 ++++- .../directives/model-component.spec.js | 56 +++++++++++++++++++ 2 files changed, 67 insertions(+), 3 deletions(-) diff --git a/src/core/vdom/create-component.js b/src/core/vdom/create-component.js index 697afbefb22..b769fa1e19d 100644 --- a/src/core/vdom/create-component.js +++ b/src/core/vdom/create-component.js @@ -252,9 +252,17 @@ function transformModel (options, data: any) { const event = (options.model && options.model.event) || 'input' ;(data.props || (data.props = {}))[prop] = data.model.value const on = data.on || (data.on = {}) - if (isDef(on[event])) { - on[event] = [data.model.callback].concat(on[event]) + const existing = on[event] + const callback = data.model.callback + if (isDef(existing)) { + if ( + Array.isArray(existing) + ? existing.indexOf(callback) === -1 + : existing !== callback + ) { + on[event] = [callback].concat(existing) + } } else { - on[event] = data.model.callback + on[event] = callback } } diff --git a/test/unit/features/directives/model-component.spec.js b/test/unit/features/directives/model-component.spec.js index 6098e4d6241..9f9536ada09 100644 --- a/test/unit/features/directives/model-component.spec.js +++ b/test/unit/features/directives/model-component.spec.js @@ -148,4 +148,60 @@ describe('Directive v-model component', () => { vm.$refs.input.$emit('input', ' foo o ') expect(vm.text).toBe('foo o') }) + + // #8436 + it('should not double transform mode props', () => { + const BaseInput = { + props: ['value'], + render (h) { + return h('input', { + domProps: { + value: this.value + }, + on: { + input: e => this.$emit('input', e.target.value) + } + }) + } + } + + const FunctionalWrapper = { + functional: true, + render (h, ctx) { + return h(BaseInput, ctx.data) + } + } + + let triggerCount = 0 + + const vm = new Vue({ + components: { + FunctionalWrapper + }, + template: ` +
+ +
+ `, + data: { + internalVal: '' + }, + computed: { + val: { + get () { + return this.internalVal + }, + set (val) { + triggerCount++ + this.internalVal = val + } + } + } + }).$mount() + + document.body.appendChild(vm.$el) + triggerEvent(vm.$el.querySelector('input'), 'input') + expect(triggerCount).toBe(1) + document.body.removeChild(vm.$el) + }) }) From 2686818beb5728e3b7aa22f47a3b3f0d39d90c8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Fontcuberta?= Date: Fri, 30 Nov 2018 00:14:28 +0100 Subject: [PATCH 005/553] fix(error handling): handle errors on immediate watcher execution (#8581) The handle callback call should be wrapped in a try/catch that explicitly calls handleError fix #8567 --- src/core/instance/state.js | 6 +++++- test/unit/features/error-handling.spec.js | 25 +++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/core/instance/state.js b/src/core/instance/state.js index f70f7d1366e..50311b2f618 100644 --- a/src/core/instance/state.js +++ b/src/core/instance/state.js @@ -351,7 +351,11 @@ export function stateMixin (Vue: Class) { options.user = true const watcher = new Watcher(vm, expOrFn, cb, options) if (options.immediate) { - cb.call(vm, watcher.value) + try { + cb.call(vm, watcher.value) + } catch (error) { + handleError(error, vm, `callback for immediate watcher "${watcher.expression}"`) + } } return function unwatchFn () { watcher.teardown() diff --git a/test/unit/features/error-handling.spec.js b/test/unit/features/error-handling.spec.js index 77ac0b928b3..713c91a766d 100644 --- a/test/unit/features/error-handling.spec.js +++ b/test/unit/features/error-handling.spec.js @@ -92,6 +92,16 @@ describe('Error handling', () => { }).then(done) }) + it('should recover from errors in user immediate watcher callback', done => { + const vm = createTestInstance(components.userImmediateWatcherCallback) + waitForUpdate(() => { + expect(`Error in callback for immediate watcher "n"`).toHaveBeenWarned() + expect(`Error: userImmediateWatcherCallback error`).toHaveBeenWarned() + }).thenWaitFor(next => { + assertBothInstancesActive(vm).end(next) + }).then(done) + }) + it('config.errorHandler should capture render errors', done => { const spy = Vue.config.errorHandler = jasmine.createSpy('errorHandler') const vm = createTestInstance(components.render) @@ -234,6 +244,21 @@ function createErrorTestComponents () { } } + components.userImmediateWatcherCallback = { + props: ['n'], + watch: { + n: { + immediate: true, + handler () { + throw new Error('userImmediateWatcherCallback error') + } + } + }, + render (h) { + return h('div', this.n) + } + } + // event errors components.event = { beforeCreate () { From 4ecc21c29ec12bb33d3b426cb4d42c579e9b0f2d Mon Sep 17 00:00:00 2001 From: Rahul Kadyan Date: Sat, 1 Dec 2018 04:01:44 +0530 Subject: [PATCH 006/553] feat(devtools): store functional render context on vnode in development (#8586) --- src/core/vdom/create-functional-component.js | 9 ++++++--- src/core/vdom/vnode.js | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/core/vdom/create-functional-component.js b/src/core/vdom/create-functional-component.js index efed801db7d..4233ade22e8 100644 --- a/src/core/vdom/create-functional-component.js +++ b/src/core/vdom/create-functional-component.js @@ -105,24 +105,27 @@ export function createFunctionalComponent ( const vnode = options.render.call(null, renderContext._c, renderContext) if (vnode instanceof VNode) { - return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options) + return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext) } else if (Array.isArray(vnode)) { const vnodes = normalizeChildren(vnode) || [] const res = new Array(vnodes.length) for (let i = 0; i < vnodes.length; i++) { - res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options) + res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext) } return res } } -function cloneAndMarkFunctionalResult (vnode, data, contextVm, options) { +function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) { // #7817 clone node before setting fnContext, otherwise if the node is reused // (e.g. it was from a cached normal slot) the fnContext causes named slots // that should not be matched to match. const clone = cloneVNode(vnode) clone.fnContext = contextVm clone.fnOptions = options + if (process.env.NODE_ENV !== 'production') { + ;(clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext + } if (data.slot) { (clone.data || (clone.data = {})).slot = data.slot } diff --git a/src/core/vdom/vnode.js b/src/core/vdom/vnode.js index c3e00078fea..0e3e2e9e635 100644 --- a/src/core/vdom/vnode.js +++ b/src/core/vdom/vnode.js @@ -26,6 +26,7 @@ export default class VNode { ssrContext: Object | void; fnContext: Component | void; // real context vm for functional nodes fnOptions: ?ComponentOptions; // for SSR caching + devtoolsMeta: ?Object; // used to store functional render context for devtools fnScopeId: ?string; // functional scope id support constructor ( From 5624278fbe5d85cfe578d749da12b1e73c3e61a9 Mon Sep 17 00:00:00 2001 From: Clark Du Date: Fri, 30 Nov 2018 22:32:28 +0000 Subject: [PATCH 007/553] fix(ssr): check js assets more accurate in ssr webpack plugin (#8639) --- src/server/webpack-plugin/server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/webpack-plugin/server.js b/src/server/webpack-plugin/server.js index a9a38337411..305b4bab58b 100644 --- a/src/server/webpack-plugin/server.js +++ b/src/server/webpack-plugin/server.js @@ -43,7 +43,7 @@ export default class VueSSRServerPlugin { } stats.assets.forEach(asset => { - if (asset.name.match(/\.js$/)) { + if (isJS(asset.name)) { bundle.files[asset.name] = compilation.assets[asset.name].source() } else if (asset.name.match(/\.js\.map$/)) { bundle.maps[asset.name.replace(/\.map$/, '')] = JSON.parse(compilation.assets[asset.name].source()) From 5f6ef15fb2879411797aee0287b811977f6ebb42 Mon Sep 17 00:00:00 2001 From: HcySunYang Date: Sat, 1 Dec 2018 06:35:10 +0800 Subject: [PATCH 008/553] polish: warn sequential index on (#8748) --- src/compiler/parser/index.js | 16 ++++++++++++++-- test/unit/modules/compiler/parser.spec.js | 11 +++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/compiler/parser/index.js b/src/compiler/parser/index.js index 5bf124b4160..56c996e8fd1 100644 --- a/src/compiler/parser/index.js +++ b/src/compiler/parser/index.js @@ -331,8 +331,20 @@ export function processElement (element: ASTElement, options: CompilerOptions) { function processKey (el) { const exp = getBindingAttr(el, 'key') if (exp) { - if (process.env.NODE_ENV !== 'production' && el.tag === 'template') { - warn(`