Documentation
¶
Overview ¶
Package exporter renders a Gx app to static files (REQ-EXP-01). It builds the app with the gxdev tag, asks the dev-only export manifest for every GET page, writes each page under the output directory, copies the /_gx/ assets, writes 404.html and builds the Pagefind index.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manifest ¶
type Manifest struct {
Paths []string `json:"paths"`
Assets []string `json:"assets"`
LLMS *gx.LLMSManifest `json:"llms"`
// ServerOnly lists the mounted routes that need a server
// (REQ-EXP-02).
ServerOnly []ServerFeature `json:"serverOnly"`
}
Manifest is the dev-only export listing (REQ-EXP-01, REQ-CNT-08).
type Options ¶
type Options struct {
// Dir is the app module root.
Dir string
// Out is the output directory. It is emptied first.
Out string
// Main is the main package path; DetectMain finds it when empty.
Main string
// Log receives progress lines. Defaults to io.Discard.
Log io.Writer
// Index writes the search index into a directory. Defaults to the
// pinned Pagefind binary.
Index func(ctx context.Context, root, siteDir string) error
// SiteURL overrides [site] url from gx.toml (REQ-CNT-09).
SiteURL string
}
Options configure one export.
type Result ¶
type Result struct {
// Pages maps a site path to its rendered HTML.
Pages map[string][]byte
// Paths lists the exported site paths in manifest order.
Paths []string
// Assets lists the /_gx/ asset URLs.
Assets []string
// NotFound is the rendered 404 page.
NotFound []byte
// LLMS is the llms.txt manifest of the app, when it has one.
LLMS *gx.LLMSManifest
}
Result carries the exported pages for the follow-up writers (REQ-CNT-08, REQ-CNT-09).
type ServerFeature ¶
type ServerFeature struct {
// Kind is "action", "form", "form on a page" or "live validation".
Kind string `json:"kind"`
// Pattern is the route pattern, or the page path for a page marker.
Pattern string `json:"pattern"`
}
ServerFeature is one feature a static host cannot run (REQ-EXP-02).