Class ProcessCommonJSModules

All Implemented Interfaces:
CompilerPass, NodeTraversal.Callback

public final class ProcessCommonJSModules extends NodeTraversal.AbstractPreOrderCallback implements CompilerPass
Rewrites a CommonJS module http://wiki.commonjs.org/wiki/Modules/1.1.1 into a form that can be safely concatenated. Does not add a function around the module body but instead adds suffixes to global variables to avoid conflicts. Calls to require are changed to reference the required module directly.
  • Field Details Link icon

    • UNKNOWN_REQUIRE_ENSURE Link icon

      public static final DiagnosticType UNKNOWN_REQUIRE_ENSURE
    • SUSPICIOUS_EXPORTS_ASSIGNMENT Link icon

      public static final DiagnosticType SUSPICIOUS_EXPORTS_ASSIGNMENT
  • Constructor Details Link icon

    • ProcessCommonJSModules Link icon

      public ProcessCommonJSModules(AbstractCompiler compiler)
      Creates a new ProcessCommonJSModules instance which can be used to rewrite CommonJS modules to a concatenable form.
      Parameters:
      compiler - The compiler
  • Method Details Link icon