Skip to main content

BuiltinComponentMap

Type Alias BuiltinComponentMap 

Source
pub type BuiltinComponentMap = fn(&str) -> Option<&'static [u8]>;
Expand description

Resolves a built-in rule name to its component’s embedded source map.

A third hook rather than a third element of BuiltinComponent, because it answers a different kind of question and almost every caller has no use for it: what a map buys is where a thrown rule error is reported, and nothing else. A violation’s position never passes through JavaScript at all, so a build that wired this to nothing would produce identical violations and a worse stack.

That is also its risk, and the reason crates/lanekeep-rules/tests/source_maps.rs asserts the wiring end to end rather than trusting it: a caller that sets RuleRoot::with_builtin_components and forgets this one gets rules that work and diagnostics that name entry.js, with nothing anywhere going red.

None is the ordinary answer. Every component built from Rust is one — a panicking rule traps, and a trap reaches the host with no stack to remap.