text: 'use strict';
  
  var UNNAMED = /import\s*['"]([^'"]+)['"];?/gi;
  var NAMED = /import\s*(\*\s*as)?\s*(\w*?)\s*,?\s*(?:\{([\s\S]*?)\})?\s*from\s*['"]([^'"]+)['"];?/gi;
  
  function alias(key) {
  	key = key.trim();
  	var name = key.split(' as ');
  	(name.length > 1) && (key=name.shift());
  	return { key: key, name: name[0] };
  }
  
  function generate(keys, dep, base, fn) {
  	var tmp = base || (dep.split('/').pop().replace(/\W/g, '_') + '$' + num++); // uniqueness
  	var name = base || alias(tmp).name;
  
  	dep = fn + "('" + dep + "')";
  
  	var obj;
  	var out = "const " + name + " = " + dep + ";";
  
  	keys.forEach(function (key) {
  		obj = alias(key);
  		out += "\nconst " + (obj.name) + " = " + tmp + "." + (obj.key) + ";";
  	});
  
  	return out;
  }
  
  var num;
  module.exports = function (str, fn) {
  	num = 0;
  	fn = fn || 'require';
  	return str
  		.replace(NAMED, function (_, asterisk, base, req, dep) { return generate(req ? req.split(',') : [], dep, base, fn); })
  		.replace(UNNAMED, function (_, dep) { return (fn + "('" + dep + "');"); });
  }
  