Browse Source

build: ship pre-minified versions of CommonJS build and server renderer

dev
Evan You 6 years ago
parent
commit
17296aa6bb
  1. 6
      benchmarks/ssr/common.js
  2. 11092
      dist/vue.common.js
  3. 2
      dist/vue.min.js
  4. 8117
      dist/vue.runtime.common.js
  5. 149
      packages/vue-server-renderer/build.dev.js
  6. 1
      packages/vue-server-renderer/build.prod.js
  7. 6
      packages/vue-server-renderer/index.js
  8. 3
      scripts/build.js
  9. 37
      scripts/config.js

6
benchmarks/ssr/common.js

@ -1,6 +1,6 @@
'use strict' 'use strict'
const self = (global || root) const self = (global || root) // eslint-disable-line
self.performance = { self.performance = {
now: function () { now: function () {
@ -35,11 +35,11 @@ module.exports = {
} }
}, },
// template: '<table><tr v-for="row in grid"><th>123</th><td v-for="item in row.items">{{ item.id }}</td></tr></table>', // template: '<table><tr v-for="row in grid"><th>123</th><td v-for="item in row.items">{{ item.id }}</td></tr></table>',
template: '<table width="100%" cellspacing="2"><row v-for="row in grid" :row="row"></row></table>', template: '<table width="100%" cellspacing="2"><row v-for="row in grid" :key="row.id" :row="row"></row></table>',
components: { components: {
row: { row: {
props: ['row'], props: ['row'],
template: '<tr><th>{{ Math.random() }}</th><column v-for="item in row.items"></column></tr>', template: '<tr><th>{{ Math.random() }}</th><column v-for="item in row.items" :key="item.id"></column></tr>',
components: { components: {
column: { column: {
template: '<td class="item">' + template: '<td class="item">' +

11092
dist/vue.common.js

File diff suppressed because it is too large

2
dist/vue.min.js

File diff suppressed because one or more lines are too long

8117
dist/vue.runtime.common.js

File diff suppressed because it is too large

149
packages/vue-server-renderer/build.js → packages/vue-server-renderer/build.dev.js

@ -733,12 +733,12 @@ var config = ({
/** /**
* Show production mode tip message on boot? * Show production mode tip message on boot?
*/ */
productionTip: process.env.NODE_ENV !== 'production', productionTip: "development" !== 'production',
/** /**
* Whether to enable devtools * Whether to enable devtools
*/ */
devtools: process.env.NODE_ENV !== 'production', devtools: "development" !== 'production',
/** /**
* Whether to record perf * Whether to record perf
@ -819,7 +819,7 @@ var tip = noop;
var generateComponentTrace = (noop); // work around flow check var generateComponentTrace = (noop); // work around flow check
var formatComponentName = (noop); var formatComponentName = (noop);
if (process.env.NODE_ENV !== 'production') { {
var hasConsole = typeof console !== 'undefined'; var hasConsole = typeof console !== 'undefined';
var classifyRE = /(?:^|[-_])(\w)/g; var classifyRE = /(?:^|[-_])(\w)/g;
var classify = function (str) { return str var classify = function (str) { return str
@ -934,12 +934,6 @@ Dep.prototype.depend = function depend () {
Dep.prototype.notify = function notify () { Dep.prototype.notify = function notify () {
// stabilize the subscriber list first // stabilize the subscriber list first
var subs = this.subs.slice(); 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++) { for (var i = 0, l = subs.length; i < l; i++) {
subs[i].update(); subs[i].update();
} }
@ -1165,7 +1159,7 @@ function defineReactive$$1 (
return return
} }
/* eslint-enable no-self-compare */ /* eslint-enable no-self-compare */
if (process.env.NODE_ENV !== 'production' && customSetter) { if (customSetter) {
customSetter(); customSetter();
} }
// #7981: for accessor properties without setter // #7981: for accessor properties without setter
@ -1187,8 +1181,7 @@ function defineReactive$$1 (
* already exist. * already exist.
*/ */
function set (target, key, val) { function set (target, key, val) {
if (process.env.NODE_ENV !== 'production' && if (isUndef(target) || isPrimitive(target)
(isUndef(target) || isPrimitive(target))
) { ) {
warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target)))); warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
} }
@ -1203,7 +1196,7 @@ function set (target, key, val) {
} }
var ob = (target).__ob__; var ob = (target).__ob__;
if (target._isVue || (ob && ob.vmCount)) { if (target._isVue || (ob && ob.vmCount)) {
process.env.NODE_ENV !== 'production' && warn( warn(
'Avoid adding reactive properties to a Vue instance or its root $data ' + 'Avoid adding reactive properties to a Vue instance or its root $data ' +
'at runtime - declare it upfront in the data option.' 'at runtime - declare it upfront in the data option.'
); );
@ -1244,7 +1237,7 @@ var strats = config.optionMergeStrategies;
/** /**
* Options with restrictions * Options with restrictions
*/ */
if (process.env.NODE_ENV !== 'production') { {
strats.el = strats.propsData = function (parent, child, vm, key) { strats.el = strats.propsData = function (parent, child, vm, key) {
if (!vm) { if (!vm) {
warn( warn(
@ -1332,7 +1325,7 @@ strats.data = function (
) { ) {
if (!vm) { if (!vm) {
if (childVal && typeof childVal !== 'function') { if (childVal && typeof childVal !== 'function') {
process.env.NODE_ENV !== 'production' && warn( warn(
'The "data" option should be a function ' + 'The "data" option should be a function ' +
'that returns a per-instance value in component ' + 'that returns a per-instance value in component ' +
'definitions.', 'definitions.',
@ -1382,7 +1375,7 @@ function mergeAssets (
) { ) {
var res = Object.create(parentVal || null); var res = Object.create(parentVal || null);
if (childVal) { if (childVal) {
process.env.NODE_ENV !== 'production' && assertObjectType(key, childVal, vm); assertObjectType(key, childVal, vm);
return extend(res, childVal) return extend(res, childVal)
} else { } else {
return res return res
@ -1410,7 +1403,7 @@ strats.watch = function (
if (childVal === nativeWatch) { childVal = undefined; } if (childVal === nativeWatch) { childVal = undefined; }
/* istanbul ignore if */ /* istanbul ignore if */
if (!childVal) { return Object.create(parentVal || null) } if (!childVal) { return Object.create(parentVal || null) }
if (process.env.NODE_ENV !== 'production') { {
assertObjectType(key, childVal, vm); assertObjectType(key, childVal, vm);
} }
if (!parentVal) { return childVal } if (!parentVal) { return childVal }
@ -1441,7 +1434,7 @@ strats.computed = function (
vm, vm,
key key
) { ) {
if (childVal && process.env.NODE_ENV !== 'production') { if (childVal && "development" !== 'production') {
assertObjectType(key, childVal, vm); assertObjectType(key, childVal, vm);
} }
if (!parentVal) { return childVal } if (!parentVal) { return childVal }
@ -1502,7 +1495,7 @@ function normalizeProps (options, vm) {
if (typeof val === 'string') { if (typeof val === 'string') {
name = camelize(val); name = camelize(val);
res[name] = { type: null }; res[name] = { type: null };
} else if (process.env.NODE_ENV !== 'production') { } else {
warn('props must be strings when using array syntax.'); warn('props must be strings when using array syntax.');
} }
} }
@ -1514,7 +1507,7 @@ function normalizeProps (options, vm) {
? val ? val
: { type: val }; : { type: val };
} }
} else if (process.env.NODE_ENV !== 'production') { } else {
warn( warn(
"Invalid value for option \"props\": expected an Array or an Object, " + "Invalid value for option \"props\": expected an Array or an Object, " +
"but got " + (toRawType(props)) + ".", "but got " + (toRawType(props)) + ".",
@ -1542,7 +1535,7 @@ function normalizeInject (options, vm) {
? extend({ from: key }, val) ? extend({ from: key }, val)
: { from: val }; : { from: val };
} }
} else if (process.env.NODE_ENV !== 'production') { } else {
warn( warn(
"Invalid value for option \"inject\": expected an Array or an Object, " + "Invalid value for option \"inject\": expected an Array or an Object, " +
"but got " + (toRawType(inject)) + ".", "but got " + (toRawType(inject)) + ".",
@ -1585,7 +1578,7 @@ function mergeOptions (
child, child,
vm vm
) { ) {
if (process.env.NODE_ENV !== 'production') { {
checkComponents(child); checkComponents(child);
} }
@ -1653,7 +1646,7 @@ function resolveAsset (
if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] } if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
// fallback to prototype chain // fallback to prototype chain
var res = assets[id] || assets[camelizedId] || assets[PascalCaseId]; var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
if (process.env.NODE_ENV !== 'production' && warnMissing && !res) { if (warnMissing && !res) {
warn( warn(
'Failed to resolve ' + type.slice(0, -1) + ': ' + id, 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
options options
@ -1699,11 +1692,7 @@ function validateProp (
observe(value); observe(value);
toggleObserving(prevShouldObserve); toggleObserving(prevShouldObserve);
} }
if ( {
process.env.NODE_ENV !== 'production' &&
// skip validation for weex recycle-list child component props
!(false)
) {
assertProp(prop, key, value, vm, absent); assertProp(prop, key, value, vm, absent);
} }
return value return value
@ -1719,7 +1708,7 @@ function getPropDefaultValue (vm, prop, key) {
} }
var def = prop.default; var def = prop.default;
// warn against non-factory defaults for Object & Array // warn against non-factory defaults for Object & Array
if (process.env.NODE_ENV !== 'production' && isObject(def)) { if (isObject(def)) {
warn( warn(
'Invalid default value for prop "' + key + '": ' + 'Invalid default value for prop "' + key + '": ' +
'Props with type Object/Array must use a factory function ' + 'Props with type Object/Array must use a factory function ' +
@ -1915,7 +1904,7 @@ function globalHandleError (err, vm, info) {
} }
function logError (err, vm, info) { function logError (err, vm, info) {
if (process.env.NODE_ENV !== 'production') { {
warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm); warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
} }
/* istanbul ignore else */ /* istanbul ignore else */
@ -2719,7 +2708,7 @@ function addHandler (
// warn prevent and passive modifier // warn prevent and passive modifier
/* istanbul ignore if */ /* istanbul ignore if */
if ( if (
process.env.NODE_ENV !== 'production' && warn && warn &&
modifiers.prevent && modifiers.passive modifiers.prevent && modifiers.passive
) { ) {
warn( warn(
@ -2831,7 +2820,7 @@ function getAndRemoveAttr (
function transformNode (el, options) { function transformNode (el, options) {
var warn = options.warn || baseWarn; var warn = options.warn || baseWarn;
var staticClass = getAndRemoveAttr(el, 'class'); var staticClass = getAndRemoveAttr(el, 'class');
if (process.env.NODE_ENV !== 'production' && staticClass) { if (staticClass) {
var res = parseText(staticClass, options.delimiters); var res = parseText(staticClass, options.delimiters);
if (res) { if (res) {
warn( warn(
@ -2875,7 +2864,7 @@ function transformNode$1 (el, options) {
var staticStyle = getAndRemoveAttr(el, 'style'); var staticStyle = getAndRemoveAttr(el, 'style');
if (staticStyle) { if (staticStyle) {
/* istanbul ignore if */ /* istanbul ignore if */
if (process.env.NODE_ENV !== 'production') { {
var res = parseText(staticStyle, options.delimiters); var res = parseText(staticStyle, options.delimiters);
if (res) { if (res) {
warn( warn(
@ -3070,7 +3059,7 @@ function parseHTML (html, options) {
if (html === last) { if (html === last) {
options.chars && options.chars(html); options.chars && options.chars(html);
if (process.env.NODE_ENV !== 'production' && !stack.length && options.warn) { if (!stack.length && options.warn) {
options.warn(("Mal-formatted tag at end of template: \"" + html + "\"")); options.warn(("Mal-formatted tag at end of template: \"" + html + "\""));
} }
break break
@ -3168,8 +3157,7 @@ function parseHTML (html, options) {
if (pos >= 0) { if (pos >= 0) {
// Close all the open elements, up the stack // Close all the open elements, up the stack
for (var i = stack.length - 1; i >= pos; i--) { for (var i = stack.length - 1; i >= pos; i--) {
if (process.env.NODE_ENV !== 'production' && if (i > pos || !tagName &&
(i > pos || !tagName) &&
options.warn options.warn
) { ) {
options.warn( options.warn(
@ -3462,7 +3450,7 @@ function parse (
if (isForbiddenTag(element) && !isServerRendering()) { if (isForbiddenTag(element) && !isServerRendering()) {
element.forbidden = true; element.forbidden = true;
process.env.NODE_ENV !== 'production' && warn$1( warn$1(
'Templates should only be responsible for mapping the state to the ' + 'Templates should only be responsible for mapping the state to the ' +
'UI. Avoid placing tags with side-effects in your templates, such as ' + 'UI. Avoid placing tags with side-effects in your templates, such as ' +
"<" + tag + ">" + ', as they will not be parsed.' "<" + tag + ">" + ', as they will not be parsed.'
@ -3495,7 +3483,7 @@ function parse (
} }
function checkRootConstraints (el) { function checkRootConstraints (el) {
if (process.env.NODE_ENV !== 'production') { {
if (el.tag === 'slot' || el.tag === 'template') { if (el.tag === 'slot' || el.tag === 'template') {
warnOnce( warnOnce(
"Cannot use <" + (el.tag) + "> as component root element because it may " + "Cannot use <" + (el.tag) + "> as component root element because it may " +
@ -3523,7 +3511,7 @@ function parse (
exp: element.elseif, exp: element.elseif,
block: element block: element
}); });
} else if (process.env.NODE_ENV !== 'production') { } else {
warnOnce( warnOnce(
"Component template should contain exactly one root element. " + "Component template should contain exactly one root element. " +
"If you are using v-if on multiple elements, " + "If you are using v-if on multiple elements, " +
@ -3566,7 +3554,7 @@ function parse (
chars: function chars (text) { chars: function chars (text) {
if (!currentParent) { if (!currentParent) {
if (process.env.NODE_ENV !== 'production') { {
if (text === template) { if (text === template) {
warnOnce( warnOnce(
'Component template requires a root element, rather than just text.' 'Component template requires a root element, rather than just text.'
@ -3661,7 +3649,7 @@ function processElement (element, options) {
function processKey (el) { function processKey (el) {
var exp = getBindingAttr(el, 'key'); var exp = getBindingAttr(el, 'key');
if (exp) { if (exp) {
if (process.env.NODE_ENV !== 'production') { {
if (el.tag === 'template') { if (el.tag === 'template') {
warn$1("<template> cannot be keyed. Place the key on real elements instead."); warn$1("<template> cannot be keyed. Place the key on real elements instead.");
} }
@ -3694,7 +3682,7 @@ function processFor (el) {
var res = parseFor(exp); var res = parseFor(exp);
if (res) { if (res) {
extend(el, res); extend(el, res);
} else if (process.env.NODE_ENV !== 'production') { } else {
warn$1( warn$1(
("Invalid v-for expression: " + exp) ("Invalid v-for expression: " + exp)
); );
@ -3749,7 +3737,7 @@ function processIfConditions (el, parent) {
exp: el.elseif, exp: el.elseif,
block: el block: el
}); });
} else if (process.env.NODE_ENV !== 'production') { } else {
warn$1( warn$1(
"v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " + "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
"used on element <" + (el.tag) + "> without corresponding v-if." "used on element <" + (el.tag) + "> without corresponding v-if."
@ -3763,7 +3751,7 @@ function findPrevElement (children) {
if (children[i].type === 1) { if (children[i].type === 1) {
return children[i] return children[i]
} else { } else {
if (process.env.NODE_ENV !== 'production' && children[i].text !== ' ') { if (children[i].text !== ' ') {
warn$1( warn$1(
"text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " + "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
"will be ignored." "will be ignored."
@ -3791,7 +3779,7 @@ function processOnce (el) {
function processSlot (el) { function processSlot (el) {
if (el.tag === 'slot') { if (el.tag === 'slot') {
el.slotName = getBindingAttr(el, 'name'); el.slotName = getBindingAttr(el, 'name');
if (process.env.NODE_ENV !== 'production' && el.key) { if (el.key) {
warn$1( warn$1(
"`key` does not work on <slot> because slots are abstract outlets " + "`key` does not work on <slot> because slots are abstract outlets " +
"and can possibly expand into multiple elements. " + "and can possibly expand into multiple elements. " +
@ -3803,7 +3791,7 @@ function processSlot (el) {
if (el.tag === 'template') { if (el.tag === 'template') {
slotScope = getAndRemoveAttr(el, 'scope'); slotScope = getAndRemoveAttr(el, 'scope');
/* istanbul ignore if */ /* istanbul ignore if */
if (process.env.NODE_ENV !== 'production' && slotScope) { if (slotScope) {
warn$1( warn$1(
"the \"scope\" attribute for scoped slots have been deprecated and " + "the \"scope\" attribute for scoped slots have been deprecated and " +
"replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " + "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
@ -3815,7 +3803,7 @@ function processSlot (el) {
el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope'); el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
} else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) { } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
/* istanbul ignore if */ /* istanbul ignore if */
if (process.env.NODE_ENV !== 'production' && el.attrsMap['v-for']) { if (el.attrsMap['v-for']) {
warn$1( warn$1(
"Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " + "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
"(v-for takes higher priority). Use a wrapper <template> for the " + "(v-for takes higher priority). Use a wrapper <template> for the " +
@ -3866,7 +3854,6 @@ function processAttrs (el) {
value = parseFilters(value); value = parseFilters(value);
isProp = false; isProp = false;
if ( if (
process.env.NODE_ENV !== 'production' &&
value.trim().length === 0 value.trim().length === 0
) { ) {
warn$1( warn$1(
@ -3909,13 +3896,13 @@ function processAttrs (el) {
name = name.slice(0, -(arg.length + 1)); name = name.slice(0, -(arg.length + 1));
} }
addDirective(el, name, rawName, value, arg, modifiers); addDirective(el, name, rawName, value, arg, modifiers);
if (process.env.NODE_ENV !== 'production' && name === 'model') { if (name === 'model') {
checkForAliasModel(el, value); checkForAliasModel(el, value);
} }
} }
} else { } else {
// literal attribute // literal attribute
if (process.env.NODE_ENV !== 'production') { {
var res = parseText(value, delimiters); var res = parseText(value, delimiters);
if (res) { if (res) {
warn$1( warn$1(
@ -3962,7 +3949,6 @@ function makeAttrsMap (attrs) {
var map = {}; var map = {};
for (var i = 0, l = attrs.length; i < l; i++) { for (var i = 0, l = attrs.length; i < l; i++) {
if ( if (
process.env.NODE_ENV !== 'production' &&
map[attrs[i].name] && !isIE && !isEdge map[attrs[i].name] && !isIE && !isEdge
) { ) {
warn$1('duplicate attribute: ' + attrs[i].name); warn$1('duplicate attribute: ' + attrs[i].name);
@ -4116,7 +4102,7 @@ function model$2 (
var tag = el.tag; var tag = el.tag;
var type = el.attrsMap.type; var type = el.attrsMap.type;
if (process.env.NODE_ENV !== 'production') { {
// inputs with type="file" are read only and setting the input's // inputs with type="file" are read only and setting the input's
// value will throw an error. // value will throw an error.
if (tag === 'input' && type === 'file') { if (tag === 'input' && type === 'file') {
@ -4218,7 +4204,7 @@ function genDefaultModel (
// warn if v-bind:value conflicts with v-model // warn if v-bind:value conflicts with v-model
// except for inputs with v-bind:type // except for inputs with v-bind:type
if (process.env.NODE_ENV !== 'production') { {
var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value']; var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type']; var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
if (value$1 && !typeBinding) { if (value$1 && !typeBinding) {
@ -4445,7 +4431,7 @@ function genFilterCode (key) {
/* */ /* */
function on (el, dir) { function on (el, dir) {
if (process.env.NODE_ENV !== 'production' && dir.modifiers) { if (dir.modifiers) {
warn("v-on without argument does not support modifiers."); warn("v-on without argument does not support modifiers.");
} }
el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); }; el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
@ -4570,7 +4556,7 @@ function genOnce (el, state) {
parent = parent.parent; parent = parent.parent;
} }
if (!key) { if (!key) {
process.env.NODE_ENV !== 'production' && state.warn( state.warn(
"v-once can only be used inside v-for that is keyed. " "v-once can only be used inside v-for that is keyed. "
); );
return genElement(el, state) return genElement(el, state)
@ -4629,8 +4615,7 @@ function genFor (
var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : ''; var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : ''; var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
if (process.env.NODE_ENV !== 'production' && if (state.maybeComponent(el) &&
state.maybeComponent(el) &&
el.tag !== 'slot' && el.tag !== 'slot' &&
el.tag !== 'template' && el.tag !== 'template' &&
!el.key !el.key
@ -4755,9 +4740,7 @@ function genDirectives (el, state) {
function genInlineTemplate (el, state) { function genInlineTemplate (el, state) {
var ast = el.children[0]; var ast = el.children[0];
if (process.env.NODE_ENV !== 'production' && ( if (el.children.length !== 1 || ast.type !== 1) {
el.children.length !== 1 || ast.type !== 1
)) {
state.warn('Inline-template components must have exactly one child element.'); state.warn('Inline-template components must have exactly one child element.');
} }
if (ast.type === 1) { if (ast.type === 1) {
@ -5536,7 +5519,7 @@ function createCompileToFunctionFn (compile) {
delete options.warn; delete options.warn;
/* istanbul ignore if */ /* istanbul ignore if */
if (process.env.NODE_ENV !== 'production') { {
// detect possible CSP restriction // detect possible CSP restriction
try { try {
new Function('return 1'); new Function('return 1');
@ -5565,7 +5548,7 @@ function createCompileToFunctionFn (compile) {
var compiled = compile(template, options); var compiled = compile(template, options);
// check compilation errors/tips // check compilation errors/tips
if (process.env.NODE_ENV !== 'production') { {
if (compiled.errors && compiled.errors.length) { if (compiled.errors && compiled.errors.length) {
warn$$1( warn$$1(
"Error compiling template:\n\n" + template + "\n\n" + "Error compiling template:\n\n" + template + "\n\n" +
@ -5590,7 +5573,7 @@ function createCompileToFunctionFn (compile) {
// this should only happen if there is a bug in the compiler itself. // this should only happen if there is a bug in the compiler itself.
// mostly for codegen development use // mostly for codegen development use
/* istanbul ignore if */ /* istanbul ignore if */
if (process.env.NODE_ENV !== 'production') { {
if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) { if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
warn$$1( warn$$1(
"Failed to generate render function:\n\n" + "Failed to generate render function:\n\n" +
@ -5646,7 +5629,7 @@ function createCompilerCreator (baseCompile) {
} }
var compiled = baseCompile(template, finalOptions); var compiled = baseCompile(template, finalOptions);
if (process.env.NODE_ENV !== 'production') { {
errors.push.apply(errors, detectErrors(compiled.ast)); errors.push.apply(errors, detectErrors(compiled.ast));
} }
compiled.errors = errors; compiled.errors = errors;
@ -5895,7 +5878,7 @@ function renderSSRStyle (
/* not type checking this file because flow doesn't play well with Proxy */ /* not type checking this file because flow doesn't play well with Proxy */
if (process.env.NODE_ENV !== 'production') { {
var allowedGlobals = makeMap( var allowedGlobals = makeMap(
'Infinity,undefined,NaN,isFinite,isNaN,' + 'Infinity,undefined,NaN,isFinite,isNaN,' +
'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' + 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
@ -5959,7 +5942,7 @@ function _traverse (val, seen) {
} }
} }
if (process.env.NODE_ENV !== 'production') { {
var perf = inBrowser && window.performance; var perf = inBrowser && window.performance;
/* istanbul ignore if */ /* istanbul ignore if */
if ( if (
@ -6021,7 +6004,7 @@ function updateListeners (
old = oldOn[name]; old = oldOn[name];
event = normalizeEvent(name); event = normalizeEvent(name);
if (isUndef(cur)) { if (isUndef(cur)) {
process.env.NODE_ENV !== 'production' && warn( warn(
"Invalid handler for event \"" + (event.name) + "\": got " + String(cur), "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
vm vm
); );
@ -6068,7 +6051,7 @@ function extractPropsFromVNodeData (
if (isDef(attrs) || isDef(props)) { if (isDef(attrs) || isDef(props)) {
for (var key in propOptions) { for (var key in propOptions) {
var altKey = hyphenate(key); var altKey = hyphenate(key);
if (process.env.NODE_ENV !== 'production') { {
var keyInLowerCase = key.toLowerCase(); var keyInLowerCase = key.toLowerCase();
if ( if (
key !== keyInLowerCase && key !== keyInLowerCase &&
@ -6188,7 +6171,7 @@ function resolveAsyncComponent (
}); });
var reject = once(function (reason) { var reject = once(function (reason) {
process.env.NODE_ENV !== 'production' && warn( warn(
"Failed to resolve async component: " + (String(factory)) + "Failed to resolve async component: " + (String(factory)) +
(reason ? ("\nReason: " + reason) : '') (reason ? ("\nReason: " + reason) : '')
); );
@ -6231,9 +6214,7 @@ function resolveAsyncComponent (
setTimeout(function () { setTimeout(function () {
if (isUndef(factory.resolved)) { if (isUndef(factory.resolved)) {
reject( reject(
process.env.NODE_ENV !== 'production' "timeout (" + (res.timeout) + "ms)"
? ("timeout (" + (res.timeout) + "ms)")
: null
); );
} }
}, res.timeout); }, res.timeout);
@ -6364,7 +6345,6 @@ function updateChildComponent (
parentVnode, parentVnode,
renderChildren renderChildren
) { ) {
if (process.env.NODE_ENV !== 'production') ;
// determine whether component has slot children // determine whether component has slot children
// we need to do this before overwriting $options._renderChildren // we need to do this before overwriting $options._renderChildren
@ -6415,8 +6395,6 @@ function updateChildComponent (
vm.$slots = resolveSlots(renderChildren, parentVnode.context); vm.$slots = resolveSlots(renderChildren, parentVnode.context);
vm.$forceUpdate(); vm.$forceUpdate();
} }
if (process.env.NODE_ENV !== 'production') ;
} }
function isInInactiveTree (vm) { function isInInactiveTree (vm) {
@ -6529,7 +6507,7 @@ function _createElement (
normalizationType normalizationType
) { ) {
if (isDef(data) && isDef((data).__ob__)) { if (isDef(data) && isDef((data).__ob__)) {
process.env.NODE_ENV !== 'production' && warn( warn(
"Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" + "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
'Always create fresh vnode data objects in each render!', 'Always create fresh vnode data objects in each render!',
context context
@ -6545,8 +6523,7 @@ function _createElement (
return createEmptyVNode() return createEmptyVNode()
} }
// warn against non-primitive key // warn against non-primitive key
if (process.env.NODE_ENV !== 'production' && if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
isDef(data) && isDef(data.key) && !isPrimitive(data.key)
) { ) {
{ {
warn( warn(
@ -6681,7 +6658,7 @@ function renderSlot (
if (scopedSlotFn) { // scoped slot if (scopedSlotFn) { // scoped slot
props = props || {}; props = props || {};
if (bindObject) { if (bindObject) {
if (process.env.NODE_ENV !== 'production' && !isObject(bindObject)) { if (!isObject(bindObject)) {
warn( warn(
'slot v-bind without argument expects an Object', 'slot v-bind without argument expects an Object',
this this
@ -6757,7 +6734,7 @@ function bindObjectProps (
) { ) {
if (value) { if (value) {
if (!isObject(value)) { if (!isObject(value)) {
process.env.NODE_ENV !== 'production' && warn( warn(
'v-bind without argument expects an Object or Array value', 'v-bind without argument expects an Object or Array value',
this this
); );
@ -6864,7 +6841,7 @@ function markStaticNode (node, key, isOnce) {
function bindObjectListeners (data, value) { function bindObjectListeners (data, value) {
if (value) { if (value) {
if (!isPlainObject(value)) { if (!isPlainObject(value)) {
process.env.NODE_ENV !== 'production' && warn( warn(
'v-on without argument expects an Object value', 'v-on without argument expects an Object value',
this this
); );
@ -6932,7 +6909,7 @@ function resolveInject (inject, vm) {
result[key] = typeof provideDefault === 'function' result[key] = typeof provideDefault === 'function'
? provideDefault.call(vm) ? provideDefault.call(vm)
: provideDefault; : provideDefault;
} else if (process.env.NODE_ENV !== 'production') { } else {
warn(("Injection \"" + key + "\" not found"), vm); warn(("Injection \"" + key + "\" not found"), vm);
} }
} }
@ -7109,7 +7086,7 @@ function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderCo
var clone = cloneVNode(vnode); var clone = cloneVNode(vnode);
clone.fnContext = contextVm; clone.fnContext = contextVm;
clone.fnOptions = options; clone.fnOptions = options;
if (process.env.NODE_ENV !== 'production') { {
(clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext; (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
} }
if (data.slot) { if (data.slot) {
@ -7220,7 +7197,7 @@ function createComponent (
// if at this stage it's not a constructor or an async component factory, // if at this stage it's not a constructor or an async component factory,
// reject. // reject.
if (typeof Ctor !== 'function') { if (typeof Ctor !== 'function') {
if (process.env.NODE_ENV !== 'production') { {
warn(("Invalid Component definition: " + (String(Ctor))), context); warn(("Invalid Component definition: " + (String(Ctor))), context);
} }
return return
@ -8126,9 +8103,7 @@ TemplateRenderer.prototype.renderState = function renderState (context, options)
var contextKey = ref.contextKey; if ( contextKey === void 0 ) contextKey = 'state'; var contextKey = ref.contextKey; if ( contextKey === void 0 ) contextKey = 'state';
var windowKey = ref.windowKey; if ( windowKey === void 0 ) windowKey = '__INITIAL_STATE__'; var windowKey = ref.windowKey; if ( windowKey === void 0 ) windowKey = '__INITIAL_STATE__';
var state = serialize(context[contextKey], { isJSON: true }); var state = serialize(context[contextKey], { isJSON: true });
var autoRemove = process.env.NODE_ENV === 'production' var autoRemove = '';
? ';(function(){var s;(s=document.currentScript||document.scripts[document.scripts.length-1]).parentNode.removeChild(s);}());'
: '';
return context[contextKey] return context[contextKey]
? ("<script>window." + windowKey + "=" + state + autoRemove + "</script>") ? ("<script>window." + windowKey + "=" + state + autoRemove + "</script>")
: '' : ''

1
packages/vue-server-renderer/build.prod.js

File diff suppressed because one or more lines are too long

6
packages/vue-server-renderer/index.js

@ -13,4 +13,8 @@ if (vueVersion && vueVersion !== packageVersion) {
) )
} }
module.exports = require('./build') if (process.env.NODE_ENV === 'production') {
module.exports = require('./build.prod.js')
} else {
module.exports = require('./build.dev.js')
}

3
scripts/build.js

@ -43,12 +43,13 @@ function build (builds) {
function buildEntry (config) { function buildEntry (config) {
const output = config.output const output = config.output
const { file, banner } = output const { file, banner } = output
const isProd = /min\.js$/.test(file) const isProd = /(min|prod)\.js$/.test(file)
return rollup.rollup(config) return rollup.rollup(config)
.then(bundle => bundle.generate(output)) .then(bundle => bundle.generate(output))
.then(({ code }) => { .then(({ code }) => {
if (isProd) { if (isProd) {
const minified = (banner ? banner + '\n' : '') + terser.minify(code, { const minified = (banner ? banner + '\n' : '') + terser.minify(code, {
toplevel: true,
output: { output: {
ascii_only: true ascii_only: true
}, },

37
scripts/config.js

@ -36,17 +36,34 @@ const resolve = p => {
const builds = { const builds = {
// Runtime only (CommonJS). Used by bundlers e.g. Webpack & Browserify // Runtime only (CommonJS). Used by bundlers e.g. Webpack & Browserify
'web-runtime-cjs': { 'web-runtime-cjs-dev': {
entry: resolve('web/entry-runtime.js'), entry: resolve('web/entry-runtime.js'),
dest: resolve('dist/vue.runtime.common.js'), dest: resolve('dist/vue.runtime.common.dev.js'),
format: 'cjs', format: 'cjs',
env: 'development',
banner
},
'web-runtime-cjs-prod': {
entry: resolve('web/entry-runtime.js'),
dest: resolve('dist/vue.runtime.common.prod.js'),
format: 'cjs',
env: 'production',
banner banner
}, },
// Runtime+compiler CommonJS build (CommonJS) // Runtime+compiler CommonJS build (CommonJS)
'web-full-cjs': { 'web-full-cjs-dev': {
entry: resolve('web/entry-runtime-with-compiler.js'), entry: resolve('web/entry-runtime-with-compiler.js'),
dest: resolve('dist/vue.common.js'), dest: resolve('dist/vue.common.dev.js'),
format: 'cjs', format: 'cjs',
env: 'development',
alias: { he: './entity-decoder' },
banner
},
'web-full-cjs-prod': {
entry: resolve('web/entry-runtime-with-compiler.js'),
dest: resolve('dist/vue.common.prod.js'),
format: 'cjs',
env: 'production',
alias: { he: './entity-decoder' }, alias: { he: './entity-decoder' },
banner banner
}, },
@ -117,10 +134,18 @@ const builds = {
plugins: [node(), cjs()] plugins: [node(), cjs()]
}, },
// Web server renderer (CommonJS). // Web server renderer (CommonJS).
'web-server-renderer': { 'web-server-renderer-dev': {
entry: resolve('web/entry-server-renderer.js'), entry: resolve('web/entry-server-renderer.js'),
dest: resolve('packages/vue-server-renderer/build.js'), dest: resolve('packages/vue-server-renderer/build.dev.js'),
format: 'cjs', format: 'cjs',
env: 'development',
external: Object.keys(require('../packages/vue-server-renderer/package.json').dependencies)
},
'web-server-renderer-prod': {
entry: resolve('web/entry-server-renderer.js'),
dest: resolve('packages/vue-server-renderer/build.prod.js'),
format: 'cjs',
env: 'production',
external: Object.keys(require('../packages/vue-server-renderer/package.json').dependencies) external: Object.keys(require('../packages/vue-server-renderer/package.json').dependencies)
}, },
'web-server-renderer-basic': { 'web-server-renderer-basic': {

Loading…
Cancel
Save