simplifiy verbose stats api

This commit is contained in:
Tobias Koppers 2012-10-08 23:45:46 +02:00
parent e1fc167193
commit d5fc1115e7
4 changed files with 11 additions and 13 deletions

View File

@ -588,10 +588,11 @@ else `stats` as json:
loaders: [ "filename of loader", ... ]
},
{ id: 1, size: 234, filename: "...", reasons: [
{ type: "require", // or "context", "async require", "async context"
{ type: "require", // or "context"
async: true,
count: 2,
filename: "/home/.../main.js",
// additionally: dirname: "..." // for type = "context" or "async context"
// additionally: dirname: "..." // for type = "context"
}
]},
...

View File

@ -300,7 +300,8 @@ function addModule(depTree, context, modu, options, reason, finalCallback) {
if(requiresNames.length)
requiresNames.forEach(function(moduleName) {
var reason = {
type: directRequire[moduleName] ? "require" : "async require",
type: "require",
async: !directRequire[moduleName] || undefined,
count: requires[moduleName].length,
filename: filenameWithLoaders
};
@ -323,7 +324,8 @@ function addModule(depTree, context, modu, options, reason, finalCallback) {
var context = contextObj.context;
var module = contextObj.module;
var reason = {
type: directContexts[context.name] ? "context" : "async context",
type: "context",
async: !directContexts[context.name] || undefined,
filename: filenameWithLoaders
};
@ -516,6 +518,7 @@ function addContextModule(depTree, context, contextModuleName, options, reason,
}
var modulereason = {
type: "context",
async: reason.async,
dirname: contextModuleNameWithLoaders,
filename: reason.filename
};

View File

@ -79,16 +79,10 @@ module.exports = function(stats, options) {
module.reasons.forEach(function(reason) {
switch(reason.type) {
case "require":
buf.push(" "+c("\033[36m")+"require (" + reason.count + "x) from " + compressFilename(reason.filename) + c("\033[39m"));
buf.push(" "+c("\033[36m")+(reason.async?"async ":"")+"require (" + reason.count + "x) from " + compressFilename(reason.filename) + c("\033[39m"));
break;
case "context":
buf.push(" "+c("\033[90m")+"context from " + compressFilename(reason.filename) + c("\033[39m"));
break;
case "async require":
buf.push(" "+c("\033[35m")+"async require (" + reason.count + "x) from " + compressFilename(reason.filename) + c("\033[39m"));
break;
case "async context":
buf.push(" "+c("\033[35ma")+"async context from " + compressFilename(reason.filename) + c("\033[39m"));
buf.push(" "+c("\033[90m")+(reason.async?"async ":"")+"context from " + compressFilename(reason.filename) + c("\033[39m"));
break;
default:
buf.push(" "+c("\033[31m") + reason.type + c("\033[39m"));

View File

@ -1,6 +1,6 @@
{
"name": "webpack",
"version": "0.7.1",
"version": "0.7.2",
"author": "Tobias Koppers @sokra",
"description": "Packs CommonJs/AMD Modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loading of js, json, jade, coffee, css, ... out of the box and more with custom loaders.",
"dependencies": {