Skip to content

Commit

Permalink
Misc. fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkirsz committed Jun 25, 2023
1 parent 110176e commit 94367b2
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 51 deletions.
14 changes: 0 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ members = [
"crates/turbo-tasks*",
"crates/turbopack*",
"crates/turborepo*",
"crates/turbo-tasks-vc-test",
"xtask",
]

Expand All @@ -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",
Expand Down
9 changes: 3 additions & 6 deletions crates/turbopack-cli/src/dev/web_entry_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<dyn CustomTransformer + Send + Sync>),
) as _),
Vc::cell(Box::new(StyledComponentsTransformer::new(
&StyledComponentsTransformConfig::default(),
))
as Box<dyn CustomTransformer + Send + Sync>),
Vc::cell(Box::new(StyledJsxTransformer::new())
as Box<dyn CustomTransformer + Send + Sync>),
)) as _),
Vc::cell(Box::new(StyledJsxTransformer::new()) as _),
],
output_transforms: vec![],
},
Expand Down
60 changes: 33 additions & 27 deletions crates/turbopack-core/src/issue/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -615,37 +615,14 @@ where
Self: Sized,
{
#[allow(unused_variables, reason = "behind feature flag")]
async fn attach_context<T: CollectiblesSource + Copy + Send>(
async fn attach_context(
self,
context: impl Into<Option<Vc<FileSystemPath>>> + Send,
description: impl Into<String> + Send,
source: T,
) -> Result<T> {
#[cfg(feature = "issue_path")]
{
let children = source.take_collectibles().await?;
if !children.is_empty() {
emit(Vc::upcast::<Box<dyn IssueProcessingPath>>(
ItemIssueProcessingPath::cell(ItemIssueProcessingPath(
Some(IssueProcessingPathItem::cell(IssueProcessingPathItem {
context: context.into(),
description: Vc::cell(description.into()),
})),
children,
)),
));
}
}
Ok(source)
}
) -> Result<Self>;

#[allow(unused_variables, reason = "behind feature flag")]
async fn attach_description<T: CollectiblesSource + Copy + Send>(
source: T,

description: impl Into<String> + Send,
) -> Result<T> {
Vc::<Self>::attach_context(None, description, source).await
}
async fn attach_description(self, description: impl Into<String> + Send) -> Result<Self>;

async fn issue_context(
self,
Expand All @@ -670,6 +647,35 @@ impl<T> IssueContextExt for T
where
T: CollectiblesSource + Copy + Send,
{
#[allow(unused_variables, reason = "behind feature flag")]
async fn attach_context(
self,
context: impl Into<Option<Vc<FileSystemPath>>> + Send,
description: impl Into<String> + Send,
) -> Result<Self> {
#[cfg(feature = "issue_path")]
{
let children = self.take_collectibles().await?;
if !children.is_empty() {
emit(Vc::upcast::<Box<dyn IssueProcessingPath>>(
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<String> + Send) -> Result<T> {
self.attach_context(None, description).await
}

async fn issue_context(
self,
context: impl Into<Option<Vc<FileSystemPath>>> + Send,
Expand Down
11 changes: 10 additions & 1 deletion crates/turbopack-node/src/route_matcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,18 @@ pub enum Param {

#[turbo_tasks::value(transparent)]
#[derive(Debug, Clone)]
pub struct Params(Option<IndexMap<String, Param>>);
pub struct Params(pub Option<IndexMap<String, Param>>);

/// 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.
Expand Down
2 changes: 1 addition & 1 deletion crates/turbopack-tests/tests/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
}

0 comments on commit 94367b2

Please sign in to comment.