build: build 2.5.11

This commit is contained in:
Evan You 2017-12-14 11:56:00 -05:00
parent 3f0c628e2c
commit 36efc76256
14 changed files with 533 additions and 1184 deletions

90
dist/vue.common.js vendored
View File

@ -1,5 +1,5 @@
/*!
* Vue.js v2.5.10
* Vue.js v2.5.11
* (c) 2014-2017 Evan You
* Released under the MIT License.
*/
@ -342,6 +342,7 @@ var config = ({
/**
* Option merge strategies (used in core/util/options)
*/
// $flow-disable-line
optionMergeStrategies: Object.create(null),
/**
@ -382,6 +383,7 @@ var config = ({
/**
* Custom user key aliases for v-on
*/
// $flow-disable-line
keyCodes: Object.create(null),
/**
@ -816,8 +818,7 @@ var arrayMethods = Object.create(arrayProto);[
'splice',
'sort',
'reverse'
]
.forEach(function (method) {
].forEach(function (method) {
// cache original method
var original = arrayProto[method];
def(arrayMethods, method, function mutator () {
@ -1324,8 +1325,7 @@ function validateComponentName (name) {
'and must start with a letter.'
);
}
var lower = name.toLowerCase();
if (isBuiltInTag(lower) || config.isReservedTag(lower)) {
if (isBuiltInTag(name) || config.isReservedTag(name)) {
warn(
'Do not use built-in or reserved HTML elements as component ' +
'id: ' + name
@ -1357,6 +1357,9 @@ function normalizeProps (options, vm) {
for (var key in props) {
val = props[key];
name = camelize(key);
if (process.env.NODE_ENV !== 'production' && isPlainObject(val)) {
validatePropObject(name, val, vm);
}
res[name] = isPlainObject(val)
? val
: { type: val };
@ -1371,6 +1374,26 @@ function normalizeProps (options, vm) {
options.props = res;
}
/**
* Validate whether a prop object keys are valid.
*/
var propOptionsRE = /^(type|default|required|validator)$/;
function validatePropObject (
propName,
prop,
vm
) {
for (var key in prop) {
if (!propOptionsRE.test(key)) {
warn(
("Invalid key \"" + key + "\" in validation rules object for prop \"" + propName + "\"."),
vm
);
}
}
}
/**
* Normalize all injections into Object-based format
*/
@ -2518,6 +2541,8 @@ function eventsMixin (Vue) {
/* */
/**
* Runtime helper for resolving raw children VNodes into a slot object.
*/
@ -2541,10 +2566,10 @@ function resolveSlots (
if ((child.context === context || child.fnContext === context) &&
data && data.slot != null
) {
var name = child.data.slot;
var name = data.slot;
var slot = (slots[name] || (slots[name] = []));
if (child.tag === 'template') {
slot.push.apply(slot, child.children);
slot.push.apply(slot, child.children || []);
} else {
slot.push(child);
}
@ -3385,6 +3410,7 @@ function getData (data, vm) {
var computedWatcherOptions = { lazy: true };
function initComputed (vm, computed) {
// $flow-disable-line
var watchers = vm._computedWatchers = Object.create(null);
// computed properties are just getters during SSR
var isSSR = isServerRendering();
@ -3615,11 +3641,11 @@ function resolveInject (inject, vm) {
// inject is :any because flow is not smart enough to figure out cached
var result = Object.create(null);
var keys = hasSymbol
? Reflect.ownKeys(inject).filter(function (key) {
/* istanbul ignore next */
return Object.getOwnPropertyDescriptor(inject, key).enumerable
})
: Object.keys(inject);
? Reflect.ownKeys(inject).filter(function (key) {
/* istanbul ignore next */
return Object.getOwnPropertyDescriptor(inject, key).enumerable
})
: Object.keys(inject);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
@ -4976,7 +5002,7 @@ Object.defineProperty(Vue$3.prototype, '$ssrContext', {
}
});
Vue$3.version = '2.5.10';
Vue$3.version = '2.5.11';
/* */
@ -5028,12 +5054,12 @@ function genClassForVnode (vnode) {
var childNode = vnode;
while (isDef(childNode.componentInstance)) {
childNode = childNode.componentInstance._vnode;
if (childNode.data) {
if (childNode && childNode.data) {
data = mergeClassData(childNode.data, data);
}
}
while (isDef(parentNode = parentNode.parent)) {
if (parentNode.data) {
if (parentNode && parentNode.data) {
data = mergeClassData(data, parentNode.data);
}
}
@ -6134,17 +6160,20 @@ function normalizeDirectives$1 (
) {
var res = Object.create(null);
if (!dirs) {
// $flow-disable-line
return res
}
var i, dir;
for (i = 0; i < dirs.length; i++) {
dir = dirs[i];
if (!dir.modifiers) {
// $flow-disable-line
dir.modifiers = emptyModifiers;
}
res[getRawDirName(dir)] = dir;
dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
}
// $flow-disable-line
return res
}
@ -6770,11 +6799,11 @@ function genCheckboxModel (
var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
addProp(el, 'checked',
"Array.isArray(" + value + ")" +
"?_i(" + value + "," + valueBinding + ")>-1" + (
trueValueBinding === 'true'
? (":(" + value + ")")
: (":_q(" + value + "," + trueValueBinding + ")")
)
"?_i(" + value + "," + valueBinding + ")>-1" + (
trueValueBinding === 'true'
? (":(" + value + ")")
: (":_q(" + value + "," + trueValueBinding + ")")
)
);
addHandler(el, 'change',
"var $$a=" + value + "," +
@ -6791,9 +6820,9 @@ function genCheckboxModel (
}
function genRadioModel (
el,
value,
modifiers
el,
value,
modifiers
) {
var number = modifiers && modifiers.number;
var valueBinding = getBindingAttr(el, 'value') || 'null';
@ -6803,9 +6832,9 @@ function genRadioModel (
}
function genSelect (
el,
value,
modifiers
el,
value,
modifiers
) {
var number = modifiers && modifiers.number;
var selectedVal = "Array.prototype.filter" +
@ -7094,7 +7123,10 @@ function getStyle (vnode, checkChild) {
var childNode = vnode;
while (childNode.componentInstance) {
childNode = childNode.componentInstance._vnode;
if (childNode.data && (styleData = normalizeStyleData(childNode.data))) {
if (
childNode && childNode.data &&
(styleData = normalizeStyleData(childNode.data))
) {
extend(res, styleData);
}
}
@ -8250,7 +8282,7 @@ var TransitionGroup = {
this._vnode,
this.kept,
false, // hydrating
true // removeOnly (!important, avoids unnecessary moves)
true // removeOnly (!important avoids unnecessary moves)
);
this._vnode = this.kept;
},
@ -10574,7 +10606,7 @@ function createCompilerCreator (baseCompile) {
// merge custom directives
if (options.directives) {
finalOptions.directives = extend(
Object.create(baseOptions.directives),
Object.create(baseOptions.directives || null),
options.directives
);
}

90
dist/vue.esm.js vendored
View File

@ -1,5 +1,5 @@
/*!
* Vue.js v2.5.10
* Vue.js v2.5.11
* (c) 2014-2017 Evan You
* Released under the MIT License.
*/
@ -340,6 +340,7 @@ var config = ({
/**
* Option merge strategies (used in core/util/options)
*/
// $flow-disable-line
optionMergeStrategies: Object.create(null),
/**
@ -380,6 +381,7 @@ var config = ({
/**
* Custom user key aliases for v-on
*/
// $flow-disable-line
keyCodes: Object.create(null),
/**
@ -814,8 +816,7 @@ var arrayMethods = Object.create(arrayProto);[
'splice',
'sort',
'reverse'
]
.forEach(function (method) {
].forEach(function (method) {
// cache original method
var original = arrayProto[method];
def(arrayMethods, method, function mutator () {
@ -1322,8 +1323,7 @@ function validateComponentName (name) {
'and must start with a letter.'
);
}
var lower = name.toLowerCase();
if (isBuiltInTag(lower) || config.isReservedTag(lower)) {
if (isBuiltInTag(name) || config.isReservedTag(name)) {
warn(
'Do not use built-in or reserved HTML elements as component ' +
'id: ' + name
@ -1355,6 +1355,9 @@ function normalizeProps (options, vm) {
for (var key in props) {
val = props[key];
name = camelize(key);
if (process.env.NODE_ENV !== 'production' && isPlainObject(val)) {
validatePropObject(name, val, vm);
}
res[name] = isPlainObject(val)
? val
: { type: val };
@ -1369,6 +1372,26 @@ function normalizeProps (options, vm) {
options.props = res;
}
/**
* Validate whether a prop object keys are valid.
*/
var propOptionsRE = /^(type|default|required|validator)$/;
function validatePropObject (
propName,
prop,
vm
) {
for (var key in prop) {
if (!propOptionsRE.test(key)) {
warn(
("Invalid key \"" + key + "\" in validation rules object for prop \"" + propName + "\"."),
vm
);
}
}
}
/**
* Normalize all injections into Object-based format
*/
@ -2516,6 +2539,8 @@ function eventsMixin (Vue) {
/* */
/**
* Runtime helper for resolving raw children VNodes into a slot object.
*/
@ -2539,10 +2564,10 @@ function resolveSlots (
if ((child.context === context || child.fnContext === context) &&
data && data.slot != null
) {
var name = child.data.slot;
var name = data.slot;
var slot = (slots[name] || (slots[name] = []));
if (child.tag === 'template') {
slot.push.apply(slot, child.children);
slot.push.apply(slot, child.children || []);
} else {
slot.push(child);
}
@ -3383,6 +3408,7 @@ function getData (data, vm) {
var computedWatcherOptions = { lazy: true };
function initComputed (vm, computed) {
// $flow-disable-line
var watchers = vm._computedWatchers = Object.create(null);
// computed properties are just getters during SSR
var isSSR = isServerRendering();
@ -3613,11 +3639,11 @@ function resolveInject (inject, vm) {
// inject is :any because flow is not smart enough to figure out cached
var result = Object.create(null);
var keys = hasSymbol
? Reflect.ownKeys(inject).filter(function (key) {
/* istanbul ignore next */
return Object.getOwnPropertyDescriptor(inject, key).enumerable
})
: Object.keys(inject);
? Reflect.ownKeys(inject).filter(function (key) {
/* istanbul ignore next */
return Object.getOwnPropertyDescriptor(inject, key).enumerable
})
: Object.keys(inject);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
@ -4974,7 +5000,7 @@ Object.defineProperty(Vue$3.prototype, '$ssrContext', {
}
});
Vue$3.version = '2.5.10';
Vue$3.version = '2.5.11';
/* */
@ -5026,12 +5052,12 @@ function genClassForVnode (vnode) {
var childNode = vnode;
while (isDef(childNode.componentInstance)) {
childNode = childNode.componentInstance._vnode;
if (childNode.data) {
if (childNode && childNode.data) {
data = mergeClassData(childNode.data, data);
}
}
while (isDef(parentNode = parentNode.parent)) {
if (parentNode.data) {
if (parentNode && parentNode.data) {
data = mergeClassData(data, parentNode.data);
}
}
@ -6132,17 +6158,20 @@ function normalizeDirectives$1 (
) {
var res = Object.create(null);
if (!dirs) {
// $flow-disable-line
return res
}
var i, dir;
for (i = 0; i < dirs.length; i++) {
dir = dirs[i];
if (!dir.modifiers) {
// $flow-disable-line
dir.modifiers = emptyModifiers;
}
res[getRawDirName(dir)] = dir;
dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
}
// $flow-disable-line
return res
}
@ -6768,11 +6797,11 @@ function genCheckboxModel (
var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
addProp(el, 'checked',
"Array.isArray(" + value + ")" +
"?_i(" + value + "," + valueBinding + ")>-1" + (
trueValueBinding === 'true'
? (":(" + value + ")")
: (":_q(" + value + "," + trueValueBinding + ")")
)
"?_i(" + value + "," + valueBinding + ")>-1" + (
trueValueBinding === 'true'
? (":(" + value + ")")
: (":_q(" + value + "," + trueValueBinding + ")")
)
);
addHandler(el, 'change',
"var $$a=" + value + "," +
@ -6789,9 +6818,9 @@ function genCheckboxModel (
}
function genRadioModel (
el,
value,
modifiers
el,
value,
modifiers
) {
var number = modifiers && modifiers.number;
var valueBinding = getBindingAttr(el, 'value') || 'null';
@ -6801,9 +6830,9 @@ function genRadioModel (
}
function genSelect (
el,
value,
modifiers
el,
value,
modifiers
) {
var number = modifiers && modifiers.number;
var selectedVal = "Array.prototype.filter" +
@ -7092,7 +7121,10 @@ function getStyle (vnode, checkChild) {
var childNode = vnode;
while (childNode.componentInstance) {
childNode = childNode.componentInstance._vnode;
if (childNode.data && (styleData = normalizeStyleData(childNode.data))) {
if (
childNode && childNode.data &&
(styleData = normalizeStyleData(childNode.data))
) {
extend(res, styleData);
}
}
@ -8248,7 +8280,7 @@ var TransitionGroup = {
this._vnode,
this.kept,
false, // hydrating
true // removeOnly (!important, avoids unnecessary moves)
true // removeOnly (!important avoids unnecessary moves)
);
this._vnode = this.kept;
},
@ -10572,7 +10604,7 @@ function createCompilerCreator (baseCompile) {
// merge custom directives
if (options.directives) {
finalOptions.directives = extend(
Object.create(baseOptions.directives),
Object.create(baseOptions.directives || null),
options.directives
);
}

90
dist/vue.js vendored
View File

@ -1,5 +1,5 @@
/*!
* Vue.js v2.5.10
* Vue.js v2.5.11
* (c) 2014-2017 Evan You
* Released under the MIT License.
*/
@ -346,6 +346,7 @@ var config = ({
/**
* Option merge strategies (used in core/util/options)
*/
// $flow-disable-line
optionMergeStrategies: Object.create(null),
/**
@ -386,6 +387,7 @@ var config = ({
/**
* Custom user key aliases for v-on
*/
// $flow-disable-line
keyCodes: Object.create(null),
/**
@ -820,8 +822,7 @@ var arrayMethods = Object.create(arrayProto);[
'splice',
'sort',
'reverse'
]
.forEach(function (method) {
].forEach(function (method) {
// cache original method
var original = arrayProto[method];
def(arrayMethods, method, function mutator () {
@ -1328,8 +1329,7 @@ function validateComponentName (name) {
'and must start with a letter.'
);
}
var lower = name.toLowerCase();
if (isBuiltInTag(lower) || config.isReservedTag(lower)) {
if (isBuiltInTag(name) || config.isReservedTag(name)) {
warn(
'Do not use built-in or reserved HTML elements as component ' +
'id: ' + name
@ -1361,6 +1361,9 @@ function normalizeProps (options, vm) {
for (var key in props) {
val = props[key];
name = camelize(key);
if ("development" !== 'production' && isPlainObject(val)) {
validatePropObject(name, val, vm);
}
res[name] = isPlainObject(val)
? val
: { type: val };
@ -1375,6 +1378,26 @@ function normalizeProps (options, vm) {
options.props = res;
}
/**
* Validate whether a prop object keys are valid.
*/
var propOptionsRE = /^(type|default|required|validator)$/;
function validatePropObject (
propName,
prop,
vm
) {
for (var key in prop) {
if (!propOptionsRE.test(key)) {
warn(
("Invalid key \"" + key + "\" in validation rules object for prop \"" + propName + "\"."),
vm
);
}
}
}
/**
* Normalize all injections into Object-based format
*/
@ -2520,6 +2543,8 @@ function eventsMixin (Vue) {
/* */
/**
* Runtime helper for resolving raw children VNodes into a slot object.
*/
@ -2543,10 +2568,10 @@ function resolveSlots (
if ((child.context === context || child.fnContext === context) &&
data && data.slot != null
) {
var name = child.data.slot;
var name = data.slot;
var slot = (slots[name] || (slots[name] = []));
if (child.tag === 'template') {
slot.push.apply(slot, child.children);
slot.push.apply(slot, child.children || []);
} else {
slot.push(child);
}
@ -3383,6 +3408,7 @@ function getData (data, vm) {
var computedWatcherOptions = { lazy: true };
function initComputed (vm, computed) {
// $flow-disable-line
var watchers = vm._computedWatchers = Object.create(null);
// computed properties are just getters during SSR
var isSSR = isServerRendering();
@ -3611,11 +3637,11 @@ function resolveInject (inject, vm) {
// inject is :any because flow is not smart enough to figure out cached
var result = Object.create(null);
var keys = hasSymbol
? Reflect.ownKeys(inject).filter(function (key) {
/* istanbul ignore next */
return Object.getOwnPropertyDescriptor(inject, key).enumerable
})
: Object.keys(inject);
? Reflect.ownKeys(inject).filter(function (key) {
/* istanbul ignore next */
return Object.getOwnPropertyDescriptor(inject, key).enumerable
})
: Object.keys(inject);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
@ -4965,7 +4991,7 @@ Object.defineProperty(Vue$3.prototype, '$ssrContext', {
}
});
Vue$3.version = '2.5.10';
Vue$3.version = '2.5.11';
/* */
@ -5017,12 +5043,12 @@ function genClassForVnode (vnode) {
var childNode = vnode;
while (isDef(childNode.componentInstance)) {
childNode = childNode.componentInstance._vnode;
if (childNode.data) {
if (childNode && childNode.data) {
data = mergeClassData(childNode.data, data);
}
}
while (isDef(parentNode = parentNode.parent)) {
if (parentNode.data) {
if (parentNode && parentNode.data) {
data = mergeClassData(data, parentNode.data);
}
}
@ -6123,17 +6149,20 @@ function normalizeDirectives$1 (
) {
var res = Object.create(null);
if (!dirs) {
// $flow-disable-line
return res
}
var i, dir;
for (i = 0; i < dirs.length; i++) {
dir = dirs[i];
if (!dir.modifiers) {
// $flow-disable-line
dir.modifiers = emptyModifiers;
}
res[getRawDirName(dir)] = dir;
dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
}
// $flow-disable-line
return res
}
@ -6759,11 +6788,11 @@ function genCheckboxModel (
var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
addProp(el, 'checked',
"Array.isArray(" + value + ")" +
"?_i(" + value + "," + valueBinding + ")>-1" + (
trueValueBinding === 'true'
? (":(" + value + ")")
: (":_q(" + value + "," + trueValueBinding + ")")
)
"?_i(" + value + "," + valueBinding + ")>-1" + (
trueValueBinding === 'true'
? (":(" + value + ")")
: (":_q(" + value + "," + trueValueBinding + ")")
)
);
addHandler(el, 'change',
"var $$a=" + value + "," +
@ -6780,9 +6809,9 @@ function genCheckboxModel (
}
function genRadioModel (
el,
value,
modifiers
el,
value,
modifiers
) {
var number = modifiers && modifiers.number;
var valueBinding = getBindingAttr(el, 'value') || 'null';
@ -6792,9 +6821,9 @@ function genRadioModel (
}
function genSelect (
el,
value,
modifiers
el,
value,
modifiers
) {
var number = modifiers && modifiers.number;
var selectedVal = "Array.prototype.filter" +
@ -7083,7 +7112,10 @@ function getStyle (vnode, checkChild) {
var childNode = vnode;
while (childNode.componentInstance) {
childNode = childNode.componentInstance._vnode;
if (childNode.data && (styleData = normalizeStyleData(childNode.data))) {
if (
childNode && childNode.data &&
(styleData = normalizeStyleData(childNode.data))
) {
extend(res, styleData);
}
}
@ -8239,7 +8271,7 @@ var TransitionGroup = {
this._vnode,
this.kept,
false, // hydrating
true // removeOnly (!important, avoids unnecessary moves)
true // removeOnly (!important avoids unnecessary moves)
);
this._vnode = this.kept;
},
@ -10563,7 +10595,7 @@ function createCompilerCreator (baseCompile) {
// merge custom directives
if (options.directives) {
finalOptions.directives = extend(
Object.create(baseOptions.directives),
Object.create(baseOptions.directives || null),
options.directives
);
}

4
dist/vue.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*!
* Vue.js v2.5.10
* Vue.js v2.5.11
* (c) 2014-2017 Evan You
* Released under the MIT License.
*/
@ -338,6 +338,7 @@ var config = ({
/**
* Option merge strategies (used in core/util/options)
*/
// $flow-disable-line
optionMergeStrategies: Object.create(null),
/**
@ -378,6 +379,7 @@ var config = ({
/**
* Custom user key aliases for v-on
*/
// $flow-disable-line
keyCodes: Object.create(null),
/**
@ -812,8 +814,7 @@ var arrayMethods = Object.create(arrayProto);[
'splice',
'sort',
'reverse'
]
.forEach(function (method) {
].forEach(function (method) {
// cache original method
var original = arrayProto[method];
def(arrayMethods, method, function mutator () {
@ -1320,8 +1321,7 @@ function validateComponentName (name) {
'and must start with a letter.'
);
}
var lower = name.toLowerCase();
if (isBuiltInTag(lower) || config.isReservedTag(lower)) {
if (isBuiltInTag(name) || config.isReservedTag(name)) {
warn(
'Do not use built-in or reserved HTML elements as component ' +
'id: ' + name
@ -1353,6 +1353,9 @@ function normalizeProps (options, vm) {
for (var key in props) {
val = props[key];
name = camelize(key);
if (process.env.NODE_ENV !== 'production' && isPlainObject(val)) {
validatePropObject(name, val, vm);
}
res[name] = isPlainObject(val)
? val
: { type: val };
@ -1367,6 +1370,26 @@ function normalizeProps (options, vm) {
options.props = res;
}
/**
* Validate whether a prop object keys are valid.
*/
var propOptionsRE = /^(type|default|required|validator)$/;
function validatePropObject (
propName,
prop,
vm
) {
for (var key in prop) {
if (!propOptionsRE.test(key)) {
warn(
("Invalid key \"" + key + "\" in validation rules object for prop \"" + propName + "\"."),
vm
);
}
}
}
/**
* Normalize all injections into Object-based format
*/
@ -2514,6 +2537,8 @@ function eventsMixin (Vue) {
/* */
/**
* Runtime helper for resolving raw children VNodes into a slot object.
*/
@ -2537,10 +2562,10 @@ function resolveSlots (
if ((child.context === context || child.fnContext === context) &&
data && data.slot != null
) {
var name = child.data.slot;
var name = data.slot;
var slot = (slots[name] || (slots[name] = []));
if (child.tag === 'template') {
slot.push.apply(slot, child.children);
slot.push.apply(slot, child.children || []);
} else {
slot.push(child);
}
@ -3381,6 +3406,7 @@ function getData (data, vm) {
var computedWatcherOptions = { lazy: true };
function initComputed (vm, computed) {
// $flow-disable-line
var watchers = vm._computedWatchers = Object.create(null);
// computed properties are just getters during SSR
var isSSR = isServerRendering();
@ -3611,11 +3637,11 @@ function resolveInject (inject, vm) {
// inject is :any because flow is not smart enough to figure out cached
var result = Object.create(null);
var keys = hasSymbol
? Reflect.ownKeys(inject).filter(function (key) {
/* istanbul ignore next */
return Object.getOwnPropertyDescriptor(inject, key).enumerable
})
: Object.keys(inject);
? Reflect.ownKeys(inject).filter(function (key) {
/* istanbul ignore next */
return Object.getOwnPropertyDescriptor(inject, key).enumerable
})
: Object.keys(inject);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
@ -4972,7 +4998,7 @@ Object.defineProperty(Vue$3.prototype, '$ssrContext', {
}
});
Vue$3.version = '2.5.10';
Vue$3.version = '2.5.11';
/* */
@ -5024,12 +5050,12 @@ function genClassForVnode (vnode) {
var childNode = vnode;
while (isDef(childNode.componentInstance)) {
childNode = childNode.componentInstance._vnode;
if (childNode.data) {
if (childNode && childNode.data) {
data = mergeClassData(childNode.data, data);
}
}
while (isDef(parentNode = parentNode.parent)) {
if (parentNode.data) {
if (parentNode && parentNode.data) {
data = mergeClassData(data, parentNode.data);
}
}
@ -6130,17 +6156,20 @@ function normalizeDirectives$1 (
) {
var res = Object.create(null);
if (!dirs) {
// $flow-disable-line
return res
}
var i, dir;
for (i = 0; i < dirs.length; i++) {
dir = dirs[i];
if (!dir.modifiers) {
// $flow-disable-line
dir.modifiers = emptyModifiers;
}
res[getRawDirName(dir)] = dir;
dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
}
// $flow-disable-line
return res
}
@ -6564,7 +6593,10 @@ function getStyle (vnode, checkChild) {
var childNode = vnode;
while (childNode.componentInstance) {
childNode = childNode.componentInstance._vnode;
if (childNode.data && (styleData = normalizeStyleData(childNode.data))) {
if (
childNode && childNode.data &&
(styleData = normalizeStyleData(childNode.data))
) {
extend(res, styleData);
}
}
@ -7720,7 +7752,7 @@ var TransitionGroup = {
this._vnode,
this.kept,
false, // hydrating
true // removeOnly (!important, avoids unnecessary moves)
true // removeOnly (!important avoids unnecessary moves)
);
this._vnode = this.kept;
},

View File

@ -1,5 +1,5 @@
/*!
* Vue.js v2.5.10
* Vue.js v2.5.11
* (c) 2014-2017 Evan You
* Released under the MIT License.
*/
@ -336,6 +336,7 @@ var config = ({
/**
* Option merge strategies (used in core/util/options)
*/
// $flow-disable-line
optionMergeStrategies: Object.create(null),
/**
@ -376,6 +377,7 @@ var config = ({
/**
* Custom user key aliases for v-on
*/
// $flow-disable-line
keyCodes: Object.create(null),
/**
@ -810,8 +812,7 @@ var arrayMethods = Object.create(arrayProto);[
'splice',
'sort',
'reverse'
]
.forEach(function (method) {
].forEach(function (method) {
// cache original method
var original = arrayProto[method];
def(arrayMethods, method, function mutator () {
@ -1318,8 +1319,7 @@ function validateComponentName (name) {
'and must start with a letter.'
);
}
var lower = name.toLowerCase();
if (isBuiltInTag(lower) || config.isReservedTag(lower)) {
if (isBuiltInTag(name) || config.isReservedTag(name)) {
warn(
'Do not use built-in or reserved HTML elements as component ' +
'id: ' + name
@ -1351,6 +1351,9 @@ function normalizeProps (options, vm) {
for (var key in props) {
val = props[key];
name = camelize(key);
if (process.env.NODE_ENV !== 'production' && isPlainObject(val)) {
validatePropObject(name, val, vm);
}
res[name] = isPlainObject(val)
? val
: { type: val };
@ -1365,6 +1368,26 @@ function normalizeProps (options, vm) {
options.props = res;
}
/**
* Validate whether a prop object keys are valid.
*/
var propOptionsRE = /^(type|default|required|validator)$/;
function validatePropObject (
propName,
prop,
vm
) {
for (var key in prop) {
if (!propOptionsRE.test(key)) {
warn(
("Invalid key \"" + key + "\" in validation rules object for prop \"" + propName + "\"."),
vm
);
}
}
}
/**
* Normalize all injections into Object-based format
*/
@ -2512,6 +2535,8 @@ function eventsMixin (Vue) {
/* */
/**
* Runtime helper for resolving raw children VNodes into a slot object.
*/
@ -2535,10 +2560,10 @@ function resolveSlots (
if ((child.context === context || child.fnContext === context) &&
data && data.slot != null
) {
var name = child.data.slot;
var name = data.slot;
var slot = (slots[name] || (slots[name] = []));
if (child.tag === 'template') {
slot.push.apply(slot, child.children);
slot.push.apply(slot, child.children || []);
} else {
slot.push(child);
}
@ -3379,6 +3404,7 @@ function getData (data, vm) {
var computedWatcherOptions = { lazy: true };
function initComputed (vm, computed) {
// $flow-disable-line
var watchers = vm._computedWatchers = Object.create(null);
// computed properties are just getters during SSR
var isSSR = isServerRendering();
@ -3609,11 +3635,11 @@ function resolveInject (inject, vm) {
// inject is :any because flow is not smart enough to figure out cached
var result = Object.create(null);
var keys = hasSymbol
? Reflect.ownKeys(inject).filter(function (key) {
/* istanbul ignore next */
return Object.getOwnPropertyDescriptor(inject, key).enumerable
})
: Object.keys(inject);
? Reflect.ownKeys(inject).filter(function (key) {
/* istanbul ignore next */
return Object.getOwnPropertyDescriptor(inject, key).enumerable
})
: Object.keys(inject);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
@ -4970,7 +4996,7 @@ Object.defineProperty(Vue$3.prototype, '$ssrContext', {
}
});
Vue$3.version = '2.5.10';
Vue$3.version = '2.5.11';
/* */
@ -5022,12 +5048,12 @@ function genClassForVnode (vnode) {
var childNode = vnode;
while (isDef(childNode.componentInstance)) {
childNode = childNode.componentInstance._vnode;
if (childNode.data) {
if (childNode && childNode.data) {
data = mergeClassData(childNode.data, data);
}
}
while (isDef(parentNode = parentNode.parent)) {
if (parentNode.data) {
if (parentNode && parentNode.data) {
data = mergeClassData(data, parentNode.data);
}
}
@ -6128,17 +6154,20 @@ function normalizeDirectives$1 (
) {
var res = Object.create(null);
if (!dirs) {
// $flow-disable-line
return res
}
var i, dir;
for (i = 0; i < dirs.length; i++) {
dir = dirs[i];
if (!dir.modifiers) {
// $flow-disable-line
dir.modifiers = emptyModifiers;
}
res[getRawDirName(dir)] = dir;
dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
}
// $flow-disable-line
return res
}
@ -6562,7 +6591,10 @@ function getStyle (vnode, checkChild) {
var childNode = vnode;
while (childNode.componentInstance) {
childNode = childNode.componentInstance._vnode;
if (childNode.data && (styleData = normalizeStyleData(childNode.data))) {
if (
childNode && childNode.data &&
(styleData = normalizeStyleData(childNode.data))
) {
extend(res, styleData);
}
}
@ -7718,7 +7750,7 @@ var TransitionGroup = {
this._vnode,
this.kept,
false, // hydrating
true // removeOnly (!important, avoids unnecessary moves)
true // removeOnly (!important avoids unnecessary moves)
);
this._vnode = this.kept;
},

66
dist/vue.runtime.js vendored
View File

@ -1,5 +1,5 @@
/*!
* Vue.js v2.5.10
* Vue.js v2.5.11
* (c) 2014-2017 Evan You
* Released under the MIT License.
*/
@ -342,6 +342,7 @@ var config = ({
/**
* Option merge strategies (used in core/util/options)
*/
// $flow-disable-line
optionMergeStrategies: Object.create(null),
/**
@ -382,6 +383,7 @@ var config = ({
/**
* Custom user key aliases for v-on
*/
// $flow-disable-line
keyCodes: Object.create(null),
/**
@ -816,8 +818,7 @@ var arrayMethods = Object.create(arrayProto);[
'splice',
'sort',
'reverse'
]
.forEach(function (method) {
].forEach(function (method) {
// cache original method
var original = arrayProto[method];
def(arrayMethods, method, function mutator () {
@ -1324,8 +1325,7 @@ function validateComponentName (name) {
'and must start with a letter.'
);
}
var lower = name.toLowerCase();
if (isBuiltInTag(lower) || config.isReservedTag(lower)) {
if (isBuiltInTag(name) || config.isReservedTag(name)) {
warn(
'Do not use built-in or reserved HTML elements as component ' +
'id: ' + name
@ -1357,6 +1357,9 @@ function normalizeProps (options, vm) {
for (var key in props) {
val = props[key];
name = camelize(key);
if ("development" !== 'production' && isPlainObject(val)) {
validatePropObject(name, val, vm);
}
res[name] = isPlainObject(val)
? val
: { type: val };
@ -1371,6 +1374,26 @@ function normalizeProps (options, vm) {
options.props = res;
}
/**
* Validate whether a prop object keys are valid.
*/
var propOptionsRE = /^(type|default|required|validator)$/;
function validatePropObject (
propName,
prop,
vm
) {
for (var key in prop) {
if (!propOptionsRE.test(key)) {
warn(
("Invalid key \"" + key + "\" in validation rules object for prop \"" + propName + "\"."),
vm
);
}
}
}
/**
* Normalize all injections into Object-based format
*/
@ -2516,6 +2539,8 @@ function eventsMixin (Vue) {
/* */
/**
* Runtime helper for resolving raw children VNodes into a slot object.
*/
@ -2539,10 +2564,10 @@ function resolveSlots (
if ((child.context === context || child.fnContext === context) &&
data && data.slot != null
) {
var name = child.data.slot;
var name = data.slot;
var slot = (slots[name] || (slots[name] = []));
if (child.tag === 'template') {
slot.push.apply(slot, child.children);
slot.push.apply(slot, child.children || []);
} else {
slot.push(child);
}
@ -3379,6 +3404,7 @@ function getData (data, vm) {
var computedWatcherOptions = { lazy: true };
function initComputed (vm, computed) {
// $flow-disable-line
var watchers = vm._computedWatchers = Object.create(null);
// computed properties are just getters during SSR
var isSSR = isServerRendering();
@ -3607,11 +3633,11 @@ function resolveInject (inject, vm) {
// inject is :any because flow is not smart enough to figure out cached
var result = Object.create(null);
var keys = hasSymbol
? Reflect.ownKeys(inject).filter(function (key) {
/* istanbul ignore next */
return Object.getOwnPropertyDescriptor(inject, key).enumerable
})
: Object.keys(inject);
? Reflect.ownKeys(inject).filter(function (key) {
/* istanbul ignore next */
return Object.getOwnPropertyDescriptor(inject, key).enumerable
})
: Object.keys(inject);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
@ -4961,7 +4987,7 @@ Object.defineProperty(Vue$3.prototype, '$ssrContext', {
}
});
Vue$3.version = '2.5.10';
Vue$3.version = '2.5.11';
/* */
@ -5013,12 +5039,12 @@ function genClassForVnode (vnode) {
var childNode = vnode;
while (isDef(childNode.componentInstance)) {
childNode = childNode.componentInstance._vnode;
if (childNode.data) {
if (childNode && childNode.data) {
data = mergeClassData(childNode.data, data);
}
}
while (isDef(parentNode = parentNode.parent)) {
if (parentNode.data) {
if (parentNode && parentNode.data) {
data = mergeClassData(data, parentNode.data);
}
}
@ -6119,17 +6145,20 @@ function normalizeDirectives$1 (
) {
var res = Object.create(null);
if (!dirs) {
// $flow-disable-line
return res
}
var i, dir;
for (i = 0; i < dirs.length; i++) {
dir = dirs[i];
if (!dir.modifiers) {
// $flow-disable-line
dir.modifiers = emptyModifiers;
}
res[getRawDirName(dir)] = dir;
dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
}
// $flow-disable-line
return res
}
@ -6553,7 +6582,10 @@ function getStyle (vnode, checkChild) {
var childNode = vnode;
while (childNode.componentInstance) {
childNode = childNode.componentInstance._vnode;
if (childNode.data && (styleData = normalizeStyleData(childNode.data))) {
if (
childNode && childNode.data &&
(styleData = normalizeStyleData(childNode.data))
) {
extend(res, styleData);
}
}
@ -7709,7 +7741,7 @@ var TransitionGroup = {
this._vnode,
this.kept,
false, // hydrating
true // removeOnly (!important, avoids unnecessary moves)
true // removeOnly (!important avoids unnecessary moves)
);
this._vnode = this.kept;
},

File diff suppressed because one or more lines are too long

View File

@ -590,24 +590,6 @@ function def (obj, key, val, enumerable) {
});
}
/**
* Parse simple path.
*/
var bailRE = /[^\w.$]/;
function parsePath (path) {
if (bailRE.test(path)) {
return
}
var segments = path.split('.');
return function (obj) {
for (var i = 0; i < segments.length; i++) {
if (!obj) { return }
obj = obj[segments[i]];
}
return obj
}
}
/* */
@ -725,6 +707,7 @@ var config = ({
/**
* Option merge strategies (used in core/util/options)
*/
// $flow-disable-line
optionMergeStrategies: Object.create(null),
/**
@ -765,6 +748,7 @@ var config = ({
/**
* Custom user key aliases for v-on
*/
// $flow-disable-line
keyCodes: Object.create(null),
/**
@ -941,16 +925,6 @@ Dep.prototype.notify = function notify () {
// this is globally unique because there could be only one
// watcher being evaluated at any time.
Dep.target = null;
var targetStack = [];
function pushTarget (_target) {
if (Dep.target) { targetStack.push(Dep.target); }
Dep.target = _target;
}
function popTarget () {
Dep.target = targetStack.pop();
}
/*
* not type checking this file because flow doesn't play well with
@ -966,8 +940,7 @@ var arrayMethods = Object.create(arrayProto);[
'splice',
'sort',
'reverse'
]
.forEach(function (method) {
].forEach(function (method) {
// cache original method
var original = arrayProto[method];
def(arrayMethods, method, function mutator () {
@ -1453,8 +1426,7 @@ function validateComponentName (name) {
'and must start with a letter.'
);
}
var lower = name.toLowerCase();
if (isBuiltInTag(lower) || config.isReservedTag(lower)) {
if (isBuiltInTag(name) || config.isReservedTag(name)) {
warn(
'Do not use built-in or reserved HTML elements as component ' +
'id: ' + name
@ -1486,6 +1458,9 @@ function normalizeProps (options, vm) {
for (var key in props) {
val = props[key];
name = camelize(key);
if ("development" !== 'production' && isPlainObject(val)) {
validatePropObject(name, val, vm);
}
res[name] = isPlainObject(val)
? val
: { type: val };
@ -1500,6 +1475,26 @@ function normalizeProps (options, vm) {
options.props = res;
}
/**
* Validate whether a prop object keys are valid.
*/
var propOptionsRE = /^(type|default|required|validator)$/;
function validatePropObject (
propName,
prop,
vm
) {
for (var key in prop) {
if (!propOptionsRE.test(key)) {
warn(
("Invalid key \"" + key + "\" in validation rules object for prop \"" + propName + "\"."),
vm
);
}
}
}
/**
* Normalize all injections into Object-based format
*/
@ -1848,10 +1843,7 @@ function logError (err, vm, info) {
/* globals MessageChannel */
var callbacks = [];
var pending = false;
function flushCallbacks () {
pending = false;
var copies = callbacks.slice(0);
callbacks.length = 0;
for (var i = 0; i < copies.length; i++) {
@ -1859,61 +1851,33 @@ function flushCallbacks () {
}
}
// Here we have async deferring wrappers using both micro and macro tasks.
// In < 2.4 we used micro tasks everywhere, but there are some scenarios where
// micro tasks have too high a priority and fires in between supposedly
// sequential events (e.g. #4521, #6690) or even between bubbling of the same
// event (#6566). However, using macro tasks everywhere also has subtle problems
// when state is changed right before repaint (e.g. #6813, out-in transitions).
// Here we use micro task by default, but expose a way to force macro task when
// needed (e.g. in event handlers attached by v-on).
var microTimerFunc;
var macroTimerFunc;
var useMacroTask = false;
// Determine (macro) Task defer implementation.
// Technically setImmediate should be the ideal choice, but it's only available
// in IE. The only polyfill that consistently queues the callback after all DOM
// events triggered in the same loop is by using MessageChannel.
/* istanbul ignore if */
if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
macroTimerFunc = function () {
setImmediate(flushCallbacks);
};
} else if (typeof MessageChannel !== 'undefined' && (
isNative(MessageChannel) ||
// PhantomJS
MessageChannel.toString() === '[object MessageChannelConstructor]'
)) {
var channel = new MessageChannel();
var port = channel.port2;
channel.port1.onmessage = flushCallbacks;
macroTimerFunc = function () {
port.postMessage(1);
};
} else {
/* istanbul ignore next */
macroTimerFunc = function () {
setTimeout(flushCallbacks, 0);
};
}
// Determine MicroTask defer implementation.
/* istanbul ignore next, $flow-disable-line */
if (typeof Promise !== 'undefined' && isNative(Promise)) {
var p = Promise.resolve();
microTimerFunc = function () {
p.then(flushCallbacks);
// in problematic UIWebViews, Promise.then doesn't completely break, but
// it can get stuck in a weird state where callbacks are pushed into the
// microtask queue but the queue isn't being flushed, until the browser
// needs to do some other work, e.g. handle a timer. Therefore we can
// "force" the microtask queue to be flushed by adding an empty timer.
if (isIOS) { setTimeout(noop); }
};
} else {
// fallback to macro
microTimerFunc = macroTimerFunc;
}
/**
@ -1921,36 +1885,6 @@ if (typeof Promise !== 'undefined' && isNative(Promise)) {
* the changes are queued using a Task instead of a MicroTask.
*/
function nextTick (cb, ctx) {
var _resolve;
callbacks.push(function () {
if (cb) {
try {
cb.call(ctx);
} catch (e) {
handleError(e, ctx, 'nextTick');
}
} else if (_resolve) {
_resolve(ctx);
}
});
if (!pending) {
pending = true;
if (useMacroTask) {
macroTimerFunc();
} else {
microTimerFunc();
}
}
// $flow-disable-line
if (!cb && typeof Promise !== 'undefined') {
return new Promise(function (resolve) {
_resolve = resolve;
})
}
}
/* */
/* */
@ -1961,12 +1895,12 @@ function genClassForVnode (vnode) {
var childNode = vnode;
while (isDef(childNode.componentInstance)) {
childNode = childNode.componentInstance._vnode;
if (childNode.data) {
if (childNode && childNode.data) {
data = mergeClassData(childNode.data, data);
}
}
while (isDef(parentNode = parentNode.parent)) {
if (parentNode.data) {
if (parentNode && parentNode.data) {
data = mergeClassData(data, parentNode.data);
}
}
@ -2145,7 +2079,10 @@ function getStyle (vnode, checkChild) {
var childNode = vnode;
while (childNode.componentInstance) {
childNode = childNode.componentInstance._vnode;
if (childNode.data && (styleData = normalizeStyleData(childNode.data))) {
if (
childNode && childNode.data &&
(styleData = normalizeStyleData(childNode.data))
) {
extend(res, styleData);
}
}
@ -4392,11 +4329,11 @@ function genCheckboxModel (
var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
addProp(el, 'checked',
"Array.isArray(" + value + ")" +
"?_i(" + value + "," + valueBinding + ")>-1" + (
trueValueBinding === 'true'
? (":(" + value + ")")
: (":_q(" + value + "," + trueValueBinding + ")")
)
"?_i(" + value + "," + valueBinding + ")>-1" + (
trueValueBinding === 'true'
? (":(" + value + ")")
: (":_q(" + value + "," + trueValueBinding + ")")
)
);
addHandler(el, 'change',
"var $$a=" + value + "," +
@ -4413,9 +4350,9 @@ function genCheckboxModel (
}
function genRadioModel (
el,
value,
modifiers
el,
value,
modifiers
) {
var number = modifiers && modifiers.number;
var valueBinding = getBindingAttr(el, 'value') || 'null';
@ -4425,9 +4362,9 @@ function genRadioModel (
}
function genSelect (
el,
value,
modifiers
el,
value,
modifiers
) {
var number = modifiers && modifiers.number;
var selectedVal = "Array.prototype.filter" +
@ -5821,7 +5758,7 @@ function createCompilerCreator (baseCompile) {
// merge custom directives
if (options.directives) {
finalOptions.directives = extend(
Object.create(baseOptions.directives),
Object.create(baseOptions.directives || null),
options.directives
);
}
@ -6111,36 +6048,19 @@ var seenObjects = new _Set();
* getters, so that every nested property inside the object
* is collected as a "deep" dependency.
*/
function traverse (val) {
_traverse(val, seenObjects);
seenObjects.clear();
}
function _traverse (val, seen) {
var i, keys;
var isA = Array.isArray(val);
if ((!isA && !isObject(val)) || Object.isFrozen(val)) {
return
}
if (val.__ob__) {
var depId = val.__ob__.dep.id;
if (seen.has(depId)) {
return
}
seen.add(depId);
}
if (isA) {
i = val.length;
while (i--) { _traverse(val[i], seen); }
} else {
keys = Object.keys(val);
i = keys.length;
while (i--) { _traverse(val[keys[i]], seen); }
}
}
{
var perf = inBrowser && window.performance;
/* istanbul ignore if */
if (
perf &&
perf.mark &&
perf.measure &&
perf.clearMarks &&
perf.clearMeasures
) {
}
}
/* */
@ -6447,6 +6367,8 @@ function updateComponentListeners (
/* */
/**
* Runtime helper for resolving raw children VNodes into a slot object.
*/
@ -6470,10 +6392,10 @@ function resolveSlots (
if ((child.context === context || child.fnContext === context) &&
data && data.slot != null
) {
var name = child.data.slot;
var name = data.slot;
var slot = (slots[name] || (slots[name] = []));
if (child.tag === 'template') {
slot.push.apply(slot, child.children);
slot.push.apply(slot, child.children || []);
} else {
slot.push(child);
}
@ -6645,97 +6567,9 @@ function callHook (vm, hook) {
/* */
var MAX_UPDATE_COUNT = 100;
var queue = [];
var activatedChildren = [];
var has = {};
var circular = {};
var waiting = false;
var flushing = false;
var index$1 = 0;
/**
* Reset the scheduler's state.
*/
function resetSchedulerState () {
index$1 = queue.length = activatedChildren.length = 0;
has = {};
{
circular = {};
}
waiting = flushing = false;
}
/**
* Flush both queues and run the watchers.
*/
function flushSchedulerQueue () {
flushing = true;
var watcher, id;
// Sort queue before flush.
// This ensures that:
// 1. Components are updated from parent to child. (because parent is always
// created before the child)
// 2. A component's user watchers are run before its render watcher (because
// user watchers are created before the render watcher)
// 3. If a component is destroyed during a parent component's watcher run,
// its watchers can be skipped.
queue.sort(function (a, b) { return a.id - b.id; });
// do not cache length because more watchers might be pushed
// as we run existing watchers
for (index$1 = 0; index$1 < queue.length; index$1++) {
watcher = queue[index$1];
id = watcher.id;
has[id] = null;
watcher.run();
// in dev build, check and stop circular updates.
if ("development" !== 'production' && has[id] != null) {
circular[id] = (circular[id] || 0) + 1;
if (circular[id] > MAX_UPDATE_COUNT) {
warn(
'You may have an infinite update loop ' + (
watcher.user
? ("in watcher with expression \"" + (watcher.expression) + "\"")
: "in a component render function."
),
watcher.vm
);
break
}
}
}
// keep copies of post queues before resetting state
var activatedQueue = activatedChildren.slice();
var updatedQueue = queue.slice();
resetSchedulerState();
// call component updated and activated hooks
callActivatedHooks(activatedQueue);
callUpdatedHooks(updatedQueue);
// devtool hook
/* istanbul ignore if */
if (devtools && config.devtools) {
devtools.emit('flush');
}
}
function callUpdatedHooks (queue) {
var i = queue.length;
while (i--) {
var watcher = queue[i];
var vm = watcher.vm;
if (vm._watcher === watcher && vm._isMounted) {
callHook(vm, 'updated');
}
}
}
/**
* Queue a kept-alive component that was activated during patch.
* The queue will be processed after the entire tree has been patched.
@ -6747,252 +6581,14 @@ function queueActivatedComponent (vm) {
activatedChildren.push(vm);
}
function callActivatedHooks (queue) {
for (var i = 0; i < queue.length; i++) {
queue[i]._inactive = true;
activateChildComponent(queue[i], true /* true */);
}
}
/**
* Push a watcher into the watcher queue.
* Jobs with duplicate IDs will be skipped unless it's
* pushed when the queue is being flushed.
*/
function queueWatcher (watcher) {
var id = watcher.id;
if (has[id] == null) {
has[id] = true;
if (!flushing) {
queue.push(watcher);
} else {
// if already flushing, splice the watcher based on its id
// if already past its id, it will be run next immediately.
var i = queue.length - 1;
while (i > index$1 && queue[i].id > watcher.id) {
i--;
}
queue.splice(i + 1, 0, watcher);
}
// queue the flush
if (!waiting) {
waiting = true;
nextTick(flushSchedulerQueue);
}
}
}
/* */
var uid$2 = 0;
/**
* A watcher parses an expression, collects dependencies,
* and fires callback when the expression value changes.
* This is used for both the $watch() api and directives.
*/
var Watcher = function Watcher (
vm,
expOrFn,
cb,
options,
isRenderWatcher
) {
this.vm = vm;
if (isRenderWatcher) {
vm._watcher = this;
}
vm._watchers.push(this);
// options
if (options) {
this.deep = !!options.deep;
this.user = !!options.user;
this.lazy = !!options.lazy;
this.sync = !!options.sync;
} else {
this.deep = this.user = this.lazy = this.sync = false;
}
this.cb = cb;
this.id = ++uid$2; // uid for batching
this.active = true;
this.dirty = this.lazy; // for lazy watchers
this.deps = [];
this.newDeps = [];
this.depIds = new _Set();
this.newDepIds = new _Set();
this.expression = expOrFn.toString();
// parse expression for getter
if (typeof expOrFn === 'function') {
this.getter = expOrFn;
} else {
this.getter = parsePath(expOrFn);
if (!this.getter) {
this.getter = function () {};
"development" !== 'production' && warn(
"Failed watching path: \"" + expOrFn + "\" " +
'Watcher only accepts simple dot-delimited paths. ' +
'For full control, use a function instead.',
vm
);
}
}
this.value = this.lazy
? undefined
: this.get();
};
/**
* Evaluate the getter, and re-collect dependencies.
*/
Watcher.prototype.get = function get () {
pushTarget(this);
var value;
var vm = this.vm;
try {
value = this.getter.call(vm, vm);
} catch (e) {
if (this.user) {
handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
} else {
throw e
}
} finally {
// "touch" every property so they are all tracked as
// dependencies for deep watching
if (this.deep) {
traverse(value);
}
popTarget();
this.cleanupDeps();
}
return value
};
/**
* Add a dependency to this directive.
*/
Watcher.prototype.addDep = function addDep (dep) {
var id = dep.id;
if (!this.newDepIds.has(id)) {
this.newDepIds.add(id);
this.newDeps.push(dep);
if (!this.depIds.has(id)) {
dep.addSub(this);
}
}
};
/**
* Clean up for dependency collection.
*/
Watcher.prototype.cleanupDeps = function cleanupDeps () {
var this$1 = this;
var i = this.deps.length;
while (i--) {
var dep = this$1.deps[i];
if (!this$1.newDepIds.has(dep.id)) {
dep.removeSub(this$1);
}
}
var tmp = this.depIds;
this.depIds = this.newDepIds;
this.newDepIds = tmp;
this.newDepIds.clear();
tmp = this.deps;
this.deps = this.newDeps;
this.newDeps = tmp;
this.newDeps.length = 0;
};
/**
* Subscriber interface.
* Will be called when a dependency changes.
*/
Watcher.prototype.update = function update () {
/* istanbul ignore else */
if (this.lazy) {
this.dirty = true;
} else if (this.sync) {
this.run();
} else {
queueWatcher(this);
}
};
/**
* Scheduler job interface.
* Will be called by the scheduler.
*/
Watcher.prototype.run = function run () {
if (this.active) {
var value = this.get();
if (
value !== this.value ||
// Deep watchers and watchers on Object/Arrays should fire even
// when the value is the same, because the value may
// have mutated.
isObject(value) ||
this.deep
) {
// set new value
var oldValue = this.value;
this.value = value;
if (this.user) {
try {
this.cb.call(this.vm, value, oldValue);
} catch (e) {
handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
}
} else {
this.cb.call(this.vm, value, oldValue);
}
}
}
};
/**
* Evaluate the value of the watcher.
* This only gets called for lazy watchers.
*/
Watcher.prototype.evaluate = function evaluate () {
this.value = this.get();
this.dirty = false;
};
/**
* Depend on all deps collected by this watcher.
*/
Watcher.prototype.depend = function depend () {
var this$1 = this;
var i = this.deps.length;
while (i--) {
this$1.deps[i].depend();
}
};
/**
* Remove self from all dependencies' subscriber list.
*/
Watcher.prototype.teardown = function teardown () {
var this$1 = this;
if (this.active) {
// remove self from vm's watcher list
// this is a somewhat expensive operation so we skip it
// if the vm is being destroyed.
if (!this.vm._isBeingDestroyed) {
remove(this.vm._watchers, this);
}
var i = this.deps.length;
while (i--) {
this$1.deps[i].removeSub(this$1);
}
this.active = false;
}
};
/* */
/* */
@ -7406,11 +7002,11 @@ function resolveInject (inject, vm) {
// inject is :any because flow is not smart enough to figure out cached
var result = Object.create(null);
var keys = hasSymbol
? Reflect.ownKeys(inject).filter(function (key) {
/* istanbul ignore next */
return Object.getOwnPropertyDescriptor(inject, key).enumerable
})
: Object.keys(inject);
? Reflect.ownKeys(inject).filter(function (key) {
/* istanbul ignore next */
return Object.getOwnPropertyDescriptor(inject, key).enumerable
})
: Object.keys(inject);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];

View File

@ -592,24 +592,6 @@ function def (obj, key, val, enumerable) {
});
}
/**
* Parse simple path.
*/
var bailRE = /[^\w.$]/;
function parsePath (path) {
if (bailRE.test(path)) {
return
}
var segments = path.split('.');
return function (obj) {
for (var i = 0; i < segments.length; i++) {
if (!obj) { return }
obj = obj[segments[i]];
}
return obj
}
}
/* */
@ -727,6 +709,7 @@ var config = ({
/**
* Option merge strategies (used in core/util/options)
*/
// $flow-disable-line
optionMergeStrategies: Object.create(null),
/**
@ -767,6 +750,7 @@ var config = ({
/**
* Custom user key aliases for v-on
*/
// $flow-disable-line
keyCodes: Object.create(null),
/**
@ -943,16 +927,6 @@ Dep.prototype.notify = function notify () {
// this is globally unique because there could be only one
// watcher being evaluated at any time.
Dep.target = null;
var targetStack = [];
function pushTarget (_target) {
if (Dep.target) { targetStack.push(Dep.target); }
Dep.target = _target;
}
function popTarget () {
Dep.target = targetStack.pop();
}
/*
* not type checking this file because flow doesn't play well with
@ -968,8 +942,7 @@ var arrayMethods = Object.create(arrayProto);[
'splice',
'sort',
'reverse'
]
.forEach(function (method) {
].forEach(function (method) {
// cache original method
var original = arrayProto[method];
def(arrayMethods, method, function mutator () {
@ -1455,8 +1428,7 @@ function validateComponentName (name) {
'and must start with a letter.'
);
}
var lower = name.toLowerCase();
if (isBuiltInTag(lower) || config.isReservedTag(lower)) {
if (isBuiltInTag(name) || config.isReservedTag(name)) {
warn(
'Do not use built-in or reserved HTML elements as component ' +
'id: ' + name
@ -1488,6 +1460,9 @@ function normalizeProps (options, vm) {
for (var key in props) {
val = props[key];
name = camelize(key);
if (process.env.NODE_ENV !== 'production' && isPlainObject(val)) {
validatePropObject(name, val, vm);
}
res[name] = isPlainObject(val)
? val
: { type: val };
@ -1502,6 +1477,26 @@ function normalizeProps (options, vm) {
options.props = res;
}
/**
* Validate whether a prop object keys are valid.
*/
var propOptionsRE = /^(type|default|required|validator)$/;
function validatePropObject (
propName,
prop,
vm
) {
for (var key in prop) {
if (!propOptionsRE.test(key)) {
warn(
("Invalid key \"" + key + "\" in validation rules object for prop \"" + propName + "\"."),
vm
);
}
}
}
/**
* Normalize all injections into Object-based format
*/
@ -1850,10 +1845,7 @@ function logError (err, vm, info) {
/* globals MessageChannel */
var callbacks = [];
var pending = false;
function flushCallbacks () {
pending = false;
var copies = callbacks.slice(0);
callbacks.length = 0;
for (var i = 0; i < copies.length; i++) {
@ -1861,61 +1853,33 @@ function flushCallbacks () {
}
}
// Here we have async deferring wrappers using both micro and macro tasks.
// In < 2.4 we used micro tasks everywhere, but there are some scenarios where
// micro tasks have too high a priority and fires in between supposedly
// sequential events (e.g. #4521, #6690) or even between bubbling of the same
// event (#6566). However, using macro tasks everywhere also has subtle problems
// when state is changed right before repaint (e.g. #6813, out-in transitions).
// Here we use micro task by default, but expose a way to force macro task when
// needed (e.g. in event handlers attached by v-on).
var microTimerFunc;
var macroTimerFunc;
var useMacroTask = false;
// Determine (macro) Task defer implementation.
// Technically setImmediate should be the ideal choice, but it's only available
// in IE. The only polyfill that consistently queues the callback after all DOM
// events triggered in the same loop is by using MessageChannel.
/* istanbul ignore if */
if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
macroTimerFunc = function () {
setImmediate(flushCallbacks);
};
} else if (typeof MessageChannel !== 'undefined' && (
isNative(MessageChannel) ||
// PhantomJS
MessageChannel.toString() === '[object MessageChannelConstructor]'
)) {
var channel = new MessageChannel();
var port = channel.port2;
channel.port1.onmessage = flushCallbacks;
macroTimerFunc = function () {
port.postMessage(1);
};
} else {
/* istanbul ignore next */
macroTimerFunc = function () {
setTimeout(flushCallbacks, 0);
};
}
// Determine MicroTask defer implementation.
/* istanbul ignore next, $flow-disable-line */
if (typeof Promise !== 'undefined' && isNative(Promise)) {
var p = Promise.resolve();
microTimerFunc = function () {
p.then(flushCallbacks);
// in problematic UIWebViews, Promise.then doesn't completely break, but
// it can get stuck in a weird state where callbacks are pushed into the
// microtask queue but the queue isn't being flushed, until the browser
// needs to do some other work, e.g. handle a timer. Therefore we can
// "force" the microtask queue to be flushed by adding an empty timer.
if (isIOS) { setTimeout(noop); }
};
} else {
// fallback to macro
microTimerFunc = macroTimerFunc;
}
/**
@ -1923,36 +1887,6 @@ if (typeof Promise !== 'undefined' && isNative(Promise)) {
* the changes are queued using a Task instead of a MicroTask.
*/
function nextTick (cb, ctx) {
var _resolve;
callbacks.push(function () {
if (cb) {
try {
cb.call(ctx);
} catch (e) {
handleError(e, ctx, 'nextTick');
}
} else if (_resolve) {
_resolve(ctx);
}
});
if (!pending) {
pending = true;
if (useMacroTask) {
macroTimerFunc();
} else {
microTimerFunc();
}
}
// $flow-disable-line
if (!cb && typeof Promise !== 'undefined') {
return new Promise(function (resolve) {
_resolve = resolve;
})
}
}
/* */
/* */
@ -1963,12 +1897,12 @@ function genClassForVnode (vnode) {
var childNode = vnode;
while (isDef(childNode.componentInstance)) {
childNode = childNode.componentInstance._vnode;
if (childNode.data) {
if (childNode && childNode.data) {
data = mergeClassData(childNode.data, data);
}
}
while (isDef(parentNode = parentNode.parent)) {
if (parentNode.data) {
if (parentNode && parentNode.data) {
data = mergeClassData(data, parentNode.data);
}
}
@ -2147,7 +2081,10 @@ function getStyle (vnode, checkChild) {
var childNode = vnode;
while (childNode.componentInstance) {
childNode = childNode.componentInstance._vnode;
if (childNode.data && (styleData = normalizeStyleData(childNode.data))) {
if (
childNode && childNode.data &&
(styleData = normalizeStyleData(childNode.data))
) {
extend(res, styleData);
}
}
@ -4131,11 +4068,11 @@ function genCheckboxModel (
var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
addProp(el, 'checked',
"Array.isArray(" + value + ")" +
"?_i(" + value + "," + valueBinding + ")>-1" + (
trueValueBinding === 'true'
? (":(" + value + ")")
: (":_q(" + value + "," + trueValueBinding + ")")
)
"?_i(" + value + "," + valueBinding + ")>-1" + (
trueValueBinding === 'true'
? (":(" + value + ")")
: (":_q(" + value + "," + trueValueBinding + ")")
)
);
addHandler(el, 'change',
"var $$a=" + value + "," +
@ -4152,9 +4089,9 @@ function genCheckboxModel (
}
function genRadioModel (
el,
value,
modifiers
el,
value,
modifiers
) {
var number = modifiers && modifiers.number;
var valueBinding = getBindingAttr(el, 'value') || 'null';
@ -4164,9 +4101,9 @@ function genRadioModel (
}
function genSelect (
el,
value,
modifiers
el,
value,
modifiers
) {
var number = modifiers && modifiers.number;
var selectedVal = "Array.prototype.filter" +
@ -5560,7 +5497,7 @@ function createCompilerCreator (baseCompile) {
// merge custom directives
if (options.directives) {
finalOptions.directives = extend(
Object.create(baseOptions.directives),
Object.create(baseOptions.directives || null),
options.directives
);
}
@ -5850,31 +5787,18 @@ var seenObjects = new _Set();
* getters, so that every nested property inside the object
* is collected as a "deep" dependency.
*/
function traverse (val) {
_traverse(val, seenObjects);
seenObjects.clear();
}
function _traverse (val, seen) {
var i, keys;
var isA = Array.isArray(val);
if ((!isA && !isObject(val)) || Object.isFrozen(val)) {
return
}
if (val.__ob__) {
var depId = val.__ob__.dep.id;
if (seen.has(depId)) {
return
}
seen.add(depId);
}
if (isA) {
i = val.length;
while (i--) { _traverse(val[i], seen); }
} else {
keys = Object.keys(val);
i = keys.length;
while (i--) { _traverse(val[keys[i]], seen); }
if (process.env.NODE_ENV !== 'production') {
var perf = inBrowser && window.performance;
/* istanbul ignore if */
if (
perf &&
perf.mark &&
perf.measure &&
perf.clearMarks &&
perf.clearMeasures
) {
}
}
@ -6184,6 +6108,8 @@ function updateComponentListeners (
/* */
/**
* Runtime helper for resolving raw children VNodes into a slot object.
*/
@ -6207,10 +6133,10 @@ function resolveSlots (
if ((child.context === context || child.fnContext === context) &&
data && data.slot != null
) {
var name = child.data.slot;
var name = data.slot;
var slot = (slots[name] || (slots[name] = []));
if (child.tag === 'template') {
slot.push.apply(slot, child.children);
slot.push.apply(slot, child.children || []);
} else {
slot.push(child);
}
@ -6264,6 +6190,12 @@ function updateChildComponent (
parentVnode,
renderChildren
) {
if (process.env.NODE_ENV !== 'production') {
}
// determine whether component has slot children
// we need to do this before overwriting $options._renderChildren
var hasChildren = !!(
renderChildren || // has new static slots
vm.$options._renderChildren || // has old static slots
@ -6311,7 +6243,9 @@ function updateChildComponent (
vm.$forceUpdate();
}
if (process.env.NODE_ENV !== 'production') {
}
}
function isInInactiveTree (vm) {
@ -6374,97 +6308,9 @@ function callHook (vm, hook) {
/* */
var MAX_UPDATE_COUNT = 100;
var queue = [];
var activatedChildren = [];
var has = {};
var circular = {};
var waiting = false;
var flushing = false;
var index$1 = 0;
/**
* Reset the scheduler's state.
*/
function resetSchedulerState () {
index$1 = queue.length = activatedChildren.length = 0;
has = {};
if (process.env.NODE_ENV !== 'production') {
circular = {};
}
waiting = flushing = false;
}
/**
* Flush both queues and run the watchers.
*/
function flushSchedulerQueue () {
flushing = true;
var watcher, id;
// Sort queue before flush.
// This ensures that:
// 1. Components are updated from parent to child. (because parent is always
// created before the child)
// 2. A component's user watchers are run before its render watcher (because
// user watchers are created before the render watcher)
// 3. If a component is destroyed during a parent component's watcher run,
// its watchers can be skipped.
queue.sort(function (a, b) { return a.id - b.id; });
// do not cache length because more watchers might be pushed
// as we run existing watchers
for (index$1 = 0; index$1 < queue.length; index$1++) {
watcher = queue[index$1];
id = watcher.id;
has[id] = null;
watcher.run();
// in dev build, check and stop circular updates.
if (process.env.NODE_ENV !== 'production' && has[id] != null) {
circular[id] = (circular[id] || 0) + 1;
if (circular[id] > MAX_UPDATE_COUNT) {
warn(
'You may have an infinite update loop ' + (
watcher.user
? ("in watcher with expression \"" + (watcher.expression) + "\"")
: "in a component render function."
),
watcher.vm
);
break
}
}
}
// keep copies of post queues before resetting state
var activatedQueue = activatedChildren.slice();
var updatedQueue = queue.slice();
resetSchedulerState();
// call component updated and activated hooks
callActivatedHooks(activatedQueue);
callUpdatedHooks(updatedQueue);
// devtool hook
/* istanbul ignore if */
if (devtools && config.devtools) {
devtools.emit('flush');
}
}
function callUpdatedHooks (queue) {
var i = queue.length;
while (i--) {
var watcher = queue[i];
var vm = watcher.vm;
if (vm._watcher === watcher && vm._isMounted) {
callHook(vm, 'updated');
}
}
}
/**
* Queue a kept-alive component that was activated during patch.
* The queue will be processed after the entire tree has been patched.
@ -6476,254 +6322,14 @@ function queueActivatedComponent (vm) {
activatedChildren.push(vm);
}
function callActivatedHooks (queue) {
for (var i = 0; i < queue.length; i++) {
queue[i]._inactive = true;
activateChildComponent(queue[i], true /* true */);
}
}
/**
* Push a watcher into the watcher queue.
* Jobs with duplicate IDs will be skipped unless it's
* pushed when the queue is being flushed.
*/
function queueWatcher (watcher) {
var id = watcher.id;
if (has[id] == null) {
has[id] = true;
if (!flushing) {
queue.push(watcher);
} else {
// if already flushing, splice the watcher based on its id
// if already past its id, it will be run next immediately.
var i = queue.length - 1;
while (i > index$1 && queue[i].id > watcher.id) {
i--;
}
queue.splice(i + 1, 0, watcher);
}
// queue the flush
if (!waiting) {
waiting = true;
nextTick(flushSchedulerQueue);
}
}
}
/* */
var uid$2 = 0;
/**
* A watcher parses an expression, collects dependencies,
* and fires callback when the expression value changes.
* This is used for both the $watch() api and directives.
*/
var Watcher = function Watcher (
vm,
expOrFn,
cb,
options,
isRenderWatcher
) {
this.vm = vm;
if (isRenderWatcher) {
vm._watcher = this;
}
vm._watchers.push(this);
// options
if (options) {
this.deep = !!options.deep;
this.user = !!options.user;
this.lazy = !!options.lazy;
this.sync = !!options.sync;
} else {
this.deep = this.user = this.lazy = this.sync = false;
}
this.cb = cb;
this.id = ++uid$2; // uid for batching
this.active = true;
this.dirty = this.lazy; // for lazy watchers
this.deps = [];
this.newDeps = [];
this.depIds = new _Set();
this.newDepIds = new _Set();
this.expression = process.env.NODE_ENV !== 'production'
? expOrFn.toString()
: '';
// parse expression for getter
if (typeof expOrFn === 'function') {
this.getter = expOrFn;
} else {
this.getter = parsePath(expOrFn);
if (!this.getter) {
this.getter = function () {};
process.env.NODE_ENV !== 'production' && warn(
"Failed watching path: \"" + expOrFn + "\" " +
'Watcher only accepts simple dot-delimited paths. ' +
'For full control, use a function instead.',
vm
);
}
}
this.value = this.lazy
? undefined
: this.get();
};
/**
* Evaluate the getter, and re-collect dependencies.
*/
Watcher.prototype.get = function get () {
pushTarget(this);
var value;
var vm = this.vm;
try {
value = this.getter.call(vm, vm);
} catch (e) {
if (this.user) {
handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
} else {
throw e
}
} finally {
// "touch" every property so they are all tracked as
// dependencies for deep watching
if (this.deep) {
traverse(value);
}
popTarget();
this.cleanupDeps();
}
return value
};
/**
* Add a dependency to this directive.
*/
Watcher.prototype.addDep = function addDep (dep) {
var id = dep.id;
if (!this.newDepIds.has(id)) {
this.newDepIds.add(id);
this.newDeps.push(dep);
if (!this.depIds.has(id)) {
dep.addSub(this);
}
}
};
/**
* Clean up for dependency collection.
*/
Watcher.prototype.cleanupDeps = function cleanupDeps () {
var this$1 = this;
var i = this.deps.length;
while (i--) {
var dep = this$1.deps[i];
if (!this$1.newDepIds.has(dep.id)) {
dep.removeSub(this$1);
}
}
var tmp = this.depIds;
this.depIds = this.newDepIds;
this.newDepIds = tmp;
this.newDepIds.clear();
tmp = this.deps;
this.deps = this.newDeps;
this.newDeps = tmp;
this.newDeps.length = 0;
};
/**
* Subscriber interface.
* Will be called when a dependency changes.
*/
Watcher.prototype.update = function update () {
/* istanbul ignore else */
if (this.lazy) {
this.dirty = true;
} else if (this.sync) {
this.run();
} else {
queueWatcher(this);
}
};
/**
* Scheduler job interface.
* Will be called by the scheduler.
*/
Watcher.prototype.run = function run () {
if (this.active) {
var value = this.get();
if (
value !== this.value ||
// Deep watchers and watchers on Object/Arrays should fire even
// when the value is the same, because the value may
// have mutated.
isObject(value) ||
this.deep
) {
// set new value
var oldValue = this.value;
this.value = value;
if (this.user) {
try {
this.cb.call(this.vm, value, oldValue);
} catch (e) {
handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
}
} else {
this.cb.call(this.vm, value, oldValue);
}
}
}
};
/**
* Evaluate the value of the watcher.
* This only gets called for lazy watchers.
*/
Watcher.prototype.evaluate = function evaluate () {
this.value = this.get();
this.dirty = false;
};
/**
* Depend on all deps collected by this watcher.
*/
Watcher.prototype.depend = function depend () {
var this$1 = this;
var i = this.deps.length;
while (i--) {
this$1.deps[i].depend();
}
};
/**
* Remove self from all dependencies' subscriber list.
*/
Watcher.prototype.teardown = function teardown () {
var this$1 = this;
if (this.active) {
// remove self from vm's watcher list
// this is a somewhat expensive operation so we skip it
// if the vm is being destroyed.
if (!this.vm._isBeingDestroyed) {
remove(this.vm._watchers, this);
}
var i = this.deps.length;
while (i--) {
this$1.deps[i].removeSub(this$1);
}
this.active = false;
}
};
/* */
/* */
@ -7137,11 +6743,11 @@ function resolveInject (inject, vm) {
// inject is :any because flow is not smart enough to figure out cached
var result = Object.create(null);
var keys = hasSymbol
? Reflect.ownKeys(inject).filter(function (key) {
/* istanbul ignore next */
return Object.getOwnPropertyDescriptor(inject, key).enumerable
})
: Object.keys(inject);
? Reflect.ownKeys(inject).filter(function (key) {
/* istanbul ignore next */
return Object.getOwnPropertyDescriptor(inject, key).enumerable
})
: Object.keys(inject);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
@ -8275,11 +7881,12 @@ TemplateRenderer.prototype.renderState = function renderState (context, options)
var ref = options || {};
var contextKey = ref.contextKey; if ( contextKey === void 0 ) contextKey = 'state';
var windowKey = ref.windowKey; if ( windowKey === void 0 ) windowKey = '__INITIAL_STATE__';
var state = serialize(context[contextKey], { isJSON: true });
var autoRemove = process.env.NODE_ENV === 'production'
? ';(function(){var s;(s=document.currentScript||document.scripts[document.scripts.length-1]).parentNode.removeChild(s);}());'
: '';
return context[contextKey]
? ("<script>window." + windowKey + "=" + (serialize(context[contextKey], { isJSON: true })) + autoRemove + "</script>")
? ("<script>window." + windowKey + "=" + state + autoRemove + "</script>")
: ''
};

View File

@ -1,6 +1,6 @@
{
"name": "vue-server-renderer",
"version": "2.5.10",
"version": "2.5.11",
"description": "server renderer for Vue 2.0",
"main": "index.js",
"types": "types/index.d.ts",

View File

@ -186,17 +186,9 @@ var camelize = cached(function (str) {
/**
* Capitalize a string.
*/
var capitalize = cached(function (str) {
return str.charAt(0).toUpperCase() + str.slice(1)
});
/**
* Hyphenate a camelCase string.
*/
var hyphenateRE = /\B([A-Z])/g;
var hyphenate = cached(function (str) {
return str.replace(hyphenateRE, '-$1').toLowerCase()
});
/**
* Simple bind, faster than native
@ -605,7 +597,7 @@ var isSpecialTag = makeMap('script,style,template', true);
function parseComponent (
content,
options
) {
) {
if ( options === void 0 ) options = {};
var sfc = {
@ -635,7 +627,7 @@ function parseComponent (
cumulated[name] = value || true;
return cumulated
}, Object.create(null))
}, {})
};
if (isSpecialTag(tag)) {
checkAttrs(currentBlock, attrs);
@ -778,7 +770,7 @@ var isServerRendering = function () {
};
// detect devtools
var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
/* istanbul ignore next */
function isNative (Ctor) {
@ -789,29 +781,13 @@ var hasSymbol =
typeof Symbol !== 'undefined' && isNative(Symbol) &&
typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
var _Set;
/* istanbul ignore if */ // $flow-disable-line
if (typeof Set !== 'undefined' && isNative(Set)) {
// use native Set when available.
_Set = Set;
} else {
// a non-standard Set polyfill that only works with primitive keys.
_Set = (function () {
function Set () {
this.set = Object.create(null);
}
Set.prototype.has = function has (key) {
return this.set[key] === true
};
Set.prototype.add = function add (key) {
this.set[key] = true;
};
Set.prototype.clear = function clear () {
this.set = Object.create(null);
};
return Set;
}());
}
var ASSET_TYPES = [
@ -840,6 +816,7 @@ var config = ({
/**
* Option merge strategies (used in core/util/options)
*/
// $flow-disable-line
optionMergeStrategies: Object.create(null),
/**
@ -880,6 +857,7 @@ var config = ({
/**
* Custom user key aliases for v-on
*/
// $flow-disable-line
keyCodes: Object.create(null),
/**
@ -1127,8 +1105,7 @@ var arrayMethods = Object.create(arrayProto);[
'splice',
'sort',
'reverse'
]
.forEach(function (method) {
].forEach(function (method) {
// cache original method
var original = arrayProto[method];
def(arrayMethods, method, function mutator () {
@ -3450,11 +3427,11 @@ function genCheckboxModel (
var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
addProp(el, 'checked',
"Array.isArray(" + value + ")" +
"?_i(" + value + "," + valueBinding + ")>-1" + (
trueValueBinding === 'true'
? (":(" + value + ")")
: (":_q(" + value + "," + trueValueBinding + ")")
)
"?_i(" + value + "," + valueBinding + ")>-1" + (
trueValueBinding === 'true'
? (":(" + value + ")")
: (":_q(" + value + "," + trueValueBinding + ")")
)
);
addHandler(el, 'change',
"var $$a=" + value + "," +
@ -3471,9 +3448,9 @@ function genCheckboxModel (
}
function genRadioModel (
el,
value,
modifiers
el,
value,
modifiers
) {
var number = modifiers && modifiers.number;
var valueBinding = getBindingAttr(el, 'value') || 'null';
@ -3483,9 +3460,9 @@ function genRadioModel (
}
function genSelect (
el,
value,
modifiers
el,
value,
modifiers
) {
var number = modifiers && modifiers.number;
var selectedVal = "Array.prototype.filter" +
@ -4532,7 +4509,7 @@ function createCompilerCreator (baseCompile) {
// merge custom directives
if (options.directives) {
finalOptions.directives = extend(
Object.create(baseOptions.directives),
Object.create(baseOptions.directives || null),
options.directives
);
}

View File

@ -143,17 +143,9 @@ var camelize = cached(function (str) {
/**
* Capitalize a string.
*/
var capitalize = cached(function (str) {
return str.charAt(0).toUpperCase() + str.slice(1)
});
/**
* Hyphenate a camelCase string.
*/
var hyphenateRE = /\B([A-Z])/g;
var hyphenate = cached(function (str) {
return str.replace(hyphenateRE, '-$1').toLowerCase()
});
/**
* Simple bind, faster than native
@ -562,7 +554,7 @@ var isSpecialTag = makeMap('script,style,template', true);
function parseComponent (
content,
options
) {
) {
if ( options === void 0 ) options = {};
var sfc = {
@ -592,7 +584,7 @@ function parseComponent (
cumulated[name] = value || true;
return cumulated
}, Object.create(null))
}, {})
};
if (isSpecialTag(tag)) {
checkAttrs(currentBlock, attrs);
@ -735,7 +727,7 @@ var isServerRendering = function () {
};
// detect devtools
var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
/* istanbul ignore next */
function isNative (Ctor) {
@ -746,29 +738,13 @@ var hasSymbol =
typeof Symbol !== 'undefined' && isNative(Symbol) &&
typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
var _Set;
/* istanbul ignore if */ // $flow-disable-line
if (typeof Set !== 'undefined' && isNative(Set)) {
// use native Set when available.
_Set = Set;
} else {
// a non-standard Set polyfill that only works with primitive keys.
_Set = (function () {
function Set () {
this.set = Object.create(null);
}
Set.prototype.has = function has (key) {
return this.set[key] === true
};
Set.prototype.add = function add (key) {
this.set[key] = true;
};
Set.prototype.clear = function clear () {
this.set = Object.create(null);
};
return Set;
}());
}
var ASSET_TYPES = [
@ -797,6 +773,7 @@ var config = ({
/**
* Option merge strategies (used in core/util/options)
*/
// $flow-disable-line
optionMergeStrategies: Object.create(null),
/**
@ -837,6 +814,7 @@ var config = ({
/**
* Custom user key aliases for v-on
*/
// $flow-disable-line
keyCodes: Object.create(null),
/**
@ -1084,8 +1062,7 @@ var arrayMethods = Object.create(arrayProto);[
'splice',
'sort',
'reverse'
]
.forEach(function (method) {
].forEach(function (method) {
// cache original method
var original = arrayProto[method];
def(arrayMethods, method, function mutator () {
@ -3052,11 +3029,11 @@ function genCheckboxModel (
var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
addProp(el, 'checked',
"Array.isArray(" + value + ")" +
"?_i(" + value + "," + valueBinding + ")>-1" + (
trueValueBinding === 'true'
? (":(" + value + ")")
: (":_q(" + value + "," + trueValueBinding + ")")
)
"?_i(" + value + "," + valueBinding + ")>-1" + (
trueValueBinding === 'true'
? (":(" + value + ")")
: (":_q(" + value + "," + trueValueBinding + ")")
)
);
addHandler(el, 'change',
"var $$a=" + value + "," +
@ -3073,9 +3050,9 @@ function genCheckboxModel (
}
function genRadioModel (
el,
value,
modifiers
el,
value,
modifiers
) {
var number = modifiers && modifiers.number;
var valueBinding = getBindingAttr(el, 'value') || 'null';
@ -3085,9 +3062,9 @@ function genRadioModel (
}
function genSelect (
el,
value,
modifiers
el,
value,
modifiers
) {
var number = modifiers && modifiers.number;
var selectedVal = "Array.prototype.filter" +
@ -4134,7 +4111,7 @@ function createCompilerCreator (baseCompile) {
// merge custom directives
if (options.directives) {
finalOptions.directives = extend(
Object.create(baseOptions.directives),
Object.create(baseOptions.directives || null),
options.directives
);
}

View File

@ -1,6 +1,6 @@
{
"name": "vue-template-compiler",
"version": "2.5.10",
"version": "2.5.11",
"description": "template compiler for Vue 2.0",
"main": "index.js",
"unpkg": "browser.js",