build: build v2.5.18-beta.0

This commit is contained in:
Evan You 2018-12-02 16:12:52 -05:00
parent 307835284a
commit fe194dd5d8
16 changed files with 33283 additions and 33053 deletions

889
dist/vue.common.js vendored

File diff suppressed because it is too large Load Diff

889
dist/vue.esm.js vendored

File diff suppressed because it is too large Load Diff

20935
dist/vue.js vendored

File diff suppressed because it is too large Load Diff

4
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

15341
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

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -4,6 +4,8 @@
var isJS = function (file) { return /\.js(\?[^.]+)?$/.test(file); };
var isCSS = function (file) { return /\.css(\?[^.]+)?$/.test(file); };
var ref = require('chalk');
var red = ref.red;
var yellow = ref.yellow;
@ -12,8 +14,19 @@ var prefix = "[vue-server-renderer-webpack-plugin]";
var warn = exports.warn = function (msg) { return console.error(red((prefix + " " + msg + "\n"))); };
var tip = exports.tip = function (msg) { return console.log(yellow((prefix + " " + msg + "\n"))); };
var onEmit = function (compiler, name, hook) {
if (compiler.hooks) {
// Webpack >= 4.0.0
compiler.hooks.emit.tapAsync(name, hook);
} else {
// Webpack < 4.0.0
compiler.plugin('emit', hook);
}
};
var hash = require('hash-sum');
var uniq = require('lodash.uniq');
var VueSSRClientPlugin = function VueSSRClientPlugin (options) {
if ( options === void 0 ) options = {};
@ -25,7 +38,7 @@ var VueSSRClientPlugin = function VueSSRClientPlugin (options) {
VueSSRClientPlugin.prototype.apply = function apply (compiler) {
var this$1 = this;
compiler.plugin('emit', function (compilation, cb) {
onEmit(compiler, 'vue-client-plugin', function (compilation, cb) {
var stats = compilation.getStats().toJson();
var allFiles = uniq(stats.assets
@ -34,10 +47,10 @@ VueSSRClientPlugin.prototype.apply = function apply (compiler) {
var initialFiles = uniq(Object.keys(stats.entrypoints)
.map(function (name) { return stats.entrypoints[name].assets; })
.reduce(function (assets, all) { return all.concat(assets); }, [])
.filter(isJS));
.filter(function (file) { return isJS(file) || isCSS(file); }));
var asyncFiles = allFiles
.filter(isJS)
.filter(function (file) { return isJS(file) || isCSS(file); })
.filter(function (file) { return initialFiles.indexOf(file) < 0; });
var manifest = {
@ -58,7 +71,8 @@ VueSSRClientPlugin.prototype.apply = function apply (compiler) {
if (!chunk || !chunk.files) {
return
}
var files = manifest.modules[hash(m.identifier)] = chunk.files.map(fileToIndex);
var id = m.identifier.replace(/\s\w+$/, ''); // remove appended hash
var files = manifest.modules[hash(id)] = chunk.files.map(fileToIndex);
// find all asset modules associated with the same chunk
assetModules.forEach(function (m) {
if (m.chunks.some(function (id) { return id === cid; })) {
@ -68,12 +82,6 @@ VueSSRClientPlugin.prototype.apply = function apply (compiler) {
}
});
// const debug = (file, obj) => {
// require('fs').writeFileSync(__dirname + '/' + file, JSON.stringify(obj, null, 2))
// }
// debug('stats.json', stats)
// debug('client-manifest.json', manifest)
var json = JSON.stringify(manifest, null, 2);
compilation.assets[this$1.options.filename] = {
source: function () { return json; },

View File

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

View File

@ -29,6 +29,16 @@ var validate = function (compiler) {
}
};
var onEmit = function (compiler, name, hook) {
if (compiler.hooks) {
// Webpack >= 4.0.0
compiler.hooks.emit.tapAsync(name, hook);
} else {
// Webpack < 4.0.0
compiler.plugin('emit', hook);
}
};
var VueSSRServerPlugin = function VueSSRServerPlugin (options) {
if ( options === void 0 ) options = {};
@ -42,7 +52,7 @@ VueSSRServerPlugin.prototype.apply = function apply (compiler) {
validate(compiler);
compiler.plugin('emit', function (compilation, cb) {
onEmit(compiler, 'vue-server-plugin', function (compilation, cb) {
var stats = compilation.getStats().toJson();
var entryName = Object.keys(stats.entrypoints)[0];
var entryInfo = stats.entrypoints[entryName];
@ -75,7 +85,7 @@ VueSSRServerPlugin.prototype.apply = function apply (compiler) {
};
stats.assets.forEach(function (asset) {
if (asset.name.match(/\.js$/)) {
if (isJS(asset.name)) {
bundle.files[asset.name] = compilation.assets[asset.name].source();
} else if (asset.name.match(/\.js\.map$/)) {
bundle.maps[asset.name.replace(/\.map$/, '')] = JSON.parse(compilation.assets[asset.name].source());

File diff suppressed because one or more lines are too long

View File

@ -11,20 +11,14 @@ var he = _interopDefault(require('he'));
var emptyObject = Object.freeze({});
// these helpers produces better vm code in JS engines due to their
// explicitness and function inlining
// These helpers produce better VM code in JS engines due to their
// explicitness and function inlining.
function isUndef (v) {
return v === undefined || v === null
}
/**
* Check if value is primitive
* Check if value is primitive.
*/
function isPrimitive (value) {
return (
@ -46,7 +40,7 @@ function isObject (obj) {
}
/**
* Get the raw type string of a value e.g. [object Object]
* Get the raw type string of a value, e.g., [object Object].
*/
var _toString = Object.prototype.toString;
@ -62,8 +56,6 @@ function isPlainObject (obj) {
return _toString.call(obj) === '[object Object]'
}
/**
* Check if val is a valid array index.
*/
@ -72,17 +64,6 @@ function isValidArrayIndex (val) {
return n >= 0 && Math.floor(n) === n && isFinite(val)
}
/**
* Convert a value to a string that is actually rendered.
*/
/**
* Convert a input value to a number for persistence.
* If the conversion fails, return original string.
*/
/**
* Make a map and return a function for checking if a key
* is in that map.
@ -107,12 +88,12 @@ function makeMap (
var isBuiltInTag = makeMap('slot,component', true);
/**
* Check if a attribute is a reserved attribute.
* Check if an attribute is a reserved attribute.
*/
var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
/**
* Remove an item from an array
* Remove an item from an array.
*/
function remove (arr, item) {
if (arr.length) {
@ -124,7 +105,7 @@ function remove (arr, item) {
}
/**
* Check whether the object has the property.
* Check whether an object has the property.
*/
var hasOwnProperty = Object.prototype.hasOwnProperty;
function hasOwn (obj, key) {
@ -151,18 +132,11 @@ var camelize = cached(function (str) {
});
/**
* Capitalize a string.
*/
/**
* 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.
* 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 performant enough in most browsers.
* But removing it would mean breaking code that was able to run in
* PhantomJS 1.x, so this must be kept for backward compatibility.
*/
/* istanbul ignore next */
@ -188,11 +162,6 @@ var bind = Function.prototype.bind
? nativeBind
: polyfillBind;
/**
* Convert an Array-like object to a real Array.
*/
/**
* Mix properties into target object.
*/
@ -203,15 +172,12 @@ function extend (to, _from) {
return to
}
/**
* Merge an Array of Objects into a single Object.
*/
/* eslint-disable no-unused-vars */
/**
* Perform no operation.
* Stubbing args to make Flow happy without leaving useless transpiled code
* with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/)
* with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
*/
function noop (a, b, c) {}
@ -220,13 +186,15 @@ function noop (a, b, c) {}
*/
var no = function (a, b, c) { return false; };
/* eslint-enable no-unused-vars */
/**
* Return same value
* Return the same value.
*/
var identity = function (_) { return _; };
/**
* Generate a static keys string from compiler modules.
* Generate a string containing static keys from compiler modules.
*/
function genStaticKeys (modules) {
return modules.reduce(function (keys, m) {
@ -234,18 +202,6 @@ function genStaticKeys (modules) {
}, []).join(',')
}
/**
* Check if two values are loosely equal - that is,
* if they are plain objects, do they have the same shape?
*/
/**
* Ensure a function is called only once.
*/
/* */
var isUnaryTag = makeMap(
@ -273,13 +229,6 @@ var isNonPhrasingTag = makeMap(
* Not type-checking this file because it's mostly vendor code.
*/
/*!
* HTML Parser By John Resig (ejohn.org)
* Modified by Juriy "kangax" Zaytsev
* Original code by Erik Arvidsson, Mozilla Public License
* http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
*/
// Regular Expressions for parsing tags and attributes
var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
// could use https://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-QName
@ -294,11 +243,6 @@ var doctype = /^<!DOCTYPE [^>]+>/i;
var comment = /^<!\--/;
var conditionalComment = /^<!\[/;
var IS_REGEX_CAPTURING_BROKEN = false;
'x'.replace(/x(.)?/g, function (m, g) {
IS_REGEX_CAPTURING_BROKEN = g === '';
});
// Special Elements (can contain anything)
var isPlainTextElement = makeMap('script,style,textarea', true);
var reCache = {};
@ -379,7 +323,7 @@ function parseHTML (html, options) {
var startTagMatch = parseStartTag();
if (startTagMatch) {
handleStartTag(startTagMatch);
if (shouldIgnoreFirstNewline(lastTag, html)) {
if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
advance(1);
}
continue
@ -496,12 +440,6 @@ function parseHTML (html, options) {
var attrs = new Array(l);
for (var i = 0; i < l; i++) {
var args = match.attrs[i];
// hackish work around FF bug https://bugzilla.mozilla.org/show_bug.cgi?id=369778
if (IS_REGEX_CAPTURING_BROKEN && args[0].indexOf('""') === -1) {
if (args[3] === '') { delete args[3]; }
if (args[4] === '') { delete args[4]; }
if (args[5] === '') { delete args[5]; }
}
var value = args[3] || args[4] || args[5] || '';
var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
? options.shouldDecodeNewlinesForHref
@ -527,12 +465,9 @@ function parseHTML (html, options) {
if (start == null) { start = index; }
if (end == null) { end = index; }
if (tagName) {
lowerCasedTagName = tagName.toLowerCase();
}
// Find the closest opened tag of the same type
if (tagName) {
lowerCasedTagName = tagName.toLowerCase();
for (pos = stack.length - 1; pos >= 0; pos--) {
if (stack[pos].lowerCasedTag === lowerCasedTagName) {
break
@ -657,14 +592,18 @@ function parseComponent (
}
}
function end (tag, start, end) {
function end (tag, start) {
if (depth === 1 && currentBlock) {
currentBlock.end = start;
var text = deindent(content.slice(currentBlock.start, currentBlock.end));
var text = content.slice(currentBlock.start, currentBlock.end);
// pad content so that linters and pre-processors can output correct
// line numbers in errors and warnings
if (currentBlock.type !== 'template' && options.pad) {
if (options.pad) {
text = padContent(currentBlock, options.pad) + text;
} else {
// avoid to deindent if pad option is specified
// to retain original source position.
text = deindent(text);
}
currentBlock.content = text;
currentBlock = null;
@ -694,11 +633,6 @@ function parseComponent (
/* */
/**
* Check if a string starts with $ or _
*/
/**
* Define a property.
*/
@ -730,15 +664,11 @@ var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
// Firefox has a "watch" function on Object.prototype...
var nativeWatch = ({}).watch;
if (inBrowser) {
try {
var opts = {};
Object.defineProperty(opts, 'passive', ({
get: function get () {
/* istanbul ignore next */
}
})); // https://github.com/facebook/flow/issues/285
window.addEventListener('test-passive', null, opts);
@ -754,7 +684,7 @@ var isServerRendering = function () {
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';
_isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
} else {
_isServer = false;
}
@ -774,13 +704,29 @@ 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 = /*@__PURE__*/(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 = [
@ -805,6 +751,8 @@ var LIFECYCLE_HOOKS = [
/* */
var config = ({
/**
* Option merge strategies (used in core/util/options)
@ -887,11 +835,17 @@ var config = ({
*/
mustUseProp: no,
/**
* Perform updates asynchronously. Intended to be used by Vue Test Utils
* This will significantly reduce performance if set to false.
*/
async: true,
/**
* Exposed for legacy reasons
*/
_lifecycleHooks: LIFECYCLE_HOOKS
})
});
/* */
@ -910,9 +864,7 @@ if (process.env.NODE_ENV !== 'production') {
warn = function (msg, vm) {
var trace = vm ? generateComponentTrace(vm) : '';
if (config.warnHandler) {
config.warnHandler.call(null, msg, vm, trace);
} else if (hasConsole && (!config.silent)) {
if (hasConsole && (!config.silent)) {
console.error(("[Vue warn]: " + msg + trace));
}
};
@ -989,7 +941,6 @@ if (process.env.NODE_ENV !== 'production') {
/* */
var uid = 0;
/**
@ -1018,6 +969,12 @@ Dep.prototype.depend = function depend () {
Dep.prototype.notify = function notify () {
// stabilize the subscriber list first
var subs = this.subs.slice();
if (process.env.NODE_ENV !== 'production' && !config.async) {
// subs aren't sorted in scheduler if not running async
// we need to sort them now to make sure they fire in correct
// order
subs.sort(function (a, b) { return a.id - b.id; });
}
for (var i = 0, l = subs.length; i < l; i++) {
subs[i].update();
}
@ -1075,15 +1032,6 @@ prototypeAccessors.child.get = function () {
Object.defineProperties( VNode.prototype, prototypeAccessors );
// optimized shallow clone
// 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.
/*
* not type checking this file because flow doesn't play well with
* dynamically accessing methods on Array prototype
@ -1141,8 +1089,6 @@ var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
*/
var shouldObserve = true;
/**
* Observer class that is attached to each observed
* object. Once attached, the observer converts the target
@ -1155,10 +1101,11 @@ var Observer = function Observer (value) {
this.vmCount = 0;
def(value, '__ob__', this);
if (Array.isArray(value)) {
var augment = hasProto
? protoAugment
: copyAugment;
augment(value, arrayMethods, arrayKeys);
if (hasProto) {
protoAugment(value, arrayMethods);
} else {
copyAugment(value, arrayMethods, arrayKeys);
}
this.observeArray(value);
} else {
this.walk(value);
@ -1166,14 +1113,14 @@ var Observer = function Observer (value) {
};
/**
* Walk through each property and convert them into
* Walk through all properties and convert them into
* getter/setters. This method should only be called when
* value type is Object.
*/
Observer.prototype.walk = function walk (obj) {
var keys = Object.keys(obj);
for (var i = 0; i < keys.length; i++) {
defineReactive(obj, keys[i]);
defineReactive$$1(obj, keys[i]);
}
};
@ -1189,17 +1136,17 @@ Observer.prototype.observeArray = function observeArray (items) {
// helpers
/**
* Augment an target Object or Array by intercepting
* Augment a target Object or Array by intercepting
* the prototype chain using __proto__
*/
function protoAugment (target, src, keys) {
function protoAugment (target, src) {
/* eslint-disable no-proto */
target.__proto__ = src;
/* eslint-enable no-proto */
}
/**
* Augment an target Object or Array by defining
* Augment a target Object or Array by defining
* hidden properties.
*/
/* istanbul ignore next */
@ -1240,7 +1187,7 @@ function observe (value, asRootData) {
/**
* Define a reactive property on an Object.
*/
function defineReactive (
function defineReactive$$1 (
obj,
key,
val,
@ -1288,6 +1235,8 @@ function defineReactive (
if (process.env.NODE_ENV !== 'production' && customSetter) {
customSetter();
}
// #7981: for accessor properties without setter
if (getter && !setter) { return }
if (setter) {
setter.call(obj, newVal);
} else {
@ -1331,16 +1280,11 @@ function set (target, key, val) {
target[key] = val;
return val
}
defineReactive(ob.value, key, val);
defineReactive$$1(ob.value, key, val);
ob.dep.notify();
return val
}
/**
* Delete a property and trigger change if necessary.
*/
/**
* Collect dependencies on array elements when the array is touched, since
* we cannot intercept array element access like property getters.
@ -1392,7 +1336,11 @@ function mergeData (to, from) {
fromVal = from[key];
if (!hasOwn(to, key)) {
set(to, key, fromVal);
} else if (isPlainObject(toVal) && isPlainObject(fromVal)) {
} else if (
toVal !== fromVal &&
isPlainObject(toVal) &&
isPlainObject(fromVal)
) {
mergeData(toVal, fromVal);
}
}
@ -1580,8 +1528,6 @@ var defaultStrat = function (parentVal, childVal) {
: childVal
};
function assertObjectType (name, value, vm) {
if (!isPlainObject(value)) {
warn(
@ -1592,26 +1538,14 @@ function assertObjectType (name, value, vm) {
}
}
/**
* Merge two option objects into a new one.
* Core utility used in both instantiation and inheritance.
*/
/**
* Resolve an asset.
* This function is used because child instances need access
* to assets defined in its ancestor chain.
*/
/* */
/* */
/* */
/* globals MessageChannel */
var callbacks = [];
function flushCallbacks () {
var copies = callbacks.slice(0);
callbacks.length = 0;
@ -1625,34 +1559,18 @@ function flushCallbacks () {
// 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)) {
} else if (typeof MessageChannel !== 'undefined' && (
if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) ; else if (typeof MessageChannel !== 'undefined' && (
isNative(MessageChannel) ||
// PhantomJS
MessageChannel.toString() === '[object MessageChannelConstructor]'
)) {
var channel = new MessageChannel();
channel.port1.onmessage = flushCallbacks;
} else {
/* istanbul ignore next */
}
// Determine microtask defer implementation.
/* istanbul ignore next, $flow-disable-line */
if (typeof Promise !== 'undefined' && isNative(Promise)) {
} else {
// fallback to macro
}
/**
* Wrap a function so that if any code inside triggers state change,
* the changes are queued using a (macro) task instead of a microtask.
*/
if (typeof Promise !== 'undefined' && isNative(Promise)) ;
/* */
@ -1688,8 +1606,6 @@ var isBooleanAttr = makeMap(
/* */
var isHTMLTag = makeMap(
'html,body,base,head,link,meta,style,title,' +
'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
@ -1730,16 +1646,10 @@ function getTagNamespace (tag) {
}
}
var isTextInputType = makeMap('text,number,password,search,email,tel,url');
/* */
/**
* Query an element selector if it's not an element already.
*/
/* */
var validDivisionCharRE = /[\w).+\-_$\]]/;
@ -1840,7 +1750,7 @@ function wrapFilter (exp, filter) {
/* */
var defaultTagRE = /\{\{((?:.|\n)+?)\}\}/g;
var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
var buildRegex = cached(function (delimiters) {
@ -1950,6 +1860,18 @@ function addHandler (
);
}
// normalize click.right and click.middle since they don't actually fire
// this is technically browser-specific, but at least for now browsers are
// the only target envs that have right/middle clicks.
if (name === 'click') {
if (modifiers.right) {
name = 'contextmenu';
delete modifiers.right;
} else if (modifiers.middle) {
name = 'mouseup';
}
}
// check capture modifier
if (modifiers.capture) {
delete modifiers.capture;
@ -1965,18 +1887,6 @@ function addHandler (
name = '&' + name; // mark the event as passive
}
// normalize click.right and click.middle since they don't actually fire
// this is technically browser-specific, but at least for now browsers are
// the only target envs that have right/middle clicks.
if (name === 'click') {
if (modifiers.right) {
name = 'contextmenu';
delete modifiers.right;
} else if (modifiers.middle) {
name = 'mouseup';
}
}
var events;
if (modifiers.native) {
delete modifiers.native;
@ -2088,7 +1998,7 @@ var klass = {
staticKeys: ['staticClass'],
transformNode: transformNode,
genData: genData
}
};
/* */
@ -2105,14 +2015,6 @@ var parseStyleText = cached(function (cssText) {
return res
});
// normalize possible array / string values into Object
/**
* parent component style should be after child's
* so that parent component's style could override it
*/
/* */
function transformNode$1 (el, options) {
@ -2155,7 +2057,7 @@ var style = {
staticKeys: ['staticStyle'],
transformNode: transformNode$1,
genData: genData$1
}
};
/* */
@ -2221,12 +2123,7 @@ function genAssignmentCode (
*
*/
var len;
var str;
var chr;
var index;
var expressionPos;
var expressionEndPos;
var len, str, chr, index, expressionPos, expressionEndPos;
@ -2314,7 +2211,7 @@ function parseString (chr) {
var onRE = /^@|^v-on:/;
var dirRE = /^v-|^@|^:/;
var forAliasRE = /([^]*?)\s+(?:in|of)\s+([^]*)/;
var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
var stripParensRE = /^\(|\)$/g;
@ -2499,7 +2396,8 @@ function parse (
processIfConditions(element, currentParent);
} else if (element.slotScope) { // scoped slot
currentParent.plain = false;
var name = element.slotTarget || '"default"';(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
var name = element.slotTarget || '"default"'
;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
} else {
currentParent.children.push(element);
element.parent = currentParent;
@ -2623,8 +2521,20 @@ function processElement (element, options) {
function processKey (el) {
var exp = getBindingAttr(el, 'key');
if (exp) {
if (process.env.NODE_ENV !== 'production' && el.tag === 'template') {
warn$1("<template> cannot be keyed. Place the key on real elements instead.");
if (process.env.NODE_ENV !== 'production') {
if (el.tag === 'template') {
warn$1("<template> cannot be keyed. Place the key on real elements instead.");
}
if (el.for) {
var iterator = el.iterator2 || el.iterator1;
var parent = el.parent;
if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
warn$1(
"Do not use v-for index as key on <transtion-group> children, " +
"this is the same as not using keys."
);
}
}
}
el.key = exp;
}
@ -2662,7 +2572,7 @@ function parseFor (exp) {
var alias = inMatch[1].trim().replace(stripParensRE, '');
var iteratorMatch = alias.match(forIteratorRE);
if (iteratorMatch) {
res.alias = alias.replace(forIteratorRE, '');
res.alias = alias.replace(forIteratorRE, '').trim();
res.iterator1 = iteratorMatch[1].trim();
if (iteratorMatch[2]) {
res.iterator2 = iteratorMatch[2].trim();
@ -2815,6 +2725,14 @@ function processAttrs (el) {
name = name.replace(bindRE, '');
value = parseFilters(value);
isProp = false;
if (
process.env.NODE_ENV !== 'production' &&
value.trim().length === 0
) {
warn$1(
("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
);
}
if (modifiers) {
if (modifiers.prop) {
isProp = true;
@ -2963,16 +2881,6 @@ function checkForAliasModel (el, value) {
/* */
/**
* Expand input[v-model] with dyanmic type bindings into v-if-else chains
* Turn this:
* <input v-model="data[type]" :type="type">
* into this:
* <input v-if="type === 'checkbox'" type="checkbox" v-model="data[type]">
* <input v-else-if="type === 'radio'" type="radio" v-model="data[type]">
* <input v-else :type="type" v-model="data[type]">
*/
function preTransformNode (el, options) {
if (el.tag === 'input') {
var map = el.attrsMap;
@ -3041,13 +2949,13 @@ function cloneASTElement (el) {
var model = {
preTransformNode: preTransformNode
}
};
var modules = [
klass,
style,
model
]
];
/* */
@ -3057,7 +2965,6 @@ var warn$2;
// so we used some reserved tokens during compile.
var RANGE_TOKEN = '__r';
function model$1 (
el,
dir,
@ -3241,7 +3148,7 @@ var directives = {
model: model$1,
text: text,
html: html
}
};
/* */
@ -3438,8 +3345,7 @@ var modifierCode = {
function genHandlers (
events,
isNative,
warn
isNative
) {
var res = isNative ? 'nativeOn:{' : 'on:{';
for (var name in events) {
@ -3467,7 +3373,6 @@ function genHandler (
if (isMethodPath || isFunctionExpression) {
return handler.value
}
/* istanbul ignore if */
return ("function($event){" + (handler.value) + "}") // inline statement
} else {
var code = '';
@ -3504,7 +3409,6 @@ function genHandler (
: isFunctionExpression
? ("return (" + (handler.value) + ")($event)")
: handler.value;
/* istanbul ignore if */
return ("function($event){" + code + handlerCode + "}")
}
}
@ -3553,10 +3457,14 @@ var baseDirectives = {
on: on,
bind: bind$1,
cloak: noop
}
};
/* */
var CodegenState = function CodegenState (options) {
this.options = options;
this.warn = options.warn || baseWarn;
@ -3564,9 +3472,10 @@ var CodegenState = function CodegenState (options) {
this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
this.directives = extend(extend({}, baseDirectives), options.directives);
var isReservedTag = options.isReservedTag || no;
this.maybeComponent = function (el) { return !isReservedTag(el.tag); };
this.maybeComponent = function (el) { return !(isReservedTag(el.tag) && !el.component); };
this.onceId = 0;
this.staticRenderFns = [];
this.pre = false;
};
@ -3584,6 +3493,10 @@ function generate (
}
function genElement (el, state) {
if (el.parent) {
el.pre = el.pre || el.parent.pre;
}
if (el.staticRoot && !el.staticProcessed) {
return genStatic(el, state)
} else if (el.once && !el.onceProcessed) {
@ -3592,7 +3505,7 @@ function genElement (el, state) {
return genFor(el, state)
} else if (el.if && !el.ifProcessed) {
return genIf(el, state)
} else if (el.tag === 'template' && !el.slotTarget) {
} else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
return genChildren(el, state) || 'void 0'
} else if (el.tag === 'slot') {
return genSlot(el, state)
@ -3602,7 +3515,10 @@ function genElement (el, state) {
if (el.component) {
code = genComponent(el.component, el, state);
} else {
var data = el.plain ? undefined : genData$2(el, state);
var data;
if (!el.plain || (el.pre && state.maybeComponent(el))) {
data = genData$2(el, state);
}
var children = el.inlineTemplate ? null : genChildren(el, state, true);
code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
@ -3618,7 +3534,15 @@ function genElement (el, state) {
// hoist static sub-trees out
function genStatic (el, state) {
el.staticProcessed = true;
// Some elements (templates) need to behave differently inside of a v-pre
// node. All pre nodes are static roots, so we can use this as a location to
// wrap a state change and reset it upon exiting the pre node.
var originalPreState = state.pre;
if (el.pre) {
state.pre = el.pre;
}
state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
state.pre = originalPreState;
return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
}
@ -3759,10 +3683,10 @@ function genData$2 (el, state) {
}
// event handlers
if (el.events) {
data += (genHandlers(el.events, false, state.warn)) + ",";
data += (genHandlers(el.events, false)) + ",";
}
if (el.nativeEvents) {
data += (genHandlers(el.nativeEvents, true, state.warn)) + ",";
data += (genHandlers(el.nativeEvents, true)) + ",";
}
// slot target
// only for non-scoped slots
@ -3854,7 +3778,7 @@ function genScopedSlot (
var fn = "function(" + (String(el.slotScope)) + "){" +
"return " + (el.tag === 'template'
? el.if
? ((el.if) + "?" + (genChildren(el, state) || 'undefined') + ":undefined")
? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
: genChildren(el, state) || 'undefined'
: genElement(el, state)) + "}";
return ("{key:" + key + ",fn:" + fn + "}")
@ -3892,13 +3816,16 @@ function genChildren (
el$1.tag !== 'template' &&
el$1.tag !== 'slot'
) {
return (altGenElement || genElement)(el$1, state)
// because el may be a functional component and return an Array instead of a single root.
// In this case, just a simple normalization is needed
var normalizationType = state.maybeComponent(el$1) ? ",1" : "";
return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
}
var normalizationType = checkSkip
var normalizationType$1 = checkSkip
? getNormalizationType(children, state.maybeComponent)
: 0;
var gen = altGenNode || genNode;
return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType ? ("," + normalizationType) : ''))
return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
}
}
@ -3936,7 +3863,7 @@ function needsNormalization (el) {
function genNode (node, state) {
if (node.type === 1) {
return genElement(node, state)
} if (node.type === 3 && node.isComment) {
} else if (node.type === 3 && node.isComment) {
return genComment(node)
} else {
return genText(node)
@ -4109,6 +4036,8 @@ function checkExpression (exp, text, errors) {
/* */
function createFunction (code, errors) {
try {
return new Function(code)
@ -4309,6 +4238,7 @@ var isRenderableAttr = function (name) {
name.indexOf('aria-') === 0
)
};
var propsToAttrMap = {
acceptCharset: 'accept-charset',
className: 'class',
@ -4333,6 +4263,11 @@ function escapeChar (a) {
/* */
var plainStringRE = /^"(?:[^"\\]|\\.)*"$|^'(?:[^'\\]|\\.)*'$/;
// let the model AST transform translate v-model into appropriate
@ -4412,7 +4347,7 @@ function genClassSegments (
classBinding
) {
if (staticClass && !classBinding) {
return [{ type: RAW, value: (" class=" + staticClass) }]
return [{ type: RAW, value: (" class=\"" + (JSON.parse(staticClass)) + "\"") }]
} else {
return [{
type: EXPRESSION,
@ -4441,16 +4376,6 @@ function genStyleSegments (
/* */
/**
* In SSR, the vdom tree is generated only once and never patched, so
* we can optimize most element / trees into plain string render functions.
* The SSR optimizer walks the AST tree to detect optimizable elements and trees.
*
* The criteria for SSR optimizability is quite a bit looser than static tree
* detection (which is designed for client re-render). In SSR we bail only for
* components/slots/custom directives.
*/
// optimizability constants
var optimizability = {
FALSE: 0, // whole sub tree un-optimizable
@ -4580,9 +4505,8 @@ function isSelectWithModel (node) {
/* */
// The SSR codegen is essentially extending the default codegen to handle
// SSR-optimizable nodes and turn them into string render fns. In cases where
// a node is not optimizable it simply falls back to the default codegen.
// segment types
var RAW = 0;

View File

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