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

    • UNKNOWN_REQUIRE_ENSURE

      public static final DiagnosticType UNKNOWN_REQUIRE_ENSURE
    • SUSPICIOUS_EXPORTS_ASSIGNMENT

      public static final DiagnosticType SUSPICIOUS_EXPORTS_ASSIGNMENT
  • Constructor Details

    • ProcessCommonJSModules

      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