Class Es6RewriteModules

  • All Implemented Interfaces:
    CompilerPass, NodeTraversal.Callback

    public final class Es6RewriteModules
    extends java.lang.Object
    implements CompilerPass, NodeTraversal.Callback
    Rewrites a ES6 module into a form that can be safely concatenated. Note that we treat a file as an ES6 module if it has at least one import or export statement.

    Also rewrites any goog.{require,requireType,forwardDeclare,goog.module.get} calls that are either in an ES module or of an ES module using goog.declareModuleId.

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean isEs6ModuleRoot​(Node scriptNode)
      Return whether or not the given script node represents an ES6 module file.
      void process​(Node externs, Node root)
      Process the JS with root node root.
      boolean shouldTraverse​(NodeTraversal nodeTraversal, Node n, Node parent)
      Visits a node in preorder (before its children) and decides whether the node and its children should be traversed.
      void visit​(NodeTraversal t, Node n, Node parent)
      Visits a node in postorder (after its children).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait