WXL
3 天以前 3bd962a6d7f61239c020e2dbbeb7341e5b842dd1
node_modules/webpack/lib/dependencies/WorkerDependency.js
@@ -23,20 +23,28 @@
/** @typedef {import("../util/Hash")} Hash */
/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
/**
 * Represents the worker dependency runtime component.
 * @typedef {object} WorkerDependencyOptions
 * @property {string=} publicPath public path for the worker
 * @property {boolean=} needNewUrl true when need generate `new URL(...)`, otherwise false
 */
class WorkerDependency extends ModuleDependency {
   /**
    * Creates an instance of WorkerDependency.
    * @param {string} request request
    * @param {Range} range range
    * @param {object} workerDependencyOptions options
    * @param {string=} workerDependencyOptions.publicPath public path for the worker
    * @param {boolean=} workerDependencyOptions.needNewUrl need generate `new URL(...)`
    * @param {WorkerDependencyOptions} workerDependencyOptions options
    */
   constructor(request, range, workerDependencyOptions) {
      super(request);
      this.range = range;
      // If options are updated, don't forget to update the hash and serialization functions
      /** @type {WorkerDependencyOptions} */
      this.options = workerDependencyOptions;
      /** Cache the hash */
      /** @type {undefined | string} */
      this._hashUpdate = undefined;
   }
@@ -59,7 +67,7 @@
   }
   /**
    * Update the hash
    * Updates the hash with the data contributed by this instance.
    * @param {Hash} hash hash to be updated
    * @param {UpdateHashContext} context context
    * @returns {void}
@@ -72,6 +80,7 @@
   }
   /**
    * Serializes this instance into the provided serializer context.
    * @param {ObjectSerializerContext} context context
    */
   serialize(context) {
@@ -81,6 +90,7 @@
   }
   /**
    * Restores this instance from the provided deserializer context.
    * @param {ObjectDeserializerContext} context context
    */
   deserialize(context) {
@@ -94,6 +104,7 @@
   ModuleDependency.Template
) {
   /**
    * Applies the plugin by registering its hooks on the compiler.
    * @param {Dependency} dependency the dependency for which the template should be applied
    * @param {ReplaceSource} source the current replace source which can be modified
    * @param {DependencyTemplateContext} templateContext the context object