* Gets chunk module rendered hash map. * @param {Chunk} chunk the chunk * @param {ModuleFilterPredicate} filterFn function used to filter modules * @param {number} hashLength length of the hash * @param {boolean} includeAllChunks all chunks or only async chunks * @returns {ChunkModuleHashM
( chunk, filterFn, hashLength = 0, includeAllChunks = false )
| 857 | * @returns {ChunkModuleHashMap} chunk to module id to module hash object |
| 858 | */ |
| 859 | getChunkModuleRenderedHashMap( |
| 860 | chunk, |
| 861 | filterFn, |
| 862 | hashLength = 0, |
| 863 | includeAllChunks = false |
| 864 | ) { |
| 865 | /** @type {ChunkModuleHashMap} */ |
| 866 | const chunkModuleHashMap = Object.create(null); |
| 867 | |
| 868 | for (const asyncChunk of includeAllChunks |
| 869 | ? chunk.getAllReferencedChunks() |
| 870 | : chunk.getAllAsyncChunks()) { |
| 871 | /** @type {IdToHashMap | undefined} */ |
| 872 | let idToHashMap; |
| 873 | for (const module of this.getOrderedChunkModulesIterable( |
| 874 | asyncChunk, |
| 875 | compareModulesById(this) |
| 876 | )) { |
| 877 | if (filterFn(module)) { |
| 878 | if (idToHashMap === undefined) { |
| 879 | /** @type {IdToHashMap} */ |
| 880 | idToHashMap = Object.create(null); |
| 881 | chunkModuleHashMap[/** @type {ChunkId} */ (asyncChunk.id)] = |
| 882 | /** @type {IdToHashMap} */ |
| 883 | (idToHashMap); |
| 884 | } |
| 885 | const moduleId = this.getModuleId(module); |
| 886 | const hash = this.getRenderedModuleHash(module, asyncChunk.runtime); |
| 887 | /** @type {IdToHashMap} */ |
| 888 | (idToHashMap)[/** @type {ModuleId} */ (moduleId)] = hashLength |
| 889 | ? hash.slice(0, hashLength) |
| 890 | : hash; |
| 891 | } |
| 892 | } |
| 893 | } |
| 894 | |
| 895 | return chunkModuleHashMap; |
| 896 | } |
| 897 | |
| 898 | /** |
| 899 | * Gets chunk condition map. |
no test coverage detected