a zip code crypto-currency system good for red ONLY

SingleEntryPlugin.js 925B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. const SingleEntryDependency = require("./dependencies/SingleEntryDependency");
  7. class SingleEntryPlugin {
  8. constructor(context, entry, name) {
  9. this.context = context;
  10. this.entry = entry;
  11. this.name = name;
  12. }
  13. apply(compiler) {
  14. compiler.plugin("compilation", (compilation, params) => {
  15. const normalModuleFactory = params.normalModuleFactory;
  16. compilation.dependencyFactories.set(SingleEntryDependency, normalModuleFactory);
  17. });
  18. compiler.plugin("make", (compilation, callback) => {
  19. const dep = SingleEntryPlugin.createDependency(this.entry, this.name);
  20. compilation.addEntry(this.context, dep, this.name, callback);
  21. });
  22. }
  23. static createDependency(entry, name) {
  24. const dep = new SingleEntryDependency(entry);
  25. dep.loc = name;
  26. return dep;
  27. }
  28. }
  29. module.exports = SingleEntryPlugin;