public final class TransformAMDToCJSModule extends java.lang.Object implements CompilerPass
ProcessCommonJSModules
for follow up processing
step.Modifier and Type | Class and Description |
---|---|
private static class |
TransformAMDToCJSModule.DefineCallbackReturnCallback
Rewrites the return statement of the callback to be an assignment to
module.exports.
|
private static class |
TransformAMDToCJSModule.RenameCallback
Renames names;
|
private class |
TransformAMDToCJSModule.TransformAMDModulesCallback
Rewrites calls to define which has to be in void context just below the
current script node.
|
Modifier and Type | Field and Description |
---|---|
private AbstractCompiler |
compiler |
(package private) static DiagnosticType |
NON_TOP_LEVEL_STATEMENT_DEFINE_ERROR |
private int |
renameIndex |
(package private) static DiagnosticType |
REQUIREJS_PLUGINS_NOT_SUPPORTED_WARNING |
(package private) static DiagnosticType |
UNSUPPORTED_DEFINE_SIGNATURE_ERROR |
(package private) static java.lang.String |
VAR_RENAME_SUFFIX |
Constructor and Description |
---|
TransformAMDToCJSModule(AbstractCompiler compiler) |
Modifier and Type | Method and Description |
---|---|
private static boolean |
isVirtualModuleName(java.lang.String moduleName)
The modules "exports", "require" and "module" are virtual in terms of
existing implicitly in CommonJS.
|
void |
process(Node externs,
Node root)
Process the JS with root node root.
|
private static void |
unsupportedDefineError(NodeTraversal t,
Node n) |
static final DiagnosticType UNSUPPORTED_DEFINE_SIGNATURE_ERROR
static final DiagnosticType NON_TOP_LEVEL_STATEMENT_DEFINE_ERROR
static final DiagnosticType REQUIREJS_PLUGINS_NOT_SUPPORTED_WARNING
static final java.lang.String VAR_RENAME_SUFFIX
private final AbstractCompiler compiler
private int renameIndex
public TransformAMDToCJSModule(AbstractCompiler compiler)
public void process(Node externs, Node root)
CompilerPass
process
in interface CompilerPass
externs
- Top of external JS treeroot
- Top of JS treeprivate static void unsupportedDefineError(NodeTraversal t, Node n)
private static boolean isVirtualModuleName(java.lang.String moduleName)