MCPcopy
hub / github.com/webpack/webpack / getChunkMaps

Method getChunkMaps

lib/Chunk.js:474–503  ·  view source on GitHub ↗

* Returns the chunk map information. * @deprecated * @param {boolean} realHash whether the full hash or the rendered hash is to be used * @returns {ChunkMaps} the chunk map information

(realHash)

Source from the content-addressed store, hash-verified

472 * @returns {ChunkMaps} the chunk map information
473 */
474 getChunkMaps(realHash) {
475 /** @type {Record<ChunkId, string>} */
476 const chunkHashMap = Object.create(null);
477 /** @type {Record<string, Record<ChunkId, string>>} */
478 const chunkContentHashMap = Object.create(null);
479 /** @type {Record<ChunkId, string>} */
480 const chunkNameMap = Object.create(null);
481
482 for (const chunk of this.getAllAsyncChunks()) {
483 const id = /** @type {ChunkId} */ (chunk.id);
484 chunkHashMap[id] =
485 /** @type {string} */
486 (realHash ? chunk.hash : chunk.renderedHash);
487 for (const key of Object.keys(chunk.contentHash)) {
488 if (!chunkContentHashMap[key]) {
489 chunkContentHashMap[key] = Object.create(null);
490 }
491 chunkContentHashMap[key][id] = chunk.contentHash[key];
492 }
493 if (chunk.name) {
494 chunkNameMap[id] = chunk.name;
495 }
496 }
497
498 return {
499 hash: chunkHashMap,
500 contentHash: chunkContentHashMap,
501 name: chunkNameMap
502 };
503 }
504 // BACKWARD-COMPAT END
505
506 /**

Callers

nothing calls this directly

Calls 3

getAllAsyncChunksMethod · 0.95
keysMethod · 0.65
createMethod · 0.45

Tested by

no test coverage detected