INNER CODE UNIT · JavaScript
babelTranspile
thinkjs/thinkjs · packages/think-babel/index.js:11
function babelTranspile(config) {
const {srcPath, outPath, file, ext = '.js'} = config;
let {options} = config;
const filePath = path.join(srcPath, file);
const pPath = path.dirname(path.join(outPath, file));
const content = fs.readFileSync(filePath, 'utf8');
const relativePath = path.relative(pPath, path.join(srcPath, file));
// babel options
options = Object.assign({
filename: file,
sourceFileName: relativePath,
sourceMaps: true,
babelrc: false
}, options);
// babel transform
let data;