allow all possible combinations with pattern

This commit is contained in:
Tobias Koppers 2019-10-18 14:58:50 +02:00
parent c81ffbef42
commit c1d1e91bd6
3 changed files with 19 additions and 38 deletions

View File

@ -299,22 +299,9 @@ export interface WebpackOptions {
[k: string]: any;
};
/**
* A developer tool to enhance debugging.
* A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
*/
devtool?:
| false
| "eval"
| "cheap-eval-source-map"
| "cheap-module-eval-source-map"
| "eval-source-map"
| "cheap-source-map"
| "cheap-module-source-map"
| "inline-cheap-source-map"
| "inline-cheap-module-source-map"
| "source-map"
| "inline-source-map"
| "hidden-source-map"
| "nosources-source-map";
devtool?: (false | "eval") | string;
/**
* The entry point(s) of the compilation.
*/

View File

@ -2381,21 +2381,15 @@
"type": "object"
},
"devtool": {
"description": "A developer tool to enhance debugging.",
"enum": [
false,
"eval",
"cheap-eval-source-map",
"cheap-module-eval-source-map",
"eval-source-map",
"cheap-source-map",
"cheap-module-source-map",
"inline-cheap-source-map",
"inline-cheap-module-source-map",
"source-map",
"inline-source-map",
"hidden-source-map",
"nosources-source-map"
"description": "A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).",
"oneOf": [
{
"enum": [false, "eval"]
},
{
"type": "string",
"pattern": "^(inline-|hidden-|eval-)?(nosources-)?(cheap-(module-)?)?source-map$"
}
]
},
"entry": {

View File

@ -220,8 +220,12 @@ describe("Validation", () => {
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration.devtool should be one of these:
false | \\"eval\\" | \\"cheap-eval-source-map\\" | \\"cheap-module-eval-source-map\\" | \\"eval-source-map\\" | \\"cheap-source-map\\" | \\"cheap-module-source-map\\" | \\"inline-cheap-source-map\\" | \\"inline-cheap-module-source-map\\" | \\"source-map\\" | \\"inline-source-map\\" | \\"hidden-source-map\\" | \\"nosources-source-map\\"
-> A developer tool to enhance debugging."
false | \\"eval\\" | string (should match pattern \\"^(inline-|hidden-|eval-)?(nosources-)?(cheap-(module-)?)?source-map$\\")
-> A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
Details:
* configuration.devtool should be one of these:
false | \\"eval\\"
* configuration.devtool should be a string (should match pattern \\"^(inline-|hidden-|eval-)?(nosources-)?(cheap-(module-)?)?source-map$\\")."
`)
);
@ -553,9 +557,7 @@ describe("Validation", () => {
msg =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration.devtool should be one of these:
false | \\"eval\\" | \\"cheap-eval-source-map\\" | \\"cheap-module-eval-source-map\\" | \\"eval-source-map\\" | \\"cheap-source-map\\" | \\"cheap-module-source-map\\" | \\"inline-cheap-source-map\\" | \\"inline-cheap-module-source-map\\" | \\"source-map\\" | \\"inline-source-map\\" | \\"hidden-source-map\\" | \\"nosources-source-map\\"
-> A developer tool to enhance debugging."
- configuration.devtool should match pattern \\"^(inline-|hidden-|eval-)?(nosources-)?(cheap-(module-)?)?source-map$\\"."
`)
);
@ -567,9 +569,7 @@ describe("Validation", () => {
msg =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration.devtool should be one of these:
false | \\"eval\\" | \\"cheap-eval-source-map\\" | \\"cheap-module-eval-source-map\\" | \\"eval-source-map\\" | \\"cheap-source-map\\" | \\"cheap-module-source-map\\" | \\"inline-cheap-source-map\\" | \\"inline-cheap-module-source-map\\" | \\"source-map\\" | \\"inline-source-map\\" | \\"hidden-source-map\\" | \\"nosources-source-map\\"
-> A developer tool to enhance debugging."
- configuration.devtool should match pattern \\"^(inline-|hidden-|eval-)?(nosources-)?(cheap-(module-)?)?source-map$\\"."
`)
);
});