Skip to main content

Module render

Module render 

Source
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§

PackageHead
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§

RenderedSource
Rendered package source: one module, or a relpath → source tree.

Functions§

package_head_at_op
Walk the op-log from head_op and assemble the PackageHead — the same bookkeeping lex export-git does 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.