webbundle

package
v0.3.13 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package webbundle finds the viewer for an agni binary that runs outside a checkout (agni WS16-003).

The server reads the viewer from a directory, so both sources end as one under the user cache. A release binary carries the bundle (package web, built with the embedweb tag) and writes it out once. A `go install` binary carries none, since the built JS is not in the Go module, and downloads the bundle its own release attached, checked against that release's checksums.txt. A build that is not a release (a checkout's `make agni`, `go install ...@main`) has no bundle to name, so it gets ErrNoBundle and keeps today's answer: `open` refuses and `serve` serves the API alone.

Index

Constants

View Source
const ChecksumsName = "checksums.txt"

ChecksumsName is the sha256 list a release attaches, one "<hex> <file>" line per asset.

View Source
const DefaultReleases = "https://github.com/panyam/agni/releases/download"

DefaultReleases is where a release's assets download from, as <base>/<tag>/<asset>.

Variables

View Source
var ErrNoBundle = errors.New("this agni build carries no viewer")

ErrNoBundle means this binary has no viewer to offer, neither embedded nor a release to fetch from.

Functions

func AssetName

func AssetName(tag string) string

AssetName is the viewer bundle a release attaches beside its binaries.

Types

type Source

type Source struct {
	// Embedded is the bundle the binary carries, nil when it carries none.
	Embedded fs.FS
	// Version is the binary's own version. A download is tried only for a release tag.
	Version string
	// Releases is the download base, DefaultReleases unless a test points it elsewhere.
	Releases string
	// CacheRoot holds one directory per bundle, under web/.
	CacheRoot string
	Client    *http.Client
	// Notes receives one line before a download, since a command that reaches the network should say so.
	Notes io.Writer
}

Source says where a viewer may come from and where to keep it.

func (Source) Dir

func (s Source) Dir(ctx context.Context) (dir, how string, err error)

Dir returns a directory holding the viewer's templates/ and static/, and how it got there ("embedded" or "downloaded"). A directory written by an earlier call is reused. An error wraps ErrNoBundle when the binary has nothing to offer; any other error is a download or a write that failed, which a caller reports.

Jump to

Keyboard shortcuts

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