| | |
| | | /** @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; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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} |
| | |
| | | } |
| | | |
| | | /** |
| | | * Serializes this instance into the provided serializer context. |
| | | * @param {ObjectSerializerContext} context context |
| | | */ |
| | | serialize(context) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * Restores this instance from the provided deserializer context. |
| | | * @param {ObjectDeserializerContext} context context |
| | | */ |
| | | deserialize(context) { |
| | |
| | | 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 |