Interface Transpiler
- All Known Implementing Classes:
BaseTranspiler
,CachingTranspiler
public interface Transpiler
Common interface for a transpiler.
There are a number of considerations when implementing this interface. Specifically,
- Which compiler and options to use, including language mode and any
specific Compiler subclass. This is handled by
BaseTranspiler
accepting aCompilerSupplier
. - Whether or not to generate external or embedded source maps. This
is handled by returning a
TranspileResult
, which is able to return any combination of embedded or external source map. - Specification of a
sourceURL
, handling ofgoog.module
, or other postprocessing, such as wrapping the script ineval
. This is left to other collaborators. - Caching. This is handled by a
CachingTranspiler
that decorates an existingTranspiler
with caching behavior.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Transpiler
Null implementation that does no transpilation at all. -
Method Summary
-
Field Details
-
NULL
Null implementation that does no transpilation at all.
-
-
Method Details
-
transpile
Transforms the given chunk of code. The input should be an entire file worth of code. -
runtime
String runtime()Returns any necessary runtime code as a string. This should include everything that could possibly be required at runtime, regardless of whether it's actually used by any of the code that will be transpiled.
-