Class ModuleResolver
java.lang.Object
com.google.javascript.jscomp.deps.ModuleResolver
- Direct Known Subclasses:
BrowserModuleResolver
,BrowserWithTransformedPrefixesModuleResolver
,NodeModuleResolver
Base class for algorithms that resolve JavaScript module references to input files.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ErrorHandler
protected final com.google.common.collect.ImmutableSet
<String> The set of all known input module URIs (including trailing .js), after normalization.protected final com.google.common.collect.ImmutableList
<String> Root URIs to match module roots against. -
Constructor Summary
ConstructorsConstructorDescriptionModuleResolver
(com.google.common.collect.ImmutableSet<String> modulePaths, com.google.common.collect.ImmutableList<String> moduleRootPaths, ErrorHandler errorHandler, ModuleLoader.PathEscaper pathEscaper) -
Method Summary
Modifier and TypeMethodDescriptionprotected String
canonicalizePath
(String scriptAddress, String moduleAddress) Normalizes a module path reference.protected @Nullable String
Locates the module with the given name, but returns null if there is no JS file in the expected location.abstract @Nullable String
resolveJsModule
(String scriptAddress, String moduleAddress, String sourcename, int lineno, int colno) resolveModuleAsPath
(String scriptAddress, String moduleAddress) void
setErrorHandler
(ErrorHandler errorHandler)
-
Field Details
-
modulePaths
The set of all known input module URIs (including trailing .js), after normalization. -
moduleRootPaths
Root URIs to match module roots against. -
errorHandler
-
-
Constructor Details
-
ModuleResolver
public ModuleResolver(com.google.common.collect.ImmutableSet<String> modulePaths, com.google.common.collect.ImmutableList<String> moduleRootPaths, ErrorHandler errorHandler, ModuleLoader.PathEscaper pathEscaper)
-
-
Method Details
-
resolveJsModule
-
resolveModuleAsPath
-
locate
Locates the module with the given name, but returns null if there is no JS file in the expected location. -
canonicalizePath
Normalizes a module path reference. Includes escaping special characters and converting relative paths to absolute references. -
setErrorHandler
-