lockfile

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const PipenvEcosystem = PipEcosystem
View Source
const PnpmEcosystem = NpmEcosystem
View Source
const PoetryEcosystem = PipEcosystem
View Source
const YarnEcosystem = NpmEcosystem

Variables

View Source
var ErrNuGetUnsupportedLockfileVersion = errors.New("unsupported lockfile version")
View Source
var ErrParserNotFound = errors.New("could not determine parser")

Functions

func ListParsers

func ListParsers() []string

Types

type CargoLockFile

type CargoLockFile struct {
	Version  int                `toml:"version"`
	Packages []CargoLockPackage `toml:"package"`
}

type CargoLockPackage

type CargoLockPackage struct {
	Name    string `toml:"name"`
	Version string `toml:"version"`
}

type ComposerLock

type ComposerLock struct {
	Packages    []ComposerPackage `json:"packages"`
	PackagesDev []ComposerPackage `json:"packages-dev"`
}

type ComposerPackage

type ComposerPackage struct {
	Name    string `json:"name"`
	Version string `json:"version"`
	Dist    struct {
		Reference string `json:"reference"`
	} `json:"dist"`
}

type Ecosystem

type Ecosystem = internal.Ecosystem
const BundlerEcosystem Ecosystem = "RubyGems"
const CargoEcosystem Ecosystem = "crates.io"
const ComposerEcosystem Ecosystem = "Packagist"
const GoEcosystem Ecosystem = "Go"
const MavenEcosystem Ecosystem = "Maven"
const MixEcosystem Ecosystem = "Hex"
const NpmEcosystem Ecosystem = "npm"
const NuGetEcosystem Ecosystem = "NuGet"
const PipEcosystem Ecosystem = "PyPI"
const PubEcosystem Ecosystem = "Pub"

func KnownEcosystems

func KnownEcosystems() []Ecosystem

type Lockfile

type Lockfile struct {
	FilePath string   `json:"filePath"`
	ParsedAs string   `json:"parsedAs"`
	Packages Packages `json:"packages"`
}

func FromCSVFile

func FromCSVFile(pathToCSV string, parseAs string) (Lockfile, error)

func FromCSVRows

func FromCSVRows(filePath string, parseAs string, rows []string) (Lockfile, error)

func Parse

func Parse(pathToLockfile string, parseAs string) (Lockfile, error)

Parse attempts to extract a collection of package details from a lockfile, using one of the native parsers.

The parser is selected based on the name of the file, which can be overridden with the "parseAs" parameter.

func (Lockfile) String

func (l Lockfile) String() string

type MavenLockDependency

type MavenLockDependency struct {
	XMLName    xml.Name `xml:"dependency"`
	GroupID    string   `xml:"groupId"`
	ArtifactID string   `xml:"artifactId"`
	Version    string   `xml:"version"`
}

func (MavenLockDependency) ResolveVersion

func (mld MavenLockDependency) ResolveVersion(lockfile MavenLockFile) string

type MavenLockFile

type MavenLockFile struct {
	XMLName             xml.Name              `xml:"project"`
	ModelVersion        string                `xml:"modelVersion"`
	Properties          MavenLockProperties   `xml:"properties"`
	Dependencies        []MavenLockDependency `xml:"dependencies>dependency"`
	ManagedDependencies []MavenLockDependency `xml:"dependencyManagement>dependencies>dependency"`
}

type MavenLockProperties

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

func (*MavenLockProperties) UnmarshalXML

func (p *MavenLockProperties) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type NpmLockDependency

type NpmLockDependency struct {
	Version      string                       `json:"version"`
	Dependencies map[string]NpmLockDependency `json:"dependencies,omitempty"`
}

type NpmLockPackage

type NpmLockPackage struct {
	Version      string            `json:"version"`
	Resolved     string            `json:"resolved"`
	Dependencies map[string]string `json:"dependencies"`
}

type NpmLockfile

type NpmLockfile struct {
	Version int `json:"lockfileVersion"`
	// npm v1- lockfiles use "dependencies"
	Dependencies map[string]NpmLockDependency `json:"dependencies"`
	// npm v2+ lockfiles use "packages"
	Packages map[string]NpmLockPackage `json:"packages,omitempty"`
}

type NuGetLockPackage

type NuGetLockPackage struct {
	Resolved string `json:"resolved"`
}

type NuGetLockfile

type NuGetLockfile struct {
	Version      int                                    `json:"version"`
	Dependencies map[string]map[string]NuGetLockPackage `json:"dependencies"`
}

