assets

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package assets distributes immutable plugin files through Foundry's shared guarded publisher. Publication is explicit and never part of application boot.

Index

Constants

Variables

This section is empty.

Functions

func Register

func Register(r *foundation.Registrar, bundle *Bundle) error

Register contributes an already snapshotted bundle under the captured plugin owner/release. It performs no publication or filesystem reads.

func Snapshot

func Snapshot(files []File) (map[string][]byte, error)

Snapshot validates all paths before any publication. Nil data means an empty file, never deletion. Omitted files are removed only when the publisher proves that they belong to this exact distribution and have not been manually edited.

Types

type Bundle

type Bundle struct {
	// contains filtered or unexported fields
}

Bundle snapshots every source file. It is safe to share across applications; inspection returns copies and publication does not modify the bundle.

func Bundles

func Bundles(resolver foundation.Resolver) ([]*Bundle, error)

Bundles returns immutable bundles registered in dependency order. Calling it on App.Services needs no boot or runtime infrastructure.

func New

func New(declaration manifest.Manifest, id ID, files ...File) (*Bundle, error)

New validates the plugin distribution and snapshots files into an asset bundle.

func (*Bundle) Files

func (b *Bundle) Files() []FileInfo

Files returns file metadata sorted by path; a nil bundle returns nil.

func (*Bundle) Info

func (b *Bundle) Info() manifest.Distribution

Info returns distribution metadata, or zero metadata for a nil bundle.

func (*Bundle) Publish

func (b *Bundle) Publish(ctx context.Context, dir string, check bool) (Report, error)

Publish confines files to one existing selected output root. Different bundle owners, older releases, unowned files and edited owned files are refused. Check is read-only, including when recovery is pending. Failed publication can leave newly created empty directories; it never recursively deletes directories.

type File

type File struct {
	Path string
	Data []byte
}

File contains an asset path and its bytes.

type FileInfo

type FileInfo struct {
	Path  string `json:"path"`
	Bytes int    `json:"bytes"`
}

FileInfo describes an asset path and byte count.

type ID

type ID string

ID identifies an asset bundle within a plugin.

type Recovery

type Recovery = generate.Recovery

Recovery is the generator's distribution recovery information.

func Recover

func Recover(ctx context.Context, dir string) (Recovery, error)

Recover is the shared publisher recovery entry point; the same operation is available through foundry generate --recover --dir <selected output root>.

type Report

type Report = generate.Report

Report is the generator's publication report.

Jump to

Keyboard shortcuts

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