Skip to content

Commit 5433b8c

Browse files
authored
Merge pull request webpack#5825 from jbottigliero/fix-webpackOptionsSchema
[fix] webpackOptionsSchema
2 parents 33818bc + 5761875 commit 5433b8c

File tree

4 files changed

+75
-2
lines changed

4 files changed

+75
-2
lines changed

schemas/webpackOptionsSchema.json

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,7 @@
975975
"anyOf": [
976976
{
977977
"type": "object",
978+
"additionalProperties": false,
978979
"properties": {
979980
"context": {
980981
"type": "string",
@@ -997,6 +998,46 @@
997998
"type": "boolean",
998999
"description": "add assets information"
9991000
},
1001+
"env": {
1002+
"type": "boolean",
1003+
"description": "add --env information"
1004+
},
1005+
"colors": {
1006+
"oneOf": [
1007+
{
1008+
"type": "boolean",
1009+
"description": "`webpack --colors` equivalent"
1010+
},
1011+
{
1012+
"type": "object",
1013+
"additionalProperties": false,
1014+
"properties": {
1015+
"bold": {
1016+
"type": "string"
1017+
},
1018+
"red": {
1019+
"type": "string"
1020+
},
1021+
"green": {
1022+
"type": "string"
1023+
},
1024+
"cyan": {
1025+
"type": "string"
1026+
},
1027+
"magenta": {
1028+
"type": "string"
1029+
},
1030+
"yellow": {
1031+
"type": "string"
1032+
}
1033+
}
1034+
}
1035+
]
1036+
},
1037+
"maxModules": {
1038+
"type": "number",
1039+
"description": "Set the maximum number of modules to be shown"
1040+
},
10001041
"chunks": {
10011042
"type": "boolean",
10021043
"description": "add chunk information"
@@ -1017,6 +1058,10 @@
10171058
"type": "boolean",
10181059
"description": "add also information about cached (not built) modules"
10191060
},
1061+
"cachedAssets": {
1062+
"type": "boolean",
1063+
"description": "Show cached assets (setting this to `false` only shows emitted files)"
1064+
},
10201065
"reasons": {
10211066
"type": "boolean",
10221067
"description": "add information about the reasons why modules are included"
@@ -1041,6 +1086,10 @@
10411086
"description": "Please use excludeModules instead.",
10421087
"$ref": "#/definitions/filter-types"
10431088
},
1089+
"entrypoints": {
1090+
"type": "boolean",
1091+
"description": "Display the entry points with the corresponding bundles"
1092+
},
10441093
"errorDetails": {
10451094
"type": "boolean",
10461095
"description": "add details to errors (like resolving log)"
@@ -1065,6 +1114,10 @@
10651114
"type": "string",
10661115
"description": "sort the assets by that field"
10671116
},
1117+
"publicPath": {
1118+
"type": "boolean",
1119+
"description": "Add public path information"
1120+
},
10681121
"providedExports": {
10691122
"type": "boolean",
10701123
"description": "show exports provided by modules"

test/Validation.test.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,20 @@ describe("Validation", () => {
199199
message: [
200200
" - configuration.context: The provided value \"baz\" is not an absolute path!",
201201
]
202+
}, {
203+
name: "missing stats option",
204+
config: {
205+
entry: "foo.js",
206+
stats: {
207+
foobar: true
208+
}
209+
},
210+
test(e) {
211+
e.message.should.startWith("Invalid configuration object.");
212+
e.message.split("\n").slice(1)[0].should.be.eql(
213+
" - configuration.stats should be one of these:"
214+
);
215+
}
202216
}];
203217
testCases.forEach((testCase) => {
204218
it("should fail validation for " + testCase.name, () => {
@@ -207,6 +221,12 @@ describe("Validation", () => {
207221
} catch(e) {
208222
if(!(e instanceof WebpackOptionsValidationError))
209223
throw e;
224+
225+
if(testCase.test) {
226+
testCase.test(e);
227+
return;
228+
}
229+
210230
e.message.should.startWith("Invalid configuration object.");
211231
e.message.split("\n").slice(1).should.be.eql(testCase.message);
212232
return;

test/statsCases/module-deduplication-named/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module.exports = {
99
},
1010
stats: {
1111
hash: false,
12-
timing: false,
12+
timings: true,
1313
chunks: true,
1414
chunkModules: true,
1515
modules: false

test/statsCases/module-deduplication/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module.exports = {
99
},
1010
stats: {
1111
hash: false,
12-
timing: false,
12+
timings: true,
1313
chunks: true,
1414
chunkModules: true,
1515
modules: false

0 commit comments

Comments
 (0)