Help us shape the future of Go! Take the 2026 Go Developer Survey

transpiler

package
v1.3.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL