WXL
3 天以前 3bd962a6d7f61239c020e2dbbeb7341e5b842dd1
node_modules/webpack/lib/FlagDependencyUsagePlugin.js
@@ -28,14 +28,16 @@
class FlagDependencyUsagePlugin {
   /**
    * Creates an instance of FlagDependencyUsagePlugin.
    * @param {boolean} global do a global analysis instead of per runtime
    */
   constructor(global) {
      /** @type {boolean} */
      this.global = global;
   }
   /**
    * Apply the plugin
    * Applies the plugin by registering its hooks on the compiler.
    * @param {Compiler} compiler the compiler instance
    * @returns {void}
    */
@@ -59,6 +61,7 @@
               const queue = new TupleQueue();
               /**
                * Process referenced module.
                * @param {Module} module module to process
                * @param {ReferencedExports} usedExports list of used exports
                * @param {RuntimeSpec} runtime part of which runtime
@@ -80,6 +83,7 @@
                        return;
                     }
                     for (const usedExportInfo of usedExports) {
                        /** @type {string[]} */
                        let usedExport;
                        let canMangle = true;
                        if (Array.isArray(usedExportInfo)) {
@@ -161,13 +165,15 @@
               };
               /**
                * Processes the provided module.
                * @param {DependenciesBlock} module the module
                * @param {RuntimeSpec} runtime part of which runtime
                * @param {boolean} forceSideEffects always apply side effects
                * @returns {void}
                */
               const processModule = (module, runtime, forceSideEffects) => {
                  /** @type {Map<Module, ReferencedExports | Map<string, string[] | ReferencedExport>>} */
                  /** @typedef {Map<string, string[] | ReferencedExport>} ExportMaps */
                  /** @type {Map<Module, ReferencedExports | ExportMaps>} */
                  const map = new Map();
                  /** @type {ArrayQueue<DependenciesBlock>} */
@@ -177,14 +183,12 @@
                     const block = queue.dequeue();
                     if (block === undefined) break;
                     for (const b of block.blocks) {
                        if (
                           !this.global &&
                           b.groupOptions &&
                           b.groupOptions.entryOptions
                        ) {
                        if (b.groupOptions && b.groupOptions.entryOptions) {
                           processModule(
                              b,
                              b.groupOptions.entryOptions.runtime || undefined,
                              this.global
                                 ? undefined
                                 : b.groupOptions.entryOptions.runtime || undefined,
                              true
                           );
                        } else {
@@ -221,6 +225,7 @@
                        ) {
                           continue;
                        } else {
                           /** @type {undefined | ExportMaps} */
                           let exportsMap;
                           if (Array.isArray(oldReferencedExports)) {
                              exportsMap = new Map();
@@ -292,6 +297,7 @@
               logger.time("trace exports usage in graph");
               /**
                * Process entry dependency.
                * @param {Dependency} dep dependency
                * @param {RuntimeSpec} runtime runtime
                */