WXL
4 天以前 2cc85c64f1c64a2dbaeae276a3e2ca8420de76b7
node_modules/webpack/lib/Dependency.js
@@ -21,6 +21,7 @@
/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */
/** @typedef {import("./dependencies/ModuleDependency")} ModuleDependency */
/**
 * Defines the update hash context type used by this module.
 * @typedef {object} UpdateHashContext
 * @property {ChunkGraph} chunkGraph
 * @property {RuntimeSpec} runtime
@@ -28,12 +29,14 @@
 */
/**
 * Defines the source position type used by this module.
 * @typedef {object} SourcePosition
 * @property {number} line
 * @property {number=} column
 */
/**
 * Defines the real dependency location type used by this module.
 * @typedef {object} RealDependencyLocation
 * @property {SourcePosition} start
 * @property {SourcePosition=} end
@@ -41,6 +44,7 @@
 */
/**
 * Defines the synthetic dependency location type used by this module.
 * @typedef {object} SyntheticDependencyLocation
 * @property {string} name
 * @property {number=} index
@@ -48,9 +52,12 @@
/** @typedef {SyntheticDependencyLocation | RealDependencyLocation} DependencyLocation */
/** @typedef {string} ExportInfoName */
/**
 * Defines the export spec type used by this module.
 * @typedef {object} ExportSpec
 * @property {string} name the name of the export
 * @property {ExportInfoName} name the name of the export
 * @property {boolean=} canMangle can the export be renamed (defaults to true)
 * @property {boolean=} terminalBinding is the export a terminal binding that should be checked for export star conflicts
 * @property {(string | ExportSpec)[]=} exports nested exports
@@ -63,6 +70,7 @@
/** @typedef {Set<string>} ExportsSpecExcludeExports */
/**
 * Defines the exports spec type used by this module.
 * @typedef {object} ExportsSpec
 * @property {(string | ExportSpec)[] | true | null} exports exported names, true for unknown exports or null for no exports
 * @property {ExportsSpecExcludeExports=} excludeExports when exports = true, list of unaffected exports
@@ -75,6 +83,7 @@
 */
/**
 * Defines the referenced export type used by this module.
 * @typedef {object} ReferencedExport
 * @property {string[]} name name of the referenced export
 * @property {boolean=} canMangle when false, referenced export can not be mangled, defaults to true
@@ -85,7 +94,7 @@
/** @typedef {(moduleGraphConnection: ModuleGraphConnection, runtime: RuntimeSpec) => ConnectionState} GetConditionFn */
const TRANSITIVE = Symbol("transitive");
const TRANSITIVE = /** @type {symbol} */ (Symbol("transitive"));
const getIgnoredModule = memoize(() => {
   const RawModule = require("./RawModule");
@@ -113,12 +122,16 @@
      this._locSC = 0;
      this._locEL = 0;
      this._locEC = 0;
      /** @type {undefined | number} */
      this._locI = undefined;
      /** @type {undefined | string} */
      this._locN = undefined;
      /** @type {undefined | DependencyLocation} */
      this._loc = undefined;
   }
   /**
    * Returns a display name for the type of dependency.
    * @returns {string} a display name for the type of dependency
    */
   get type() {
@@ -126,6 +139,7 @@
   }
   /**
    * Returns a dependency category, typical categories are "commonjs", "amd", "esm".
    * @returns {string} a dependency category, typical categories are "commonjs", "amd", "esm"
    */
   get category() {
@@ -133,6 +147,7 @@
   }
   /**
    * Returns location.
    * @returns {DependencyLocation} location
    */
   get loc() {
@@ -178,6 +193,7 @@
   }
   /**
    * Updates loc using the provided start line.
    * @param {number} startLine start line
    * @param {number} startColumn start column
    * @param {number} endLine end line
@@ -194,6 +210,7 @@
   }
   /**
    * Returns a request context.
    * @returns {string | undefined} a request context
    */
   getContext() {
@@ -201,6 +218,7 @@
   }
   /**
    * Returns an identifier to merge equal requests.
    * @returns {string | null} an identifier to merge equal requests
    */
   getResourceIdentifier() {
@@ -208,6 +226,7 @@
   }
   /**
    * Could affect referencing module.
    * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module
    */
   couldAffectReferencingModule() {
@@ -222,7 +241,7 @@
    */
   getReference(moduleGraph) {
      throw new Error(
         "Dependency.getReference was removed in favor of Dependency.getReferencedExports, ModuleGraph.getModule and ModuleGraph.getConnection().active"
         "Dependency.getReference was removed in favor of Dependency.getReferencedExports, ModuleGraph.getModule, ModuleGraph.getConnection(), and ModuleGraphConnection.getActiveState(runtime)"
      );
   }
@@ -237,6 +256,7 @@
   }
   /**
    * Returns function to determine if the connection is active.
    * @param {ModuleGraph} moduleGraph module graph
    * @returns {null | false | GetConditionFn} function to determine if the connection is active
    */
@@ -254,7 +274,7 @@
   }
   /**
    * Returns warnings
    * Returns warnings.
    * @param {ModuleGraph} moduleGraph module graph
    * @returns {WebpackError[] | null | undefined} warnings
    */
@@ -263,7 +283,7 @@
   }
   /**
    * Returns errors
    * Returns errors.
    * @param {ModuleGraph} moduleGraph module graph
    * @returns {WebpackError[] | null | undefined} errors
    */
@@ -272,7 +292,7 @@
   }
   /**
    * Update the hash
    * Updates the hash with the data contributed by this instance.
    * @param {Hash} hash hash to be updated
    * @param {UpdateHashContext} context context
    * @returns {void}
@@ -288,6 +308,7 @@
   }
   /**
    * Gets module evaluation side effects state.
    * @param {ModuleGraph} moduleGraph the module graph
    * @returns {ConnectionState} how this dependency connects the module to referencing modules
    */
@@ -296,6 +317,7 @@
   }
   /**
    * Creates an ignored module.
    * @param {string} context context directory
    * @returns {Module} ignored module
    */
@@ -304,6 +326,7 @@
   }
   /**
    * Serializes this instance into the provided serializer context.
    * @param {ObjectSerializerContext} context context
    */
   serialize({ write }) {
@@ -318,6 +341,7 @@
   }
   /**
    * Restores this instance from the provided deserializer context.
    * @param {ObjectDeserializerContext} context context
    */
   deserialize({ read }) {
@@ -340,6 +364,7 @@
// TODO remove in webpack 6
Object.defineProperty(Dependency.prototype, "module", {
   /**
    * Returns throws.
    * @deprecated
    * @returns {EXPECTED_ANY} throws
    */
@@ -350,6 +375,7 @@
   },
   /**
    * Updates module.
    * @deprecated
    * @returns {never} throws
    */
@@ -361,6 +387,7 @@
});
/**
 * Returns true if the dependency is a low priority dependency.
 * @param {Dependency} dependency dep
 * @returns {boolean} true if the dependency is a low priority dependency
 */
@@ -370,6 +397,7 @@
// TODO remove in webpack 6
Object.defineProperty(Dependency.prototype, "disconnect", {
   /**
    * Returns throws.
    * @deprecated
    * @returns {EXPECTED_ANY} throws
    */