2015-04-22 18:56:46 +03:00
|
|
|
var babel = require('babel');
|
|
|
|
var fs = require('fs');
|
|
|
|
var crypto = require('crypto');
|
|
|
|
|
2015-02-10 08:24:12 +03:00
|
|
|
module.exports = {
|
|
|
|
process: function(src, filename) {
|
2015-04-22 18:56:46 +03:00
|
|
|
if (filename.indexOf('node_modules') !== -1) {
|
|
|
|
return src;
|
2015-02-10 08:24:12 +03:00
|
|
|
}
|
2015-04-22 18:56:46 +03:00
|
|
|
var compiled = babel.transform(src, {filename: filename, sourceMap: true});
|
|
|
|
fs.writeFileSync('/tmp/' + crypto.createHash('md5').update(filename).digest('hex') + '.map', JSON.stringify(compiled.map));
|
|
|
|
return compiled.code;
|
2015-02-10 08:24:12 +03:00
|
|
|
}
|
|
|
|
};
|