Documentation
¶
Overview ¶
Package source parses the source-reference vocabulary shared by package installation and Pig piglet resource origins. It preserves upstream Pi's npm/git/local grammar while allowing Pig products to contribute explicit lowercase schemes without teaching generic code their transport semantics.
pig additive (D18): product-neutral typed source and contributed schemes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSourcePackageKey ¶
GetSourcePackageKey is core/source-info.ts getSourcePackageKey: the key under which per-package state, such as the last seen extension changelog version, is stored. It is the JSON text of {source, scope}.
func ValidNPMPackageName ¶
ValidNPMPackageName reports whether name is a name npm accepts for a package that is about to be published. It does not check npm's length limit; npm reports that when it publishes.
pig additive (D18): npm publication of Packages and Piglet source.
func ValidNPMVersion ¶
ValidNPMVersion reports whether version is a version npm publishes: a full MAJOR.MINOR.PATCH semantic version with an optional prerelease and build, and no leading `v`. Go's semver also accepts the shorthand `1` and `1.2`, which npm rejects as an invalid version.
pig additive (D18): npm publication of Packages and Piglet source.
Types ¶
type BarePolicy ¶
type BarePolicy uint8
BarePolicy controls how a source without an explicit scheme/path marker is interpreted. Each caller selects local, npm, or rejection semantics.
const ( BareReject BarePolicy = iota BareLocal BareNPM )
type Options ¶
type Options struct {
BaseDir string
Bare BarePolicy
AllowContributed bool
}
Options defines boundary-specific parsing behavior.
type Ref ¶
type Ref struct {
Raw string
Kind Kind
Scheme string
Locator string
NPMName string
NPMVer string
NPMRegistry string
GitHost string
GitPath string
GitRef string
GitRepo string
GitSubdir string
}
Ref is a parsed source. Raw is retained for settings/piglet serialization; identity fields exclude mutable version/ref selectors where upstream package de-duplication does.
type SourceInfo ¶
type SourceInfo struct {
Path string `json:"path"`
Source string `json:"source"`
Scope string `json:"scope"`
Origin string `json:"origin"`
BaseDir string `json:"baseDir,omitempty"`
// ChangelogPath is the changelog file of the package that supplied the resource, when it has one.
ChangelogPath string `json:"changelogPath,omitempty"`
}
SourceInfo mirrors core/source-info.ts SourceInfo: where a resource, tool or command came from.