Documentation
¶
Index ¶
- Constants
- func Overwrite(rw ManifestIO, filename string, p ManifestPatch) error
- func SplitNPMAlias(v string) (name, version string)
- type DependencyPatch
- type Manifest
- type ManifestIO
- type ManifestPatch
- type MavenManifestIO
- type MavenManifestSpecific
- type MavenPropertyPatches
- type NpmManifestIO
- type PackageJSON
- type PropertyWithOrigin
Constants ¶
View Source
const ( OriginManagement = "management" OriginParent = "parent" OriginPlugin = "plugin" OriginProfile = "profile" )
Variables ¶
This section is empty.
Functions ¶
func Overwrite ¶
func Overwrite(rw ManifestIO, filename string, p ManifestPatch) error
Overwrite applies the ManifestPatch to the manifest at filename. Used so as to not have the same file open for reading and writing at the same time.
func SplitNPMAlias ¶
extract the real package name & version from an alias-specified version e.g. "npm:pkg@^1.2.3" -> name: "pkg", version: "^1.2.3" name is empty and version is unchanged if not an alias specifier
Types ¶
type DependencyPatch ¶
type DependencyPatch struct {
Pkg resolve.PackageKey // The package this applies to
Type dep.Type // The dependency type
OrigRequire string // The original requirement string e.g. "1.*.*"
NewRequire string // The new requirement string e.g. "2.*.*"
OrigResolved string // The version the original resolves to e.g. "1.2.3" (for display only)
NewResolved string // The version the new resolves to e.g. "2.4.6" (for display only)
}
type Manifest ¶
type Manifest struct {
FilePath string // Path to the manifest file on disk
Root resolve.Version // Version representing this package
Requirements []resolve.RequirementVersion // All direct requirements, including dev
Groups map[resolve.PackageKey][]string // Dependency groups that the imports belong to
LocalManifests []Manifest // manifests of local packages
EcosystemSpecific any // Any ecosystem-specific information needed
}
type ManifestIO ¶
type ManifestIO interface {
// Read parses a manifest file into a Manifest, possibly recursively following references to other local manifest files
Read(file lockfile.DepFile) (Manifest, error)
// Write applies the ManifestPatch to the manifest, with minimal changes to the file.
// `original` is the original manifest file to read from. The updated manifest is written to `output`.
Write(original lockfile.DepFile, output io.Writer, patches ManifestPatch) error
}
func GetManifestIO ¶
func GetManifestIO(pathToManifest string) (ManifestIO, error)
type ManifestPatch ¶
type ManifestPatch struct {
Manifest *Manifest // The original manifest
Deps []DependencyPatch // Changed direct dependencies
EcosystemSpecific any // Any ecosystem-specific information
}
type MavenManifestIO ¶ added in v1.7.0
type MavenManifestIO struct{}
func (MavenManifestIO) Read ¶ added in v1.7.0
func (m MavenManifestIO) Read(df lockfile.DepFile) (Manifest, error)
TODO: fetch and merge parent data TODO: process dependencies (imports and dedupe) TODO: handle profiles (activation and interpolation)
func (MavenManifestIO) Write ¶ added in v1.7.0
func (MavenManifestIO) Write(df lockfile.DepFile, w io.Writer, patch ManifestPatch) error
type MavenManifestSpecific ¶ added in v1.7.0
type MavenManifestSpecific struct {
Properties []PropertyWithOrigin
RequirementsWithProperties []resolve.RequirementVersion
}
type MavenPropertyPatches ¶ added in v1.7.0
MavenPropertyPatches represent the properties to be updated, which is a map of properties of each origin.
type NpmManifestIO ¶
type NpmManifestIO struct{}
func (NpmManifestIO) Write ¶
func (NpmManifestIO) Write(r lockfile.DepFile, w io.Writer, patch ManifestPatch) error
type PackageJSON ¶
type PackageJSON struct {
Name string `json:"name"`
Version string `json:"version"`
// TODO: yarn allows workspaces to be a object OR a list:
// https://classic.yarnpkg.com/blog/2018/02/15/nohoist/
Workspaces []string `json:"workspaces"`
Dependencies map[string]string `json:"dependencies"`
DevDependencies map[string]string `json:"devDependencies"`
OptionalDependencies map[string]string `json:"optionalDependencies"`
// These fields are currently only used when parsing package-lock.json
PeerDependencies map[string]string `json:"peerDependencies"`
}
type PropertyWithOrigin ¶ added in v1.7.0
Click to show internal directories.
Click to hide internal directories.