DllModuleFactory.js 1008 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. const DllModule = require("./DllModule");
  7. const ModuleFactory = require("./ModuleFactory");
  8. /** @typedef {import("./ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */
  9. /** @typedef {import("./ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */
  10. /** @typedef {import("./dependencies/DllEntryDependency")} DllEntryDependency */
  11. class DllModuleFactory extends ModuleFactory {
  12. constructor() {
  13. super();
  14. this.hooks = Object.freeze({});
  15. }
  16. /**
  17. * @param {ModuleFactoryCreateData} data data object
  18. * @param {function(Error=, ModuleFactoryResult=): void} callback callback
  19. * @returns {void}
  20. */
  21. create(data, callback) {
  22. const dependency = /** @type {DllEntryDependency} */ (data.dependencies[0]);
  23. callback(null, {
  24. module: new DllModule(
  25. data.context,
  26. dependency.dependencies,
  27. dependency.name
  28. )
  29. });
  30. }
  31. }
  32. module.exports = DllModuleFactory;