MCPcopy
hub / github.com/webpack/webpack / assignDepth

Method assignDepth

lib/Compilation.js:4494–4524  ·  view source on GitHub ↗

* Processes the provided module. * @deprecated * @param {Module} module module to assign depth * @returns {void}

(module)

Source from the content-addressed store, hash-verified

4492 * @returns {void}
4493 */
4494 assignDepth(module) {
4495 const moduleGraph = this.moduleGraph;
4496
4497 const queue = new Set([module]);
4498 /** @type {number} */
4499 let depth;
4500
4501 moduleGraph.setDepth(module, 0);
4502
4503 /**
4504 * Processes the provided module.
4505 * @param {Module} module module for processing
4506 * @returns {void}
4507 */
4508 const processModule = (module) => {
4509 if (!moduleGraph.setDepthIfLower(module, depth)) return;
4510 queue.add(module);
4511 };
4512
4513 for (module of queue) {
4514 queue.delete(module);
4515 depth = /** @type {number} */ (moduleGraph.getDepth(module)) + 1;
4516
4517 for (const connection of moduleGraph.getOutgoingConnections(module)) {
4518 const refModule = connection.module;
4519 if (refModule) {
4520 processModule(refModule);
4521 }
4522 }
4523 }
4524 }
4525
4526 /**
4527 * Assigns depth values to the provided modules.

Callers

nothing calls this directly

Calls 4

setDepthMethod · 0.80
getDepthMethod · 0.80
deleteMethod · 0.45

Tested by

no test coverage detected