build: build 2.5.14

This commit is contained in:
Evan You 2018-03-09 16:41:25 -05:00
parent 2c52c4265b
commit a08feed8c4
15 changed files with 3096 additions and 1943 deletions

666
dist/vue.common.js vendored

File diff suppressed because it is too large Load Diff

666
dist/vue.esm.js vendored

File diff suppressed because it is too large Load Diff

666
dist/vue.js vendored

File diff suppressed because it is too large Load Diff

6
dist/vue.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

575
dist/vue.runtime.js vendored

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -178,9 +178,35 @@ var hyphenate = cached(function (str) {
});
/**
* Simple bind, faster than native
* Simple bind polyfill for environments that do not support it... e.g.
* PhantomJS 1.x. Technically we don't need this anymore since native bind is
* now more performant in most browsers, but removing it would be breaking for
* code that was able to run in PhantomJS 1.x, so this must be kept for
* backwards compatibility.
*/
/* istanbul ignore next */
function polyfillBind (fn, ctx) {
function boundFn (a) {
var l = arguments.length;
return l
? l > 1
? fn.apply(ctx, arguments)
: fn.call(ctx, a)
: fn.call(ctx)
}
boundFn._length = fn.length;
return boundFn
}
function nativeBind (fn, ctx) {
return fn.bind(ctx)
}
var bind = Function.prototype.bind
? nativeBind
: polyfillBind;
/**
* Convert an Array-like object to a real Array.
@ -487,45 +513,6 @@ function createTextVNode (val) {
// used for static nodes and slot nodes because they may be reused across
// multiple renders, cloning them avoids errors when DOM manipulations rely
// on their elm reference.
function cloneVNode (vnode, deep) {
var componentOptions = vnode.componentOptions;
var cloned = new VNode(
vnode.tag,
vnode.data,
vnode.children,
vnode.text,
vnode.elm,
vnode.context,
componentOptions,
vnode.asyncFactory
);
cloned.ns = vnode.ns;
cloned.isStatic = vnode.isStatic;
cloned.key = vnode.key;
cloned.isComment = vnode.isComment;
cloned.fnContext = vnode.fnContext;
cloned.fnOptions = vnode.fnOptions;
cloned.fnScopeId = vnode.fnScopeId;
cloned.isCloned = true;
if (deep) {
if (vnode.children) {
cloned.children = cloneVNodes(vnode.children, true);
}
if (componentOptions && componentOptions.children) {
componentOptions.children = cloneVNodes(componentOptions.children, true);
}
}
return cloned
}
function cloneVNodes (vnodes, deep) {
var len = vnodes.length;
var res = new Array(len);
for (var i = 0; i < len; i++) {
res[i] = cloneVNode(vnodes[i], deep);
}
return res
}
/* */
@ -594,7 +581,6 @@ function def (obj, key, val, enumerable) {
/* */
// can we use __proto__?
var hasProto = '__proto__' in {};
@ -633,7 +619,7 @@ var _isServer;
var isServerRendering = function () {
if (_isServer === undefined) {
/* istanbul ignore if */
if (!inBrowser && typeof global !== 'undefined') {
if (!inBrowser && !inWeex && typeof global !== 'undefined') {
// detect presence of vue-server-renderer and avoid
// Webpack shimming the process
_isServer = global['process'].env.VUE_ENV === 'server';
@ -791,7 +777,7 @@ var config = ({
* Exposed for legacy reasons
*/
_lifecycleHooks: LIFECYCLE_HOOKS
});
})
/* */
@ -927,6 +913,16 @@ 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
@ -934,7 +930,9 @@ Dep.target = null;
*/
var arrayProto = Array.prototype;
var arrayMethods = Object.create(arrayProto);[
var arrayMethods = Object.create(arrayProto);
var methodsToPatch = [
'push',
'pop',
'shift',
@ -942,7 +940,12 @@ var arrayMethods = Object.create(arrayProto);[
'splice',
'sort',
'reverse'
].forEach(function (method) {
];
/**
* Intercept mutating methods and emit events
*/
methodsToPatch.forEach(function (method) {
// cache original method
var original = arrayProto[method];
def(arrayMethods, method, function mutator () {
@ -973,20 +976,20 @@ var arrayMethods = Object.create(arrayProto);[
var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
/**
* By default, when a reactive property is set, the new value is
* also converted to become reactive. However when passing down props,
* we don't want to force conversion because the value may be a nested value
* under a frozen data structure. Converting it would defeat the optimization.
* In some cases we may want to disable observation inside a component's
* update computation.
*/
var observerState = {
shouldConvert: true
};
var shouldObserve = true;
function toggleObserving (value) {
shouldObserve = value;
}
/**
* Observer class that are attached to each observed
* object. Once attached, the observer converts target
* Observer class that is attached to each observed
* object. Once attached, the observer converts the target
* object's property keys into getter/setters that
* collect dependencies and dispatches updates.
* collect dependencies and dispatch updates.
*/
var Observer = function Observer (value) {
this.value = value;
@ -1012,7 +1015,7 @@ var Observer = function Observer (value) {
Observer.prototype.walk = function walk (obj) {
var keys = Object.keys(obj);
for (var i = 0; i < keys.length; i++) {
defineReactive(obj, keys[i], obj[keys[i]]);
defineReactive(obj, keys[i]);
}
};
@ -1062,7 +1065,7 @@ function observe (value, asRootData) {
if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
ob = value.__ob__;
} else if (
observerState.shouldConvert &&
shouldObserve &&
!isServerRendering() &&
(Array.isArray(value) || isPlainObject(value)) &&
Object.isExtensible(value) &&
@ -1095,6 +1098,9 @@ function defineReactive (
// cater for pre-defined getter/setters
var getter = property && property.get;
if (!getter && arguments.length === 2) {
val = obj[key];
}
var setter = property && property.set;
var childOb = !shallow && observe(val);
@ -1141,6 +1147,12 @@ function defineReactive (
* already exist.
*/
function set (target, key, val) {
if ("development" !== 'production' &&
!Array.isArray(target) &&
!isObject(target)
) {
warn(("Cannot set reactive property on non-object/array value: " + target));
}
if (Array.isArray(target) && isValidArrayIndex(key)) {
target.length = Math.max(target.length, key);
target.splice(key, 1, val);
@ -1616,12 +1628,18 @@ function validateProp (
var prop = propOptions[key];
var absent = !hasOwn(propsData, key);
var value = propsData[key];
// handle boolean props
if (isType(Boolean, prop.type)) {
// boolean casting
var booleanIndex = getTypeIndex(Boolean, prop.type);
if (booleanIndex > -1) {
if (absent && !hasOwn(prop, 'default')) {
value = false;
} else if (!isType(String, prop.type) && (value === '' || value === hyphenate(key))) {
value = true;
} else if (value === '' || value === hyphenate(key)) {
// only cast empty string / same name to boolean if
// boolean has higher priority
var stringIndex = getTypeIndex(String, prop.type);
if (stringIndex < 0 || booleanIndex < stringIndex) {
value = true;
}
}
}
// check default value
@ -1629,10 +1647,10 @@ function validateProp (
value = getPropDefaultValue(vm, prop, key);
// since the default value is a fresh copy,
// make sure to observe it.
var prevShouldConvert = observerState.shouldConvert;
observerState.shouldConvert = true;
var prevShouldObserve = shouldObserve;
toggleObserving(true);
observe(value);
observerState.shouldConvert = prevShouldConvert;
toggleObserving(prevShouldObserve);
}
{
assertProp(prop, key, value, vm, absent);
@ -1761,17 +1779,20 @@ function getType (fn) {
return match ? match[1] : ''
}
function isType (type, fn) {
if (!Array.isArray(fn)) {
return getType(fn) === getType(type)
function isSameType (a, b) {
return getType(a) === getType(b)
}
function getTypeIndex (type, expectedTypes) {
if (!Array.isArray(expectedTypes)) {
return isSameType(expectedTypes, type) ? 0 : -1
}
for (var i = 0, len = fn.length; i < len; i++) {
if (getType(fn[i]) === getType(type)) {
return true
for (var i = 0, len = expectedTypes.length; i < len; i++) {
if (isSameType(expectedTypes[i], type)) {
return i
}
}
/* istanbul ignore next */
return false
return -1
}
/* */
@ -1831,7 +1852,7 @@ function flushCallbacks () {
}
}
// Determine (macro) Task defer implementation.
// 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.
@ -1851,7 +1872,7 @@ if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
}
// Determine MicroTask defer implementation.
// Determine microtask defer implementation.
/* istanbul ignore next, $flow-disable-line */
if (typeof Promise !== 'undefined' && isNative(Promise)) {
@ -1862,7 +1883,7 @@ if (typeof Promise !== 'undefined' && isNative(Promise)) {
/**
* Wrap a function so that if any code inside triggers state change,
* the changes are queued using a Task instead of a MicroTask.
* the changes are queued using a (macro) task instead of a microtask.
*/
/* */
@ -1884,7 +1905,7 @@ function genClassForVnode (vnode) {
data = mergeClassData(data, parentNode.data);
}
}
return renderClass$1(data.staticClass, data.class)
return renderClass(data.staticClass, data.class)
}
function mergeClassData (child, parent) {
@ -1896,7 +1917,7 @@ function mergeClassData (child, parent) {
}
}
function renderClass$1 (
function renderClass (
staticClass,
dynamicClass
) {
@ -2004,7 +2025,7 @@ var isTextInputType = makeMap('text,number,password,search,email,tel,url');
/* */
function renderClass (node) {
function renderClass$1 (node) {
var classList = genClassForVnode(node);
if (classList !== '') {
return (" class=\"" + (escape(classList)) + "\"")
@ -2109,9 +2130,9 @@ function renderStyle (vnode) {
var modules = [
renderAttrs,
renderDOMProps,
renderClass,
renderClass$1,
renderStyle
];
]
/* */
@ -2168,7 +2189,7 @@ function setSelected (option) {
var directives = {
show: show,
model: model
};
}
/* */
@ -2426,7 +2447,7 @@ function wrapFilter (exp, filter) {
} else {
var name = filter.slice(0, i);
var args = filter.slice(i + 1);
return ("_f(\"" + name + "\")(" + exp + "," + args)
return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
}
}
@ -2577,7 +2598,9 @@ function addHandler (
events = el.events || (el.events = {});
}
var newHandler = { value: value };
var newHandler = {
value: value.trim()
};
if (modifiers !== emptyObject) {
newHandler.modifiers = modifiers;
}
@ -2678,7 +2701,7 @@ var klass = {
staticKeys: ['staticClass'],
transformNode: transformNode,
genData: genData
};
}
/* */
@ -2722,7 +2745,7 @@ var style = {
staticKeys: ['staticStyle'],
transformNode: transformNode$1,
genData: genData$1
};
}
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@ -3100,7 +3123,8 @@ var startTagOpen = new RegExp(("^<" + qnameCapture));
var startTagClose = /^\s*(\/?)>/;
var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
var doctype = /^<!DOCTYPE [^>]+>/i;
var comment = /^<!--/;
// #7298: escape - to avoid being pased as HTML comment when inlined in page
var comment = /^<!\--/;
var conditionalComment = /^<!\[/;
var IS_REGEX_CAPTURING_BROKEN = false;
@ -3230,7 +3254,7 @@ function parseHTML (html, options) {
endTagLength = endTag.length;
if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
text = text
.replace(/<!--([\s\S]*?)-->/g, '$1')
.replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
.replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
}
if (shouldIgnoreFirstNewline(stackedTag, text)) {
@ -3405,8 +3429,8 @@ function genComponentModel (
if (trim) {
valueExpression =
"(typeof " + baseValueExpression + " === 'string'" +
"? " + baseValueExpression + ".trim()" +
": " + baseValueExpression + ")";
"? " + baseValueExpression + ".trim()" +
": " + baseValueExpression + ")";
}
if (number) {
valueExpression = "_n(" + valueExpression + ")";
@ -3460,6 +3484,9 @@ var expressionEndPos;
function parseModel (val) {
// Fix https://github.com/vuejs/vue/pull/7730
// allow v-model="obj.val " (trailing whitespace)
val = val.trim();
len = val.length;
if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
@ -3878,6 +3905,8 @@ function processFor (el) {
}
}
function parseFor (exp) {
var inMatch = exp.match(forAliasRE);
if (!inMatch) { return }
@ -4200,8 +4229,19 @@ function checkForAliasModel (el, value) {
function preTransformNode (el, options) {
if (el.tag === 'input') {
var map = el.attrsMap;
if (map['v-model'] && (map['v-bind:type'] || map[':type'])) {
var typeBinding = getBindingAttr(el, 'type');
if (!map['v-model']) {
return
}
var typeBinding;
if (map[':type'] || map['v-bind:type']) {
typeBinding = getBindingAttr(el, 'type');
}
if (!typeBinding && map['v-bind']) {
typeBinding = "(" + (map['v-bind']) + ").type";
}
if (typeBinding) {
var ifCondition = getAndRemoveAttr(el, 'v-if', true);
var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
@ -4254,13 +4294,13 @@ function cloneASTElement (el) {
var model$1 = {
preTransformNode: preTransformNode
};
}
var modules$1 = [
klass,
style,
model$1
];
]
/* */
@ -4346,8 +4386,8 @@ function genCheckboxModel (
'if(Array.isArray($$a)){' +
"var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
'$$i=_i($$a,$$v);' +
"if($$el.checked){$$i<0&&(" + value + "=$$a.concat([$$v]))}" +
"else{$$i>-1&&(" + value + "=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}" +
"if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
"else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
"}else{" + (genAssignmentCode(value, '$$c')) + "}",
null, true
);
@ -4390,9 +4430,11 @@ function genDefaultModel (
var type = el.attrsMap.type;
// warn if v-bind:value conflicts with v-model
// except for inputs with v-bind:type
{
var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
if (value$1) {
var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
if (value$1 && !typeBinding) {
var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
warn$2(
binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
@ -4452,7 +4494,7 @@ var directives$1 = {
model: model$2,
text: text,
html: html
};
}
/* */
@ -4471,10 +4513,10 @@ var baseOptions = {
/* */
var fnExpRE = /^\s*([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
var simplePathRE = /^\s*[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['.*?']|\[".*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*\s*$/;
var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
// keyCode aliases
// KeyboardEvent.keyCode aliases
var keyCodes = {
esc: 27,
tab: 9,
@ -4487,6 +4529,19 @@ var keyCodes = {
'delete': [8, 46]
};
// KeyboardEvent.key aliases
var keyNames = {
esc: 'Escape',
tab: 'Tab',
enter: 'Enter',
space: ' ',
up: 'ArrowUp',
left: 'ArrowLeft',
right: 'ArrowRight',
down: 'ArrowDown',
'delete': ['Backspace', 'Delete']
};
// #4868: modifiers that prevent the execution of the listener
// need to explicitly return null so that we can determine whether to remove
// the listener for .once
@ -4569,9 +4624,9 @@ function genHandler (
code += genModifierCode;
}
var handlerCode = isMethodPath
? handler.value + '($event)'
? ("return " + (handler.value) + "($event)")
: isFunctionExpression
? ("(" + (handler.value) + ")($event)")
? ("return (" + (handler.value) + ")($event)")
: handler.value;
/* istanbul ignore if */
return ("function($event){" + code + handlerCode + "}")
@ -4587,12 +4642,15 @@ function genFilterCode (key) {
if (keyVal) {
return ("$event.keyCode!==" + keyVal)
}
var code = keyCodes[key];
var keyCode = keyCodes[key];
var keyName = keyNames[key];
return (
"_k($event.keyCode," +
(JSON.stringify(key)) + "," +
(JSON.stringify(code)) + "," +
"$event.key)"
(JSON.stringify(keyCode)) + "," +
"$event.key," +
"" + (JSON.stringify(keyName)) +
")"
)
}
@ -4619,7 +4677,7 @@ var baseDirectives = {
on: on,
bind: bind$1,
cloak: noop
};
}
/* */
@ -4637,7 +4695,7 @@ var CodegenState = function CodegenState (options) {
function generate$1 (
function generate (
ast,
options
) {
@ -4895,7 +4953,7 @@ function genInlineTemplate (el, state) {
state.warn('Inline-template components must have exactly one child element.');
}
if (ast.type === 1) {
var inlineRenderFns = generate$1(ast, state.options);
var inlineRenderFns = generate(ast, state.options);
return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
}
}
@ -5324,7 +5382,7 @@ var RAW = 0;
var INTERPOLATION = 1;
var EXPRESSION = 2;
function generate (
function generate$1 (
ast,
options
) {
@ -5804,7 +5862,7 @@ var createCompiler = createCompilerCreator(function baseCompile (
) {
var ast = parse(template.trim(), options);
optimize(ast, options);
var code = generate(ast, options);
var code = generate$1(ast, options);
return {
ast: ast,
render: code.render,
@ -5906,22 +5964,29 @@ function normalizeArrayChildren (children, nestedIndex) {
/* */
var ssrHelpers = {
_ssrEscape: escape,
_ssrNode: renderStringNode,
_ssrList: renderStringList,
_ssrAttr: renderAttr,
_ssrAttrs: renderAttrs$1,
_ssrDOMProps: renderDOMProps$1,
_ssrClass: renderSSRClass,
_ssrStyle: renderSSRStyle
};
function installSSRHelpers (vm) {
if (vm._ssrNode) { return }
var Ctor = vm.constructor;
while (Ctor.super) {
Ctor = Ctor.super;
if (vm._ssrNode) {
return
}
var Vue = vm.constructor;
while (Vue.super) {
Vue = Vue.super;
}
extend(Vue.prototype, ssrHelpers);
if (Vue.FunctionalRenderContext) {
extend(Vue.FunctionalRenderContext.prototype, ssrHelpers);
}
extend(Ctor.prototype, {
_ssrEscape: escape,
_ssrNode: renderStringNode$1,
_ssrList: renderStringList,
_ssrAttr: renderAttr,
_ssrAttrs: renderAttrs$1,
_ssrDOMProps: renderDOMProps$1,
_ssrClass: renderSSRClass,
_ssrStyle: renderSSRStyle
});
}
var StringNode = function StringNode (
@ -5944,7 +6009,7 @@ var StringNode = function StringNode (
}
};
function renderStringNode$1 (
function renderStringNode (
open,
close,
children,
@ -6000,7 +6065,7 @@ function renderSSRClass (
staticClass,
dynamic
) {
var res = renderClass$1(staticClass, dynamic);
var res = renderClass(staticClass, dynamic);
return res === '' ? res : (" class=\"" + (escape(res)) + "\"")
}
@ -6028,8 +6093,7 @@ function renderSSRStyle (
);
var hasProxy =
typeof Proxy !== 'undefined' &&
Proxy.toString().match(/native code/);
typeof Proxy !== 'undefined' && isNative(Proxy);
if (hasProxy) {
var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
@ -6058,6 +6122,33 @@ 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;
@ -6484,29 +6575,30 @@ function updateChildComponent (
// update $attrs and $listeners hash
// these are also reactive so they may trigger child update if the child
// used them during render
vm.$attrs = (parentVnode.data && parentVnode.data.attrs) || emptyObject;
vm.$attrs = parentVnode.data.attrs || emptyObject;
vm.$listeners = listeners || emptyObject;
// update props
if (propsData && vm.$options.props) {
observerState.shouldConvert = false;
toggleObserving(false);
var props = vm._props;
var propKeys = vm.$options._propKeys || [];
for (var i = 0; i < propKeys.length; i++) {
var key = propKeys[i];
props[key] = validateProp(key, vm.$options.props, propsData, vm);
var propOptions = vm.$options.props; // wtf flow?
props[key] = validateProp(key, propOptions, propsData, vm);
}
observerState.shouldConvert = true;
toggleObserving(true);
// keep a copy of raw propsData
vm.$options.propsData = propsData;
}
// update listeners
if (listeners) {
var oldListeners = vm.$options._parentListeners;
vm.$options._parentListeners = listeners;
updateComponentListeners(vm, listeners, oldListeners);
}
listeners = listeners || emptyObject;
var oldListeners = vm.$options._parentListeners;
vm.$options._parentListeners = listeners;
updateComponentListeners(vm, listeners, oldListeners);
// resolve slots + force update if has children
if (hasChildren) {
vm.$slots = resolveSlots(renderChildren, parentVnode.context);
@ -6560,6 +6652,8 @@ function deactivateChildComponent (vm, direct) {
}
function callHook (vm, hook) {
// #7573 disable dep collection when invoking lifecycle hooks
pushTarget();
var handlers = vm.$options[hook];
if (handlers) {
for (var i = 0, j = handlers.length; i < j; i++) {
@ -6573,6 +6667,7 @@ function callHook (vm, hook) {
if (vm._hasHookEvent) {
vm.$emit('hook:' + hook);
}
popTarget();
}
/* */
@ -6702,8 +6797,11 @@ function _createElement (
// direct component options / constructor
vnode = createComponent(tag, data, context, children);
}
if (isDef(vnode)) {
if (ns) { applyNS(vnode, ns); }
if (Array.isArray(vnode)) {
return vnode
} else if (isDef(vnode)) {
if (isDef(ns)) { applyNS(vnode, ns); }
if (isDef(data)) { registerDeepBindings(data); }
return vnode
} else {
return createEmptyVNode()
@ -6720,13 +6818,26 @@ function applyNS (vnode, ns, force) {
if (isDef(vnode.children)) {
for (var i = 0, l = vnode.children.length; i < l; i++) {
var child = vnode.children[i];
if (isDef(child.tag) && (isUndef(child.ns) || isTrue(force))) {
if (isDef(child.tag) && (
isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
applyNS(child, ns, force);
}
}
}
}
// ref #5318
// necessary to ensure parent re-render when deep bindings like :style and
// :class are used on slot nodes
function registerDeepBindings (data) {
if (isObject(data.style)) {
traverse(data.style);
}
if (isObject(data.class)) {
traverse(data.class);
}
}
/* */
/**
@ -6821,6 +6932,14 @@ function resolveFilter (id) {
/* */
function isKeyNotMatch (expect, actual) {
if (Array.isArray(expect)) {
return expect.indexOf(actual) === -1
} else {
return expect !== actual
}
}
/**
* Runtime helper for checking keyCodes from config.
* exposed as Vue.prototype._k
@ -6829,16 +6948,15 @@ function resolveFilter (id) {
function checkKeyCodes (
eventKeyCode,
key,
builtInAlias,
eventKeyName
builtInKeyCode,
eventKeyName,
builtInKeyName
) {
var keyCodes = config.keyCodes[key] || builtInAlias;
if (keyCodes) {
if (Array.isArray(keyCodes)) {
return keyCodes.indexOf(eventKeyCode) === -1
} else {
return keyCodes !== eventKeyCode
}
var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
return isKeyNotMatch(builtInKeyName, eventKeyName)
} else if (mappedKeyCode) {
return isKeyNotMatch(mappedKeyCode, eventKeyCode)
} else if (eventKeyName) {
return hyphenate(eventKeyName) !== key
}
@ -6910,11 +7028,9 @@ function renderStatic (
var cached = this._staticTrees || (this._staticTrees = []);
var tree = cached[index];
// if has already-rendered static tree and not inside v-for,
// we can reuse the same tree by doing a shallow clone.
// we can reuse the same tree.
if (tree && !isInFor) {
return Array.isArray(tree)
? cloneVNodes(tree)
: cloneVNode(tree)
return tree
}
// otherwise, render a fresh tree.
tree = cached[index] = this.$options.staticRenderFns[index].call(
@ -7026,7 +7142,7 @@ function resolveInject (inject, vm) {
var provideKey = inject[key].from;
var source = vm;
while (source) {
if (source._provided && provideKey in source._provided) {
if (source._provided && hasOwn(source._provided, provideKey)) {
result[key] = source._provided[provideKey];
break
}
@ -7146,7 +7262,7 @@ function FunctionalRenderContext (
if (options._scopeId) {
this._c = function (a, b, c, d) {
var vnode = createElement(contextVm, a, b, c, d, needNormalization);
if (vnode) {
if (vnode && !Array.isArray(vnode)) {
vnode.fnScopeId = options._scopeId;
vnode.fnContext = parent;
}
@ -7189,14 +7305,23 @@ function createFunctionalComponent (
var vnode = options.render.call(null, renderContext._c, renderContext);
if (vnode instanceof VNode) {
vnode.fnContext = contextVm;
vnode.fnOptions = options;
if (data.slot) {
(vnode.data || (vnode.data = {})).slot = data.slot;
setFunctionalContextForVNode(vnode, data, contextVm, options);
return vnode
} else if (Array.isArray(vnode)) {
var vnodes = normalizeChildren(vnode) || [];
for (var i = 0; i < vnodes.length; i++) {
setFunctionalContextForVNode(vnodes[i], data, contextVm, options);
}
return vnodes
}
}
return vnode
function setFunctionalContextForVNode (vnode, data, vm, options) {
vnode.fnContext = vm;
vnode.fnOptions = options;
if (data.slot) {
(vnode.data || (vnode.data = {})).slot = data.slot;
}
}
function mergeProps (to, from) {
@ -7234,7 +7359,15 @@ var componentVNodeHooks = {
parentElm,
refElm
) {
if (!vnode.componentInstance || vnode.componentInstance._isDestroyed) {
if (
vnode.componentInstance &&
!vnode.componentInstance._isDestroyed &&
vnode.data.keepAlive
) {
// kept-alive components, treat as a patch
var mountedNode = vnode; // work around flow
componentVNodeHooks.prepatch(mountedNode, mountedNode);
} else {
var child = vnode.componentInstance = createComponentInstanceForVnode(
vnode,
activeInstance,
@ -7242,10 +7375,6 @@ var componentVNodeHooks = {
refElm
);
child.$mount(hydrating ? vnode.elm : undefined, hydrating);
} else if (vnode.data.keepAlive) {
// kept-alive components, treat as a patch
var mountedNode = vnode; // work around flow
componentVNodeHooks.prepatch(mountedNode, mountedNode);
}
},
@ -7492,7 +7621,7 @@ var normalizeRender = function (vm) {
function renderNode (node, isRoot, context) {
if (node.isString) {
renderStringNode(node, context);
renderStringNode$1(node, context);
} else if (isDef(node.componentOptions)) {
renderComponent(node, isRoot, context);
} else if (isDef(node.tag)) {
@ -7670,7 +7799,7 @@ function renderAsyncComponent (node, isRoot, context) {
}
}
function renderStringNode (el, context) {
function renderStringNode$1 (el, context) {
var write = context.write;
var next = context.next;
if (isUndef(el.children) || el.children.length === 0) {
@ -7869,7 +7998,7 @@ var entryServerBasicRenderer = createBasicRenderer({
directives: directives,
isUnaryTag: isUnaryTag,
canBeLeftOpenTag: canBeLeftOpenTag
});
})
return entryServerBasicRenderer;

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -4,7 +4,7 @@
(factory((global.VueTemplateCompiler = {})));
}(this, (function (exports) { 'use strict';
var splitRE$1 = /\r?\n/g;
var splitRE = /\r?\n/g;
var emptyRE = /^\s*$/;
var needFixRE = /^(\r?\n)*[\t\s]/;
@ -12,7 +12,7 @@ var deIndent = function deindent (str) {
if (!needFixRE.test(str)) {
return str
}
var lines = str.split(splitRE$1);
var lines = str.split(splitRE);
var min = Infinity;
var type, cur, c;
for (var i = 0; i < lines.length; i++) {
@ -191,9 +191,35 @@ var camelize = cached(function (str) {
/**
* Simple bind, faster than native
* Simple bind polyfill for environments that do not support it... e.g.
* PhantomJS 1.x. Technically we don't need this anymore since native bind is
* now more performant in most browsers, but removing it would be breaking for
* code that was able to run in PhantomJS 1.x, so this must be kept for
* backwards compatibility.
*/
/* istanbul ignore next */
function polyfillBind (fn, ctx) {
function boundFn (a) {
var l = arguments.length;
return l
? l > 1
? fn.apply(ctx, arguments)
: fn.call(ctx, a)
: fn.call(ctx)
}
boundFn._length = fn.length;
return boundFn
}
function nativeBind (fn, ctx) {
return fn.bind(ctx)
}
var bind = Function.prototype.bind
? nativeBind
: polyfillBind;
/**
* Convert an Array-like object to a real Array.
@ -297,7 +323,8 @@ var startTagOpen = new RegExp(("^<" + qnameCapture));
var startTagClose = /^\s*(\/?)>/;
var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
var doctype = /^<!DOCTYPE [^>]+>/i;
var comment = /^<!--/;
// #7298: escape - to avoid being pased as HTML comment when inlined in page
var comment = /^<!\--/;
var conditionalComment = /^<!\[/;
var IS_REGEX_CAPTURING_BROKEN = false;
@ -427,7 +454,7 @@ function parseHTML (html, options) {
endTagLength = endTag.length;
if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
text = text
.replace(/<!--([\s\S]*?)-->/g, '$1')
.replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
.replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
}
if (shouldIgnoreFirstNewline(stackedTag, text)) {
@ -585,7 +612,7 @@ function parseHTML (html, options) {
/* */
var splitRE = /\r?\n/g;
var splitRE$1 = /\r?\n/g;
var replaceRE = /./g;
var isSpecialTag = makeMap('script,style,template', true);
@ -682,7 +709,7 @@ function parseComponent (
if (pad === 'space') {
return content.slice(0, block.start).replace(replaceRE, ' ')
} else {
var offset = content.slice(0, block.start).split(splitRE).length;
var offset = content.slice(0, block.start).split(splitRE$1).length;
var padChar = block.type === 'script' && !block.lang
? '//\n'
: '\n';
@ -719,7 +746,6 @@ function def (obj, key, val, enumerable) {
/* */
// can we use __proto__?
var hasProto = '__proto__' in {};
@ -758,7 +784,7 @@ var _isServer;
var isServerRendering = function () {
if (_isServer === undefined) {
/* istanbul ignore if */
if (!inBrowser && typeof global !== 'undefined') {
if (!inBrowser && !inWeex && typeof global !== 'undefined') {
// detect presence of vue-server-renderer and avoid
// Webpack shimming the process
_isServer = global['process'].env.VUE_ENV === 'server';
@ -898,7 +924,7 @@ var config = ({
* Exposed for legacy reasons
*/
_lifecycleHooks: LIFECYCLE_HOOKS
});
})
/* */
@ -1097,7 +1123,9 @@ Object.defineProperties( VNode.prototype, prototypeAccessors );
*/
var arrayProto = Array.prototype;
var arrayMethods = Object.create(arrayProto);[
var arrayMethods = Object.create(arrayProto);
var methodsToPatch = [
'push',
'pop',
'shift',
@ -1105,7 +1133,12 @@ var arrayMethods = Object.create(arrayProto);[
'splice',
'sort',
'reverse'
].forEach(function (method) {
];
/**
* Intercept mutating methods and emit events
*/
methodsToPatch.forEach(function (method) {
// cache original method
var original = arrayProto[method];
def(arrayMethods, method, function mutator () {
@ -1136,20 +1169,18 @@ var arrayMethods = Object.create(arrayProto);[
var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
/**
* By default, when a reactive property is set, the new value is
* also converted to become reactive. However when passing down props,
* we don't want to force conversion because the value may be a nested value
* under a frozen data structure. Converting it would defeat the optimization.
* In some cases we may want to disable observation inside a component's
* update computation.
*/
var observerState = {
shouldConvert: true
};
var shouldObserve = true;
/**
* Observer class that are attached to each observed
* object. Once attached, the observer converts target
* Observer class that is attached to each observed
* object. Once attached, the observer converts the target
* object's property keys into getter/setters that
* collect dependencies and dispatches updates.
* collect dependencies and dispatch updates.
*/
var Observer = function Observer (value) {
this.value = value;
@ -1175,7 +1206,7 @@ var Observer = function Observer (value) {
Observer.prototype.walk = function walk (obj) {
var keys = Object.keys(obj);
for (var i = 0; i < keys.length; i++) {
defineReactive(obj, keys[i], obj[keys[i]]);
defineReactive(obj, keys[i]);
}
};
@ -1225,7 +1256,7 @@ function observe (value, asRootData) {
if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
ob = value.__ob__;
} else if (
observerState.shouldConvert &&
shouldObserve &&
!isServerRendering() &&
(Array.isArray(value) || isPlainObject(value)) &&
Object.isExtensible(value) &&
@ -1258,6 +1289,9 @@ function defineReactive (
// cater for pre-defined getter/setters
var getter = property && property.get;
if (!getter && arguments.length === 2) {
val = obj[key];
}
var setter = property && property.set;
var childOb = !shallow && observe(val);
@ -1304,6 +1338,12 @@ function defineReactive (
* already exist.
*/
function set (target, key, val) {
if ("development" !== 'production' &&
!Array.isArray(target) &&
!isObject(target)
) {
warn(("Cannot set reactive property on non-object/array value: " + target));
}
if (Array.isArray(target) && isValidArrayIndex(key)) {
target.length = Math.max(target.length, key);
target.splice(key, 1, val);
@ -1614,7 +1654,7 @@ function flushCallbacks () {
}
}
// Determine (macro) Task defer implementation.
// 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.
@ -1634,7 +1674,7 @@ if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
}
// Determine MicroTask defer implementation.
// Determine microtask defer implementation.
/* istanbul ignore next, $flow-disable-line */
if (typeof Promise !== 'undefined' && isNative(Promise)) {
@ -1645,7 +1685,7 @@ if (typeof Promise !== 'undefined' && isNative(Promise)) {
/**
* Wrap a function so that if any code inside triggers state change,
* the changes are queued using a Task instead of a MicroTask.
* the changes are queued using a (macro) task instead of a microtask.
*/
/* */
@ -1828,7 +1868,7 @@ function wrapFilter (exp, filter) {
} else {
var name = filter.slice(0, i);
var args = filter.slice(i + 1);
return ("_f(\"" + name + "\")(" + exp + "," + args)
return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
}
}
@ -1979,7 +2019,9 @@ function addHandler (
events = el.events || (el.events = {});
}
var newHandler = { value: value };
var newHandler = {
value: value.trim()
};
if (modifiers !== emptyObject) {
newHandler.modifiers = modifiers;
}
@ -2080,7 +2122,7 @@ var klass = {
staticKeys: ['staticClass'],
transformNode: transformNode,
genData: genData
};
}
/* */
@ -2147,7 +2189,7 @@ var style = {
staticKeys: ['staticStyle'],
transformNode: transformNode$1,
genData: genData$1
};
}
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@ -2523,8 +2565,8 @@ function genComponentModel (
if (trim) {
valueExpression =
"(typeof " + baseValueExpression + " === 'string'" +
"? " + baseValueExpression + ".trim()" +
": " + baseValueExpression + ")";
"? " + baseValueExpression + ".trim()" +
": " + baseValueExpression + ")";
}
if (number) {
valueExpression = "_n(" + valueExpression + ")";
@ -2578,6 +2620,9 @@ var expressionEndPos;
function parseModel (val) {
// Fix https://github.com/vuejs/vue/pull/7730
// allow v-model="obj.val " (trailing whitespace)
val = val.trim();
len = val.length;
if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
@ -2996,6 +3041,8 @@ function processFor (el) {
}
}
function parseFor (exp) {
var inMatch = exp.match(forAliasRE);
if (!inMatch) { return }
@ -3318,8 +3365,19 @@ function checkForAliasModel (el, value) {
function preTransformNode (el, options) {
if (el.tag === 'input') {
var map = el.attrsMap;
if (map['v-model'] && (map['v-bind:type'] || map[':type'])) {
var typeBinding = getBindingAttr(el, 'type');
if (!map['v-model']) {
return
}
var typeBinding;
if (map[':type'] || map['v-bind:type']) {
typeBinding = getBindingAttr(el, 'type');
}
if (!typeBinding && map['v-bind']) {
typeBinding = "(" + (map['v-bind']) + ").type";
}
if (typeBinding) {
var ifCondition = getAndRemoveAttr(el, 'v-if', true);
var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
@ -3372,13 +3430,13 @@ function cloneASTElement (el) {
var model = {
preTransformNode: preTransformNode
};
}
var modules = [
klass,
style,
model
];
]
/* */
@ -3464,8 +3522,8 @@ function genCheckboxModel (
'if(Array.isArray($$a)){' +
"var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
'$$i=_i($$a,$$v);' +
"if($$el.checked){$$i<0&&(" + value + "=$$a.concat([$$v]))}" +
"else{$$i>-1&&(" + value + "=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}" +
"if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
"else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
"}else{" + (genAssignmentCode(value, '$$c')) + "}",
null, true
);
@ -3508,9 +3566,11 @@ function genDefaultModel (
var type = el.attrsMap.type;
// warn if v-bind:value conflicts with v-model
// except for inputs with v-bind:type
{
var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
if (value$1) {
var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
if (value$1 && !typeBinding) {
var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
warn$2(
binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
@ -3570,7 +3630,7 @@ var directives = {
model: model$1,
text: text,
html: html
};
}
/* */
@ -3716,10 +3776,10 @@ function isDirectChildOfTemplateFor (node) {
/* */
var fnExpRE = /^\s*([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
var simplePathRE = /^\s*[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['.*?']|\[".*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*\s*$/;
var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
// keyCode aliases
// KeyboardEvent.keyCode aliases
var keyCodes = {
esc: 27,
tab: 9,
@ -3732,6 +3792,19 @@ var keyCodes = {
'delete': [8, 46]
};
// KeyboardEvent.key aliases
var keyNames = {
esc: 'Escape',
tab: 'Tab',
enter: 'Enter',
space: ' ',
up: 'ArrowUp',
left: 'ArrowLeft',
right: 'ArrowRight',
down: 'ArrowDown',
'delete': ['Backspace', 'Delete']
};
// #4868: modifiers that prevent the execution of the listener
// need to explicitly return null so that we can determine whether to remove
// the listener for .once
@ -3814,9 +3887,9 @@ function genHandler (
code += genModifierCode;
}
var handlerCode = isMethodPath
? handler.value + '($event)'
? ("return " + (handler.value) + "($event)")
: isFunctionExpression
? ("(" + (handler.value) + ")($event)")
? ("return (" + (handler.value) + ")($event)")
: handler.value;
/* istanbul ignore if */
return ("function($event){" + code + handlerCode + "}")
@ -3832,12 +3905,15 @@ function genFilterCode (key) {
if (keyVal) {
return ("$event.keyCode!==" + keyVal)
}
var code = keyCodes[key];
var keyCode = keyCodes[key];
var keyName = keyNames[key];
return (
"_k($event.keyCode," +
(JSON.stringify(key)) + "," +
(JSON.stringify(code)) + "," +
"$event.key)"
(JSON.stringify(keyCode)) + "," +
"$event.key," +
"" + (JSON.stringify(keyName)) +
")"
)
}
@ -3864,7 +3940,7 @@ var baseDirectives = {
on: on,
bind: bind$1,
cloak: noop
};
}
/* */

View File

@ -148,9 +148,35 @@ var camelize = cached(function (str) {
/**
* Simple bind, faster than native
* Simple bind polyfill for environments that do not support it... e.g.
* PhantomJS 1.x. Technically we don't need this anymore since native bind is
* now more performant in most browsers, but removing it would be breaking for
* code that was able to run in PhantomJS 1.x, so this must be kept for
* backwards compatibility.
*/
/* istanbul ignore next */
function polyfillBind (fn, ctx) {
function boundFn (a) {
var l = arguments.length;
return l
? l > 1
? fn.apply(ctx, arguments)
: fn.call(ctx, a)
: fn.call(ctx)
}
boundFn._length = fn.length;
return boundFn
}
function nativeBind (fn, ctx) {
return fn.bind(ctx)
}
var bind = Function.prototype.bind
? nativeBind
: polyfillBind;
/**
* Convert an Array-like object to a real Array.
@ -254,7 +280,8 @@ var startTagOpen = new RegExp(("^<" + qnameCapture));
var startTagClose = /^\s*(\/?)>/;
var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
var doctype = /^<!DOCTYPE [^>]+>/i;
var comment = /^<!--/;
// #7298: escape - to avoid being pased as HTML comment when inlined in page
var comment = /^<!\--/;
var conditionalComment = /^<!\[/;
var IS_REGEX_CAPTURING_BROKEN = false;
@ -384,7 +411,7 @@ function parseHTML (html, options) {
endTagLength = endTag.length;
if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
text = text
.replace(/<!--([\s\S]*?)-->/g, '$1')
.replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
.replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
}
if (shouldIgnoreFirstNewline(stackedTag, text)) {
@ -676,7 +703,6 @@ function def (obj, key, val, enumerable) {
/* */
// can we use __proto__?
var hasProto = '__proto__' in {};
@ -715,7 +741,7 @@ var _isServer;
var isServerRendering = function () {
if (_isServer === undefined) {
/* istanbul ignore if */
if (!inBrowser && typeof global !== 'undefined') {
if (!inBrowser && !inWeex && typeof global !== 'undefined') {
// detect presence of vue-server-renderer and avoid
// Webpack shimming the process
_isServer = global['process'].env.VUE_ENV === 'server';
@ -855,7 +881,7 @@ var config = ({
* Exposed for legacy reasons
*/
_lifecycleHooks: LIFECYCLE_HOOKS
});
})
/* */
@ -1054,7 +1080,9 @@ Object.defineProperties( VNode.prototype, prototypeAccessors );
*/
var arrayProto = Array.prototype;
var arrayMethods = Object.create(arrayProto);[
var arrayMethods = Object.create(arrayProto);
var methodsToPatch = [
'push',
'pop',
'shift',
@ -1062,7 +1090,12 @@ var arrayMethods = Object.create(arrayProto);[
'splice',
'sort',
'reverse'
].forEach(function (method) {
];
/**
* Intercept mutating methods and emit events
*/
methodsToPatch.forEach(function (method) {
// cache original method
var original = arrayProto[method];
def(arrayMethods, method, function mutator () {
@ -1093,20 +1126,18 @@ var arrayMethods = Object.create(arrayProto);[
var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
/**
* By default, when a reactive property is set, the new value is
* also converted to become reactive. However when passing down props,
* we don't want to force conversion because the value may be a nested value
* under a frozen data structure. Converting it would defeat the optimization.
* In some cases we may want to disable observation inside a component's
* update computation.
*/
var observerState = {
shouldConvert: true
};
var shouldObserve = true;
/**
* Observer class that are attached to each observed
* object. Once attached, the observer converts target
* Observer class that is attached to each observed
* object. Once attached, the observer converts the target
* object's property keys into getter/setters that
* collect dependencies and dispatches updates.
* collect dependencies and dispatch updates.
*/
var Observer = function Observer (value) {
this.value = value;
@ -1132,7 +1163,7 @@ var Observer = function Observer (value) {
Observer.prototype.walk = function walk (obj) {
var keys = Object.keys(obj);
for (var i = 0; i < keys.length; i++) {
defineReactive(obj, keys[i], obj[keys[i]]);
defineReactive(obj, keys[i]);
}
};
@ -1182,7 +1213,7 @@ function observe (value, asRootData) {
if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
ob = value.__ob__;
} else if (
observerState.shouldConvert &&
shouldObserve &&
!isServerRendering() &&
(Array.isArray(value) || isPlainObject(value)) &&
Object.isExtensible(value) &&
@ -1215,6 +1246,9 @@ function defineReactive (
// cater for pre-defined getter/setters
var getter = property && property.get;
if (!getter && arguments.length === 2) {
val = obj[key];
}
var setter = property && property.set;
var childOb = !shallow && observe(val);
@ -1261,6 +1295,12 @@ function defineReactive (
* already exist.
*/
function set (target, key, val) {
if (process.env.NODE_ENV !== 'production' &&
!Array.isArray(target) &&
!isObject(target)
) {
warn(("Cannot set reactive property on non-object/array value: " + target));
}
if (Array.isArray(target) && isValidArrayIndex(key)) {
target.length = Math.max(target.length, key);
target.splice(key, 1, val);
@ -1571,7 +1611,7 @@ function flushCallbacks () {
}
}
// Determine (macro) Task defer implementation.
// 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.
@ -1591,7 +1631,7 @@ if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
}
// Determine MicroTask defer implementation.
// Determine microtask defer implementation.
/* istanbul ignore next, $flow-disable-line */
if (typeof Promise !== 'undefined' && isNative(Promise)) {
@ -1602,7 +1642,7 @@ if (typeof Promise !== 'undefined' && isNative(Promise)) {
/**
* Wrap a function so that if any code inside triggers state change,
* the changes are queued using a Task instead of a MicroTask.
* the changes are queued using a (macro) task instead of a microtask.
*/
/* */
@ -1785,7 +1825,7 @@ function wrapFilter (exp, filter) {
} else {
var name = filter.slice(0, i);
var args = filter.slice(i + 1);
return ("_f(\"" + name + "\")(" + exp + "," + args)
return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
}
}
@ -1936,7 +1976,9 @@ function addHandler (
events = el.events || (el.events = {});
}
var newHandler = { value: value };
var newHandler = {
value: value.trim()
};
if (modifiers !== emptyObject) {
newHandler.modifiers = modifiers;
}
@ -2037,7 +2079,7 @@ var klass = {
staticKeys: ['staticClass'],
transformNode: transformNode,
genData: genData
};
}
/* */
@ -2104,7 +2146,7 @@ var style = {
staticKeys: ['staticStyle'],
transformNode: transformNode$1,
genData: genData$1
};
}
/* */
@ -2125,8 +2167,8 @@ function genComponentModel (
if (trim) {
valueExpression =
"(typeof " + baseValueExpression + " === 'string'" +
"? " + baseValueExpression + ".trim()" +
": " + baseValueExpression + ")";
"? " + baseValueExpression + ".trim()" +
": " + baseValueExpression + ")";
}
if (number) {
valueExpression = "_n(" + valueExpression + ")";
@ -2180,6 +2222,9 @@ var expressionEndPos;
function parseModel (val) {
// Fix https://github.com/vuejs/vue/pull/7730
// allow v-model="obj.val " (trailing whitespace)
val = val.trim();
len = val.length;
if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
@ -2598,6 +2643,8 @@ function processFor (el) {
}
}
function parseFor (exp) {
var inMatch = exp.match(forAliasRE);
if (!inMatch) { return }
@ -2920,8 +2967,19 @@ function checkForAliasModel (el, value) {
function preTransformNode (el, options) {
if (el.tag === 'input') {
var map = el.attrsMap;
if (map['v-model'] && (map['v-bind:type'] || map[':type'])) {
var typeBinding = getBindingAttr(el, 'type');
if (!map['v-model']) {
return
}
var typeBinding;
if (map[':type'] || map['v-bind:type']) {
typeBinding = getBindingAttr(el, 'type');
}
if (!typeBinding && map['v-bind']) {
typeBinding = "(" + (map['v-bind']) + ").type";
}
if (typeBinding) {
var ifCondition = getAndRemoveAttr(el, 'v-if', true);
var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
@ -2974,13 +3032,13 @@ function cloneASTElement (el) {
var model = {
preTransformNode: preTransformNode
};
}
var modules = [
klass,
style,
model
];
]
/* */
@ -3066,8 +3124,8 @@ function genCheckboxModel (
'if(Array.isArray($$a)){' +
"var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
'$$i=_i($$a,$$v);' +
"if($$el.checked){$$i<0&&(" + value + "=$$a.concat([$$v]))}" +
"else{$$i>-1&&(" + value + "=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}" +
"if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
"else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
"}else{" + (genAssignmentCode(value, '$$c')) + "}",
null, true
);
@ -3110,9 +3168,11 @@ function genDefaultModel (
var type = el.attrsMap.type;
// warn if v-bind:value conflicts with v-model
// except for inputs with v-bind:type
if (process.env.NODE_ENV !== 'production') {
var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
if (value$1) {
var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
if (value$1 && !typeBinding) {
var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
warn$2(
binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
@ -3172,7 +3232,7 @@ var directives = {
model: model$1,
text: text,
html: html
};
}
/* */
@ -3318,10 +3378,10 @@ function isDirectChildOfTemplateFor (node) {
/* */
var fnExpRE = /^\s*([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
var simplePathRE = /^\s*[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['.*?']|\[".*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*\s*$/;
var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
// keyCode aliases
// KeyboardEvent.keyCode aliases
var keyCodes = {
esc: 27,
tab: 9,
@ -3334,6 +3394,19 @@ var keyCodes = {
'delete': [8, 46]
};
// KeyboardEvent.key aliases
var keyNames = {
esc: 'Escape',
tab: 'Tab',
enter: 'Enter',
space: ' ',
up: 'ArrowUp',
left: 'ArrowLeft',
right: 'ArrowRight',
down: 'ArrowDown',
'delete': ['Backspace', 'Delete']
};
// #4868: modifiers that prevent the execution of the listener
// need to explicitly return null so that we can determine whether to remove
// the listener for .once
@ -3416,9 +3489,9 @@ function genHandler (
code += genModifierCode;
}
var handlerCode = isMethodPath
? handler.value + '($event)'
? ("return " + (handler.value) + "($event)")
: isFunctionExpression
? ("(" + (handler.value) + ")($event)")
? ("return (" + (handler.value) + ")($event)")
: handler.value;
/* istanbul ignore if */
return ("function($event){" + code + handlerCode + "}")
@ -3434,12 +3507,15 @@ function genFilterCode (key) {
if (keyVal) {
return ("$event.keyCode!==" + keyVal)
}
var code = keyCodes[key];
var keyCode = keyCodes[key];
var keyName = keyNames[key];
return (
"_k($event.keyCode," +
(JSON.stringify(key)) + "," +
(JSON.stringify(code)) + "," +
"$event.key)"
(JSON.stringify(keyCode)) + "," +
"$event.key," +
"" + (JSON.stringify(keyName)) +
")"
)
}
@ -3466,7 +3542,7 @@ var baseDirectives = {
on: on,
bind: bind$1,
cloak: noop
};
}
/* */

View File

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

View File

@ -2,7 +2,7 @@ const chalk = require('chalk')
const msgPath = process.env.GIT_PARAMS
const msg = require('fs').readFileSync(msgPath, 'utf-8').trim()
const commitRE = /^(revert: )?(feat|fix|polish|docs|style|refactor|perf|test|workflow|ci|chore|types)(\(.+\))?: .{1,50}/
const commitRE = /^(revert: )?(feat|fix|polish|docs|style|refactor|perf|test|workflow|ci|chore|types|build)(\(.+\))?: .{1,50}/
if (!commitRE.test(msg)) {
console.log()