-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathindex.js
34 lines (34 loc) · 1016 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Generated by LiveScript 1.4.0
var LiveScript, LoaderUtils;
LiveScript = require('livescript');
LoaderUtils = require('loader-utils');
module.exports = function(source){
var lsRequest, jsRequest, config, query, result;
if (typeof this.cacheable == 'function') {
this.cacheable();
}
lsRequest = LoaderUtils.getRemainingRequest(this);
jsRequest = LoaderUtils.getCurrentRequest(this);
config = {
filename: lsRequest,
outputFilename: jsRequest,
map: 'linked',
bare: true,
'const': false,
header: false
};
query = LoaderUtils.parseQuery(this.query);
import$(config, query);
result = LiveScript.compile(source, config);
if (config.map === 'none') {
return result;
}
result.map.setSourceContent(lsRequest, source);
result.map._file = lsRequest;
this.callback(null, result.code, JSON.parse(result.map.toString()));
};
function import$(obj, src){
var own = {}.hasOwnProperty;
for (var key in src) if (own.call(src, key)) obj[key] = src[key];
return obj;
}