Skip to content

Commit

Permalink
refactor(es/parser): Remove import_assertions from TsConfig (#2950)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed Dec 5, 2021
1 parent 74363e0 commit 97df4ce
Show file tree
Hide file tree
Showing 10 changed files with 2 additions and 17 deletions.
1 change: 0 additions & 1 deletion crates/swc/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1503,7 +1503,6 @@ impl Merge for swc_ecma_parser::TsConfig {
self.tsx |= from.tsx;
self.decorators |= from.decorators;
self.dynamic_import |= from.dynamic_import;
self.import_assertions |= from.import_assertions;
}
}

Expand Down
3 changes: 1 addition & 2 deletions crates/swc/tests/fixture/issue-2086/input/.swcrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"parser": {
"syntax": "typescript",
"dynamicImport": true,
"decorators": true,
"importAssertions": true
"decorators": true
},
"transform": {
"legacyDecorator": true,
Expand Down
1 change: 0 additions & 1 deletion crates/swc/tests/rust_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ fn shopify_2_same_opt() {
dynamic_import: true,
dts: false,
no_early_errors: false,
import_assertions: false,
})),
transform: None,
external_helpers: false,
Expand Down
1 change: 0 additions & 1 deletion crates/swc/tests/tsc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ fn compile(input: &Path, output: &Path, opts: Options) {
dynamic_import: true,
dts: false,
no_early_errors: true,
import_assertions: false,
})),
..opts.config.jsc
},
Expand Down
1 change: 0 additions & 1 deletion crates/swc_ecma_dep_graph/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ mod tests {
dynamic_import: true,
decorators: true,
no_early_errors: true,
import_assertions: true,
..Default::default()
}),
EsVersion::Es2015,
Expand Down
8 changes: 1 addition & 7 deletions crates/swc_ecma_parser/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,8 @@ impl Syntax {
match self {
Syntax::Es(EsConfig {
import_assertions, ..
})
| Syntax::Typescript(TsConfig {
import_assertions, ..
}) => import_assertions,
Syntax::Typescript(_) => true,
}
}

Expand Down Expand Up @@ -314,10 +312,6 @@ pub struct TsConfig {

#[serde(skip, default)]
pub no_early_errors: bool,

/// Stage 3.
#[serde(default)]
pub import_assertions: bool,
}

#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize)]
Expand Down
1 change: 0 additions & 1 deletion crates/swc_ecma_parser/tests/comments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ fn test(input: PathBuf) {
decorators: true,
dynamic_import: true,
no_early_errors: true,
import_assertions: true,
..Default::default()
}),
_ => {
Expand Down
1 change: 0 additions & 1 deletion crates/swc_ecma_parser/tests/typescript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ where
tsx: fname.contains("tsx"),
dynamic_import: true,
decorators: true,
import_assertions: true,
no_early_errors,
..Default::default()
}),
Expand Down
1 change: 0 additions & 1 deletion crates/swc_ecma_transforms_base/tests/ts_resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ fn no_empty(input: PathBuf) {
decorators: true,
dynamic_import: true,
no_early_errors: true,
import_assertions: true,
..Default::default()
}),
EsVersion::latest(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ fn identity(entry: PathBuf) {
dynamic_import: true,
dts: false,
no_early_errors: false,
import_assertions: true,
}),
(&*src).into(),
None,
Expand Down

1 comment on commit 97df4ce

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: 97df4ce Previous: 74363e0 Ratio
full_es2015 197468640 ns/iter (± 17309490) 222252788 ns/iter (± 10871662) 0.89
full_es2016 164838987 ns/iter (± 11726509) 174465206 ns/iter (± 9218632) 0.94
full_es2017 168755077 ns/iter (± 12257484) 183503415 ns/iter (± 10695121) 0.92
full_es2018 174535234 ns/iter (± 8643213) 183564262 ns/iter (± 11168250) 0.95
full_es2019 165998400 ns/iter (± 11967320) 181819311 ns/iter (± 11405267) 0.91
full_es2020 165720765 ns/iter (± 13608234) 180775391 ns/iter (± 13298522) 0.92
full_es3 235522588 ns/iter (± 28886874) 256066005 ns/iter (± 22110344) 0.92
full_es5 215820384 ns/iter (± 22954311) 236256734 ns/iter (± 25517941) 0.91
parser 775394 ns/iter (± 70709) 883562 ns/iter (± 183680) 0.88

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.