webpack-bundle-stats-plugin
Advanced tools
Comparing version 0.2.1 to 0.3.0
@@ -8,10 +8,18 @@ "use strict"; | ||
webpackBundleStatsPluginVersion: version, | ||
assets: getAssets(compilation), | ||
chunkGroups: getChunkGroups(compilation), | ||
chunks: getChunks(compilation), | ||
modules: getModules(compilation), | ||
}; | ||
} | ||
exports.getStatsFromCompilation = getStatsFromCompilation; | ||
function getAssets(compilation) { | ||
const assets = {}; | ||
for (let assetName of compilation.assetsInfo.keys()) { | ||
assets[assetName] = { size: compilation.assetsInfo.get(assetName).size }; | ||
} | ||
return assets; | ||
} | ||
function getChunkGroups(compilation) { | ||
return compilation.chunkGroups.map(cg => ({ | ||
chunkGroupType: cg.constructor.name, | ||
id: cg.id, | ||
@@ -28,10 +36,5 @@ name: cg.name || undefined, | ||
files: [...c.files], | ||
modules: compilation.chunkGraph | ||
.getChunkModules(c) | ||
.map(m => m.readableIdentifier(compilation.requestShortener)), | ||
modules: compilation.chunkGraph.getChunkModules(c).map(m => getModule(m, compilation)), | ||
})); | ||
} | ||
function getModules(compilation) { | ||
return [...compilation.modules].map(m => getModule(m, compilation)); | ||
} | ||
function getModule(m, compilation) { | ||
@@ -38,0 +41,0 @@ var _a; |
export interface BundleStats { | ||
webpackBundleStatsPluginVersion: string; | ||
assets: Record<string, Asset>; | ||
chunkGroups: ChunkGroup[]; | ||
chunks: Chunk[]; | ||
modules: Module[]; | ||
} | ||
export interface Asset { | ||
size: number; | ||
} | ||
export interface ChunkGroup { | ||
chunkGroupType: string; | ||
id: string; | ||
@@ -17,3 +21,3 @@ name?: string; | ||
files: string[]; | ||
modules: string[]; | ||
modules: Module[]; | ||
} | ||
@@ -20,0 +24,0 @@ export declare type ChunkId = string | number; |
{ | ||
"name": "webpack-bundle-stats-plugin", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"description": "Export internal bundling details from Webpack", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
7754
139