a zip code crypto-currency system good for red ONLY

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. const Module = require("./Module");
  7. const OriginalSource = require("webpack-sources").OriginalSource;
  8. const RawSource = require("webpack-sources").RawSource;
  9. module.exports = class RawModule extends Module {
  10. constructor(source, identifier, readableIdentifier) {
  11. super();
  12. this.sourceStr = source;
  13. this.identifierStr = identifier || this.sourceStr;
  14. this.readableIdentifierStr = readableIdentifier || this.identifierStr;
  15. this.cacheable = true;
  16. this.built = false;
  17. }
  18. identifier() {
  19. return this.identifierStr;
  20. }
  21. size() {
  22. return this.sourceStr.length;
  23. }
  24. readableIdentifier(requestShortener) {
  25. return requestShortener.shorten(this.readableIdentifierStr);
  26. }
  27. needRebuild() {
  28. return false;
  29. }
  30. build(options, compilations, resolver, fs, callback) {
  31. this.builtTime = Date.now();
  32. callback();
  33. }
  34. source() {
  35. if(this.useSourceMap)
  36. return new OriginalSource(this.sourceStr, this.identifier());
  37. else
  38. return new RawSource(this.sourceStr);
  39. }
  40. updateHash(hash) {
  41. hash.update(this.sourceStr);
  42. super.updateHash(hash);
  43. }
  44. };