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§
- Manifest
- Package
Meta - Store
Section [store]table oflex.toml.
Enums§
Functions§
- dep_
source_ prefers_ git - Whether dependency resolution should prefer a dual dep’s git fallback over
its vcs/registry primary. Set by the CLI’s
--source gitflag via theLEX_DEP_SOURCEenv var so the pure source resolver stays flag-free. Default (unset, or any value other thangit) is vcs-primary. - 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). - parse_
version - Parse a
MAJOR.MINOR.PATCHversion into comparable parts. - resolve_
package_ import - Resolve
pkg_name/module_pathto a.lexfile on disk. - satisfies_
floor - Does
runningsatisfy a declaredfloor?
Type Aliases§
- GitCoord
- A git dependency coordinate:
(url, branch, tag, rev).branch/tag/revare mutually exclusive (at most one set); allNonemeans the default branch.