Class ModuleLoader.ModulePath
- java.lang.Object
-
- com.google.javascript.jscomp.deps.ModuleLoader.ModulePath
-
- Enclosing class:
- ModuleLoader
public class ModuleLoader.ModulePath extends java.lang.Object
A path to a module. Provides access to the module's closurized name and a way to resolve relative paths.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equalsIgnoreLeadingSlash(ModuleLoader.ModulePath other)
Determines if this path is the same as another path, ignoring any potential leading slashes on both.ModuleLoader.ModulePath
resolveJsModule(java.lang.String moduleAddress, java.lang.String sourcename, int lineno, int colno)
Find a JS modulerequireName
.ModuleLoader.ModulePath
resolveModuleAsPath(java.lang.String moduleAddress)
Treats the module address as a path and returns the name of that module.java.lang.String
toModuleName()
Turns a filename into a JS identifier that is used for moduleNames in rewritten code.java.lang.String
toString()
-
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equalsIgnoreLeadingSlash
public boolean equalsIgnoreLeadingSlash(ModuleLoader.ModulePath other)
Determines if this path is the same as another path, ignoring any potential leading slashes on both.
-
toModuleName
public java.lang.String toModuleName()
Turns a filename into a JS identifier that is used for moduleNames in rewritten code. Removes leading /, replaces / with $, removes trailing .js and replaces - with _. All moduleNames get a "module$" prefix.
-
resolveJsModule
@Nullable public ModuleLoader.ModulePath resolveJsModule(java.lang.String moduleAddress, java.lang.String sourcename, int lineno, int colno)
Find a JS modulerequireName
. See https://nodejs.org/api/modules.html#modules_all_together- Returns:
- The normalized module URI, or
null
if not found.
-
resolveModuleAsPath
public ModuleLoader.ModulePath resolveModuleAsPath(java.lang.String moduleAddress)
Treats the module address as a path and returns the name of that module. Does not verify that there is actually a JS file at the provided URI.Primarily used for per-file ES6 module transpilation
-
-