mirror of https://github.com/webpack/webpack.git
Merge pull request #5825 from jbottigliero/fix-webpackOptionsSchema
[fix] webpackOptionsSchema
This commit is contained in:
commit
5433b8cc78
|
|
@ -975,6 +975,7 @@
|
||||||
"anyOf": [
|
"anyOf": [
|
||||||
{
|
{
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
"additionalProperties": false,
|
||||||
"properties": {
|
"properties": {
|
||||||
"context": {
|
"context": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
|
@ -997,6 +998,46 @@
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "add assets information"
|
"description": "add assets information"
|
||||||
},
|
},
|
||||||
|
"env": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "add --env information"
|
||||||
|
},
|
||||||
|
"colors": {
|
||||||
|
"oneOf": [
|
||||||
|
{
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "`webpack --colors` equivalent"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": false,
|
||||||
|
"properties": {
|
||||||
|
"bold": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"red": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"green": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"cyan": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"magenta": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"yellow": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"maxModules": {
|
||||||
|
"type": "number",
|
||||||
|
"description": "Set the maximum number of modules to be shown"
|
||||||
|
},
|
||||||
"chunks": {
|
"chunks": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "add chunk information"
|
"description": "add chunk information"
|
||||||
|
|
@ -1017,6 +1058,10 @@
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "add also information about cached (not built) modules"
|
"description": "add also information about cached (not built) modules"
|
||||||
},
|
},
|
||||||
|
"cachedAssets": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Show cached assets (setting this to `false` only shows emitted files)"
|
||||||
|
},
|
||||||
"reasons": {
|
"reasons": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "add information about the reasons why modules are included"
|
"description": "add information about the reasons why modules are included"
|
||||||
|
|
@ -1041,6 +1086,10 @@
|
||||||
"description": "Please use excludeModules instead.",
|
"description": "Please use excludeModules instead.",
|
||||||
"$ref": "#/definitions/filter-types"
|
"$ref": "#/definitions/filter-types"
|
||||||
},
|
},
|
||||||
|
"entrypoints": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Display the entry points with the corresponding bundles"
|
||||||
|
},
|
||||||
"errorDetails": {
|
"errorDetails": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "add details to errors (like resolving log)"
|
"description": "add details to errors (like resolving log)"
|
||||||
|
|
@ -1065,6 +1114,10 @@
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "sort the assets by that field"
|
"description": "sort the assets by that field"
|
||||||
},
|
},
|
||||||
|
"publicPath": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Add public path information"
|
||||||
|
},
|
||||||
"providedExports": {
|
"providedExports": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "show exports provided by modules"
|
"description": "show exports provided by modules"
|
||||||
|
|
|
||||||
|
|
@ -199,6 +199,20 @@ describe("Validation", () => {
|
||||||
message: [
|
message: [
|
||||||
" - configuration.context: The provided value \"baz\" is not an absolute path!",
|
" - configuration.context: The provided value \"baz\" is not an absolute path!",
|
||||||
]
|
]
|
||||||
|
}, {
|
||||||
|
name: "missing stats option",
|
||||||
|
config: {
|
||||||
|
entry: "foo.js",
|
||||||
|
stats: {
|
||||||
|
foobar: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
test(e) {
|
||||||
|
e.message.should.startWith("Invalid configuration object.");
|
||||||
|
e.message.split("\n").slice(1)[0].should.be.eql(
|
||||||
|
" - configuration.stats should be one of these:"
|
||||||
|
);
|
||||||
|
}
|
||||||
}];
|
}];
|
||||||
testCases.forEach((testCase) => {
|
testCases.forEach((testCase) => {
|
||||||
it("should fail validation for " + testCase.name, () => {
|
it("should fail validation for " + testCase.name, () => {
|
||||||
|
|
@ -207,6 +221,12 @@ describe("Validation", () => {
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
if(!(e instanceof WebpackOptionsValidationError))
|
if(!(e instanceof WebpackOptionsValidationError))
|
||||||
throw e;
|
throw e;
|
||||||
|
|
||||||
|
if(testCase.test) {
|
||||||
|
testCase.test(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
e.message.should.startWith("Invalid configuration object.");
|
e.message.should.startWith("Invalid configuration object.");
|
||||||
e.message.split("\n").slice(1).should.be.eql(testCase.message);
|
e.message.split("\n").slice(1).should.be.eql(testCase.message);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
stats: {
|
stats: {
|
||||||
hash: false,
|
hash: false,
|
||||||
timing: false,
|
timings: true,
|
||||||
chunks: true,
|
chunks: true,
|
||||||
chunkModules: true,
|
chunkModules: true,
|
||||||
modules: false
|
modules: false
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
stats: {
|
stats: {
|
||||||
hash: false,
|
hash: false,
|
||||||
timing: false,
|
timings: true,
|
||||||
chunks: true,
|
chunks: true,
|
||||||
chunkModules: true,
|
chunkModules: true,
|
||||||
modules: false
|
modules: false
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue