| | |
| | | const identifierUtils = require("./util/identifier"); |
| | | |
| | | /** @typedef {import("../declarations/WebpackOptions").StatsOptions} StatsOptions */ |
| | | /** @typedef {import("../declarations/WebpackOptions").StatsValue} StatsValue */ |
| | | /** @typedef {import("./Compilation").CreateStatsOptionsContext} CreateStatsOptionsContext */ |
| | | /** @typedef {import("./Compilation").NormalizedStatsOptions} NormalizedStatsOptions */ |
| | | /** @typedef {import("./Stats")} Stats */ |
| | |
| | | /** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsError} StatsError */ |
| | | |
| | | /** |
| | | * Returns indent. |
| | | * @param {string} str string |
| | | * @param {string} prefix pref |
| | | * @returns {string} indent |
| | |
| | | return prefix + rem; |
| | | }; |
| | | |
| | | /** @typedef {undefined | string | boolean | StatsOptions} ChildrenStatsOptions */ |
| | | /** @typedef {Omit<StatsOptions, "children"> & { children?: ChildrenStatsOptions | ChildrenStatsOptions[] }} MultiStatsOptions */ |
| | | /** @typedef {StatsOptions} MultiStatsOptions */ |
| | | /** @typedef {{ version: boolean, hash: boolean, errorsCount: boolean, warningsCount: boolean, errors: boolean, warnings: boolean, children: NormalizedStatsOptions[] }} ChildOptions */ |
| | | |
| | | class MultiStats { |
| | | /** |
| | | * Creates an instance of MultiStats. |
| | | * @param {Stats[]} stats the child stats |
| | | */ |
| | | constructor(stats) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * Checks whether this multi stats has errors. |
| | | * @returns {boolean} true if a child compilation encountered an error |
| | | */ |
| | | hasErrors() { |
| | |
| | | } |
| | | |
| | | /** |
| | | * Checks whether this multi stats has warnings. |
| | | * @returns {boolean} true if a child compilation had a warning |
| | | */ |
| | | hasWarnings() { |
| | |
| | | } |
| | | |
| | | /** |
| | | * @param {undefined | string | boolean | MultiStatsOptions} options stats options |
| | | * Create child options. |
| | | * @param {undefined | StatsValue} options stats options |
| | | * @param {CreateStatsOptionsContext} context context |
| | | * @returns {ChildOptions} context context |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * @param {(string | boolean | MultiStatsOptions)=} options stats options |
| | | * Returns json output. |
| | | * @param {StatsValue=} options stats options |
| | | * @returns {StatsCompilation} json output |
| | | */ |
| | | toJson(options) { |
| | |
| | | obj.hash = obj.children.map((j) => j.hash).join(""); |
| | | } |
| | | /** |
| | | * Returns result. |
| | | * @param {StatsCompilation} j stats error |
| | | * @param {StatsError} obj Stats error |
| | | * @returns {StatsError} result |
| | |
| | | } |
| | | |
| | | /** |
| | | * @param {(string | boolean | MultiStatsOptions)=} options stats options |
| | | * Returns a string representation. |
| | | * @param {StatsValue=} options stats options |
| | | * @returns {string} string output |
| | | */ |
| | | toString(options) { |