Skip to main content

Module layout

Module layout 

Source
Expand description

The document-tree layout: the storage-profile boundary, the logical path grammar, and file stems.

Mirrors IR/src/layout/{index,paths,stems,write-tree}.ts in ecosystem/morphir-typescript; see .dev/docs/superpowers/maps/2026-09-17-reference-tree-layout-map.md. paths and stems supply what a tree reader and a tree writer are both built on; read assembles a tree into a distribution and [write] lays one back out.

The same layout holds a v4 distribution (read_tree, write_tree) or a classic v3 Library or Specs one (read_tree_v3, write_tree_v3), whose files all say formatVersion: "3.1.0"; read_any_tree reads either, chosen by the manifest.

Re-exports§

pub use paths::MANIFEST;
pub use paths::NodeFileKind;
pub use paths::PathKind;
pub use paths::Root;
pub use paths::VERSION_SLOT;
pub use paths::classify;
pub use paths::from_physical;
pub use paths::module_dir;
pub use paths::module_dir_prefix;
pub use paths::module_manifest_path;
pub use paths::node_file_path;
pub use paths::package_dir;
pub use paths::to_physical;
pub use read::read_tree;
pub use stems::StemResult;
pub use stems::stem_for;
pub use write::ManifestHeader;
pub use write::TreePolicy;
pub use write::write_definition_module;
pub use write::write_manifest;
pub use write::write_manifest_header;
pub use write::write_specification_module;
pub use write::write_tree;

Modules§

paths
The document tree’s logical path grammar: classification, escaping, and the physical boundary.
read
Reading a document tree: a map of logical paths to text becomes the distribution the equivalent single document would have produced.
stems
stemFor: the file stem a name is given inside a module directory, truncated when it would not fit the tree’s path budget.
write
Writing a document tree: a distribution becomes a list of logical paths and their text.

Enums§

AnyTree
A document tree read without knowing its version first.
Profile
The two storage profiles a document tree can be laid out under.
V3Kind
The two kinds of distribution a v3 document tree can hold.

Constants§

V3_TREE_FORMAT_VERSION
The formatVersion every file of a v3 document tree carries.

Functions§

read_any_tree
Reads a document tree of either version, chosen by the manifest’s formatVersion: a v3 version (3, or a string that starts 3.) reads as a v3 tree and anything else as a v4 one.
read_tree_v3
Reads a v3 document tree into the classic distribution it lays out, with the warnings its files produced.
read_v3_manifest_file
A v3 distribution manifest read on its own, with no tree around it, and answered as the value a v3 tree writes for it: every check read_tree_v3 makes of a manifest, then the writer’s spelling. $meta is dropped and never written back (decision 0014).
write_tree_v3
Lays a classic Library or Specs distribution out as a v3 document tree under policy.
write_v3_definition_module
Lays one classic module definition out as its manifest and one file per type and value, in the order the module lists them.
write_v3_manifest
The root manifest of a v3 document tree. Total: a manifest carries only names, a kind and a number.
write_v3_specification_module
Lays one classic module specification out the same way, with spec bodies. A specification publishes nothing private, so its manifest never writes an access member.

Type Aliases§

Tree
An in-memory document tree: logical path to file text, ordered so a byte-for-byte comparison of two trees does not depend on insertion order.