/**
 * Copyright (c) 2013-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 *
 * @format
 */

'use strict';

module.exports = function(options) {
  options = Object.assign(
    {
      env: 'production',
      moduleMap: {},
      plugins: [],
    },
    options,
  );

  const fbjsPreset = require('babel-preset-fbjs/configure')({
    autoImport: options.autoImport || false,
    objectAssign: false,
    inlineRequires: true,
    stripDEV: options.env === 'production',
  });

  // The module rewrite transform needs to be positioned relative to fbjs's
  // many other transforms.
  fbjsPreset.presets[0].plugins.push([
    require('./rewrite-modules'),
    {
      map: Object.assign({}, require('fbjs/module-map'), options.moduleMap),
    },
  ]);

  if (options.postPlugins) {
    fbjsPreset.presets.push({
      plugins: options.postPlugins,
    });
  }

  return {
    plugins: options.plugins.concat('transform-es2015-spread'),
    presets: [fbjsPreset],
  };
};

/**
 * Copyright (c) 2013-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @noformat
 */

'use strict';

module.exports = function(options) {
  options = Object.assign(
    {
      env: 'production',
      moduleMap: {},
      plugins: [],
    },
    options
  );

  const fbjsPreset = require('babel-preset-fbjs/configure')({
    autoImport: options.autoImport || false,
    objectAssign: false,
    inlineRequires: true,
    stripDEV: options.env === 'production',
  });

  // The module rewrite transform needs to be positioned relative to fbjs's
  // many other transforms.
  fbjsPreset.presets[0].plugins.push([
    require('./rewrite-modules'),
    {
      map: Object.assign({}, require('fbjs/module-map'), options.moduleMap),
    },
  ]);

  if (options.postPlugins) {
    fbjsPreset.presets.push({
      plugins: options.postPlugins,
    });
  }

  return {
    plugins: options.plugins.concat('transform-es2015-spread'),
    presets: [fbjsPreset],
  };
};

Fix CI for node 6
Fix CI for node 6

Summary:
This file is executed without transforms so we can't have trailing commas in function calls until we drop node 6.
Closes https://github.com/facebook/relay/pull/2424

Differential Revision: D7754622

Pulled By: kassens

fbshipit-source-id: a3a54348cc4890616304c9ed5a739d4a92a9e305
