"use strict";

var _babelJest = _interopRequireDefault(require("babel-jest"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

const getOptions = require('../../../lib/utils/getOptions').default;

const {
  enableTypeScript,
  babelCustomizationForLibrary
} = getOptions();
const {
  babelPlugins
} = babelCustomizationForLibrary;
const resolvedPlugins = [];
babelPlugins.forEach(plugin => {
  resolvedPlugins.push(require.resolve(plugin));
});
const presets = [require.resolve('@babel/preset-env'), require.resolve('@babel/preset-react')];

if (enableTypeScript) {
  presets.push(require.resolve('@babel/preset-typescript'));
}

const defaultPlugins = [require.resolve('babel-plugin-transform-dynamic-import')];
const plugins = [...defaultPlugins, ...resolvedPlugins];
module.exports = _babelJest.default.createTransformer({
  presets: presets,
  plugins: plugins
});