pub struct PkgResolver { /* private fields */ }Expand description
Resolve references inside node_modules folders.
Node’s require.resolve has no Rust counterpart, so this is the
portable subset the Go port also implements: it walks node_modules
directories, honours a package’s package.json main for a bare
reference, and tries implicit extensions and index files. Node’s
conditional exports are not implemented.
Implementations§
Source§impl PkgResolver
impl PkgResolver
Sourcepub fn with_paths<I, S>(self, paths: I) -> Self
pub fn with_paths<I, S>(self, paths: I) -> Self
Search these directories, and each of their parents, instead.
Sourcepub fn with_fs(self, filesystem: impl SourceFs + 'static) -> Self
pub fn with_fs(self, filesystem: impl SourceFs + 'static) -> Self
Read from filesystem instead of the one the plugin options name.
Read from an already shared filesystem handle.
Sourcepub fn with_root(self, root: impl Into<String>) -> Self
pub fn with_root(self, root: impl Into<String>) -> Self
Confine every candidate path to root. See
FileResolver::with_root.
Trait Implementations§
Source§impl Clone for PkgResolver
impl Clone for PkgResolver
Source§impl Debug for PkgResolver
impl Debug for PkgResolver
Source§impl Default for PkgResolver
impl Default for PkgResolver
Source§impl Resolver for PkgResolver
impl Resolver for PkgResolver
Source§fn resolve(
&self,
reference: Option<&str>,
input: &ResolverInput<'_>,
) -> Resolution
fn resolve( &self, reference: Option<&str>, input: &ResolverInput<'_>, ) -> Resolution
Resolve
reference to a Resolution. A reference that names
nothing returns Resolution::not_found; raising the error is
the plugin’s job, not the resolver’s.Auto Trait Implementations§
impl !RefUnwindSafe for PkgResolver
impl !UnwindSafe for PkgResolver
impl Freeze for PkgResolver
impl Send for PkgResolver
impl Sync for PkgResolver
impl Unpin for PkgResolver
impl UnsafeUnpin for PkgResolver
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