WXL
4 天以前 2cc85c64f1c64a2dbaeae276a3e2ca8420de76b7
node_modules/webpack/lib/library/AbstractLibraryPlugin.js
@@ -27,6 +27,7 @@
   "Common configuration options that specific library names are 'output.library[.name]', 'entry.xyz.library[.name]', 'ModuleFederationPlugin.name' and 'ModuleFederationPlugin.library[.name]'.";
/**
 * Defines the library context type used by this module.
 * @template T
 * @typedef {object} LibraryContext
 * @property {Compilation} compilation
@@ -35,26 +36,32 @@
 */
/**
 * Defines the abstract library plugin options type used by this module.
 * @typedef {object} AbstractLibraryPluginOptions
 * @property {string} pluginName name of the plugin
 * @property {LibraryType} type used library type
 */
/**
 * Represents AbstractLibraryPlugin.
 * @template T
 */
class AbstractLibraryPlugin {
   /**
    * Creates an instance of AbstractLibraryPlugin.
    * @param {AbstractLibraryPluginOptions} options options
    */
   constructor({ pluginName, type }) {
      /** @type {AbstractLibraryPluginOptions["pluginName"]} */
      this._pluginName = pluginName;
      /** @type {AbstractLibraryPluginOptions["type"]} */
      this._type = type;
      /** @type {WeakMap<LibraryOptions, T>} */
      this._parseCache = new WeakMap();
   }
   /**
    * Apply the plugin
    * Applies the plugin by registering its hooks on the compiler.
    * @param {Compiler} compiler the compiler instance
    * @returns {void}
    */
@@ -94,6 +101,7 @@
         );
         /**
          * Gets options for chunk.
          * @param {Chunk} chunk chunk
          * @returns {T | false} options for the chunk
          */
@@ -219,6 +227,7 @@
   }
   /**
    * Parse options cached.
    * @param {LibraryOptions=} library normalized library option
    * @returns {T | false} preprocess as needed by overriding
    */
@@ -234,9 +243,10 @@
   /* istanbul ignore next */
   /**
    * Returns preprocess as needed by overriding.
    * @abstract
    * @param {LibraryOptions} library normalized library option
    * @returns {T | false} preprocess as needed by overriding
    * @returns {T} preprocess as needed by overriding
    */
   parseOptions(library) {
      const AbstractMethodError = require("../AbstractMethodError");
@@ -245,6 +255,7 @@
   }
   /**
    * Finish entry module.
    * @param {Module} module the exporting entry module
    * @param {string} entryName the name of the entrypoint
    * @param {LibraryContext<T>} libraryContext context
@@ -253,6 +264,7 @@
   finishEntryModule(module, entryName, libraryContext) {}
   /**
    * Embed in runtime bailout.
    * @param {Module} module the exporting entry module
    * @param {RenderContext} renderContext render context
    * @param {LibraryContext<T>} libraryContext context
@@ -263,6 +275,7 @@
   }
   /**
    * Strict runtime bailout.
    * @param {RenderContext} renderContext render context
    * @param {LibraryContext<T>} libraryContext context
    * @returns {string | undefined} bailout reason
@@ -272,6 +285,7 @@
   }
   /**
    * Processes the provided chunk.
    * @param {Chunk} chunk the chunk
    * @param {RuntimeRequirements} set runtime requirements
    * @param {LibraryContext<T>} libraryContext context
@@ -284,6 +298,7 @@
   }
   /**
    * Returns source with library export.
    * @param {Source} source source
    * @param {RenderContext} renderContext render context
    * @param {LibraryContext<T>} libraryContext context
@@ -294,6 +309,7 @@
   }
   /**
    * Renders source with library export.
    * @param {Source} source source
    * @param {Module} module module
    * @param {StartupRenderContext} renderContext render context
@@ -305,10 +321,11 @@
   }
   /**
    * Renders module content.
    * @param {Source} source source
    * @param {Module} module module
    * @param {ModuleRenderContext} renderContext render context
    * @param {Omit<LibraryContext<T>, 'options'>} libraryContext context
    * @param {Omit<LibraryContext<T>, "options">} libraryContext context
    * @returns {Source} source with library export
    */
   renderModuleContent(source, module, renderContext, libraryContext) {
@@ -316,6 +333,7 @@
   }
   /**
    * Processes the provided chunk.
    * @param {Chunk} chunk the chunk
    * @param {Hash} hash hash
    * @param {ChunkHashContext} chunkHashContext chunk hash context