WXL
4 天以前 3bd962a6d7f61239c020e2dbbeb7341e5b842dd1
node_modules/webpack/lib/wasm/EnableWasmLoadingPlugin.js
@@ -14,27 +14,39 @@
const enabledTypes = new WeakMap();
/**
 * Returns the set of wasm loading backends that have already been enabled for
 * the compiler.
 * @param {Compiler} compiler compiler instance
 * @returns {WasmLoadingTypes} enabled types
 */
const getEnabledTypes = (compiler) => {
   let set = enabledTypes.get(compiler);
   if (set === undefined) {
      /** @type {WasmLoadingTypes} */
      set = new Set();
      enabledTypes.set(compiler, set);
   }
   return set;
};
/**
 * Validates and enables named wasm loading backends by applying the plugin
 * implementations that provide their runtime support.
 */
class EnableWasmLoadingPlugin {
   /**
    * Stores the wasm loading backend name that should be enabled for the
    * compiler.
    * @param {WasmLoadingType} type library type that should be available
    */
   constructor(type) {
      /** @type {WasmLoadingType} */
      this.type = type;
   }
   /**
    * Marks a custom or built-in wasm loading type as enabled for the compiler
    * without applying additional built-in behavior.
    * @param {Compiler} compiler the compiler instance
    * @param {WasmLoadingType} type type of library
    * @returns {void}
@@ -44,6 +56,8 @@
   }
   /**
    * Verifies that a wasm loading type has been enabled before code generation
    * attempts to use it.
    * @param {Compiler} compiler the compiler instance
    * @param {WasmLoadingType} type type of library
    * @returns {void}
@@ -61,7 +75,9 @@
   }
   /**
    * Apply the plugin
    * Enables the requested wasm loading backend once and applies the
    * environment-specific plugins that provide its parser, generator, and
    * runtime support.
    * @param {Compiler} compiler the compiler instance
    * @returns {void}
    */