这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/turbopack-build/src/chunking_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,10 @@ impl ChunkingContext for BuildChunkingContext {
}

#[turbo_tasks::function]
async fn with_layer(self: Vc<Self>, layer: String) -> Result<Vc<Box<dyn ChunkingContext>>> {
async fn with_layer(self: Vc<Self>, layer: String) -> Result<Vc<Self>> {
let mut context = self.await?.clone_value();
context.layer = (!layer.is_empty()).then(|| layer.to_string());
Ok(Vc::upcast(BuildChunkingContext::new(Value::new(context))))
Ok(BuildChunkingContext::new(Value::new(context)))
}

#[turbo_tasks::function]
Expand Down
2 changes: 1 addition & 1 deletion crates/turbopack-core/src/chunk/chunking_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub trait ChunkingContext {
Vc::cell("".to_string())
}

fn with_layer(self: Vc<Self>, layer: String) -> Vc<Box<dyn ChunkingContext>>;
fn with_layer(self: Vc<Self>, layer: String) -> Vc<Self>;

fn chunk_group(self: Vc<Self>, entry: Vc<Box<dyn Chunk>>) -> Vc<OutputAssets>;

Expand Down
4 changes: 2 additions & 2 deletions crates/turbopack-dev/src/chunking_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,10 @@ impl ChunkingContext for DevChunkingContext {
}

#[turbo_tasks::function]
async fn with_layer(self: Vc<Self>, layer: String) -> Result<Vc<Box<dyn ChunkingContext>>> {
async fn with_layer(self: Vc<Self>, layer: String) -> Result<Vc<Self>> {
let mut context = self.await?.clone_value();
context.layer = (!layer.is_empty()).then(|| layer.to_string());
Ok(Vc::upcast(DevChunkingContext::new(Value::new(context))))
Ok(DevChunkingContext::new(Value::new(context)))
}

#[turbo_tasks::function]
Expand Down
10 changes: 9 additions & 1 deletion crates/turbopack/src/transition/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::collections::HashMap;

use anyhow::Result;
pub use context_transition::ContextTransition;
use turbo_tasks::{Value, Vc};
use turbo_tasks::{Value, ValueDefault, Vc};
use turbopack_core::{
compile_time_info::CompileTimeInfo, module::Module, reference_type::ReferenceType,
source::Source,
Expand Down Expand Up @@ -88,3 +88,11 @@ pub trait Transition {

#[turbo_tasks::value(transparent)]
pub struct TransitionsByName(HashMap<String, Vc<Box<dyn Transition>>>);

#[turbo_tasks::value_impl]
impl ValueDefault for TransitionsByName {
#[turbo_tasks::function]
fn value_default() -> Vc<Self> {
Vc::cell(Default::default())
}
}