2015-01-30 01:10:49 +00:00
|
|
|
'use strict';
|
|
|
|
|
2015-02-19 01:43:36 +00:00
|
|
|
var transformer = require('../packager/transformer.js');
|
2015-01-30 01:10:49 +00:00
|
|
|
|
2015-03-02 19:36:55 +00:00
|
|
|
function transformSource(src, filename) {
|
|
|
|
return transformer.transform(src, filename).code;
|
2015-01-30 01:10:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
transformSource: transformSource,
|
|
|
|
|
|
|
|
process: function(src, fileName) {
|
2015-03-02 18:42:31 +00:00
|
|
|
if (fileName.match(/node_modules/)) {
|
|
|
|
return src;
|
|
|
|
}
|
|
|
|
|
2015-01-30 01:10:49 +00:00
|
|
|
try {
|
2015-03-02 19:36:55 +00:00
|
|
|
return transformSource(src, fileName);
|
2015-01-30 01:10:49 +00:00
|
|
|
} catch(e) {
|
|
|
|
throw new Error('\nError transforming file:\n js/' +
|
|
|
|
(fileName.split('/js/')[1] || fileName) + ':' + e.lineNumber + ': \'' +
|
|
|
|
e.message + '\'\n');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|