Trait AssetContext

Source
pub trait AssetContext:
    Send
    + Sync
    + NonLocalValue
    + ValueDebug {
    // Required methods
    fn compile_time_info(self: Vc<Self>) -> Vc<CompileTimeInfo>
       where Self: Sized;
    fn layer(self: Vc<Self>) -> Vc<RcStr>
       where Self: Sized;
    fn resolve_options(
        self: Vc<Self>,
        origin_path: Vc<FileSystemPath>,
        reference_type: Value<ReferenceType>,
    ) -> Vc<ResolveOptions>
       where Self: Sized;
    fn resolve_asset(
        self: Vc<Self>,
        origin_path: Vc<FileSystemPath>,
        request: Vc<Request>,
        resolve_options: Vc<ResolveOptions>,
        reference_type: Value<ReferenceType>,
    ) -> Vc<ModuleResolveResult>
       where Self: Sized;
    fn process(
        self: Vc<Self>,
        asset: Vc<Box<dyn Source>>,
        reference_type: Value<ReferenceType>,
    ) -> Vc<ProcessResult>
       where Self: Sized;
    fn process_resolve_result(
        self: Vc<Self>,
        result: Vc<ResolveResult>,
        reference_type: Value<ReferenceType>,
    ) -> Vc<ModuleResolveResult>
       where Self: Sized;
    fn with_transition(
        self: Vc<Self>,
        transition: RcStr,
    ) -> Vc<Box<dyn AssetContext>>
       where Self: Sized;
    fn side_effect_free_packages(self: Vc<Self>) -> Vc<Glob>
       where Self: Sized;
}
Expand description

A context for building an asset graph. It’s passed through the assets while creating them. It’s needed to resolve assets and upgrade assets to a higher type (e. g. from FileSource to ModuleAsset).

Required Methods§

Source

fn compile_time_info(self: Vc<Self>) -> Vc<CompileTimeInfo>
where Self: Sized,

Gets the compile time info of the asset context.

Source

fn layer(self: Vc<Self>) -> Vc<RcStr>
where Self: Sized,

Gets the layer of the asset context.

Source

fn resolve_options( self: Vc<Self>, origin_path: Vc<FileSystemPath>, reference_type: Value<ReferenceType>, ) -> Vc<ResolveOptions>
where Self: Sized,

Gets the resolve options for a given path.

Source

fn resolve_asset( self: Vc<Self>, origin_path: Vc<FileSystemPath>, request: Vc<Request>, resolve_options: Vc<ResolveOptions>, reference_type: Value<ReferenceType>, ) -> Vc<ModuleResolveResult>
where Self: Sized,

Resolves an request to an ModuleResolveResult.

Source

fn process( self: Vc<Self>, asset: Vc<Box<dyn Source>>, reference_type: Value<ReferenceType>, ) -> Vc<ProcessResult>
where Self: Sized,

Process a source into a module.

Source

fn process_resolve_result( self: Vc<Self>, result: Vc<ResolveResult>, reference_type: Value<ReferenceType>, ) -> Vc<ModuleResolveResult>
where Self: Sized,

Process an ResolveResult into an ModuleResolveResult.

Source

fn with_transition( self: Vc<Self>, transition: RcStr, ) -> Vc<Box<dyn AssetContext>>
where Self: Sized,

Gets a new AssetContext with the transition applied.

Source

fn side_effect_free_packages(self: Vc<Self>) -> Vc<Glob>
where Self: Sized,

Trait Implementations§

Implementors§