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, npm_resolver: NpmResolverRc) -> 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>, mode: NodeResolutionMode, ) -> Result<NodeResolution, ResolvePkgSubpathFromDenoModuleError>

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<NodeResolution, ResolvePkgJsonBinExportError>

source

pub fn url_to_node_resolution( &self, url: Url, ) -> Result<NodeResolution, UrlToNodeResolutionError>

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 get_closest_package_json( &self, url: &Url, ) -> Result<Option<PackageJsonRc>, ClosestPkgJsonError>

source

pub fn get_closest_package_json_from_path( &self, file_path: &Path, ) -> Result<Option<PackageJsonRc>, ClosestPkgJsonError>

source

pub fn load_package_json( &self, package_json_path: &Path, ) -> Result<Option<PackageJsonRc>, PackageJsonLoadError>

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.