WXL
3 天以前 9bce51f651aad297ef9eb6df832bfdaf1de05d84
node_modules/webpack/lib/stats/DefaultStatsPresetPlugin.js
@@ -17,6 +17,7 @@
/** @typedef {import("./DefaultStatsFactoryPlugin").StatsError} StatsError */
/**
 * Processes the provided normalized stats option.
 * @param {Partial<NormalizedStatsOptions>} options options
 * @param {StatsOptions} defaults default options
 */
@@ -30,7 +31,7 @@
   }
};
/** @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 = {
@@ -144,16 +145,19 @@
};
/**
 * 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
@@ -161,6 +165,7 @@
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
@@ -168,6 +173,7 @@
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
@@ -285,11 +291,13 @@
};
/**
 * 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
@@ -315,6 +323,7 @@
/** @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
@@ -343,6 +352,7 @@
      }
      return value.map(
         /**
          * Handles the warnings filter callback for this hook.
          * @param {StatsOptions["warningsFilter"]} filter a warning filter
          * @returns {WarningFilterFn} result
          */
@@ -380,7 +390,7 @@
class DefaultStatsPresetPlugin {
   /**
    * Apply the plugin
    * Applies the plugin by registering its hooks on the compiler.
    * @param {Compiler} compiler the compiler instance
    * @returns {void}
    */