* Gets chunk module id map. * @param {Chunk} chunk the chunk * @param {ModuleFilterPredicate} filterFn function used to filter modules * @param {boolean} includeAllChunks all chunks or only async chunks * @returns {ChunkModuleIdMap} chunk to module ids object
(chunk, filterFn, includeAllChunks = false)
| 822 | * @returns {ChunkModuleIdMap} chunk to module ids object |
| 823 | */ |
| 824 | getChunkModuleIdMap(chunk, filterFn, includeAllChunks = false) { |
| 825 | /** @type {ChunkModuleIdMap} */ |
| 826 | const chunkModuleIdMap = Object.create(null); |
| 827 | |
| 828 | for (const asyncChunk of includeAllChunks |
| 829 | ? chunk.getAllReferencedChunks() |
| 830 | : chunk.getAllAsyncChunks()) { |
| 831 | /** @type {ModuleId[] | undefined} */ |
| 832 | let array; |
| 833 | for (const module of this.getOrderedChunkModulesIterable( |
| 834 | asyncChunk, |
| 835 | compareModulesById(this) |
| 836 | )) { |
| 837 | if (filterFn(module)) { |
| 838 | if (array === undefined) { |
| 839 | array = []; |
| 840 | chunkModuleIdMap[/** @type {ChunkId} */ (asyncChunk.id)] = array; |
| 841 | } |
| 842 | const moduleId = /** @type {ModuleId} */ (this.getModuleId(module)); |
| 843 | array.push(moduleId); |
| 844 | } |
| 845 | } |
| 846 | } |
| 847 | |
| 848 | return chunkModuleIdMap; |
| 849 | } |
| 850 | |
| 851 | /** |
| 852 | * Gets chunk module rendered hash map. |
no test coverage detected