* @param {Dependency[]} dependencies all dependencies * @param {ChunkGraph} chunkGraph chunk graph * @returns {UserRequestsMap} map with user requests
(dependencies, chunkGraph)
| 750 | * @returns {UserRequestsMap} map with user requests |
| 751 | */ |
| 752 | getModuleDeferredAsyncDepsMap(dependencies, chunkGraph) { |
| 753 | const moduleGraph = chunkGraph.moduleGraph; |
| 754 | const comparator = compareModulesById(chunkGraph); |
| 755 | // if we filter first we get a new array |
| 756 | // therefore we don't need to create a clone of dependencies explicitly |
| 757 | // therefore the order of this is !important! |
| 758 | const sortedModules = dependencies |
| 759 | .map( |
| 760 | (dependency) => |
| 761 | /** @type {Module} */ (moduleGraph.getModule(dependency)) |
| 762 | ) |
| 763 | .filter(Boolean) |
| 764 | .sort(comparator); |
| 765 | /** @type {UserRequestsMap} */ |
| 766 | const map = Object.create(null); |
| 767 | for (const module of sortedModules) { |
| 768 | if (!(/** @type {BuildMeta} */ (module.buildMeta).async)) { |
| 769 | const id = /** @type {ModuleId} */ (chunkGraph.getModuleId(module)); |
| 770 | map[id] = Array.from( |
| 771 | getOutgoingAsyncModules(chunkGraph.moduleGraph, module), |
| 772 | (m) => chunkGraph.getModuleId(m) |
| 773 | ).filter((id) => id !== null); |
| 774 | } |
| 775 | } |
| 776 | return map; |
| 777 | } |
| 778 | |
| 779 | /** |
| 780 | * @param {false | UserRequestsMap} asyncDepsMap fake map |
no test coverage detected