Make stats version output configurable

This commit is contained in:
Christoffer Wolgast 2014-08-01 15:19:15 +02:00
parent e5cc07ec96
commit ab630347ad
1 changed files with 6 additions and 2 deletions

View File

@ -24,6 +24,7 @@ Stats.prototype.toJson = function toJson(options, forToString) {
var compilation = this.compilation;
var requestShortener = new RequestShortener(d(options.context, process.cwd()));
var showHash = d(options.hash, true);
var showVersion = d(options.version, true);
var showTimings = d(options.timings, true);
var showAssets = d(options.assets, true);
var showChunks = d(options.chunks, true);
@ -68,18 +69,21 @@ Stats.prototype.toJson = function toJson(options, forToString) {
if(!dep.loc) return;
if(!dep.loc.start) return;
if(!dep.loc.end) return;
text += " " + dep.loc.start.line + ":" + dep.loc.start.column + "-" +
text += " " + dep.loc.start.line + ":" + dep.loc.start.column + "-" +
(dep.loc.start.line !== dep.loc.end.line ? dep.loc.end.line + ":" : "") + dep.loc.end.column;
});
}
return text;
}
var obj = {
version: require("../package.json").version,
errors: compilation.errors.map(formatError),
warnings: compilation.warnings.map(formatError)
};
if(showVersion) {
obj.version = require("../package.json").version;
}
if(showHash) obj.hash = this.hash;
if(showTimings && this.startTime && this.endTime) {
obj.time = this.endTime - this.startTime;