browserassets

package
v0.1.0-alpha.58 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package browserassets defines the versioned browser bundle manifest emitted by gobeyond build. It keeps Vite's implementation-specific manifest out of production servers and exposes only the assets needed to render a route.

Index

Constants

View Source
const APIVersionV1Alpha1 = "gobeyond.browser-assets/v1alpha1"

Variables

This section is empty.

Functions

This section is empty.

Types

type BrowserAssets

type BrowserAssets struct {
	Bootstrap      string   `json:"bootstrap,omitempty"`
	ModulePreloads []string `json:"modulePreloads"`
	Styles         []string `json:"styles"`
}

BrowserAssets describes one executable browser entry and its eager assets. Bootstrap is the executable module for this group. For a route entry it is preloaded by the document and imported by the framework bootstrap at runtime.

type Manifest

type Manifest struct {
	APIVersion   string                   `json:"apiVersion,omitempty"`
	BuildID      string                   `json:"buildId,omitempty"`
	Bootstrap    BrowserAssets            `json:"bootstrapAssets"`
	Routes       map[string]BrowserAssets `json:"routes"`
	ClientScript string                   `json:"clientScript,omitempty"`
	Styles       []string                 `json:"styles,omitempty"`
}

Manifest is the stable route-aware projection of the bundler output. ClientScript and Styles are retained for one compatibility release and are used only by servers that do not understand the route-aware fields.

func Load

func Load(path string) (Manifest, error)

Load parses and validates a standalone browser asset manifest.

func LoadRuntimeManifest

func LoadRuntimeManifest(path, buildID string) (Manifest, error)

LoadRuntimeManifest reads the browser assets embedded in gobeyond build's production runtime envelope and verifies that no artifact crossed builds.

func Parse

func Parse(source []byte) (Manifest, error)

Parse validates the manifest version and required collection fields.

func (Manifest) ForRoute

func (manifest Manifest) ForRoute(routeID string) (BrowserAssets, error)

ForRoute returns the bootstrap script and the deduplicated eager assets for an initial document. Legacy manifests return their global asset set.

func (Manifest) Validate

func (manifest Manifest) Validate() error

Validate rejects partial route-aware manifests. A completely unversioned manifest is accepted as the one-release legacy representation.

Jump to

Keyboard shortcuts

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