entrypoint_browser_bundle

package
v0.57.2 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildOpfsWorkerBundle added in v0.52.0

func BuildOpfsWorkerBundle(
	ctx context.Context,
	le *logrus.Entry,
	stateDir,
	bldrDistRoot,
	buildDir string,
	minify,
	sourcemaps,
	devMode bool,
) (string, error)

BuildOpfsWorkerBundle builds the OPFS protocol worker through the direct owner.

func BuildRendererBundle

func BuildRendererBundle(
	le *logrus.Entry,
	sourcesRoot,
	bldrDistRoot,
	buildDir,
	runtimeJsPath,
	runtimeSwPath,
	runtimeShwPath,
	runtimeOpfsWorkerPath,
	webStartupSrcPath,
	entrypointHash string,
	minify,
	sourcemaps,
	forceDedicatedWorkers,
	forceMessagePortWorkerComms,
	devMode bool,
	browserIceServers []BrowserIceServer,
	browserIceServersEndpoint string,
	webPkgImportMap web_entrypoint_index.ImportMap,
) ([]string, error)

BuildRendererBundle builds the browser renderer with config-free Vite.

func BuildRendererIndex

func BuildRendererIndex(buildDir, entrypointPath string, importMap web_entrypoint_index.ImportMap) error

BuildRendererIndex builds the web renderer index.html.

importMap contains the web pkg import map entries (from BuildWebPkgsBundle).

func BuildServiceWorkerBundle

func BuildServiceWorkerBundle(
	ctx context.Context,
	le *logrus.Entry,
	stateDir,
	bldrDistRoot,
	buildDir string,
	minify,
	sourcemaps,
	devMode bool,
) (string, error)

BuildServiceWorkerBundle builds the service worker through the direct owner.

func BuildSharedWorkerBundle

func BuildSharedWorkerBundle(
	ctx context.Context,
	le *logrus.Entry,
	stateDir,
	bldrDistRoot,
	buildDir string,
	minify,
	sourcemaps,
	devMode bool,
) (string, error)

BuildSharedWorkerBundle builds the shared worker through the direct owner.

func BuildWebPkgsBundle

func BuildWebPkgsBundle(ctx context.Context, le *logrus.Entry, stateDir string, plat bldr_platform.Platform, bldrDistRoot, buildDir, pathPrefix string, minify, sourcemaps, devMode bool) (web_entrypoint_index.ImportMap, error)

BuildWebPkgsBundle builds the web pkg bundle files.

stateDir is the directory where bun will be downloaded if not found in PATH. pathPrefix is the prefix to prepend to /pkgs/ for pkg paths Returns the import map entries mapping logical specifiers to hashed output paths.

func DefaultBanner

func DefaultBanner() map[string]string

DefaultBanner is the default banner applied to code files.

func EnsureBldrDistDepsInstall added in v0.52.0

func EnsureBldrDistDepsInstall(ctx context.Context, le *logrus.Entry, stateDir, bldrDistRoot string) (string, error)

func LoadTinyGoWasmExecSource added in v0.57.2

func LoadTinyGoWasmExecSource(wasmExecFile string) (string, error)

LoadTinyGoWasmExecSource reads and patches TinyGo's browser runtime.

func WriteBuildManifest

func WriteBuildManifest(dir string, manifest *BuildManifest) error

WriteBuildManifest writes a manifest.json to the given directory.

func WriteStableBootAsset

func WriteStableBootAsset(dir string) error

WriteStableBootAsset writes the stable browser boot asset at the build root.

Types

type BrowserBundleResult

type BrowserBundleResult struct {
	// EntrypointPath is the path to the entrypoint mjs relative to the build dir.
	EntrypointPath string
	// EntrypointDecompressedSize is the byte size of EntrypointPath after HTTP decompression.
	EntrypointDecompressedSize int64
	// ServiceWorkerFilename is the output filename of the service worker.
	ServiceWorkerFilename string
	// SharedWorkerFilename is the output filename of the shared worker.
	SharedWorkerFilename string
	// OpfsWorkerFilename is the output filename of the OPFS protocol worker.
	OpfsWorkerFilename string
	// CSSPaths contains CSS output file paths relative to the build dir.
	CSSPaths []string
}

