node_resolver

Struct NodeResolver

Source
pub struct NodeResolver<TEnv: NodeResolverEnv> { /* private fields */ }

Implementations§

Source§

impl<TEnv: NodeResolverEnv> NodeResolver<TEnv>

Source

pub fn new( env: TEnv, in_npm_pkg_checker: InNpmPackageCheckerRc, npm_pkg_folder_resolver: NpmPackageFolderResolverRc, pkg_json_resolver: PackageJsonResolverRc<TEnv>, ) -> Self

Source

pub fn in_npm_package(&self, specifier: &Url) -> bool

Source

pub fn resolve( &self, specifier: &str, referrer: &Url, referrer_kind: NodeModuleKind, mode: NodeResolutionMode, ) -> Result<NodeResolution, NodeResolveError>

This function is an implementation of defaultResolve in lib/internal/modules/esm/resolve.js from Node.

Source

pub fn resolve_package_subpath_from_deno_module( &self, package_dir: &Path, package_subpath: Option<&str>, maybe_referrer: Option<&Url>, referrer_kind: NodeModuleKind, mode: NodeResolutionMode, ) -> Result<Url, PackageSubpathResolveError>

Source

pub fn resolve_binary_commands( &self, package_folder: &Path, ) -> Result<Vec<String>, ResolveBinaryCommandsError>

Source

pub fn resolve_binary_export( &self, package_folder: &Path, sub_path: Option<&str>, ) -> Result<Url, ResolvePkgJsonBinExportError>

Source

pub fn package_imports_resolve( &self, name: &str, maybe_referrer: Option<&Url>, referrer_kind: NodeModuleKind, referrer_pkg_json: Option<&PackageJson>, conditions: &[&str], mode: NodeResolutionMode, ) -> Result<Url, PackageImportsResolveError>

Source

pub fn package_exports_resolve( &self, package_json_path: &Path, package_subpath: &str, package_exports: &Map<String, Value>, maybe_referrer: Option<&Url>, referrer_kind: NodeModuleKind, conditions: &[&str], mode: NodeResolutionMode, ) -> Result<Url, PackageExportsResolveError>

Source

pub fn handle_if_in_node_modules(&self, specifier: &Url) -> Option<Url>

Resolves a specifier that is pointing into a node_modules folder by canonicalizing it.

Returns None when the specifier is not in a node_modules folder.

Trait Implementations§

Source§

impl<TEnv: Debug + NodeResolverEnv> Debug for NodeResolver<TEnv>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<TEnv> Freeze for NodeResolver<TEnv>
where TEnv: Freeze,

§

impl<TEnv> !RefUnwindSafe for NodeResolver<TEnv>

§

impl<TEnv> !Send for NodeResolver<TEnv>

§

impl<TEnv> !Sync for NodeResolver<TEnv>

§

impl<TEnv> Unpin for NodeResolver<TEnv>
where TEnv: Unpin,

§

impl<TEnv> !UnwindSafe for NodeResolver<TEnv>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.