public final class ModuleLoader
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
ModuleLoader.ModulePath
A path to a module.
|
static interface |
ModuleLoader.ModuleResolverFactory
An enum used to specify what algorithm to use to locate non path-based modules
|
static class |
ModuleLoader.PathEscaper
Indicates whether to escape characters in paths.
|
static class |
ModuleLoader.PathResolver
An enum indicating whether to absolutize paths.
|
static class |
ModuleLoader.ResolutionMode
Standard path base resolution algorithms that are accepted as a command line flag.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_FILENAME_PREFIX
The default module root, the current directory.
|
static ModuleLoader |
EMPTY
A trivial module loader with no roots.
|
static DiagnosticType |
INVALID_MODULE_PATH |
static java.lang.String |
JSC_BROWSER_BLACKLISTED_MARKER |
static DiagnosticType |
LOAD_WARNING |
static DiagnosticType |
MODULE_CONFLICT |
static java.lang.String |
MODULE_SLASH
According to the spec, the forward slash should be the delimiter on all platforms.
|
Constructor and Description |
---|
ModuleLoader(ErrorHandler errorHandler,
java.lang.Iterable<java.lang.String> moduleRoots,
java.lang.Iterable<? extends DependencyInfo> inputs,
ModuleLoader.ModuleResolverFactory factory) |
ModuleLoader(ErrorHandler errorHandler,
java.lang.Iterable<java.lang.String> moduleRoots,
java.lang.Iterable<? extends DependencyInfo> inputs,
ModuleLoader.ModuleResolverFactory factory,
ModuleLoader.PathResolver pathResolver) |
ModuleLoader(ErrorHandler errorHandler,
java.lang.Iterable<java.lang.String> moduleRoots,
java.lang.Iterable<? extends DependencyInfo> inputs,
ModuleLoader.ModuleResolverFactory factory,
ModuleLoader.PathResolver pathResolver,
ModuleLoader.PathEscaper pathEscaper)
Creates an instance of the module loader which can be used to locate ES6 and CommonJS modules.
|
Modifier and Type | Method and Description |
---|---|
ErrorHandler |
getErrorHandler() |
java.util.Map<java.lang.String,java.lang.String> |
getPackageJsonMainEntries() |
static boolean |
isAbsoluteIdentifier(java.lang.String name)
Whether this is absolute to the compilation.
|
static boolean |
isAmbiguousIdentifier(java.lang.String name)
Whether this is neither absolute or relative.
|
static boolean |
isPathIdentifier(java.lang.String name)
Whether name is a path-based identifier (has a '/' character)
|
static boolean |
isRelativeIdentifier(java.lang.String name)
Whether this is relative to the current file, or a top-level identifier.
|
ModuleLoader.ModulePath |
resolve(java.lang.String path)
Resolves a path into a
ModuleLoader.ModulePath . |
void |
setErrorHandler(ErrorHandler errorHandler) |
public static final DiagnosticType MODULE_CONFLICT
public static final java.lang.String MODULE_SLASH
public static final java.lang.String DEFAULT_FILENAME_PREFIX
public static final java.lang.String JSC_BROWSER_BLACKLISTED_MARKER
public static final DiagnosticType LOAD_WARNING
public static final DiagnosticType INVALID_MODULE_PATH
public static final ModuleLoader EMPTY
public ModuleLoader(@Nullable ErrorHandler errorHandler, java.lang.Iterable<java.lang.String> moduleRoots, java.lang.Iterable<? extends DependencyInfo> inputs, ModuleLoader.ModuleResolverFactory factory, ModuleLoader.PathResolver pathResolver, ModuleLoader.PathEscaper pathEscaper)
moduleRoots
- path prefixes to strip from module pathsinputs
- all inputs to the compilation process. Used to ensure that resolved paths
references an valid input.factory
- creates a module resolver, which determines how module identifiers are resolvedpathResolver
- determines how to sanitize paths before resolvingpathEscaper
- determines if / how paths should be escapedpublic ModuleLoader(@Nullable ErrorHandler errorHandler, java.lang.Iterable<java.lang.String> moduleRoots, java.lang.Iterable<? extends DependencyInfo> inputs, ModuleLoader.ModuleResolverFactory factory, ModuleLoader.PathResolver pathResolver)
public ModuleLoader(@Nullable ErrorHandler errorHandler, java.lang.Iterable<java.lang.String> moduleRoots, java.lang.Iterable<? extends DependencyInfo> inputs, ModuleLoader.ModuleResolverFactory factory)
public java.util.Map<java.lang.String,java.lang.String> getPackageJsonMainEntries()
public ModuleLoader.ModulePath resolve(java.lang.String path)
ModuleLoader.ModulePath
.public static boolean isRelativeIdentifier(java.lang.String name)
public static boolean isAbsoluteIdentifier(java.lang.String name)
public static boolean isAmbiguousIdentifier(java.lang.String name)
public static boolean isPathIdentifier(java.lang.String name)
public void setErrorHandler(ErrorHandler errorHandler)
public ErrorHandler getErrorHandler()
Copyright © 2009-2018 Google. All Rights Reserved.