Skip to content

Commit e359fd3

Browse files
authored
Merge branch 'main' into fix/array-pat-opt
2 parents 0d5c575 + 0406178 commit e359fd3

40 files changed

+385
-2623
lines changed

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
- **(ci)** Fix CI of `peff ([#9216](https://github.com/swc-project/swc/issues/9216)) ([602e0e5](https://github.com/swc-project/swc/commit/602e0e5aa14ecb3a7bc20bfe77aac2badaa54bb2))
1212

1313

14+
- **(es/codegen)** Fix codegen of large numeric literals ([#9226](https://github.com/swc-project/swc/issues/9226)) ([fba79e6](https://github.com/swc-project/swc/commit/fba79e6f03da69a6ae721eabe4afeaaedc301816))
15+
16+
1417
- **(es/compat)** Consider only the variables used in the closure ([#9151](https://github.com/swc-project/swc/issues/9151)) ([1357531](https://github.com/swc-project/swc/commit/1357531805d529b11848b02d1b59c010a02d272d))
1518

1619

@@ -56,6 +59,9 @@
5659
- **(allocator)** Implement `SwcAlloc` ([#9232](https://github.com/swc-project/swc/issues/9232)) ([e343eb6](https://github.com/swc-project/swc/commit/e343eb6de2747086f9873c6444964500e40b4936))
5760

5861

62+
- **(allocator)** Add a cargo feature ([#9239](https://github.com/swc-project/swc/issues/9239)) ([398dc21](https://github.com/swc-project/swc/commit/398dc21e073d8271fa7ac4169b93ed8b96645459))
63+
64+
5965
- **(es/typescript)** Add `transform` mode back to fast TS strip ([#9237](https://github.com/swc-project/swc/issues/9237)) ([8231e3c](https://github.com/swc-project/swc/commit/8231e3cd4f72ad120735f6a21d9616e98d61eed1))
6066

6167

@@ -74,6 +80,9 @@
7480

7581

7682

83+
- **(allocator)** Drop `scoped_tls` ([#9240](https://github.com/swc-project/swc/issues/9240)) ([4ce2514](https://github.com/swc-project/swc/commit/4ce2514d1bbf1be3972cd620c3a5f6ffd25ffa9d))
84+
85+
7786
- **(bindings)** Invert Wasm size shrink ([#9224](https://github.com/swc-project/swc/issues/9224)) ([aa7f791](https://github.com/swc-project/swc/commit/aa7f791dfdba5845c4253a4014d9bc210e5fb817))
7887

7988

Cargo.lock

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Also, SWC tries to ensure that
4646
4747
for rust users.
4848

49-
MSRV of crates is currently `1.71`.
49+
MSRV of crates is currently `1.73`.
5050

5151
To update all SWC crates you use, you can run `curl https://raw.githubusercontent.com/swc-project/swc/main/scripts/update-all-swc-crates.sh | bash -s`. This script will update all dependencies to the latest version and run `cargo build` to ensure that everything works.
5252
Note that you need

bindings/Cargo.lock

+5-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindings/binding_typescript_wasm/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ serde-wasm-bindgen = "0.4.5"
2222
serde_json = "1.0.120"
2323
swc_common = "0.35.0"
2424
swc_error_reporters = "0.19.0"
25-
swc_fast_ts_strip = "0.2.0"
25+
swc_fast_ts_strip = "0.2.1"
2626
tracing = { version = "0.1.37", features = ["max_level_off"] }
2727
wasm-bindgen = { version = "0.2.82", features = ["enable-interning"] }
2828
wasm-bindgen-futures = { version = "0.4.41" }

bindings/binding_typescript_wasm/__tests__/__snapshots__/transform.js.snap

+51-19
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,82 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`transform in strip-only mode should remove declare enum 1`] = `" "`;
3+
exports[`transform in strip-only mode should remove declare enum 1`] = `
4+
{
5+
"code": " ",
6+
"map": undefined,
7+
}
8+
`;
49

510
exports[`transform in strip-only mode should remove declare enum 2`] = `
6-
"
11+
{
12+
"code": "
713
8-
"
14+
",
15+
"map": undefined,
16+
}
917
`;
1018

