diff --git a/Cargo.lock b/Cargo.lock index 36aa5f92bcbb7..5145347dea429 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9869,20 +9869,6 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4d330786735ea358f3bc09eea4caa098569c1c93f342d9aca0514915022fe7e" -[[package]] -name = "vc-test" -version = "0.1.0" -dependencies = [ - "anyhow", - "serde", - "serde_json", - "tokio", - "turbo-tasks", - "turbo-tasks-build", - "turbo-tasks-malloc", - "turbo-tasks-memory", -] - [[package]] name = "vcpkg" version = "0.2.15" diff --git a/Cargo.toml b/Cargo.toml index 44dfdfa2af2a3..06bc0f3697c05 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,6 @@ members = [ "crates/turbo-tasks*", "crates/turbopack*", "crates/turborepo*", - "crates/turbo-tasks-vc-test", "xtask", ] @@ -28,7 +27,6 @@ default-members = [ "crates/turbo-tasks-signposter-sys", "crates/turbo-tasks-testing", "crates/turbo-tasks-tracing-signpost", - "crates/turbo-tasks-vc-test", "crates/turbopack", "crates/turbopack-bench", "crates/turbopack-cli-utils", diff --git a/crates/turbopack-cli/src/dev/web_entry_source.rs b/crates/turbopack-cli/src/dev/web_entry_source.rs index 1a5e16ddbba48..bc3bc4ce79957 100644 --- a/crates/turbopack-cli/src/dev/web_entry_source.rs +++ b/crates/turbopack-cli/src/dev/web_entry_source.rs @@ -124,14 +124,11 @@ async fn get_client_module_options_context( Vc::cell(Box::new( EmotionTransformer::new(&EmotionTransformConfig::default()) .expect("Should be able to create emotion transformer"), - ) - as Box), + ) as _), Vc::cell(Box::new(StyledComponentsTransformer::new( &StyledComponentsTransformConfig::default(), - )) - as Box), - Vc::cell(Box::new(StyledJsxTransformer::new()) - as Box), + )) as _), + Vc::cell(Box::new(StyledJsxTransformer::new()) as _), ], output_transforms: vec![], }, diff --git a/crates/turbopack-core/src/issue/mod.rs b/crates/turbopack-core/src/issue/mod.rs index 4470bbc526cec..38dadbad099cd 100644 --- a/crates/turbopack-core/src/issue/mod.rs +++ b/crates/turbopack-core/src/issue/mod.rs @@ -615,37 +615,14 @@ where Self: Sized, { #[allow(unused_variables, reason = "behind feature flag")] - async fn attach_context( + async fn attach_context( + self, context: impl Into>> + Send, description: impl Into + Send, - source: T, - ) -> Result { - #[cfg(feature = "issue_path")] - { - let children = source.take_collectibles().await?; - if !children.is_empty() { - emit(Vc::upcast::>( - ItemIssueProcessingPath::cell(ItemIssueProcessingPath( - Some(IssueProcessingPathItem::cell(IssueProcessingPathItem { - context: context.into(), - description: Vc::cell(description.into()), - })), - children, - )), - )); - } - } - Ok(source) - } + ) -> Result; #[allow(unused_variables, reason = "behind feature flag")] - async fn attach_description( - source: T, - - description: impl Into + Send, - ) -> Result { - Vc::::attach_context(None, description, source).await - } + async fn attach_description(self, description: impl Into + Send) -> Result; async fn issue_context( self, @@ -670,6 +647,35 @@ impl IssueContextExt for T where T: CollectiblesSource + Copy + Send, { + #[allow(unused_variables, reason = "behind feature flag")] + async fn attach_context( + self, + context: impl Into>> + Send, + description: impl Into + Send, + ) -> Result { + #[cfg(feature = "issue_path")] + { + let children = self.take_collectibles().await?; + if !children.is_empty() { + emit(Vc::upcast::>( + ItemIssueProcessingPath::cell(ItemIssueProcessingPath( + Some(IssueProcessingPathItem::cell(IssueProcessingPathItem { + context: context.into(), + description: Vc::cell(description.into()), + })), + children, + )), + )); + } + } + Ok(self) + } + + #[allow(unused_variables, reason = "behind feature flag")] + async fn attach_description(self, description: impl Into + Send) -> Result { + self.attach_context(None, description).await + } + async fn issue_context( self, context: impl Into>> + Send, diff --git a/crates/turbopack-node/src/route_matcher.rs b/crates/turbopack-node/src/route_matcher.rs index d93ca9bc54ed3..18ef21acd1358 100644 --- a/crates/turbopack-node/src/route_matcher.rs +++ b/crates/turbopack-node/src/route_matcher.rs @@ -11,9 +11,18 @@ pub enum Param { #[turbo_tasks::value(transparent)] #[derive(Debug, Clone)] -pub struct Params(Option>); +pub struct Params(pub Option>); /// Extracts parameters from a URL path. +pub trait RouteMatcherRef { + /// Returns whether the given path is a match for the route. + fn matches(&self, path: &str) -> bool; + + /// Returns the parameters extracted from the given path. + fn params(&self, path: &str) -> Params; +} + +/// Extracts parameters from a URL path (Vc version) #[turbo_tasks::value_trait] pub trait RouteMatcher { /// Returns whether the given path is a match for the route. diff --git a/crates/turbopack-tests/tests/snapshot.rs b/crates/turbopack-tests/tests/snapshot.rs index e4ac787d6362d..d0d0edb4ea055 100644 --- a/crates/turbopack-tests/tests/snapshot.rs +++ b/crates/turbopack-tests/tests/snapshot.rs @@ -427,5 +427,5 @@ async fn maybe_load_env( let env = DotenvProcessEnv::new(None, dotenv_path); let asset = ProcessEnvAsset::new(dotenv_path, env.into()); - Ok(Some(asset.into())) + Ok(Some(Vc::upcast(asset))) }