public final class ModuleMetadataMap
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 |
ModuleMetadataMap.ModuleMetadata
Struct containing basic information about a module including its type and goog namespaces.
|
static class |
ModuleMetadataMap.ModuleType
Various types of Javascript "modules" that can be found in the JS Compiler.
|
Constructor and Description |
---|
ModuleMetadataMap(java.util.Map<java.lang.String,ModuleMetadataMap.ModuleMetadata> modulesByPath,
java.util.Map<java.lang.String,ModuleMetadataMap.ModuleMetadata> modulesByGoogNamespace) |
Modifier and Type | Method and Description |
---|---|
com.google.common.collect.ImmutableMap<java.lang.String,ModuleMetadataMap.ModuleMetadata> |
getModulesByGoogNamespace() |
com.google.common.collect.ImmutableMap<java.lang.String,ModuleMetadataMap.ModuleMetadata> |
getModulesByPath() |
public ModuleMetadataMap(java.util.Map<java.lang.String,ModuleMetadataMap.ModuleMetadata> modulesByPath, java.util.Map<java.lang.String,ModuleMetadataMap.ModuleMetadata> modulesByGoogNamespace)
public com.google.common.collect.ImmutableMap<java.lang.String,ModuleMetadataMap.ModuleMetadata> getModulesByPath()
ModuleMetadataMap.ModuleMetadata.googNamespaces()
contains all Closure namespaces in the file. These are not
the same modules from getModulesByGoogNamespace()
. It is not
valid to call ModuleRenaming#getGlobalName(ModuleMetadata, String)
on ModuleMetadataMap.ModuleType.GOOG_PROVIDE
modules from this map that have more than one Closure namespace as
it is ambiguous.public com.google.common.collect.ImmutableMap<java.lang.String,ModuleMetadataMap.ModuleMetadata> getModulesByGoogNamespace()
ModuleMetadataMap.ModuleMetadata.googNamespaces()
will have size 1. As a result, it is valid to
call ModuleRenaming#getGlobalName(ModuleMetadata, String)
on these modules. These
are not the same modules from getModulesByPath()
.Copyright © 2009-2019 Google. All Rights Reserved.