react-native/jestSupport/scriptPreprocess.js
Spencer Ahrens eeb0bf145d Updates from Sun Feb 15
- [react-packager][streamline oss] Injectable transformer | Amjad Masad
2015-02-18 17:43:36 -08:00

22 lines
493 B
JavaScript

'use strict';
var transformer = require('../packager/transformer.js');
function transformSource(src) {
return transformer.transform(null, src).code;
}
module.exports = {
transformSource: transformSource,
process: function(src, fileName) {
try {
return transformSource(src);
} catch(e) {
throw new Error('\nError transforming file:\n js/' +
(fileName.split('/js/')[1] || fileName) + ':' + e.lineNumber + ': \'' +
e.message + '\'\n');
}
}
};