library

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File added in v0.5.0

type File struct {
	Path      string
	LocalPath string
	Type      FileType
}

type FileType added in v0.5.0

type FileType string
const (
	// FileTypeJS represents a JavaScript file
	FileTypeJS FileType = "js"
	// FileTypeCSS represents a CSS file
	FileTypeCSS FileType = "css"
	// FileTypeOther represents a file that is not a JavaScript or CSS file
	FileTypeOther FileType = "other"
)

func ExtractFileType added in v0.5.0

func ExtractFileType(filename string) FileType

type Files added in v0.5.0

type Files []File

type Include added in v0.5.0

type Include struct {
	File string
	Raw  string
	As   string
}

func (Include) Name added in v0.5.0

func (I Include) Name() string

type Includes added in v0.5.0

type Includes []Include

func (Includes) Get added in v0.5.0

func (I Includes) Get(s string) *Include

type Package

type Package struct {
	Name     string
	Version  string
	Provider Provider
	Require  Includes // Patterns to specify which files to include
}

func (*Package) Assets added in v1.1.0

func (p *Package) Assets(assetsDir string, filePath string) (Files, string, error)

func (*Package) AssetsDir

func (p *Package) AssetsDir(assets string) string

AssetsDir returns the assets dir for the current package, we will store all files in here

func (*Package) CacheDir

func (p *Package) CacheDir(cacheDir string) string

CacheDir returns the cache dir for the current package, we will store all files in here

func (*Package) HasAssetFile added in v0.5.0

func (p *Package) HasAssetFile(rootDir string, assetsDir string, filePath string) bool

func (*Package) HasAssets

func (p *Package) HasAssets(rootDir string, assetsDir string) bool

HasAssets checks if the package has assets on disk

func (*Package) HasCache

func (p *Package) HasCache(rootDir string, cacheDir string) bool

HasCache checks if the package has cache on disk

func (*Package) MakeAssets

func (p *Package) MakeAssets(rootDir string, cacheDir string, assetsDir string, filePath string, src string) error

MakeAssets copies the cache files to the asset path without the version

func (*Package) MakeCache

func (p *Package) MakeCache(rootDir string, cacheDir string, filePath string, src string) error

MakeCache retrieves the file from the remote server and stores it locally

type Provider added in v1.0.0

type Provider interface {
	FetchPackageFiles(ctx context.Context, name, version string) (Files, string, error)
}

Jump to

Keyboard shortcuts

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