a zip code crypto-currency system good for red ONLY

ModuleKindPlugin.js 805B

123456789101112131415161718192021222324252627
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. var createInnerCallback = require("./createInnerCallback");
  6. function ModuleKindPlugin(source, target) {
  7. this.source = source;
  8. this.target = target;
  9. }
  10. module.exports = ModuleKindPlugin;
  11. ModuleKindPlugin.prototype.apply = function(resolver) {
  12. var target = this.target;
  13. resolver.plugin(this.source, function(request, callback) {
  14. if(!request.module) return callback();
  15. var obj = Object.assign({}, request);
  16. delete obj.module;
  17. resolver.doResolve(target, obj, "resolve as module", createInnerCallback(function(err, result) {
  18. if(arguments.length > 0) return callback(err, result);
  19. // Don't allow other alternatives
  20. callback(null, null);
  21. }, callback));
  22. });
  23. };