From 4e9c71c06d31b79c3b82d7c56daeed6563d11900 Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Date: Mon, 24 Jun 2024 11:27:38 +0200 Subject: [PATCH 1/4] Cargo dev_dependencies was renamed --- crates/parcel_config/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/parcel_config/Cargo.toml b/crates/parcel_config/Cargo.toml index 6283b9841d3..c6894b879eb 100644 --- a/crates/parcel_config/Cargo.toml +++ b/crates/parcel_config/Cargo.toml @@ -19,5 +19,5 @@ serde = { version = "1.0.123", features = ["derive", "rc"] } serde_json5 = "0.1.0" thiserror = "1.0.59" -[dev_dependencies] +[dev-dependencies] mockall = "0.12.1" From 905b196cecce18fe6b42201f59b864665b7de006 Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Date: Mon, 24 Jun 2024 11:28:01 +0200 Subject: [PATCH 2/4] Bump swc --- Cargo.lock | 126 ++++++++++-------- crates/macros/Cargo.toml | 2 +- .../parcel_plugin_transformer_js/Cargo.toml | 4 +- packages/transformers/js/core/Cargo.toml | 4 +- 4 files changed, 74 insertions(+), 62 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a3823eda74e..580e516e7b5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2854,6 +2854,17 @@ dependencies = [ "digest", ] +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha2" version = "0.10.8" @@ -3098,9 +3109,9 @@ dependencies = [ [[package]] name = "swc_common" -version = "0.33.26" +version = "0.34.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2f9706038906e66f3919028f9f7a37f3ed552f1b85578e93f4468742e2da438" +checksum = "2b0d7bcbd9faf61cec1a552cbdaec57faefbb10be7cc5f959613c6f91b5a9254" dependencies = [ "ahash", "ast_node", @@ -3151,9 +3162,9 @@ dependencies = [ [[package]] name = "swc_core" -version = "0.92.9" +version = "0.95.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dc177a38a11913076a8dc415a0dd2c7a5ca13c10c0a7633f1f81655aa8836fe" +checksum = "f4a4e72f0ba02942e8c8973708c024e822362c7af874bea05de8cf263fb02f58" dependencies = [ "swc_atoms", "swc_common", @@ -3174,9 +3185,9 @@ dependencies = [ [[package]] name = "swc_ecma_ast" -version = "0.113.6" +version = "0.115.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ae3fb68e165bb093ea05fe68dfbc5d378c8b41515a5160f733d7b45bfb9d96e" +checksum = "7be1306930c235435a892104c00c2b5e16231043c085d5a10bd3e7537b15659b" dependencies = [ "bitflags 2.5.0", "is-macro", @@ -3191,9 +3202,9 @@ dependencies = [ [[package]] name = "swc_ecma_codegen" -version = "0.149.2" +version = "0.151.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ab6d5e7bbd9208f980b5dad2a4a6ae798c97569f809a48c3f92e6ae7e183c6c" +checksum = "cc6602bcf4fd78b2ef0c7b2abcdbd3e35dfa564a6bcfb0f256e86b41ff3299d7" dependencies = [ "memchr", "num-bigint", @@ -3222,9 +3233,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_bugfixes" -version = "0.5.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47dad0d8b1c4ca3264a8c5ac59a10127e4f1c3ec5ed271692c8897228f306d05" +checksum = "2f8e8697555cf32b8dd18c62637ce804c8c96343a6752d622e12e84fd0cea336" dependencies = [ "swc_atoms", "swc_common", @@ -3239,9 +3250,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_common" -version = "0.5.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d888bcaea9c3b8178ea4abf65adf64457a95a5dd3a3c109a69e02c3c38878e96" +checksum = "0d2f791e974b5dd20a72c50aaf5507a07c6b7c2778711a4b8f62b881b92035b1" dependencies = [ "swc_common", "swc_ecma_ast", @@ -3252,9 +3263,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2015" -version = "0.5.3" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f0d3d5d4637af5195265444b2a708020ee90973008ec50c665dad83dd5f1c70" +checksum = "f0514f6652e4bdb327df10c7a577346fa1f2bea5a416360f12763e4bb15d1794" dependencies = [ "arrayvec", "indexmap 2.2.6", @@ -3278,9 +3289,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2016" -version = "0.5.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d7222c8114ae47fb2e46a65f426b125edab523192e835aecbe3136541f96500" +checksum = "d4a58e0626e1d6f156b6c30a596fcaddf99d7fd2826fed118ee848a6b8339d32" dependencies = [ "swc_atoms", "swc_common", @@ -3295,9 +3306,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2017" -version = "0.5.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ccdc725616ef5a558fb905b991cf328a3a36a4d1b8423173708a02568077a14" +checksum = "e11928d0da6babf2632d9b1580bb5f476f251c3c5a5ce9ceb9f650e4ee5b38fe" dependencies = [ "serde", "swc_atoms", @@ -3313,9 +3324,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2018" -version = "0.5.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a6c329c3980fb20c6c3f7f2afc94975bfe640d53dbb90b74a4707a514f16882" +checksum = "eaee1dbdf5d65fe8149c51298c2065bf94e4b32b922c487deeda3f9033e246d6" dependencies = [ "serde", "swc_atoms", @@ -3332,9 +3343,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2019" -version = "0.5.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1934f5021e80f6b76e5e0bd06e331d719eb9541c13cb5c128a2b994931952a4" +checksum = "2243e1b427495d787fc06966b60ba61e194bcd46646c7ee95a0481674a44f353" dependencies = [ "swc_atoms", "swc_common", @@ -3348,9 +3359,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2020" -version = "0.5.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aeddeba198fef2e0ed2bc4a5a0b412a04063f062dc47f93e191b492fc07db4f" +checksum = "e791d25641ba974d01a1f6f8795244ccb7cb16e916f91b51d72609db6cd94cf3" dependencies = [ "serde", "swc_atoms", @@ -3366,9 +3377,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2021" -version = "0.5.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "288ad7b2cc410dc4fb08687915c1f588f6a714d737e0a4d4128657124902bcae" +checksum = "529b0368f8ada330a928ecf82c6c480eefd51cacd2d6e9f3bdedf9187782f0da" dependencies = [ "swc_atoms", "swc_common", @@ -3382,9 +3393,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2022" -version = "0.5.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d4a8a9fde6f96316e8b0792a72baa209277e0ce3050b476ee3ab408ec579a2d" +checksum = "0fb64c1ee316e05823b6b698d44017848241626f1e11eaf394a642bc99d4d4cd" dependencies = [ "swc_atoms", "swc_common", @@ -3401,9 +3412,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es3" -version = "0.5.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc88d41bf1d86c163997a48b10ad47a40d2d0c8b9c6ee03ead151d0022975789" +checksum = "b1de9acee5e6867cb91460a48a2cc0900db01fdd90112cdd4c74defc7dcd4577" dependencies = [ "swc_common", "swc_ecma_ast", @@ -3416,11 +3427,12 @@ dependencies = [ [[package]] name = "swc_ecma_parser" -version = "0.144.1" +version = "0.146.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0499e69683ae5d67a20ff0279b94bc90f29df7922a46331b54d5dd367bf89570" +checksum = "169cd7a18ed5e73346f38d5a6123c6427f04b9dffe5cce468e8d70530cc4adcb" dependencies = [ "either", + "memchr", "new_debug_unreachable", "num-bigint", "num-traits", @@ -3438,9 +3450,9 @@ dependencies = [ [[package]] name = "swc_ecma_preset_env" -version = "0.207.1" +version = "0.209.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5969314bf66a4cca45b0401689dd0c74e568c69243ce46f2342d59219e1283c" +checksum = "2e9a4cc2b1deb679c15be85f77d0f4bca75404c5964c786761a056e1a4cfe828" dependencies = [ "anyhow", "dashmap", @@ -3463,9 +3475,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms" -version = "0.230.1" +version = "0.232.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b37b4301415b83165109b94c99f9ac62b38fd1da625bfc830883d65d29a473f9" +checksum = "6e8e66bc10715c10219239772abd2f6be99eda573e69e5abb8646b1f3fce83dc" dependencies = [ "swc_atoms", "swc_common", @@ -3479,9 +3491,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_base" -version = "0.138.3" +version = "0.140.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f38c6d12c8fd704cee66d93038dae2ceb26df18229166d2bdc1ebbb4854d3b36" +checksum = "daee7af0abfccc9855656fc36ac472e1e6a61398a3a1a1b3bf05ef7a7e7af6b0" dependencies = [ "better_scoped_tls", "bitflags 2.5.0", @@ -3502,9 +3514,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_classes" -version = "0.127.1" +version = "0.129.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53043d81678f3c693604eeb1d1f0fe6ba10f303104a31b954dbeebed9cadf530" +checksum = "a3eab5f8179e5b0aedf385eacc2c033691c6d211a7babd1bbbff12cf794a824e" dependencies = [ "swc_atoms", "swc_common", @@ -3516,9 +3528,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_compat" -version = "0.164.1" +version = "0.166.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d4e2942c5d8b7afdf81b8d1eec2f4a961aa9fc89ab05ebe5cbd0f6066b60afc" +checksum = "9e03c5afd68b80591a3871ac3692f3adaf281c0c3c686db51a73ed91270d6f4c" dependencies = [ "arrayvec", "indexmap 2.2.6", @@ -3564,9 +3576,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_optimization" -version = "0.199.2" +version = "0.201.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25982d69c91cd64cbfae714d9e953810b3f2835486d08108967cbd15016e7720" +checksum = "c58577833f2a748ce4f8d934b59e528cc2391c43dc716040b15952ce7a1afae6" dependencies = [ "dashmap", "indexmap 2.2.6", @@ -3588,9 +3600,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_proposal" -version = "0.172.3" +version = "0.174.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fbc414d6a9c5479cfb4c6e92fcdac504582bd7bc89a0ed7f8808b72dc8bd1f0" +checksum = "5db0e71b7a87c4fcddec835e6717854849ab8bba9c9f6332858f6c8b66c1ad9f" dependencies = [ "either", "rustc-hash", @@ -3608,16 +3620,16 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_react" -version = "0.184.1" +version = "0.186.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "565a76c4ca47ce31d78301c0beab878e4c2cb4f624691254d834ec8c0e236755" +checksum = "bf43b55128241b30e39ebfc5d904351276966d7d0ed6708e76652eac65d2189e" dependencies = [ "base64 0.21.7", "dashmap", "indexmap 2.2.6", "once_cell", "serde", - "sha-1", + "sha1", "string_enum", "swc_atoms", "swc_common", @@ -3632,9 +3644,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_typescript" -version = "0.189.1" +version = "0.191.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e209026c1d3c577cafac257d87e7c0d23119282fbdc8ed03d7f56077e95beb90" +checksum = "ebd0ed356e5e19a7111ac24773439141bd3941eb420a51bfbce762757fc7adc2" dependencies = [ "ryu-js", "serde", @@ -3649,9 +3661,9 @@ dependencies = [ [[package]] name = "swc_ecma_utils" -version = "0.128.3" +version = "0.130.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02f470d8cc31adf6189b228636201ee3cdd268c0b5a2d0407f83093dfa96ff91" +checksum = "831490c6d4a52f06932fa2c3d87fc0d0aa43211a5df6b5e05a1ec2c57a2f2519" dependencies = [ "indexmap 2.2.6", "num_cpus", @@ -3669,9 +3681,9 @@ dependencies = [ [[package]] name = "swc_ecma_visit" -version = "0.99.1" +version = "0.101.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28a6ce28ad8e591f8d627f1f9cb26b25e5d83052a9bc1b674d95fc28040cfa98" +checksum = "ce0d997f0c9b4e181225f603d161f6757c2a97022258170982cfe005ec69ec92" dependencies = [ "num-bigint", "swc_atoms", @@ -3694,9 +3706,9 @@ dependencies = [ [[package]] name = "swc_fast_graph" -version = "0.21.22" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3fdd64bc3d161d6c1ea9a8ae5779e4ba132afc67e7b8ece5420bfc9c6e1275d" +checksum = "c00cf5c1687e9858fb9de1ffa90a3e21369095406e97ace870a389320d105b0a" dependencies = [ "indexmap 2.2.6", "petgraph", diff --git a/crates/macros/Cargo.toml b/crates/macros/Cargo.toml index f7c4675b36e..aa6ffacd939 100644 --- a/crates/macros/Cargo.toml +++ b/crates/macros/Cargo.toml @@ -9,7 +9,7 @@ napi = ["dep:napi", "dep:napi-derive", "dep:crossbeam-channel"] [dependencies] indexmap = "1.9.2" -swc_core = { version = "0.92.4", features = [ +swc_core = { version = "0.95", features = [ "common", "common_ahash", "common_sourcemap", diff --git a/crates/parcel_plugin_transformer_js/Cargo.toml b/crates/parcel_plugin_transformer_js/Cargo.toml index b709c3f96c6..fd33de6a8ed 100644 --- a/crates/parcel_plugin_transformer_js/Cargo.toml +++ b/crates/parcel_plugin_transformer_js/Cargo.toml @@ -8,8 +8,8 @@ description = "JavaScript Transformer Plugin for the Parcel Bundler" parcel_core = { path = "../parcel_core" } anyhow = "1" parcel-js-swc-core = { path = "../../packages/transformers/js/core" } -swc_core = { version = "0.92", features = ["ecma_ast"] } +swc_core = { version = "0.95", features = ["ecma_ast"] } indexmap = "2.2.6" [dev-dependencies] -parcel_filesystem = { path = "../parcel_filesystem" } \ No newline at end of file +parcel_filesystem = { path = "../parcel_filesystem" } diff --git a/packages/transformers/js/core/Cargo.toml b/packages/transformers/js/core/Cargo.toml index 3a79af18dd4..8bbd4275bad 100644 --- a/packages/transformers/js/core/Cargo.toml +++ b/packages/transformers/js/core/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" crate-type = ["rlib"] [dependencies] -swc_core = { version = "0.92.4", features = [ +swc_core = { version = "0.95", features = [ "common", "common_ahash", "common_sourcemap", @@ -37,4 +37,4 @@ pathdiff = "0.2.0" path-slash = "0.1.4" indexmap = "1.9.2" parcel-macros = { path = "../../../../crates/macros" } -parking_lot = "0.12" \ No newline at end of file +parking_lot = "0.12" From fc8364d2ed776045539b303c5e0304f4df56b549 Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Date: Mon, 24 Jun 2024 11:31:05 +0200 Subject: [PATCH 3/4] swc API deprecations --- packages/transformers/js/core/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/transformers/js/core/src/lib.rs b/packages/transformers/js/core/src/lib.rs index 9933eb0f92c..2bab3c3ccd4 100644 --- a/packages/transformers/js/core/src/lib.rs +++ b/packages/transformers/js/core/src/lib.rs @@ -55,11 +55,11 @@ use swc_core::ecma::ast::Program; use swc_core::ecma::codegen::text_writer::JsWriter; use swc_core::ecma::parser::error::Error; use swc_core::ecma::parser::lexer::Lexer; -use swc_core::ecma::parser::EsConfig; +use swc_core::ecma::parser::EsSyntax; use swc_core::ecma::parser::Parser; use swc_core::ecma::parser::StringInput; use swc_core::ecma::parser::Syntax; -use swc_core::ecma::parser::TsConfig; +use swc_core::ecma::parser::TsSyntax; use swc_core::ecma::preset_env::preset_env; use swc_core::ecma::preset_env::Mode::Entry; use swc_core::ecma::preset_env::Targets; @@ -570,13 +570,13 @@ fn parse( let comments = SingleThreadedComments::default(); let syntax = if config.is_type_script { - Syntax::Typescript(TsConfig { + Syntax::Typescript(TsSyntax { tsx: config.is_jsx, decorators: config.decorators, ..Default::default() }) } else { - Syntax::Es(EsConfig { + Syntax::Es(EsSyntax { jsx: config.is_jsx, export_default_from: true, decorators: config.decorators, From b3207337a04b12920a57ce79f52d6bdbc8f993df Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Date: Mon, 24 Jun 2024 11:32:24 +0200 Subject: [PATCH 4/4] Remove unused fields in JS transformer --- packages/transformers/js/core/src/lib.rs | 2 -- packages/transformers/js/core/src/node_replacer.rs | 2 -- 2 files changed, 4 deletions(-) diff --git a/packages/transformers/js/core/src/lib.rs b/packages/transformers/js/core/src/lib.rs index 2bab3c3ccd4..09dde0e742b 100644 --- a/packages/transformers/js/core/src/lib.rs +++ b/packages/transformers/js/core/src/lib.rs @@ -399,10 +399,8 @@ pub fn transform( items: &mut global_deps, global_mark, globals: HashMap::new(), - project_root: Path::new(&config.project_root), filename: Path::new(&config.filename), unresolved_mark, - scope_hoist: config.scope_hoist, has_node_replacements: &mut result.has_node_replacements, }, config.node_replacer, diff --git a/packages/transformers/js/core/src/node_replacer.rs b/packages/transformers/js/core/src/node_replacer.rs index 36aa06d20e2..9a3e7078cd9 100644 --- a/packages/transformers/js/core/src/node_replacer.rs +++ b/packages/transformers/js/core/src/node_replacer.rs @@ -25,10 +25,8 @@ pub struct NodeReplacer<'a> { pub items: &'a mut Vec, pub global_mark: Mark, pub globals: HashMap, - pub project_root: &'a Path, pub filename: &'a Path, pub unresolved_mark: Mark, - pub scope_hoist: bool, pub has_node_replacements: &'a mut bool, }