src/main/javascript/Build/Babel.js
function (options, overrides) {
    let resolved = null;

    if (typeof options === 'string') { //we've been give a path to a project dir or babelrc
      let babelrcPath;
      const stats = fs.statSync(options);
      if (stats.isDirectory()) {
        babelrcPath = path.join(options, '.babelrc');
      } else if (stats.isFile()) {
        babelrcPath = options;
      }

      if (babelrcPath) {
        try {
          const babelOptions = JSON.parse(fs.readFileSync(babelrcPath));
          resolved = resolveOptions(babelOptions);
        } catch (e) {
          console.log(e);
        }
      }

    } else if (typeof options === 'object') {
      resolved = resolveOptions(options);
    }

    if (resolved) {
      Object.keys(overrides).forEach(function (key) {
        resolved[key] = overrides[key];
      });
      return resolved;
    }

    return null;
  }
function (options, overrides) {
    let resolved = null;

    if (typeof options === 'string') { //we've been give a path to a project dir or babelrc
      let babelrcPath;
      const stats = fs.statSync(options);
      if (stats.isDirectory()) {
        babelrcPath = path.join(options, '.babelrc');
      } else if (stats.isFile()) {
        babelrcPath = options;
      }

      if (babelrcPath) {
        try {
          const babelOptions = JSON.parse(fs.readFileSync(babelrcPath));
          resolved = resolveOptions(babelOptions);
        } catch (e) {
          console.log(e);
        }
      }

    } else if (typeof options === 'object') {
      resolved = resolveOptions(options);
    }

    if (resolved) {
      Object.keys(overrides).forEach(function (key) {
        resolved[key] = overrides[key];
      });
      return resolved;
    }

    return null;
  }
function ( options , overrides ) { let resolved = null ; if ( typeof options === 'string' ) { //we've been give a path to a project dir or babelrc let babelrcPath ; const stats = fs . statSync ( options ) ; if ( stats . isDirectory ( ) ) { babelrcPath = path . join ( options , '.babelrc' ) ; } else if ( stats . isFile ( ) ) { babelrcPath = options ; } if ( babelrcPath ) { try { const babelOptions = JSON . parse ( fs . readFileSync ( babelrcPath ) ) ; resolved = resolveOptions ( babelOptions ) ; } catch ( e ) { console . log ( e ) ; } } } else if ( typeof options === 'object' ) { resolved = resolveOptions ( options ) ; } if ( resolved ) { Object . keys ( overrides ) . forEach ( function ( key ) { resolved [ key ] = overrides [ key ] ; } ) ; return resolved ; } return null ; }
Replaces plugin and presets short names with absolute paths

@param {{}|String} options
@param {{}} overrides
@return {*}
Replaces plugin and presets short names with absolute paths