modules

package
v0.0.0-...-6224849 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultRoots

func DefaultRoots(baseDir string) []string

DefaultRoots returns standard module root directories.

Types

type FileResolver

type FileResolver struct {
	Roots []string // directories to search, e.g. ["stdlib/", "effects/"]
}

FileResolver resolves modules from filesystem roots.

func NewFileResolver

func NewFileResolver(roots ...string) *FileResolver

NewFileResolver creates a FileResolver with the given root directories.

func (*FileResolver) Resolve

func (r *FileResolver) Resolve(path string) ([]byte, error)

Resolve searches each root for path.lfx. For example, "std/math" searches each root for "std/math.lfx".

type ModuleGraph

type ModuleGraph struct {
	Entry string
	Nodes map[string]*ResolvedModule
	Edges map[string][]string // module path -> imported module paths
}

ModuleGraph tracks the dependency graph.

func Build

func Build(entry string, source []byte, resolver Resolver) (*ModuleGraph, error)

Build constructs the full import graph starting from entry. It parses each module to find imports, resolves them, detects cycles, and validates that effect modules do not import other effect modules.

type ResolvedModule

type ResolvedModule struct {
	Path   string
	Source []byte
	IsLib  bool
}

ResolvedModule holds the resolved source and metadata for a module.

type Resolver

type Resolver interface {
	Resolve(path string) ([]byte, error)
}

Resolver finds module source by path.

Jump to

Keyboard shortcuts

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