ki

package
v0.84.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: BSD-3-Clause Imports: 51 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CriticalCSSElementID = "wave-critical-css"
	StyleSheetElementID  = "wave-normal-css"
)
View Source
const (
	PUBLIC  = "public"
	PRIVATE = "private"
)
View Source
const (
	PublicFileMapJSName   = "vorma_internal_public_filemap.js"
	PublicFileMapGobName  = "public_filemap.gob"
	PrivateFileMapGobName = "private_filemap.gob"
)
View Source
const (
	OnChangeStrategyPre              = "pre"
	OnChangeStrategyPost             = "post"
	OnChangeStrategyConcurrent       = "concurrent"
	OnChangeStrategyConcurrentNoWait = "concurrent-no-wait"
)
View Source
const PrehashedDirname = "prehashed"

Variables

View Source
var ErrConfigValidation = errors.New("config validation error")
View Source
var STATIC_FILENAMES_IGNORE_LIST = map[string]struct{}{
	".DS_Store": {},
}

__TODO this should probably be a config option and use glob patterns

View Source
var TimingEnum = struct {
	Pre              Timing
	Post             Timing
	Concurrent       Timing
	ConcurrentNoWait Timing
}{
	Pre:              "pre",
	Post:             "post",
	Concurrent:       "concurrent",
	ConcurrentNoWait: "concurrent-no-wait",
}

Functions

func GetIsDev

func GetIsDev() bool

func GetRefreshScriptInner

func GetRefreshScriptInner(port int) string

func MustGetAppPort

func MustGetAppPort() int

func SetModeToDev

func SetModeToDev()

Types

type Base64

type Base64 = string

type BuildOptions

type BuildOptions struct {
	IsDev             bool
	RecompileGoBinary bool
	// contains filtered or unexported fields
}

type CSSEntryFiles

type CSSEntryFiles struct {
	Critical    string
	NonCritical string
}

type CleanSources

type CleanSources struct {
	Dist                string
	PrivateStatic       string
	PublicStatic        string
	CriticalCSSEntry    string
	NonCriticalCSSEntry string
}

type Config

type Config struct {
	// Required -- the bytes of your wave.config.json file. You can
	// use go:embed or just read the file in yourself. Using go:embed
	// is recommended for simpler deployments and improved performance.
	WaveConfigJSON []byte

	// Required -- be sure to pass in a file system that has your
	// <distDir>/static directory as its ROOT. If you are using an
	// embedded filesystem, you may need to use fs.Sub to get the
	// correct subdirectory. Using go:embed is recommended for simpler
	// deployments and improved performance.
	DistStaticFS fs.FS

	// Optional -- a Logger instance. If not provided, a default Logger
	// will be created that writes to standard out.
	Logger *slog.Logger
	// contains filtered or unexported fields
}

func (*Config) AddPublicAssetKeys

func (c *Config) AddPublicAssetKeys(statements *tsgen.Statements) *tsgen.Statements

If you pass nil to this function, it will return a pointer to a new Statements object. If you pass a pointer to an existing Statements object, it will mutate that object and return it.

func (*Config) BuildWave

func (c *Config) BuildWave(opts BuildOptions) error

func (*Config) BuildWaveWithHook

func (c *Config) BuildWaveWithHook(hook func(isDev bool) error)

func (*Config) FaviconRedirect

func (c *Config) FaviconRedirect() middleware.Middleware

func (*Config) GetBaseFS

func (c *Config) GetBaseFS() (fs.FS, error)

GetBaseFS returns a filesystem interface that works across different environments (dev/prod) and supports both embedded and non-embedded filesystems.

func (*Config) GetConfigFile

func (c *Config) GetConfigFile() string

func (*Config) GetCriticalCSS

func (c *Config) GetCriticalCSS() string

func (*Config) GetCriticalCSSStyleElement

func (c *Config) GetCriticalCSSStyleElement() template.HTML

func (*Config) GetCriticalCSSStyleElementSha256Hash

func (c *Config) GetCriticalCSSStyleElementSha256Hash() string

func (*Config) GetDistDir

func (c *Config) GetDistDir() string

func (*Config) GetPrivateFS

func (c *Config) GetPrivateFS() (fs.FS, error)

func (*Config) GetPrivateStaticDir

func (c *Config) GetPrivateStaticDir() string

func (*Config) GetPublicFS

func (c *Config) GetPublicFS() (fs.FS, error)

func (*Config) GetPublicFileMap

func (c *Config) GetPublicFileMap() (FileMap, error)

func (*Config) GetPublicFileMapElements

func (c *Config) GetPublicFileMapElements() template.HTML

func (*Config) GetPublicFileMapKeysBuildtime

func (c *Config) GetPublicFileMapKeysBuildtime() ([]string, error)

func (*Config) GetPublicFileMapScriptSha256Hash

func (c *Config) GetPublicFileMapScriptSha256Hash() string

func (*Config) GetPublicFileMapURL

func (c *Config) GetPublicFileMapURL() string

func (*Config) GetPublicPathPrefix

func (c *Config) GetPublicPathPrefix() string

func (*Config) GetPublicStaticDir

func (c *Config) GetPublicStaticDir() string

func (*Config) GetPublicURL

func (c *Config) GetPublicURL(originalPublicURL string) string

func (*Config) GetRefreshScript

func (c *Config) GetRefreshScript() template.HTML

