diff --git a/Cargo.lock b/Cargo.lock index ba19b3e1181c..79587f991578 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -149,12 +149,6 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" -[[package]] -name = "base64" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" - [[package]] name = "base64" version = "0.13.0" @@ -2265,7 +2259,7 @@ version = "0.35.0" dependencies = [ "ahash 0.7.4", "anyhow", - "base64 0.12.3", + "base64 0.13.0", "dashmap", "either", "log", @@ -2419,7 +2413,7 @@ dependencies = [ [[package]] name = "swc_ecma_ast" -version = "0.49.0" +version = "0.49.1" dependencies = [ "arbitrary", "is-macro", @@ -2433,7 +2427,7 @@ dependencies = [ [[package]] name = "swc_ecma_codegen" -version = "0.65.0" +version = "0.65.1" dependencies = [ "bitflags", "num-bigint", @@ -2750,7 +2744,7 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_react" -version = "0.30.0" +version = "0.30.1" dependencies = [ "base64 0.13.0", "dashmap", diff --git a/Cargo.toml b/Cargo.toml index 9802714aaa70..3fcfefc21d7e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ name = "swc" [dependencies] ahash = "0.7.2" anyhow = "1" -base64 = "0.12.0" +base64 = "0.13.0" dashmap = "4.0.2" either = "1" log = {version = "0.4", features = ["release_max_level_info"]} diff --git a/ecmascript/ast/Cargo.toml b/ecmascript/ast/Cargo.toml index a1a6c06bbbb1..c331485019e1 100644 --- a/ecmascript/ast/Cargo.toml +++ b/ecmascript/ast/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_ecma_ast" repository = "https://github.com/swc-project/swc.git" -version = "0.49.0" +version = "0.49.1" [features] default = [] diff --git a/ecmascript/codegen/Cargo.toml b/ecmascript/codegen/Cargo.toml index 7e71f20670e7..9deac867b2e1 100644 --- a/ecmascript/codegen/Cargo.toml +++ b/ecmascript/codegen/Cargo.toml @@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs"] license = "Apache-2.0/MIT" name = "swc_ecma_codegen" repository = "https://github.com/swc-project/swc.git" -version = "0.65.0" +version = "0.65.1" [dependencies] bitflags = "1" diff --git a/ecmascript/codegen/src/text_writer/semicolon.rs b/ecmascript/codegen/src/text_writer/semicolon.rs index 6feb6f8a3040..a62b43384168 100644 --- a/ecmascript/codegen/src/text_writer/semicolon.rs +++ b/ecmascript/codegen/src/text_writer/semicolon.rs @@ -60,7 +60,7 @@ impl WriteJs for OmitTrailingSemi { self.commit_pending_semi()?; } - "{" | "(" => { + "/" | "{" | "(" => { self.commit_pending_semi()?; } diff --git a/ecmascript/codegen/tests/fixture/issues/2000/input.js b/ecmascript/codegen/tests/fixture/issues/2000/input.js new file mode 100644 index 000000000000..31bed7db8ad2 --- /dev/null +++ b/ecmascript/codegen/tests/fixture/issues/2000/input.js @@ -0,0 +1,5 @@ +function testme() { + for (var a = arguments.length, b = new Array(a), c = 0; c < a; c++) + b[c] = arguments[c]; + /^toto.+/.test(b.join("")) && global.other(!0) +} diff --git a/ecmascript/codegen/tests/fixture/issues/2000/output.js b/ecmascript/codegen/tests/fixture/issues/2000/output.js new file mode 100644 index 000000000000..30f27a82e536 --- /dev/null +++ b/ecmascript/codegen/tests/fixture/issues/2000/output.js @@ -0,0 +1,4 @@ +function testme() { + for(var a = arguments.length, b = new Array(a), c = 0; c < a; c++)b[c] = arguments[c]; + /^toto.+/.test(b.join("")) && global.other(!0); +} diff --git a/ecmascript/codegen/tests/fixture/issues/2000/output.min.js b/ecmascript/codegen/tests/fixture/issues/2000/output.min.js new file mode 100644 index 000000000000..937a2b67d5f1 --- /dev/null +++ b/ecmascript/codegen/tests/fixture/issues/2000/output.min.js @@ -0,0 +1 @@ +function testme(){for(var a=arguments.length,b=new Array(a),c=0;c ( +
Hello World
+); \ No newline at end of file diff --git a/ecmascript/transforms/react/tests/jsx/fixture/issue-1933/options.json b/ecmascript/transforms/react/tests/jsx/fixture/issue-1933/options.json new file mode 100644 index 000000000000..a6ce63157f65 --- /dev/null +++ b/ecmascript/transforms/react/tests/jsx/fixture/issue-1933/options.json @@ -0,0 +1,3 @@ +{ + "runtime": "classic" +} diff --git a/ecmascript/transforms/react/tests/jsx/fixture/issue-1933/output.js b/ecmascript/transforms/react/tests/jsx/fixture/issue-1933/output.js new file mode 100644 index 000000000000..ec620641ecb8 --- /dev/null +++ b/ecmascript/transforms/react/tests/jsx/fixture/issue-1933/output.js @@ -0,0 +1,6 @@ +import { jsx as _jsx } from "react/jsx-runtime"; + +/* @jsxImportSource react */ +const p = () => /*#__PURE__*/_jsx("div", { + children: "Hello World" +}); diff --git a/tests/fixture/.issue-1726/case1/input/index.tsx b/tests/fixture/.issue-1726/case1/input/index.tsx deleted file mode 100644 index f41481153134..000000000000 --- a/tests/fixture/.issue-1726/case1/input/index.tsx +++ /dev/null @@ -1 +0,0 @@ -const foo =

{bar}

\ No newline at end of file diff --git a/tests/fixture/.issue-1726/case1/output/index.tsx b/tests/fixture/.issue-1726/case1/output/index.tsx deleted file mode 100644 index 197cd54cfec8..000000000000 --- a/tests/fixture/.issue-1726/case1/output/index.tsx +++ /dev/null @@ -1,3 +0,0 @@ -var foo = /*#__PURE__*/ React.createElement("h1", null, bar); - -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9Vc2Vycy9rZHkxL3Byb2plY3RzL3N3Yy1idWdzL3Rlc3RzL2ZpeHR1cmUvaXNzdWUtMTcyNi9jYXNlMS9pbnB1dC9pbmRleC50c3giXSwic291cmNlc0NvbnRlbnQiOlsiY29uc3QgZm9vID0gPGgxPntiYXJ9PC9oMT4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsR0FBSyxDQUFDLEdBQUcsc0NBQUksRUFBRSxTQUFFLEdBQUcifQ== diff --git a/tests/fixture/.issue-1726/case1/input/.swcrc b/tests/fixture/issue-1726/case1/input/.swcrc similarity index 84% rename from tests/fixture/.issue-1726/case1/input/.swcrc rename to tests/fixture/issue-1726/case1/input/.swcrc index c4d1cb6708e8..95ff4e962c76 100644 --- a/tests/fixture/.issue-1726/case1/input/.swcrc +++ b/tests/fixture/issue-1726/case1/input/.swcrc @@ -1,5 +1,4 @@ { - "sourceMaps": "inline", "jsc": { "target": "es5", "parser": { @@ -8,4 +7,4 @@ }, "loose": true } -} +} \ No newline at end of file diff --git a/tests/fixture/issue-1726/case1/input/index.tsx b/tests/fixture/issue-1726/case1/input/index.tsx new file mode 100644 index 000000000000..228542e7e491 --- /dev/null +++ b/tests/fixture/issue-1726/case1/input/index.tsx @@ -0,0 +1 @@ +const foo = /* 1 */

{/* 2 */ bar /* 3 */}

; /* 4 */ diff --git a/tests/fixture/issue-1726/case1/output/index.tsx b/tests/fixture/issue-1726/case1/output/index.tsx new file mode 100644 index 000000000000..ae4bb930dbf8 --- /dev/null +++ b/tests/fixture/issue-1726/case1/output/index.tsx @@ -0,0 +1 @@ +var foo = /* 1 */ /*#__PURE__*/ React.createElement("h1", null, bar /* 3 */ ); /* 4 */ diff --git a/tests/fixture/issue-2000/input/.swcrc b/tests/fixture/issue-2000/input/.swcrc new file mode 100644 index 000000000000..479f8d3f8e40 --- /dev/null +++ b/tests/fixture/issue-2000/input/.swcrc @@ -0,0 +1,10 @@ +{ + "jsc": { + "loose": true, + "minify": { + "compress": true, + "mangle": true + } + }, + "minify": true +} \ No newline at end of file diff --git a/tests/fixture/issue-2000/input/index.js b/tests/fixture/issue-2000/input/index.js new file mode 100644 index 000000000000..d18313294900 --- /dev/null +++ b/tests/fixture/issue-2000/input/index.js @@ -0,0 +1,3 @@ +function testme(...list) { + if (/^toto.+/.test(list.join(''))) global.other(true); +} \ No newline at end of file diff --git a/tests/fixture/issue-2000/output/index.js b/tests/fixture/issue-2000/output/index.js new file mode 100644 index 000000000000..937a2b67d5f1 --- /dev/null +++ b/tests/fixture/issue-2000/output/index.js @@ -0,0 +1 @@ +function testme(){for(var a=arguments.length,b=new Array(a),c=0;c