| | |
| | | /** @typedef {import("./DefaultStatsFactoryPlugin").StatsError} StatsError */ |
| | | |
| | | /** |
| | | * Processes the provided normalized stats option. |
| | | * @param {Partial<NormalizedStatsOptions>} options options |
| | | * @param {StatsOptions} defaults default options |
| | | */ |
| | |
| | | } |
| | | }; |
| | | |
| | | /** @typedef {{ [Key in Exclude<StatsValue, boolean | object | "normal">]: StatsOptions }} NamedPresets */ |
| | | /** @typedef {{ [Key in Exclude<StatsValue, boolean | EXPECTED_OBJECT | "normal">]: StatsOptions }} NamedPresets */ |
| | | |
| | | /** @type {NamedPresets} */ |
| | | const NAMED_PRESETS = { |
| | |
| | | }; |
| | | |
| | | /** |
| | | * Returns true when enabled, otherwise false. |
| | | * @param {Partial<NormalizedStatsOptions>} all stats options |
| | | * @returns {boolean} true when enabled, otherwise false |
| | | */ |
| | | const NORMAL_ON = ({ all }) => all !== false; |
| | | /** |
| | | * Returns true when enabled, otherwise false. |
| | | * @param {Partial<NormalizedStatsOptions>} all stats options |
| | | * @returns {boolean} true when enabled, otherwise false |
| | | */ |
| | | const NORMAL_OFF = ({ all }) => all === true; |
| | | /** |
| | | * Returns true when enabled, otherwise false. |
| | | * @param {Partial<NormalizedStatsOptions>} all stats options |
| | | * @param {CreateStatsOptionsContext} forToString stats options context |
| | | * @returns {boolean} true when enabled, otherwise false |
| | |
| | | const ON_FOR_TO_STRING = ({ all }, { forToString }) => |
| | | forToString ? all !== false : all === true; |
| | | /** |
| | | * Returns true when enabled, otherwise false. |
| | | * @param {Partial<NormalizedStatsOptions>} all stats options |
| | | * @param {CreateStatsOptionsContext} forToString stats options context |
| | | * @returns {boolean} true when enabled, otherwise false |
| | |
| | | const OFF_FOR_TO_STRING = ({ all }, { forToString }) => |
| | | forToString ? all === true : all !== false; |
| | | /** |
| | | * Auto for to string. |
| | | * @param {Partial<NormalizedStatsOptions>} all stats options |
| | | * @param {CreateStatsOptionsContext} forToString stats options context |
| | | * @returns {boolean | "auto"} true when enabled, otherwise false |
| | |
| | | }; |
| | | |
| | | /** |
| | | * Defines the normalize function type used by this module. |
| | | * @template T |
| | | * @typedef {(value: T, ...args: EXPECTED_ANY[]) => boolean} NormalizeFunction |
| | | */ |
| | | |
| | | /** |
| | | * Returns normalize fn. |
| | | * @template {string} T |
| | | * @param {string | ({ test: (value: T) => boolean }) | NormalizeFunction<T> | boolean} item item to normalize |
| | | * @returns {NormalizeFunction<T>} normalize fn |
| | |
| | | /** @typedef {{ [Key in NormalizerKeys]?: (value: StatsOptions[Key]) => KnownNormalizedStatsOptions[Key] }} Normalizers */ |
| | | |
| | | /** |
| | | * Defines the warning filter fn callback. |
| | | * @callback WarningFilterFn |
| | | * @param {StatsError} warning warning |
| | | * @param {string} warningString warning string |
| | |
| | | } |
| | | return value.map( |
| | | /** |
| | | * Handles the warnings filter callback for this hook. |
| | | * @param {StatsOptions["warningsFilter"]} filter a warning filter |
| | | * @returns {WarningFilterFn} result |
| | | */ |
| | |
| | | |
| | | class DefaultStatsPresetPlugin { |
| | | /** |
| | | * Apply the plugin |
| | | * Applies the plugin by registering its hooks on the compiler. |
| | | * @param {Compiler} compiler the compiler instance |
| | | * @returns {void} |
| | | */ |