Skip to content

Commit 144eebd

Browse files
committed
review: content_type without cell
1 parent b89cd05 commit 144eebd

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

turbopack/crates/turbopack-core/src/data_uri_source.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl Source for DataUriSource {
5353
);
5454
Ok(
5555
AssetIdent::from_path(self.lookup_path.join(filename.into()))
56-
.with_content_type(Vc::cell(content_type)),
56+
.with_content_type(content_type),
5757
)
5858
}
5959
}

turbopack/crates/turbopack-core/src/ident.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ pub struct AssetIdent {
2727
pub parts: Vec<ModulePart>,
2828
/// The asset layer the asset was created from.
2929
pub layer: Option<ResolvedVc<RcStr>>,
30-
31-
pub content_type: Option<ResolvedVc<RcStr>>,
30+
/// The MIME content type, if this asset was created from a data URL.
31+
pub content_type: Option<RcStr>,
3232
}
3333

3434
impl AssetIdent {
@@ -101,7 +101,7 @@ impl ValueToString for AssetIdent {
101101
}
102102

103103
if let Some(content_type) = &self.content_type {
104-
write!(s, " <{}>", content_type.await?)?;
104+
write!(s, " <{}>", content_type)?;
105105
}
106106

107107
if !self.parts.is_empty() {
@@ -176,7 +176,7 @@ impl AssetIdent {
176176
}
177177

178178
#[turbo_tasks::function]
179-
pub fn with_content_type(&self, content_type: ResolvedVc<RcStr>) -> Vc<Self> {
179+
pub fn with_content_type(&self, content_type: RcStr) -> Vc<Self> {
180180
let mut this = self.clone();
181181
this.content_type = Some(content_type);
182182
Self::new(Value::new(this))
@@ -324,7 +324,7 @@ impl AssetIdent {
324324
}
325325
if let Some(content_type) = content_type {
326326
1_u8.deterministic_hash(&mut hasher);
327-
content_type.await?.deterministic_hash(&mut hasher);
327+
content_type.deterministic_hash(&mut hasher);
328328
has_hash = true;
329329
}
330330

turbopack/crates/turbopack/src/module_options/rule_condition.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ impl RuleCondition {
101101
ResolvedVc::try_downcast_type::<VirtualSource>(source).is_some()
102102
}
103103
RuleCondition::ContentTypeStartsWith(start) => {
104-
if let Some(content_type) = source.ident().await?.content_type {
105-
content_type.await?.starts_with(start)
104+
if let Some(content_type) = source.ident().await?.content_type.as_ref() {
105+
content_type.starts_with(start)
106106
} else {
107107
false
108108
}

0 commit comments

Comments
 (0)