devserver

package
v0.0.0-...-b7a3837 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(opts Options) error

Build runs a one-off production build.

func BuildOptions

func BuildOptions(build api.BuildOptions, isDev bool) api.BuildOptions

BuildOptions returns a copy of build tuned for either dev or prod.

func Run

func Run(defaults Options)

Run parses flags for the CLI and runs either a one-off build or a dev server.

func Start

func Start(ctx context.Context, opts Options) error

Start builds and watches, serving on 127.0.0.1 and blocking until ctx is cancelled.

Types

type Logger

type Logger interface {
	Printf(format string, v ...any)
	Fatal(v ...any)
}

type Options

type Options struct {
	// Logger is used to log build/serve output.
	Logger Logger
	// Build holds the project-specific configuration, some settings are overridden.
	Build api.BuildOptions
	// Output is the build output directory.
	Output string
	// PublicDir, if set, is copied into Output before building, it's also served by the dev server.
	PublicDir string
	// Port the dev server binds to (127.0.0.1), defaults to 8000.
	Port int
	// OpenBrowser opens Output's URL once the dev server is listening.
	OpenBrowser bool
}

Options configures a build or dev server run.

Jump to

Keyboard shortcuts

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