require

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 17 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.

Types

type Plan

type Plan struct {
	Modules []Requirement
}

type Requirement

type Requirement struct {
	Import     string
	Alias      string
	Version    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