(block)
| 789 | * @returns {void} |
| 790 | */ |
| 791 | const processBlock = (block) => { |
| 792 | statProcessedBlocks++; |
| 793 | // get prepared block info |
| 794 | const blockModules = getBlockModules(block, chunkGroupInfo.runtime); |
| 795 | |
| 796 | if (blockModules !== undefined) { |
| 797 | const minAvailableModules = |
| 798 | /** @type {bigint} */ |
| 799 | (chunkGroupInfo.minAvailableModules); |
| 800 | // Buffer items because order need to be reversed to get indices correct |
| 801 | // Traverse all referenced modules |
| 802 | for (let i = 0, len = blockModules.length; i < len; i += 3) { |
| 803 | const refModule = /** @type {Module} */ (blockModules[i]); |
| 804 | // For single comparisons this might be cheaper |
| 805 | const isModuleInChunk = chunkGraph.isModuleInChunk(refModule, chunk); |
| 806 | |
| 807 | if (isModuleInChunk) { |
| 808 | // skip early if already connected |
| 809 | continue; |
| 810 | } |
| 811 | |
| 812 | const activeState = /** @type {ConnectionState} */ ( |
| 813 | blockModules[i + 1] |
| 814 | ); |
| 815 | if (activeState !== true) { |
| 816 | const connections = /** @type {ModuleGraphConnection[]} */ ( |
| 817 | blockModules[i + 2] |
| 818 | ); |
| 819 | skipConnectionBuffer.push([refModule, connections]); |
| 820 | // We skip inactive connections |
| 821 | if (activeState === false) continue; |
| 822 | } else if ( |
| 823 | // assigning ordinals lazily here keeps masks small |
| 824 | isOrdinalSetInMask(minAvailableModules, getModuleOrdinal(refModule)) |
| 825 | ) { |
| 826 | // already in parent chunks, skip it for now |
| 827 | skipBuffer.push(refModule); |
| 828 | continue; |
| 829 | } |
| 830 | // enqueue, then add and enter to be in the correct order |
| 831 | // this is relevant with circular dependencies |
| 832 | queueBuffer.push({ |
| 833 | action: activeState === true ? ADD_AND_ENTER_MODULE : PROCESS_BLOCK, |
| 834 | block: refModule, |
| 835 | module: refModule, |
| 836 | chunk, |
| 837 | chunkGroup, |
| 838 | chunkGroupInfo |
| 839 | }); |
| 840 | } |
| 841 | // Add buffered items in reverse order |
| 842 | if (skipConnectionBuffer.length > 0) { |
| 843 | let { skippedModuleConnections } = chunkGroupInfo; |
| 844 | if (skippedModuleConnections === undefined) { |
| 845 | chunkGroupInfo.skippedModuleConnections = skippedModuleConnections = |
| 846 | new Set(); |
| 847 | } |
| 848 | for (let i = skipConnectionBuffer.length - 1; i >= 0; i--) { |
no test coverage detected