Documentation
¶
Overview ¶
Package preview implements `puzzle preview`: a local server for an ALREADY BUILT dist/, behaving the way the host that will serve it behaves. There is no watcher, no rebuild, no live-reload injection and no dev.proxy — the output is served exactly as it sits on disk, because the point of the command is to check the artifact rather than the source.
What "the way a host behaves" means is decided by the resolved output mode from puzzle.config.js (D81), and that resolution lives in internal/serve so `puzzle dev` answers static URLs identically:
- SPA: history-API fallback — anything that is not a file is index.html.
- hybrid: the route's prerendered page when one was written, index.html otherwise (the router owns the rest).
- static: clean URLs and a real 404 on a miss. No index.html fallback: a static host has no router to fall back to, and a preview that quietly served the home page for a missing route would hide exactly the bug this command exists to catch.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Options ¶
type Options struct {
// Port is the TCP port to listen on. A busy port is not fatal: the D90 scan
// takes the next free one unless StrictPort is set.
Port int
// StrictPort binds Port or fails, for the same reasons `puzzle dev` has it —
// container mappings and redirect URIs pin a number on purpose.
StrictPort bool
// OnReady runs after the ready banner is printed (test/CLI hook).
OnReady func()
}
Options configure Serve.
Click to show internal directories.
Click to hide internal directories.