Documentation
¶
Index ¶
- Variables
- func CheckHydrisVersion(pkg *Package, hydrisVersion string) error
- func ExtractPluginTarGz(r io.Reader) (string, error)
- func ResolveOCI(ref string, hydrisVersion string) (bundlePath, dataDir string, cleanup func(), err error)
- func TestRegistryAuth(registry, username, password string) error
- type OCIImage
- type Package
Constants ¶
This section is empty.
Variables ¶
var ErrIncompatibleVersion = errors.New("incompatible hydris version")
ErrIncompatibleVersion is wrapped into the error CheckHydrisVersion returns when the running hydris is outside a plugin's engines.hydris range, so the run path can treat it as a conflict rather than a transient failure.
var TempDir string
TempDir is the base directory for temporary plugin extractions. Empty string uses the OS default. On Android this must be set to a writable directory (e.g. the app's cache dir) before calling ResolveOCI.
Functions ¶
func CheckHydrisVersion ¶
CheckHydrisVersion validates the given hydris version against the engines.hydris semver range from package.json.
func ExtractPluginTarGz ¶ added in v0.0.23
ExtractPluginTarGz extracts a gzip-compressed plugin tar into a temp dir, returning the directory path. The caller must remove the directory when done.
func ResolveOCI ¶
func ResolveOCI(ref string, hydrisVersion string) (bundlePath, dataDir string, cleanup func(), err error)
ResolveOCI pulls an OCI image, extracts the plugin layer, checks version constraints and returns the path to the bundle and its data directory. The caller must call cleanup when done to remove the temp directory.
func TestRegistryAuth ¶ added in v0.0.21
TestRegistryAuth validates that the given credentials can authenticate against the registry by performing the full token exchange.
Types ¶
type OCIImage ¶ added in v0.0.23
OCIImage is a pulled OCI image (alias for v1.Image).
func PullOCIImage ¶ added in v0.0.23
PullOCIImage pulls an OCI image from the remote registry with auth.
type Package ¶
type Package struct {
Name string `json:"name"`
Version string `json:"version"`
Main string `json:"main"`
Files []string `json:"files,omitempty"`
Hydris *struct {
Compat string `json:"compat,omitempty"`
} `json:"hydris,omitempty"`
}
Package mirrors the relevant fields of a plugin's package.json.
func ReadPackageJSON ¶
ReadPackageJSON reads and parses a package.json from dir.