NuGetLockfile contains the required dependency information as defined in https://github.com/NuGet/NuGet.Client/blob/6.5.0.136/src/NuGet.Core/NuGet.ProjectModel/ProjectLockFile/PackagesLockFileFormat.cs

type PackageDetails

type PackageDetails = internal.PackageDetails

func ParseCargoLock

func ParseCargoLock(pathToLockfile string) ([]PackageDetails, error)

func ParseComposerLock

func ParseComposerLock(pathToLockfile string) ([]PackageDetails, error)

func ParseGemfileLock

func ParseGemfileLock(pathToLockfile string) ([]PackageDetails, error)

func ParseGoLock

func ParseGoLock(pathToLockfile string) ([]PackageDetails, error)

func ParseGradleLock

func ParseGradleLock(pathToLockfile string) ([]PackageDetails, error)

func ParseMavenLock

func ParseMavenLock(pathToLockfile string) ([]PackageDetails, error)

func ParseMixLock

func ParseMixLock(pathToLockfile string) ([]PackageDetails, error)

func ParseNpmLock

func ParseNpmLock(pathToLockfile string) ([]PackageDetails, error)

func ParseNuGetLock

func ParseNuGetLock(pathToLockfile string) ([]PackageDetails, error)

func ParsePipenvLock

func ParsePipenvLock(pathToLockfile string) ([]PackageDetails, error)

func ParsePnpmLock

func ParsePnpmLock(pathToLockfile string) ([]PackageDetails, error)

func ParsePoetryLock

func ParsePoetryLock(pathToLockfile string) ([]PackageDetails, error)

func ParsePubspecLock

func ParsePubspecLock(pathToLockfile string) ([]PackageDetails, error)

func ParseRequirementsTxt

func ParseRequirementsTxt(pathToLockfile string) ([]PackageDetails, error)

func ParseYarnLock

func ParseYarnLock(pathToLockfile string) ([]PackageDetails, error)

type PackageDetailsParser

type PackageDetailsParser = func(pathToLockfile string) ([]PackageDetails, error)

func FindParser

func FindParser(pathToLockfile string, parseAs string) (PackageDetailsParser, string)

type Packages

type Packages []PackageDetails

func (Packages) Ecosystems

func (ps Packages) Ecosystems() []Ecosystem

type PipenvLock

type PipenvLock struct {
	Packages    map[string]PipenvPackage `json:"default"`
	PackagesDev map[string]PipenvPackage `json:"develop"`
}

type PipenvPackage

type PipenvPackage struct {
	Version string `json:"version"`
}

type PnpmLockPackage

type PnpmLockPackage struct {
	Resolution PnpmLockPackageResolution `yaml:"resolution"`
	Name       string                    `yaml:"name"`
	Version    string                    `yaml:"version"`
}

type PnpmLockPackageResolution

type PnpmLockPackageResolution struct {
	Tarball string `yaml:"tarball"`
	Commit  string `yaml:"commit"`
	Repo    string `yaml:"repo"`
	Type    string `yaml:"type"`
}

type PnpmLockfile

type PnpmLockfile struct {
	Version  float64                    `yaml:"lockfileVersion"`
	Packages map[string]PnpmLockPackage `yaml:"packages,omitempty"`
}

type PoetryLockFile

type PoetryLockFile struct {
	Version  int                 `toml:"version"`
	Packages []PoetryLockPackage `toml:"package"`
}

type PoetryLockPackage

type PoetryLockPackage struct {
	Name    string                  `toml:"name"`
	Version string                  `toml:"version"`
	Source  PoetryLockPackageSource `toml:"source"`
}

type PoetryLockPackageSource

type PoetryLockPackageSource struct {
	Type   string `toml:"type"`
	Commit string `toml:"resolved_reference"`
}

type PubspecLockDescription

type PubspecLockDescription struct {
	Name string `yaml:"name"`
	URL  string `yaml:"url"`
	Path string `yaml:"path"`
	Ref  string `yaml:"resolved-ref"`
}

func (*PubspecLockDescription) UnmarshalYAML

func (pld *PubspecLockDescription) UnmarshalYAML(unmarshal func(interface{}) error) error

type PubspecLockPackage

type PubspecLockPackage struct {
	Source      string                 `yaml:"source"`
	Description PubspecLockDescription `yaml:"description"`
	Version     string                 `yaml:"version"`
}

type PubspecLockfile

type PubspecLockfile struct {
	Packages map[string]PubspecLockPackage `yaml:"packages,omitempty"`
	Sdks     map[string]string             `yaml:"sdks"`
}

Jump to

Keyboard shortcuts

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