wave

package
v0.85.0-pre.2 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package wave is the end-user runtime API for Wave applications.

Application code should only need this package to construct runtime behavior and attach middleware/templating helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetIsDev

func GetIsDev() bool

GetIsDev reports whether Wave is running in development mode.

func MustGetPort

func MustGetPort() int

MustGetPort returns the application runtime port. In dev mode it resolves and caches a framework-controlled free port. It panics in dev mode if a free port cannot be resolved. It panics in non-dev mode when PORT is missing or invalid.

func SetModeToDev

func SetModeToDev()

SetModeToDev marks the current process as development mode.

Types

type Config

type Config struct {
	// Required -- Raw Wave configuration JSON.
	WaveConfigJSON []byte

	// Required -- this must root at <distDir>/static for production.
	DistStaticFS fs.FS

	// Optional logger.
	Logger *slog.Logger
}

Config configures Wave initialization.

type Wave

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

Wave provides the app-facing runtime API surface.

func New

func New(c Config) *Wave

New constructs a Wave runtime instance from raw config JSON and a dist/static file system root.

func (*Wave) ConfigFile

func (w *Wave) ConfigFile() string

ConfigFile returns the original configuration file location if known.

func (*Wave) CriticalCSS

func (w *Wave) CriticalCSS() template.CSS

CriticalCSS returns critical CSS content when available.

func (*Wave) CriticalCSSStyleElement

func (w *Wave) CriticalCSSStyleElement() template.HTML

CriticalCSSStyleElement returns one rendered critical-css <style> element.

func (*Wave) DistDir

func (w *Wave) DistDir() string

DistDir returns the configured build output directory root.

func (*Wave) IsDev

func (w *Wave) IsDev() bool

IsDev returns true if running in development mode.

func (*Wave) Logger

func (w *Wave) Logger() *slog.Logger

Logger returns the Wave logger instance.

func (*Wave) MustGetPort

func (w *Wave) MustGetPort() int

MustGetPort returns the application runtime port.

func (*Wave) MustPrivateFS

func (w *Wave) MustPrivateFS() fs.FS

MustPrivateFS returns the private filesystem or panics if unavailable.

func (*Wave) MustStaticMiddleware

func (w *Wave) MustStaticMiddleware(
	immutable bool,
) func(http.Handler) http.Handler

MustStaticMiddleware returns middleware that serves static public assets and delegates all other requests to next.

func (*Wave) PrivateFS

func (w *Wave) PrivateFS() (fs.FS, error)

PrivateFS returns the runtime private-assets filesystem.

func (*Wave) PrivateStaticDir

func (w *Wave) PrivateStaticDir() string

PrivateStaticDir returns the source directory for private static assets.

func (*Wave) PublicPathPrefix

func (w *Wave) PublicPathPrefix() string

PublicPathPrefix returns the normalized configured public path prefix.

func (*Wave) PublicURL

func (w *Wave) PublicURL(original string) string

PublicURL resolves one source public asset path to its built URL.

func (*Wave) RawConfigJSON

func (w *Wave) RawConfigJSON() []byte

RawConfigJSON returns the raw bytes of the configuration file.

func (*Wave) RefreshScript

func (w *Wave) RefreshScript() template.HTML

RefreshScript returns one rendered dev refresh script.

func (*Wave) SetModeToDev

func (w *Wave) SetModeToDev()

SetModeToDev sets the environment to development mode.

func (*Wave) StaticPrivateOutDir

func (w *Wave) StaticPrivateOutDir() string

StaticPrivateOutDir returns the private static output directory.

func (*Wave) StaticPublicOutDir

func (w *Wave) StaticPublicOutDir() string

StaticPublicOutDir returns the public static output directory.

func (*Wave) StyleSheetLinkElement

func (w *Wave) StyleSheetLinkElement() template.HTML

StyleSheetLinkElement returns one rendered non-critical stylesheet <link>.

func (*Wave) ViteManifestLocation

func (w *Wave) ViteManifestLocation() string

ViteManifestLocation returns the expected path of the Vite manifest in build output.

Directories

