|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.javascript.jscomp.ProcessCommonJSModules
public class ProcessCommonJSModules
Rewrites a Common JS 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. goog.provide and goog.require are emitted for closure compiler automatic ordering.
Field Summary | |
---|---|
static String |
DEFAULT_FILENAME_PREFIX
|
Method Summary | |
---|---|
void |
process(Node externs,
Node root)
Process the JS with root node root. |
static String |
toModuleName(String filename)
Turns a filename into a JS identifier that is used for moduleNames in rewritten code. |
static String |
toModuleName(String requiredFilename,
String currentFilename)
Turn a filename into a moduleName with support for relative addressing with ./ and ../ based on currentFilename; |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_FILENAME_PREFIX
Method Detail |
---|
public void process(Node externs, Node root)
CompilerPass
process
in interface CompilerPass
externs
- Top of external JS treeroot
- Top of JS treepublic static String toModuleName(String filename)
public static String toModuleName(String requiredFilename, String currentFilename)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |