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