builder

package
v0.0.0-...-3c1f4a5 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Debug = false

Debug is a global flag, which is only used by the command line program to track errors down.

Functions

func RewriteHTML

func RewriteHTML(file string, indexData IndexData) error

RewriteTemplate reads the given file, applies it as a template and writes it back again (as *.html).

Types

type BuildInfo

type BuildInfo struct {
	// Time of this build.
	Time time.Time
	// Version contains a hash or something else which uniquely identifies this build.
	Version string
	// CompileError is nil or contains a compile error.
	CompileError error
	// HotReload is true, if the server should be polled at /api/v1/poll/version.
	HotReload bool
	// Wasm is true, if the web assembly (app.wasm) is available.
	Wasm bool
	// Commit may be empty, if the project is not contained in a git repository.
	Commit string
	// Host name.
	Host string
	// Compiler denotes the compiler which has created the wasm build.
	Compiler string
	// Extra may be nil or injected by user.
	Extra interface{}
}

BuildInfo provides some basic information about a gotrino build.

func (BuildInfo) Error

func (b BuildInfo) Error() string

Error returns an html formatted error description. Check HasError before.

func (BuildInfo) HasError

func (b BuildInfo) HasError() bool

HasError returns true, if something went wrong while building.

type CompileErr

type CompileErr struct {
	// contains filtered or unexported fields
}

A CompileErr denotes a special build error, which is solely related to applying templates or the go compiler.

func (CompileErr) Error

func (b CompileErr) Error() string

func (CompileErr) Unwrap

func (b CompileErr) Unwrap() error

type IndexData

type IndexData struct {
	WasmVersion       string
	WasmBridgeVersion string
	Body              string
	HotReload         bool
	LoadWasm          bool
}

type Options

type Options struct {
	Force            bool
	HotReload        bool
	TemplatePatterns []string
	Extra            interface{}
	Debug            bool
	GoGenerate       bool
}

Options to use for building.

type Part

type Part struct {
	// contains filtered or unexported fields
}

A Part of a Project.

type Project

type Project struct {
	// contains filtered or unexported fields
}

A Project is kept usually in-memory to efficiently (re-)build a Go module with dependent other modules.

func NewProject

func NewProject(dstPath, srcPath string) (*Project, error)

NewProject allocates a new project and setups one-time things.

func (*Project) Build

func (p *Project) Build(opts Options) ([32]byte, error)

Build syncs the file tree of all modules into the build destination directory and compiles the web assembly. Returns the unique hash of the last build.

Jump to

Keyboard shortcuts

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