WXL
4 天以前 2cc85c64f1c64a2dbaeae276a3e2ca8420de76b7
node_modules/webpack/lib/util/deprecation.js
@@ -11,16 +11,19 @@
const deprecationCache = new Map();
/**
 * Defines the fake hook marker type used by this module.
 * @typedef {object} FakeHookMarker
 * @property {true} _fakeHook it's a fake hook
 */
/**
 * Defines the shared type used by this module.
 * @template T
 * @typedef {T & FakeHookMarker} FakeHook<T>
 */
/**
 * Creates a deprecation.
 * @param {string} message deprecation message
 * @param {string} code deprecation code
 * @returns {() => void} function to trigger deprecation
@@ -74,11 +77,13 @@
];
/**
 * Defines the set with deprecated array methods type used by this module.
 * @template T
 * @typedef {Set<T> & { [Symbol.isConcatSpreadable]: boolean } & { push: (...items: T[]) => void, length?: number } & { [P in DISABLED_METHODS_NAMES]: () => void } & { [P in COPY_METHODS_NAMES]: P extends keyof Array<T> ? () => Pick<Array<T>, P> : never }} SetWithDeprecatedArrayMethods
 */
/**
 * Processes the provided set.
 * @template T
 * @param {Set<T>} set new set
 * @param {string} name property name
@@ -139,11 +144,13 @@
      };
   }
   /**
    * Creates an index getter.
    * @param {number} index index
    * @returns {() => T | undefined} value
    */
   const createIndexGetter = (index) => {
      /**
       * Returns the value at this location.
       * @this {Set<T>} a Set
       * @returns {T | undefined} the value at this location
       */
@@ -158,6 +165,7 @@
      return fn;
   };
   /**
    * Define index getter.
    * @param {number} index index
    */
   const defineIndexGetter = (index) => {
@@ -192,18 +200,21 @@
};
/**
 * Returns } SetDeprecatedArray.
 * @template T
 * @param {string} name name
 * @returns {{ new <T = any>(values?: ReadonlyArray<T> | null): SetDeprecatedArray<T> }} SetDeprecatedArray
 * @returns {{ new <T = EXPECTED_ANY>(values?: ReadonlyArray<T> | null): SetDeprecatedArray<T> }} SetDeprecatedArray
 */
module.exports.createArrayToSetDeprecationSet = (name) => {
   let initialized = false;
   /**
    * Represents SetDeprecatedArray.
    * @template T
    */
   class SetDeprecatedArray extends Set {
      /**
       * Creates an instance of SetDeprecatedArray.
       * @param {ReadonlyArray<T> | null=} items items
       */
      constructor(items) {
@@ -222,6 +233,7 @@
};
/**
 * Returns fake hook which redirects.
 * @template {object} T
 * @param {T} fakeHook fake hook implementation
 * @param {string=} message deprecation message (not deprecated when unset)
@@ -238,6 +250,7 @@
};
/**
 * Deprecate all properties.
 * @template T
 * @param {T} obj object
 * @param {string} message deprecation message
@@ -269,6 +282,7 @@
            set: descriptor.writable
               ? util.deprecate(
                     /**
                      * Handles the callback logic for this hook.
                      * @template T
                      * @param {T} v value
                      * @returns {T} result
@@ -287,6 +301,7 @@
module.exports.deprecateAllProperties = deprecateAllProperties;
/**
 * Returns frozen object with deprecation when modifying.
 * @template {object} T
 * @param {T} obj object
 * @param {string} name property name
@@ -302,6 +317,7 @@
      new Proxy(obj, {
         set: util.deprecate(
            /**
             * Handles the callback logic for this hook.
             * @param {object} target target
             * @param {string | symbol} property property
             * @param {EXPECTED_ANY} value value
@@ -315,6 +331,7 @@
         ),
         defineProperty: util.deprecate(
            /**
             * Handles the define property callback for this hook.
             * @param {object} target target
             * @param {string | symbol} property property
             * @param {PropertyDescriptor} descriptor descriptor
@@ -327,6 +344,7 @@
         ),
         deleteProperty: util.deprecate(
            /**
             * Handles the delete property callback for this hook.
             * @param {object} target target
             * @param {string | symbol} property property
             * @returns {boolean} result
@@ -337,6 +355,7 @@
         ),
         setPrototypeOf: util.deprecate(
            /**
             * Updates prototype of using the provided target.
             * @param {object} target target
             * @param {EXPECTED_OBJECT | null} proto proto
             * @returns {boolean} result