"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.runBabelForJSFile = runBabelForJSFile;

var _core = require("@babel/core");

var _babelWebConfig = require("./babelWebConfig");

var _copyFile = require("../fileUtils/copyFile");

function runBabelForJSFile({
  filename,
  outputFile,
  options,
  mode = 'es'
}) {
  // const jsSourceCode = readFileSync(filename).toString();
  const babelConfig = (0, _babelWebConfig.babelWebConfig)(options, mode);
  const result = (0, _core.transformFileSync)(filename, babelConfig);
  (0, _copyFile.writeFile)(outputFile, result.code);
}