Expand description
lex.toml manifest parsing and package resolution.
A lex.toml file marks a project root and declares its package
dependencies. Import paths of the form "pkg-name/module" are
resolved against this file.
§File format
[package]
name = "lex-web"
version = "0.1.0"
[dependencies]
lex-schema = { path = "../lex-schema" }
# pin to a tag:
lex-schema = { git = "https://github.com/alpibrusl/lex-schema", tag = "v1.2.0" }
# pin to a commit:
lex-schema = { git = "https://github.com/alpibrusl/lex-schema", rev = "abc1234" }
# track a branch:
lex-schema = { git = "https://github.com/alpibrusl/lex-schema", branch = "stable" }
# or from a registry:
lex-schema = { registry = "https://lexhub.alpibru.com", version = "0.9.2" }At most one of tag, rev, branch may be set; omitting all three
clones the default branch at HEAD (not reproducible — pin for releases).
§Module resolution
import "lex-schema/validate" as v splits into pkg = "lex-schema",
module = "validate". The loader:
- Walks up from the importing file to find the nearest
lex.toml. - Looks up
lex-schemain[dependencies]. - For
path =: resolves{dep_path}/src/validate.lex; falls back to{dep_path}/validate.lexifsrc/doesn’t exist. - For
git =: clones the repo into~/.lex/packages/lex-schema-<ref>/(once; subsequent loads hit the cache), then resolves the same way.
Structs§
Enums§
Functions§
- find_
manifest - Walk up from
start(a file or directory) looking forlex.toml. Returns(toml_path, toml_dir)for the nearest ancestor that has one. - packages_
cache_ root - The flat package cache root used by the resolver —
$LEX_PACKAGES_DIRif set, otherwise~/.lex/packages/. ReturnsNoneonly when neither is available. Exposed so tooling can recognise dependencies whose path resolves into this cache (and are therefore aliases of an already-installed package rather than independent sources). - resolve_
package_ import - Resolve
pkg_name/module_pathto a.lexfile on disk.