Skip to content

Commit f9bdc7b

Browse files
authored
fix(es/parser): Fix panic on debug mode (#1828)
swc_ecma_parser: - Handle undefined unicode code point gracefully. (#1813)
1 parent b5a7a3f commit f9bdc7b

File tree

27 files changed

+299
-103
lines changed

27 files changed

+299
-103
lines changed

Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ edition = "2018"
1111
license = "Apache-2.0/MIT"
1212
name = "swc"
1313
repository = "https://github.com/swc-project/swc.git"
14-
version = "0.22.0"
14+
version = "0.23.0"
1515

1616
[lib]
1717
name = "swc"
@@ -31,11 +31,11 @@ sourcemap = "6"
3131
swc_atoms = {version = "0.2", path = "./atoms"}
3232
swc_common = {version = "0.10.16", path = "./common", features = ["sourcemap", "concurrent"]}
3333
swc_ecma_ast = {version = "0.46.0", path = "./ecmascript/ast"}
34-
swc_ecma_codegen = {version = "0.57.0", path = "./ecmascript/codegen"}
35-
swc_ecma_ext_transforms = {version = "0.17.0", path = "./ecmascript/ext-transforms"}
36-
swc_ecma_parser = {version = "0.59.0", path = "./ecmascript/parser"}
37-
swc_ecma_preset_env = {version = "0.22.0", path = "./ecmascript/preset-env"}
38-
swc_ecma_transforms = {version = "0.52.0", path = "./ecmascript/transforms", features = [
34+
swc_ecma_codegen = {version = "0.58.0", path = "./ecmascript/codegen"}
35+
swc_ecma_ext_transforms = {version = "0.18.0", path = "./ecmascript/ext-transforms"}
36+
swc_ecma_parser = {version = "0.60.0", path = "./ecmascript/parser"}
37+
swc_ecma_preset_env = {version = "0.23.0", path = "./ecmascript/preset-env"}
38+
swc_ecma_transforms = {version = "0.53.0", path = "./ecmascript/transforms", features = [
3939
"compat",
4040
"module",
4141
"optimization",

bundler/Cargo.toml

Lines changed: 5 additions & 5 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.39.0"
12+
version = "0.40.0"
1313

1414
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1515
[features]
@@ -34,9 +34,9 @@ retain_mut = "0.1.2"
3434
swc_atoms = {version = "0.2.4", path = "../atoms"}
3535
swc_common = {version = "0.10.16", path = "../common"}
3636
swc_ecma_ast = {version = "0.46.0", path = "../ecmascript/ast"}
37-
swc_ecma_codegen = {version = "0.57.0", path = "../ecmascript/codegen"}
38-
swc_ecma_parser = {version = "0.59.0", path = "../ecmascript/parser"}
39-
swc_ecma_transforms = {version = "0.52.0", path = "../ecmascript/transforms", features = ["optimization"]}
37+
swc_ecma_codegen = {version = "0.58.0", path = "../ecmascript/codegen"}
38+
swc_ecma_parser = {version = "0.60.0", path = "../ecmascript/parser"}
39+
swc_ecma_transforms = {version = "0.53.0", path = "../ecmascript/transforms", features = ["optimization"]}
4040
swc_ecma_utils = {version = "0.37.0", path = "../ecmascript/utils"}
4141
swc_ecma_visit = {version = "0.32.0", path = "../ecmascript/visit"}
4242

@@ -45,7 +45,7 @@ hex = "0.4"
4545
ntest = "0.7.2"
4646
reqwest = {version = "0.10.8", features = ["blocking"]}
4747
sha-1 = "0.9"
48-
swc_ecma_transforms = {version = "0.52.0", path = "../ecmascript/transforms", features = ["react", "typescript"]}
48+
swc_ecma_transforms = {version = "0.53.0", path = "../ecmascript/transforms", features = ["react", "typescript"]}
4949
tempfile = "3.1.0"
5050
testing = {version = "0.10.5", path = "../testing"}
5151
url = "2.1.1"

ecmascript/Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ edition = "2018"
66
license = "Apache-2.0/MIT"
77
name = "swc_ecmascript"
88
repository = "https://github.com/swc-project/swc.git"
9-
version = "0.38.0"
9+
version = "0.39.0"
1010

1111
[package.metadata.docs.rs]
1212
all-features = true
@@ -29,11 +29,11 @@ typescript = ["swc_ecma_transforms/typescript"]
2929

3030
[dependencies]
3131
swc_ecma_ast = {version = "0.46.0", path = "./ast"}
32-
swc_ecma_codegen = {version = "0.57.0", path = "./codegen", optional = true}
33-
swc_ecma_dep_graph = {version = "0.27.0", path = "./dep-graph", optional = true}
34-
swc_ecma_minifier = {version = "0.4.0", path = "./minifier", optional = true}
35-
swc_ecma_parser = {version = "0.59.0", path = "./parser", optional = true}
36-
swc_ecma_transforms = {version = "0.52.0", path = "./transforms", optional = true}
32+
swc_ecma_codegen = {version = "0.58.0", path = "./codegen", optional = true}
33+
swc_ecma_dep_graph = {version = "0.28.0", path = "./dep-graph", optional = true}
34+
swc_ecma_minifier = {version = "0.5.0", path = "./minifier", optional = true}
35+
swc_ecma_parser = {version = "0.60.0", path = "./parser", optional = true}
36+
swc_ecma_transforms = {version = "0.53.0", path = "./transforms", optional = true}
3737
swc_ecma_utils = {version = "0.37.0", path = "./utils", optional = true}
3838
swc_ecma_visit = {version = "0.32.0", path = "./visit", optional = true}
3939

ecmascript/codegen/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs"]
77
license = "Apache-2.0/MIT"
88
name = "swc_ecma_codegen"
99
repository = "https://github.com/swc-project/swc.git"
10-
version = "0.57.2"
10+
version = "0.58.0"
1111

1212
[dependencies]
1313
bitflags = "1"
@@ -17,7 +17,7 @@ swc_atoms = {version = "0.2", path = "../../atoms"}
1717
swc_common = {version = "0.10.16", path = "../../common"}
1818
swc_ecma_ast = {version = "0.46.0", path = "../ast"}
1919
swc_ecma_codegen_macros = {version = "0.5.2", path = "./macros"}
20-
swc_ecma_parser = {version = "0.59.0", path = "../parser"}
20+
swc_ecma_parser = {version = "0.60.0", path = "../parser"}
2121

2222
[dev-dependencies]
2323
swc_common = {version = "0.10.16", path = "../../common", features = ["sourcemap"]}

ecmascript/dep-graph/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ edition = "2018"
66
license = "Apache-2.0/MIT"
77
name = "swc_ecma_dep_graph"
88
repository = "https://github.com/swc-project/swc.git"
9-
version = "0.27.0"
9+
version = "0.28.0"
1010

1111
[dependencies]
1212
swc_atoms = {version = "0.2", path = "../../atoms"}
@@ -15,5 +15,5 @@ swc_ecma_ast = {version = "0.46.0", path = "../ast"}
1515
swc_ecma_visit = {version = "0.32.0", path = "../visit"}
1616

1717
[dev-dependencies]
18-
swc_ecma_parser = {version = "0.59.0", path = "../parser"}
18+
swc_ecma_parser = {version = "0.60.0", path = "../parser"}
1919
testing = {version = "0.10.5", path = "../../testing"}

ecmascript/ext-transforms/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ documentation = "https://rustdoc.swc.rs/swc_ecma_ext_transforms/"
55
edition = "2018"
66
license = "Apache-2.0/MIT"
77
name = "swc_ecma_ext_transforms"
8-
version = "0.17.0"
8+
version = "0.18.0"
99

1010
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1111

@@ -14,6 +14,6 @@ phf = {version = "0.8.0", features = ["macros"]}
1414
swc_atoms = {version = "0.2", path = "../../atoms"}
1515
swc_common = {version = "0.10.16", path = "../../common"}
1616
swc_ecma_ast = {version = "0.46.0", path = "../ast"}
17-
swc_ecma_parser = {version = "0.59.0", path = "../parser"}
17+
swc_ecma_parser = {version = "0.60.0", path = "../parser"}
1818
swc_ecma_utils = {version = "0.37.0", path = "../utils"}
1919
swc_ecma_visit = {version = "0.32.0", path = "../visit"}

ecmascript/jsdoc/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ documentation = "https://rustdoc.swc.rs/jsdoc/"
55
edition = "2018"
66
license = "Apache-2.0/MIT"
77
name = "jsdoc"
8-
version = "0.27.0"
8+
version = "0.28.0"
99

1010
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1111

@@ -19,6 +19,6 @@ swc_common = {version = "0.10.16", path = "../../common"}
1919
anyhow = "1"
2020
dashmap = "4.0.2"
2121
swc_ecma_ast = {version = "0.46.0", path = "../ast"}
22-
swc_ecma_parser = {version = "0.59.0", path = "../parser"}
22+
swc_ecma_parser = {version = "0.60.0", path = "../parser"}
2323
testing = {version = "0.10.5", path = "../../testing"}
2424
walkdir = "2"

ecmascript/minifier/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs", "src/lists/*.json"]
77
license = "Apache-2.0/MIT"
88
name = "swc_ecma_minifier"
99
repository = "https://github.com/swc-project/swc.git"
10-
version = "0.4.0"
10+
version = "0.5.0"
1111

1212
[features]
1313
debug = []
@@ -25,10 +25,10 @@ serde_regex = "1.1.0"
2525
swc_atoms = {version = "0.2", path = "../../atoms"}
2626
swc_common = {version = "0.10.8", path = "../../common"}
2727
swc_ecma_ast = {version = "0.46.0", path = "../ast"}
28-
swc_ecma_codegen = {version = "0.57.0", path = "../codegen"}
29-
swc_ecma_parser = {version = "0.59.0", path = "../parser"}
30-
swc_ecma_transforms = {version = "0.52.0", path = "../transforms/", features = ["optimization"]}
31-
swc_ecma_transforms_base = {version = "0.17.0", path = "../transforms/base"}
28+
swc_ecma_codegen = {version = "0.58.0", path = "../codegen"}
29+
swc_ecma_parser = {version = "0.60.0", path = "../parser"}
30+
swc_ecma_transforms = {version = "0.53.0", path = "../transforms/", features = ["optimization"]}
31+
swc_ecma_transforms_base = {version = "0.18.0", path = "../transforms/base"}
3232
swc_ecma_utils = {version = "0.37.0", path = "../utils"}
3333
swc_ecma_visit = {version = "0.32.0", path = "../visit"}
3434

ecmascript/parser/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs", "examples/**/*.rs"]
77
license = "Apache-2.0/MIT"
88
name = "swc_ecma_parser"
99
repository = "https://github.com/swc-project/swc.git"
10-
version = "0.59.3"
10+
version = "0.60.0"
1111

1212
[features]
1313
default = []

ecmascript/parser/src/error.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ pub enum SyntaxError {
6969
c: char,
7070
},
7171
InvalidStrEscape,
72+
InvalidUnicodeCodePoint,
7273
InvalidUnicodeEscape,
7374
InvalidCodePoint,
7475
ExpectedHexChars {
@@ -266,6 +267,7 @@ impl SyntaxError {
266267
SyntaxError::IdentAfterNum => "Identifier cannot follow number".into(),
267268
SyntaxError::UnexpectedChar { c } => format!("Unexpected character {:?}", c).into(),
268269
SyntaxError::InvalidStrEscape => "Invalid string escape".into(),
270+
SyntaxError::InvalidUnicodeCodePoint => "Undefined Unicode code-point".into(),
269271
SyntaxError::InvalidUnicodeEscape => "Invalid unicode escape".into(),
270272
SyntaxError::InvalidCodePoint => "Invalid unicode code point".into(),
271273
SyntaxError::ExpectedHexChars { count } => {

0 commit comments

Comments
 (0)