assets

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssetHandler

func AssetHandler() http.Handler

func ComponentImportPath

func ComponentImportPath(entryPath string, componentPath string) (string, error)

func EmbeddedAssetHandler

func EmbeddedAssetHandler(assetsFS embed.FS) http.Handler

func EntryNameForPath

func EntryNameForPath(componentPath string) string

func GetAssets

func GetAssets(man *Manifest, entryName string) (scriptSrc, cssHref string, chunks []string, isStatic bool, ssrPath string)

func GetContentType

func GetContentType(path string) string

func HasSSREntries

func HasSSREntries(man *Manifest) bool

HasSSREntries returns true if the manifest contains any SSR pages. It checks both the Mode field (primary) and falls back to the SSR field for legacy manifests.

func PublicFileExistsInEmbed

func PublicFileExistsInEmbed(assetsFS embed.FS, path string) bool

func PublicFileExistsInFS

func PublicFileExistsInFS(path string) bool

func PublicHandler

func PublicHandler(assetsFS embed.FS, next http.Handler, isDev bool) http.Handler

Types

type Manifest

type Manifest struct {
	Entries map[string]ManifestEntry `json:"entries"`
	Chunks  map[string]string        `json:"chunks,omitempty"`
}

func LoadManifest

func LoadManifest(path string) (*Manifest, error)

func LoadManifestFromEmbed

func LoadManifestFromEmbed(fs embed.FS, path string) (*Manifest, error)

func ParseManifest

func ParseManifest(data []byte) (*Manifest, error)

type ManifestEntry

type ManifestEntry struct {
	Script       string            `json:"script"`
	CSS          string            `json:"css,omitempty"`
	Chunks       []string          `json:"chunks,omitempty"`
	Static       bool              `json:"static,omitempty"`
	SSR          string            `json:"ssr,omitempty"`
	Mode         string            `json:"mode,omitempty"`
	HTML         string            `json:"html,omitempty"`
	StaticRoutes map[string]string `json:"staticRoutes,omitempty"` // route -> html file path (for dynamic static pages)
}

type Resolver

type Resolver struct {
	AssetsFS embed.FS
	Manifest *Manifest
	IsDev    bool
	// contains filtered or unexported fields
}

func NewResolver

func NewResolver(assetsFS embed.FS, manifest *Manifest, isDev bool) *Resolver

func (*Resolver) Cleanup

func (r *Resolver) Cleanup()

func (*Resolver) GetSSRBundlePath

func (r *Resolver) GetSSRBundlePath(ssrManifestPath string) string

Jump to

Keyboard shortcuts

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