ContainerEntryModuleFactory.js 1020 B

123456789101112131415161718192021222324252627
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr
  4. */
  5. "use strict";
  6. const ModuleFactory = require("../ModuleFactory");
  7. const ContainerEntryModule = require("./ContainerEntryModule");
  8. /** @typedef {import("../ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */
  9. /** @typedef {import("../ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */
  10. /** @typedef {import("./ContainerEntryDependency")} ContainerEntryDependency */
  11. module.exports = class ContainerEntryModuleFactory extends ModuleFactory {
  12. /**
  13. * @param {ModuleFactoryCreateData} data data object
  14. * @param {function((Error | null)=, ModuleFactoryResult=): void} callback callback
  15. * @returns {void}
  16. */
  17. create({ dependencies: [dependency] }, callback) {
  18. const dep = /** @type {ContainerEntryDependency} */ (dependency);
  19. callback(null, {
  20. module: new ContainerEntryModule(dep.name, dep.exposes, dep.shareScope)
  21. });
  22. }
  23. };