lockfile

package
v0.0.0-...-0a43815 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package lockfile provides the lockfile interface and implementations for the various package managers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllTransitiveClosures

func AllTransitiveClosures(
	workspaces map[turbopath.AnchoredUnixPath]map[string]string,
	lockFile Lockfile,
) (map[turbopath.AnchoredUnixPath]mapset.Set, error)

AllTransitiveClosures computes closures for all workspaces

func IsNil

func IsNil(l Lockfile) bool

IsNil checks if lockfile is nil

Types

type BerryDependencyMetaEntry

type BerryDependencyMetaEntry struct {
	Optional  bool `yaml:"optional,omitempty"`
	Unplugged bool `yaml:"unplugged,omitempty"`
}

BerryDependencyMetaEntry Structure for holding if a package is optional or not

type BerryLockfile

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

BerryLockfile representation of berry lockfile

func DecodeBerryLockfile

func DecodeBerryLockfile(contents []byte, resolutions map[string]string) (*BerryLockfile, error)

DecodeBerryLockfile Takes the contents of a berry lockfile and returns a struct representation

func (*BerryLockfile) AllDependencies

func (l *BerryLockfile) AllDependencies(key string) (map[string]string, bool)

AllDependencies Given a lockfile key return all (dev/optional/peer) dependencies of that package

func (*BerryLockfile) GlobalChange

func (l *BerryLockfile) GlobalChange(other Lockfile) bool

GlobalChange checks if there are any differences between lockfiles that would completely invalidate the cache.

func (*BerryLockfile) ResolvePackage

func (l *BerryLockfile) ResolvePackage(_workspace turbopath.AnchoredUnixPath, name string, version string) (Package, error)

ResolvePackage Given a package and version returns the key, resolved version, and if it was found

type BunLockfile

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

BunLockfile representation of bun lockfile

func DecodeBunLockfile

func DecodeBunLockfile(contents []byte) (*BunLockfile, error)

DecodeBunLockfile Takes the contents of a bun lockfile and returns a struct representation

func (*BunLockfile) AllDependencies

func (l *BunLockfile) AllDependencies(_ string) (map[string]string, bool)

AllDependencies Given a lockfile key return all (dev/optional/peer) dependencies of that package

func (*BunLockfile) GlobalChange

func (l *BunLockfile) GlobalChange(other Lockfile) bool

GlobalChange checks if there are any differences between lockfiles that would completely invalidate the cache.

func (*BunLockfile) ResolvePackage

func (l *BunLockfile) ResolvePackage(_ turbopath.AnchoredUnixPath, _ string, _ string) (Package, error)

ResolvePackage Given a package and version returns the key, resolved version, and if it was found

type ByKey

type ByKey []Package

ByKey sort package structures by key

func (ByKey) Len

func (p ByKey) Len() int

func (ByKey) Less

func (p ByKey) Less(i, j int) bool

func (ByKey) Swap

func (p ByKey) Swap(i, j int)

type Lockfile

type Lockfile interface {
	// ResolvePackage Given a workspace, a package it imports and version returns the key, resolved version, and if it was found
	ResolvePackage(workspacePath turbopath.AnchoredUnixPath, name string, version string) (Package, error)
	// AllDependencies Given a lockfile key return all (dev/optional/peer) dependencies of that package
	AllDependencies(key string) (map[string]string, bool)
	// GlobalChange checks if there are any differences between lockfiles that would completely invalidate
	// the cache.
	GlobalChange(other Lockfile) bool
}

Lockfile Interface for general operations that work across all lockfiles

func DecodeNpmLockfile

func DecodeNpmLockfile(contents []byte) (Lockfile, error)

DecodeNpmLockfile Parse contents of package-lock.json into NpmLockfile

type NpmLockfile

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

NpmLockfile representation of package-lock.json

func (*NpmLockfile) AllDependencies

func (l *NpmLockfile) AllDependencies(key string) (map[string]string, bool)

AllDependencies Given a lockfile key return all (dev/optional/peer) dependencies of that package

func (*NpmLockfile) GlobalChange

func (l *NpmLockfile) GlobalChange(other Lockfile) bool

GlobalChange checks if there are any differences between lockfiles that would completely invalidate the cache.

func (*NpmLockfile) ResolvePackage

func (l *NpmLockfile) ResolvePackage(workspacePath turbopath.AnchoredUnixPath, name string, version string) (Package, error)

ResolvePackage Given a workspace, a package it imports and version returns the key, resolved version, and if it was found

type Package

type Package struct {
	// Key used to lookup a package in the lockfile
	Key string `json:"key"`
	// The resolved version of a package as it appears in the lockfile
	Version string `json:"version"`
	// Set to true iff Key and Version are set
	Found bool `json:"-"`
}

Package Structure representing a possible Pack

type PnpmLockfile

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

PnpmLockfile Go representation of the contents of 'pnpm-lock.yaml' Reference https://github.com/pnpm/pnpm/blob/main/packages/lockfile-types/src/index.ts

func DecodePnpmLockfile

func DecodePnpmLockfile(contents []byte) (*PnpmLockfile, error)

DecodePnpmLockfile parse a pnpm lockfile

func (*PnpmLockfile) AllDependencies

func (p *PnpmLockfile) AllDependencies(key string) (map[string]string, bool)

AllDependencies Given a lockfile key return all (dev/optional/peer) dependencies of that package

func (*PnpmLockfile) GlobalChange

func (p *PnpmLockfile) GlobalChange(other Lockfile) bool

GlobalChange checks if there are any differences between lockfiles that would completely invalidate the cache.

func (*PnpmLockfile) ResolvePackage

func (p *PnpmLockfile) ResolvePackage(workspacePath turbopath.AnchoredUnixPath, name string, version string) (Package, error)

ResolvePackage Given a package and version returns the key, resolved version, and if it was found

type YarnLockfile

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

YarnLockfile representation of yarn lockfile

func DecodeYarnLockfile

func DecodeYarnLockfile(contents []byte) (*YarnLockfile, error)

DecodeYarnLockfile Takes the contents of a yarn lockfile and returns a struct representation

func (*YarnLockfile) AllDependencies

func (l *YarnLockfile) AllDependencies(key string) (map[string]string, bool)

AllDependencies Given a lockfile key return all (dev/optional/peer) dependencies of that package

func (*YarnLockfile) GlobalChange

func (l *YarnLockfile) GlobalChange(other Lockfile) bool

GlobalChange checks if there are any differences between lockfiles that would completely invalidate the cache.

func (*YarnLockfile) ResolvePackage

func (l *YarnLockfile) ResolvePackage(_workspacePath turbopath.AnchoredUnixPath, name string, version string) (Package, error)

ResolvePackage Given a package and version returns the key, resolved version, and if it was found

Jump to

Keyboard shortcuts

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