require

package
v0.20.3 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const ID = "require"

Variables

View Source
var Directive = core.Directive{
	Name:    "require",
	Example: "@require ./locallib as mylib\n@require github.com/nexssp/text-tools v1.0.0 as text_tools",
	Handler: handleDirective,
}

Functions

func Bundle

func Bundle(_ map[string]string) core.Bundle

func GenerateGlue

func GenerateGlue(
	w io.Writer,
	packageName, cliImport string,
	mods []ResolvedModule,
) error

func HasGoFiles

func HasGoFiles(dir string) bool

func NormalizeID

func NormalizeID(target string) string

NormalizeID extracts the canonical bundle ID from any target path. e.g. "github.com/nexssp/mybundle/nexssflow" -> "mybundle" e.g. "nflow-harness/loose/localtest_e152bdd9" -> "localtest"

func ReadModuleLine

func ReadModuleLine(goModPath string) (string, error)

func ResolveBundles

func ResolveBundles(reqs []Requirement) ([]core.Bundle, error)

ResolveBundles resolves in-process requirements to core.Bundle instances.

func ResolveBundlesWith added in v0.15.0

func ResolveBundlesWith(reqs []Requirement, onBundle func(core.Bundle)) ([]core.Bundle, error)

ResolveBundlesWith resolves in-process requirements and calls onBundle immediately after each factory returns, before option validation or alias wiring. Owners can therefore retain cleanup callbacks when a later bundle fails validation or construction.

Types

type Plan

type Plan struct {
	Modules []Requirement
}

type Requirement

type Requirement struct {
	Import string
	// PackagePath is the Go import path selected for the bundle package.
	// It may differ from Import when a bare repository target defaults to
	// its nexssflow package or when Go resolves a package to a nested module.
	PackagePath string
	Alias       string
	Version     string
	// ResolvedVersion is the provider module version selected by Go for a
	// versioned remote bundle package. Local and workspace replacements may
	// leave it empty.
	ResolvedVersion string
	LocalPath       string
	ModuleRoot      string
	ModulePath      string
	IsLoose         bool
	LooseID         string
	Options         map[string]string
}

func FromMeta

func FromMeta(meta map[string]any) []Requirement

func Parse

func Parse(spec, baseDir string, opts map[string]string, file string, line int) (Requirement, error)

func (Requirement) IsLocal

func (r Requirement) IsLocal() bool

type ResolvedModule

type ResolvedModule struct {
	Requirement Requirement
	Dir         string
	GoMod       string
}

func Resolve

func Resolve(plan Plan, _ string) ([]ResolvedModule, error)

Jump to

Keyboard shortcuts

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