packageasset

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Overview

Package packageasset defines the shared generated-package asset descriptor. Generation writes it; package loading consumes it without importing emitters.

Index

Constants

View Source
const ManifestName = ".datly-gen.json"

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	Path string
	Data []byte
}

File is a virtual source file supplied before an immutable snapshot is published.

type Manifest

type Manifest struct {
	Resources *Resources           `json:"resources,omitempty"`
	Owners    map[string]*Manifest `json:"owners,omitempty"`
}

type Resources

type Resources struct {
	Namespace string   `json:"namespace"`
	Files     []string `json:"files"`
}

func DiscoverSourceResources

func DiscoverSourceResources(directory string) ([]*Resources, error)

DiscoverSourceResources finds generated go:embed declarations in a package.

func Read

func Read(source fs.FS) (*Resources, error)

func ReadAll

func ReadAll(source fs.FS) ([]*Resources, error)

Read returns nil when the package has no generated-resource manifest.

func (*Resources) Validate

func (r *Resources) Validate() error

type Snapshotter

type Snapshotter struct {
	Source  fs.FS
	Overlay []File
}

Snapshotter creates a completed filesystem for one unpublished generation. Standard-library archive storage retains all bytes without fabricating embed internals.

func (Snapshotter) All

func (s Snapshotter) All(ctx context.Context) (fs.FS, error)

func (Snapshotter) Files

func (s Snapshotter) Files(ctx context.Context, files []string) (fs.FS, error)

func (Snapshotter) Folder

func (s Snapshotter) Folder(ctx context.Context, root string) (fs.FS, error)

Folder snapshots an explicit subtree for both generated embedding and MCP. Filesystems supplied directly must be immutable; development OS callers use os.Root.

type StaticSource

type StaticSource struct {
	// LocalRoot is an optional caller-owned authority selected independently of
	// ContentURL. Local ContentURL must be relative to it. The caller must keep it
	// open through staging and must not derive it by following configured paths.
	// Nil uses the volume root for absolute paths, or cwd for relative paths.
	LocalRoot  *os.Root
	Resources  *resource.Store
	ContentURL string
}

StaticSource resolves static authority once per generation. Local OS roots are confined while snapshotting; remote ContentURL keeps AFS ownership.

func (StaticSource) Snapshot

func (s StaticSource) Snapshot(ctx context.Context, content *spec.StaticContent) (fs.FS, error)

Jump to

Keyboard shortcuts

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