MCPcopy
hub / github.com/webpack/webpack / iteratorBlock

Function iteratorBlock

lib/buildChunkGraph.js:564–784  ·  view source on GitHub ↗
(b)

Source from the content-addressed store, hash-verified

562 * @returns {void}
563 */
564 const iteratorBlock = (b) => {
565 // 1. We create a chunk group with single chunk in it for this Block
566 // but only once (blockChunkGroups map)
567 /** @type {ChunkGroupInfo | undefined} */
568 let cgi = blockChunkGroups.get(b);
569 /** @type {ChunkGroup | undefined} */
570 let c;
571 /** @type {Entrypoint | undefined} */
572 let entrypoint;
573 /** @type {Module | null} */
574 const depModule = moduleGraph.getModule(b.dependencies[0]);
575 const entryOptions = b.groupOptions && b.groupOptions.entryOptions;
576 if (cgi === undefined) {
577 const chunkName = (b.groupOptions && b.groupOptions.name) || b.chunkName;
578 if (entryOptions) {
579 cgi = namedAsyncEntrypoints.get(/** @type {string} */ (chunkName));
580 if (!cgi && !b.circular && depModule) {
581 cgi = depModuleAsyncEntrypoints.get(depModule);
582 }
583 if (!cgi) {
584 entrypoint = compilation.addAsyncEntrypoint(
585 entryOptions,
586 module,
587 /** @type {DependencyLocation} */ (b.loc),
588 /** @type {string} */ (b.request)
589 );
590 maskByChunk.set(entrypoint.chunks[0], ZERO_BIGINT);
591 entrypoint.index = nextChunkGroupIndex++;
592 cgi = {
593 depModule,
594 circular: b.circular,
595 chunkGroup: entrypoint,
596 initialized: false,
597 runtime:
598 entrypoint.options.runtime ||
599 /** @type {string | undefined} */ (entrypoint.name),
600 minAvailableModules: ZERO_BIGINT,
601 availableModulesToBeMerged: [],
602 skippedItems: undefined,
603 resultingAvailableModules: undefined,
604 children: undefined,
605 availableSources: undefined,
606 availableChildren: undefined,
607 preOrderIndex: 0,
608 postOrderIndex: 0,
609 chunkLoading:
610 entryOptions.chunkLoading !== undefined
611 ? entryOptions.chunkLoading !== false
612 : chunkGroupInfo.chunkLoading,
613 asyncChunks:
614 entryOptions.asyncChunks !== undefined
615 ? entryOptions.asyncChunks
616 : chunkGroupInfo.asyncChunks
617 };
618 chunkGroupInfoMap.set(
619 entrypoint,
620 /** @type {ChunkGroupInfo} */
621 (cgi)

Callers 2

processBlockFunction · 0.85
processEntryBlockFunction · 0.85

Calls 12

addOriginMethod · 0.80
addChunkInGroupMethod · 0.80
keysMethod · 0.65
getMethod · 0.45
getModuleMethod · 0.45
addAsyncEntrypointMethod · 0.45
setMethod · 0.45
pushMethod · 0.45
addMethod · 0.45
isInitialMethod · 0.45
addOptionsMethod · 0.45

Tested by

no test coverage detected