2013-01-31 01:49:25 +08:00
|
|
|
/*
|
|
|
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
|
|
Author Tobias Koppers @sokra
|
|
|
|
*/
|
|
|
|
var RequestShortener = require("./RequestShortener");
|
|
|
|
|
|
|
|
function Stats(compilation) {
|
|
|
|
this.compilation = compilation;
|
2014-06-12 04:26:50 +08:00
|
|
|
this.hash = compilation.hash;
|
2013-01-31 01:49:25 +08:00
|
|
|
}
|
|
|
|
module.exports = Stats;
|
|
|
|
|
|
|
|
Stats.prototype.hasWarnings = function() {
|
|
|
|
return this.compilation.warnings.length > 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
Stats.prototype.hasErrors = function() {
|
|
|
|
return this.compilation.errors.length > 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
Stats.prototype.toJson = function toJson(options, forToString) {
|
2015-08-03 17:01:29 +08:00
|
|
|
if(typeof options === "boolean" || typeof options === "string") {
|
|
|
|
options = Stats.presetToOptions(options);
|
|
|
|
} else if(!options) {
|
|
|
|
options = {};
|
|
|
|
}
|
2015-07-13 06:20:09 +08:00
|
|
|
|
|
|
|
function d(v, def) {
|
|
|
|
return v === undefined ? def : v;
|
|
|
|
}
|
2013-01-31 01:49:25 +08:00
|
|
|
var compilation = this.compilation;
|
|
|
|
var requestShortener = new RequestShortener(d(options.context, process.cwd()));
|
|
|
|
var showHash = d(options.hash, true);
|
2014-08-01 21:19:15 +08:00
|
|
|
var showVersion = d(options.version, true);
|
2013-01-31 01:49:25 +08:00
|
|
|
var showTimings = d(options.timings, true);
|
|
|
|
var showAssets = d(options.assets, true);
|
|
|
|
var showChunks = d(options.chunks, true);
|
|
|
|
var showChunkModules = d(options.chunkModules, !!forToString);
|
2014-01-23 22:31:40 +08:00
|
|
|
var showChunkOrigins = d(options.chunkOrigins, !forToString);
|
2013-01-31 01:49:25 +08:00
|
|
|
var showModules = d(options.modules, !forToString);
|
|
|
|
var showCachedModules = d(options.cached, true);
|
2014-08-28 17:04:48 +08:00
|
|
|
var showCachedAssets = d(options.cachedAssets, true);
|
2013-01-31 01:49:25 +08:00
|
|
|
var showReasons = d(options.reasons, !forToString);
|
2016-06-29 07:17:15 +08:00
|
|
|
var showUsedExports = d(options.usedExports, !forToString);
|
2013-01-31 01:49:25 +08:00
|
|
|
var showChildren = d(options.children, true);
|
2013-02-19 18:11:43 +08:00
|
|
|
var showSource = d(options.source, !forToString);
|
2015-08-03 17:01:29 +08:00
|
|
|
var showErrors = d(options.errors, true);
|
2014-01-21 23:24:17 +08:00
|
|
|
var showErrorDetails = d(options.errorDetails, !forToString);
|
2015-08-03 17:01:29 +08:00
|
|
|
var showWarnings = d(options.warnings, true);
|
2015-04-17 16:17:10 +08:00
|
|
|
var showPublicPath = d(options.publicPath, !forToString);
|
2014-09-15 17:46:33 +08:00
|
|
|
var excludeModules = [].concat(d(options.exclude, [])).map(function(str) {
|
|
|
|
if(typeof str !== "string") return str;
|
|
|
|
return new RegExp("[\\\\/]" + str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&") + "([\\\\/]|$|!|\\?)");
|
|
|
|
});
|
2013-01-31 01:49:25 +08:00
|
|
|
var sortModules = d(options.modulesSort, "id");
|
|
|
|
var sortChunks = d(options.chunksSort, "id");
|
|
|
|
var sortAssets = d(options.assetsSort, "");
|
2015-01-18 04:55:44 +08:00
|
|
|
|
2014-09-15 17:46:33 +08:00
|
|
|
function moduleFilter(module) {
|
|
|
|
if(!showCachedModules && !module.built) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if(excludeModules.length === 0)
|
|
|
|
return true;
|
|
|
|
var ident = module.identifier();
|
|
|
|
return !excludeModules.some(function(regExp) {
|
|
|
|
return regExp.test(ident);
|
|
|
|
});
|
|
|
|
}
|
2013-01-31 01:49:25 +08:00
|
|
|
|
|
|
|
function sortByField(field) {
|
2015-07-16 06:19:23 +08:00
|
|
|
if(!field) return function() {
|
2015-07-13 06:20:09 +08:00
|
|
|
return 0;
|
|
|
|
};
|
2014-06-25 00:53:32 +08:00
|
|
|
if(field[0] === "!") {
|
2013-01-31 01:49:25 +08:00
|
|
|
field = field.substr(1);
|
|
|
|
return function(a, b) {
|
2014-06-25 00:53:32 +08:00
|
|
|
if(a[field] === b[field]) return 0;
|
2015-07-16 06:39:56 +08:00
|
|
|
return a[field] < b[field] ? 1 : -1;
|
2015-04-24 05:55:50 +08:00
|
|
|
};
|
2013-01-31 01:49:25 +08:00
|
|
|
}
|
|
|
|
return function(a, b) {
|
2014-06-25 00:53:32 +08:00
|
|
|
if(a[field] === b[field]) return 0;
|
2015-07-16 06:39:56 +08:00
|
|
|
return a[field] < b[field] ? -1 : 1;
|
2015-04-24 05:55:50 +08:00
|
|
|
};
|
2013-01-31 01:49:25 +08:00
|
|
|
}
|
2015-07-13 06:20:09 +08:00
|
|
|
|
2013-01-31 01:49:25 +08:00
|
|
|
function formatError(e) {
|
|
|
|
var text = "";
|
2015-06-06 01:35:54 +08:00
|
|
|
if(typeof e === "string")
|
2015-07-13 06:20:09 +08:00
|
|
|
e = {
|
|
|
|
message: e
|
|
|
|
};
|
2015-06-27 17:34:17 +08:00
|
|
|
if(e.chunk) {
|
|
|
|
text += "chunk " + (e.chunk.name || e.chunk.id) +
|
|
|
|
(e.chunk.entry ? " [entry]" : e.chunk.initial ? " [initial]" : "") + "\n";
|
|
|
|
}
|
|
|
|
if(e.file) {
|
|
|
|
text += e.file + "\n";
|
|
|
|
}
|
2013-02-04 19:33:36 +08:00
|
|
|
if(e.module && e.module.readableIdentifier && typeof e.module.readableIdentifier === "function") {
|
|
|
|
text += e.module.readableIdentifier(requestShortener) + "\n";
|
2013-01-31 01:49:25 +08:00
|
|
|
}
|
|
|
|
text += e.message;
|
2014-01-21 23:24:17 +08:00
|
|
|
if(showErrorDetails && e.details) text += "\n" + e.details;
|
2015-01-18 04:55:44 +08:00
|
|
|
if(showErrorDetails && e.missing) text += e.missing.map(function(item) {
|
|
|
|
return "\n[" + item + "]";
|
|
|
|
}).join("");
|
2013-01-31 01:49:25 +08:00
|
|
|
if(e.dependencies && e.origin) {
|
|
|
|
text += "\n @ " + e.origin.readableIdentifier(requestShortener);
|
|
|
|
e.dependencies.forEach(function(dep) {
|
|
|
|
if(!dep.loc) return;
|
2015-05-11 00:31:58 +08:00
|
|
|
if(typeof dep.loc === "string") return;
|
2013-01-31 01:49:25 +08:00
|
|
|
if(!dep.loc.start) return;
|
|
|
|
if(!dep.loc.end) return;
|
2014-08-01 21:19:15 +08:00
|
|
|
text += " " + dep.loc.start.line + ":" + dep.loc.start.column + "-" +
|
2014-06-25 00:53:32 +08:00
|
|
|
(dep.loc.start.line !== dep.loc.end.line ? dep.loc.end.line + ":" : "") + dep.loc.end.column;
|
2013-01-31 01:49:25 +08:00
|
|
|
});
|
2016-07-03 19:13:01 +08:00
|
|
|
var current = e.origin;
|
|
|
|
while(current.issuer) {
|
|
|
|
current = current.issuer;
|
|
|
|
text += "\n @ " + current.readableIdentifier(requestShortener);
|
|
|
|
}
|
2013-01-31 01:49:25 +08:00
|
|
|
}
|
|
|
|
return text;
|
|
|
|
}
|
2015-08-03 17:46:29 +08:00
|
|
|
|
2013-01-31 01:49:25 +08:00
|
|
|
var obj = {
|
|
|
|
errors: compilation.errors.map(formatError),
|
|
|
|
warnings: compilation.warnings.map(formatError)
|
|
|
|
};
|
|
|
|
|
2015-08-03 18:15:08 +08:00
|
|
|
//We just hint other renderers since actually omitting
|
|
|
|
//errors/warnings from the JSON would be kind of weird.
|
2015-08-03 17:26:46 +08:00
|
|
|
Object.defineProperty(obj, "_showWarnings", {
|
|
|
|
value: showWarnings,
|
|
|
|
enumerable: false
|
|
|
|
});
|
|
|
|
Object.defineProperty(obj, "_showErrors", {
|
|
|
|
value: showErrors,
|
|
|
|
enumerable: false
|
|
|
|
});
|
2015-08-03 17:01:29 +08:00
|
|
|
|
2014-08-01 21:19:15 +08:00
|
|
|
if(showVersion) {
|
|
|
|
obj.version = require("../package.json").version;
|
|
|
|
}
|
|
|
|
|
2014-06-12 04:26:50 +08:00
|
|
|
if(showHash) obj.hash = this.hash;
|
2013-01-31 01:49:25 +08:00
|
|
|
if(showTimings && this.startTime && this.endTime) {
|
|
|
|
obj.time = this.endTime - this.startTime;
|
|
|
|
}
|
2015-01-30 07:46:52 +08:00
|
|
|
if(compilation.needAdditionalPass) {
|
2015-04-21 03:08:42 +08:00
|
|
|
obj.needAdditionalPass = true;
|
|
|
|
}
|
2015-04-17 16:17:10 +08:00
|
|
|
if(showPublicPath) {
|
|
|
|
obj.publicPath = this.compilation.mainTemplate.getPublicPath({
|
2015-04-21 02:31:24 +08:00
|
|
|
hash: this.compilation.hash
|
2015-04-17 16:17:10 +08:00
|
|
|
});
|
2015-01-30 07:46:52 +08:00
|
|
|
}
|
2013-01-31 01:49:25 +08:00
|
|
|
if(showAssets) {
|
|
|
|
var assetsByFile = {};
|
2014-03-31 14:46:04 +08:00
|
|
|
obj.assetsByChunkName = {};
|
2013-01-31 01:49:25 +08:00
|
|
|
obj.assets = Object.keys(compilation.assets).map(function(asset) {
|
|
|
|
var obj = {
|
|
|
|
name: asset,
|
|
|
|
size: compilation.assets[asset].size(),
|
|
|
|
chunks: [],
|
2013-05-08 19:28:54 +08:00
|
|
|
chunkNames: [],
|
|
|
|
emitted: compilation.assets[asset].emitted
|
2013-01-31 01:49:25 +08:00
|
|
|
};
|
|
|
|
assetsByFile[asset] = obj;
|
|
|
|
return obj;
|
2014-08-28 17:04:48 +08:00
|
|
|
}).filter(function(asset) {
|
|
|
|
return showCachedAssets || asset.emitted;
|
2013-01-31 01:49:25 +08:00
|
|
|
});
|
|
|
|
compilation.chunks.forEach(function(chunk) {
|
|
|
|
chunk.files.forEach(function(asset) {
|
|
|
|
if(assetsByFile[asset]) {
|
2013-02-24 09:05:55 +08:00
|
|
|
chunk.ids.forEach(function(id) {
|
|
|
|
assetsByFile[asset].chunks.push(id);
|
|
|
|
});
|
2014-03-31 14:46:04 +08:00
|
|
|
if(chunk.name) {
|
2013-01-31 01:49:25 +08:00
|
|
|
assetsByFile[asset].chunkNames.push(chunk.name);
|
2014-07-09 19:37:06 +08:00
|
|
|
if(obj.assetsByChunkName[chunk.name])
|
|
|
|
obj.assetsByChunkName[chunk.name] = [].concat(obj.assetsByChunkName[chunk.name]).concat([asset]);
|
|
|
|
else
|
|
|
|
obj.assetsByChunkName[chunk.name] = asset;
|
2014-03-31 14:46:04 +08:00
|
|
|
}
|
2013-01-31 01:49:25 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
obj.assets.sort(sortByField(sortAssets));
|
|
|
|
}
|
2015-07-13 06:20:09 +08:00
|
|
|
|
2013-01-31 01:49:25 +08:00
|
|
|
function fnModule(module) {
|
|
|
|
var obj = {
|
|
|
|
id: module.id,
|
|
|
|
identifier: module.identifier(),
|
|
|
|
name: module.readableIdentifier(requestShortener),
|
2015-08-06 19:22:46 +08:00
|
|
|
index: module.index,
|
|
|
|
index2: module.index2,
|
2013-01-31 01:49:25 +08:00
|
|
|
size: module.size(),
|
|
|
|
cacheable: !!module.cacheable,
|
|
|
|
built: !!module.built,
|
2014-07-03 06:00:06 +08:00
|
|
|
optional: !!module.optional,
|
2013-05-13 19:34:00 +08:00
|
|
|
prefetched: !!module.prefetched,
|
2013-01-31 01:49:25 +08:00
|
|
|
chunks: module.chunks.map(function(chunk) {
|
|
|
|
return chunk.id;
|
2013-05-08 20:47:13 +08:00
|
|
|
}),
|
2014-05-21 23:37:46 +08:00
|
|
|
assets: Object.keys(module.assets || {}),
|
2016-07-03 19:13:01 +08:00
|
|
|
issuer: module.issuer && module.issuer.identifier(),
|
|
|
|
issuerId: module.issuer && module.issuer.id,
|
|
|
|
issuerName: module.issuer && module.issuer.readableIdentifier(requestShortener),
|
2013-05-18 20:42:11 +08:00
|
|
|
profile: module.profile,
|
|
|
|
failed: !!module.error,
|
|
|
|
errors: module.errors && module.dependenciesErrors && (module.errors.length + module.dependenciesErrors.length),
|
|
|
|
warnings: module.errors && module.dependenciesErrors && (module.warnings.length + module.dependenciesWarnings.length)
|
2013-01-31 01:49:25 +08:00
|
|
|
};
|
|
|
|
if(showReasons) {
|
|
|
|
obj.reasons = module.reasons.filter(function(reason) {
|
2013-05-21 07:47:22 +08:00
|
|
|
return reason.dependency && reason.module;
|
2013-01-31 01:49:25 +08:00
|
|
|
}).map(function(reason) {
|
|
|
|
var obj = {
|
|
|
|
moduleId: reason.module.id,
|
2014-02-24 22:07:15 +08:00
|
|
|
moduleIdentifier: reason.module.identifier(),
|
2013-01-31 01:49:25 +08:00
|
|
|
module: reason.module.readableIdentifier(requestShortener),
|
2014-02-24 22:07:15 +08:00
|
|
|
moduleName: reason.module.readableIdentifier(requestShortener),
|
2013-01-31 01:49:25 +08:00
|
|
|
type: reason.dependency.type,
|
|
|
|
userRequest: reason.dependency.userRequest
|
2015-04-24 05:55:50 +08:00
|
|
|
};
|
2013-01-31 01:49:25 +08:00
|
|
|
var dep = reason.dependency;
|
2015-07-16 06:19:23 +08:00
|
|
|
if(dep.templateModules) obj.templateModules = dep.templateModules.map(function(module) {
|
2015-07-13 06:20:09 +08:00
|
|
|
return module.id;
|
|
|
|
});
|
2015-05-11 00:31:58 +08:00
|
|
|
if(typeof dep.loc === "object") obj.loc = dep.loc.start.line + ":" + dep.loc.start.column + "-" +
|
2015-04-24 05:55:50 +08:00
|
|
|
(dep.loc.start.line !== dep.loc.end.line ? dep.loc.end.line + ":" : "") + dep.loc.end.column;
|
2013-01-31 01:49:25 +08:00
|
|
|
return obj;
|
2013-10-31 07:38:10 +08:00
|
|
|
}).sort(function(a, b) {
|
|
|
|
return a.moduleId - b.moduleId;
|
2013-01-31 01:49:25 +08:00
|
|
|
});
|
|
|
|
}
|
2016-06-29 07:17:15 +08:00
|
|
|
if(showUsedExports) {
|
|
|
|
obj.usedExports = module.used ? module.usedExports : false;
|
|
|
|
}
|
2013-02-19 18:11:43 +08:00
|
|
|
if(showSource && module._source) {
|
|
|
|
obj.source = module._source.source();
|
|
|
|
}
|
2013-01-31 01:49:25 +08:00
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
if(showChunks) {
|
|
|
|
obj.chunks = compilation.chunks.map(function(chunk) {
|
|
|
|
var obj = {
|
|
|
|
id: chunk.id,
|
2013-05-08 19:28:54 +08:00
|
|
|
rendered: chunk.rendered,
|
2014-02-24 22:07:15 +08:00
|
|
|
initial: !!chunk.initial,
|
|
|
|
entry: !!chunk.entry,
|
2015-01-12 06:15:11 +08:00
|
|
|
extraAsync: !!chunk.extraAsync,
|
2015-07-13 06:20:09 +08:00
|
|
|
size: chunk.modules.reduce(function(size, module) {
|
|
|
|
return size + module.size();
|
|
|
|
}, 0),
|
2013-01-31 01:49:25 +08:00
|
|
|
names: chunk.name ? [chunk.name] : [],
|
|
|
|
files: chunk.files.slice(),
|
2014-12-31 20:42:05 +08:00
|
|
|
hash: chunk.renderedHash,
|
2013-01-31 01:49:25 +08:00
|
|
|
parents: chunk.parents.map(function(c) {
|
|
|
|
return c.id;
|
|
|
|
})
|
|
|
|
};
|
|
|
|
if(showChunkModules) {
|
2014-09-15 17:46:33 +08:00
|
|
|
obj.modules = chunk.modules.filter(moduleFilter).map(fnModule);
|
|
|
|
obj.filteredModules = chunk.modules.length - obj.modules.length;
|
2013-01-31 01:49:25 +08:00
|
|
|
obj.modules.sort(sortByField(sortModules));
|
|
|
|
}
|
2014-01-23 22:31:40 +08:00
|
|
|
if(showChunkOrigins) {
|
|
|
|
obj.origins = chunk.origins.map(function(origin) {
|
|
|
|
return {
|
2014-02-11 15:32:18 +08:00
|
|
|
moduleId: origin.module ? origin.module.id : undefined,
|
2014-01-23 22:31:40 +08:00
|
|
|
module: origin.module ? origin.module.identifier() : "",
|
2014-02-24 22:07:15 +08:00
|
|
|
moduleIdentifier: origin.module ? origin.module.identifier() : "",
|
|
|
|
moduleName: origin.module ? origin.module.readableIdentifier(requestShortener) : "",
|
2015-05-11 00:31:58 +08:00
|
|
|
loc: typeof origin.loc === "object" ? obj.loc = origin.loc.start.line + ":" + origin.loc.start.column + "-" +
|
2014-06-25 00:53:32 +08:00
|
|
|
(origin.loc.start.line !== origin.loc.end.line ? origin.loc.end.line + ":" : "") + origin.loc.end.column : "",
|
2014-01-23 22:31:40 +08:00
|
|
|
name: origin.name,
|
|
|
|
reasons: origin.reasons || []
|
2015-04-24 05:55:50 +08:00
|
|
|
};
|
2014-01-23 22:31:40 +08:00
|
|
|
});
|
|
|
|
}
|
2013-01-31 01:49:25 +08:00
|
|
|
return obj;
|
|
|
|
});
|
|
|
|
obj.chunks.sort(sortByField(sortChunks));
|
|
|
|
}
|
|
|
|
if(showModules) {
|
2014-09-15 17:46:33 +08:00
|
|
|
obj.modules = compilation.modules.filter(moduleFilter).map(fnModule);
|
|
|
|
obj.filteredModules = compilation.modules.length - obj.modules.length;
|
2013-01-31 01:49:25 +08:00
|
|
|
obj.modules.sort(sortByField(sortModules));
|
|
|
|
}
|
|
|
|
if(showChildren) {
|
|
|
|
obj.children = compilation.children.map(function(child) {
|
2013-02-04 20:22:45 +08:00
|
|
|
var obj = new Stats(child).toJson(options, forToString);
|
2014-07-23 20:41:54 +08:00
|
|
|
delete obj.hash;
|
|
|
|
delete obj.version;
|
2013-01-31 01:49:25 +08:00
|
|
|
obj.name = child.name;
|
|
|
|
return obj;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return obj;
|
|
|
|
};
|
|
|
|
|
|
|
|
Stats.prototype.toString = function toString(options) {
|
2015-08-03 17:01:29 +08:00
|
|
|
if(typeof options === "boolean" || typeof options === "string") {
|
|
|
|
options = Stats.presetToOptions(options);
|
|
|
|
} else if(!options) options = {};
|
2015-07-13 06:20:09 +08:00
|
|
|
|
|
|
|
function d(v, def) {
|
|
|
|
return v === undefined ? def : v;
|
|
|
|
}
|
2013-01-31 01:49:25 +08:00
|
|
|
var useColors = d(options.colors, false);
|
|
|
|
|
|
|
|
var obj = this.toJson(options, true);
|
|
|
|
|
|
|
|
return Stats.jsonToString(obj, useColors);
|
|
|
|
};
|
|
|
|
|
|
|
|
Stats.jsonToString = function jsonToString(obj, useColors) {
|
|
|
|
var buf = [];
|
2015-07-13 06:20:09 +08:00
|
|
|
|
2015-11-09 18:33:32 +08:00
|
|
|
var defaultColors = {
|
|
|
|
bold: "\u001b[1m",
|
|
|
|
yellow: "\u001b[1m\u001b[33m",
|
|
|
|
red: "\u001b[1m\u001b[31m",
|
|
|
|
green: "\u001b[1m\u001b[32m",
|
|
|
|
cyan: "\u001b[1m\u001b[36m",
|
|
|
|
magenta: "\u001b[1m\u001b[35m"
|
|
|
|
};
|
2015-07-13 06:20:09 +08:00
|
|
|
|
2015-11-09 18:33:32 +08:00
|
|
|
var colors = Object.keys(defaultColors).reduce(function(obj, color) {
|
|
|
|
obj[color] = function(str) {
|
|
|
|
if(useColors) {
|
|
|
|
buf.push(
|
|
|
|
(useColors === true || useColors[color] === undefined) ?
|
|
|
|
defaultColors[color] : useColors[color]
|
|
|
|
);
|
|
|
|
}
|
|
|
|
buf.push(str);
|
|
|
|
if(useColors) {
|
|
|
|
buf.push("\u001b[39m\u001b[22m");
|
|
|
|
}
|
|
|
|
};
|
|
|
|
return obj;
|
2015-11-14 06:05:20 +08:00
|
|
|
}, {
|
|
|
|
normal: function(str) {
|
|
|
|
buf.push(str);
|
|
|
|
}
|
|
|
|
});
|
2015-07-13 06:20:09 +08:00
|
|
|
|
2013-05-08 20:47:13 +08:00
|
|
|
function coloredTime(time) {
|
|
|
|
var times = [800, 400, 200, 100];
|
|
|
|
if(obj.time) {
|
2015-04-24 05:55:50 +08:00
|
|
|
times = [obj.time / 2, obj.time / 4, obj.time / 8, obj.time / 16];
|
2013-05-08 20:47:13 +08:00
|
|
|
}
|
|
|
|
if(time < times[3])
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.normal(time + "ms");
|
2013-05-08 20:47:13 +08:00
|
|
|
else if(time < times[2])
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.bold(time + "ms");
|
2013-05-08 20:47:13 +08:00
|
|
|
else if(time < times[1])
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.green(time + "ms");
|
2013-05-08 20:47:13 +08:00
|
|
|
else if(time < times[0])
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.yellow(time + "ms");
|
2013-05-08 20:47:13 +08:00
|
|
|
else
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.red(time + "ms");
|
2013-05-08 20:47:13 +08:00
|
|
|
}
|
2015-07-13 06:20:09 +08:00
|
|
|
|
2013-01-31 01:49:25 +08:00
|
|
|
function newline() {
|
|
|
|
buf.push("\n");
|
|
|
|
}
|
2015-07-13 06:20:09 +08:00
|
|
|
|
2013-01-31 01:49:25 +08:00
|
|
|
function table(array, formats, align, splitter) {
|
2016-01-19 08:52:28 +08:00
|
|
|
var row;
|
2013-01-31 01:49:25 +08:00
|
|
|
var rows = array.length;
|
2016-01-19 08:52:28 +08:00
|
|
|
var col;
|
2013-01-31 01:49:25 +08:00
|
|
|
var cols = array[0].length;
|
|
|
|
var colSizes = new Array(cols);
|
2016-01-19 08:52:28 +08:00
|
|
|
var value;
|
|
|
|
for(col = 0; col < cols; col++)
|
2013-01-31 01:49:25 +08:00
|
|
|
colSizes[col] = 3;
|
2016-01-19 08:52:28 +08:00
|
|
|
for(row = 0; row < rows; row++) {
|
|
|
|
for(col = 0; col < cols; col++) {
|
|
|
|
value = array[row][col] + "";
|
2013-01-31 01:49:25 +08:00
|
|
|
if(value.length > colSizes[col]) {
|
|
|
|
colSizes[col] = value.length;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-01-19 08:52:28 +08:00
|
|
|
for(row = 0; row < rows; row++) {
|
|
|
|
for(col = 0; col < cols; col++) {
|
2015-11-09 18:33:32 +08:00
|
|
|
var format = row === 0 ? colors.bold : formats[col];
|
2016-01-19 08:52:28 +08:00
|
|
|
value = array[row][col] + "";
|
2013-01-31 01:49:25 +08:00
|
|
|
var l = value.length;
|
2014-06-25 00:53:32 +08:00
|
|
|
if(align[col] === "l")
|
2013-01-31 01:49:25 +08:00
|
|
|
format(value);
|
2015-04-24 05:55:50 +08:00
|
|
|
for(; l < colSizes[col] && col !== cols - 1; l++)
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.normal(" ");
|
2014-06-25 00:53:32 +08:00
|
|
|
if(align[col] === "r")
|
2013-01-31 01:49:25 +08:00
|
|
|
format(value);
|
|
|
|
if(col + 1 < cols)
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.normal(splitter || " ");
|
2013-01-31 01:49:25 +08:00
|
|
|
}
|
|
|
|
newline();
|
|
|
|
}
|
|
|
|
}
|
2015-07-13 06:20:09 +08:00
|
|
|
|
2015-03-04 13:18:44 +08:00
|
|
|
function formatSize(size) {
|
|
|
|
if(size <= 0) return "0 bytes";
|
|
|
|
|
|
|
|
var abbreviations = ["bytes", "kB", "MB", "GB"];
|
|
|
|
var index = Math.floor(Math.log(size) / Math.log(1000));
|
|
|
|
|
|
|
|
return +(size / Math.pow(1000, index))
|
2015-04-24 05:55:50 +08:00
|
|
|
.toPrecision(3) + " " + abbreviations[index];
|
2015-03-04 13:18:44 +08:00
|
|
|
}
|
2013-01-31 01:49:25 +08:00
|
|
|
|
|
|
|
if(obj.hash) {
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.normal("Hash: ");
|
|
|
|
colors.bold(obj.hash);
|
2013-01-31 01:49:25 +08:00
|
|
|
newline();
|
|
|
|
}
|
2013-03-26 23:54:41 +08:00
|
|
|
if(obj.version) {
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.normal("Version: webpack ");
|
|
|
|
colors.bold(obj.version);
|
2013-03-26 23:54:41 +08:00
|
|
|
newline();
|
|
|
|
}
|
2015-05-23 19:05:08 +08:00
|
|
|
if(typeof obj.time === "number") {
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.normal("Time: ");
|
|
|
|
colors.bold(obj.time);
|
|
|
|
colors.normal("ms");
|
2013-01-31 01:49:25 +08:00
|
|
|
newline();
|
|
|
|
}
|
2015-04-17 16:17:10 +08:00
|
|
|
if(obj.publicPath) {
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.normal("PublicPath: ");
|
|
|
|
colors.bold(obj.publicPath);
|
2015-04-17 16:17:10 +08:00
|
|
|
newline();
|
|
|
|
}
|
2014-07-23 20:41:54 +08:00
|
|
|
if(obj.assets && obj.assets.length > 0) {
|
2015-07-13 06:20:09 +08:00
|
|
|
var t = [
|
|
|
|
["Asset", "Size", "Chunks", "", "Chunk Names"]
|
|
|
|
];
|
2013-01-31 01:49:25 +08:00
|
|
|
obj.assets.forEach(function(asset) {
|
|
|
|
t.push([
|
|
|
|
asset.name,
|
2015-03-04 13:18:44 +08:00
|
|
|
formatSize(asset.size),
|
2013-01-31 01:49:25 +08:00
|
|
|
asset.chunks.join(", "),
|
2013-05-08 19:28:54 +08:00
|
|
|
asset.emitted ? "[emitted]" : "",
|
2013-01-31 01:49:25 +08:00
|
|
|
asset.chunkNames.join(", ")
|
2015-04-24 05:55:50 +08:00
|
|
|
]);
|
2013-01-31 01:49:25 +08:00
|
|
|
});
|
2015-11-09 18:33:32 +08:00
|
|
|
table(t, [colors.green, colors.normal, colors.bold, colors.green, colors.normal], "rrrll");
|
2013-01-31 01:49:25 +08:00
|
|
|
}
|
2013-05-08 20:47:13 +08:00
|
|
|
var modulesByIdentifier = {};
|
|
|
|
if(obj.modules) {
|
|
|
|
obj.modules.forEach(function(module) {
|
2015-04-24 05:55:50 +08:00
|
|
|
modulesByIdentifier["$" + module.identifier] = module;
|
2013-05-08 20:47:13 +08:00
|
|
|
});
|
2013-05-10 00:17:28 +08:00
|
|
|
} else if(obj.chunks) {
|
2013-05-08 20:47:13 +08:00
|
|
|
obj.chunks.forEach(function(chunk) {
|
2013-05-10 00:17:28 +08:00
|
|
|
if(chunk.modules) {
|
|
|
|
chunk.modules.forEach(function(module) {
|
2015-04-24 05:55:50 +08:00
|
|
|
modulesByIdentifier["$" + module.identifier] = module;
|
2013-05-10 00:17:28 +08:00
|
|
|
});
|
|
|
|
}
|
2013-05-08 20:47:13 +08:00
|
|
|
});
|
|
|
|
}
|
2015-07-13 06:20:09 +08:00
|
|
|
|
2013-05-08 20:47:13 +08:00
|
|
|
function processProfile(module) {
|
|
|
|
if(module.profile) {
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.normal(" ");
|
2016-07-03 19:13:01 +08:00
|
|
|
var sum = 0;
|
2013-05-08 20:47:13 +08:00
|
|
|
var path = [];
|
|
|
|
var current = module;
|
|
|
|
while(current.issuer) {
|
2016-07-03 19:13:01 +08:00
|
|
|
path.unshift(current = current.issuer);
|
2013-05-08 20:47:13 +08:00
|
|
|
}
|
|
|
|
path.forEach(function(module) {
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.normal(" [");
|
|
|
|
colors.normal(module.id);
|
|
|
|
colors.normal("] ");
|
2013-05-08 20:47:13 +08:00
|
|
|
if(module.profile) {
|
|
|
|
var time = (module.profile.factory || 0) + (module.profile.building || 0);
|
|
|
|
coloredTime(time);
|
|
|
|
sum += time;
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.normal(" ");
|
2013-05-08 20:47:13 +08:00
|
|
|
}
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.normal("->");
|
2013-05-08 20:47:13 +08:00
|
|
|
});
|
|
|
|
Object.keys(module.profile).forEach(function(key) {
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.normal(" " + key + ":");
|
2013-05-08 20:47:13 +08:00
|
|
|
var time = module.profile[key];
|
|
|
|
coloredTime(time);
|
|
|
|
sum += time;
|
|
|
|
});
|
2016-07-03 19:13:01 +08:00
|
|
|
colors.normal(" = ");
|
|
|
|
coloredTime(sum);
|
2013-05-08 20:47:13 +08:00
|
|
|
newline();
|
|
|
|
}
|
|
|
|
}
|
2015-07-13 06:20:09 +08:00
|
|
|
|
2013-05-18 20:42:11 +08:00
|
|
|
function processModuleAttributes(module) {
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.normal(" ");
|
|
|
|
colors.normal(formatSize(module.size));
|
2013-05-18 20:42:11 +08:00
|
|
|
if(module.chunks) {
|
|
|
|
module.chunks.forEach(function(chunk) {
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.normal(" {");
|
|
|
|
colors.yellow(chunk);
|
|
|
|
colors.normal("}");
|
2013-05-18 20:42:11 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
if(!module.cacheable) {
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.red(" [not cacheable]");
|
2013-05-18 20:42:11 +08:00
|
|
|
}
|
2014-07-09 19:13:02 +08:00
|
|
|
if(module.optional) {
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.yellow(" [optional]");
|
2014-07-03 06:00:06 +08:00
|
|
|
}
|
2013-05-18 20:42:11 +08:00
|
|
|
if(module.built) {
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.green(" [built]");
|
2013-05-18 20:42:11 +08:00
|
|
|
}
|
|
|
|
if(module.prefetched) {
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.magenta(" [prefetched]");
|
2013-05-18 20:42:11 +08:00
|
|
|
}
|
|
|
|
if(module.failed)
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.red(" [failed]");
|
2013-05-18 20:42:11 +08:00
|
|
|
if(module.warnings)
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.yellow(" [" + module.warnings + " warning" + (module.warnings === 1 ? "" : "s") + "]");
|
2013-05-18 20:42:11 +08:00
|
|
|
if(module.errors)
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.red(" [" + module.errors + " error" + (module.errors === 1 ? "" : "s") + "]");
|
2013-05-18 20:42:11 +08:00
|
|
|
}
|
2013-01-31 01:49:25 +08:00
|
|
|
if(obj.chunks) {
|
|
|
|
obj.chunks.forEach(function(chunk) {
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.normal("chunk ");
|
|
|
|
if(chunk.id < 1000) colors.normal(" ");
|
|
|
|
if(chunk.id < 100) colors.normal(" ");
|
|
|
|
if(chunk.id < 10) colors.normal(" ");
|
|
|
|
colors.normal("{");
|
|
|
|
colors.yellow(chunk.id);
|
|
|
|
colors.normal("} ");
|
|
|
|
colors.green(chunk.files.join(", "));
|
2013-01-31 01:49:25 +08:00
|
|
|
if(chunk.names && chunk.names.length > 0) {
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.normal(" (");
|
|
|
|
colors.normal(chunk.names.join(", "));
|
|
|
|
colors.normal(")");
|
2013-01-31 01:49:25 +08:00
|
|
|
}
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.normal(" ");
|
|
|
|
colors.normal(formatSize(chunk.size));
|
2013-01-31 01:49:25 +08:00
|
|
|
chunk.parents.forEach(function(id) {
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.normal(" {");
|
|
|
|
colors.yellow(id);
|
|
|
|
colors.normal("}");
|
2013-01-31 01:49:25 +08:00
|
|
|
});
|
2013-05-08 19:28:54 +08:00
|
|
|
if(chunk.rendered) {
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.green(" [rendered]");
|
2013-05-08 19:28:54 +08:00
|
|
|
}
|
2013-01-31 01:49:25 +08:00
|
|
|
newline();
|
2014-01-23 22:31:40 +08:00
|
|
|
if(chunk.origins) {
|
|
|
|
chunk.origins.forEach(function(origin) {
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.normal(" > ");
|
2014-01-23 22:31:40 +08:00
|
|
|
if(origin.reasons && origin.reasons.length) {
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.yellow(origin.reasons.join(" "));
|
|
|
|
colors.normal(" ");
|
2014-01-23 22:31:40 +08:00
|
|
|
}
|
|
|
|
if(origin.name) {
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.normal(origin.name);
|
|
|
|
colors.normal(" ");
|
2014-01-23 22:31:40 +08:00
|
|
|
}
|
|
|
|
if(origin.module) {
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.normal("[");
|
|
|
|
colors.normal(origin.moduleId);
|
|
|
|
colors.normal("] ");
|
2015-04-24 05:55:50 +08:00
|
|
|
var module = modulesByIdentifier["$" + origin.module];
|
2014-02-14 17:07:42 +08:00
|
|
|
if(module) {
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.bold(module.name);
|
|
|
|
colors.normal(" ");
|
2014-02-14 17:07:42 +08:00
|
|
|
}
|
|
|
|
if(origin.loc) {
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.normal(origin.loc);
|
2014-01-23 22:31:40 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
newline();
|
|
|
|
});
|
|
|
|
}
|
2013-01-31 01:49:25 +08:00
|
|
|
if(chunk.modules) {
|
|
|
|
chunk.modules.forEach(function(module) {
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.normal(" ");
|
|
|
|
if(module.id < 1000) colors.normal(" ");
|
|
|
|
if(module.id < 100) colors.normal(" ");
|
|
|
|
if(module.id < 10) colors.normal(" ");
|
|
|
|
colors.normal("[");
|
|
|
|
colors.normal(module.id);
|
|
|
|
colors.normal("] ");
|
|
|
|
colors.bold(module.name);
|
2013-05-18 20:42:11 +08:00
|
|
|
processModuleAttributes(module);
|
2013-01-31 01:49:25 +08:00
|
|
|
newline();
|
2016-06-29 07:17:15 +08:00
|
|
|
if(module.usedExports !== undefined) {
|
|
|
|
if(module.usedExports !== true) {
|
|
|
|
colors.normal(" ");
|
|
|
|
if(module.usedExports === false)
|
|
|
|
colors.cyan("[no exports used]");
|
|
|
|
else
|
|
|
|
colors.cyan("[only some exports used: " + module.usedExports.join(", ") + "]");
|
|
|
|
newline();
|
|
|
|
}
|
|
|
|
}
|
2013-01-31 01:49:25 +08:00
|
|
|
if(module.reasons) {
|
|
|
|
module.reasons.forEach(function(reason) {
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.normal(" ");
|
|
|
|
colors.normal(reason.type);
|
|
|
|
colors.normal(" ");
|
|
|
|
colors.cyan(reason.userRequest);
|
|
|
|
if(reason.templateModules) colors.cyan(reason.templateModules.join(" "));
|
|
|
|
colors.normal(" [");
|
|
|
|
colors.normal(reason.moduleId);
|
|
|
|
colors.normal("] ");
|
|
|
|
colors.magenta(reason.module);
|
2013-01-31 01:49:25 +08:00
|
|
|
if(reason.loc) {
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.normal(" ");
|
|
|
|
colors.normal(reason.loc);
|
2013-01-31 01:49:25 +08:00
|
|
|
}
|
|
|
|
newline();
|
|
|
|
});
|
|
|
|
}
|
2013-05-08 20:47:13 +08:00
|
|
|
processProfile(module);
|
2013-01-31 01:49:25 +08:00
|
|
|
});
|
2014-09-15 17:46:33 +08:00
|
|
|
if(chunk.filteredModules > 0) {
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.normal(" + " + chunk.filteredModules + " hidden modules");
|
2014-09-15 17:46:33 +08:00
|
|
|
newline();
|
|
|
|
}
|
2013-01-31 01:49:25 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
if(obj.modules) {
|
|
|
|
obj.modules.forEach(function(module) {
|
2015-11-09 18:33:32 +08:00
|
|
|
if(module.id < 1000) colors.normal(" ");
|
|
|
|
if(module.id < 100) colors.normal(" ");
|
|
|
|
if(module.id < 10) colors.normal(" ");
|
|
|
|
colors.normal("[");
|
|
|
|
colors.normal(module.id);
|
|
|
|
colors.normal("] ");
|
|
|
|
colors.bold(module.name || module.identifier);
|
2013-05-18 20:42:11 +08:00
|
|
|
processModuleAttributes(module);
|
2013-01-31 01:49:25 +08:00
|
|
|
newline();
|
2016-06-29 07:17:15 +08:00
|
|
|
if(module.usedExports !== undefined) {
|
|
|
|
if(module.usedExports !== true) {
|
|
|
|
colors.normal(" ");
|
|
|
|
if(module.usedExports === false)
|
|
|
|
colors.cyan("[no exports used]");
|
|
|
|
else
|
|
|
|
colors.cyan("[only some exports used: " + module.usedExports.join(", ") + "]");
|
|
|
|
newline();
|
|
|
|
}
|
|
|
|
}
|
2013-01-31 01:49:25 +08:00
|
|
|
if(module.reasons) {
|
|
|
|
module.reasons.forEach(function(reason) {
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.normal(" ");
|
|
|
|
colors.normal(reason.type);
|
|
|
|
colors.normal(" ");
|
|
|
|
colors.cyan(reason.userRequest);
|
|
|
|
if(reason.templateModules) colors.cyan(reason.templateModules.join(" "));
|
|
|
|
colors.normal(" [");
|
|
|
|
colors.normal(reason.moduleId);
|
|
|
|
colors.normal("] ");
|
|
|
|
colors.magenta(reason.module);
|
2013-01-31 01:49:25 +08:00
|
|
|
if(reason.loc) {
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.normal(" ");
|
|
|
|
colors.normal(reason.loc);
|
2013-01-31 01:49:25 +08:00
|
|
|
}
|
|
|
|
newline();
|
|
|
|
});
|
|
|
|
}
|
2013-05-08 20:47:13 +08:00
|
|
|
processProfile(module);
|
2013-01-31 01:49:25 +08:00
|
|
|
});
|
2014-09-15 17:46:33 +08:00
|
|
|
if(obj.filteredModules > 0) {
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.normal(" + " + obj.filteredModules + " hidden modules");
|
2014-09-15 17:46:33 +08:00
|
|
|
newline();
|
|
|
|
}
|
2013-01-31 01:49:25 +08:00
|
|
|
}
|
2015-08-03 17:01:29 +08:00
|
|
|
if(obj._showWarnings && obj.warnings) {
|
2013-01-31 01:49:25 +08:00
|
|
|
obj.warnings.forEach(function(warning) {
|
|
|
|
newline();
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.yellow("WARNING in " + warning);
|
2013-01-31 01:49:25 +08:00
|
|
|
newline();
|
|
|
|
});
|
|
|
|
}
|
2015-08-03 17:01:29 +08:00
|
|
|
if(obj._showErrors && obj.errors) {
|
2013-01-31 01:49:25 +08:00
|
|
|
obj.errors.forEach(function(error) {
|
|
|
|
newline();
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.red("ERROR in " + error);
|
2013-01-31 01:49:25 +08:00
|
|
|
newline();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
if(obj.children) {
|
|
|
|
obj.children.forEach(function(child) {
|
2014-06-12 04:26:50 +08:00
|
|
|
if(child.name) {
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.normal("Child ");
|
|
|
|
colors.bold(child.name);
|
|
|
|
colors.normal(":");
|
2014-06-12 04:26:50 +08:00
|
|
|
} else {
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.normal("Child");
|
2014-06-12 04:26:50 +08:00
|
|
|
}
|
2013-01-31 01:49:25 +08:00
|
|
|
newline();
|
|
|
|
buf.push(" ");
|
|
|
|
buf.push(Stats.jsonToString(child, useColors).replace(/\n/g, "\n "));
|
2014-04-18 20:58:57 +08:00
|
|
|
newline();
|
2013-01-31 01:49:25 +08:00
|
|
|
});
|
|
|
|
}
|
2015-01-30 07:46:52 +08:00
|
|
|
if(obj.needAdditionalPass) {
|
2015-11-09 18:33:32 +08:00
|
|
|
colors.yellow("Compilation needs an additional pass and will compile again.");
|
2015-01-30 07:46:52 +08:00
|
|
|
}
|
2013-01-31 01:49:25 +08:00
|
|
|
|
2015-04-24 05:55:50 +08:00
|
|
|
while(buf[buf.length - 1] === "\n") buf.pop();
|
2013-01-31 01:49:25 +08:00
|
|
|
return buf.join("");
|
2015-01-18 04:55:44 +08:00
|
|
|
};
|
2015-08-03 17:01:29 +08:00
|
|
|
|
|
|
|
Stats.presetToOptions = function(name) {
|
|
|
|
//Accepted values: none, errors-only, minimal, normal, verbose
|
|
|
|
//Any other falsy value will behave as 'none', truthy values as 'normal'
|
|
|
|
var pn = (typeof name === "string") && name.toLowerCase() || name;
|
|
|
|
if(pn === "none" || !pn) {
|
|
|
|
return {
|
|
|
|
hash: false,
|
|
|
|
version: false,
|
|
|
|
timings: false,
|
|
|
|
assets: false,
|
|
|
|
chunks: false,
|
|
|
|
modules: false,
|
|
|
|
reasons: false,
|
2016-06-29 07:17:15 +08:00
|
|
|
usedExports: false,
|
2015-08-03 17:01:29 +08:00
|
|
|
children: false,
|
|
|
|
source: false,
|
|
|
|
errors: false,
|
|
|
|
errorDetails: false,
|
|
|
|
warnings: false,
|
|
|
|
publicPath: false
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
return {
|
|
|
|
assets: pn === "verbose",
|
|
|
|
version: pn === "verbose",
|
|
|
|
timings: pn !== "errors-only" && pn !== "minimal",
|
|
|
|
hash: pn !== "errors-only" && pn !== "minimal",
|
|
|
|
chunks: pn !== "errors-only",
|
|
|
|
chunkModules: pn === "verbose",
|
|
|
|
//warnings: pn !== "errors-only",
|
|
|
|
errorDetails: pn !== "errors-only" && pn !== "minimal",
|
|
|
|
reasons: pn === "verbose",
|
2016-06-29 07:17:15 +08:00
|
|
|
usedExports: pn === "verbose",
|
2015-08-03 17:01:29 +08:00
|
|
|
colors: true
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|