mirror of
https://github.com/status-im/react-native.git
synced 2025-01-27 09:45:04 +00:00
1490ab12ef
Summary: Includes React Native and its dependencies Fresco, Metro, and Yoga. Excludes samples/examples/docs. find: ^(?:( *)|( *(?:[\*~#]|::))( )? *)?Copyright (?:\(c\) )?(\d{4})\b.+Facebook[\s\S]+?BSD[\s\S]+?(?:this source tree|the same directory)\.$ replace: $1$2$3Copyright (c) $4-present, Facebook, Inc.\n$2\n$1$2$3This source code is licensed under the MIT license found in the\n$1$2$3LICENSE file in the root directory of this source tree. Reviewed By: TheSavior, yungsters Differential Revision: D7007050 fbshipit-source-id: 37dd6bf0ffec0923bfc99c260bb330683f35553e
37 lines
1018 B
JavaScript
37 lines
1018 B
JavaScript
/**
|
|
* Copyright (c) 2015-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.
|
|
*/
|
|
'use strict';
|
|
|
|
/**
|
|
* Manually resolve all default Babel plugins.
|
|
* `babel.transform` will attempt to resolve all base plugins relative to
|
|
* the file it's compiling. This makes sure that we're using the plugins
|
|
* installed in the react-native package.
|
|
*/
|
|
function resolvePlugins(plugins) {
|
|
return plugins.map(resolvePlugin);
|
|
}
|
|
|
|
/**
|
|
* Manually resolve a single Babel plugin.
|
|
*/
|
|
function resolvePlugin(plugin) {
|
|
// Normalise plugin to an array.
|
|
if (!Array.isArray(plugin)) {
|
|
plugin = [plugin];
|
|
}
|
|
// Only resolve the plugin if it's a string reference.
|
|
if (typeof plugin[0] === 'string') {
|
|
plugin[0] = require('babel-plugin-' + plugin[0]);
|
|
plugin[0] = plugin[0].__esModule ? plugin[0].default : plugin[0];
|
|
}
|
|
return plugin;
|
|
}
|
|
|
|
module.exports = resolvePlugins;
|
|
module.exports.resolvePlugin = resolvePlugin;
|