asset

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: MIT Imports: 23 Imported by: ? 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

Index

Constants

View Source
const FormatVersion = 1

Variables

This section is empty.

Functions

func DisplayReference

func DisplayReference(value string) string

Types

type Asset

type Asset struct {
	Name string
	// contains filtered or unexported fields
}

func (*Asset) Entries

func (a *Asset) Entries() []*Entry

func (*Asset) Entry

func (a *Asset) Entry(internalPath string) (*Entry, bool)

type Cache

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

func NewCache

func NewCache(catalog *Catalog, requestedRoot string) (*Cache, error)

func (*Cache) HideRootInErrors

func (c *Cache) HideRootInErrors()

func (*Cache) Resolve

func (c *Cache) Resolve(token string) (any, error)

func (*Cache) Root

func (c *Cache) Root() (string, error)

type CapturedAsset

type CapturedAsset struct {
	Name    string
	Entries []CapturedEntry
}

type CapturedEntry

type CapturedEntry struct {
	InternalPath  string
	Kind          EntryKind
	Mode          string
	Content       []byte
	ContentSize   int64
	ContentSHA256 string
	EntryIdentity string
}

type CapturedSet

type CapturedSet struct {
	ID     string
	Assets []CapturedAsset
}

func Capture

func Capture(
	source *resolve.Source,
	sourceFile syntax.SourceFileSpec,
	declarations []syntax.AssetDecl,
	outputPath string,
) (*CapturedSet, error)

type Catalog

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

func Open

func Open(body []byte) (*Catalog, error)

func (*Catalog) Content

func (c *Catalog) Content(token string) ([]byte, error)

func (*Catalog) Reference

func (c *Catalog) Reference(token string) (*Reference, bool)

func (*Catalog) Set

func (c *Catalog) Set(id string) (*Set, bool)

func (*Catalog) Sets

func (c *Catalog) Sets() []*Set

func (*Catalog) Verify

func (c *Catalog) Verify() error

type Collection

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

func (*Collection) Add

func (c *Collection) Add(set *CapturedSet) error

func (*Collection) Catalog

func (c *Collection) Catalog() *Catalog

func (*Collection) Encode

func (c *Collection) Encode() ([]byte, error)

type ContentRef

type ContentRef string

type Entry

type Entry struct {
	ManifestEntry
}

type EntryKind

type EntryKind string
const (
	EntryKindFile      EntryKind = "file"
	EntryKindDirectory EntryKind = "directory"
)

type Manifest

type Manifest struct {
	FormatVersion int                `json:"format-version"`
	AssetSets     []ManifestAssetSet `json:"asset-sets"`
}

type ManifestAsset

type ManifestAsset struct {
	Name    string          `json:"name"`
	Entries []ManifestEntry `json:"entries"`
}

type ManifestAssetSet

type ManifestAssetSet struct {
	ID     string          `json:"id"`
	Assets []ManifestAsset `json:"assets"`
}

type ManifestEntry

type ManifestEntry struct {
	InternalPath  string    `json:"internal-path"`
	Kind          EntryKind `json:"kind"`
	Mode          string    `json:"mode"`
	ContentSize   int64     `json:"content-size"`
	ContentSHA256 string    `json:"content-sha256"`
	EntryIdentity string    `json:"entry-identity"`
	BlobPath      string    `json:"blob-path"`
}

type PathRef

type PathRef string

type Reference

type Reference struct {
	Token         string
	Kind          ReferenceKind
	EntryIdentity string
	AssetName     string
	InternalPath  string
	Asset         *Asset
	Entry         *Entry
}

func ParseReference

func ParseReference(token string) (Reference, bool)

type ReferenceKind

type ReferenceKind string
const (
	ReferenceKindPath    ReferenceKind = "path"
	ReferenceKindContent ReferenceKind = "content"
)

type Set

type Set struct {
	ID string
	// contains filtered or unexported fields
}

func (*Set) Asset

func (s *Set) Asset(name string) (*Asset, bool)

func (*Set) Assets

func (s *Set) Assets() []*Asset

func (*Set) Catalog

func (s *Set) Catalog() *Catalog

func (*Set) Value

func (s *Set) Value(name, internalPath string) (Value, error)

type Value

type Value struct {
	Path          PathRef    `json:"path"`
	Content       ContentRef `json:"content"`
	ContentSHA256 string     `json:"content-sha256"`
	Mode          string     `json:"mode"`
}

Jump to

Keyboard shortcuts

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