MCPcopy
hub / github.com/webpack/webpack / getIntegratedChunksSize

Method getIntegratedChunksSize

lib/ChunkGraph.js:1019–1038  ·  view source on GitHub ↗

* Gets integrated chunks size. * @param {Chunk} chunkA chunk * @param {Chunk} chunkB chunk * @param {ChunkSizeOptions} options options object * @returns {number} total size of the chunk or false if chunks can't be integrated

(chunkA, chunkB, options = {})

Source from the content-addressed store, hash-verified

1017 * @returns {number} total size of the chunk or false if chunks can't be integrated
1018 */
1019 getIntegratedChunksSize(chunkA, chunkB, options = {}) {
1020 const cgcA = this._getChunkGraphChunk(chunkA);
1021 const cgcB = this._getChunkGraphChunk(chunkB);
1022 const allModules = new Set(cgcA.modules);
1023 for (const m of cgcB.modules) allModules.add(m);
1024 const modulesSize = getModulesSize(allModules);
1025 const chunkOverhead =
1026 typeof options.chunkOverhead === "number" ? options.chunkOverhead : 10000;
1027 const entryChunkMultiplicator =
1028 typeof options.entryChunkMultiplicator === "number"
1029 ? options.entryChunkMultiplicator
1030 : 10;
1031 return (
1032 chunkOverhead +
1033 modulesSize *
1034 (chunkA.canBeInitial() || chunkB.canBeInitial()
1035 ? entryChunkMultiplicator
1036 : 1)
1037 );
1038 }
1039
1040 /**
1041 * Checks whether it can chunks be integrated.

Callers 4

integratedSizeMethod · 0.80
applyMethod · 0.80
applyMethod · 0.80
applyMethod · 0.80

Calls 4

_getChunkGraphChunkMethod · 0.95
getModulesSizeFunction · 0.85
canBeInitialMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected