appgen

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package appgen emits a generated Go app that embeds static build output.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildBinary

func BuildBinary(appDir, binaryPath string) (string, error)

BuildBinary compiles the generated app into binaryPath.

func BuildWASM

func BuildWASM(appDir, wasmPath string) (string, error)

BuildWASM compiles the generated app into a Go js/wasm artifact.

Types

type ActionFragment

type ActionFragment struct {
	Target string
	HTML   string
}

ActionFragment describes a generated partial response fragment.

type ActionRoute

type ActionRoute struct {
	PageID         string
	ActionName     string
	Route          string
	InputName      string
	InputType      string
	InputFields    []string
	RequiredFields []string
	ValidatesInput bool
	Redirect       string
	Fragments      []ActionFragment
}

ActionRoute describes a generated static action handler.

func ActionRoutes

func ActionRoutes(app manifest.Manifest) ([]ActionRoute, error)

ActionRoutes extracts generated action routes from a parsed manifest.

type Options

type Options struct {
	Actions []ActionRoute
	SSR     []SSRRoute
}

Options configures generated app output.

type Result

type Result struct {
	AppDir      string
	MainPath    string
	PackagePath string
	ModulePath  string
	StaticDir   string
	Files       []string
	BinaryPath  string
}

Result describes generated app artifacts.

func Generate

func Generate(staticDir, appDir string) (Result, error)

Generate writes a self-contained Go app that embeds staticDir.

func GenerateWithOptions

func GenerateWithOptions(staticDir, appDir string, options Options) (Result, error)

GenerateWithOptions writes a self-contained Go app that embeds staticDir.

type SSRReplacement

type SSRReplacement struct {
	Param       string
	Placeholder string
}

SSRReplacement maps a generated placeholder back to a request route param.

type SSRRoute

type SSRRoute struct {
	PageID       string
	Route        string
	HTML         string
	Replacements []SSRReplacement
}

SSRRoute describes a generated request-time page handler.

Jump to

Keyboard shortcuts

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