WXL
3 天以前 9bce51f651aad297ef9eb6df832bfdaf1de05d84
node_modules/webpack/lib/dependencies/CommonJsExportRequireDependency.js
@@ -10,7 +10,7 @@
const Template = require("../Template");
const { equals } = require("../util/ArrayHelpers");
const makeSerializable = require("../util/makeSerializable");
const propertyAccess = require("../util/propertyAccess");
const { propertyAccess } = require("../util/property");
const { handleDependencyBase } = require("./CommonJsDependencyHelpers");
const ModuleDependency = require("./ModuleDependency");
const processExportInfo = require("./processExportInfo");
@@ -32,7 +32,9 @@
/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
/** @typedef {import("./CommonJsDependencyHelpers").CommonJSDependencyBaseKeywords} CommonJSDependencyBaseKeywords */
const idsSymbol = Symbol("CommonJsExportRequireDependency.ids");
const idsSymbol = /** @type {symbol} */ (
   Symbol("CommonJsExportRequireDependency.ids")
);
const EMPTY_OBJECT = {};
@@ -41,6 +43,7 @@
class CommonJsExportRequireDependency extends ModuleDependency {
   /**
    * Creates an instance of CommonJsExportRequireDependency.
    * @param {Range} range range
    * @param {Range | null} valueRange value range
    * @param {CommonJSDependencyBaseKeywords} base base
@@ -57,6 +60,7 @@
      this.names = names;
      this.ids = ids;
      this.resultUsed = resultUsed;
      /** @type {undefined | boolean} */
      this.asiSafe = undefined;
   }
@@ -64,7 +68,12 @@
      return "cjs export require";
   }
   get category() {
      return "commonjs";
   }
   /**
    * 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() {
@@ -72,6 +81,7 @@
   }
   /**
    * Returns the imported id.
    * @param {ModuleGraph} moduleGraph the module graph
    * @returns {ExportInfoName[]} the imported id
    */
@@ -80,6 +90,7 @@
   }
   /**
    * Updates ids using the provided module graph.
    * @param {ModuleGraph} moduleGraph the module graph
    * @param {ExportInfoName[]} ids the imported ids
    * @returns {void}
@@ -215,6 +226,7 @@
   }
   /**
    * Gets star reexports.
    * @param {ModuleGraph} moduleGraph the module graph
    * @param {RuntimeSpec} runtime the runtime
    * @param {Module} importedModule the imported module (optional)
@@ -301,6 +313,7 @@
   }
   /**
    * Serializes this instance into the provided serializer context.
    * @param {ObjectSerializerContext} context context
    */
   serialize(context) {
@@ -316,6 +329,7 @@
   }
   /**
    * Restores this instance from the provided deserializer context.
    * @param {ObjectDeserializerContext} context context
    */
   deserialize(context) {
@@ -340,6 +354,7 @@
   ModuleDependency.Template
) {
   /**
    * Applies the plugin by registering its hooks on the compiler.
    * @param {Dependency} dependency the dependency for which the template should be applied
    * @param {ReplaceSource} source the current replace source which can be modified
    * @param {DependencyTemplateContext} templateContext the context object