Skip to content

Commit

Permalink
Revert "build: Update swc_core to v0.90.30" (vercel/turborepo#7938)
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra authored Apr 11, 2024
1 parent 448cd73 commit ea3da8a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
29 changes: 13 additions & 16 deletions crates/turbopack-core/src/source_map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ impl TryInto<sourcemap::RawToken> for Token {
src_col: t.original_column as u32,
src_line: t.original_line as u32,
src_id: t.original_file.parse()?,
is_range: false,
},
Self::Synthetic(t) => sourcemap::RawToken {
dst_col: t.generated_column as u32,
Expand All @@ -168,7 +167,6 @@ impl TryInto<sourcemap::RawToken> for Token {
src_col: SOURCEMAP_CRATE_NONE_U32,
src_line: SOURCEMAP_CRATE_NONE_U32,
src_id: SOURCEMAP_CRATE_NONE_U32,
is_range: false,
},
})
}
Expand Down Expand Up @@ -242,7 +240,7 @@ impl SourceMap {
#[turbo_tasks::function]
pub fn empty() -> Vc<Self> {
let mut builder = SourceMapBuilder::new(None);
builder.add(0, 0, 0, 0, None, None, false);
builder.add(0, 0, 0, 0, None, None);
SourceMap::new_regular(builder.into_sourcemap()).cell()
}

Expand Down Expand Up @@ -391,23 +389,23 @@ impl SourceMap {
origin: Vc<FileSystemPath>,
) -> Result<Vc<Self>> {
async fn resolve_source(
source_request: Arc<str>,
source_content: Option<Arc<str>>,
source_request: String,
source_content: Option<String>,
origin: Vc<FileSystemPath>,
) -> Result<(Arc<str>, Arc<str>)> {
) -> Result<(String, String)> {
Ok(
if let Some(path) = *origin.parent().try_join(source_request.to_string()).await? {
let path_str = path.to_string().await?;
let source = format!("/{SOURCE_MAP_ROOT_NAME}/{}", path_str);
let source_content = if let Some(source_content) = source_content {
source_content
source_content.to_string()
} else if let FileContent::Content(file) = &*path.read().await? {
let text = file.content().to_str()?;
text.to_string().into()
text.to_string()
} else {
format!("unable to read source {path_str}").into()
format!("unable to read source {path_str}")
};
(source.into(), source_content)
(source, source_content)
} else {
let origin_str = origin.to_string().await?;
static INVALID_REGEX: Lazy<Regex> =
Expand All @@ -422,9 +420,8 @@ impl SourceMap {
"unable to access {source_request} in {origin_str} (it's leaving the \
filesystem root)"
)
.into()
});
(source.into(), source_content)
(source, source_content)
},
)
}
Expand All @@ -433,14 +430,14 @@ impl SourceMap {
origin: Vc<FileSystemPath>,
) -> Result<RegularMap> {
let map = &map.0;
let file = map.get_file().map(Arc::<str>::from);
let file = map.get_file().map(ToString::to_string);
let tokens = map.tokens().map(|t| t.get_raw_token()).collect();
let names = map.names().map(Arc::<str>::from).collect();
let names = map.names().map(ToString::to_string).collect();
let count = map.get_source_count() as usize;
let sources = map.sources().map(Arc::<str>::from).collect::<Vec<_>>();
let sources = map.sources().map(ToString::to_string).collect::<Vec<_>>();
let source_contents = map
.source_contents()
.map(|s| s.map(Arc::<str>::from))
.map(|s| s.map(ToString::to_string))
.collect::<Vec<_>>();
let mut new_sources = Vec::with_capacity(count);
let mut new_source_contents = Vec::with_capacity(count);
Expand Down
1 change: 0 additions & 1 deletion crates/turbopack-css/src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,6 @@ impl GenerateSourceMap for ParseCssResultSourceMap {
m.original.map(|v| v.original_column).unwrap_or_default(),
Some(0),
None,
false,
);
}

Expand Down

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

0 comments on commit ea3da8a

Please sign in to comment.