pub struct InlineLoaderRequest<'a> { /* private fields */ }Expand description
One parsed webpack inline loader request.
Implementations§
Source§impl<'a> InlineLoaderRequest<'a>
impl<'a> InlineLoaderRequest<'a>
Sourcepub fn parse(specifier: &'a str) -> Option<Self>
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).
Sourcepub fn resolved<'p>(
specifier: &'a str,
target: impl FnOnce() -> Option<&'p Path>,
) -> Option<Self>
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.
Sourcepub fn resolved_to<'p>(
specifier: &'a str,
target: &'p ResolveResult,
file_path: impl FnOnce(FileId) -> Option<&'p Path>,
) -> Option<Self>
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.
Sourcepub fn names_package_file(&self, specifier: &str, package: &str) -> bool
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.
Sourcepub fn loaders(&self) -> &[&'a str]
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.
Sourcepub const fn has_prefix(&self) -> bool
pub const fn has_prefix(&self) -> bool
Whether the request must use the loader syntax (it has a prefix).
Sourcepub fn reads_resource_as_asset(&self) -> bool
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.
Sourcepub fn runs_resource_in_another_thread(&self) -> bool
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>
impl<'a> Debug for InlineLoaderRequest<'a>
impl<'a> Eq for InlineLoaderRequest<'a>
Source§impl<'a> PartialEq for InlineLoaderRequest<'a>
impl<'a> PartialEq for InlineLoaderRequest<'a>
impl<'a> StructuralPartialEq for InlineLoaderRequest<'a>
Auto Trait Implementations§
impl<'a> Freeze for InlineLoaderRequest<'a>
impl<'a> RefUnwindSafe for InlineLoaderRequest<'a>
impl<'a> Send for InlineLoaderRequest<'a>
impl<'a> Sync for InlineLoaderRequest<'a>
impl<'a> Unpin for InlineLoaderRequest<'a>
impl<'a> UnsafeUnpin for InlineLoaderRequest<'a>
impl<'a> UnwindSafe for InlineLoaderRequest<'a>
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
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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