| 1 | /*
|
|---|
| 2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
|---|
| 3 | Author Tobias Koppers @sokra
|
|---|
| 4 | */
|
|---|
| 5 |
|
|---|
| 6 | "use strict";
|
|---|
| 7 |
|
|---|
| 8 | /** @typedef {import("../declarations/WebpackOptions").ResolveOptions} ResolveOptions */
|
|---|
| 9 | /** @typedef {import("./Dependency")} Dependency */
|
|---|
| 10 | /** @typedef {import("./Module")} Module */
|
|---|
| 11 |
|
|---|
| 12 | /**
|
|---|
| 13 | * Defines the module factory result type used by this module.
|
|---|
| 14 | * @typedef {object} ModuleFactoryResult
|
|---|
| 15 | * @property {Module=} module the created module or unset if no module was created
|
|---|
| 16 | * @property {Set<string>=} fileDependencies
|
|---|
| 17 | * @property {Set<string>=} contextDependencies
|
|---|
| 18 | * @property {Set<string>=} missingDependencies
|
|---|
| 19 | * @property {boolean=} cacheable allow to use the unsafe cache
|
|---|
| 20 | */
|
|---|
| 21 |
|
|---|
| 22 | /** @typedef {string | null} IssuerLayer */
|
|---|
| 23 |
|
|---|
| 24 | /**
|
|---|
| 25 | * Defines the module factory create data context info type used by this module.
|
|---|
| 26 | * @typedef {object} ModuleFactoryCreateDataContextInfo
|
|---|
| 27 | * @property {string} issuer
|
|---|
| 28 | * @property {IssuerLayer} issuerLayer
|
|---|
| 29 | * @property {string=} compiler
|
|---|
| 30 | */
|
|---|
| 31 |
|
|---|
| 32 | /**
|
|---|
| 33 | * Defines the module factory create data type used by this module.
|
|---|
| 34 | * @typedef {object} ModuleFactoryCreateData
|
|---|
| 35 | * @property {ModuleFactoryCreateDataContextInfo} contextInfo
|
|---|
| 36 | * @property {ResolveOptions=} resolveOptions
|
|---|
| 37 | * @property {string} context
|
|---|
| 38 | * @property {Dependency[]} dependencies
|
|---|
| 39 | */
|
|---|
| 40 |
|
|---|
| 41 | /**
|
|---|
| 42 | * Represents the module factory runtime component.
|
|---|
| 43 | * @typedef {(err?: Error | null, result?: ModuleFactoryResult) => void} ModuleFactoryCallback
|
|---|
| 44 | */
|
|---|
| 45 |
|
|---|
| 46 | class ModuleFactory {
|
|---|
| 47 | /* istanbul ignore next */
|
|---|
| 48 | /**
|
|---|
| 49 | * Processes the provided data.
|
|---|
| 50 | * @abstract
|
|---|
| 51 | * @param {ModuleFactoryCreateData} data data object
|
|---|
| 52 | * @param {ModuleFactoryCallback} callback callback
|
|---|
| 53 | * @returns {void}
|
|---|
| 54 | */
|
|---|
| 55 | create(data, callback) {
|
|---|
| 56 | const AbstractMethodError = require("./errors/AbstractMethodError");
|
|---|
| 57 |
|
|---|
| 58 | throw new AbstractMethodError();
|
|---|
| 59 | }
|
|---|
| 60 | }
|
|---|
| 61 |
|
|---|
| 62 | module.exports = ModuleFactory;
|
|---|