feat: cli flags

This commit is contained in:
evilebottnawi 2020-03-06 18:45:51 +03:00 committed by Tobias Koppers
parent 9c4e18bdc7
commit 56f5d1100b
2 changed files with 112 additions and 23 deletions

View File

@ -61,13 +61,12 @@ module.exports = {
"The base directory (absolute path!) for resolving the `entry` option. If `output.pathinfo` is set, the included pathinfo is shortened to this directory." "The base directory (absolute path!) for resolving the `entry` option. If `output.pathinfo` is set, the included pathinfo is shortened to this directory."
}, },
devtool: { devtool: {
types: [null], types: ["boolean", "string"]
description:
"A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map)."
}, },
entry: { entry: {
types: [null], types: ["string"],
description: "A static entry description" description:
"The string is resolved to a module which is loaded upon startup."
}, },
"experiments-asset": { "experiments-asset": {
types: ["boolean"], types: ["boolean"],
@ -276,9 +275,10 @@ module.exports = {
description: "Remove chunks which are empty" description: "Remove chunks which are empty"
}, },
"optimization-runtime-chunk": { "optimization-runtime-chunk": {
types: [null], types: ["boolean", "string"]
description: },
"Create an additional chunk which contains only the webpack runtime and chunk hash maps" "optimization-runtime-chunk-name": {
types: ["string"]
}, },
"optimization-side-effects": { "optimization-side-effects": {
types: ["boolean"], types: ["boolean"],
@ -286,9 +286,80 @@ module.exports = {
"Skip over modules which are flagged to contain no side effects when exports are not used" "Skip over modules which are flagged to contain no side effects when exports are not used"
}, },
"optimization-split-chunks": { "optimization-split-chunks": {
types: [null], types: ["boolean"]
},
"optimization-split-chunks-automatic-name-delimiter": {
types: ["string"],
description: "Sets the name delimiter for created chunks"
},
"optimization-split-chunks-chunks": {
types: ["string"]
},
"optimization-split-chunks-fallback-cache-group-automatic-name-delimiter": {
types: ["string"],
description: "Sets the name delimiter for created chunks"
},
"optimization-split-chunks-fallback-cache-group-max-async-size": {
types: ["number"],
description: "Size of the javascript part of the chunk"
},
"optimization-split-chunks-fallback-cache-group-max-initial-size": {
types: ["number"],
description: "Size of the javascript part of the chunk"
},
"optimization-split-chunks-fallback-cache-group-max-size": {
types: ["number"],
description: "Size of the javascript part of the chunk"
},
"optimization-split-chunks-fallback-cache-group-min-size": {
types: ["number"],
description: "Size of the javascript part of the chunk"
},
"optimization-split-chunks-filename": {
types: ["string"]
},
"optimization-split-chunks-hide-path-info": {
types: ["boolean"],
description: description:
"Optimize duplication and caching by splitting chunks by shared modules and cache group" "Prevents exposing path info when creating names for parts splitted by maxSize"
},
"optimization-split-chunks-max-async-requests": {
types: ["number"],
description:
"Maximum number of requests which are accepted for on-demand loading"
},
"optimization-split-chunks-max-async-size": {
types: ["number"],
description: "Size of the javascript part of the chunk"
},
"optimization-split-chunks-max-initial-requests": {
types: ["number"],
description:
"Maximum number of initial chunks which are accepted for an entry point"
},
"optimization-split-chunks-max-initial-size": {
types: ["number"],
description: "Size of the javascript part of the chunk"
},
"optimization-split-chunks-max-size": {
types: ["number"],
description: "Size of the javascript part of the chunk"
},
"optimization-split-chunks-min-chunks": {
types: ["number"],
description:
"Minimum number of times a module has to be duplicated until it's considered for splitting"
},
"optimization-split-chunks-min-remaining-size": {
types: ["number"],
description: "Size of the javascript part of the chunk"
},
"optimization-split-chunks-min-size": {
types: ["number"],
description: "Size of the javascript part of the chunk"
},
"optimization-split-chunks-name": {
types: ["boolean", "string"]
}, },
"optimization-used-exports": { "optimization-used-exports": {
types: ["boolean"], types: ["boolean"],
@ -543,17 +614,13 @@ module.exports = {
description: "Capture timing information for each module." description: "Capture timing information for each module."
}, },
"records-input-path": { "records-input-path": {
types: [null], types: ["boolean", "string"]
description: "Store compiler state to a json file."
}, },
"records-output-path": { "records-output-path": {
types: [null], types: ["boolean", "string"]
description: "Load compiler state from a json file."
}, },
"records-path": { "records-path": {
types: [null], types: ["boolean", "string"]
description:
"Store/Load compiler state from/to a json file. This will result in persistent ids of modules and chunks. An absolute path is expected. `recordsPath` is used for `recordsInputPath` and `recordsOutputPath` if they left undefined."
}, },
"resolve-cache": { "resolve-cache": {
types: ["boolean"], types: ["boolean"],
@ -667,8 +734,32 @@ module.exports = {
description: "sort the chunks by that field" description: "sort the chunks by that field"
}, },
"stats-colors": { "stats-colors": {
types: [null], types: ["boolean"],
description: "Enables/Disables colorful output" description: "`webpack --colors` equivalent"
},
"stats-colors-bold": {
types: ["string"],
description: "Custom color for bold text"
},
"stats-colors-cyan": {
types: ["string"],
description: "Custom color for cyan text"
},
"stats-colors-green": {
types: ["string"],
description: "Custom color for green text"
},
"stats-colors-magenta": {
types: ["string"],
description: "Custom color for magenta text"
},
"stats-colors-red": {
types: ["string"],
description: "Custom color for red text"
},
"stats-colors-yellow": {
types: ["string"],
description: "Custom color for yellow text"
}, },
"stats-context": { "stats-context": {
types: ["string"], types: ["string"],

View File

@ -77,12 +77,10 @@ function traverse(schemaPart, schemaPath = "") {
return; return;
} }
if (schemaPart.anyOf) { if (schemaPart.oneOf || schemaPart.anyOf) {
const items = schemaPart.oneOf || schemaPart.anyOf; const items = schemaPart.oneOf || schemaPart.anyOf;
items.forEach((item, index) => items.forEach((item, index) => traverse(items[index], schemaPath));
traverse(schemaPart.anyOf[index], schemaPath)
);
return; return;
} }