lib/process_babel_plugins.js
function processPlugins(baseURL, plugins) {
	var normalized = [];

	// path.resolve does not work correctly if baseURL starts with "file:"
	baseURL = baseURL.replace("file:", "");
	plugins = plugins || [];

	plugins.forEach(function(plugin) {
		var name = getPluginName(plugin);

		if (isPluginFunction(plugin) || isBuiltinPlugin(name)) {
			normalized.push(plugin);
		}
		else if (!isBuiltinPlugin(name)) {
			var npmPluginNameOrPath = getNpmPluginNameOrPath(baseURL, name);

			// load the plugin!
			var pluginFn = require(npmPluginNameOrPath);

			if (_.isString(plugin)) {
				normalized.push(pluginFn);
			}
			else if (_.isArray(plugin)) {
				// [ pluginName, pluginOptions ]
				normalized.push([pluginFn, plugin[1]]);
			}
		}
	});

	return normalized;
}
function processPlugins(baseURL, plugins) {
	var normalized = [];

	// path.resolve does not work correctly if baseURL starts with "file:"
	baseURL = baseURL.replace("file:", "");
	plugins = plugins || [];

	plugins.forEach(function(plugin) {
		var name = getPluginName(plugin);

		if (isPluginFunction(plugin) || isBuiltinPlugin(name)) {
			normalized.push(plugin);
		}
		else if (!isBuiltinPlugin(name)) {
			var npmPluginNameOrPath = getNpmPluginNameOrPath(baseURL, name);

			// load the plugin!
			var pluginFn = require(npmPluginNameOrPath);

			if (_.isString(plugin)) {
				normalized.push(pluginFn);
			}
			else if (_.isArray(plugin)) {
				// [ pluginName, pluginOptions ]
				normalized.push([pluginFn, plugin[1]]);
			}
		}
	});

	return normalized;
}
function processPlugins ( baseURL , plugins ) { var normalized = [ ] ; // path.resolve does not work correctly if baseURL starts with "file:" baseURL = baseURL . replace ( "file:" , "" ) ; plugins = plugins || [ ] ; plugins . forEach ( function ( plugin ) { var name = getPluginName ( plugin ) ; if ( isPluginFunction ( plugin ) || isBuiltinPlugin ( name ) ) { normalized . push ( plugin ) ; } else if ( ! isBuiltinPlugin ( name ) ) { var npmPluginNameOrPath = getNpmPluginNameOrPath ( baseURL , name ) ; // load the plugin! var pluginFn = require ( npmPluginNameOrPath ) ; if ( _ . isString ( plugin ) ) { normalized . push ( pluginFn ) ; } else if ( _ . isArray ( plugin ) ) { // [ pluginName, pluginOptions ] normalized . push ( [ pluginFn , plugin [ 1 ] ] ) ; } } } ) ; return normalized ; }
Collect builtin plugin names and non builtin plugin functions
@param {string} baseURL The loader baseURL value
@param {BabelPlugin[]} plugins An array of babel plugins
@return {BabelPlugin[]} An array of babel plugins filtered by the babel
environment name and with non-builtins replaced
by their respective functions
Collect builtin plugin names and non builtin plugin functions