From ea3da8adfb589d5f6196434182b0c185a2dad57d Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Thu, 11 Apr 2024 11:42:23 +0200 Subject: [PATCH] Revert "build: Update `swc_core` to `v0.90.30`" (vercel/turbo#7938) Reverts vercel/turbo#7856 Closes PACK-2935 --- crates/turbopack-core/src/source_map/mod.rs | 29 +++++++++---------- crates/turbopack-css/src/process.rs | 1 - ...turbopack-tests_tests_snapshot_b36339._.js | 2 +- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/crates/turbopack-core/src/source_map/mod.rs b/crates/turbopack-core/src/source_map/mod.rs index db41d7e920a02..c58b8eb9bfa96 100644 --- a/crates/turbopack-core/src/source_map/mod.rs +++ b/crates/turbopack-core/src/source_map/mod.rs @@ -159,7 +159,6 @@ impl TryInto 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, @@ -168,7 +167,6 @@ impl TryInto for Token { src_col: SOURCEMAP_CRATE_NONE_U32, src_line: SOURCEMAP_CRATE_NONE_U32, src_id: SOURCEMAP_CRATE_NONE_U32, - is_range: false, }, }) } @@ -242,7 +240,7 @@ impl SourceMap { #[turbo_tasks::function] pub fn empty() -> Vc { 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() } @@ -391,23 +389,23 @@ impl SourceMap { origin: Vc, ) -> Result> { async fn resolve_source( - source_request: Arc, - source_content: Option>, + source_request: String, + source_content: Option, origin: Vc, - ) -> Result<(Arc, Arc)> { + ) -> 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 = @@ -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) }, ) } @@ -433,14 +430,14 @@ impl SourceMap { origin: Vc, ) -> Result { let map = &map.0; - let file = map.get_file().map(Arc::::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::::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::::from).collect::>(); + let sources = map.sources().map(ToString::to_string).collect::>(); let source_contents = map .source_contents() - .map(|s| s.map(Arc::::from)) + .map(|s| s.map(ToString::to_string)) .collect::>(); let mut new_sources = Vec::with_capacity(count); let mut new_source_contents = Vec::with_capacity(count); diff --git a/crates/turbopack-css/src/process.rs b/crates/turbopack-css/src/process.rs index 36ae1987ac699..8c7c849d8ac0d 100644 --- a/crates/turbopack-css/src/process.rs +++ b/crates/turbopack-css/src/process.rs @@ -991,7 +991,6 @@ impl GenerateSourceMap for ParseCssResultSourceMap { m.original.map(|v| v.original_column).unwrap_or_default(), Some(0), None, - false, ); } diff --git a/crates/turbopack-tests/tests/snapshot/emotion/emotion/output/crates_turbopack-tests_tests_snapshot_b36339._.js b/crates/turbopack-tests/tests/snapshot/emotion/emotion/output/crates_turbopack-tests_tests_snapshot_b36339._.js index 1bb656791d4e7..3a669289822d5 100644 --- a/crates/turbopack-tests/tests/snapshot/emotion/emotion/output/crates_turbopack-tests_tests_snapshot_b36339._.js +++ b/crates/turbopack-tests/tests/snapshot/emotion/emotion/output/crates_turbopack-tests_tests_snapshot_b36339._.js @@ -12,7 +12,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests ; ; const StyledButton = /*#__PURE__*/ (0, __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$node_modules$2f40$emotion$2f$styled$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__["default"])("button", { - target: "ekn3dmj0" + target: "ekkrg800" })("background:blue;"); function ClassNameButton({ children }) { return /*#__PURE__*/ (0, __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$node_modules$2f40$emotion$2f$react$2f$jsx$2d$dev$2d$runtime$2e$js__$5b$test$5d$__$28$ecmascript$29$__["jsxDEV"])("button", {