Class ModuleLoader


  • public final class ModuleLoader
    extends java.lang.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 Detail

      • MODULE_SLASH

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

        public static final java.lang.String DEFAULT_FILENAME_PREFIX
        The default module root, the current directory.
        See Also:
        Constant Field Values
      • JSC_BROWSER_SKIPLISTED_MARKER

        public static final java.lang.String JSC_BROWSER_SKIPLISTED_MARKER
        See Also:
        Constant Field Values
      • INVALID_MODULE_PATH

        public static final DiagnosticType INVALID_MODULE_PATH
      • EMPTY

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

      • getPackageJsonMainEntries

        public java.util.Map<java.lang.String,​java.lang.String> getPackageJsonMainEntries()
      • isRelativeIdentifier

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

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

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

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

        public static java.lang.String relativePathFrom​(java.lang.String fromUriPath,
                                                        java.lang.String toUriPath)
      • setErrorHandler

        public void setErrorHandler​(ErrorHandler errorHandler)