From 8f0c67f9b54e5b95388bdccaccdd75257b956b01 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 4 Dec 2025 03:57:47 +0000 Subject: [PATCH 1/2] chore(deps): update rust crate swc_ecma_parser to v29 --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0953bd6..117b701 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1267,9 +1267,9 @@ dependencies = [ [[package]] name = "swc_common" -version = "18.0.0" +version = "18.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd86b909e39cba2b3d9ab898d3fb3a912e3b9b809919394fca6fbf1ab970a8b8" +checksum = "a1c06698254e9b47daaf9bbb062af489a350bd8d10dfaab0cabbd32d46cec69d" dependencies = [ "anyhow", "ast_node", @@ -1311,9 +1311,9 @@ dependencies = [ [[package]] name = "swc_ecma_parser" -version = "28.0.0" +version = "29.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "495a29bd31c957a2116096a741bc6f4289c49de568706987c29452e0f8f6423c" +checksum = "0c2c1a432a5fa26e01db57a272aea12c4682fe882796418d30ca47fdf7b7ceec" dependencies = [ "bitflags", "either", diff --git a/Cargo.toml b/Cargo.toml index b898eaa..8508963 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,7 @@ doctest = false [dependencies] oxc = "0.101.0" -swc_ecma_parser = { version = "28.0.0", features = ["typescript"] } +swc_ecma_parser = { version = "29.0.0", features = ["typescript"] } swc_ecma_ast = "19.0.0" # biome_js_parser = "0.5.6" From 13faa7ffe34c3586a203cbf5818e5f76b9f472cc Mon Sep 17 00:00:00 2001 From: Boshen Date: Thu, 4 Dec 2025 14:22:35 +0800 Subject: [PATCH 2/2] fix --- Cargo.lock | 1 + Cargo.toml | 1 + src/lib.rs | 5 +++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 117b701..e67da5c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -76,6 +76,7 @@ dependencies = [ "num_cpus", "oxc", "rayon", + "swc_common", "swc_ecma_ast", "swc_ecma_parser", ] diff --git a/Cargo.toml b/Cargo.toml index 8508963..6a56c5c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,6 +31,7 @@ oxc = "0.101.0" swc_ecma_parser = { version = "29.0.0", features = ["typescript"] } swc_ecma_ast = "19.0.0" +swc_common = "18.0.1" # biome_js_parser = "0.5.6" # biome_js_syntax = "0.5.6" diff --git a/src/lib.rs b/src/lib.rs index 591c23b..ca50235 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -14,6 +14,7 @@ pub mod oxc { pub mod swc { use std::path::Path; + use swc_common::BytePos; use swc_ecma_ast::Module; use swc_ecma_parser::{EsSyntax, Parser, StringInput, Syntax, TsSyntax}; @@ -24,9 +25,9 @@ pub mod swc { tsx: true, ..TsSyntax::default() }), - _ => panic!("need to define syntax for swc"), + _ => panic!("need to define syntax for swc"), }; - let input = StringInput::new(source, Default::default(), Default::default()); + let input = StringInput::new(source, BytePos(0), BytePos(source.len() as u32)); Parser::new(syntax, input, None).parse_module().unwrap() } }