@statoscope/webpack-model
Advanced tools
Comparing version 5.22.1-alpha.0 to 5.22.1-alpha.1
@@ -143,2 +143,3 @@ "use strict"; | ||
prepareChunks(processingContext); | ||
linkChunks(processingContext); | ||
prepareAssets(processingContext); | ||
@@ -354,5 +355,13 @@ extractPackages(normalized, processingContext); | ||
const origins = [...(0, collector_1.collectRawReasonsFromArray)(chunk.origins).values()]; | ||
origins.forEach((o) => (o.resolvedModule = o.moduleIdentifier | ||
? context.rawIndexes.modules.get(o.moduleIdentifier) | ||
: null)); | ||
origins.forEach((o) => { | ||
var _a; | ||
if (!o.moduleIdentifier) { | ||
o.resolvedEntryName = o.loc; | ||
o.resolvedEntry = | ||
(_a = context.indexes.entrypoints.get(o.loc)) !== null && _a !== void 0 ? _a : null; | ||
} | ||
o.resolvedModule = o.moduleIdentifier | ||
? context.rawIndexes.modules.get(o.moduleIdentifier) | ||
: null; | ||
}); | ||
chunk.origins = origins; | ||
@@ -369,2 +378,43 @@ } | ||
} | ||
function getChunkMapItem(map, chunk) { | ||
let mapItem = map.get(chunk); | ||
if (!mapItem) { | ||
mapItem = { | ||
children: new Set(), | ||
parents: new Set(), | ||
}; | ||
map.set(chunk, mapItem); | ||
} | ||
return mapItem; | ||
} | ||
function linkChunks(context) { | ||
var _a; | ||
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; | ||
} | ||
for (const parentChunk of parentModule.chunks) { | ||
if (dep.module.chunks.includes(parentChunk)) { | ||
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 [chunk, data] of map) { | ||
chunk.children = [...data.children]; | ||
chunk.parents = [...data.parents]; | ||
} | ||
} | ||
function prepareAssets(context) { | ||
@@ -371,0 +421,0 @@ var _a; |
@@ -356,3 +356,3 @@ "use strict"; | ||
entrypoint_getChunks(entrypoint) { | ||
return context.query(`data.chunks + data.chunks.[not isRuntime]..children`, entrypoint); | ||
return context.query(`data.chunks + data.chunks..children`, entrypoint); | ||
}, | ||
@@ -372,9 +372,9 @@ entrypoint_getInitialChunks(entrypoint) { | ||
entrypoint_getAssets(entrypoint) { | ||
return context.query(`(data.chunks + data.chunks.[not isRuntime]..children).files`, entrypoint); | ||
return context.query(`(data.chunks + data.chunks..children).files`, entrypoint); | ||
}, | ||
entrypoint_getInitialAssets(entrypoint) { | ||
return context.query(`(data.chunks + data.chunks.[not isRuntime]..children).[initial].files`, entrypoint); | ||
return context.query(`(data.chunks + data.chunks..children).[initial].files`, entrypoint); | ||
}, | ||
entrypoint_getAsyncAssets(entrypoint) { | ||
return context.query(`(data.chunks + data.chunks.[not isRuntime]..children).[not initial].files`, entrypoint); | ||
return context.query(`(data.chunks + data.chunks..children).[not initial].files`, entrypoint); | ||
}, | ||
@@ -381,0 +381,0 @@ }; |
{ | ||
"name": "@statoscope/webpack-model", | ||
"version": "5.22.1-alpha.0", | ||
"version": "5.22.1-alpha.1", | ||
"description": "This package contains helpers to process webpack stats", | ||
@@ -37,3 +37,3 @@ "main": "./dist/index.js", | ||
}, | ||
"gitHead": "fe6ea2b69d7c476112bcc9d69e88ee3dfc0df842" | ||
"gitHead": "30dacdc363a9169933e16c6d51056fb74664b121" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
90511
2131