Path Synopsis
buildtime
buildentry
Package buildentry owns wavebuild command parsing and execution orchestration.
Package buildentry owns wavebuild command parsing and execution orchestration.
builder
Package builder orchestrates Wave build execution across schema, CSS, and static artifact phases.
Package builder orchestrates Wave build execution across schema, CSS, and static artifact phases.
builder/internal/css
Package css implements the Wave CSS build and manifest generation pipeline.
Package css implements the Wave CSS build and manifest generation pipeline.
builder/internal/fileops
Package fileops provides deterministic file hashing and atomic write helpers for Wave build artifacts.
Package fileops provides deterministic file hashing and atomic write helpers for Wave build artifacts.
builder/internal/schema
Package schema parses and validates Wave configuration documents for build and runtime consumers.
Package schema parses and validates Wave configuration documents for build and runtime consumers.
builder/internal/static
Package static owns Wave static-asset planning, hashing, and public map generation.
Package static owns Wave static-asset planning, hashing, and public map generation.
devserver
Package devserver provides the top-level Wave development server orchestration API.
Package devserver provides the top-level Wave development server orchestration API.
internal/broadcast
Package broadcast provides websocket fan-out for Wave dev-server browser updates.
Package broadcast provides websocket fan-out for Wave dev-server browser updates.
internal/devserver/appsupervisor
Package appsupervisor manages dev-server process lifecycle and readiness probing.
Package appsupervisor manages dev-server process lifecycle and readiness probing.
internal/devserver/eventpipeline
Package eventpipeline classifies and plans filesystem watcher events for the Wave dev server.
Package eventpipeline classifies and plans filesystem watcher events for the Wave dev server.
internal/devserver/hooks
Package hooks normalizes and executes configured dev-server on-change hooks.
Package hooks normalizes and executes configured dev-server on-change hooks.
internal/devserver/reloadwait
Package reloadwait isolates browser runtime orchestration for devserver.
Package reloadwait isolates browser runtime orchestration for devserver.
internal/devserver/restartengine
Package restartengine decides and executes dev-server restart/build behavior.
Package restartengine decides and executes dev-server restart/build behavior.
internal/devserver/runloop
Package runloop executes the dev-server watcher event loop.
Package runloop executes the dev-server watcher event loop.
internal/outputledger
Package outputledger provides a Wave-owned on-disk build-output ledger and final reconciliation sweep helpers.
Package outputledger provides a Wave-owned on-disk build-output ledger and final reconciliation sweep helpers.
internal/watch
Package watch owns fsnotify watcher wiring and normalized event emission for Wave dev tooling.
Package watch owns fsnotify watcher wiring and normalized event emission for Wave dev tooling.
internal/watch/classification
Package classification maps changed filesystem paths to semantic watcher file types.
Package classification maps changed filesystem paths to semantic watcher file types.
internal/watch/dedup
Package dedup performs deterministic watcher event and path deduplication.
Package dedup performs deterministic watcher event and path deduplication.
internal
wavecache
Package wavecache provides low-level runtime cache primitives shared by Wave runtime services.
Package wavecache provides low-level runtime cache primitives shared by Wave runtime services.
wavefilemap
Package wavefilemap models mappings from source public assets to built output artifacts.
Package wavefilemap models mappings from source public assets to built output artifacts.
wavefs
Package wavefs owns small filesystem helpers shared by Wave build/dev internals.
Package wavefs owns small filesystem helpers shared by Wave build/dev internals.
waveglob
Package waveglob owns path normalization and glob matching semantics used by Wave build/dev watchers.
Package waveglob owns path normalization and glob matching semantics used by Wave build/dev watchers.
wavelock
Package wavelock owns Wave's project-level lock lifecycle for build and dev orchestration.
Package wavelock owns Wave's project-level lock lifecycle for build and dev orchestration.
waveruntime
Package waveruntime holds Wave runtime-specific rendering and config helpers.
Package waveruntime holds Wave runtime-specific rendering and config helpers.
waveruntimecore
Package waveruntimecore hosts low-level Wave runtime mechanics.
Package waveruntimecore hosts low-level Wave runtime mechanics.
Package waveartifacts defines build artifact naming and directory conventions.
Package waveartifacts defines build artifact naming and directory conventions.
Package waveconfig provides JSON parsing with filesystem-path invariants that can be applied to typed configuration structs.
Package waveconfig provides JSON parsing with filesystem-path invariants that can be applied to typed configuration structs.
Package waveenv provides runtime-safe environment and path primitives used by Wave runtime and config parsing.
Package waveenv provides runtime-safe environment and path primitives used by Wave runtime and config parsing.
Package waveframework provides framework/tooling-facing helpers that operate on Wave runtime instances without expanding the end-user `wave` API surface.
Package waveframework provides framework/tooling-facing helpers that operate on Wave runtime instances without expanding the end-user `wave` API surface.
Package wavewatch defines Wave's file-watch and hook execution contract used by framework tooling, devservers, and build pipelines.
Package wavewatch defines Wave's file-watch and hook execution contract used by framework tooling, devservers, and build pipelines.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL