From 08fffd71cacf850ba5d51d4ac99c37c9f667b53d Mon Sep 17 00:00:00 2001 From: uegi9quae1pee2qu Date: Tue, 21 Feb 2023 20:22:07 +0100 Subject: [PATCH 1/6] fix(cli): Use the source-file-name and source-root options --- bindings/Cargo.lock | 1 + bindings/swc_cli/Cargo.toml | 1 + bindings/swc_cli/src/commands/compile.rs | 79 +++++++++++++++++++----- bindings/swc_cli/src/commands/plugin.rs | 6 +- 4 files changed, 71 insertions(+), 16 deletions(-) diff --git a/bindings/Cargo.lock b/bindings/Cargo.lock index d574a4430d42..a56cdfd9bb5c 100644 --- a/bindings/Cargo.lock +++ b/bindings/Cargo.lock @@ -2576,6 +2576,7 @@ dependencies = [ "relative-path", "serde", "serde_json", + "sourcemap", "swc_core", "tracing", "tracing-chrome", diff --git a/bindings/swc_cli/Cargo.toml b/bindings/swc_cli/Cargo.toml index ba3798efc127..188875ae1d3f 100644 --- a/bindings/swc_cli/Cargo.toml +++ b/bindings/swc_cli/Cargo.toml @@ -26,6 +26,7 @@ rayon = "1" relative-path = "1.6.1" serde = { version = "1", features = ["derive"] } serde_json = { version = "1", features = ["unbounded_depth"] } +sourcemap = "6" swc_core = { version = "0.59.36", features = [ "trace_macro", "common_concurrent", diff --git a/bindings/swc_cli/src/commands/compile.rs b/bindings/swc_cli/src/commands/compile.rs index 2f2bbc429c19..626639d30c22 100644 --- a/bindings/swc_cli/src/commands/compile.rs +++ b/bindings/swc_cli/src/commands/compile.rs @@ -212,10 +212,22 @@ fn resolve_output_file_path( fn emit_output( mut output: TransformOutput, + source_file_name: &Option, + source_root: &Option, out_dir: &Option, file_path: &Path, file_extension: PathBuf, ) -> anyhow::Result<()> { + let source_map = if let Some(ref source_map) = &output.map { + Some(extend_source_map( + source_map.to_owned(), + source_file_name, + source_root, + )?) + } else { + None + }; + if let Some(out_dir) = out_dir { let output_file_path = resolve_output_file_path(out_dir, file_path, file_extension)?; let output_dir = output_file_path @@ -226,7 +238,7 @@ fn emit_output( fs::create_dir_all(output_dir)?; } - if let Some(source_map) = &output.map { + if let Some(ref source_map) = source_map { let source_map_path = output_file_path.with_extension("js.map"); output.code.push_str("\n//# sourceMappingURL="); @@ -239,16 +251,13 @@ fn emit_output( fs::write(output_file_path, &output.code)?; } else { - println!( - "{}\n{}\n{}", - file_path.display(), - output.code, - output - .map - .as_ref() - .map(|m| m.to_string()) - .unwrap_or_default() - ); + let source_map = if let Some(ref source_map) = source_map { + String::from_utf8_lossy(source_map).to_string() + } else { + String::new() + }; + + println!("{}\n{}\n{}", file_path.display(), output.code, source_map,); }; Ok(()) } @@ -324,6 +333,9 @@ impl CompileOptions { "true" => SourceMapsConfig::Bool(true), value => SourceMapsConfig::Str(value.to_string()), }); + + options.source_file_name = self.source_file_name.to_owned(); + options.source_root = self.source_root.to_owned(); } Ok(options) @@ -469,10 +481,17 @@ impl CompileOptions { buf_srcmap = Some(File::create(map_out_file)?); } + let source_map = extend_source_map( + src_map.to_owned(), + &self.source_file_name, + &self.source_root, + ) + .unwrap(); + buf_srcmap .as_ref() .expect("Srcmap buffer should be available") - .write(src_map.as_bytes()) + .write(&source_map) .and(Ok(()))?; } @@ -498,9 +517,14 @@ impl CompileOptions { let result = execute(compiler, fm, options); match result { - Ok(output) => { - emit_output(output, &self.out_dir, &file_path, file_extension) - } + Ok(output) => emit_output( + output, + &self.source_file_name, + &self.source_root, + &self.out_dir, + &file_path, + file_extension, + ), Err(e) => Err(e), } }, @@ -509,6 +533,31 @@ impl CompileOptions { } } +// TODO: remove once fixed in core https://github.com/swc-project/swc/issues/1388 +fn extend_source_map( + source_map: String, + source_file_name: &Option, + source_root: &Option, +) -> anyhow::Result> { + let mut source_map = sourcemap::SourceMap::from_reader(source_map.as_bytes()) + .context("failed to encode source map")?; + + if let Some(ref source_file_name) = source_file_name { + source_map.set_source(0u32, source_file_name); + } + + if source_root.is_some() { + source_map.set_source_root(source_root.clone()); + } + + let mut buf = vec![]; + source_map + .to_writer(&mut buf) + .context("failed to decode source map")?; + + Ok(buf) +} + #[swc_trace] impl super::CommandRunner for CompileOptions { fn execute(&self) -> anyhow::Result<()> { diff --git a/bindings/swc_cli/src/commands/plugin.rs b/bindings/swc_cli/src/commands/plugin.rs index d4af97cb5e65..83c56efb8732 100644 --- a/bindings/swc_cli/src/commands/plugin.rs +++ b/bindings/swc_cli/src/commands/plugin.rs @@ -202,7 +202,11 @@ build-wasm32 = "build --target wasm32-unknown-unknown" .context("failed to write config toml file")?; // Create package.json for npm package publishing. - let dist_output_path = format!("target/{}/release/{}.wasm", build_target, name.replace("-", "_")); + let dist_output_path = format!( + "target/{}/release/{}.wasm", + build_target, + name.replace("-", "_") + ); fs::write( &path.join("package.json"), format!( From 03d40399d3f59b58f8bc8b2db77b533c74fcb6f1 Mon Sep 17 00:00:00 2001 From: uegi9quae1pee2qu Date: Wed, 22 Feb 2023 10:52:34 +0100 Subject: [PATCH 2/6] replace to_string() with borrow::Cow --- bindings/swc_cli/src/commands/compile.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bindings/swc_cli/src/commands/compile.rs b/bindings/swc_cli/src/commands/compile.rs index 626639d30c22..f517ee19fd29 100644 --- a/bindings/swc_cli/src/commands/compile.rs +++ b/bindings/swc_cli/src/commands/compile.rs @@ -1,4 +1,5 @@ use std::{ + borrow::Cow, fs::{self, File}, io::{self, Read, Write}, path::{Component, Path, PathBuf}, @@ -252,9 +253,9 @@ fn emit_output( fs::write(output_file_path, &output.code)?; } else { let source_map = if let Some(ref source_map) = source_map { - String::from_utf8_lossy(source_map).to_string() + String::from_utf8_lossy(source_map) } else { - String::new() + Cow::Borrowed("") }; println!("{}\n{}\n{}", file_path.display(), output.code, source_map,); From 3eedf3b3b013131d995c33d5335e408b462b359c Mon Sep 17 00:00:00 2001 From: uegi9quae1pee2qu Date: Wed, 22 Feb 2023 19:10:09 +0100 Subject: [PATCH 3/6] update sourcemap -> 6.2 --- Cargo.lock | 25 +++++++++---------------- bindings/swc_cli/Cargo.toml | 2 +- crates/swc_common/Cargo.toml | 2 +- 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e560b1889046..70e532a6f71b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -156,12 +156,6 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b" -[[package]] -name = "base64" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" - [[package]] name = "base64" version = "0.13.1" @@ -2553,7 +2547,7 @@ version = "0.11.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68cc60575865c7831548863cc02356512e3f1dc2f3f82cb837d7fc4cc8f3c97c" dependencies = [ - "base64 0.13.1", + "base64", "bytes", "encoding_rs", "futures-core", @@ -2921,17 +2915,16 @@ dependencies = [ [[package]] name = "sourcemap" -version = "6.0.1" +version = "6.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e031f2463ecbdd5f34c950f89f5c1e1032f22c0f8e3dc4bdb2e8b6658cf61eb" +checksum = "aebe057d110ddba043708da3fb010bf562ff6e9d4d60c9ee92860527bcbeccd6" dependencies = [ - "base64 0.11.0", + "base64", "if_chain", - "lazy_static", - "regex", "rustc_version 0.2.3", "serde", "serde_json", + "unicode-id", "url", ] @@ -3125,7 +3118,7 @@ dependencies = [ "ahash", "ansi_term", "anyhow", - "base64 0.13.1", + "base64", "criterion", "dashmap", "either", @@ -3568,7 +3561,7 @@ dependencies = [ name = "swc_ecma_codegen" version = "0.129.13" dependencies = [ - "base64 0.13.1", + "base64", "criterion", "memchr", "num-bigint", @@ -3993,7 +3986,7 @@ name = "swc_ecma_transforms_react" version = "0.160.19" dependencies = [ "ahash", - "base64 0.13.1", + "base64", "dashmap", "indexmap", "once_cell", @@ -4024,7 +4017,7 @@ version = "0.119.12" dependencies = [ "ansi_term", "anyhow", - "base64 0.13.1", + "base64", "hex", "serde", "serde_json", diff --git a/bindings/swc_cli/Cargo.toml b/bindings/swc_cli/Cargo.toml index 188875ae1d3f..b6c086eeb6fe 100644 --- a/bindings/swc_cli/Cargo.toml +++ b/bindings/swc_cli/Cargo.toml @@ -26,7 +26,7 @@ rayon = "1" relative-path = "1.6.1" serde = { version = "1", features = ["derive"] } serde_json = { version = "1", features = ["unbounded_depth"] } -sourcemap = "6" +sourcemap = "6.2" swc_core = { version = "0.59.36", features = [ "trace_macro", "common_concurrent", diff --git a/crates/swc_common/Cargo.toml b/crates/swc_common/Cargo.toml index 19a75946f29d..91ce189c4fe3 100644 --- a/crates/swc_common/Cargo.toml +++ b/crates/swc_common/Cargo.toml @@ -70,7 +70,7 @@ rkyv-latest = { package = "rkyv-test", version = "=0.7.38-test.2", opti rustc-hash = "1.1.0" serde = { version = "1.0.119", features = ["derive"] } siphasher = "0.3.9" -sourcemap = { version = "6", optional = true } +sourcemap = { version = "6.2", optional = true } string_cache = "0.8.4" swc_atoms = { version = "0.4.36", path = "../swc_atoms" } swc_eq_ignore_macros = { version = "0.1.1", path = "../swc_eq_ignore_macros" } From 2123530d68a4336107e493c6d46c35799bdb07fb Mon Sep 17 00:00:00 2001 From: uegi9quae1pee2qu Date: Wed, 22 Feb 2023 23:28:41 +0100 Subject: [PATCH 4/6] update sourcemap fixture test output mappings --- crates/swc/tests/fixture/sourcemap/004/output/index.map | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/swc/tests/fixture/sourcemap/004/output/index.map b/crates/swc/tests/fixture/sourcemap/004/output/index.map index 0885cc65c807..ad091f129e6c 100644 --- a/crates/swc/tests/fixture/sourcemap/004/output/index.map +++ b/crates/swc/tests/fixture/sourcemap/004/output/index.map @@ -1,5 +1,5 @@ { - "mappings": "AAACA,CAAAA,KAAKC,gBAAmB,GAAGD,KAAKC,gBAAmB,IAAI,EAAC,AAAD,EAAIC,IAAI,CAAC;IAC7D;QACI;KACH;IACD;QACU,MAAY,SAAUC,CAAuB,EAAEC,CAAmB,EAAEC,CAAmB,EAAE;YAC3F;YACA,IAAIC,IAAa,SAAoBC,CAAI,EAAE;gBACvC,IAAIC,IAAOD,EAAKC,IAAI;gBACpB,OAAsB,CAAA,GAAGC,EAA+CC,GAAE,AAAFA,EAAK,OAAO;oBAChFC,UAAUH,EAAKI,GAAG;gBACtB;YACJ;YACAP,EAAoBQ,CAAC,CAACT,IACDC,EAAoBS,CAAC,CAACV,GAAqB;gBACvCW,SAAS,WAAoB;oBAC9C,OAAqBA;gBACzB;gBACqBC,SAAS,WAAoB;oBAC9C,OAAqBV;gBACzB;YACJ,EAAA;YACqB,IAAIG,IAAiDJ,EAAoB,OAC1FU,IAAU,CAAA;QAE1B;QACc,MAAY,SAAUZ,CAAuB,EAAEc,CAAwB,EAAEZ,CAAmB,EAAE;YAC/Fa,CAAAA,OAAOC,QAAQ,GAAGD,OAAOC,QAAQ,IAAI,EAAC,AAAD,EAAIjB,IAAI,CAAC;gBAC3C;gBACA,WAAY;oBACR,OAAOG,EAAoB;gBAC/B;aACH;QAGb;IACI;IACS,SAAUA,CAAmB,EAAE;QAK3BA,EAAoBe,CAAC,CAAC,GAAG;YAC9B;YACA;YACA;SACH,EAAE,WAAY;YACX,OAPOf,EAAoBA,EAAoBgB,CAAC,GAOxB;QAC5B,IAESC,OAD0BjB,EAAoBe,CAAC,EAAA;IAGhE;CACC", + "mappings": "AAACA,CAAAA,KAAKC,gBAAmB,GAAGD,KAAKC,gBAAmB,IAAI,EAAC,AAAD,EAAIC,IAAI,CAAC;IAC7D;QACI;KACH;IACD;QACU,MAAY,SAAUC,CAAuB,EAAEC,CAAmB,EAAEC,CAAmB,EAAE;YAC3F;YACA,IAAIC,IAAa,SAAoBC,CAAI,EAAE;gBACvC,IAAIC,IAAOD,EAAKC,IAAI;gBACpB,OAAqB,AAAC,CAAA,GAAGC,EAA+CC,GAAE,AAAFA,EAAK,OAAO;oBAChFC,UAAUH,EAAKI,GAAG;gBACtB;YACJ;YACAP,EAAoBQ,CAAC,CAACT,IACDC,EAAoBS,CAAC,CAACV,GAAqB;gBACvCW,SAAS,WAAoB;oBAC9C,OAAqBA;gBACzB;gBACqBC,SAAS,WAAoB;oBAC9C,OAAqBV;gBACzB;YACJ,EAAA;YACqB,IAAIG,IAAiDJ,EAAoB,OAC1FU,IAAU,CAAA;QAE1B;QACc,MAAY,SAAUZ,CAAuB,EAAEc,CAAwB,EAAEZ,CAAmB,EAAE;YAC/Fa,CAAAA,OAAOC,QAAQ,GAAGD,OAAOC,QAAQ,IAAI,EAAC,AAAD,EAAIjB,IAAI,CAAC;gBAC3C;gBACA,WAAY;oBACR,OAAOG,EAAoB;gBAC/B;aACH;QAGb;IACI;IACS,SAAUA,CAAmB,EAAE;QAK3BA,EAAoBe,CAAC,CAAC,GAAG;YAC9B;YACA;YACA;SACH,EAAE,WAAY;YACX,OAPOf,EAAoBA,EAAoBgB,CAAC,GAOxB;QAC5B,IAESC,OAD0BjB,EAAoBe,CAAC,EAAA;IAGhE;CACC", "names": [ "self", "webpackChunk_N_E", From 6123a96b34d67afefe2bf4adcb1e653baad45404 Mon Sep 17 00:00:00 2001 From: uegi9quae1pee2qu Date: Fri, 24 Feb 2023 18:03:35 +0100 Subject: [PATCH 5/6] update sourcemap -> 6.2.2 --- Cargo.lock | 12 +- bindings/Cargo.lock | 12 +- bindings/swc_cli/Cargo.toml | 2 +- crates/swc/Cargo.toml | 2 +- crates/swc_common/Cargo.toml | 2 +- crates/swc_ecma_codegen/Cargo.toml | 2 +- crates/swc_ecma_minifier/fuzz/Cargo.lock | 137 ++++++++++-------- crates/swc_ecma_transforms/Cargo.toml | 2 +- crates/swc_ecma_transforms_testing/Cargo.toml | 2 +- 9 files changed, 104 insertions(+), 69 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0582d4be106e..d3b46d145cf5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -836,6 +836,12 @@ dependencies = [ "parking_lot", ] +[[package]] +name = "data-encoding" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23d8666cb01533c39dde32bcbab8e227b4ed6679b2c925eba05feabea39508fb" + [[package]] name = "dbg-swc" version = "0.66.54" @@ -2915,11 +2921,11 @@ dependencies = [ [[package]] name = "sourcemap" -version = "6.2.1" +version = "6.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aebe057d110ddba043708da3fb010bf562ff6e9d4d60c9ee92860527bcbeccd6" +checksum = "3562681c4e0890af6cd22f09a0eeed4afd855d5011cd5f9358c834b670932382" dependencies = [ - "base64", + "data-encoding", "if_chain", "rustc_version 0.2.3", "serde", diff --git a/bindings/Cargo.lock b/bindings/Cargo.lock index a56cdfd9bb5c..c1e528a6d62c 100644 --- a/bindings/Cargo.lock +++ b/bindings/Cargo.lock @@ -714,6 +714,12 @@ dependencies = [ "parking_lot_core", ] +[[package]] +name = "data-encoding" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23d8666cb01533c39dde32bcbab8e227b4ed6679b2c925eba05feabea39508fb" + [[package]] name = "digest" version = "0.10.6" @@ -2252,11 +2258,11 @@ checksum = "f67ad224767faa3c7d8b6d91985b78e70a1324408abcb1cfcc2be4c06bc06043" [[package]] name = "sourcemap" -version = "6.2.1" +version = "6.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aebe057d110ddba043708da3fb010bf562ff6e9d4d60c9ee92860527bcbeccd6" +checksum = "3562681c4e0890af6cd22f09a0eeed4afd855d5011cd5f9358c834b670932382" dependencies = [ - "base64", + "data-encoding", "if_chain", "rustc_version", "serde", diff --git a/bindings/swc_cli/Cargo.toml b/bindings/swc_cli/Cargo.toml index b6c086eeb6fe..88be9b3aedf9 100644 --- a/bindings/swc_cli/Cargo.toml +++ b/bindings/swc_cli/Cargo.toml @@ -26,7 +26,7 @@ rayon = "1" relative-path = "1.6.1" serde = { version = "1", features = ["derive"] } serde_json = { version = "1", features = ["unbounded_depth"] } -sourcemap = "6.2" +sourcemap = "6.2.2" swc_core = { version = "0.59.36", features = [ "trace_macro", "common_concurrent", diff --git a/crates/swc/Cargo.toml b/crates/swc/Cargo.toml index a8c12de8fd92..a96c410749d2 100644 --- a/crates/swc/Cargo.toml +++ b/crates/swc/Cargo.toml @@ -62,7 +62,7 @@ regex = "1" rustc-hash = "1.1.0" serde = { version = "1", features = ["derive"] } serde_json = "1" -sourcemap = "6" +sourcemap = "6.2.2" swc_atoms = { version = "0.4.37", path = "../swc_atoms" } swc_cached = { version = "0.3.15", path = "../swc_cached" } swc_common = { version = "0.29.32", path = "../swc_common", features = [ diff --git a/crates/swc_common/Cargo.toml b/crates/swc_common/Cargo.toml index a971308c2b35..de2392033efa 100644 --- a/crates/swc_common/Cargo.toml +++ b/crates/swc_common/Cargo.toml @@ -70,7 +70,7 @@ rkyv-latest = { package = "rkyv-test", version = "=0.7.38-test.2", opti rustc-hash = "1.1.0" serde = { version = "1.0.119", features = ["derive"] } siphasher = "0.3.9" -sourcemap = { version = "6.2", optional = true } +sourcemap = { version = "6.2.2", optional = true } string_cache = "0.8.4" swc_atoms = { version = "0.4.37", path = "../swc_atoms" } swc_eq_ignore_macros = { version = "0.1.1", path = "../swc_eq_ignore_macros" } diff --git a/crates/swc_ecma_codegen/Cargo.toml b/crates/swc_ecma_codegen/Cargo.toml index 5b0caca37ea8..34b7cdf12d9b 100644 --- a/crates/swc_ecma_codegen/Cargo.toml +++ b/crates/swc_ecma_codegen/Cargo.toml @@ -18,7 +18,7 @@ num-bigint = { version = "0.4", features = ["serde"] } once_cell = "1.10.0" rustc-hash = "1.1.0" serde = "1.0.127" -sourcemap = "6" +sourcemap = "6.2.2" swc_atoms = { version = "0.4.37", path = "../swc_atoms" } swc_common = { version = "0.29.32", path = "../swc_common" } swc_ecma_ast = { version = "0.96.7", path = "../swc_ecma_ast" } diff --git a/crates/swc_ecma_minifier/fuzz/Cargo.lock b/crates/swc_ecma_minifier/fuzz/Cargo.lock index 859c9ac97609..5b5cbb93edac 100644 --- a/crates/swc_ecma_minifier/fuzz/Cargo.lock +++ b/crates/swc_ecma_minifier/fuzz/Cargo.lock @@ -121,12 +121,6 @@ dependencies = [ "rustc-demangle", ] -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - [[package]] name = "better_scoped_tls" version = "0.1.0" @@ -242,13 +236,10 @@ dependencies = [ ] [[package]] -name = "debug_unreachable" -version = "0.1.1" +name = "data-encoding" +version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a032eac705ca39214d169f83e3d3da290af06d8d1d344d1baad2fd002dca4b3" -dependencies = [ - "unreachable", -] +checksum = "23d8666cb01533c39dde32bcbab8e227b4ed6679b2c925eba05feabea39508fb" [[package]] name = "derive_arbitrary" @@ -855,6 +846,15 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "psm" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" +dependencies = [ + "cc", +] + [[package]] name = "quote" version = "1.0.21" @@ -864,6 +864,12 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "radix_fmt" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce082a9940a7ace2ad4a8b7d0b1eac6aa378895f18be598230c5f2284ac05426" + [[package]] name = "rand" version = "0.8.5" @@ -935,12 +941,6 @@ version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0df32d82cedd1499386877b062ebe8721f806de80b08d183c70184ef17dd1d42" -[[package]] -name = "retain_mut" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4389f1d5789befaf6029ebd9f7dac4af7f7e3d61b69d4f30e2ac02b57e7712b0" - [[package]] name = "rustc-demangle" version = "0.1.21" @@ -968,6 +968,12 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +[[package]] +name = "ryu-js" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6518fc26bced4d53678a22d6e423e9d8716377def84545fe328236e3af070e7f" + [[package]] name = "scoped-tls" version = "1.0.0" @@ -1066,17 +1072,16 @@ checksum = "f67ad224767faa3c7d8b6d91985b78e70a1324408abcb1cfcc2be4c06bc06043" [[package]] name = "sourcemap" -version = "6.2.0" +version = "6.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c46fdc1838ff49cf692226f5c2b0f5b7538f556863d0eca602984714667ac6e7" +checksum = "3562681c4e0890af6cd22f09a0eeed4afd855d5011cd5f9358c834b670932382" dependencies = [ - "base64", + "data-encoding", "if_chain", - "lazy_static", - "regex", "rustc_version", "serde", "serde_json", + "unicode-id", "url", ] @@ -1086,6 +1091,19 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +[[package]] +name = "stacker" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c886bd4480155fd3ef527d45e9ac8dd7118a898a46530b7b94c3e21866259fce" +dependencies = [ + "cc", + "cfg-if", + "libc", + "psm", + "winapi", +] + [[package]] name = "static_assertions" version = "1.1.0" @@ -1165,7 +1183,7 @@ dependencies = [ [[package]] name = "swc_atoms" -version = "0.4.23" +version = "0.4.37" dependencies = [ "once_cell", "rustc-hash", @@ -1189,7 +1207,7 @@ dependencies = [ [[package]] name = "swc_common" -version = "0.29.10" +version = "0.29.32" dependencies = [ "ahash", "arbitrary", @@ -1197,9 +1215,9 @@ dependencies = [ "atty", "better_scoped_tls", "cfg-if", - "debug_unreachable", "either", "from_variant", + "new_debug_unreachable", "num-bigint", "once_cell", "parking_lot", @@ -1239,7 +1257,7 @@ dependencies = [ [[package]] name = "swc_ecma_ast" -version = "0.94.14" +version = "0.96.7" dependencies = [ "arbitrary", "bitflags", @@ -1255,7 +1273,7 @@ dependencies = [ [[package]] name = "swc_ecma_codegen" -version = "0.127.24" +version = "0.129.15" dependencies = [ "memchr", "num-bigint", @@ -1283,7 +1301,7 @@ dependencies = [ [[package]] name = "swc_ecma_minifier" -version = "0.159.47" +version = "0.166.30" dependencies = [ "ahash", "arrayvec", @@ -1292,9 +1310,10 @@ dependencies = [ "num_cpus", "once_cell", "parking_lot", + "radix_fmt", "regex", - "retain_mut", "rustc-hash", + "ryu-js", "serde", "serde_json", "swc_atoms", @@ -1306,6 +1325,7 @@ dependencies = [ "swc_ecma_parser", "swc_ecma_transforms_base", "swc_ecma_transforms_optimization", + "swc_ecma_usage_analyzer", "swc_ecma_utils", "swc_ecma_visit", "swc_timer", @@ -1330,7 +1350,7 @@ dependencies = [ [[package]] name = "swc_ecma_parser" -version = "0.122.20" +version = "0.124.12" dependencies = [ "either", "enum_kind", @@ -1338,6 +1358,7 @@ dependencies = [ "num-bigint", "serde", "smallvec", + "stacker", "swc_atoms", "swc_common", "swc_ecma_ast", @@ -1347,7 +1368,7 @@ dependencies = [ [[package]] name = "swc_ecma_testing" -version = "0.20.7" +version = "0.20.8" dependencies = [ "anyhow", "hex", @@ -1357,7 +1378,7 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_base" -version = "0.111.34" +version = "0.116.14" dependencies = [ "better_scoped_tls", "bitflags", @@ -1388,7 +1409,7 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_optimization" -version = "0.167.27" +version = "0.172.27" dependencies = [ "ahash", "dashmap", @@ -1409,13 +1430,30 @@ dependencies = [ "tracing", ] +[[package]] +name = "swc_ecma_usage_analyzer" +version = "0.3.10" +dependencies = [ + "ahash", + "indexmap", + "rustc-hash", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_utils", + "swc_ecma_visit", + "swc_timer", + "tracing", +] + [[package]] name = "swc_ecma_utils" -version = "0.105.25" +version = "0.107.12" dependencies = [ "indexmap", "num_cpus", "once_cell", + "rustc-hash", "swc_atoms", "swc_common", "swc_ecma_ast", @@ -1426,7 +1464,7 @@ dependencies = [ [[package]] name = "swc_ecma_visit" -version = "0.80.14" +version = "0.82.7" dependencies = [ "num-bigint", "swc_atoms", @@ -1448,7 +1486,7 @@ dependencies = [ [[package]] name = "swc_error_reporters" -version = "0.13.10" +version = "0.13.33" dependencies = [ "anyhow", "miette", @@ -1459,7 +1497,7 @@ dependencies = [ [[package]] name = "swc_fast_graph" -version = "0.17.11" +version = "0.17.33" dependencies = [ "ahash", "indexmap", @@ -1479,14 +1517,14 @@ dependencies = [ [[package]] name = "swc_timer" -version = "0.17.10" +version = "0.17.34" dependencies = [ "tracing", ] [[package]] name = "swc_visit" -version = "0.5.3" +version = "0.5.4" dependencies = [ "either", "swc_visit_macros", @@ -1494,7 +1532,7 @@ dependencies = [ [[package]] name = "swc_visit_macros" -version = "0.5.4" +version = "0.5.5" dependencies = [ "Inflector", "pmutil", @@ -1536,7 +1574,7 @@ dependencies = [ [[package]] name = "testing" -version = "0.31.10" +version = "0.31.34" dependencies = [ "ansi_term", "difference", @@ -1748,15 +1786,6 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" -[[package]] -name = "unreachable" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f2ae5ddb18e1c92664717616dd9549dde73f539f01bd7b77c2edb2446bdff91" -dependencies = [ - "void", -] - [[package]] name = "url" version = "2.3.1" @@ -1780,12 +1809,6 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" diff --git a/crates/swc_ecma_transforms/Cargo.toml b/crates/swc_ecma_transforms/Cargo.toml index fb41e60a14be..f41506794605 100644 --- a/crates/swc_ecma_transforms/Cargo.toml +++ b/crates/swc_ecma_transforms/Cargo.toml @@ -46,7 +46,7 @@ swc_ecma_visit = { version = "0.82.7", path = "../swc_ecma_vis [dev-dependencies] pretty_assertions = "1.1" -sourcemap = "6" +sourcemap = "6.2.2" swc_ecma_codegen = { version = "0.129.15", path = "../swc_ecma_codegen" } swc_ecma_parser = { version = "0.124.12", path = "../swc_ecma_parser" } swc_ecma_transforms_testing = { version = "0.119.14", path = "../swc_ecma_transforms_testing" } diff --git a/crates/swc_ecma_transforms_testing/Cargo.toml b/crates/swc_ecma_transforms_testing/Cargo.toml index a926cdedfb79..077d5f319ce9 100644 --- a/crates/swc_ecma_transforms_testing/Cargo.toml +++ b/crates/swc_ecma_transforms_testing/Cargo.toml @@ -19,7 +19,7 @@ hex = "0.4.3" serde = "1" serde_json = "1" sha-1 = "0.10" -sourcemap = "6" +sourcemap = "6.2.2" swc_common = { version = "0.29.32", path = "../swc_common", features = [ "sourcemap", ] } From eef3e396a1808b2cbc7f1d33297e6ea74f6c208d Mon Sep 17 00:00:00 2001 From: uegi9quae1pee2qu Date: Sat, 25 Feb 2023 20:04:02 +0100 Subject: [PATCH 6/6] revert sourcemap update --- Cargo.lock | 53 +++---- crates/swc/Cargo.toml | 2 +- .../fixture/sourcemap/004/output/index.map | 2 +- crates/swc_common/Cargo.toml | 2 +- crates/swc_ecma_codegen/Cargo.toml | 2 +- crates/swc_ecma_minifier/fuzz/Cargo.lock | 137 ++++++++---------- crates/swc_ecma_transforms/Cargo.toml | 2 +- crates/swc_ecma_transforms_testing/Cargo.toml | 2 +- 8 files changed, 90 insertions(+), 112 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d3b46d145cf5..7541e3eb1480 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -156,6 +156,12 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b" +[[package]] +name = "base64" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" + [[package]] name = "base64" version = "0.13.1" @@ -836,15 +842,9 @@ dependencies = [ "parking_lot", ] -[[package]] -name = "data-encoding" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d8666cb01533c39dde32bcbab8e227b4ed6679b2c925eba05feabea39508fb" - [[package]] name = "dbg-swc" -version = "0.66.54" +version = "0.66.55" dependencies = [ "anyhow", "clap 3.1.0", @@ -2553,7 +2553,7 @@ version = "0.11.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68cc60575865c7831548863cc02356512e3f1dc2f3f82cb837d7fc4cc8f3c97c" dependencies = [ - "base64", + "base64 0.13.1", "bytes", "encoding_rs", "futures-core", @@ -2921,16 +2921,17 @@ dependencies = [ [[package]] name = "sourcemap" -version = "6.2.2" +version = "6.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3562681c4e0890af6cd22f09a0eeed4afd855d5011cd5f9358c834b670932382" +checksum = "6e031f2463ecbdd5f34c950f89f5c1e1032f22c0f8e3dc4bdb2e8b6658cf61eb" dependencies = [ - "data-encoding", + "base64 0.11.0", "if_chain", + "lazy_static", + "regex", "rustc_version 0.2.3", "serde", "serde_json", - "unicode-id", "url", ] @@ -3124,7 +3125,7 @@ dependencies = [ "ahash", "ansi_term", "anyhow", - "base64", + "base64 0.13.1", "criterion", "dashmap", "either", @@ -3305,7 +3306,7 @@ dependencies = [ [[package]] name = "swc_core" -version = "0.59.39" +version = "0.59.40" dependencies = [ "anyhow", "binding_macros", @@ -3358,7 +3359,7 @@ dependencies = [ [[package]] name = "swc_css" -version = "0.149.7" +version = "0.149.8" dependencies = [ "swc_css_ast", "swc_css_codegen", @@ -3386,7 +3387,7 @@ dependencies = [ [[package]] name = "swc_css_codegen" -version = "0.144.5" +version = "0.144.6" dependencies = [ "auto_impl", "bitflags", @@ -3415,7 +3416,7 @@ dependencies = [ [[package]] name = "swc_css_compat" -version = "0.20.5" +version = "0.20.6" dependencies = [ "bitflags", "once_cell", @@ -3452,7 +3453,7 @@ dependencies = [ [[package]] name = "swc_css_minifier" -version = "0.109.5" +version = "0.109.6" dependencies = [ "criterion", "serde", @@ -3469,7 +3470,7 @@ dependencies = [ [[package]] name = "swc_css_modules" -version = "0.21.7" +version = "0.21.8" dependencies = [ "rustc-hash", "serde", @@ -3503,7 +3504,7 @@ dependencies = [ [[package]] name = "swc_css_prefixer" -version = "0.146.5" +version = "0.146.6" dependencies = [ "once_cell", "preset_env_base", @@ -3521,7 +3522,7 @@ dependencies = [ [[package]] name = "swc_css_utils" -version = "0.131.5" +version = "0.131.6" dependencies = [ "once_cell", "serde", @@ -3567,7 +3568,7 @@ dependencies = [ name = "swc_ecma_codegen" version = "0.129.15" dependencies = [ - "base64", + "base64 0.13.1", "criterion", "memchr", "num-bigint", @@ -3992,7 +3993,7 @@ name = "swc_ecma_transforms_react" version = "0.160.21" dependencies = [ "ahash", - "base64", + "base64 0.13.1", "dashmap", "indexmap", "once_cell", @@ -4023,7 +4024,7 @@ version = "0.119.14" dependencies = [ "ansi_term", "anyhow", - "base64", + "base64 0.13.1", "hex", "serde", "serde_json", @@ -4207,7 +4208,7 @@ dependencies = [ [[package]] name = "swc_html" -version = "0.109.30" +version = "0.109.31" dependencies = [ "swc_html_ast", "swc_html_codegen", @@ -4259,7 +4260,7 @@ dependencies = [ [[package]] name = "swc_html_minifier" -version = "0.106.30" +version = "0.106.31" dependencies = [ "criterion", "once_cell", diff --git a/crates/swc/Cargo.toml b/crates/swc/Cargo.toml index a96c410749d2..a8c12de8fd92 100644 --- a/crates/swc/Cargo.toml +++ b/crates/swc/Cargo.toml @@ -62,7 +62,7 @@ regex = "1" rustc-hash = "1.1.0" serde = { version = "1", features = ["derive"] } serde_json = "1" -sourcemap = "6.2.2" +sourcemap = "6" swc_atoms = { version = "0.4.37", path = "../swc_atoms" } swc_cached = { version = "0.3.15", path = "../swc_cached" } swc_common = { version = "0.29.32", path = "../swc_common", features = [ diff --git a/crates/swc/tests/fixture/sourcemap/004/output/index.map b/crates/swc/tests/fixture/sourcemap/004/output/index.map index ad091f129e6c..0885cc65c807 100644 --- a/crates/swc/tests/fixture/sourcemap/004/output/index.map +++ b/crates/swc/tests/fixture/sourcemap/004/output/index.map @@ -1,5 +1,5 @@ { - "mappings": "AAACA,CAAAA,KAAKC,gBAAmB,GAAGD,KAAKC,gBAAmB,IAAI,EAAC,AAAD,EAAIC,IAAI,CAAC;IAC7D;QACI;KACH;IACD;QACU,MAAY,SAAUC,CAAuB,EAAEC,CAAmB,EAAEC,CAAmB,EAAE;YAC3F;YACA,IAAIC,IAAa,SAAoBC,CAAI,EAAE;gBACvC,IAAIC,IAAOD,EAAKC,IAAI;gBACpB,OAAqB,AAAC,CAAA,GAAGC,EAA+CC,GAAE,AAAFA,EAAK,OAAO;oBAChFC,UAAUH,EAAKI,GAAG;gBACtB;YACJ;YACAP,EAAoBQ,CAAC,CAACT,IACDC,EAAoBS,CAAC,CAACV,GAAqB;gBACvCW,SAAS,WAAoB;oBAC9C,OAAqBA;gBACzB;gBACqBC,SAAS,WAAoB;oBAC9C,OAAqBV;gBACzB;YACJ,EAAA;YACqB,IAAIG,IAAiDJ,EAAoB,OAC1FU,IAAU,CAAA;QAE1B;QACc,MAAY,SAAUZ,CAAuB,EAAEc,CAAwB,EAAEZ,CAAmB,EAAE;YAC/Fa,CAAAA,OAAOC,QAAQ,GAAGD,OAAOC,QAAQ,IAAI,EAAC,AAAD,EAAIjB,IAAI,CAAC;gBAC3C;gBACA,WAAY;oBACR,OAAOG,EAAoB;gBAC/B;aACH;QAGb;IACI;IACS,SAAUA,CAAmB,EAAE;QAK3BA,EAAoBe,CAAC,CAAC,GAAG;YAC9B;YACA;YACA;SACH,EAAE,WAAY;YACX,OAPOf,EAAoBA,EAAoBgB,CAAC,GAOxB;QAC5B,IAESC,OAD0BjB,EAAoBe,CAAC,EAAA;IAGhE;CACC", + "mappings": "AAACA,CAAAA,KAAKC,gBAAmB,GAAGD,KAAKC,gBAAmB,IAAI,EAAC,AAAD,EAAIC,IAAI,CAAC;IAC7D;QACI;KACH;IACD;QACU,MAAY,SAAUC,CAAuB,EAAEC,CAAmB,EAAEC,CAAmB,EAAE;YAC3F;YACA,IAAIC,IAAa,SAAoBC,CAAI,EAAE;gBACvC,IAAIC,IAAOD,EAAKC,IAAI;gBACpB,OAAsB,CAAA,GAAGC,EAA+CC,GAAE,AAAFA,EAAK,OAAO;oBAChFC,UAAUH,EAAKI,GAAG;gBACtB;YACJ;YACAP,EAAoBQ,CAAC,CAACT,IACDC,EAAoBS,CAAC,CAACV,GAAqB;gBACvCW,SAAS,WAAoB;oBAC9C,OAAqBA;gBACzB;gBACqBC,SAAS,WAAoB;oBAC9C,OAAqBV;gBACzB;YACJ,EAAA;YACqB,IAAIG,IAAiDJ,EAAoB,OAC1FU,IAAU,CAAA;QAE1B;QACc,MAAY,SAAUZ,CAAuB,EAAEc,CAAwB,EAAEZ,CAAmB,EAAE;YAC/Fa,CAAAA,OAAOC,QAAQ,GAAGD,OAAOC,QAAQ,IAAI,EAAC,AAAD,EAAIjB,IAAI,CAAC;gBAC3C;gBACA,WAAY;oBACR,OAAOG,EAAoB;gBAC/B;aACH;QAGb;IACI;IACS,SAAUA,CAAmB,EAAE;QAK3BA,EAAoBe,CAAC,CAAC,GAAG;YAC9B;YACA;YACA;SACH,EAAE,WAAY;YACX,OAPOf,EAAoBA,EAAoBgB,CAAC,GAOxB;QAC5B,IAESC,OAD0BjB,EAAoBe,CAAC,EAAA;IAGhE;CACC", "names": [ "self", "webpackChunk_N_E", diff --git a/crates/swc_common/Cargo.toml b/crates/swc_common/Cargo.toml index de2392033efa..64c383ea4ba7 100644 --- a/crates/swc_common/Cargo.toml +++ b/crates/swc_common/Cargo.toml @@ -70,7 +70,7 @@ rkyv-latest = { package = "rkyv-test", version = "=0.7.38-test.2", opti rustc-hash = "1.1.0" serde = { version = "1.0.119", features = ["derive"] } siphasher = "0.3.9" -sourcemap = { version = "6.2.2", optional = true } +sourcemap = { version = "6", optional = true } string_cache = "0.8.4" swc_atoms = { version = "0.4.37", path = "../swc_atoms" } swc_eq_ignore_macros = { version = "0.1.1", path = "../swc_eq_ignore_macros" } diff --git a/crates/swc_ecma_codegen/Cargo.toml b/crates/swc_ecma_codegen/Cargo.toml index 34b7cdf12d9b..5b0caca37ea8 100644 --- a/crates/swc_ecma_codegen/Cargo.toml +++ b/crates/swc_ecma_codegen/Cargo.toml @@ -18,7 +18,7 @@ num-bigint = { version = "0.4", features = ["serde"] } once_cell = "1.10.0" rustc-hash = "1.1.0" serde = "1.0.127" -sourcemap = "6.2.2" +sourcemap = "6" swc_atoms = { version = "0.4.37", path = "../swc_atoms" } swc_common = { version = "0.29.32", path = "../swc_common" } swc_ecma_ast = { version = "0.96.7", path = "../swc_ecma_ast" } diff --git a/crates/swc_ecma_minifier/fuzz/Cargo.lock b/crates/swc_ecma_minifier/fuzz/Cargo.lock index 5b5cbb93edac..859c9ac97609 100644 --- a/crates/swc_ecma_minifier/fuzz/Cargo.lock +++ b/crates/swc_ecma_minifier/fuzz/Cargo.lock @@ -121,6 +121,12 @@ dependencies = [ "rustc-demangle", ] +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + [[package]] name = "better_scoped_tls" version = "0.1.0" @@ -236,10 +242,13 @@ dependencies = [ ] [[package]] -name = "data-encoding" -version = "2.3.3" +name = "debug_unreachable" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d8666cb01533c39dde32bcbab8e227b4ed6679b2c925eba05feabea39508fb" +checksum = "9a032eac705ca39214d169f83e3d3da290af06d8d1d344d1baad2fd002dca4b3" +dependencies = [ + "unreachable", +] [[package]] name = "derive_arbitrary" @@ -846,15 +855,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "psm" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" -dependencies = [ - "cc", -] - [[package]] name = "quote" version = "1.0.21" @@ -864,12 +864,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "radix_fmt" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce082a9940a7ace2ad4a8b7d0b1eac6aa378895f18be598230c5f2284ac05426" - [[package]] name = "rand" version = "0.8.5" @@ -941,6 +935,12 @@ version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0df32d82cedd1499386877b062ebe8721f806de80b08d183c70184ef17dd1d42" +[[package]] +name = "retain_mut" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4389f1d5789befaf6029ebd9f7dac4af7f7e3d61b69d4f30e2ac02b57e7712b0" + [[package]] name = "rustc-demangle" version = "0.1.21" @@ -968,12 +968,6 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" -[[package]] -name = "ryu-js" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6518fc26bced4d53678a22d6e423e9d8716377def84545fe328236e3af070e7f" - [[package]] name = "scoped-tls" version = "1.0.0" @@ -1072,16 +1066,17 @@ checksum = "f67ad224767faa3c7d8b6d91985b78e70a1324408abcb1cfcc2be4c06bc06043" [[package]] name = "sourcemap" -version = "6.2.2" +version = "6.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3562681c4e0890af6cd22f09a0eeed4afd855d5011cd5f9358c834b670932382" +checksum = "c46fdc1838ff49cf692226f5c2b0f5b7538f556863d0eca602984714667ac6e7" dependencies = [ - "data-encoding", + "base64", "if_chain", + "lazy_static", + "regex", "rustc_version", "serde", "serde_json", - "unicode-id", "url", ] @@ -1091,19 +1086,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" -[[package]] -name = "stacker" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c886bd4480155fd3ef527d45e9ac8dd7118a898a46530b7b94c3e21866259fce" -dependencies = [ - "cc", - "cfg-if", - "libc", - "psm", - "winapi", -] - [[package]] name = "static_assertions" version = "1.1.0" @@ -1183,7 +1165,7 @@ dependencies = [ [[package]] name = "swc_atoms" -version = "0.4.37" +version = "0.4.23" dependencies = [ "once_cell", "rustc-hash", @@ -1207,7 +1189,7 @@ dependencies = [ [[package]] name = "swc_common" -version = "0.29.32" +version = "0.29.10" dependencies = [ "ahash", "arbitrary", @@ -1215,9 +1197,9 @@ dependencies = [ "atty", "better_scoped_tls", "cfg-if", + "debug_unreachable", "either", "from_variant", - "new_debug_unreachable", "num-bigint", "once_cell", "parking_lot", @@ -1257,7 +1239,7 @@ dependencies = [ [[package]] name = "swc_ecma_ast" -version = "0.96.7" +version = "0.94.14" dependencies = [ "arbitrary", "bitflags", @@ -1273,7 +1255,7 @@ dependencies = [ [[package]] name = "swc_ecma_codegen" -version = "0.129.15" +version = "0.127.24" dependencies = [ "memchr", "num-bigint", @@ -1301,7 +1283,7 @@ dependencies = [ [[package]] name = "swc_ecma_minifier" -version = "0.166.30" +version = "0.159.47" dependencies = [ "ahash", "arrayvec", @@ -1310,10 +1292,9 @@ dependencies = [ "num_cpus", "once_cell", "parking_lot", - "radix_fmt", "regex", + "retain_mut", "rustc-hash", - "ryu-js", "serde", "serde_json", "swc_atoms", @@ -1325,7 +1306,6 @@ dependencies = [ "swc_ecma_parser", "swc_ecma_transforms_base", "swc_ecma_transforms_optimization", - "swc_ecma_usage_analyzer", "swc_ecma_utils", "swc_ecma_visit", "swc_timer", @@ -1350,7 +1330,7 @@ dependencies = [ [[package]] name = "swc_ecma_parser" -version = "0.124.12" +version = "0.122.20" dependencies = [ "either", "enum_kind", @@ -1358,7 +1338,6 @@ dependencies = [ "num-bigint", "serde", "smallvec", - "stacker", "swc_atoms", "swc_common", "swc_ecma_ast", @@ -1368,7 +1347,7 @@ dependencies = [ [[package]] name = "swc_ecma_testing" -version = "0.20.8" +version = "0.20.7" dependencies = [ "anyhow", "hex", @@ -1378,7 +1357,7 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_base" -version = "0.116.14" +version = "0.111.34" dependencies = [ "better_scoped_tls", "bitflags", @@ -1409,7 +1388,7 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_optimization" -version = "0.172.27" +version = "0.167.27" dependencies = [ "ahash", "dashmap", @@ -1430,30 +1409,13 @@ dependencies = [ "tracing", ] -[[package]] -name = "swc_ecma_usage_analyzer" -version = "0.3.10" -dependencies = [ - "ahash", - "indexmap", - "rustc-hash", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_timer", - "tracing", -] - [[package]] name = "swc_ecma_utils" -version = "0.107.12" +version = "0.105.25" dependencies = [ "indexmap", "num_cpus", "once_cell", - "rustc-hash", "swc_atoms", "swc_common", "swc_ecma_ast", @@ -1464,7 +1426,7 @@ dependencies = [ [[package]] name = "swc_ecma_visit" -version = "0.82.7" +version = "0.80.14" dependencies = [ "num-bigint", "swc_atoms", @@ -1486,7 +1448,7 @@ dependencies = [ [[package]] name = "swc_error_reporters" -version = "0.13.33" +version = "0.13.10" dependencies = [ "anyhow", "miette", @@ -1497,7 +1459,7 @@ dependencies = [ [[package]] name = "swc_fast_graph" -version = "0.17.33" +version = "0.17.11" dependencies = [ "ahash", "indexmap", @@ -1517,14 +1479,14 @@ dependencies = [ [[package]] name = "swc_timer" -version = "0.17.34" +version = "0.17.10" dependencies = [ "tracing", ] [[package]] name = "swc_visit" -version = "0.5.4" +version = "0.5.3" dependencies = [ "either", "swc_visit_macros", @@ -1532,7 +1494,7 @@ dependencies = [ [[package]] name = "swc_visit_macros" -version = "0.5.5" +version = "0.5.4" dependencies = [ "Inflector", "pmutil", @@ -1574,7 +1536,7 @@ dependencies = [ [[package]] name = "testing" -version = "0.31.34" +version = "0.31.10" dependencies = [ "ansi_term", "difference", @@ -1786,6 +1748,15 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +[[package]] +name = "unreachable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f2ae5ddb18e1c92664717616dd9549dde73f539f01bd7b77c2edb2446bdff91" +dependencies = [ + "void", +] + [[package]] name = "url" version = "2.3.1" @@ -1809,6 +1780,12 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" diff --git a/crates/swc_ecma_transforms/Cargo.toml b/crates/swc_ecma_transforms/Cargo.toml index f41506794605..fb41e60a14be 100644 --- a/crates/swc_ecma_transforms/Cargo.toml +++ b/crates/swc_ecma_transforms/Cargo.toml @@ -46,7 +46,7 @@ swc_ecma_visit = { version = "0.82.7", path = "../swc_ecma_vis [dev-dependencies] pretty_assertions = "1.1" -sourcemap = "6.2.2" +sourcemap = "6" swc_ecma_codegen = { version = "0.129.15", path = "../swc_ecma_codegen" } swc_ecma_parser = { version = "0.124.12", path = "../swc_ecma_parser" } swc_ecma_transforms_testing = { version = "0.119.14", path = "../swc_ecma_transforms_testing" } diff --git a/crates/swc_ecma_transforms_testing/Cargo.toml b/crates/swc_ecma_transforms_testing/Cargo.toml index 077d5f319ce9..a926cdedfb79 100644 --- a/crates/swc_ecma_transforms_testing/Cargo.toml +++ b/crates/swc_ecma_transforms_testing/Cargo.toml @@ -19,7 +19,7 @@ hex = "0.4.3" serde = "1" serde_json = "1" sha-1 = "0.10" -sourcemap = "6.2.2" +sourcemap = "6" swc_common = { version = "0.29.32", path = "../swc_common", features = [ "sourcemap", ] }