ModuleFactory.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. /** @typedef {import("../declarations/WebpackOptions").ResolveOptions} ResolveOptions */
  7. /** @typedef {import("./Dependency")} Dependency */
  8. /** @typedef {import("./Module")} Module */
  9. /**
  10. * @typedef {object} ModuleFactoryResult
  11. * @property {Module=} module the created module or unset if no module was created
  12. * @property {Set<string>=} fileDependencies
  13. * @property {Set<string>=} contextDependencies
  14. * @property {Set<string>=} missingDependencies
  15. * @property {boolean=} cacheable allow to use the unsafe cache
  16. */
  17. /**
  18. * @typedef {object} ModuleFactoryCreateDataContextInfo
  19. * @property {string} issuer
  20. * @property {string | null=} issuerLayer
  21. * @property {string} compiler
  22. */
  23. /**
  24. * @typedef {object} ModuleFactoryCreateData
  25. * @property {ModuleFactoryCreateDataContextInfo} contextInfo
  26. * @property {ResolveOptions=} resolveOptions
  27. * @property {string} context
  28. * @property {Dependency[]} dependencies
  29. */
  30. class ModuleFactory {
  31. /* istanbul ignore next */
  32. /**
  33. * @abstract
  34. * @param {ModuleFactoryCreateData} data data object
  35. * @param {function((Error | null)=, ModuleFactoryResult=): void} callback callback
  36. * @returns {void}
  37. */
  38. create(data, callback) {
  39. const AbstractMethodError = require("./AbstractMethodError");
  40. throw new AbstractMethodError();
  41. }
  42. }
  43. module.exports = ModuleFactory;