Skip to main content

InlineLoaderRequest

Struct InlineLoaderRequest 

Source
pub struct InlineLoaderRequest<'a> { /* private fields */ }
Expand description

One parsed webpack inline loader request.

Implementations§

Source§

impl<'a> InlineLoaderRequest<'a>

Source

pub fn parse(specifier: &'a str) -> Option<Self>

Parse specifier as a webpack inline loader request.

Returns None when the specifier has no ! separator, is a URL, has an empty resource segment, or has the SystemJS plugin shape (./style.css!css: path loaders and a bare resource, no prefix).

Source

pub fn resolved<'p>( specifier: &'a str, target: impl FnOnce() -> Option<&'p Path>, ) -> Option<Self>

Return the loader request that specifier resolved through, given the file it resolved to.

Returns None when specifier is not a loader request, or when it resolved as a plain path. The resolver tries a request without a prefix as a plain path first. A plain path keeps its ! in the path of the target, while a resource segment never contains a !. So the request resolved as a plain path when target contains the first path segment of specifier that holds a !. target gives the path of the target, or None for a target that is not a file. It runs only for a loader request without a prefix.

Source

pub fn resolved_to<'p>( specifier: &'a str, target: &'p ResolveResult, file_path: impl FnOnce(FileId) -> Option<&'p Path>, ) -> Option<Self>

Self::resolved for a request that resolved to target.

file_path gives the path of a project file by its id. An external file gives its own path. A package target has no path: the request resolved as a plain path when Self::names_package_file holds for the target package. An unresolved request is a loader request.

Source

pub fn names_package_file(&self, specifier: &str, package: &str) -> bool

Whether specifier, read as a plain bare request, names a file of package, such as pkg/a!b.js for the installed file a!b.js of pkg.

The resolver accepts that reading only when the file is installed. The loader reading resolves the resource, so its target is the package of the resource. The target package therefore tells the two readings apart, except when the resource names the same package: such a request is always a loader request. A request with a prefix is never a plain request.

Source

pub fn loaders(&self) -> &[&'a str]

Loader requests without their ?options, in source order. A loader can be a package name or a path to a local loader file.

Source

pub const fn resource(&self) -> &'a str

The resource request, with its ?query.

Source

pub const fn has_prefix(&self) -> bool

Whether the request must use the loader syntax (it has a prefix).

Source

pub fn reads_resource_as_asset(&self) -> bool

Whether the loader next to the resource reads it as an asset (text, bytes or a URL), so the bundle never runs the resource as code.

Webpack runs the loaders from right to left, so only the last loader reads the resource file. In raw-loader!sass-loader!./a.scss Sass compiles the file and follows its imports first.

Source

pub fn runs_resource_in_another_thread(&self) -> bool

Whether a loader in the chain runs the resource in another thread or global scope, such as a worker or a worklet.

Any position counts. A worker loader is a pitching loader: it compiles the rest of the request as a separate bundle, and the loaders to its left only see its output.

Trait Implementations§

Source§

impl<'a> Debug for InlineLoaderRequest<'a>

Source§

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

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

impl<'a> Eq for InlineLoaderRequest<'a>

Source§

impl<'a> PartialEq for InlineLoaderRequest<'a>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<'a> StructuralPartialEq for InlineLoaderRequest<'a>

Auto Trait Implementations§

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<'a, T> FromIn<'a, T> for T

Source§

fn from_in(t: T, _: &'a Allocator) -> T

Converts to this type from the input type within the given allocator.
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 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<'a, T, U> IntoIn<'a, U> for T
where U: FromIn<'a, T>,

Source§

fn into_in(self, allocator: &'a Allocator) -> U

Converts this type into the (usually inferred) input type within the given allocator.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
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