import { Plugin, Stats } from "webpack"; import webpack = require("webpack"); /** * Stats writer module. */ declare namespace StatsWriterPlugin { /** * transform function */ interface TransformFunc { ( data: { [key: string]: any; }, options?: TransformOptions, ): string | Promise; } interface TransformOptions { /** Current compiler instance */ compiler: webpack.compilation.Compilation; } interface Options { /** * output file name * @default 'stats.json' */ filename?: string | undefined; /** * fields of stats obj to keep * @default ['assetsByChunkName'] */ fields?: null | string[] | undefined; /** * stats config object or string preset * @default {} */ stats?: { [key: string]: any } | string | undefined; /** * transform stats obj * @default JSON.stringify() */ transform?: TransformFunc | undefined; } } declare class StatsWriterPlugin extends Plugin { constructor(opts?: StatsWriterPlugin.Options); emitStats(curCompiler: webpack.compilation.Compilation, callback: StatsWriterPlugin.TransformFunc): Promise; emitStats(curCompiler: webpack.compilation.Compilation): Promise; } export = StatsWriterPlugin;