Skip to content

Commit

Permalink
build: build 2.6.4
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Feb 8, 2019
1 parent b2a093f commit dfb9fb1
Show file tree
Hide file tree
Showing 19 changed files with 521 additions and 139 deletions.
74 changes: 59 additions & 15 deletions dist/vue.common.dev.js
@@ -1,5 +1,5 @@
/*!
* Vue.js v2.6.3
* Vue.js v2.6.4
* (c) 2014-2019 Evan You
* Released under the MIT License.
*/
Expand Down Expand Up @@ -1864,7 +1864,11 @@ function globalHandleError (err, vm, info) {
try {
return config.errorHandler.call(null, err, vm, info)
} catch (e) {
logError(e, null, 'config.errorHandler');
// if the user intentionally throws the original error in the handler,
// do not log it twice
if (e !== err) {
logError(e, null, 'config.errorHandler');
}
}
}
logError(err, vm, info);
Expand Down Expand Up @@ -2526,18 +2530,23 @@ function isWhitespace (node) {

function normalizeScopedSlots (
slots,
normalSlots
normalSlots,
prevSlots
) {
var res;
if (!slots) {
res = {};
} else if (slots._normalized) {
return slots
// fast path 1: child component re-render only, parent did not change
return slots._normalized
} else if (slots.$stable && prevSlots && prevSlots !== emptyObject) {
// fast path 2: stable scoped slots, only need to normalize once
return prevSlots
} else {
res = {};
for (var key in slots) {
if (slots[key] && key[0] !== '$') {
res[key] = normalizeScopedSlot(slots[key]);
res[key] = normalizeScopedSlot(normalSlots, key, slots[key]);
}
}
}
Expand All @@ -2547,18 +2556,36 @@ function normalizeScopedSlots (
res[key$1] = proxyNormalSlot(normalSlots, key$1);
}
}
def(res, '_normalized', true);
// avoriaz seems to mock a non-extensible $scopedSlots object
// and when that is passed down this would cause an error
if (slots && Object.isExtensible(slots)) {
(slots)._normalized = res;
}
def(res, '$stable', slots ? !!slots.$stable : true);
return res
}

