assignDepths(modules) {
		const moduleGraph = this.moduleGraph;

		/** @type {Set<Module>} */
		const queue = new Set(modules);
		// Track these in local variables so that queue only has one data type
		let nextDepthAt = queue.size;
		let depth = 0;

		let i = 0;
		for (const module of queue) {
			moduleGraph.setDepth(module, depth);
			// Some of these results come from cache, which speeds this up
			const connections = moduleGraph.getOutgoingConnectionsByModule(module);
			// connections will be undefined if there are no outgoing connections
			if (connections) {
				for (const refModule of connections.keys()) {
					if (refModule) queue.add(refModule);
				}
			}
			i++;
			// Since this is a breadth-first search, all modules added to the queue
			// while at depth N will be depth N+1
			if (i >= nextDepthAt) {
				depth++;
				nextDepthAt = queue.size;
			}
		}
	}
@param {Set<Module>} modules module to assign depth
@returns {void}