Documentation ¶
Index ¶
Constants ¶
View Source
const DefaultTranspilerCommand = "transpiler"
DefaultTranspilerCommand is the binary used for executing the transpiler
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TranspileError ¶
type TranspileError struct { Index int `json:"index"` // index into code input Message string `json:"message"` Line int `json:"line"` Column int `json:"column"` }
TranspileError contains the error message from a failed transpile attempt, and the line/column if available
func (TranspileError) Error ¶
func (te TranspileError) Error() string
Error returns the error messag
type TranspileErrors ¶
type TranspileErrors []*TranspileError
TranspileErrors is a slice of TranspileError
func (TranspileErrors) Error ¶
func (tes TranspileErrors) Error() string
type TranspileResult ¶
type TranspileResult struct { Code string `json:"code"` SourceMap json.RawMessage `json:"map"` }
TranspileResult contains the transpiled code and the source map obtained from a transpiler run
type Transpiler ¶
type Transpiler interface {
Transpile(ctx context.Context, code ...string) ([]TranspileResult, error)
}
Transpiler allows building transpiled source code and a source map from a given ES6 source string
func NewExternalTranspiler ¶
func NewExternalTranspiler(command string) Transpiler
NewExternalTranspiler returns an instance of Transpiler that works by invoking the binary at the given path
Click to show internal directories.
Click to hide internal directories.