You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SourceAndMapMixin.js 764B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. module.exports = function mixinSourceAndMap(proto) {
  7. proto.map = function(options) {
  8. options = options || {};
  9. if(options.columns === false) {
  10. return this.listMap(options).toStringWithSourceMap({
  11. file: "x"
  12. }).map;
  13. }
  14. return this.node(options).toStringWithSourceMap({
  15. file: "x"
  16. }).map.toJSON();
  17. };
  18. proto.sourceAndMap = function(options) {
  19. options = options || {};
  20. if(options.columns === false) {
  21. return this.listMap(options).toStringWithSourceMap({
  22. file: "x"
  23. });
  24. }
  25. var res = this.node(options).toStringWithSourceMap({
  26. file: "x"
  27. });
  28. return {
  29. source: res.code,
  30. map: res.map.toJSON()
  31. };
  32. };
  33. }