UNPKG

1.08 kBTypeScriptView Raw
1import webpack_stats = require('./webpack_stats');
2/** A node in the package size tree
3 */
4export interface StatsNode {
5 /** Name of the package. ie. 'foo' from 'node_modules/foo' */
6 packageName: string;
7 /** Total size of files in this package, including its dependencies,
8 * in bytes.
9 */
10 size: number;
11 children: StatsNode[];
12}
13export interface RootStatsNode extends StatsNode {
14 bundleName?: string;
15}
16/** Walk a dependency size tree produced by dependencySizeTree() and output the
17 * size contributed to the bundle by each package's own code plus those
18 * of its dependencies.
19 */
20export declare function printDependencySizeTree(node: StatsNode, shareStats: boolean, depth?: number, outputFn?: (str: string) => void): void;
21/** Takes the output of 'webpack --json', and returns
22 * an array of trees of require()'d package names and sizes.
23 *
24 * There is one entry in the array for each bundle specified
25 * in the Webpack compilation.
26 */
27export declare function dependencySizeTree(stats: webpack_stats.WebpackStats): RootStatsNode[];