Documentation
¶
Overview ¶
Package config loads puzzle.config.js — the app's optional configuration file (constellation/doc/DOC-DECISIONS.md D12). The Go side must never parse JavaScript (D3), so the config is read by executing node: it imports the ES module and prints its default export as JSON, which Go then unmarshals. No config file present means zero-config defaults and no node invocation at all.
v1 surface (SPEC §3, §11): styles.use accepts the single string entry "tailwindcss". The object form (`{ name: 'sass', ... }`) and any other string are parsed and rejected with a clear "not in v1" error — the grammar is recognized so the message can name what was deferred, not a generic failure.
Index ¶
Constants ¶
const ConfigFileName = "puzzle.config.js"
ConfigFileName is the app-root config file. Its absence is not an error.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Build ¶
type Build struct {
// DropConsole is the tri-state build.dropConsole setting: nil means the key
// was absent (default behavior), a non-nil pointer is the explicit user
// value. The pointer lets "unset" be distinguished from an explicit false.
DropConsole *bool
}
Build mirrors the `build` block of puzzle.config.js.
type Config ¶
type Config struct {
Styles Styles
Build Build
Dev Dev
// Output is the resolved `output` key: "" (absent — the default SPA build)
// or "static" (per-route static HTML, the SSG mode). Any other value is
// rejected by validate with a message naming the allowed values.
Output string
}
Config is the resolved, validated configuration. The zero value is the valid "no config file" state: no style pipelines declared, default build, SPA output.
func LoadConfig ¶
LoadConfig loads and validates puzzle.config.js from appRoot.
- No config file: returns the zero Config and no error (no node needed).
- Config present but node missing / unrunnable: a clear error.
- Config present but malformed JS: node's syntax error, surfaced.
- A deferred entry (object form, or a non-"tailwindcss" string): a "not in v1" error naming the entry.
func (Config) DropConsole ¶
DropConsole reports whether production builds should strip console.* calls. Unset (no config file, or build.dropConsole absent) defaults to true — the v1 behavior; build.dropConsole: false opts out.
func (Config) StaticOutput ¶
StaticOutput reports whether the app declares the static (SSG) output mode via `output: 'static'`. Absent (or no config file) reports false — the default SPA build. The `puzzle build --static` flag enables the same step without touching the config.
func (Config) TailwindEnabled ¶
TailwindEnabled reports whether the Tailwind pipeline is declared.