Class ModuleLoader.ModulePath
java.lang.Object
com.google.javascript.jscomp.deps.ModuleLoader.ModulePath
- Enclosing class:
ModuleLoader
A path to a module. Provides access to the module's closurized name and a way to resolve
relative paths.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Determines if this path is the same as another path, ignoring any potential leading slashes on both.@Nullable ModuleLoader.ModulePath
resolveJsModule
(String moduleAddress, String sourcename, int lineno, int colno) Find a JS modulerequireName
.resolveModuleAsPath
(String moduleAddress) Treats the module address as a path and returns the name of that module.Turns a filename into a JS identifier that is used for moduleNames in rewritten code.toString()
-
Method Details
-
toString
-
equalsIgnoreLeadingSlash
Determines if this path is the same as another path, ignoring any potential leading slashes on both. -
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
public @Nullable ModuleLoader.ModulePath resolveJsModule(String moduleAddress, 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
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
-