Trait deno_graph::source::Resolver
source · pub trait Resolver: Debug {
// Provided methods
fn default_jsx_import_source(&self) -> Option<String> { ... }
fn jsx_import_source_module(&self) -> &str { ... }
fn resolve(
&self,
specifier_text: &str,
referrer: &ModuleSpecifier
) -> Result<ModuleSpecifier, Error> { ... }
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§
sourcefn default_jsx_import_source(&self) -> Option<String>
fn default_jsx_import_source(&self) -> Option<String>
An optional method that returns the default JSX import source if one is
configured. If this method returns Some and a JSX file is encountered
that does not have an import source specified as a pragma, this import
source will be used instead.
sourcefn 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.
sourcefn resolve(
&self,
specifier_text: &str,
referrer: &ModuleSpecifier
) -> Result<ModuleSpecifier, Error>
fn resolve( &self, specifier_text: &str, referrer: &ModuleSpecifier ) -> Result<ModuleSpecifier, Error>
Given a string specifier and a referring module specifier, return a resolved module specifier.
sourcefn 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.