mirror of https://github.com/webpack/webpack.git
chore(performance): cleanup logic errors, reformat test expects with new colomn [big] format if empty
This commit is contained in:
parent
c6850b3481
commit
44f6f07ec2
|
|
@ -418,6 +418,9 @@ Stats.jsonToString = function jsonToString(obj, useColors) {
|
|||
for(row = 0; row < rows; row++) {
|
||||
for(col = 0; col < cols; col++) {
|
||||
value = getText(array, row, col) + "";
|
||||
if(value.length === 0) {
|
||||
colSizes[col] = 0;
|
||||
}
|
||||
if(value.length > colSizes[col]) {
|
||||
colSizes[col] = value.length;
|
||||
}
|
||||
|
|
@ -434,7 +437,7 @@ Stats.jsonToString = function jsonToString(obj, useColors) {
|
|||
colors.normal(" ");
|
||||
if(align[col] === "r")
|
||||
format(value);
|
||||
if(col + 1 < cols)
|
||||
if(col + 1 < cols && colSizes[col] != 0)
|
||||
colors.normal(splitter || " ");
|
||||
}
|
||||
newline();
|
||||
|
|
@ -446,7 +449,6 @@ Stats.jsonToString = function jsonToString(obj, useColors) {
|
|||
return colors.yellow;
|
||||
}
|
||||
|
||||
|
||||
return defaultColor;
|
||||
}
|
||||
|
||||
|
|
@ -489,7 +491,7 @@ Stats.jsonToString = function jsonToString(obj, useColors) {
|
|||
{value: formatSize(asset.size), color: getAssetColor(asset, colors.normal)},
|
||||
{value: asset.chunks.join(", "), color: colors.bold},
|
||||
{value: asset.emitted ? "[emitted]" : "", color: colors.green},
|
||||
{value: asset.isOverSizeLimit ? "[big]" : "", color: colors.yellow},
|
||||
{value: asset.isOverSizeLimit ? "[big]" : "", color: getAssetColor(asset, colors.normal)},
|
||||
{value: asset.chunkNames.join(", "), color: colors.normal}
|
||||
]);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ var FlagIncludedChunksPlugin = require("./optimize/FlagIncludedChunksPlugin");
|
|||
var OccurrenceOrderPlugin = require("./optimize/OccurrenceOrderPlugin");
|
||||
var FlagDependencyUsagePlugin = require("./FlagDependencyUsagePlugin");
|
||||
var FlagDependencyExportsPlugin = require("./FlagDependencyExportsPlugin");
|
||||
var EmittedAssetSizeLimitPlugin = require("./performance/EmittedAssetSizeLimitPlugin");
|
||||
|
||||
var ResolverFactory = require("enhanced-resolve").ResolverFactory;
|
||||
|
||||
|
|
@ -65,28 +66,21 @@ WebpackOptionsApply.prototype.process = function(options, compiler) {
|
|||
compiler.name = options.name;
|
||||
compiler.dependencies = options.dependencies;
|
||||
if(typeof options.target === "string") {
|
||||
var EmittedAssetSizeLimitPlugin;
|
||||
var JsonpTemplatePlugin;
|
||||
var NodeSourcePlugin;
|
||||
var NodeTargetPlugin;
|
||||
var NodeTemplatePlugin;
|
||||
|
||||
switch(options.target) {
|
||||
case "web":
|
||||
JsonpTemplatePlugin = require("./JsonpTemplatePlugin");
|
||||
NodeSourcePlugin = require("./node/NodeSourcePlugin");
|
||||
|
||||
compiler.apply(
|
||||
new JsonpTemplatePlugin(options.output),
|
||||
new FunctionModulePlugin(options.output),
|
||||
new NodeSourcePlugin(options.node),
|
||||
new LoaderTargetPlugin("web")
|
||||
);
|
||||
|
||||
if (options.performance.hints) {
|
||||
EmittedAssetSizeLimitPlugin = require("./performance/EmittedAssetSizeLimitPlugin");
|
||||
compiler.apply(new EmittedAssetSizeLimitPlugin(options.performance));
|
||||
}
|
||||
|
||||
break;
|
||||
case "webworker":
|
||||
var WebWorkerTemplatePlugin = require("./webworker/WebWorkerTemplatePlugin");
|
||||
|
|
@ -194,6 +188,7 @@ WebpackOptionsApply.prototype.process = function(options, compiler) {
|
|||
} else {
|
||||
throw new Error("Unsupported target '" + options.target + "'.");
|
||||
}
|
||||
|
||||
if(options.output.library || options.output.libraryTarget !== "var") {
|
||||
var LibraryTemplatePlugin = require("./LibraryTemplatePlugin");
|
||||
compiler.apply(new LibraryTemplatePlugin(options.output.library, options.output.libraryTarget, options.output.umdNamedDefine, options.output.auxiliaryComment || ""));
|
||||
|
|
@ -272,6 +267,8 @@ WebpackOptionsApply.prototype.process = function(options, compiler) {
|
|||
new FlagDependencyUsagePlugin()
|
||||
);
|
||||
|
||||
compiler.apply(new EmittedAssetSizeLimitPlugin(options.performance));
|
||||
|
||||
compiler.apply(new TemplatedPathPlugin());
|
||||
|
||||
compiler.apply(new RecordIdsPlugin());
|
||||
|
|
|
|||
|
|
@ -13,11 +13,6 @@ function WebpackOptionsDefaulter() {
|
|||
this.set("context", process.cwd());
|
||||
this.set("target", "web");
|
||||
|
||||
this.set("performance.maxAssetSize", 250000);
|
||||
this.set("performance.maxInitialChunkSize", 250000);
|
||||
this.set("performance.hints", true);
|
||||
this.set("performance.errorOnHint", false);
|
||||
|
||||
this.set("module.unknownContextRequest", ".");
|
||||
this.set("module.unknownContextRegExp", false);
|
||||
this.set("module.unknownContextRecursive", true);
|
||||
|
|
@ -74,6 +69,16 @@ function WebpackOptionsDefaulter() {
|
|||
this.set("node.__filename", "mock");
|
||||
this.set("node.__dirname", "mock");
|
||||
|
||||
this.set("performance.maxAssetSize", 250000);
|
||||
this.set("performance.maxInitialChunkSize", 250000);
|
||||
this.set("performance.errorOnHint", false);
|
||||
this.set("performance.hints", "make", function(options) {
|
||||
if(options.target === "web")
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
});
|
||||
|
||||
this.set("resolve", {});
|
||||
this.set("resolve.unsafeCache", true);
|
||||
this.set("resolve.modules", ["node_modules"]);
|
||||
|
|
@ -90,7 +95,6 @@ function WebpackOptionsDefaulter() {
|
|||
else
|
||||
return ["module", "main"];
|
||||
});
|
||||
|
||||
this.set("resolveLoader", {});
|
||||
this.set("resolveLoader.unsafeCache", true);
|
||||
this.set("resolveLoader.mainFields", ["loader", "main"]);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ function AssetsOverSizeLimitWarning(assetsOverSizeLimit, assetLimit) {
|
|||
this.assets = assetsOverSizeLimit;
|
||||
|
||||
var assetLists = this.assets.map(function(asset) {
|
||||
return "\n " + asset.name + " (" + SizeFormatHelpers.formatSize(asset.size) +")";
|
||||
return "\n " + asset.name + " (" + SizeFormatHelpers.formatSize(asset.size) + ")";
|
||||
}).join("");
|
||||
|
||||
this.message = "asset size limit: The following asset(s) exceed the recommended size limit (" + SizeFormatHelpers.formatSize(assetLimit) + "). \n" +
|
||||
|
|
|
|||
|
|
@ -54,7 +54,9 @@ EmittedAssetSizeLimitPlugin.prototype.apply = function(compiler) {
|
|||
}).length > 0;
|
||||
|
||||
var entrypointsOverLimit = Object.keys(compilation.entrypoints)
|
||||
.map(function(key) { return compilation.entrypoints[key] })
|
||||
.map(function(key) {
|
||||
return compilation.entrypoints[key]
|
||||
})
|
||||
.filter(function(entry) {
|
||||
return doesExceedLimit(entrypointSizeLimit, entry.getSize(compilation))
|
||||
});
|
||||
|
|
@ -83,7 +85,7 @@ EmittedAssetSizeLimitPlugin.prototype.apply = function(compiler) {
|
|||
warnings.push(new NoAsyncChunksWarning());
|
||||
}
|
||||
} else {
|
||||
if(entrypointsOverLimit.legnth > 0) {
|
||||
if(entrypointsOverLimit.length > 0) {
|
||||
warnings.push(
|
||||
new EntrypointsOverSizeLimitWarning(
|
||||
entrypointsOverLimit,
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ function EntrypointsOverSizeLimitWarning(entrypoints, compilation, entrypointLim
|
|||
this.name = "EntrypointsOverSizeLimitWarning";
|
||||
this.entrypoints = entrypoints;
|
||||
|
||||
|
||||
var entrypointCompilation = compilation;
|
||||
var entrypointList = this.entrypoints.map(function(entrypoint) {
|
||||
return "\n " + entrypoint.name + " (" + SizeFormatHelpers.formatSize(entrypoint.getSize(entrypointCompilation)) + ")\n" +
|
||||
|
|
@ -19,8 +18,6 @@ function EntrypointsOverSizeLimitWarning(entrypoints, compilation, entrypointLim
|
|||
}).join("");
|
||||
}).join("");
|
||||
|
||||
debugger;
|
||||
|
||||
this.message = "entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (" + SizeFormatHelpers.formatSize(entrypointLimit) + "). " +
|
||||
"This can impact web performance.\n" +
|
||||
"Entrypoints:" + entrypointList;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Hash: <CLR=BOLD>6c781fe6bf412ba6435b</CLR>
|
||||
Time: <CLR=BOLD>X</CLR>ms
|
||||
<CLR=BOLD>Asset</CLR> <CLR=BOLD>Size</CLR> <CLR=BOLD>Chunks</CLR> <CLR=39,BOLD><CLR=22> <CLR=BOLD>Chunk Names</CLR>
|
||||
<CLR=BOLD>Asset</CLR> <CLR=BOLD>Size</CLR> <CLR=BOLD>Chunks</CLR> <CLR=39,BOLD><CLR=22> <CLR=39,BOLD><CLR=22><CLR=BOLD>Chunk Names</CLR>
|
||||
<CLR=32>main.js</CLR> 2.51 kB <CLR=BOLD>0</CLR> <CLR=32>[emitted]</CLR> main
|
||||
chunk {<CLR=33>0</CLR>} <CLR=32>main.js</CLR> (main) 0 bytes<CLR=33> [entry]</CLR><CLR=32> [rendered]</CLR>
|
||||
[0] <CLR=BOLD>(webpack)/test/statsCases/color-enabled-custom/index.js</CLR> 0 bytes {<CLR=33>0</CLR>}<CLR=32> [built]</CLR>
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
Hash: <CLR=BOLD>6c781fe6bf412ba6435b</CLR>
|
||||
Time: <CLR=BOLD>X</CLR>ms
|
||||
<CLR=BOLD>Asset</CLR> <CLR=BOLD>Size</CLR> <CLR=BOLD>Chunks</CLR> <CLR=39,BOLD><CLR=22> <CLR=BOLD>Chunk Names</CLR>
|
||||
<CLR=BOLD>Asset</CLR> <CLR=BOLD>Size</CLR> <CLR=BOLD>Chunks</CLR> <CLR=39,BOLD><CLR=22> <CLR=39,BOLD><CLR=22><CLR=BOLD>Chunk Names</CLR>
|
||||
<CLR=32,BOLD>main.js</CLR> 2.51 kB <CLR=BOLD>0</CLR> <CLR=32,BOLD>[emitted]</CLR> main
|
||||
chunk {<CLR=33,BOLD>0</CLR>} <CLR=32,BOLD>main.js</CLR> (main) 0 bytes<CLR=33,BOLD> [entry]</CLR><CLR=32,BOLD> [rendered]</CLR>
|
||||
[0] <CLR=BOLD>(webpack)/test/statsCases/color-enabled/index.js</CLR> 0 bytes {<CLR=33,BOLD>0</CLR>}<CLR=32,BOLD> [built]</CLR>
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
Time: <CLR=BOLD>X</CLR>ms
|
||||
<CLR=BOLD>Asset</CLR> <CLR=BOLD>Size</CLR> <CLR=BOLD>Chunks</CLR> <CLR=39,BOLD><CLR=22> <CLR=BOLD>Chunk Names</CLR>
|
||||
<CLR=32,BOLD>0.js</CLR> 227 bytes <CLR=BOLD>0</CLR> <CLR=32,BOLD>[emitted]</CLR>
|
||||
<CLR=32,BOLD>1.js</CLR> 106 bytes <CLR=BOLD>1</CLR> <CLR=32,BOLD>[emitted]</CLR>
|
||||
<CLR=32,BOLD>2.js</CLR> 200 bytes <CLR=BOLD>2</CLR> <CLR=32,BOLD>[emitted]</CLR>
|
||||
<CLR=33,BOLD>main.js</CLR> <CLR=33,BOLD>306 kB</CLR> <CLR=BOLD>3</CLR> <CLR=32,BOLD>[emitted]</CLR> main
|
||||
<CLR=BOLD>Asset</CLR> <CLR=BOLD>Size</CLR> <CLR=BOLD>Chunks</CLR> <CLR=39,BOLD><CLR=22> <CLR=39,BOLD><CLR=22> <CLR=BOLD>Chunk Names</CLR>
|
||||
<CLR=32,BOLD>0.js</CLR> 227 bytes <CLR=BOLD>0</CLR> <CLR=32,BOLD>[emitted]</CLR>
|
||||
<CLR=32,BOLD>1.js</CLR> 106 bytes <CLR=BOLD>1</CLR> <CLR=32,BOLD>[emitted]</CLR>
|
||||
<CLR=32,BOLD>2.js</CLR> 200 bytes <CLR=BOLD>2</CLR> <CLR=32,BOLD>[emitted]</CLR>
|
||||
<CLR=33,BOLD>main.js</CLR> <CLR=33,BOLD>306 kB</CLR> <CLR=BOLD>3</CLR> <CLR=32,BOLD>[emitted]</CLR> <CLR=33,BOLD>[big]</CLR> main
|
||||
chunk {<CLR=33,BOLD>0</CLR>} <CLR=32,BOLD>0.js</CLR> 54 bytes {<CLR=33,BOLD>3</CLR>}<CLR=32,BOLD> [rendered]</CLR>
|
||||
[2] <CLR=BOLD>(webpack)/test/statsCases/performance-error/c.js</CLR> 54 bytes {<CLR=33,BOLD>0</CLR>}<CLR=32,BOLD> [built]</CLR>
|
||||
chunk {<CLR=33,BOLD>1</CLR>} <CLR=32,BOLD>1.js</CLR> 22 bytes {<CLR=33,BOLD>3</CLR>}<CLR=32,BOLD> [rendered]</CLR>
|
||||
|
|
@ -15,14 +15,13 @@ chunk {<CLR=33,BOLD>3</CLR>} <CLR=32,BOLD>main.js</CLR> (main) 300 kB<CLR=33,
|
|||
[0] <CLR=BOLD>(webpack)/test/statsCases/performance-error/a.js</CLR> 300 kB {<CLR=33,BOLD>3</CLR>}<CLR=32,BOLD> [built]</CLR>
|
||||
[5] <CLR=BOLD>(webpack)/test/statsCases/performance-error/index.js</CLR> 52 bytes {<CLR=33,BOLD>3</CLR>}<CLR=32,BOLD> [built]</CLR>
|
||||
|
||||
<CLR=31,BOLD>ERROR in asset size limit: The following assets exceed the recommended size limit (250 kB).
|
||||
<CLR=31,BOLD>ERROR in asset size limit: The following asset(s) exceed the recommended size limit (250 kB).
|
||||
This can impact web performance.
|
||||
Assets:
|
||||
main.js</CLR>
|
||||
main.js (306 kB)</CLR>
|
||||
|
||||
<CLR=31,BOLD>ERROR in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (250 kB). This can impact web performance.
|
||||
Entrypoints:
|
||||
|
||||
main: 306 kB
|
||||
Entrypoints:
|
||||
main (306 kB)
|
||||
main.js
|
||||
</CLR>
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
Time: <CLR=BOLD>X</CLR>ms
|
||||
<CLR=BOLD>Asset</CLR> <CLR=BOLD>Size</CLR> <CLR=BOLD>Chunks</CLR> <CLR=39,BOLD><CLR=22> <CLR=BOLD>Chunk Names</CLR>
|
||||
<CLR=32,BOLD>0.js</CLR> 227 bytes <CLR=BOLD>0</CLR> <CLR=32,BOLD>[emitted]</CLR>
|
||||
<CLR=32,BOLD>1.js</CLR> 106 bytes <CLR=BOLD>1</CLR> <CLR=32,BOLD>[emitted]</CLR>
|
||||
<CLR=32,BOLD>2.js</CLR> 200 bytes <CLR=BOLD>2</CLR> <CLR=32,BOLD>[emitted]</CLR>
|
||||
<CLR=33,BOLD>main.js</CLR> <CLR=33,BOLD>306 kB</CLR> <CLR=BOLD>3</CLR> <CLR=32,BOLD>[emitted]</CLR> main
|
||||
<CLR=BOLD>Asset</CLR> <CLR=BOLD>Size</CLR> <CLR=BOLD>Chunks</CLR> <CLR=39,BOLD><CLR=22> <CLR=39,BOLD><CLR=22> <CLR=BOLD>Chunk Names</CLR>
|
||||
<CLR=32,BOLD>0.js</CLR> 227 bytes <CLR=BOLD>0</CLR> <CLR=32,BOLD>[emitted]</CLR>
|
||||
<CLR=32,BOLD>1.js</CLR> 106 bytes <CLR=BOLD>1</CLR> <CLR=32,BOLD>[emitted]</CLR>
|
||||
<CLR=32,BOLD>2.js</CLR> 200 bytes <CLR=BOLD>2</CLR> <CLR=32,BOLD>[emitted]</CLR>
|
||||
<CLR=33,BOLD>main.js</CLR> <CLR=33,BOLD>306 kB</CLR> <CLR=BOLD>3</CLR> <CLR=32,BOLD>[emitted]</CLR> <CLR=33,BOLD>[big]</CLR> main
|
||||
chunk {<CLR=33,BOLD>0</CLR>} <CLR=32,BOLD>0.js</CLR> 54 bytes {<CLR=33,BOLD>3</CLR>}<CLR=32,BOLD> [rendered]</CLR>
|
||||
[2] <CLR=BOLD>(webpack)/test/statsCases/preset-normal-performance/c.js</CLR> 54 bytes {<CLR=33,BOLD>0</CLR>}<CLR=32,BOLD> [built]</CLR>
|
||||
chunk {<CLR=33,BOLD>1</CLR>} <CLR=32,BOLD>1.js</CLR> 22 bytes {<CLR=33,BOLD>3</CLR>}<CLR=32,BOLD> [rendered]</CLR>
|
||||
|
|
@ -15,14 +15,13 @@ chunk {<CLR=33,BOLD>3</CLR>} <CLR=32,BOLD>main.js</CLR> (main) 300 kB<CLR=33,
|
|||
[0] <CLR=BOLD>(webpack)/test/statsCases/preset-normal-performance/a.js</CLR> 300 kB {<CLR=33,BOLD>3</CLR>}<CLR=32,BOLD> [built]</CLR>
|
||||
[5] <CLR=BOLD>(webpack)/test/statsCases/preset-normal-performance/index.js</CLR> 52 bytes {<CLR=33,BOLD>3</CLR>}<CLR=32,BOLD> [built]</CLR>
|
||||
|
||||
<CLR=33,BOLD>WARNING in asset size limit: The following assets exceed the recommended size limit (250 kB).
|
||||
<CLR=33,BOLD>WARNING in asset size limit: The following asset(s) exceed the recommended size limit (250 kB).
|
||||
This can impact web performance.
|
||||
Assets:
|
||||
main.js</CLR>
|
||||
main.js (306 kB)</CLR>
|
||||
|
||||
<CLR=33,BOLD>WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (250 kB). This can impact web performance.
|
||||
Entrypoints:
|
||||
|
||||
main: 306 kB
|
||||
Entrypoints:
|
||||
main (306 kB)
|
||||
main.js
|
||||
</CLR>
|
||||
Loading…
Reference in New Issue