2015-10-09 14:56:00 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
|
2016-04-12 15:28:22 +00:00
|
|
|
Array.prototype.values || require('core-js/fn/array/values');
|
|
|
|
Object.entries || require('core-js/fn/object/entries');
|
|
|
|
Object.values || require('core-js/fn/object/values');
|
2015-11-10 18:51:39 +00:00
|
|
|
|
2016-04-30 23:53:52 +00:00
|
|
|
var fs = require('fs');
|
|
|
|
var path = require('path');
|
|
|
|
|
2015-10-09 14:56:00 +00:00
|
|
|
var _only = [];
|
|
|
|
|
2016-04-30 23:53:52 +00:00
|
|
|
function readBabelRC() {
|
|
|
|
var rcpath = path.join(__dirname, 'react-packager', 'rn-babelrc.json');
|
|
|
|
var source = fs.readFileSync(rcpath).toString();
|
|
|
|
return JSON.parse(source);
|
|
|
|
}
|
|
|
|
|
2015-10-09 14:56:00 +00:00
|
|
|
module.exports = function(onlyList) {
|
|
|
|
_only = _only.concat(onlyList);
|
2016-04-30 23:53:52 +00:00
|
|
|
var config = readBabelRC();
|
|
|
|
config.only = _only;
|
|
|
|
require('babel-register')(config);
|
2015-10-09 14:56:00 +00:00
|
|
|
};
|