Skip to main content

Module dependency

Module dependency 

Source
Expand description

Typed build-dependency identities (manifest §7, §32; MVP 5).

Incremental builds need to name what a cached artifact depends on before they can decide whether it is stale. This module supplies the vocabulary: DependencyKind is the coarse category and DependencyId is the typed, deterministic identity. Both are pure value types: there is no dirty-node invalidation, content hashing, or persistent cache here. Those later slices (see docs/incremental-dependencies.md) consume these identities.

§Scope

Only inputs with a real, stable identity today are modelled: file-backed inputs (their canonical project path, see ProjectPath) and labels (their reference name). Categories the design note sketches but cannot yet identify deterministically: Node and Style bundles (their ids are still defaulted), packages, layout inputs (no real layout key until paragraph hashing lands, §4.4), and layout outputs: are deferred until they have a genuine identity scheme, rather than modelled as placeholders that would collide.

§What is intentionally not modelled yet

  • Content boundaries. A DependencyId names a dependency; it does not hash the bytes behind it. For bibliography inputs that pairing has landed as BibliographyDependency, which couples a DependencyId::bibliography identity with a [ContentHash] boundary (the bytes are hashed by mos_bib::bibliography_content_hash). Other categories still carry identity only.
  • Serialization format. DependencyId derives Eq/Ord/Hash so it can key in-memory maps and sets deterministically. The byte-exact on-disk form is deferred to the persistent-cache slice; Display is a stable, debuggable view, not the wire format.

Structs§

BibliographyDependency
A bibliography input paired with its content-hash boundary.
ProjectPath
A canonical, project-relative resource path used as a file dependency’s identity.

Enums§

DependencyId
A typed, deterministic identity for one build dependency.
DependencyKind
The category of a build dependency.
ProjectPathError
Error returned when a path cannot be used as a project-relative dependency identity.

Functions§

normalize 🔒
Lexically canonicalize a project-relative path: fold \ to /, drop ./empty segments, resolve .., and NFC-normalize. No filesystem access.
starts_with_windows_drive 🔒