WXL
3 天以前 9bce51f651aad297ef9eb6df832bfdaf1de05d84
node_modules/webpack/lib/javascript/EnableChunkLoadingPlugin.js
@@ -8,16 +8,20 @@
/** @typedef {import("../../declarations/WebpackOptions").ChunkLoadingType} ChunkLoadingType */
/** @typedef {import("../Compiler")} Compiler */
/** @type {WeakMap<Compiler, Set<ChunkLoadingType>>} */
/** @typedef {Set<ChunkLoadingType>} ChunkLoadingTypes */
/** @type {WeakMap<Compiler, ChunkLoadingTypes>} */
const enabledTypes = new WeakMap();
/**
 * Returns enabled types.
 * @param {Compiler} compiler compiler
 * @returns {Set<ChunkLoadingType>} enabled types
 * @returns {ChunkLoadingTypes} enabled types
 */
const getEnabledTypes = (compiler) => {
   let set = enabledTypes.get(compiler);
   if (set === undefined) {
      /** @type {ChunkLoadingTypes} */
      set = new Set();
      enabledTypes.set(compiler, set);
   }
@@ -26,6 +30,7 @@
class EnableChunkLoadingPlugin {
   /**
    * Creates an instance of EnableChunkLoadingPlugin.
    * @param {ChunkLoadingType} type library type that should be available
    */
   constructor(type) {
@@ -33,6 +38,7 @@
   }
   /**
    * Updates enabled using the provided compiler.
    * @param {Compiler} compiler the compiler instance
    * @param {ChunkLoadingType} type type of library
    * @returns {void}
@@ -42,6 +48,7 @@
   }
   /**
    * Checks enabled.
    * @param {Compiler} compiler the compiler instance
    * @param {ChunkLoadingType} type type of library
    * @returns {void}
@@ -59,7 +66,7 @@
   }
   /**
    * Apply the plugin
    * Applies the plugin by registering its hooks on the compiler.
    * @param {Compiler} compiler the compiler instance
    * @returns {void}
    */
@@ -103,8 +110,7 @@
               }).apply(compiler);
               break;
            }
            case "import":
            case "universal": {
            case "import": {
               const ModuleChunkLoadingPlugin = require("../esm/ModuleChunkLoadingPlugin");
               new ModuleChunkLoadingPlugin().apply(compiler);