code: function getImports(moduleTree) {
        var imports = [];
  
        function addImport(name) {
          if (indexOf.call(imports, name) == -1)
            imports.push(name);
        }
  
        // tree traversal, NB should use visitor pattern here
        function traverse(object, iterator, parent, parentProperty) {
          var key, child;
          if (iterator(object, parent, parentProperty) === false)
            return;
          for (key in object) {
            if (!object.hasOwnProperty(key))
              continue;
            if (key == 'location' || key == 'type')
              continue;
            child = object[key];
            if (typeof child == 'object' && child !== null)
              traverse(child, iterator, object, key);
          }
        }
  
        traverse(moduleTree, function(node) {
          // import {} from 'foo';
          // export * from 'foo';
          // export { ... } from 'foo';
          // import * as x from 'foo';
          if (node.type == 'EXPORT_DECLARATION') {
            if (node.declaration.moduleSpecifier)
              addImport(node.declaration.moduleSpecifier.token.processedValue);
          }
          else if (node.type == 'IMPORT_DECLARATION')
            addImport(node.moduleSpecifier.token.processedValue);
          else if (node.type == 'MODULE_DECLARATION')
            addImport(node.expression.token.processedValue);
        });
        return imports;
      }
docs: given a syntax tree, return the import list