MCPcopy
hub / github.com/webpack/webpack / getChunkModuleMaps

Method getChunkModuleMaps

lib/Chunk.js:411–450  ·  view source on GitHub ↗

* Gets chunk module maps. * @deprecated * @param {ModuleFilterPredicate} filterFn function used to filter modules * @returns {ChunkModuleMaps} module map information

(filterFn)

Source from the content-addressed store, hash-verified

409 * @returns {ChunkModuleMaps} module map information
410 */
411 getChunkModuleMaps(filterFn) {
412 const chunkGraph = ChunkGraph.getChunkGraphForChunk(
413 this,
414 "Chunk.getChunkModuleMaps",
415 "DEP_WEBPACK_CHUNK_GET_CHUNK_MODULE_MAPS"
416 );
417 /** @type {ChunkModuleIdMap} */
418 const chunkModuleIdMap = Object.create(null);
419 /** @type {chunkModuleHashMap} */
420 const chunkModuleHashMap = Object.create(null);
421
422 for (const asyncChunk of this.getAllAsyncChunks()) {
423 /** @type {ChunkId[] | undefined} */
424 let array;
425 for (const module of chunkGraph.getOrderedChunkModulesIterable(
426 asyncChunk,
427 compareModulesById(chunkGraph)
428 )) {
429 if (filterFn(module)) {
430 if (array === undefined) {
431 array = [];
432 chunkModuleIdMap[/** @type {ChunkId} */ (asyncChunk.id)] = array;
433 }
434 const moduleId =
435 /** @type {ModuleId} */
436 (chunkGraph.getModuleId(module));
437 array.push(moduleId);
438 chunkModuleHashMap[moduleId] = chunkGraph.getRenderedModuleHash(
439 module,
440 undefined
441 );
442 }
443 }
444 }
445
446 return {
447 id: chunkModuleIdMap,
448 hash: chunkModuleHashMap
449 };
450 }
451
452 /**
453 * Checks whether this chunk contains a matching module in the graph.

Callers 1

webpack.config.jsFile · 0.80

Calls 8

getAllAsyncChunksMethod · 0.95
compareModulesByIdFunction · 0.85
getChunkGraphForChunkMethod · 0.80
getModuleIdMethod · 0.80
getRenderedModuleHashMethod · 0.80
createMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected