Skip to content

Commit 4fd617c

Browse files
committed
Use it
1 parent 83cc83c commit 4fd617c

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

Cargo.lock

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

crates/swc_ecma_compat_es2020/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ swc_common = { version = "17.0.1", path = "../swc_common" }
2323
swc_ecma_ast = { version = "18.0.0", path = "../swc_ecma_ast" }
2424
swc_ecma_compat_es2022 = { version = "31.0.0", path = "../swc_ecma_compat_es2022" }
2525
swc_ecma_compiler = { version = "8.0.0", path = "../swc_ecma_compiler" }
26+
swc_ecma_transformer = { version = "0.1.0", path = "../swc_ecma_transformer" }
2627
swc_ecma_transforms_base = { version = "30.0.0", path = "../swc_ecma_transforms_base" }
2728
swc_ecma_utils = { version = "24.0.0", path = "../swc_ecma_utils" }
2829
swc_ecma_visit = { version = "18.0.1", path = "../swc_ecma_visit" }
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
use swc_ecma_ast::Pass;
2-
use swc_ecma_compiler::{Compiler, Features};
32

43
pub fn export_namespace_from() -> impl Pass {
5-
Compiler::new(swc_ecma_compiler::Config {
6-
includes: Features::EXPORT_NAMESPACE_FROM,
7-
..Default::default()
8-
})
4+
let mut options = swc_ecma_transformer::Options::default();
5+
options.env.es2020.export_namespace_from = true;
6+
options.into_pass()
97
}

crates/swc_ecma_preset_env/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,10 @@ where
156156
pass,
157157
/* ES2022 */ | PrivatePropertyInObject
158158
/* ES2021 */ | LogicalAssignmentOperators
159-
/* ES2020 */ | ExportNamespaceFrom
160159
);
160+
if !caniuse(Feature::ExportNamespaceFrom) {
161+
options.env.es2020.export_namespace_from = true;
162+
}
161163

162164
// ES2020
163165
let pass = add!(

0 commit comments

Comments
 (0)