Skip to content

Commit 4810ac7

Browse files
committed
Merge pull request webpack#389 from Chrazy/stats-patch
Make stats version output configurable
2 parents e5cc07e + ab63034 commit 4810ac7

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

lib/Stats.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Stats.prototype.toJson = function toJson(options, forToString) {
2424
var compilation = this.compilation;
2525
var requestShortener = new RequestShortener(d(options.context, process.cwd()));
2626
var showHash = d(options.hash, true);
27+
var showVersion = d(options.version, true);
2728
var showTimings = d(options.timings, true);
2829
var showAssets = d(options.assets, true);
2930
var showChunks = d(options.chunks, true);
@@ -68,18 +69,21 @@ Stats.prototype.toJson = function toJson(options, forToString) {
6869
if(!dep.loc) return;
6970
if(!dep.loc.start) return;
7071
if(!dep.loc.end) return;
71-
text += " " + dep.loc.start.line + ":" + dep.loc.start.column + "-" +
72+
text += " " + dep.loc.start.line + ":" + dep.loc.start.column + "-" +
7273
(dep.loc.start.line !== dep.loc.end.line ? dep.loc.end.line + ":" : "") + dep.loc.end.column;
7374
});
7475
}
7576
return text;
7677
}
7778
var obj = {
78-
version: require("../package.json").version,
7979
errors: compilation.errors.map(formatError),
8080
warnings: compilation.warnings.map(formatError)
8181
};
8282

83+
if(showVersion) {
84+
obj.version = require("../package.json").version;
85+
}
86+
8387
if(showHash) obj.hash = this.hash;
8488
if(showTimings && this.startTime && this.endTime) {
8589
obj.time = this.endTime - this.startTime;

0 commit comments

Comments
 (0)