Skip to content

Commit 321441a

Browse files
committed
Replace with oxc
1 parent e41c0ac commit 321441a

File tree

113 files changed

+29279
-1504
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+29279
-1504
lines changed

Cargo.lock

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/swc_ecma_compat_common/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ version = "24.0.0"
1414
[dependencies]
1515
swc_common = { version = "17.0.1", path = "../swc_common" }
1616
swc_ecma_ast = { version = "18.0.0", path = "../swc_ecma_ast" }
17+
swc_ecma_compiler = { version = "8.0.0", path = "../swc_ecma_compiler" }
1718
swc_ecma_utils = { version = "24.0.0", path = "../swc_ecma_utils" }
1819
swc_ecma_visit = { version = "18.0.1", path = "../swc_ecma_visit" }

crates/swc_ecma_compat_common/src/regexp.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
11
use swc_common::util::take::Take;
22
use swc_ecma_ast::{CallExpr, Expr, Lit, Pass, Regex};
3+
use swc_ecma_compiler::compat::{CompatCompiler, TransformOptions};
34
use swc_ecma_utils::{quote_ident, ExprFactory};
45
use swc_ecma_visit::{noop_visit_mut_type, visit_mut_pass, VisitMut, VisitMutWith};
56

67
pub fn regexp(config: Config) -> impl Pass {
7-
visit_mut_pass(RegExp { config })
8+
let mut transform_options = TransformOptions::default();
9+
10+
transform_options.env.regexp.dot_all_flag = config.dot_all_regex;
11+
transform_options.env.regexp.match_indices = config.has_indices;
12+
transform_options.env.regexp.look_behind_assertions = config.lookbehind_assertion;
13+
transform_options.env.regexp.named_capture_groups = config.named_capturing_groups_regex;
14+
transform_options.env.regexp.sticky_flag = config.sticky_regex;
15+
transform_options.env.regexp.unicode_property_escapes = config.unicode_property_regex;
16+
transform_options.env.regexp.unicode_flag = config.unicode_regex;
17+
transform_options.env.regexp.set_notation = config.unicode_sets_regex;
18+
19+
visit_mut_pass(CompatCompiler::new(&transform_options))
820
}
921

1022
#[derive(Default, Clone, Copy)]

crates/swc_ecma_compiler/Cargo.toml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,22 @@ version = "8.0.0"
1313
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(swc_ast_unknown)'] }
1414

1515
[dependencies]
16-
bitflags = { workspace = true }
17-
rustc-hash = { workspace = true }
18-
tracing = { workspace = true }
16+
bitflags = { workspace = true }
17+
indexmap = { workspace = true }
18+
itoa = "1"
19+
memchr = { workspace = true }
20+
rustc-hash = { workspace = true }
21+
serde = { workspace = true }
22+
serde_json = { workspace = true }
23+
tracing = { workspace = true }
1924

2025
swc_atoms = { version = "9.0.0", path = "../swc_atoms" }
2126
swc_common = { version = "17.0.1", path = "../swc_common" }
2227
swc_ecma_ast = { version = "18.0.0", path = "../swc_ecma_ast" }
28+
swc_ecma_hooks = { version = "0.1.0", path = "../swc_ecma_hooks" }
29+
swc_ecma_regexp = { version = "0.6.0", path = "../swc_ecma_regexp" }
30+
swc_ecma_regexp_ast = { version = "0.6.0", path = "../swc_ecma_regexp_ast" }
31+
swc_ecma_regexp_visit = { version = "0.6.0", path = "../swc_ecma_regexp_visit" }
2332
swc_ecma_transforms_base = { version = "30.0.0", path = "../swc_ecma_transforms_base" }
2433
swc_ecma_utils = { version = "24.0.0", path = "../swc_ecma_utils" }
2534
swc_ecma_visit = { version = "18.0.1", path = "../swc_ecma_visit" }

0 commit comments

Comments
 (0)