MCPcopy
hub / github.com/webpack/webpack / finish

Method finish

lib/Compilation.js:3193–3471  ·  view source on GitHub ↗

* Processes the provided callback. * @param {Callback} callback callback

(callback)

Source from the content-addressed store, hash-verified

3191 * @param {Callback} callback callback
3192 */
3193 finish(callback) {
3194 this.factorizeQueue.clear();
3195 if (this.profile) {
3196 this.logger.time("finish module profiles");
3197
3198 const ParallelismFactorCalculator = require("./util/ParallelismFactorCalculator");
3199
3200 const p = new ParallelismFactorCalculator();
3201 const moduleGraph = this.moduleGraph;
3202 /** @type {Map<Module, ModuleProfile>} */
3203 const modulesWithProfiles = new Map();
3204 for (const module of this.modules) {
3205 const profile = moduleGraph.getProfile(module);
3206 if (!profile) continue;
3207 modulesWithProfiles.set(module, profile);
3208 p.range(
3209 profile.buildingStartTime,
3210 profile.buildingEndTime,
3211 (f) => (profile.buildingParallelismFactor = f)
3212 );
3213 p.range(
3214 profile.factoryStartTime,
3215 profile.factoryEndTime,
3216 (f) => (profile.factoryParallelismFactor = f)
3217 );
3218 p.range(
3219 profile.integrationStartTime,
3220 profile.integrationEndTime,
3221 (f) => (profile.integrationParallelismFactor = f)
3222 );
3223 p.range(
3224 profile.storingStartTime,
3225 profile.storingEndTime,
3226 (f) => (profile.storingParallelismFactor = f)
3227 );
3228 p.range(
3229 profile.restoringStartTime,
3230 profile.restoringEndTime,
3231 (f) => (profile.restoringParallelismFactor = f)
3232 );
3233 if (profile.additionalFactoryTimes) {
3234 for (const { start, end } of profile.additionalFactoryTimes) {
3235 const influence = (end - start) / profile.additionalFactories;
3236 p.range(
3237 start,
3238 end,
3239 (f) =>
3240 (profile.additionalFactoriesParallelismFactor += f * influence)
3241 );
3242 }
3243 }
3244 }
3245 p.calculate();
3246
3247 const logger = this.getLogger("webpack.Compilation.ModuleProfile");
3248 // Avoid coverage problems due indirect changes
3249 /**
3250 * Processes the provided value.

Callers 1

compileMethod · 0.80

Calls 15

rangeMethod · 0.95
calculateMethod · 0.95
getLoggerMethod · 0.95
timeMethod · 0.80
getProfileMethod · 0.80
timeEndMethod · 0.80
freezeMethod · 0.80
unfreezeMethod · 0.80
requireFunction · 0.50

Tested by

no test coverage detected