Skip to main content

Module pkg

Module pkg 

Source
Expand description

mlua-pkg integration: a TealResolver that serves .tl modules through mlua-pkg’s Registry, so Teal sources sit in the same resolution chain as Rust-native modules, embedded Lua, vendored git deps and assets.

require("name")
  Registry
   ├─ NativeResolver   host_module userdata / Rust tables
   ├─ TealResolver     name -> name.tl | name/init.tl  (check + gen + load)
   │                   name -> name.d.tl              (type-only: empty table)
   ├─ VendoredResolver mlua-pkg.toml git deps
   └─ FsResolver       plain .lua

The resolver must run on a Lua that an Htl was attached to (Htl::new / Htl::from_lua); it finds the compiler through the Lua registry. Type errors are returned as Some(Err) so, per mlua-pkg’s contract, a broken .tl never silently falls through to a later resolver.

Re-exports§

pub use mlua_pkg;

Structs§

AddDone
What Project::add did: mlua-pkg’s own report, and what htl carried across it.
PatchStatus
Where a patched dependency stands after an install: whether the copy is what the dependency resolves from, and the two revisions the answer rests on.
Patched
A dependency the project took into its tree: the name the manifest declares it under, and the directory patch_dir points at, absolute.
Project
An mlua-pkg.toml project: where the manifest, lockfile and installed deps live.
TealResolver
Resolves require("a.b") to a/b.tl, a/b/init.tl, or a/b.d.tl under a sandboxed root, type-checking and generating on the fly.
TypesSync
What Project::sync_types and Project::add_types did: one entry per declaration they were offered.

Enums§

TealResolveError
Error raised when a .tl module fails the type check at require time.

Constants§

LOCKFILE_NAME
MANIFEST_NAME
PATCHES_DIR
Where Project::patch puts a dependency it takes into the tree: patches/<dep>, beside the project’s own sources rather than under pkgs_dir. One directory per dependency, named after it, so the path a diagnostic carries names the dependency it is in.
TEAL_TYPES_GIT
Where the Teal ecosystem collects declarations for libraries that ship none of their own: types/<library>/<module>.d.tl, published to LuaRocks one library at a time as <library>-tl-type.

Functions§

contract_resolvers
One TealResolver per [[contract]] in htl.toml, in declaration order, so the host and htl check enforce the same contracts from the same source. root is the directory holding htl.toml (the path HtlConfig::find returns, minus the file name). Add them to a Registry before the plain resolvers.
pkgs_dir
Where a project’s installed deps go: <root>/.htl/modules, always.