buildgen

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Overview

Package buildgen emits app-shell HTML artifacts for build-time pages.

Index

Constants

View Source
const DisableCSSDiscovery = "__gowdk_disable_css_discovery__"

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	PageID      string
	Route       string
	Path        string
	CachePolicy string
}

type AssetArtifact

type AssetArtifact struct {
	Path        string
	LogicalPath string
	Hash        string
	CachePolicy string
}

type BuildDiagnostic

type BuildDiagnostic struct {
	Code          string            `json:"code"`
	ComponentName string            `json:"componentName,omitempty"`
	Source        string            `json:"source,omitempty"`
	Span          source.SourceSpan `json:"span,omitempty"`
	Message       string            `json:"message"`
}

BuildDiagnostic is a structured diagnostic produced during SPA planning or output generation after parser/compiler validation has already completed.

type BuildError

type BuildError struct {
	Err         error
	Report      BuildReport
	Diagnostics []BuildDiagnostic
}

func (*BuildError) Error

func (err *BuildError) Error() string

func (*BuildError) Unwrap

func (err *BuildError) Unwrap() error

type BuildEvent

type BuildEvent struct {
	Level   BuildEventLevel   `json:"level"`
	Stage   string            `json:"stage"`
	Kind    string            `json:"kind,omitempty"`
	Message string            `json:"message"`
	PageID  string            `json:"pageId,omitempty"`
	Route   string            `json:"route,omitempty"`
	Path    string            `json:"path,omitempty"`
	Data    map[string]string `json:"data,omitempty"`
}

type BuildEventLevel

type BuildEventLevel string
const (
	BuildEventDebug BuildEventLevel = "debug"
	BuildEventInfo  BuildEventLevel = "info"
	BuildEventError BuildEventLevel = "error"
)

type BuildReport

type BuildReport struct {
	Version   int          `json:"version"`
	Mode      string       `json:"mode"`
	OutputDir string       `json:"outputDir"`
	Events    []BuildEvent `json:"events"`
}

type CSSArtifact

type CSSArtifact struct {
	Path        string
	LogicalPath string
	LogicalHref string
	Hash        string
	CachePolicy string
}

type MemoryResult

type MemoryResult struct {
	Result
	Files map[string][]byte
}

func BuildMemory

func BuildMemory(config gowdk.Config, sources gwdkanalysis.Sources, outputDir string) (MemoryResult, error)

func BuildMemoryFromIR

func BuildMemoryFromIR(config gowdk.Config, ir gwdkir.Program, outputDir string) (MemoryResult, error)

BuildMemoryFromIR plans SPA build artifacts from normalized compiler IR without writing them to disk.

type Result

type Result struct {
	Artifacts         []Artifact
	CSSArtifacts      []CSSArtifact
	AssetArtifacts    []AssetArtifact
	RouteManifestPath string
	AssetManifestPath string
	OpenAPIPath       string
	BuildReportPath   string
	Report            BuildReport
	WriteStats        WriteStats
}

func Build

func Build(config gowdk.Config, sources gwdkanalysis.Sources, outputDir string) (Result, error)

func BuildFromIR

func BuildFromIR(config gowdk.Config, ir gwdkir.Program, outputDir string) (Result, error)

BuildFromIR writes SPA build artifacts from normalized compiler IR.

func BuildFromValidatedIR added in v0.2.8

func BuildFromValidatedIR(config gowdk.Config, ir gwdkir.Program, outputDir string) (Result, error)

BuildFromValidatedIR is BuildFromIR for orchestrators that already ran compiler.ValidateProgram on the IR (the CLI build path). It skips the defensive re-validation, which type-checks feature Go packages on disk and is too expensive to run twice per build, but still runs cheap IR invariant checks before planning generated output.

func BuildIncremental

func BuildIncremental(config gowdk.Config, sources gwdkanalysis.Sources, outputDir string, changedPageSources []string) (Result, error)

func BuildIncrementalFromIR

func BuildIncrementalFromIR(config gowdk.Config, ir gwdkir.Program, outputDir string, changedPageSources []string) (Result, error)

BuildIncrementalFromIR incrementally renders changed SPA page outputs from normalized compiler IR.

type SSRArtifact

type SSRArtifact struct {
	PageID           string
	Route            string
	Render           gowdk.RenderMode
	Cache            string
	ErrorPage        string
	DynamicParams    []string
	RouteParams      []source.RouteParam
	Guards           []string
	HasLoad          bool
	LoadBinding      source.BackendBinding
	HTML             string
	Replacements     []SSRReplacement
	LoadReplacements []SSRLoadReplacement
}

func SSRArtifacts

func SSRArtifacts(config gowdk.Config, sources gwdkanalysis.Sources, outputDir string) ([]SSRArtifact, error)

func SSRArtifactsFromIR

func SSRArtifactsFromIR(config gowdk.Config, ir gwdkir.Program, outputDir string) ([]SSRArtifact, error)

SSRArtifactsFromIR renders request-time page artifacts from normalized compiler IR.

type SSRLoadReplacement

type SSRLoadReplacement struct {
	Path        string
	Placeholder string
}

type SSRReplacement

type SSRReplacement struct {
	Param       string
	Placeholder string
}

type WriteStats added in v0.3.0

type WriteStats struct {
	FilesWritten           int
	IdenticalWritesSkipped int
}

Jump to

Keyboard shortcuts

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