mirror of
https://github.com/swc-project/swc.git
synced 2024-11-23 00:32:15 +03:00
fix(es/ast): Pin version of unicodes (#8941)
**Description:** https://github.com/swc-project/swc/issues/8940#issuecomment-2102423586 > I found part of the problem: > > U+30FB was added to `ID_Continue` from Unicode version 14 to 15, but v8 is using an older version of unicode ... which I can't find the exact version. > > I spent 2 hours searching for all the missing pieces, I give up. > > Let me back port unicode version 14. **Related issue:** - Closes #8940
This commit is contained in:
parent
6d7b99b482
commit
6362ff4ba8
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -5927,9 +5927,9 @@ checksum = "b1b6def86329695390197b82c1e244a54a131ceb66c996f2088a3876e2ae083f"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-id-start"
|
||||
version = "1.1.2"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8f73150333cb58412db36f2aca8f2875b013049705cc77b94ded70a1ab1f5da"
|
||||
checksum = "02aebfa694eccbbbffdd92922c7de136b9fe764396d2f10e21bce1681477cfc1"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
|
@ -117,7 +117,7 @@ resolver = "2"
|
||||
tracing-subscriber = "0.3.18"
|
||||
typed-arena = "2.0.1"
|
||||
unicode-id = "0.3"
|
||||
unicode-id-start = "1.1.2"
|
||||
unicode-id-start = "=1.0.4"
|
||||
unicode-width = "0.1.4"
|
||||
url = "2.4.0"
|
||||
vergen = { version = "8.0.0", default-features = false }
|
||||
|
64
crates/swc/tests/fixture/issues-8xxx/8940/input/.swcrc
Normal file
64
crates/swc/tests/fixture/issues-8xxx/8940/input/.swcrc
Normal file
@ -0,0 +1,64 @@
|
||||
{
|
||||
"jsc": {
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
"tsx": false
|
||||
},
|
||||
"target": "es5",
|
||||
"loose": false,
|
||||
"minify": {
|
||||
"compress": {
|
||||
"arguments": false,
|
||||
"arrows": true,
|
||||
"booleans": true,
|
||||
"booleans_as_integers": false,
|
||||
"collapse_vars": true,
|
||||
"comparisons": true,
|
||||
"computed_props": true,
|
||||
"conditionals": true,
|
||||
"dead_code": true,
|
||||
"directives": true,
|
||||
"drop_console": false,
|
||||
"drop_debugger": true,
|
||||
"evaluate": true,
|
||||
"expression": false,
|
||||
"hoist_funs": false,
|
||||
"hoist_props": true,
|
||||
"hoist_vars": false,
|
||||
"if_return": true,
|
||||
"join_vars": true,
|
||||
"keep_classnames": false,
|
||||
"keep_fargs": true,
|
||||
"keep_fnames": false,
|
||||
"keep_infinity": false,
|
||||
"loops": true,
|
||||
"negate_iife": true,
|
||||
"properties": true,
|
||||
"reduce_funcs": false,
|
||||
"reduce_vars": false,
|
||||
"side_effects": true,
|
||||
"switches": true,
|
||||
"typeofs": true,
|
||||
"unsafe": false,
|
||||
"unsafe_arrows": false,
|
||||
"unsafe_comps": false,
|
||||
"unsafe_Function": false,
|
||||
"unsafe_math": false,
|
||||
"unsafe_symbols": false,
|
||||
"unsafe_methods": false,
|
||||
"unsafe_proto": false,
|
||||
"unsafe_regexp": false,
|
||||
"unsafe_undefined": false,
|
||||
"unused": true,
|
||||
"const_to_let": true,
|
||||
"pristine_globals": true
|
||||
},
|
||||
"mangle": false
|
||||
}
|
||||
},
|
||||
"module": {
|
||||
"type": "es6"
|
||||
},
|
||||
"minify": false,
|
||||
"isModule": true
|
||||
}
|
7
crates/swc/tests/fixture/issues-8xxx/8940/input/1.js
Normal file
7
crates/swc/tests/fixture/issues-8xxx/8940/input/1.js
Normal file
@ -0,0 +1,7 @@
|
||||
console.log({
|
||||
"あ": 1,
|
||||
"あ・あ": 1,
|
||||
"・あ": 1,
|
||||
"・": 1,
|
||||
"あ・": 1,
|
||||
})
|
7
crates/swc/tests/fixture/issues-8xxx/8940/output/1.js
Normal file
7
crates/swc/tests/fixture/issues-8xxx/8940/output/1.js
Normal file
@ -0,0 +1,7 @@
|
||||
console.log({
|
||||
あ: 1,
|
||||
"あ・あ": 1,
|
||||
"・あ": 1,
|
||||
"・": 1,
|
||||
"あ・": 1
|
||||
});
|
@ -258,6 +258,11 @@ static IGNORED_PASS_TESTS: &[&str] = &[
|
||||
"bc302492d441d561.js",
|
||||
"be2fd5888f434cbd.js",
|
||||
"f3260491590325af.js",
|
||||
// Unicode 14 vs 15
|
||||
"046a0bb70d03d0cc.js",
|
||||
"08a39e4289b0c3f3.js",
|
||||
"300a638d978d0f2c.js",
|
||||
"44f31660bd715f05.js",
|
||||
];
|
||||
|
||||
#[testing::fixture("../swc_ecma_parser/tests/test262-parser/pass/*.js")]
|
||||
|
@ -64,6 +64,11 @@ const IGNORED_PASS_TESTS: &[&str] = &[
|
||||
"59ae0289778b80cd.js",
|
||||
"a4d62a651f69d815.js",
|
||||
"c06df922631aeabc.js",
|
||||
// Unicode 14 vs 15
|
||||
"046a0bb70d03d0cc.js",
|
||||
"08a39e4289b0c3f3.js",
|
||||
"300a638d978d0f2c.js",
|
||||
"44f31660bd715f05.js",
|
||||
];
|
||||
|
||||
#[testing::fixture("../swc_ecma_parser/tests/test262-parser/pass/*.js")]
|
||||
|
@ -403,14 +403,11 @@ pub(crate) fn is_primitive<'a>(expr_ctx: &ExprCtx, e: &'a Expr) -> Option<&'a Ex
|
||||
}
|
||||
|
||||
pub(crate) fn is_valid_identifier(s: &str, ascii_only: bool) -> bool {
|
||||
if ascii_only {
|
||||
if s.chars().any(|c| !c.is_ascii()) {
|
||||
return false;
|
||||
}
|
||||
if ascii_only && !s.is_ascii() {
|
||||
return false;
|
||||
}
|
||||
s.starts_with(Ident::is_valid_start)
|
||||
&& s.chars().skip(1).all(Ident::is_valid_continue)
|
||||
&& !s.contains('𝒶')
|
||||
&& !s.is_reserved()
|
||||
}
|
||||
|
||||
|
@ -1 +1,3 @@
|
||||
console.log({ "𝒶": "foo" });
|
||||
console.log({
|
||||
𝒶: "foo"
|
||||
});
|
||||
|
@ -79,6 +79,11 @@ const IGNORED_PASS_TESTS: &[&str] = &[
|
||||
// Wrong test - strict mode
|
||||
"8f8bfb27569ac008.js",
|
||||
"ce569e89a005c02a.js",
|
||||
// Unicode 14 vs 15
|
||||
"046a0bb70d03d0cc.js",
|
||||
"08a39e4289b0c3f3.js",
|
||||
"300a638d978d0f2c.js",
|
||||
"44f31660bd715f05.js",
|
||||
];
|
||||
|
||||
fn add_test<F: FnOnce() -> Result<(), String> + Send + 'static>(
|
||||
|
@ -90,6 +90,11 @@ const IGNORED_PASS_TESTS: &[&str] = &[
|
||||
"59ae0289778b80cd.js",
|
||||
"a4d62a651f69d815.js",
|
||||
"c06df922631aeabc.js",
|
||||
// Unicode 14 vs 15
|
||||
"046a0bb70d03d0cc.js",
|
||||
"08a39e4289b0c3f3.js",
|
||||
"300a638d978d0f2c.js",
|
||||
"44f31660bd715f05.js",
|
||||
];
|
||||
|
||||
fn add_test<F: FnOnce() -> Result<(), String> + Send + 'static>(
|
||||
|
Loading…
Reference in New Issue
Block a user