buildgen

package
v0.12.3 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MPL-2.0 Imports: 43 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
	Locale      string
}

type AssetArtifact

type AssetArtifact struct {
	Path        string
	LogicalPath string
	Hash        string
	CachePolicy string
	SizeBytes   int64
	Obfuscated  bool
}

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 BuildPlan added in v0.12.1

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

BuildPlan is the normalized static output plan consumed by build emission. Construct it through PlanBuildFromValidatedProgram so validation, route defaults, localized page outputs, CSS/assets, fragments, schemas, and report metadata are finalized before files are written.

func PlanBuildFromValidatedProgram added in v0.12.1

func PlanBuildFromValidatedProgram(config gowdk.Config, validated compiler.ValidatedProgram, outputDir string) (BuildPlan, error)

PlanBuildFromValidatedProgram plans SPA build artifacts from compiler-validated IR without writing files.

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
	SizeBytes   int64
}

type LayoutErrorPage added in v0.8.0

type LayoutErrorPage struct {
	Layout    string
	ErrorPage string
}

type MemoryBuildOptions added in v0.5.0

type MemoryBuildOptions struct {
	// OutputBase is a virtual output root used for artifact path metadata.
	// Empty defaults to "." and never requires a real directory on disk.
	OutputBase string
}

MemoryBuildOptions controls path metadata for in-memory builds.

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 BuildMemoryFromAnalyzedProgram added in v0.12.1

func BuildMemoryFromAnalyzedProgram(config gowdk.Config, analyzed compiler.AnalyzedProgram, outputDir string) (MemoryResult, error)

BuildMemoryFromAnalyzedProgram validates analyzed compiler IR before planning in-memory artifacts.

func BuildMemoryFromAnalyzedProgramWithOptions added in v0.12.1

func BuildMemoryFromAnalyzedProgramWithOptions(config gowdk.Config, analyzed compiler.AnalyzedProgram, options MemoryBuildOptions) (MemoryResult, error)

BuildMemoryFromAnalyzedProgramWithOptions is BuildMemoryWithOptions for callers that already have analyzed compiler IR.

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.

func BuildMemoryFromIRWithOptions added in v0.5.0

func BuildMemoryFromIRWithOptions(config gowdk.Config, ir gwdkir.Program, options MemoryBuildOptions) (MemoryResult, error)

BuildMemoryFromIRWithOptions is BuildMemoryWithOptions for orchestrators that already have normalized compiler IR.

func BuildMemoryFromValidatedProgram added in v0.12.1

func BuildMemoryFromValidatedProgram(config gowdk.Config, validated compiler.ValidatedProgram, outputDir string) (MemoryResult, error)

BuildMemoryFromValidatedProgram plans in-memory SPA artifacts from compiler-validated IR.

func BuildMemoryWithOptions added in v0.5.0

func BuildMemoryWithOptions(config gowdk.Config, sources gwdkanalysis.Sources, options MemoryBuildOptions) (MemoryResult, error)

BuildMemoryWithOptions plans SPA build artifacts without requiring a real output directory. Empty MemoryBuildOptions.OutputBase defaults to ".".

type Result

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

func Build

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

func BuildFromAnalyzedProgram added in v0.12.1

func BuildFromAnalyzedProgram(config gowdk.Config, analyzed compiler.AnalyzedProgram, outputDir string) (Result, error)

BuildFromAnalyzedProgram validates analyzed compiler IR before emission.

func BuildFromIR

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

BuildFromIR writes SPA build artifacts from normalized compiler IR.

func BuildFromPlan added in v0.12.1

func BuildFromPlan(plan BuildPlan) (Result, error)

BuildFromPlan emits SPA build artifacts from a normalized build plan.

func BuildFromValidatedProgram added in v0.12.1

func BuildFromValidatedProgram(config gowdk.Config, validated compiler.ValidatedProgram, outputDir string) (Result, error)

BuildFromValidatedProgram emits SPA build artifacts from compiler-validated IR. The only way to obtain the phase token is through compiler validation.

func BuildIncremental

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

func BuildIncrementalFromAnalyzedProgram added in v0.12.1

func BuildIncrementalFromAnalyzedProgram(config gowdk.Config, analyzed compiler.AnalyzedProgram, outputDir string, changedPageSources []string) (Result, error)

BuildIncrementalFromAnalyzedProgram validates analyzed compiler IR before incrementally rendering changed SPA pages.

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.

func BuildIncrementalFromValidatedProgram added in v0.12.1

func BuildIncrementalFromValidatedProgram(config gowdk.Config, validated compiler.ValidatedProgram, outputDir string, changedPageSources []string) (Result, error)

BuildIncrementalFromValidatedProgram incrementally renders changed SPA pages from compiler-validated IR.

type RuntimeSitemapPlan added in v0.10.0

type RuntimeSitemapPlan struct {
	Enabled    bool
	BaseURL    string
	StaticURLs []runtimeseo.URL
	Dynamic    gowdk.SEODynamicSitemap
}

func RuntimeSitemapPlanFromIR added in v0.10.0

func RuntimeSitemapPlanFromIR(config gowdk.Config, ir gwdkir.Program) (RuntimeSitemapPlan, error)

func RuntimeSitemapPlanFromValidatedProgram added in v0.12.1

func RuntimeSitemapPlanFromValidatedProgram(config gowdk.Config, validated compiler.ValidatedProgram) (RuntimeSitemapPlan, error)

RuntimeSitemapPlanFromValidatedProgram builds the generated app runtime sitemap plan from compiler-validated IR.

type SSRArtifact

type SSRArtifact struct {
	PageID           string
	Route            string
	Render           gowdk.RenderMode
	Cache            string
	ErrorPage        string
	LayoutErrorPages []LayoutErrorPage
	Locale           string
	DynamicParams    []string
	RouteParams      []source.RouteParam
	Layouts          []string
	Guards           []string
	HasLoad          bool
	LoadBinding      source.BackendBinding
	HTML             string
	Replacements     []SSRReplacement
	LoadReplacements []SSRLoadReplacement
	ListSpecs        []SSRListSpec
	CondSpecs        []SSRCondSpec
	QueryRegions     []SSRQueryRegion
}

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.

func SSRArtifactsFromValidatedProgram added in v0.12.1

func SSRArtifactsFromValidatedProgram(config gowdk.Config, validated compiler.ValidatedProgram, outputDir string) ([]SSRArtifact, error)

SSRArtifactsFromValidatedProgram renders request-time page artifacts from compiler-validated IR.

type SSRCondSpec added in v0.6.0

type SSRCondSpec = source.SSRCondSpec

type SSRListSpec added in v0.6.0

type SSRListSpec = source.SSRListSpec

type SSRLoadReplacement

type SSRLoadReplacement = source.SSRLoadReplacement

type SSRQueryRegion added in v0.7.0

type SSRQueryRegion = source.SSRQueryRegion

SSRQueryRegion is the build-time render recipe for one g:query region. It is lowered by the app generator into a runtime region renderer.

type SSRReplacement

type SSRReplacement = source.SSRReplacement

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