| | |
| | | |
| | | class FlagIncludedChunksPlugin { |
| | | /** |
| | | * Apply the plugin |
| | | * Applies the plugin by registering its hooks on the compiler. |
| | | * @param {Compiler} compiler the compiler instance |
| | | * @returns {void} |
| | | */ |
| | |
| | | |
| | | // precalculate the modulo values for each bit |
| | | const modulo = 1 / (1 / modulesCount) ** (1 / 31); |
| | | const modulos = Array.from({ length: 31 }, (x, i) => (modulo ** i) | 0); |
| | | /** @type {number[]} */ |
| | | const modulos = Array.from( |
| | | { length: 31 }, |
| | | /** |
| | | * Handles the callback logic for this hook. |
| | | * @param {number} x x |
| | | * @param {number} i i |
| | | * @returns {number} result |
| | | */ |
| | | (x, i) => (modulo ** i) | 0 |
| | | ); |
| | | |
| | | // iterate all modules to generate bit values |
| | | let i = 0; |
| | |
| | | (chunkModulesHash.get(chunkA)); |
| | | const chunkAModulesCount = chunkGraph.getNumberOfChunkModules(chunkA); |
| | | if (chunkAModulesCount === 0) continue; |
| | | /** @type {undefined | Module} */ |
| | | let bestModule; |
| | | for (const module of chunkGraph.getChunkModulesIterable(chunkA)) { |
| | | if ( |