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 BudgetFile ¶ added in v0.4.0
BudgetFile is one file of a page with its gzipped size.
type BudgetFinding ¶ added in v0.4.0
type BudgetFinding struct {
// Pattern is the route pattern of the page, and Path the address that
// the check read.
Pattern, Path string
// Kind is "JS" or "CSS".
Kind string
// Bytes is the gzipped size that the page loads, and Limit its budget.
Bytes, Limit int
// Files are the files of the page of that kind, the largest first.
Files []BudgetFile
}
BudgetFinding is one page over one of its budgets.
func Budgets ¶ added in v0.4.0
func Budgets(ctx context.Context, dir, main string, budget gxconfig.Budget) ([]BudgetFinding, error)
Budgets starts the app of dir and returns each page that is over its budget. main is the main package of the app, or "" to find it.
func (BudgetFinding) String ¶ added in v0.4.0
func (f BudgetFinding) String() string
String is the message of the finding: the numbers and each file.
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).