Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function compile (filename) {
// merge in base options and resolve all the plugins and presets relative to this file
babelrc.plugins = babelrc.plugins || [];
babelrc.plugins.push(babelIstanbulPlugin);
babelrc.plugins = uniq(babelrc.plugins);
const transformOpts = new OptionManager().init(extend({}, babelrc, {
sourceRoot: dirname(filename),
filename
}));
const transformed = transform(readFileSync(filename, 'utf8'), transformOpts);
return transformed.code;
}