Skip to content

Commit 764c139

Browse files
committed
added cachedAssets stats option
fixes webpack/webpack-dev-middleware#17
1 parent b014b77 commit 764c139

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

bin/webpack.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ optimist
4242

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

45+
.boolean("display-cached-assets").describe("display-cached-assets")
46+
4547
.boolean("display-reasons").alias("display-reasons", "verbose").alias("display-reasons", "v").describe("display-reasons");
4648

4749

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

6466
var outputOptions = {
6567
cached: false,
68+
cachedAssets: false,
6669
context: options.context
6770
};
6871

@@ -108,11 +111,18 @@ if(!outputOptions.json) {
108111
if(bool)
109112
outputOptions.cached = true;
110113
});
114+
115+
ifArg("display-cached-assets", function(bool) {
116+
if(bool)
117+
outputOptions.cachedAssets = true;
118+
});
111119
} else {
112120
outputOptions.chunks = true;
113121
outputOptions.modules = true;
114122
outputOptions.chunkModules = true;
115123
outputOptions.reasons = true;
124+
outputOptions.cached = true;
125+
outputOptions.cachedAssets = true;
116126
}
117127

118128
ifArg("hide-modules", function(bool) {

lib/Stats.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Stats.prototype.toJson = function toJson(options, forToString) {
3232
var showChunkOrigins = d(options.chunkOrigins, !forToString);
3333
var showModules = d(options.modules, !forToString);
3434
var showCachedModules = d(options.cached, true);
35+
var showCachedAssets = d(options.cachedAssets, true);
3536
var showReasons = d(options.reasons, !forToString);
3637
var showChildren = d(options.children, true);
3738
var showSource = d(options.source, !forToString);
@@ -101,6 +102,8 @@ Stats.prototype.toJson = function toJson(options, forToString) {
101102
};
102103
assetsByFile[asset] = obj;
103104
return obj;
105+
}).filter(function(asset) {
106+
return showCachedAssets || asset.emitted;
104107
});
105108
compilation.chunks.forEach(function(chunk) {
106109
chunk.files.forEach(function(asset) {

0 commit comments

Comments
 (0)