diff options
author | Florian Dold <florian.dold@gmail.com> | 2019-03-27 21:01:33 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2019-03-27 21:01:33 +0100 |
commit | cc97a4dd2a967e1c2273bd5f4c5f49a5bf2e2585 (patch) | |
tree | 92c5d88706a6ffc654d1b133618d357890e7096b /node_modules/webpack/lib/optimize/LimitChunkCountPlugin.js | |
parent | 3771b4d6b67b34c130f3a9a1a15f42deefdb2eda (diff) |
remove node_modules
Diffstat (limited to 'node_modules/webpack/lib/optimize/LimitChunkCountPlugin.js')
-rw-r--r-- | node_modules/webpack/lib/optimize/LimitChunkCountPlugin.js | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/node_modules/webpack/lib/optimize/LimitChunkCountPlugin.js b/node_modules/webpack/lib/optimize/LimitChunkCountPlugin.js deleted file mode 100644 index f38b942b1..000000000 --- a/node_modules/webpack/lib/optimize/LimitChunkCountPlugin.js +++ /dev/null @@ -1,66 +0,0 @@ -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ -"use strict"; - -const validateOptions = require("schema-utils"); -const schema = require("../../schemas/plugins/optimize/LimitChunkCountPlugin.json"); - -class LimitChunkCountPlugin { - constructor(options) { - validateOptions(schema, options || {}, "Limit Chunk Count Plugin"); - this.options = options || {}; - } - apply(compiler) { - const options = this.options; - compiler.hooks.compilation.tap("LimitChunkCountPlugin", compilation => { - compilation.hooks.optimizeChunksAdvanced.tap( - "LimitChunkCountPlugin", - chunks => { - const maxChunks = options.maxChunks; - if (!maxChunks) return; - if (maxChunks < 1) return; - if (chunks.length <= maxChunks) return; - - const sortedExtendedPairCombinations = chunks - .reduce((combinations, a, idx) => { - // create combination pairs - for (let i = 0; i < idx; i++) { - const b = chunks[i]; - combinations.push([b, a]); - } - return combinations; - }, []) - .map(pair => { - // extend combination pairs with size and integrated size - const a = pair[0].size(options); - const b = pair[1].size(options); - const ab = pair[0].integratedSize(pair[1], options); - return [a + b - ab, ab, pair[0], pair[1], a, b]; - }) - .filter(extendedPair => { - // filter pairs that do not have an integratedSize - // meaning they can NOT be integrated! - return extendedPair[1] !== false; - }) - .sort((a, b) => { - // sadly javascript does an inplace sort here - // sort them by size - const diff = b[0] - a[0]; - if (diff !== 0) return diff; - return a[1] - b[1]; - }); - - const pair = sortedExtendedPairCombinations[0]; - - if (pair && pair[2].integrate(pair[3], "limit")) { - chunks.splice(chunks.indexOf(pair[3]), 1); - return true; - } - } - ); - }); - } -} -module.exports = LimitChunkCountPlugin; |