1119
exports[`transform in strip-only mode should remove declare enum 3`] = `
12-
"
20+
{
21+
"code": "
1322
1423
15-
"
24+
",
25+
"map": undefined,
26+
}
1627
`;
1728

1829
exports[`transform in strip-only mode should strip complex expressions 1`] = `
19-
"const foo = {
30+
{
31+
"code": "const foo = {
2032
foo: 1 ,
2133
bar: "bar" ,
2234
} ;
23-
const bar = "bar";"
35+
const bar = "bar";",
36+
"map": undefined,
37+
}
2438
`;
2539

2640
exports[`transform in strip-only mode should strip nonnull assertions 1`] = `
27-
"const foo = 1 ;
28-
const bar = "bar";"
41+
{
42+
"code": "const foo = 1 ;
43+
const bar = "bar";",
44+
"map": undefined,
45+
}
2946
`;
3047

3148
exports[`transform in strip-only mode should strip satisfies 1`] = `
32-
"const foo = 1 ;
33-
const bar = "bar";"
49+
{
50+
"code": "const foo = 1 ;
51+
const bar = "bar";",
52+
"map": undefined,
53+
}
3454
`;
3555

3656
exports[`transform in strip-only mode should strip type annotations 1`] = `
37-
"const foo = 1;
38-
const bar = "bar";"
57+
{
58+
"code": "const foo = 1;
59+
const bar = "bar";",
60+
"map": undefined,
61+
}
3962
`;
4063

4164
exports[`transform in strip-only mode should strip type assertions 1`] = `
42-
"const foo = 1 ;
43-
const bar = "bar";"
65+
{
66+
"code": "const foo = 1 ;
67+
const bar = "bar";",
68+
"map": undefined,
69+
}
4470
`;
4571

4672
exports[`transform in strip-only mode should strip type declarations 1`] = `
47-
"const foo = 1;
73+
{
74+
"code": "const foo = 1;
4875
4976
50-
const bar = "bar";"
77+
const bar = "bar";",
78+
"map": undefined,
79+
}
5180
`;
5281

5382
exports[`transform in strip-only mode should throw an error when it encounters a module 1`] = `
@@ -78,8 +107,11 @@ exports[`transform in strip-only mode should throw an error when it encounters a
78107
`;
79108

80109
exports[`transform should strip types 1`] = `
81-
"
110+
{
111+
"code": "
82112
export const foo = 1;
83113
84-
"
114+
",
115+
"map": undefined,
116+
}
85117
`;

bindings/binding_typescript_wasm/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use anyhow::Error;
22
use swc_common::{errors::ColorConfig, sync::Lrc, SourceMap, GLOBALS};
33
use swc_error_reporters::handler::{try_with_handler, HandlerOpts};
4-
use swc_fast_ts_strip::Options;
4+
use swc_fast_ts_strip::{Options, TransformOutput};
55
use wasm_bindgen::prelude::*;
66
use wasm_bindgen_futures::{
77
future_to_promise,
@@ -34,7 +34,7 @@ pub fn transform_sync(input: JsString, options: JsValue) -> Result<JsValue, JsVa
3434
Ok(serde_wasm_bindgen::to_value(&result)?)
3535
}
3636

37-
fn operate(input: String, options: Options) -> Result<String, Error> {
37+
fn operate(input: String, options: Options) -> Result<TransformOutput, Error> {
3838
let cm = Lrc::new(SourceMap::default());
3939

4040
try_with_handler(

clippy.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ ignore-interior-mutability = [
2222
"swc_atoms::JsWord",
2323
"swc_ecma_ast::Id",
2424
]
25-
msrv = "1.71"
25+
msrv = "1.73"
2626
type-complexity-threshold = 25000
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"jsc": {
3+
"parser": {
4+
"syntax": "typescript",
5+
"tsx": false
6+
},
7+
"target": "es2022",
8+
"loose": false,
9+
"minify": {
10+
"compress": false,
11+
"mangle": false
12+
}
13+
},
14+
"module": {
15+
"type": "es6"
16+
},
17+
"minify": false,
18+
"isModule": true
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
const x = -1e999;
2+
const y = 1e999;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
const x = -1e999;
2+
const y = 1e999;

crates/swc/tests/tsc-references/binaryIntegerLiteral.1.normal.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)