Class ModuleLoader

java.lang.Object
com.google.javascript.jscomp.deps.ModuleLoader

public final class ModuleLoader extends Object
Provides compile-time locate semantics for ES6 and CommonJS modules.
See Also:
  • "https://tc39.github.io/ecma262/#sec-module-semantics"
  • "http://wiki.commonjs.org/wiki/Modules/1.1"
  • Field Details

    • MODULE_CONFLICT

      public static final DiagnosticType MODULE_CONFLICT
    • MODULE_SLASH

      public static final String MODULE_SLASH
      According to the spec, the forward slash should be the delimiter on all platforms.
      See Also:
    • DEFAULT_FILENAME_PREFIX

      public static final String DEFAULT_FILENAME_PREFIX
      The default module root, the current directory.
      See Also:
    • JSC_BROWSER_SKIPLISTED_MARKER

      public static final String JSC_BROWSER_SKIPLISTED_MARKER
      See Also:
    • LOAD_WARNING

      public static final DiagnosticType LOAD_WARNING
    • INVALID_MODULE_PATH

      public static final DiagnosticType INVALID_MODULE_PATH
    • EMPTY

      public static final ModuleLoader EMPTY
      A trivial module loader with no roots.
  • Method Details

    • builder

      public static ModuleLoader.Builder builder()
    • getPackageJsonMainEntries

      public Map<String,String> getPackageJsonMainEntries()
    • resolve

      public ModuleLoader.ModulePath resolve(String path)
      Resolves a path into a ModuleLoader.ModulePath.
    • isRelativeIdentifier

      public static boolean isRelativeIdentifier(String name)
      Whether this is relative to the current file, or a top-level identifier.
    • isAbsoluteIdentifier

      public static boolean isAbsoluteIdentifier(String name)
      Whether this is absolute to the compilation.
    • isAmbiguousIdentifier

      public static boolean isAmbiguousIdentifier(String name)
      Whether this is neither absolute or relative.
    • isPathIdentifier

      public static boolean isPathIdentifier(String name)
      Whether name is a path-based identifier (has a '/' character)
    • relativePathFrom

      public static String relativePathFrom(String fromUriPath, String toUriPath)
    • setErrorHandler

      public void setErrorHandler(ErrorHandler errorHandler)
    • getErrorHandler

      public ErrorHandler getErrorHandler()