MCPcopy
hub / github.com/webpack/webpack / _flagModulesForDependencyReporting

Method _flagModulesForDependencyReporting

lib/Compilation.js:3146–3187  ·  view source on GitHub ↗

* Assigns a fresh dependency report cache token to every module whose * dependency errors/warnings could have changed since the previous * compilation: built modules and their (transitive) parents. * @private * @param {Set<Module>} modules modules * @returns {void}

(modules)

Source from the content-addressed store, hash-verified

3144 * @returns {void}
3145 */
3146 _flagModulesForDependencyReporting(modules) {
3147 /** @type {DependencyReportCacheToken} */
3148 const token = {};
3149 const { moduleGraph, builtModules } = this;
3150 /** @type {Set<Module>} */
3151 const updatedModules = new Set();
3152 for (const module of modules) {
3153 if (
3154 builtModules.has(module) ||
3155 !dependencyReportCacheTokens.has(module)
3156 ) {
3157 updatedModules.add(module);
3158 }
3159 }
3160 // skip the parent walk when everything is updated anyway (initial build)
3161 if (updatedModules.size !== modules.size) {
3162 /** @type {Set<Module>} */
3163 const directOnlyUpdatedModules = new Set();
3164 for (const module of updatedModules) {
3165 for (const [
3166 referencingModule,
3167 connections
3168 ] of moduleGraph.getIncomingConnectionsByOriginModule(module)) {
3169 if (!referencingModule) continue;
3170 if (updatedModules.has(referencingModule)) continue;
3171 const type = reduceAffectType(connections);
3172 if (!type) continue;
3173 if (type === true) {
3174 directOnlyUpdatedModules.add(referencingModule);
3175 } else {
3176 updatedModules.add(referencingModule);
3177 }
3178 }
3179 }
3180 for (const module of directOnlyUpdatedModules) {
3181 updatedModules.add(module);
3182 }
3183 }
3184 for (const module of updatedModules) {
3185 dependencyReportCacheTokens.set(module, token);
3186 }
3187 }
3188
3189 /**
3190 * Processes the provided callback.

Callers 1

finishMethod · 0.95

Calls 5

reduceAffectTypeFunction · 0.85
hasMethod · 0.45
addMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected