Skip to content

Commit

Permalink
Merge 5809f9c into 73d3b39
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra authored Apr 14, 2023
2 parents 73d3b39 + 5809f9c commit 1dece51
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions crates/turbopack-css/src/references/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,20 +154,24 @@ impl<'a> VisitAstPath for AssetReferencesVisitor<'a> {

let src = url_string(u);

let issue_span = u.span;
self.references.push(
UrlAssetReferenceVc::new(
self.origin,
RequestVc::parse(Value::new(src.to_string().into())),
AstPathVc::cell(as_parent_path(ast_path)),
IssueSourceVc::from_byte_offset(
self.source,
issue_span.lo.to_usize(),
issue_span.hi.to_usize(),
),
)
.into(),
);
// ignore internal urls like `url(#noiseFilter)`
// ignore server-relative urls like `url(/foo)`
if !matches!(src.bytes().next(), Some(b'#') | Some(b'/')) {
let issue_span = u.span;
self.references.push(
UrlAssetReferenceVc::new(
self.origin,
RequestVc::parse(Value::new(src.to_string().into())),
AstPathVc::cell(as_parent_path(ast_path)),
IssueSourceVc::from_byte_offset(
self.source,
issue_span.lo.to_usize(),
issue_span.hi.to_usize(),
),
)
.into(),
);
}

u.visit_children_with_path(self, ast_path);
}
Expand Down

0 comments on commit 1dece51

Please sign in to comment.