MCPcopy
hub / github.com/webpack/webpack / _getModulesWithInfo

Method _getModulesWithInfo

lib/optimize/ConcatenatedModule.js:2496–2584  ·  view source on GitHub ↗

* @param {ModuleGraph} moduleGraph the module graph * @param {RuntimeSpec} runtime the runtime * @returns {[ModuleInfoOrReference[], ModuleToInfoMap]} module info items

(moduleGraph, runtime)

Source from the content-addressed store, hash-verified

2494 * @returns {[ModuleInfoOrReference[], ModuleToInfoMap]} module info items
2495 */
2496 _getModulesWithInfo(moduleGraph, runtime) {
2497 const orderedConcatenationList = this._createConcatenationList(
2498 this.rootModule,
2499 this._modules,
2500 runtime,
2501 moduleGraph
2502 );
2503 /** @type {ModuleToInfoMap} */
2504 const map = new Map();
2505 const list = orderedConcatenationList.map((info, index) => {
2506 let item = map.get(info.module);
2507 if (item === undefined) {
2508 switch (info.type) {
2509 case "concatenated":
2510 item = {
2511 type: "concatenated",
2512 module: info.module,
2513 index,
2514 ast: undefined,
2515 chunkInitFragments: undefined,
2516 internalSource: undefined,
2517 runtimeRequirements: undefined,
2518 source: undefined,
2519 globalScope: undefined,
2520 moduleScope: undefined,
2521 internalNames: new Map(),
2522 exportMap: undefined,
2523 rawExportMap: undefined,
2524 namespaceExportSymbol: undefined,
2525 namespaceObjectName: undefined,
2526 escapeNamespaceObjectName: undefined,
2527 interopNamespaceObjectUsed: false,
2528 interopNamespaceObjectName: undefined,
2529 interopNamespaceObject2Used: false,
2530 interopNamespaceObject2Name: undefined,
2531 interopDefaultAccessUsed: false,
2532 interopDefaultAccessName: undefined,
2533 concatenationScope: undefined,
2534 exportsTypeStrict: undefined,
2535 exportsTypeNonStrict: undefined
2536 };
2537 break;
2538 case "external":
2539 item = {
2540 type: "external",
2541 module: info.module,
2542 runtimeCondition: info.runtimeCondition,
2543 nonDeferAccess: info.nonDeferAccess,
2544 index,
2545 name: undefined,
2546 escapeNamespaceObjectName: undefined,
2547 deferredName: undefined,
2548 interopNamespaceObjectUsed: false,
2549 interopNamespaceObjectName: undefined,
2550 interopNamespaceObject2Used: false,
2551 interopNamespaceObject2Name: undefined,
2552 interopDefaultAccessUsed: false,
2553 interopDefaultAccessName: undefined,

Callers 1

codeGenerationMethod · 0.95

Calls 4

isDeferredMethod · 0.80
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected