* Checks whether this module is accessible in chunk group. * @param {ChunkGraph} chunkGraph the chunk graph * @param {ChunkGroup} chunkGroup a chunk group * @param {Chunk=} ignoreChunk chunk to be ignored * @returns {boolean} true, if the module is accessible from "chunkGroup" when ignoring
(chunkGraph, chunkGroup, ignoreChunk)
| 866 | * @returns {boolean} true, if the module is accessible from "chunkGroup" when ignoring "ignoreChunk" |
| 867 | */ |
| 868 | isAccessibleInChunkGroup(chunkGraph, chunkGroup, ignoreChunk) { |
| 869 | const queue = new Set([chunkGroup]); |
| 870 | |
| 871 | // Check if module is accessible from all items of the queue |
| 872 | queueFor: for (const cg of queue) { |
| 873 | // 1. If module is in one of the chunks of the group we can continue checking the next items |
| 874 | // because it's accessible. |
| 875 | for (const chunk of cg.chunks) { |
| 876 | if (chunk !== ignoreChunk && chunkGraph.isModuleInChunk(this, chunk)) { |
| 877 | continue queueFor; |
| 878 | } |
| 879 | } |
| 880 | // 2. If the chunk group is initial, we can break here because it's not accessible. |
| 881 | if (chunkGroup.isInitial()) return false; |
| 882 | // 3. Enqueue all parents because it must be accessible from ALL parents |
| 883 | for (const parent of chunkGroup.parentsIterable) queue.add(parent); |
| 884 | } |
| 885 | // When we processed through the whole list and we didn't bailout, the module is accessible |
| 886 | return true; |
| 887 | } |
| 888 | |
| 889 | /** |
| 890 | * Checks whether this module contains the chunk. |
no test coverage detected