forked from sdemjanenko/msx-loader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
34 lines (29 loc) · 786 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
var loaderUtils = require('loader-utils');
var msx = require('msx');
module.exports = function(source) {
this.cacheable();
var params = loaderUtils.parseQuery(this.query);
if (params.harmony == 'false') {
params.harmony = false;
}
if (params.precompile == 'false') {
params.precompile = false;
}
var whitelist = {
harmony: true,
precompile: true
};
var unknownParams = [];
for (var i in params) {
if (!whitelist[i])
unknownParams.push(i);
}
if (unknownParams.length) {
var warn = unknownParams.length === 1 ?
'msx-loader got this undocumented option: ' :
'msx-loader got these undocumented options: ';
warn += unknownParams.join(', ');
this.emitWarning(warn);
}
return msx.transform(source, params);
};