Documentation
¶
Overview ¶
Package npm provides the manifest parsing and writing for the npm package.json format.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetReadWriter ¶
func GetReadWriter() (manifest.ReadWriter, error)
GetReadWriter returns a ReadWriter for package.json manifest files. registry is unused.
func MakeRequirementKey ¶
func MakeRequirementKey(requirement resolve.RequirementVersion) manifest.RequirementKey
MakeRequirementKey constructs an npm RequirementKey from the given RequirementVersion.
func SplitNPMAlias ¶
SplitNPMAlias extracts the real package name and version from an alias-specified version.
e.g. "npm:pkg@^1.2.3" -> name: "pkg", version: "^1.2.3"
If the version is not an alias specifier, the name will be empty and the version unchanged.
Types ¶
type PackageJSON ¶
type PackageJSON struct {
Name string `json:"name"`
Version string `json:"version"`
Workspaces []string `json:"workspaces"`
Dependencies map[string]string `json:"dependencies"`
DevDependencies map[string]string `json:"devDependencies"`
OptionalDependencies map[string]string `json:"optionalDependencies"`
PeerDependencies map[string]string `json:"peerDependencies"`
PeerDependenciesMeta map[string]struct {
Optional bool `json:"optional,omitempty"`
} `json:"peerDependenciesMeta,omitempty"`
}
PackageJSON is the structure for the contents of a package.json file.
type RequirementKey ¶
type RequirementKey struct {
resolve.PackageKey
KnownAs string
}
RequirementKey is a comparable type that uniquely identifies a package dependency in a manifest.