"use strict";

const babel = require('@babel/core');

const options = {
  presets: [[require.resolve('@babel/preset-env'), {
    modules: false,
    useBuiltIns: 'usage',
    corejs: 3,
    targets: {
      browsers: [// 'chrome 111',
      // 'edge 111',
      // 'firefox 111',
      // 'safari 16.2',
      'chrome 104', 'edge 104', 'firefox 104', 'safari 15.5']
    }
  }], require.resolve('@babel/preset-react')]
};

function convertCode(code) {
  const result = babel.transformSync(code, options);
  return result.code;
}

module.exports = {
  options,
  convertCode
};