MCPcopy
hub / github.com/webpack/webpack / update

Method update

lib/ProgressPlugin.js:354–423  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

352 };
353
354 const update = () => {
355 /** @type {string[]} */
356 const items = [];
357 const percentByModules =
358 doneModules /
359 Math.max(lastModulesCount || this.modulesCount || 1, modulesCount);
360 const percentByEntries =
361 doneEntries /
362 Math.max(lastEntriesCount || this.dependenciesCount || 1, entriesCount);
363 const percentByDependencies =
364 doneDependencies /
365 Math.max(lastDependenciesCount || 1, dependenciesCount);
366 /** @type {number} */
367 let percentageFactor;
368
369 switch (this.percentBy) {
370 case "entries":
371 percentageFactor = percentByEntries;
372 break;
373 case "dependencies":
374 percentageFactor = percentByDependencies;
375 break;
376 case "modules":
377 percentageFactor = percentByModules;
378 break;
379 default:
380 percentageFactor = median3(
381 percentByModules,
382 percentByEntries,
383 percentByDependencies
384 );
385 }
386
387 const percentage = 0.1 + percentageFactor * 0.55;
388
389 if (currentLoader) {
390 items.push(
391 `import loader ${contextify(
392 compiler.context,
393 currentLoader,
394 compiler.root
395 )}`
396 );
397 } else {
398 /** @type {string[]} */
399 const statItems = [];
400 if (showEntries) {
401 statItems.push(`${doneEntries}/${entriesCount} entries`);
402 }
403 if (showDependencies) {
404 statItems.push(
405 `${doneDependencies}/${dependenciesCount} dependencies`
406 );
407 }
408 if (showModules) {
409 statItems.push(`${doneModules}/${modulesCount} modules`);
410 }
411 if (showActiveModules) {

Callers

nothing calls this directly

Calls 3

median3Function · 0.85
handlerFunction · 0.50
pushMethod · 0.45

Tested by

no test coverage detected