1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! Module resolution protocol.
//!
//! `@import("path")` does not look up files itself. Instead, the evaluator
//! asks each registered [`ModuleResolver`] in order until one returns
//! `Some(ModuleSource)`. The evaluator then parses and evaluates that
//! source once, caching the result by its [`ModuleSource::canonical_id`].
//!
//! Concrete resolver implementations (`StdModuleResolver`,
//! `FilesystemModuleResolver`, host-supplied resolvers) live in the
//! backend crate (`relon-evaluator`); the trait + payload type live here
//! so any backend implementing [`crate::Evaluator`] can share them.
use crateRuntimeError;
use crateScope;
use TokenRange;
use Arc;
/// The source text plus identity of a module produced by a [`ModuleResolver`].
/// A pluggable resolver that answers `@import("path")` requests.
///
/// Resolvers are polled in order; the first non-`None` return value is used.
/// Returning `Ok(None)` defers to the next resolver. Returning `Err(_)` aborts
/// the import without consulting later resolvers.