RawSource.js 653 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. var Source = require("./Source");
  7. var SourceNode = require("source-map").SourceNode;
  8. var SourceListMap = require("source-list-map").SourceListMap;
  9. class RawSource extends Source {
  10. constructor(value) {
  11. super();
  12. this._value = value;
  13. }
  14. source() {
  15. return this._value;
  16. }
  17. map(options) {
  18. return null;
  19. }
  20. node(options) {
  21. return new SourceNode(null, null, null, this._value);
  22. }
  23. listMap(options) {
  24. return new SourceListMap(this._value);
  25. }
  26. updateHash(hash) {
  27. hash.update(this._value);
  28. }
  29. }
  30. module.exports = RawSource;