source

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 9 Imported by: 0

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

This section is empty.

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 Kind

type Kind string

Kind is the transport-independent source category.

const (
	KindLocal       Kind = "local"
	KindNPM         Kind = "npm"
	KindGit         Kind = "git"
	KindContributed Kind = "contributed"
)

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.

func Parse

func Parse(input string, opts Options) (Ref, error)

Parse validates and classifies input without materializing it. npm selectors retain spaces and tabs used by comparator sets, hyphen ranges, and unions.

func (Ref) Identity

func (r Ref) Identity(baseDir string) (string, error)

Identity returns the stable de-duplication identity. npm versions and Git refs are deliberately excluded to match upstream package identity semantics.

Jump to

Keyboard shortcuts

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