cuemod

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2022 License: MIT Imports: 21 Imported by: 2

Documentation

Index

Constants

View Source
const ModSumFilename = "cue.mod/module.sum"

Variables

This section is empty.

Functions

func BuildConfig added in v0.3.4

func BuildConfig(optionFns ...OptionFunc) *load.Config

func InjectContext added in v0.2.0

func InjectContext(c context.Context, cc *Context) context.Context

func WithOpts

func WithOpts(ctx context.Context, fns ...OptFn) context.Context

Types

type Context

type Context struct {
	Mod *Mod
	// contains filtered or unexported fields
}

func ContextFor

func ContextFor(root string) *Context

func FromContext added in v0.2.0

func FromContext(c context.Context) *Context

func (*Context) Build

func (r *Context) Build(ctx context.Context, files []string, options ...OptionFunc) *build.Instance

func (*Context) BuildConfig added in v0.3.4

func (r *Context) BuildConfig(ctx context.Context, options ...OptionFunc) *cueload.Config

func (*Context) Cleanup

func (r *Context) Cleanup() error

func (*Context) CompletePath added in v0.3.1

func (r *Context) CompletePath(p string) string

func (*Context) CueModRoot

func (r *Context) CueModRoot() string

func (*Context) Get

func (r *Context) Get(ctx context.Context, i string) error

func (*Context) ListCue

func (r *Context) ListCue(fromPath string) ([]string, error)

func (*Context) Resolve

func (r *Context) Resolve(ctx context.Context, importPath string, importedAt string) (string, error)

type ImportFunc

type ImportFunc = func(importPath string, importedAt string) (resolvedDir string, err error)

type Instance

type Instance = build.Instance

func Build

func Build(inputs []string, optionFns ...OptionFunc) *Instance

func BuildInstances added in v0.3.4

func BuildInstances(c *load.Config, inputs []string) []*Instance

type Mod

type Mod struct {
	modfile.ModFile
	modfile.ModVersion

	// Repo where module in vcs root
	Repo string
	// SubPath mod local sub path
	SubPath string
	// Dir module absolute dir
	Dir string
	// Root means this import path is mod root
	Root bool
	// Sum repo absolute dir sum
	Sum string
}

func (*Mod) FixVersion added in v0.3.1

func (m *Mod) FixVersion(repo string, version string) string

func (*Mod) LoadInfo

func (m *Mod) LoadInfo(ctx context.Context) (bool, error)

func (*Mod) ModuleRoot added in v0.4.5

func (m *Mod) ModuleRoot() string

func (*Mod) Resolved

func (m *Mod) Resolved() bool

func (*Mod) SetRequire

func (m *Mod) SetRequire(module string, modVersion modfile.ModVersion, indirect bool)

func (*Mod) String

func (m *Mod) String() string

type OptFn

type OptFn = func(o *Opts)

func OptImport added in v0.3.0

func OptImport(b string) OptFn

func OptUpgrade

func OptUpgrade(b bool) OptFn

func OptVerbose

func OptVerbose(v bool) OptFn

type OptionFunc

type OptionFunc = func(c *load.Config)

func OptImportFunc

func OptImportFunc(importFunc ImportFunc) OptionFunc

func OptOverlay added in v0.2.0

func OptOverlay(overlay map[string]load.Source) OptionFunc

func OptRoot

func OptRoot(dir string) OptionFunc

type Opts

type Opts struct {
	Upgrade bool
	Verbose bool
	Import  string
}

func OptsFromContext

func OptsFromContext(ctx context.Context) Opts

type Path

type Path struct {
	Mod
	SubPath string
	Replace *ReplaceRule
}

func PathFor

func PathFor(mod *Mod, importPath string) *Path

func (*Path) ImportPath

func (i *Path) ImportPath() string

func (Path) ImportPathRoot added in v0.4.0

func (i Path) ImportPathRoot() string

func (Path) ImportPathRootDir added in v0.4.0

func (i Path) ImportPathRootDir() string

func (*Path) ResolvedImportPath

func (i *Path) ResolvedImportPath() string

func (Path) String added in v0.4.0

func (i Path) String() string

func (*Path) SymlinkOrImport

func (i *Path) SymlinkOrImport(ctx context.Context, root string) error

func (Path) WithReplace

func (i Path) WithReplace(from string, replaceTarget modfile.ReplaceTarget) *Path

type ReplaceRule

type ReplaceRule struct {
	From string
	modfile.ReplaceTarget
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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