func (*Config) GetRefreshScriptSha256Hash

func (c *Config) GetRefreshScriptSha256Hash() string

func (*Config) GetServeStaticHandler

func (c *Config) GetServeStaticHandler(addImmutableCacheHeaders bool) (http.Handler, error)

func (*Config) GetSimplePublicFileMapBuildtime

func (c *Config) GetSimplePublicFileMapBuildtime() (map[string]string, error)

func (*Config) GetStaticPrivateOutDir

func (c *Config) GetStaticPrivateOutDir() string

func (*Config) GetStaticPublicOutDir

func (c *Config) GetStaticPublicOutDir() string

func (*Config) GetStyleSheetLinkElement

func (c *Config) GetStyleSheetLinkElement() template.HTML

func (*Config) GetStyleSheetURL

func (c *Config) GetStyleSheetURL() string

func (*Config) GetViteManifestLocation

func (c *Config) GetViteManifestLocation() string

func (*Config) GetViteOutDir

func (c *Config) GetViteOutDir() string

func (*Config) GetVormaBuildtimePublicURLFuncName

func (c *Config) GetVormaBuildtimePublicURLFuncName() string

func (*Config) GetVormaClientEntry

func (c *Config) GetVormaClientEntry() string

func (*Config) GetVormaClientRouteDefsFile

func (c *Config) GetVormaClientRouteDefsFile() string

func (*Config) GetVormaHTMLTemplateLocation

func (c *Config) GetVormaHTMLTemplateLocation() string

func (*Config) GetVormaTSGenOutPath

func (c *Config) GetVormaTSGenOutPath() string

func (*Config) GetVormaUIVariant

func (c *Config) GetVormaUIVariant() string

func (*Config) InitRuntimeCache

func (c *Config) InitRuntimeCache()

func (*Config) MainInit

func (c *Config) MainInit(opts MainInitOptions, calledFrom string)

func (*Config) MustGetPublicURLBuildtime

func (c *Config) MustGetPublicURLBuildtime(originalPublicURL string) string

func (*Config) MustStartDev

func (c *Config) MustStartDev(_opts ...must_start_dev_opts)

func (*Config) ServeStaticPublicAssets

func (c *Config) ServeStaticPublicAssets(addImmutableCacheHeaders bool) func(http.Handler) http.Handler

func (*Config) SetupDistDir

func (c *Config) SetupDistDir() error

func (*Config) ViteProdBuildWave

func (c *Config) ViteProdBuildWave() error

type Dist

type Dist struct {
	Binary *dirs.File
	Static *dirs.Dir[DistStatic]
}

type DistStatic

type DistStatic struct {
	Assets   *dirs.Dir[DistStaticAssets]
	Internal *dirs.Dir[DistWaveInternal]
	Keep     *dirs.File
}

type DistStaticAssets

type DistStaticAssets struct {
	Public  *dirs.DirEmpty
	Private *dirs.DirEmpty
}

type DistWaveInternal

type DistWaveInternal struct {
	CriticalDotCSS             *dirs.File
	NormalCSSFileRefDotTXT     *dirs.File
	PublicFileMapFileRefDotTXT *dirs.File
}

type EvtDetails

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

type FileMap

type FileMap map[string]fileVal

type MainInitOptions

type MainInitOptions struct {
	IsDev     bool
	IsRebuild bool
}

type OnChangeHook

type OnChangeHook struct {
	Cmd     string
	Timing  Timing
	Exclude []string
}

type StaticAssetDirs

type StaticAssetDirs struct {
	Private string
	Public  string
}

type Timing

type Timing string

type UserConfig

type UserConfig struct {
	Core  *UserConfigCore
	Vorma *UserConfigVorma
	Vite  *UserConfigVite
	Watch *UserConfigWatch
}

type UserConfigCore

type UserConfigCore struct {
	ConfigLocation   string
	DevBuildHook     string
	ProdBuildHook    string
	MainAppEntry     string
	DistDir          string
	StaticAssetDirs  StaticAssetDirs
	CSSEntryFiles    CSSEntryFiles
	PublicPathPrefix string
	ServerOnlyMode   bool
}

type UserConfigVite

type UserConfigVite struct {
	JSPackageManagerBaseCmd string
	JSPackageManagerCmdDir  string
	DefaultPort             int
	ViteConfigFile          string
}

type UserConfigVorma

type UserConfigVorma struct {
	IncludeDefaults            *bool
	UIVariant                  string
	HTMLTemplateLocation       string // Relative to your static private dir
	ClientEntry                string
	ClientRouteDefsFile        string
	TSGenOutPath               string // e.g., "frontend/src/vorma.gen.ts"
	BuildtimePublicURLFuncName string // e.g., "waveURL", "withHash", etc.
}

type UserConfigWatch

type UserConfigWatch struct {
	WatchRoot           string
	HealthcheckEndpoint string
	Include             []WatchedFile
	Exclude             struct {
		Dirs  []string
		Files []string
	}
}

type WatchedFile

type WatchedFile struct {
	Pattern                            string
	OnChangeHooks                      []OnChangeHook
	RecompileGoBinary                  bool
	RestartApp                         bool
	OnlyRunClientDefinedRevalidateFunc bool
	RunOnChangeOnly                    bool
	SkipRebuildingNotification         bool
	TreatAsNonGo                       bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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