Class BaseTranspiler.CompilerSupplier

  • Enclosing class:
    BaseTranspiler

    public static class BaseTranspiler.CompilerSupplier
    extends java.lang.Object
    Wraps the Compiler into a more relevant interface, making it easy to test the Transpiler without depending on implementation details of the Compiler itself. Also works around the fact that the Compiler is not thread-safe (since we may do multiple transpiles concurrently), so we supply a fresh instance each time when we're in single-file mode.
    • Field Detail

      • moduleRoots

        protected final com.google.common.collect.ImmutableList<java.lang.String> moduleRoots
      • prefixReplacements

        protected final com.google.common.collect.ImmutableMap<java.lang.String,​java.lang.String> prefixReplacements
      • outputFeatureSet

        protected final FeatureSet outputFeatureSet
    • Constructor Detail

      • CompilerSupplier

        public CompilerSupplier()
      • CompilerSupplier

        public CompilerSupplier​(FeatureSet outputFeatureSet)
      • CompilerSupplier

        public CompilerSupplier​(FeatureSet outputFeatureSet,
                                ModuleLoader.ResolutionMode moduleResolution,
                                com.google.common.collect.ImmutableList<java.lang.String> moduleRoots,
                                com.google.common.collect.ImmutableMap<java.lang.String,​java.lang.String> prefixReplacements)
        Accepts commonly overridden options for ES6 modules to avoid needed to subclass.
        Parameters:
        moduleResolution - module resolution for resolving import paths
        prefixReplacements - prefix replacements for when moduleResolution is ModuleLoader.ResolutionMode.BROWSER_WITH_TRANSFORMED_PREFIXES
    • Method Detail

      • runtime

        public java.lang.String runtime​(java.lang.String library)
      • compiler

        protected Compiler compiler()
      • createTrivialExterns

        protected SourceFile createTrivialExterns()
      • createEmptySource

        protected SourceFile createEmptySource()