mirror of https://github.com/webpack/webpack.git
Make stats version output configurable
This commit is contained in:
parent
e5cc07ec96
commit
ab630347ad
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue