pub struct ResolverGeneric<Fs> { /* private fields */ }Expand description
Generic implementation of the resolver, can be configured by the Cache trait
Implementations§
Source§impl<Fs: FileSystem> ResolverGeneric<Fs>
impl<Fs: FileSystem> ResolverGeneric<Fs>
pub fn new(options: ResolveOptions) -> Self
Source§impl<Fs: FileSystem> ResolverGeneric<Fs>
impl<Fs: FileSystem> ResolverGeneric<Fs>
pub fn new_with_file_system(file_system: Fs, options: ResolveOptions) -> Self
Sourcepub fn clone_with_options(&self, options: ResolveOptions) -> Self
pub fn clone_with_options(&self, options: ResolveOptions) -> Self
Clone the resolver using the same underlying cache.
Sourcepub const fn options(&self) -> &ResolveOptions
pub const fn options(&self) -> &ResolveOptions
Returns the options.
Sourcepub fn clear_cache(&self)
pub fn clear_cache(&self)
Clear the underlying cache.
Sourcepub fn resolve<P: AsRef<Path>>(
&self,
directory: P,
specifier: &str,
) -> Result<Resolution, ResolveError>
pub fn resolve<P: AsRef<Path>>( &self, directory: P, specifier: &str, ) -> Result<Resolution, ResolveError>
Resolve specifier at an absolute path to a directory.
A specifier is the string passed to require or import, i.e. require("specifier") or import "specifier".
directory must be an absolute path to a directory where the specifier is resolved against.
For CommonJS modules, it is the __dirname variable that contains the absolute path to the folder containing current module.
For ECMAScript modules, it is the value of import.meta.url.
§Errors
- See ResolveError
Sourcepub fn resolve_tsconfig<P: AsRef<Path>>(
&self,
path: P,
) -> Result<Arc<TsConfig>, ResolveError>
pub fn resolve_tsconfig<P: AsRef<Path>>( &self, path: P, ) -> Result<Arc<TsConfig>, ResolveError>
Resolve tsconfig.
The path can be:
- Path to a file with
.jsonextension. - Path to a file without
.jsonextension,.jsonwill be appended to filename. - Path to a directory, where the filename is defaulted to
tsconfig.json
§Errors
- See ResolveError
Sourcepub fn resolve_with_context<P: AsRef<Path>>(
&self,
directory: P,
specifier: &str,
resolve_context: &mut ResolveContext,
) -> Result<Resolution, ResolveError>
pub fn resolve_with_context<P: AsRef<Path>>( &self, directory: P, specifier: &str, resolve_context: &mut ResolveContext, ) -> Result<Resolution, ResolveError>
Trait Implementations§
Source§impl<Fs> Debug for ResolverGeneric<Fs>
impl<Fs> Debug for ResolverGeneric<Fs>
Source§impl<Fs: FileSystem> Default for ResolverGeneric<Fs>
impl<Fs: FileSystem> Default for ResolverGeneric<Fs>
Auto Trait Implementations§
impl<Fs> Freeze for ResolverGeneric<Fs>
impl<Fs> RefUnwindSafe for ResolverGeneric<Fs>where
Fs: RefUnwindSafe,
impl<Fs> Send for ResolverGeneric<Fs>
impl<Fs> Sync for ResolverGeneric<Fs>
impl<Fs> Unpin for ResolverGeneric<Fs>
impl<Fs> UnwindSafe for ResolverGeneric<Fs>where
Fs: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more