Skip to main content

Module source

Module source 

Source
Expand description

The source registry: maps a FileId to its source text and display path.

Every Span carries a FileId indexing into a Sources. Single-file scripts build a registry with one entry; multi-file packages add one per module. Diagnostics resolve a span back to (path, text, line index) through this registry so they can render --> util.subm:5:12 for the right file.

Structs§

ModulePath
A module’s package-relative display path (e.g. util, internal/math). For single-file scripts this is just the script filename. A thin newtype today; later multi-file steps extend it with resolution helpers.
SourceFile
One source file: its display path, full text, and a pre-built line index for span → line/col resolution.
Sources
Registry of every source file in a compilation, indexed by FileId.

Enums§

RelativeImportError
Error from resolving a relative import specifier against an importer’s path.
SourceError

Functions§

is_relative_specifier
True for ES-style relative-path specifiers (./…, ../…). Package specifiers (submilli:http, @org/pkg, @mcp/x) never match — none start with ./ or ../. Bare ./.. (no trailing /) are intentionally not treated as relative imports.