Struct rspack_resolver::ResolverGeneric
source · pub struct ResolverGeneric<Fs> { /* private fields */ }
Expand description
Generic implementation of the resolver, can be configured by the FileSystem trait
Implementations§
source§impl<Fs: FileSystem + Default> ResolverGeneric<Fs>
impl<Fs: FileSystem + Default> 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 fn options(&self) -> &ResolveOptions
pub 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_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> Default for ResolverGeneric<Fs>
impl<Fs: FileSystem + Default> Default for ResolverGeneric<Fs>
Auto Trait Implementations§
impl<Fs> Freeze for ResolverGeneric<Fs>
impl<Fs> !RefUnwindSafe for ResolverGeneric<Fs>
impl<Fs> Send for ResolverGeneric<Fs>
impl<Fs> Sync for ResolverGeneric<Fs>
impl<Fs> Unpin for ResolverGeneric<Fs>
impl<Fs> !UnwindSafe for ResolverGeneric<Fs>
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