pub struct Options {
Show 16 fields pub extensions: Vec<String>, pub enforce_extension: EnforceExtension, pub alias: Vec<(String, Vec<AliasMap>)>, pub prefer_relative: bool, pub external_cache: Option<Arc<Cache>>, pub symlinks: bool, pub description_file: String, pub resolve_to_context: bool, pub main_files: Vec<String>, pub main_fields: Vec<String>, pub browser_field: bool, pub condition_names: HashSet<String>, pub tsconfig: Option<PathBuf>, pub modules: Vec<String>, pub fallback: Vec<(String, Vec<AliasMap>)>, pub fully_specified: bool,
}

Fields§

§extensions: Vec<String>

Tried detect file with this extension. Default is [".js", ".json", ".node"]

§enforce_extension: EnforceExtension

Enforce that a extension from extensions must be used. Default is Auto.

§alias: Vec<(String, Vec<AliasMap>)>

Maps key to value. Default is vec![]. The reason for using Vec instead HashMap to keep the order.

§prefer_relative: bool

Prefer to resolve request as relative request and fallback to resolving as modules. Default is false

§external_cache: Option<Arc<Cache>>

Use of cache defined external, it designed to shared the info of description_file in different resolver.

  • If external_cache is None, use default cache in resolver.
  • If external_cache.is_some() is true, use this cache.

Default is None.

§symlinks: bool

Whether to resolve the real path when the result is a symlink. Default is true.

§description_file: String

A JSON file to describing this lib information. Default is "package.json".

§resolve_to_context: bool

Resolve to a context instead of a file. Default is false

§main_files: Vec<String>

Main file in this directory. Default is ["index"].

§main_fields: Vec<String>

Main fields in Description. Default is ["main"].

§browser_field: bool

Whether read and parse "browser" filed in package.json. Default is false

§condition_names: HashSet<String>

Condition names for exports filed. Note that its type is a HashSet, because the priority is related to the order in which the export field fields are written. Default is Set(["node"]).

§tsconfig: Option<PathBuf>

When this filed exists, it tries to read baseURL and paths in the corresponding tsconfig, and processes the mappings. Default is None.

§modules: Vec<String>

A list of directories to resolve modules from, can be absolute path or folder name. Default is ["node_modules"]

§fallback: Vec<(String, Vec<AliasMap>)>

Same as alias, but only used if default resolving fails. Default is [].

§fully_specified: bool

Request passed to resolve is already fully specified and extensions or main files are not resolved for it. Default is false.

Trait Implementations§

source§

impl Clone for Options

source§

fn clone(&self) -> Options

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Options

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for Options

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

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

const: unstable · 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more