Skip to content

Commit 2b292e6

Browse files
authored
feat(es): Support type-only import/export specifiers (#2309)
1 parent b206404 commit 2b292e6

File tree

183 files changed

+2816
-739
lines changed

Some content is hidden

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

183 files changed

+2816
-739
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ edition = "2018"
2020
license = "Apache-2.0/MIT"
2121
name = "swc"
2222
repository = "https://github.com/swc-project/swc.git"
23-
version = "0.58.0"
23+
version = "0.59.0"
2424

2525
[lib]
2626
name = "swc"
@@ -52,27 +52,27 @@ serde = {version = "1", features = ["derive"]}
5252
serde_json = "1"
5353
sourcemap = "6"
5454
swc_atoms = {version = "0.2", path = "./atoms"}
55-
swc_bundler = {version = "0.61.0", path = "./bundler"}
55+
swc_bundler = {version = "0.62.0", path = "./bundler"}
5656
swc_common = {version = "0.13.0", path = "./common", features = ["sourcemap", "concurrent"]}
57-
swc_ecma_ast = {version = "0.53.0", path = "./ecmascript/ast"}
58-
swc_ecma_codegen = {version = "0.72.0", path = "./ecmascript/codegen"}
59-
swc_ecma_ext_transforms = {version = "0.30.0", path = "./ecmascript/ext-transforms"}
60-
swc_ecma_loader = {version = "0.19.0", path = "./ecmascript/loader", features = ["lru", "node", "tsc"]}
61-
swc_ecma_minifier = {version = "0.30.0", path = "./ecmascript/minifier"}
62-
swc_ecma_parser = {version = "0.72.0", path = "./ecmascript/parser"}
63-
swc_ecma_preset_env = {version = "0.45.0", path = "./ecmascript/preset-env"}
64-
swc_ecma_transforms = {version = "0.74.0", path = "./ecmascript/transforms", features = [
57+
swc_ecma_ast = {version = "0.54.0", path = "./ecmascript/ast"}
58+
swc_ecma_codegen = {version = "0.73.0", path = "./ecmascript/codegen"}
59+
swc_ecma_ext_transforms = {version = "0.31.0", path = "./ecmascript/ext-transforms"}
60+
swc_ecma_loader = {version = "0.20.0", path = "./ecmascript/loader", features = ["lru", "node", "tsc"]}
61+
swc_ecma_minifier = {version = "0.31.0", path = "./ecmascript/minifier"}
62+
swc_ecma_parser = {version = "0.73.0", path = "./ecmascript/parser"}
63+
swc_ecma_preset_env = {version = "0.46.0", path = "./ecmascript/preset-env"}
64+
swc_ecma_transforms = {version = "0.75.0", path = "./ecmascript/transforms", features = [
6565
"compat",
6666
"module",
6767
"optimization",
6868
"proposal",
6969
"react",
7070
"typescript",
7171
]}
72-
swc_ecma_transforms_base = {version = "0.33.0", path = "./ecmascript/transforms/base"}
73-
swc_ecma_utils = {version = "0.45.0", path = "./ecmascript/utils"}
74-
swc_ecma_visit = {version = "0.39.0", path = "./ecmascript/visit"}
75-
swc_ecmascript = {version = "0.66.0", path = "./ecmascript"}
72+
swc_ecma_transforms_base = {version = "0.34.0", path = "./ecmascript/transforms/base"}
73+
swc_ecma_utils = {version = "0.46.0", path = "./ecmascript/utils"}
74+
swc_ecma_visit = {version = "0.40.0", path = "./ecmascript/visit"}
75+
swc_ecmascript = {version = "0.67.0", path = "./ecmascript"}
7676
swc_visit = {version = "0.2.3", path = "./visit"}
7777
tracing = "0.1.28"
7878

bundler/Cargo.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ include = ["Cargo.toml", "build.rs", "src/**/*.rs", "src/**/*.js"]
99
license = "Apache-2.0/MIT"
1010
name = "swc_bundler"
1111
repository = "https://github.com/swc-project/swc.git"
12-
version = "0.61.0"
12+
version = "0.62.0"
1313

1414
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1515
[features]
@@ -32,21 +32,21 @@ retain_mut = "0.1.2"
3232
rustc-hash = "1.1.0"
3333
swc_atoms = {version = "0.2.4", path = "../atoms"}
3434
swc_common = {version = "0.13.0", path = "../common"}
35-
swc_ecma_ast = {version = "0.53.0", path = "../ecmascript/ast"}
36-
swc_ecma_codegen = {version = "0.72.0", path = "../ecmascript/codegen"}
37-
swc_ecma_loader = {version = "0.19.0", path = "../ecmascript/loader"}
38-
swc_ecma_parser = {version = "0.72.0", path = "../ecmascript/parser"}
39-
swc_ecma_transforms = {version = "0.74.0", path = "../ecmascript/transforms", features = ["optimization"]}
40-
swc_ecma_utils = {version = "0.45.0", path = "../ecmascript/utils"}
41-
swc_ecma_visit = {version = "0.39.0", path = "../ecmascript/visit"}
35+
swc_ecma_ast = {version = "0.54.0", path = "../ecmascript/ast"}
36+
swc_ecma_codegen = {version = "0.73.0", path = "../ecmascript/codegen"}
37+
swc_ecma_loader = {version = "0.20.0", path = "../ecmascript/loader"}
38+
swc_ecma_parser = {version = "0.73.0", path = "../ecmascript/parser"}
39+
swc_ecma_transforms = {version = "0.75.0", path = "../ecmascript/transforms", features = ["optimization"]}
40+
swc_ecma_utils = {version = "0.46.0", path = "../ecmascript/utils"}
41+
swc_ecma_visit = {version = "0.40.0", path = "../ecmascript/visit"}
4242
tracing = "0.1.28"
4343

4444
[dev-dependencies]
4545
hex = "0.4"
4646
ntest = "0.7.2"
4747
reqwest = {version = "0.11.4", features = ["blocking"]}
4848
sha-1 = "0.9"
49-
swc_ecma_transforms = {version = "0.74.0", path = "../ecmascript/transforms", features = ["react", "typescript"]}
49+
swc_ecma_transforms = {version = "0.75.0", path = "../ecmascript/transforms", features = ["react", "typescript"]}
5050
tempfile = "3.1.0"
5151
testing = {version = "0.14.0", path = "../testing"}
5252
url = "2.1.1"

bundler/src/bundler/chunk/computed_key.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ where
7171
span: DUMMY_SP,
7272
orig: orig.clone(),
7373
exported: Some(exported.clone()),
74+
is_type_only: false,
7475
});
7576
addtional_items.push((
7677
module_id,

bundler/src/bundler/chunk/merge.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,7 @@ where
739739
span: DUMMY_SP,
740740
orig: local,
741741
exported: Some(exported),
742+
is_type_only: false,
742743
});
743744
extra.push(ModuleItem::ModuleDecl(ModuleDecl::ExportNamed(
744745
NamedExport {
@@ -785,6 +786,7 @@ where
785786
span: DUMMY_SP,
786787
orig: local,
787788
exported: Some(exported),
789+
is_type_only: false,
788790
});
789791
tracing::trace!("Exporting `default` with `export default expr`");
790792
extra.push(ModuleItem::ModuleDecl(ModuleDecl::ExportNamed(
@@ -851,6 +853,7 @@ where
851853
span: DUMMY_SP,
852854
orig: id,
853855
exported: Some(exported),
856+
is_type_only: false,
854857
}
855858
})
856859
.map(ExportSpecifier::Named)
@@ -889,6 +892,7 @@ where
889892
span: DUMMY_SP,
890893
orig: local,
891894
exported: Some(exported),
895+
is_type_only: false,
892896
});
893897

894898
extra.push(ModuleItem::ModuleDecl(ModuleDecl::ExportNamed(
@@ -1053,6 +1057,7 @@ where
10531057
span: ns.span,
10541058
orig: module_var.into(),
10551059
exported: Some(ns.name.clone()),
1060+
is_type_only: false,
10561061
});
10571062
extra.push(ModuleItem::ModuleDecl(
10581063
ModuleDecl::ExportNamed(NamedExport {

bundler/src/bundler/import/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,7 @@ where
475475
span: DUMMY_SP,
476476
local: Ident::new(id.0, DUMMY_SP.with_ctxt(id.1)),
477477
imported: None,
478+
is_type_only: false,
478479
})
479480
})
480481
.collect();
@@ -634,6 +635,7 @@ where
634635
span,
635636
local: ident,
636637
imported: None,
638+
is_type_only: false,
637639
})
638640
})
639641
.collect(),

0 commit comments

Comments
 (0)