MCPcopy
hub / github.com/webpack/webpack / _getOverwrittenModuleSourceTypes

Method _getOverwrittenModuleSourceTypes

lib/ChunkGraph.js:735–764  ·  view source on GitHub ↗

* Get overwritten module source types. * @param {Module} module module * @returns {SourceTypes | undefined} source types

(module)

Source from the content-addressed store, hash-verified

733 * @returns {SourceTypes | undefined} source types
734 */
735 _getOverwrittenModuleSourceTypes(module) {
736 let newSet = false;
737 /** @type {Set<SourceType> | undefined} */
738 let sourceTypes;
739 for (const chunk of this.getModuleChunksIterable(module)) {
740 const cgc = this._getChunkGraphChunk(chunk);
741 if (cgc.sourceTypesByModule === undefined) return;
742 const st = cgc.sourceTypesByModule.get(module);
743 if (st === undefined) return;
744 if (!sourceTypes) {
745 sourceTypes = /** @type {Set<SourceType>} */ (st);
746 } else if (!newSet) {
747 for (const type of st) {
748 if (!newSet) {
749 if (!sourceTypes.has(type)) {
750 newSet = true;
751 sourceTypes = new Set(sourceTypes);
752 sourceTypes.add(type);
753 }
754 } else {
755 sourceTypes.add(type);
756 }
757 }
758 } else {
759 for (const type of st) sourceTypes.add(type);
760 }
761 }
762
763 return sourceTypes;
764 }
765
766 /**
767 * Gets ordered chunk modules iterable.

Callers 2

getModuleSourceTypesMethod · 0.95

Calls 5

_getChunkGraphChunkMethod · 0.95
getMethod · 0.45
hasMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected