WXL
3 天以前 3bd962a6d7f61239c020e2dbbeb7341e5b842dd1
node_modules/webpack/lib/FlagDependencyExportsPlugin.js
@@ -14,6 +14,7 @@
/** @typedef {import("./Dependency").ExportSpec} ExportSpec */
/** @typedef {import("./Dependency").ExportsSpec} ExportsSpec */
/** @typedef {import("./ExportsInfo")} ExportsInfo */
/** @typedef {import("./ExportsInfo").ExportInfoName} ExportInfoName */
/** @typedef {import("./ExportsInfo").RestoreProvidedData} RestoreProvidedData */
/** @typedef {import("./Module")} Module */
/** @typedef {import("./Module").BuildInfo} BuildInfo */
@@ -23,7 +24,7 @@
class FlagDependencyExportsPlugin {
   /**
    * Apply the plugin
    * Applies the plugin by registering its hooks on the compiler.
    * @param {Compiler} compiler the compiler instance
    * @returns {void}
    */
@@ -50,7 +51,9 @@
               // Step 1: Try to restore cached provided export info from cache
               logger.time("restore cached provided exports");
               asyncLib.each(
                  modules,
                  /** @type {import("neo-async").IterableCollection<Module>} */ (
                     /** @type {unknown} */ (modules)
                  ),
                  (module, callback) => {
                     const exportsInfo = moduleGraph.getExportsInfo(module);
                     // If the module doesn't have an exportsType, it's a module
@@ -126,6 +129,7 @@
                     let changed = false;
                     /**
                      * Process dependencies block.
                      * @param {DependenciesBlock} depBlock the dependencies block
                      * @returns {void}
                      */
@@ -139,6 +143,7 @@
                     };
                     /**
                      * Process dependency.
                      * @param {Dependency} dep the dependency
                      * @returns {void}
                      */
@@ -149,6 +154,7 @@
                     };
                     /**
                      * Process exports spec.
                      * @param {Dependency} dep dependency
                      * @param {ExportsSpec} exportDesc info
                      * @returns {void}
@@ -188,11 +194,14 @@
                            */
                           const mergeExports = (exportsInfo, exports) => {
                              for (const exportNameOrSpec of exports) {
                                 /** @type {ExportInfoName} */
                                 let name;
                                 let canMangle = globalCanMangle;
                                 let terminalBinding = globalTerminalBinding;
                                 /** @type {ExportSpec["exports"]} */
                                 let exports;
                                 let from = globalFrom;
                                 /** @type {ExportSpec["export"]} */
                                 let fromExport;
                                 let priority = globalPriority;
                                 let hidden = false;
@@ -270,6 +279,7 @@
                                 // Recalculate target exportsInfo
                                 const target = exportInfo.getTarget(moduleGraph);
                                 /** @type {undefined | ExportsInfo} */
                                 let targetExportsInfo;
                                 if (target) {
                                    const targetModuleExportsInfo =