webbundle

package
v0.6.13 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 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 embeds the bundle (package web, built with the embedweb tag) and writes it out once. A `go install` binary embeds none, since the built JS is not in the Go module. It downloads the bundle attached to its own release and checks it against that release's checksums.txt. A checkout's `make agni` or `go install ...@main` is not a release, so it has no bundle to name. It gets ErrNoBundle and keeps today's answer, where `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 embedded in the binary, nil when there is 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 failed download or write, and a caller reports it.

Jump to

Keyboard shortcuts

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