function normalizeScopedSlot(fn) {
return function (scope) {
var res = fn(scope);
return res && typeof res === 'object' && !Array.isArray(res)
function normalizeScopedSlot(normalSlots, key, fn) {
var normalized = function (scope) {
var res = fn(scope || {});
res = res && typeof res === 'object' && !Array.isArray(res)
? [res] // single vnode
: normalizeChildren(res)
: normalizeChildren(res);
return res && res.length === 0
? undefined
: res
};
// this is a slot using the new v-slot syntax without scope. although it is
// compiled as a scoped slot, render fn users would expect it to be present
// on this.$slots because the usage is semantically a normal slot.
if (fn.proxy) {
Object.defineProperty(normalSlots, key, {
get: normalized,
enumerable: true,
configurable: true
});
}
return normalized
}

function proxyNormalSlot(slots, key) {
Expand Down Expand Up @@ -2838,6 +2865,10 @@ function resolveScopedSlots (
if (Array.isArray(slot)) {
resolveScopedSlots(slot, hasDynamicKeys, res);
} else if (slot) {
// marker for reverse proxying v-slot without scope on this.$slots
if (slot.proxy) {
slot.fn.proxy = true;
}
res[slot.key] = slot.fn;
}
}
Expand Down Expand Up @@ -2900,6 +2931,8 @@ function FunctionalRenderContext (
parent,
Ctor
) {
var this$1 = this;

var options = Ctor.options;
// ensure the createElement function in functional components
// gets a unique context - this is necessary for correct named slot check
Expand All @@ -2925,7 +2958,15 @@ function FunctionalRenderContext (
this.parent = parent;
this.listeners = data.on || emptyObject;
this.injections = resolveInject(options.inject, parent);
this.slots = function () { return resolveSlots(children, parent); };
this.slots = function () {
if (!this$1.$slots) {
normalizeScopedSlots(
data.scopedSlots,
this$1.$slots = resolveSlots(children, parent)
);
}
return this$1.$slots
};

Object.defineProperty(this, 'scopedSlots', ({
enumerable: true,
Expand Down Expand Up @@ -3451,7 +3492,8 @@ function renderMixin (Vue) {
if (_parentVnode) {
vm.$scopedSlots = normalizeScopedSlots(
_parentVnode.data.scopedSlots,
vm.$slots
vm.$slots,
vm.$scopedSlots
);
}

Expand Down Expand Up @@ -5331,7 +5373,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
value: FunctionalRenderContext
});

Vue.version = '2.6.3';
Vue.version = '2.6.4';

/* */

Expand Down Expand Up @@ -11138,7 +11180,9 @@ function genScopedSlot (
? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
: genChildren(el, state) || 'undefined'
: genElement(el, state)) + "}";
return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + "}")
// reverse proxy v-slot without scope on this.$slots
var reverseProxy = slotScope ? "" : ",proxy:true";
return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
}

function genChildren (
Expand Down
4 changes: 2 additions & 2 deletions dist/vue.common.prod.js

Large diffs are not rendered by default.

72 changes: 57 additions & 15 deletions dist/vue.esm.browser.js
@@ -1,5 +1,5 @@
/*!
* Vue.js v2.6.3
* Vue.js v2.6.4
* (c) 2014-2019 Evan You
* Released under the MIT License.
*/
Expand Down Expand Up @@ -1895,7 +1895,11 @@ function globalHandleError (err, vm, info) {
try {
return config.errorHandler.call(null, err, vm, info)
} catch (e) {
logError(e, null, 'config.errorHandler');
// if the user intentionally throws the original error in the handler,
// do not log it twice
if (e !== err) {
logError(e, null, 'config.errorHandler');
}
}
}
logError(err, vm, info);
Expand Down Expand Up @@ -2554,18 +2558,23 @@ function isWhitespace (node) {

function normalizeScopedSlots (
slots,
normalSlots
normalSlots,
prevSlots
) {
let res;
if (!slots) {
res = {};
} else if (slots._normalized) {
return slots
// fast path 1: child component re-render only, parent did not change
return slots._normalized
} else if (slots.$stable && prevSlots && prevSlots !== emptyObject) {
// fast path 2: stable scoped slots, only need to normalize once
return prevSlots
} else {
res = {};
for (const key in slots) {
if (slots[key] && key[0] !== '$') {
res[key] = normalizeScopedSlot(slots[key]);
res[key] = normalizeScopedSlot(normalSlots, key, slots[key]);
}
}
}
Expand All @@ -2575,18 +2584,36 @@ function normalizeScopedSlots (
res[key] = proxyNormalSlot(normalSlots, key);
}
}
def(res, '_normalized', true);
// avoriaz seems to mock a non-extensible $scopedSlots object
// and when that is passed down this would cause an error
if (slots && Object.isExtensible(slots)) {
(slots)._normalized = res;
}
def(res, '$stable', slots ? !!slots.$stable : true);
return res
}

function normalizeScopedSlot(fn) {
return scope => {
const res = fn(scope);
return res && typeof res === 'object' && !Array.isArray(res)
function normalizeScopedSlot(normalSlots, key, fn) {
const normalized = scope => {
let res = fn(scope || {});
res = res && typeof res === 'object' && !Array.isArray(res)
? [res] // single vnode
: normalizeChildren(res)
: normalizeChildren(res);
return res && res.length === 0
? undefined
: res
};
// this is a slot using the new v-slot syntax without scope. although it is
// compiled as a scoped slot, render fn users would expect it to be present
// on this.$slots because the usage is semantically a normal slot.
if (fn.proxy) {
Object.defineProperty(normalSlots, key, {
get: normalized,
enumerable: true,
configurable: true
});
}
return normalized
}

function proxyNormalSlot(slots, key) {
Expand Down Expand Up @@ -2864,6 +2891,10 @@ function resolveScopedSlots (
if (Array.isArray(slot)) {
resolveScopedSlots(slot, hasDynamicKeys, res);
} else if (slot) {
// marker for reverse proxying v-slot without scope on this.$slots
if (slot.proxy) {
slot.fn.proxy = true;
}
res[slot.key] = slot.fn;
}
}
Expand Down Expand Up @@ -2951,7 +2982,15 @@ function FunctionalRenderContext (
this.parent = parent;
this.listeners = data.on || emptyObject;
this.injections = resolveInject(options.inject, parent);
this.slots = () => resolveSlots(children, parent);
this.slots = () => {
if (!this.$slots) {
normalizeScopedSlots(
data.scopedSlots,
this.$slots = resolveSlots(children, parent)
);
}
return this.$slots
};

Object.defineProperty(this, 'scopedSlots', ({
enumerable: true,
Expand Down Expand Up @@ -3474,7 +3513,8 @@ function renderMixin (Vue) {
if (_parentVnode) {
vm.$scopedSlots = normalizeScopedSlots(
_parentVnode.data.scopedSlots,
vm.$slots
vm.$slots,
vm.$scopedSlots
);
}

Expand Down Expand Up @@ -5364,7 +5404,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
value: FunctionalRenderContext
});

Vue.version = '2.6.3';
Vue.version = '2.6.4';

/* */

Expand Down Expand Up @@ -11202,7 +11242,9 @@ function genScopedSlot (
: genChildren(el, state) || 'undefined'
: genElement(el, state)
}}`;
return `{key:${el.slotTarget || `"default"`},fn:${fn}}`
// reverse proxy v-slot without scope on this.$slots
const reverseProxy = slotScope ? `` : `,proxy:true`;
return `{key:${el.slotTarget || `"default"`},fn:${fn}${reverseProxy}}`
}

function genChildren (
Expand Down
4 changes: 2 additions & 2 deletions dist/vue.esm.browser.min.js

Large diffs are not rendered by default.

0 comments on commit dfb9fb1

Please sign in to comment.