parser

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeLockHash

func ComputeLockHash(path string) (string, error)

ComputeLockHash returns "sha256:{hex}" of the raw file bytes.

func DevPackageNames

func DevPackageNames(lock *ComposerLock) []string

DevPackageNames returns the names from packages-dev (for installed.json).

func IsDevPackage

func IsDevPackage(name string, lock *ComposerLock) bool

IsDevPackage checks if a package name is in packages-dev.

func IsPlatformPackage

func IsPlatformPackage(name string) bool

IsPlatformPackage returns true for php, ext-*, lib-* packages.

Types

type Autoload

type Autoload struct {
	PSR4     map[string]interface{} `json:"psr-4,omitempty"`
	PSR0     map[string]interface{} `json:"psr-0,omitempty"`
	Classmap []string               `json:"classmap,omitempty"`
	Files    []string               `json:"files,omitempty"`
}

Autoload represents a package's autoload configuration.

type ComposerLock

type ComposerLock struct {
	Packages    []Package `json:"packages"`
	PackagesDev []Package `json:"packages-dev"`
	ContentHash string    `json:"content-hash"`
}

ComposerLock represents the root structure of a composer.lock file.

func ParseLockFile

func ParseLockFile(path string) (*ComposerLock, error)

ParseLockFile reads and parses a composer.lock file.

type Dist

type Dist struct {
	Type      string `json:"type"`
	URL       string `json:"url"`
	Reference string `json:"reference"`
	Shasum    string `json:"shasum"`
}

Dist represents the distribution information for a package.

type Package

type Package struct {
	Name              string                 `json:"name"`
	Version           string                 `json:"version"`
	VersionNormalized string                 `json:"version_normalized"`
	Type              string                 `json:"type"`
	Dist              *Dist                  `json:"dist"`
	Autoload          *Autoload              `json:"autoload,omitempty"`
	Extra             map[string]interface{} `json:"extra,omitempty"`
	Description       string                 `json:"description,omitempty"`
	Bin               []string               `json:"bin,omitempty"`
	NotificationURL   string                 `json:"notification-url,omitempty"`
	Require           map[string]string      `json:"require,omitempty"`
	Replace           map[string]string      `json:"replace,omitempty"`
	Provide           map[string]string      `json:"provide,omitempty"`
	Source            map[string]interface{} `json:"source,omitempty"`
}

Package represents a single package entry in composer.lock.

func FilterInstallable

func FilterInstallable(packages []Package) []Package

FilterInstallable returns packages that are not platform pseudo-packages and not path/null dist types.

func MergePackages

func MergePackages(lock *ComposerLock) []Package

MergePackages merges packages and packages-dev into a single list, filtering out platform pseudo-packages.

Jump to

Keyboard shortcuts

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