public final class ModuleMetadata
extends java.lang.Object
TODO(johnplaisted): There's an opportunity for reuse here in ClosureRewriteModules, which would involve putting this in some common location. Currently this is only used as a helper class for Es6RewriteModules. CompilerInput already has some (not all) of this information but it is not always populated. It may also be ideal to include CommonJS here too as ES6 modules can import them. That would allow decoupling of how these modules are written; right now Es6RewriteModule only checks this for goog.requires and goog: imports, not for ES6 path imports.
Modifier and Type | Class and Description |
---|---|
static class |
ModuleMetadata.Module
Struct containing basic information about a module including its type and goog namespaces.
|
static class |
ModuleMetadata.ModuleType
Various types of Javascript "modules" that can be found in the JS Compiler.
|
Constructor and Description |
---|
ModuleMetadata(AbstractCompiler compiler) |
ModuleMetadata(AbstractCompiler compiler,
boolean processCommonJsModules,
ModuleLoader.ResolutionMode moduleResolutionMode) |
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,ModuleMetadata.Module> |
getModulesByGoogNamespace() |
java.util.Map<java.lang.String,ModuleMetadata.Module> |
getModulesByPath() |
void |
hotSwapScript(Node scriptRoot) |
void |
process(Node externs,
Node root) |
public ModuleMetadata(AbstractCompiler compiler)
public ModuleMetadata(AbstractCompiler compiler, boolean processCommonJsModules, ModuleLoader.ResolutionMode moduleResolutionMode)
public void hotSwapScript(Node scriptRoot)
public java.util.Map<java.lang.String,ModuleMetadata.Module> getModulesByPath()
ModuleMetadata.Module.googNamespaces()
contains all Closure namespaces in the file. These are not the
same modules from getModulesByGoogNamespace()
. It is not valid to
call ModuleMetadata.Module.getGlobalName()
on ModuleMetadata.ModuleType.GOOG_PROVIDE
modules from this
map that have more than one Closure namespace as it is ambiguous.public java.util.Map<java.lang.String,ModuleMetadata.Module> getModulesByGoogNamespace()
ModuleMetadata.Module.googNamespaces()
will have size 1. As a result, it is valid to call
ModuleMetadata.Module.getGlobalName()
on these modules. These are not the same modules from getModulesByPath()
.Copyright © 2009-2018 Google. All Rights Reserved.