Expand description
Rendering a package’s op-log head back to source — single src.lex
for a single-module package, or the de-flattened src/*.lex tree for a
multi-module one (#894).
Declarations published through the package loader carry a per-file
mangling prefix (schema_a1b2.validate); each AddFunction/AddType op
records the source file it came from (in_file, #903). To render source
we group the head’s stages by file, strip each file’s own prefix, and
rewrite a reference to another file’s prefix into alias.name plus a
local import.
This lives in lex-store (not the CLI) so both lex export-git and the
hosted registry’s archive endpoint render identically — the same source a
human reads in the git mirror is the source a consumer installs.
Structs§
- Package
Head - A package head decomposed into what the renderer needs: the SigId→StageId head map, each SigId’s source file, and the imports (flat, and per-file).
Enums§
- Rendered
Source - Rendered package source: one module, or a
relpath → sourcetree.
Functions§
- package_
head_ at_ op - Walk the op-log from
head_opand assemble thePackageHead— the same bookkeepinglex export-gitdoes incrementally, done once for a single head (used by the registry archive endpoint). - render_
source - Render a package head to source. Multi-module iff every head fn/type stage records its source file; otherwise a single module.