Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"use strict";
const register = require("babel-register").default;
const config = require("../.babelrc");
register(Object.assign({}, config, {
extensions: [".js"],
// Only js files in the test folder but not in the subfolder fixtures.
only: [/packages\/.+\/test\/(?!fixtures\/).+\.js$/],
compact: true,
}));
import fs from 'fs';
import path from 'path';
import register from 'babel-register';
const rcPath = path.join(__dirname, '..', '.babelrc');
const source = fs.readFileSync(rcPath).toString();
const config = JSON.parse(source);
config.ignore = (filename) => (/\/node_modules\//).test(filename);
register(config);
export default function transpile() {
const path = require.resolve('babel-runtime/package')
.replace(/[\\\/]package.json$/, '');
try {
register({
presets: [preset2015],
plugins: [
transformRuntime,
[alias, [
{ src: path, expose: 'babel-runtime' },
]],
],
});
return;
} catch (e) {
throw new Error(e);
}
}