WXL
3 天以前 3bd962a6d7f61239c020e2dbbeb7341e5b842dd1
node_modules/webpack/lib/dependencies/HarmonyExportSpecifierDependency.js
@@ -17,9 +17,12 @@
/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
/** @typedef {import("./HarmonyExportInitFragment").UnusedExports} UnusedExports */
/** @typedef {import("./HarmonyExportInitFragment").ExportMap} ExportMap */
class HarmonyExportSpecifierDependency extends NullDependency {
   /**
    * Creates an instance of HarmonyExportSpecifierDependency.
    * @param {string} id the id
    * @param {string} name the name
    */
@@ -48,6 +51,7 @@
   }
   /**
    * Gets module evaluation side effects state.
    * @param {ModuleGraph} moduleGraph the module graph
    * @returns {ConnectionState} how this dependency connects the module to referencing modules
    */
@@ -56,6 +60,7 @@
   }
   /**
    * Serializes this instance into the provided serializer context.
    * @param {ObjectSerializerContext} context context
    */
   serialize(context) {
@@ -66,6 +71,7 @@
   }
   /**
    * Restores this instance from the provided deserializer context.
    * @param {ObjectDeserializerContext} context context
    */
   deserialize(context) {
@@ -85,6 +91,7 @@
   NullDependency.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
@@ -104,6 +111,7 @@
         .getExportsInfo(module)
         .getUsedName(dep.name, runtime);
      if (!used) {
         /** @type {UnusedExports} */
         const set = new Set();
         set.add(dep.name || "namespace");
         initFragments.push(
@@ -112,6 +120,7 @@
         return;
      }
      /** @type {ExportMap} */
      const map = new Map();
      map.set(used, `/* binding */ ${dep.id}`);
      initFragments.push(