var esprima = require('esprima-fb');

module.exports = function () {
    return function (code, filename) {
        var ast = esprima.parse(code, {sourceType: 'module'});
        var body = ast.body;
        var imports = body.filter(function (node) {
            return node.type == 'ImportDeclaration';
        }).map(function (node) {
            return node.source.value;
        });
        return {
            name: filename,
            imports: imports
        };
    };
};

@@ -205,16 +205,19 @@
     var 
+es6
 imports 
@@ -380,24 +380,703 @@
         %7D);%0A
+        var requires = body.filter(function (node) %7B%0A            // TODO: this doesn't detect something like this:%0A            // var something = require('module')(somearguments);%0A            // only this:%0A            // var something = require('module');%0A            if (node.type !== 'VariableDeclaration')%0A                return false;%0A            var init = node.declarations%5B0%5D.init;%0A            if (init.type != 'CallExpression')%0A                return false;%0A            if (init.callee.name != 'require')%0A                return false;%0A            return true;%0A%0A        %7D).map(function (node) %7B%0A            return node.declarations%5B0%5D.init.arguments%5B0%5D.value;%0A        %7D);%0A
         retu
@@ -1120,16 +1120,19 @@
         
+es6
 imports:
@@ -1132,23 +1132,108 @@
 mports: 
+es6
 imports
+,%0A            requires: requires,%0A            imports: es6imports.concat(requires)
 %0A       

support (partially) CommonJS modules in ES6ModuleInfo plugin