@statoscope/webpack-model
Advanced tools
Comparing version 5.22.1-alpha.2 to 5.22.1-alpha.3
@@ -192,4 +192,4 @@ "use strict"; | ||
function prepareModule(module, context) { | ||
var _a, _b, _c; | ||
var _d; | ||
var _a, _b, _c, _d, _e; | ||
var _f, _g; | ||
if (context.indexes.modules.hasId(module.identifier)) { | ||
@@ -251,3 +251,3 @@ return; | ||
} | ||
(_c = (_d = module).modules) !== null && _c !== void 0 ? _c : (_d.modules = []); | ||
(_c = (_f = module).modules) !== null && _c !== void 0 ? _c : (_f.modules = []); | ||
const innerModules = (0, collector_1.collectRawModulesFromArray)(module.modules); | ||
@@ -257,2 +257,10 @@ const newInnerModules = []; | ||
newInnerModules.push(context.rawIndexes.modules.get(item.identifier)); | ||
(_d = item.chunks) !== null && _d !== void 0 ? _d : (item.chunks = []); | ||
if (!item.chunks.length) { | ||
item.chunks = module.chunks; | ||
for (const chunk of module.chunks) { | ||
(_e = (_g = chunk).modules) !== null && _e !== void 0 ? _e : (_g.modules = []); | ||
chunk.modules.push(item); | ||
} | ||
} | ||
} | ||
@@ -383,22 +391,19 @@ module.modules = newInnerModules; | ||
function linkChunks(context) { | ||
var _a; | ||
var _a, _b, _c, _d; | ||
const map = new Map(); | ||
for (const parentModule of context.indexes.modules.getAll()) { | ||
top: for (const dep of (_a = parentModule.deps) !== null && _a !== void 0 ? _a : []) { | ||
if (!dep.module) { | ||
continue; | ||
top: for (const childChunk of context.indexes.chunks.getAll()) { | ||
const childMapItem = getChunkMapItem(map, childChunk); | ||
for (const origin of childChunk.origins) { | ||
let targetModule = (_a = origin.resolvedModule) !== null && _a !== void 0 ? _a : null; | ||
if (!targetModule && origin.resolvedEntry) { | ||
targetModule = (_c = (_b = origin.resolvedEntry.data.dep) === null || _b === void 0 ? void 0 : _b.module) !== null && _c !== void 0 ? _c : null; | ||
} | ||
for (const parentChunk of parentModule.chunks) { | ||
if (dep.module.chunks.includes(parentChunk)) { | ||
continue top; | ||
} | ||
if (targetModule === null || targetModule === void 0 ? void 0 : targetModule.chunks.includes(childChunk)) { | ||
continue top; | ||
} | ||
for (const childChunk of dep.module.chunks) { | ||
const childMapItem = getChunkMapItem(map, childChunk); | ||
for (const parentChunk of parentModule.chunks) { | ||
const parentMapItem = getChunkMapItem(map, parentChunk); | ||
if (parentChunk !== childChunk) { | ||
parentMapItem.children.add(childChunk); | ||
childMapItem.parents.add(parentChunk); | ||
} | ||
for (const parentChunk of (_d = targetModule === null || targetModule === void 0 ? void 0 : targetModule.chunks) !== null && _d !== void 0 ? _d : []) { | ||
const parentMapItem = getChunkMapItem(map, parentChunk); | ||
if (parentChunk !== childChunk) { | ||
parentMapItem.children.add(childChunk); | ||
childMapItem.parents.add(parentChunk); | ||
} | ||
@@ -405,0 +410,0 @@ } |
{ | ||
"name": "@statoscope/webpack-model", | ||
"version": "5.22.1-alpha.2", | ||
"version": "5.22.1-alpha.3", | ||
"description": "This package contains helpers to process webpack stats", | ||
@@ -37,3 +37,3 @@ "main": "./dist/index.js", | ||
}, | ||
"gitHead": "b956994553e8ccab404cd720bda9feb2f07f6f7d" | ||
"gitHead": "77d94700b80336f56714cc98ada6851ab77fc9b8" | ||
} |
90918
2128