BrowserBundleResult contains the output filenames from a browser bundle build.

func BuildBrowserBundle

func BuildBrowserBundle(
	ctx context.Context,
	le *logrus.Entry,
	stateDir,
	sourcesRoot,
	bldrDistRoot,
	buildDir,
	runtimeJsPath,
	runtimeSwPath,
	runtimeShwPath,
	webStartupSrcPath string,
	entrypointHash string,
	minify,
	sourcemaps,
	devMode,
	forceDedicatedWorkers,
	forceMessagePortWorkerComms bool,
	browserIceServers []BrowserIceServer,
	browserIceServersEndpoint string,
) (*BrowserBundleResult, error)

BuildBrowserBundle builds and outputs the web & service worker files.

stateDir is the directory where bun will be downloaded if not found in PATH. webStartupSrcPath is the path to the startup js module to load for the react app entrypoint (can be empty). entrypointHash, if set, builds into /entrypoint/{entrypointHash}/...

type BrowserIceServer added in v0.57.2

type BrowserIceServer struct {
	URLs       []string `json:"urls"`
	Username   string   `json:"username,omitempty"`
	Credential string   `json:"credential,omitempty"`
}

BrowserIceServer is a trusted ICE server embedded in the document shell.

type BuildManifest

type BuildManifest struct {
	Entrypoint string `json:"entrypoint"`
	// EntrypointDecompressedSize is the byte size of Entrypoint after HTTP decompression.
	EntrypointDecompressedSize int64                  `json:"entrypointDecompressedSize,omitempty"`
	ServiceWorker              string                 `json:"serviceWorker"`
	SharedWorker               string                 `json:"sharedWorker"`
	Wasm                       string                 `json:"wasm,omitempty"`
	OpfsWorker                 string                 `json:"opfsWorker,omitempty"`
	CSS                        []string               `json:"css"`
	AutoStart                  bool                   `json:"autoStart,omitempty"`
	DefaultManifestBundle      *DefaultManifestBundle `json:"defaultManifestBundle,omitempty"`
}

BuildManifest is the manifest.json structure written alongside index.html. The prerender build script reads this to discover asset URLs.

type ConfigFreeRendererOpts added in v0.57.2

type ConfigFreeRendererOpts struct {
	OutputDir     string
	PublicPath    string
	Defines       map[string]string
	ExtraExternal []string
	Minify        bool
	Sourcemaps    bool
}

ConfigFreeRendererOpts describes one internal renderer build through Vite.

type DefaultManifestBundle added in v0.52.0

type DefaultManifestBundle struct {
	Metadata string `json:"metadata"`
	Pack     string `json:"pack"`
}

DefaultManifestBundle describes the browser-discoverable manifest bundle transport for first-boot range reads.

type RendererResult added in v0.57.2

type RendererResult struct {
	InputFiles  []string
	OutputFiles []string
	CSSPaths    []string
	JSPath      string
}

RendererResult contains normalized renderer provenance and outputs.

func BuildConfigFreeRenderer added in v0.57.2

func BuildConfigFreeRenderer(
	ctx context.Context,
	le *logrus.Entry,
	stateDir,
	bldrDistRoot,
	buildDir string,
	opts ConfigFreeRendererOpts,
) (*RendererResult, error)

BuildConfigFreeRenderer builds an internal renderer without project Vite configuration.

func BuildRenderer added in v0.57.2

func BuildRenderer(
	ctx context.Context,
	le *logrus.Entry,
	stateDir,
	bldrDistRoot,
	buildDir string,
	opts ConfigFreeRendererOpts,
) (*RendererResult, error)

BuildRenderer routes JavaScript-only graphs through direct Rolldown and CSS-bearing graphs through config-free Vite.

Jump to

Keyboard shortcuts

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