| 3006 | } |
| 3007 | |
| 3008 | _computeAffectedModulesWithChunkGraph() { |
| 3009 | const { moduleMemCaches } = this; |
| 3010 | if (!moduleMemCaches) return; |
| 3011 | const moduleMemCaches2 = (this.moduleMemCaches2 = new Map()); |
| 3012 | const { moduleGraph, chunkGraph } = this; |
| 3013 | const key = class="st">"memCache2"; |
| 3014 | let statUnchanged = 0; |
| 3015 | let statChanged = 0; |
| 3016 | let statNew = 0; |
| 3017 | /** |
| 3018 | * Compute references. |
| 3019 | * @param {Module} module module |
| 3020 | * @returns {References} references |
| 3021 | */ |
| 3022 | const computeReferences = (module) => { |
| 3023 | const id = /** @type {ModuleId} */ (chunkGraph.getModuleId(module)); |
| 3024 | /** @type {Map<Module, ModuleId> | undefined} */ |
| 3025 | let modules; |
| 3026 | /** @type {(ChunkId | null)[] | undefined} */ |
| 3027 | let blocks; |
| 3028 | const outgoing = moduleGraph.getOutgoingConnectionsByModule(module); |
| 3029 | if (outgoing !== undefined) { |
| 3030 | for (const m of outgoing.keys()) { |
| 3031 | if (!m) continue; |
| 3032 | if (modules === undefined) modules = new Map(); |
| 3033 | modules.set(m, /** @type {ModuleId} */ (chunkGraph.getModuleId(m))); |
| 3034 | } |
| 3035 | } |
| 3036 | if (module.blocks.length > 0) { |
| 3037 | blocks = []; |
| 3038 | const queue = [...module.blocks]; |
| 3039 | for (const block of queue) { |
| 3040 | const chunkGroup = chunkGraph.getBlockChunkGroup(block); |
| 3041 | if (chunkGroup) { |
| 3042 | for (const chunk of chunkGroup.chunks) { |
| 3043 | blocks.push(chunk.id); |
| 3044 | } |
| 3045 | } else { |
| 3046 | blocks.push(null); |
| 3047 | } |
| 3048 | class="cm">// eslint-disable-next-line prefer-spread |
| 3049 | queue.push.apply(queue, block.blocks); |
| 3050 | } |
| 3051 | } |
| 3052 | return { |
| 3053 | id, |
| 3054 | modules, |
| 3055 | blocks, |
| 3056 | sourceTypes: module.getReferencedSourceTypes() |
| 3057 | }; |
| 3058 | }; |
| 3059 | /** |
| 3060 | * Compares references. |
| 3061 | * @param {Module} module module |
| 3062 | * @param {object} references references |
| 3063 | * @param {string | number} references.id id |
| 3064 | * @param {Map<Module, string | number | undefined>=} references.modules modules |
| 3065 | * @param {(string | number | null)[]=} references.blocks blocks |