Skip to content

Commit

Permalink
added cachedAssets stats option
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Aug 28, 2014
1 parent b014b77 commit 764c139
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions bin/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ optimist

.boolean("display-cached").describe("display-cached")

.boolean("display-cached-assets").describe("display-cached-assets")

.boolean("display-reasons").alias("display-reasons", "verbose").alias("display-reasons", "v").describe("display-reasons");


Expand All @@ -63,6 +65,7 @@ function ifArg(name, fn, init) {

var outputOptions = {
cached: false,
cachedAssets: false,
context: options.context
};

Expand Down Expand Up @@ -108,11 +111,18 @@ if(!outputOptions.json) {
if(bool)
outputOptions.cached = true;
});

ifArg("display-cached-assets", function(bool) {
if(bool)
outputOptions.cachedAssets = true;
});
} else {
outputOptions.chunks = true;
outputOptions.modules = true;
outputOptions.chunkModules = true;
outputOptions.reasons = true;
outputOptions.cached = true;
outputOptions.cachedAssets = true;
}

ifArg("hide-modules", function(bool) {
Expand Down
3 changes: 3 additions & 0 deletions lib/Stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Stats.prototype.toJson = function toJson(options, forToString) {
var showChunkOrigins = d(options.chunkOrigins, !forToString);
var showModules = d(options.modules, !forToString);
var showCachedModules = d(options.cached, true);
var showCachedAssets = d(options.cachedAssets, true);
var showReasons = d(options.reasons, !forToString);
var showChildren = d(options.children, true);
var showSource = d(options.source, !forToString);
Expand Down Expand Up @@ -101,6 +102,8 @@ Stats.prototype.toJson = function toJson(options, forToString) {
};
assetsByFile[asset] = obj;
return obj;
}).filter(function(asset) {
return showCachedAssets || asset.emitted;
});
compilation.chunks.forEach(function(chunk) {
chunk.files.forEach(function(asset) {
Expand Down

0 comments on commit 764c139

Please sign in to comment.