Trait deno_graph::source::Resolver
source · [−]pub trait Resolver: Debug {
fn jsx_import_source_module(&self) -> &str { ... }
fn resolve(
&self,
specifier: &str,
referrer: &ModuleSpecifier
) -> ResolveResponse { ... }
fn resolve_types(
&self,
_specifier: &ModuleSpecifier
) -> Result<Option<(ModuleSpecifier, Option<Range>)>> { ... }
}
Expand description
A trait which allows the module graph to resolve specifiers and type only
dependencies. This can be use to provide import maps and override other
default resolution logic used by deno_graph
.
Provided methods
fn jsx_import_source_module(&self) -> &str
fn jsx_import_source_module(&self) -> &str
An optional method which returns the JSX import source module which will be appended to any JSX import source pragmas identified.
fn resolve(
&self,
specifier: &str,
referrer: &ModuleSpecifier
) -> ResolveResponse
fn resolve(
&self,
specifier: &str,
referrer: &ModuleSpecifier
) -> ResolveResponse
Given a string specifier and a referring module specifier, return a resolved module specifier.
fn resolve_types(
&self,
_specifier: &ModuleSpecifier
) -> Result<Option<(ModuleSpecifier, Option<Range>)>>
fn resolve_types(
&self,
_specifier: &ModuleSpecifier
) -> Result<Option<(ModuleSpecifier, Option<Range>)>>
Given a module specifier, return an optional tuple which provides a module
specifier that contains the types for the module and an optional range
which contains information about the source of the dependency. This will
only be called for module specifiers are resolved to a non-typed input
(e.g. JavaScript and JSX) and there is not yet types resolved for this
module. Any result will be set on the modules maybe_types_dependency
property.