bundle

package
v0.33.3 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package bundle provides primitives for bundling apps for portability.

Package bundle provides primitives for bundling apps for portability.

Index

Constants

View Source
const (
	// AppSourceName is the required name to be used for the source file. This
	// is needed so we know what we're searching for in the archive. Note, we
	// rename an app filename from a manifest when we create the bundle to
	// ensure it can be unpacked. We could get around this if we loaded all
	// files in the bundle, though we risk abuse with really large bundles.
	AppSourceName = "app.star"
	// AppBundleName is the standard name for a created bundle.
	AppBundleName = "bundle.tar.gz"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AppBundle

type AppBundle struct {
	Manifest *manifest.Manifest
	Source   fs.FS
}

AppBundle represents the unpacked bundle in our system.

func FromDir added in v0.32.1

func FromDir(dir string) (*AppBundle, error)

FromDir translates a directory containing an app manifest and source into an AppBundle.

func FromFS added in v0.32.1

func FromFS(fs fs.FS) (*AppBundle, error)

func LoadBundle

func LoadBundle(in io.Reader) (*AppBundle, error)

LoadBundle loads a compressed archive into an AppBundle.

func (*AppBundle) WriteBundle

func (ab *AppBundle) WriteBundle(out io.Writer, opts ...WriteOption) error

WriteBundle writes a compressed archive to the provided writer.

func (*AppBundle) WriteBundleToPath

func (b *AppBundle) WriteBundleToPath(dir string, opts ...WriteOption) error

WriteBundleToPath is a helper to be able to write the bundle to a provided directory.

type WriteOption added in v0.32.2

type WriteOption interface{}

func WithoutRuntime added in v0.32.2

func WithoutRuntime() WriteOption

WithoutRuntime is a WriteOption that can be used to write the bundle without using the runtime to determine the files to include in the bundle. Instead, all files in the source FS will be included in the bundle.

This is useful when writing a bundle that is known not to contain any unnecessary files, when loading and rewriting a bundle that was already tree-shaken, or when loading the entire runtime is not possible for performance or security reasons.

Jump to

Keyboard shortcuts

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