Repository: swc-project/swc (rust)

Issue:
Function keyword as property name inside JSX attribute fails
### Describe the bug

````jsx
<Wrapper>
  <Sidebar
    author={{
      name: author.name,
      function: author.function
    }}
  />
</Wrapper>
````

Fails with 

````
error - ./src/nodes/article.tsx
Error: 
  x Unexpected token Wrapper. Expected jsx identifier
    ,----
 59 | <Wrapper>
    :  ^^^^^^^^
    `----

Caused by:
    0: failed to process input file
    1: Syntax Error
````

But,

````jsx
<Wrapper>
  <Sidebar
    author={{
      name: author.name,
      // function: author.function
    }}
  />
</Wrapper>
````

compiles fine. (Interestingly having function property come first compiles too.)

### Input code

```typescript
<Sidebar
  author={{
    name: author.name,
    function: author.function
  }}
/>
```


### Config

```json
{
  "jsc": {
    "parser": {
      "syntax": "ecmascript",
      "jsx": true
    },
    "target": "es5",
    "loose": false,
    "minify": {
      "compress": false,
      "mangle": false
    }
  },
  "module": {
    "type": "es6"
  },
  "minify": false,
  "isModule": true
}
```


### Playground link

https://play.swc.rs/?version=1.2.165&code=H4sIAAAAAAAAA7MJzkxJTUos4uVSUEgsLcnIL7KtrgZxFBTyEnNTraCCeiCODkQ8rTQvuSQzPw8uBxMASdfW8nLp2wEANngkB1YAAAA%3D&config=H4sIAAAAAAAAA0WOSwrDMAxE7zJrb9uF79BDCFcJLv4hOVBjfPfaISU7MfPmoY6POtiOQqIs69KWKn1hwS6SOvGlwkxsRlUOHgaVZOe6CH3MKuSsDLtRUDaIPvmtLZHLsQir3hWlPfzJMUUxv48VdNRW%2BBQ%2BMW7HtfP6usDzgR%2Fs3ILttAAAAA%3D%3D

### Expected behavior

No compile errors

### Actual behavior

_No response_

### Version

1.2.165

### Additional context

_No response_

Pull request:
fix(es/parser): Lexer error when object prop is named function
**Description:**

**Related issue (if exists):**
closes #4314 


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2a248f7c67..a9b2ac8928 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -52,6 +52,9 @@
 
 - **(es/minifier)** Make `base54` use stack-allocated vector (#4371) ([6300b9c](https://github.com/swc-project/swc/commit/6300b9cdb19150686bc71c08386e11d7899a0764))
 
+
+- **(es/minifier)** Change default value of `passes` to `3` (#4373) ([a8eb00c](https://github.com/swc-project/swc/commit/a8eb00cc540c0bfdfc7d0b922fe34bea2cf8ef45))
+
 ### Testing
 
 
diff --git a/Cargo.lock b/Cargo.lock
index 72ba914114..30b52df072 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2838,7 +2838,7 @@ dependencies = [
 
 [[package]]
 name = "swc"
-version = "0.168.2"
+version = "0.168.3"
 dependencies = [
  "ahash",
  "ansi_term",
diff --git a/crates/swc/Cargo.toml b/crates/swc/Cargo.toml
index f393127e6a..83ca48b079 100644
--- a/crates/swc/Cargo.toml
+++ b/crates/swc/Cargo.toml
@@ -9,7 +9,7 @@ include = ["Cargo.toml", "src/**/*.rs"]
 license = "Apache-2.0"
 name = "swc"
 repository = "https://github.com/swc-project/swc.git"
-version = "0.168.2"
+version = "0.168.3"
 
 [lib]
 bench = false
diff --git a/crates/swc_ecma_minifier/benches/full.rs b/crates/swc_ecma_minifier/benches/full.rs
index c4a6ec8eee..87acca6839 100644
--- a/crates/swc_ecma_minifier/benches/full.rs
+++ b/crates/swc_ecma_minifier/benches/full.rs
@@ -6,11 +6,10 @@ use std::fs::read_to_string;
 
 use criterion::{black_box, criterion_group, criterion_main, Criterion};
 use swc_common::{sync::Lrc, FileName, Mark, SourceMap};
-use swc_ecma_ast::EsVersion;
 use swc_ecma_codegen::text_writer::JsWriter;
 use swc_ecma_minifier::{
     optimize,
-    option::{CompressOptions, ExtraOptions, MangleOptions, MinifyOptions, PureGetterOption},
+    option::{CompressOptions, ExtraOptions, MangleOptions, MinifyOptions},
 };
 use swc_ecma_parser::parse_file_as_module;
 use swc_ecma_transforms_base::{fixer::fixer, resolver::resolver_with_mark};
@@ -75,59 +74,7 @@ fn run(src: &str) {
             &MinifyOptions {
                 rename: false,
                 compress: Some(CompressOptions {
-                    arguments: false,
-                    arrows: true,
-                    bools: true,
-                    bools_as_ints: false,
-                    collapse_vars: true,
-                    comparisons: true,
-                    computed_props: false,
-                    conditionals: true,
-                    dead_code: true,
-                    directives: false,
-                    drop_console: false,
-                    drop_debugger: true,
-                    ecma: EsVersion::Es2015,
-                    evaluate: true,
-                    expr: false,
-                    global_defs: Default::default(),
-                    hoist_fns: false,
-                    hoist_props: true,
-                    hoist_vars: false,
-                    ie8: false,
-                    if_return: true,
-                    inline: 3,
-                    join_vars: true,
-                    keep_classnames: false,
-                    keep_fargs: true,
-                    keep_fnames: false,
-                    keep_infinity: false,
-                    loops: true,
-                    module: false,
-                    negate_iife: true,
-                    passes: 0,
-                    props: true,
-                    pure_getters: PureGetterOption::Strict,
-                    reduce_fns: false,
-                    reduce_vars: false,
-                    sequences: 3,
-                    side_effects: true,
-                    switches: false,
-                    top_retain: Default::default(),
-                    top_level: None,
-                    typeofs: true,
-                    unsafe_passes: 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,
+                    ..Default::default()
                 }),
                 mangle: Some(MangleOptions {
                     props: None,
diff --git a/crates/swc_ecma_minifier/src/option/mod.rs b/crates/swc_ecma_minifier/src/option/mod.rs
index 2cf423d5d4..9d4ed91f51 100644
--- a/crates/swc_ecma_minifier/src/option/mod.rs
+++ b/crates/swc_ecma_minifier/src/option/mod.rs
@@ -226,7 +226,7 @@ pub struct CompressOptions {
 
     /// If this value is zero, the minifier will repeat work until the ast node
     /// is settled.
-    #[serde(default = "zero_by_default")]
+    #[serde(default = "default_passes")]
     #[serde(alias = "passes")]
     pub passes: usize,
 
@@ -329,8 +329,8 @@ const fn true_by_default() -> bool {
     true
 }
 
-const fn zero_by_default() -> usize {
-    0
+const fn default_passes() -> usize {
+    3
 }
 
 const fn three_by_default() -> u8 {
diff --git a/crates/swc_ecma_minifier/src/option/terser.rs b/crates/swc_ecma_minifier/src/option/terser.rs
index 4170f8459f..3d8c5d984d 100644
--- a/crates/swc_ecma_minifier/src/option/terser.rs
+++ b/crates/swc_ecma_minifier/src/option/terser.rs
@@ -8,7 +8,7 @@ use swc_ecma_ast::*;
 use swc_ecma_parser::parse_file_as_expr;
 use swc_ecma_utils::drop_span;
 
-use super::{true_by_default, CompressOptions, TopLevelOptions};
+use super::{default_passes, true_by_default, CompressOptions, TopLevelOptions};
 use crate::option::PureGetterOption;
 
 #[derive(Debug, Clone, Serialize, Deserialize)]
@@ -166,7 +166,7 @@ pub struct TerserCompressorOptions {
     #[serde(default)]
     pub negate_iife: Option<bool>,
 
-    #[serde(default)]
+    #[serde(default = "default_passes")]
     pub passes: usize,
 
     #[serde(default)]
diff --git a/crates/swc_ecma_parser/src/lexer/state.rs b/crates/swc_ecma_parser/src/lexer/state.rs
index abd2321f99..0964ae6094 100644
--- a/crates/swc_ecma_parser/src/lexer/state.rs
+++ b/crates/swc_ecma_parser/src/lexer/state.rs
@@ -467,6 +467,12 @@ impl State {
                     false
                 }
 
+                tok!(':') if context.current() == Some(TokenContext::FnExpr) => {
+                    // function keyword is object prop: { function: expr }
+                    context.pop(); // Remove FnExpr
+                    true
+                }
+
                 // for (a of b) {}
                 tok!("of")
                     if Some(TokenContext::ParenStmt { is_for_loop: true }) == context.current() =>


Test patch:
diff --git a/crates/swc/tests/fixture/issues-4xxx/issue-4314/1/input/.swcrc b/crates/swc/tests/fixture/issues-4xxx/issue-4314/1/input/.swcrc
new file mode 100644
index 0000000000..63486f84bf
--- /dev/null
+++ b/crates/swc/tests/fixture/issues-4xxx/issue-4314/1/input/.swcrc
@@ -0,0 +1,9 @@
+{
+    "jsc": {
+        "target": "es2020",
+        "parser": {
+            "syntax": "ecmascript",
+            "jsx": true
+        }
+    }
+}
diff --git a/crates/swc/tests/fixture/issues-4xxx/issue-4314/1/input/input.js b/crates/swc/tests/fixture/issues-4xxx/issue-4314/1/input/input.js
new file mode 100644
index 0000000000..b53b50f4cc
--- /dev/null
+++ b/crates/swc/tests/fixture/issues-4xxx/issue-4314/1/input/input.js
@@ -0,0 +1,8 @@
+<Wrapper>
+  <Sidebar
+    author={{
+      name: author.name,
+      function: author.function
+    }}
+  />
+</Wrapper>
diff --git a/crates/swc/tests/fixture/issues-4xxx/issue-4314/1/output/input.js b/crates/swc/tests/fixture/issues-4xxx/issue-4314/1/output/input.js
new file mode 100644
index 0000000000..654330231e
--- /dev/null
+++ b/crates/swc/tests/fixture/issues-4xxx/issue-4314/1/output/input.js
@@ -0,0 +1,6 @@
+/*#__PURE__*/ React.createElement(Wrapper, null, /*#__PURE__*/ React.createElement(Sidebar, {
+    author: {
+        name: author.name,
+        function: author.function
+    }
+}));
diff --git a/crates/swc/tests/fixture/issues-4xxx/issue-4314/2/input/.swcrc b/crates/swc/tests/fixture/issues-4xxx/issue-4314/2/input/.swcrc
new file mode 100644
index 0000000000..63486f84bf
--- /dev/null
+++ b/crates/swc/tests/fixture/issues-4xxx/issue-4314/2/input/.swcrc
@@ -0,0 +1,9 @@
+{
+    "jsc": {
+        "target": "es2020",
+        "parser": {
+            "syntax": "ecmascript",
+            "jsx": true
+        }
+    }
+}
diff --git a/crates/swc/tests/fixture/issues-4xxx/issue-4314/2/input/input.js b/crates/swc/tests/fixture/issues-4xxx/issue-4314/2/input/input.js
new file mode 100644
index 0000000000..e2e28ec4e5
--- /dev/null
+++ b/crates/swc/tests/fixture/issues-4xxx/issue-4314/2/input/input.js
@@ -0,0 +1,3 @@
+<C a={{ a:1, function: /r/ }} />;
+<C a={{ a:1, function: function(){a:/r/} }}/>;
+<C function={{ a: 1, function: /r/ }}/>;
diff --git a/crates/swc/tests/fixture/issues-4xxx/issue-4314/2/output/input.js b/crates/swc/tests/fixture/issues-4xxx/issue-4314/2/output/input.js
new file mode 100644
index 0000000000..22744c3fbd
--- /dev/null
+++ b/crates/swc/tests/fixture/issues-4xxx/issue-4314/2/output/input.js
@@ -0,0 +1,20 @@
+/*#__PURE__*/ React.createElement(C, {
+    a: {
+        a: 1,
+        function: /r/
+    }
+});
+/*#__PURE__*/ React.createElement(C, {
+    a: {
+        a: 1,
+        function: function() {
+            a: /r/;
+        }
+    }
+});
+/*#__PURE__*/ React.createElement(C, {
+    function: {
+        a: 1,
+        function: /r/
+    }
+});
diff --git a/crates/swc/tests/tsc.rs b/crates/swc/tests/tsc.rs
index 4daac3efa0..05c7df835f 100644
--- a/crates/swc/tests/tsc.rs
+++ b/crates/swc/tests/tsc.rs
@@ -90,8 +90,8 @@ fn matrix() -> Vec<(String, Options)> {
                         target: Some(target),
                         minify: if minify {
                             Some(from_json(
-                                "{ \"compress\": { \"toplevel\": true, \"module\": true }, \
-                                 \"mangle\": false, \"toplevel\": true }",
+                                "{ \"compress\": { \"toplevel\": true, \"module\": true, \
+                                 \"passes\": 0 }, \"mangle\": false, \"toplevel\": true }",
                             ))
                         } else {
                             None
diff --git a/crates/swc/tests/vercel/full-compact/react-autosuggest/1/output/index.js b/crates/swc/tests/vercel/full-compact/react-autosuggest/1/output/index.js
index 305877785d..1f4b023be0 100644
--- a/crates/swc/tests/vercel/full-compact/react-autosuggest/1/output/index.js
+++ b/crates/swc/tests/vercel/full-compact/react-autosuggest/1/output/index.js
@@ -1,1 +1,1 @@
-"use strict";import*as e from"@swc/helpers";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var d=function(a){if(a&&a.__esModule)return a;if(null===a||"object"!==g(a)&&"function"!=typeof a)return{"default":a};var b=f();if(b&&b.has(a))return b.get(a);var c={},h=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var d in a)if(Object.prototype.hasOwnProperty.call(a,d)){var e=h?Object.getOwnPropertyDescriptor(a,d):null;e&&(e.get||e.set)?Object.defineProperty(c,d,e):c[d]=a[d]}return c.default=a,b&&b.set(a,c),c}(require("react")),a=function(a){return a&&a.__esModule?a:{"default":a}}(require("prop-types"));function f(){if("function"!=typeof WeakMap)return null;var a=new WeakMap;return f=function(){return a},a}function g(a){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a})(a)}function h(){return(h=Object.assign||function(d){for(var a=1;a<arguments.length;a++){var b=arguments[a];for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(d[c]=b[c])}return d}).apply(this,arguments)}function i(c,d){var a=Object.keys(c);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(c);d&&(b=b.filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable})),a.push.apply(a,b)}return a}function j(d,c){for(var b=0;b<c.length;b++){var a=c[b];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(d,a.key,a)}}function k(a){return(k=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)})(a)}function l(a,b){return(l=Object.setPrototypeOf||function(a,b){return a.__proto__=b,a})(a,b)}function c(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}var b=function(n){!function(b,a){if("function"!=typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function");b.prototype=Object.create(a&&a.prototype,{constructor:{value:b,writable:!0,configurable:!0}}),a&&l(b,a)}(m,n);var o,a,b,f,p=(o=m,function(){var c,a,b,d=k(o);if(function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(a){return!1}}()){var e=k(this).constructor;b=Reflect.construct(d,arguments,e)}else b=d.apply(this,arguments);return c=this,(a=b)&&("object"===g(a)||"function"==typeof a)?a:function(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}(c)});function m(){!function(a,b){if(!e._instanceof(a,b))throw new TypeError("Cannot call a class as a function")}(this,m);for(var b,c=arguments.length,d=new Array(c),a=0;a<c;a++)d[a]=arguments[a];return!function(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}(function(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}(b=p.call.apply(p,[this].concat(d))),"storeHighlightedItemReference",function(a){b.props.onHighlightedItemChange(null===a?null:a.item)}),b}return a=m,b=[{key:"shouldComponentUpdate",value:function(a){return(0,_compareObjects.default)(a,this.props,["itemProps"])}},{key:"render",value:function(){var l=this,a=this.props,f=a.items,g=a.itemProps,m=a.renderItem,n=a.renderItemData,b=a.sectionIndex,o=a.highlightedItemIndex,p=a.getItemId,j=a.theme,e=a.keyPrefix,k=null===b?e:"".concat(e,"section-").concat(b,"-"),q="function"==typeof g;return d.default.createElement("ul",h({role:"listbox"},j("".concat(k,"items-list"),"itemsList")),f.map(function(r,a){var e=a===o,s="".concat(k,"item-").concat(a),t=q?g({sectionIndex:b,itemIndex:a}):g,f=function(b){for(var e=arguments,d=function(a){var d=null!=e[a]?e[a]:{};a%2?i(Object(d),!0).forEach(function(a){c(b,a,d[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(b,Object.getOwnPropertyDescriptors(d)):i(Object(d)).forEach(function(a){Object.defineProperty(b,a,Object.getOwnPropertyDescriptor(d,a))})},a=1;a<arguments.length;a++)d(a);return b}({id:p(b,a),"aria-selected":e},j(s,"item",0===a&&"itemFirst",e&&"itemHighlighted"),{},t);return e&&(f.ref=l.storeHighlightedItemReference),d.default.createElement(_Item.default,h({},f,{sectionIndex:b,isHighlighted:e,itemIndex:a,item:r,renderItem:m,renderItemData:n}))}))}}],j(a.prototype,b),f&&j(a,f),m}(d.Component);exports.default=b,c(b,"propTypes",{items:a.default.array.isRequired,itemProps:a.default.oneOfType([a.default.object,a.default.func]),renderItem:a.default.func.isRequired,renderItemData:a.default.object.isRequired,sectionIndex:a.default.number,highlightedItemIndex:a.default.number,onHighlightedItemChange:a.default.func.isRequired,getItemId:a.default.func.isRequired,theme:a.default.func.isRequired,keyPrefix:a.default.string.isRequired}),c(b,"defaultProps",{sectionIndex:null}),new b
+"use strict";import*as e from"@swc/helpers";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var d=function(a){if(a&&a.__esModule)return a;if(null===a||"object"!==g(a)&&"function"!=typeof a)return{"default":a};var b=f();if(b&&b.has(a))return b.get(a);var c={},h=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var d in a)if(Object.prototype.hasOwnProperty.call(a,d)){var e=h?Object.getOwnPropertyDescriptor(a,d):null;e&&(e.get||e.set)?Object.defineProperty(c,d,e):c[d]=a[d]}return c.default=a,b&&b.set(a,c),c}(require("react")),a=function(a){return a&&a.__esModule?a:{"default":a}}(require("prop-types"));function f(){if("function"!=typeof WeakMap)return null;var a=new WeakMap;return f=function(){return a},a}function g(a){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a})(a)}function h(){return(h=Object.assign||function(d){for(var a=1;a<arguments.length;a++){var b=arguments[a];for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(d[c]=b[c])}return d}).apply(this,arguments)}function i(c,d){var a=Object.keys(c);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(c);d&&(b=b.filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable})),a.push.apply(a,b)}return a}function j(d,c){for(var b=0;b<c.length;b++){var a=c[b];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(d,a.key,a)}}function k(a){return(k=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)})(a)}function l(a,b){return(l=Object.setPrototypeOf||function(a,b){return a.__proto__=b,a})(a,b)}function c(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}var b=function(n){!function(b,a){if("function"!=typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function");b.prototype=Object.create(a&&a.prototype,{constructor:{value:b,writable:!0,configurable:!0}}),a&&l(b,a)}(m,n);var o,a,b,f,p=(o=m,function(){var c,a,b,d=k(o);if(function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(a){return!1}}()){var e=k(this).constructor;b=Reflect.construct(d,arguments,e)}else b=d.apply(this,arguments);return c=this,(a=b)&&("object"===g(a)||"function"==typeof a)?a:function b(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}(c)});function m(){!function(a,b){if(!e._instanceof(a,b))throw new TypeError("Cannot call a class as a function")}(this,m);for(var b,c=arguments.length,d=new Array(c),a=0;a<c;a++)d[a]=arguments[a];return!function(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}(function(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}(b=p.call.apply(p,[this].concat(d))),"storeHighlightedItemReference",function(a){b.props.onHighlightedItemChange(null===a?null:a.item)}),b}return a=m,b=[{key:"shouldComponentUpdate",value:function(a){return(0,_compareObjects.default)(a,this.props,["itemProps"])}},{key:"render",value:function(){var l=this,a=this.props,f=a.items,g=a.itemProps,m=a.renderItem,n=a.renderItemData,b=a.sectionIndex,o=a.highlightedItemIndex,p=a.getItemId,j=a.theme,e=a.keyPrefix,k=null===b?e:"".concat(e,"section-").concat(b,"-"),q="function"==typeof g;return d.default.createElement("ul",h({role:"listbox"},j("".concat(k,"items-list"),"itemsList")),f.map(function(r,a){var e=a===o,s="".concat(k,"item-").concat(a),t=q?g({sectionIndex:b,itemIndex:a}):g,f=function(b){for(var e=arguments,d=function(a){var d=null!=e[a]?e[a]:{};a%2?i(Object(d),!0).forEach(function(a){c(b,a,d[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(b,Object.getOwnPropertyDescriptors(d)):i(Object(d)).forEach(function(a){Object.defineProperty(b,a,Object.getOwnPropertyDescriptor(d,a))})},a=1;a<arguments.length;a++)d(a);return b}({id:p(b,a),"aria-selected":e},j(s,"item",0===a&&"itemFirst",e&&"itemHighlighted"),{},t);return e&&(f.ref=l.storeHighlightedItemReference),d.default.createElement(_Item.default,h({},f,{sectionIndex:b,isHighlighted:e,itemIndex:a,item:r,renderItem:m,renderItemData:n}))}))}}],j(a.prototype,b),f&&j(a,f),m}(d.Component);exports.default=b,c(b,"propTypes",{items:a.default.array.isRequired,itemProps:a.default.oneOfType([a.default.object,a.default.func]),renderItem:a.default.func.isRequired,renderItemData:a.default.object.isRequired,sectionIndex:a.default.number,highlightedItemIndex:a.default.number,onHighlightedItemChange:a.default.func.isRequired,getItemId:a.default.func.isRequired,theme:a.default.func.isRequired,keyPrefix:a.default.string.isRequired}),c(b,"defaultProps",{sectionIndex:null}),new b
diff --git a/crates/swc/tests/vercel/full/ms/1/output/index.ts b/crates/swc/tests/vercel/full/ms/1/output/index.ts
index fae6b9f159..a483bbaae4 100644
--- a/crates/swc/tests/vercel/full/ms/1/output/index.ts
+++ b/crates/swc/tests/vercel/full/ms/1/output/index.ts
@@ -1,71 +1,72 @@
-export default function(c, e) {
+var a = 86400000, b = 7 * a, c = 365.25 * a;
+export default function(f, h) {
     try {
-        if ("string" == typeof c && c.length > 0) return function(b) {
-            if ((b = String(b)).length > 100) throw new Error("Value exceeds the maximum length of 100 characters.");
-            var c = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(b);
-            if (!c) return NaN;
-            var a = parseFloat(c[1]), d = (c[2] || "ms").toLowerCase();
-            switch(d){
+        if ("string" == typeof f && f.length > 0) return function(e) {
+            if ((e = String(e)).length > 100) throw new Error("Value exceeds the maximum length of 100 characters.");
+            var f = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);
+            if (!f) return NaN;
+            var d = parseFloat(f[1]), g = (f[2] || "ms").toLowerCase();
+            switch(g){
                 case "years":
                 case "year":
                 case "yrs":
                 case "yr":
                 case "y":
-                    return 31557600000 * a;
+                    return d * c;
                 case "weeks":
                 case "week":
                 case "w":
-                    return 604800000 * a;
+                    return d * b;
                 case "days":
                 case "day":
                 case "d":
-                    return 86400000 * a;
+                    return d * a;
                 case "hours":
                 case "hour":
                 case "hrs":
                 case "hr":
                 case "h":
-                    return 3600000 * a;
+                    return 3600000 * d;
                 case "minutes":
                 case "minute":
                 case "mins":
                 case "min":
                 case "m":
-                    return 60000 * a;
+                    return 60000 * d;
                 case "seconds":
                 case "second":
                 case "secs":
                 case "sec":
                 case "s":
-                    return 1000 * a;
+                    return 1000 * d;
                 case "milliseconds":
                 case "millisecond":
                 case "msecs":
                 case "msec":
                 case "ms":
-                    return a;
+                    return d;
                 default:
-                    throw new Error("The unit ".concat(d, " was matched, but no matching case exists."));
+                    throw new Error("The unit ".concat(g, " was matched, but no matching case exists."));
             }
-        }(c);
-        if ("number" == typeof c && isFinite(c)) return (null == e ? void 0 : e.long) ? b(c) : a(c);
+        }(f);
+        if ("number" == typeof f && isFinite(f)) return (null == h ? void 0 : h.long) ? e(f) : d(f);
         throw new Error("Value is not a string or number.");
-    } catch (f) {
-        var g = d(f) ? "".concat(f.message, ". value=").concat(JSON.stringify(c)) : "An unknown error has occurred.";
-        throw new Error(g);
+    } catch (i) {
+        var j = g(i) ? "".concat(i.message, ". value=").concat(JSON.stringify(f)) : "An unknown error has occurred.";
+        throw new Error(j);
     }
 };
-function a(a) {
-    var b = Math.abs(a);
-    return b >= 86400000 ? "".concat(Math.round(a / 86400000), "d") : b >= 3600000 ? "".concat(Math.round(a / 3600000), "h") : b >= 60000 ? "".concat(Math.round(a / 60000), "m") : b >= 1000 ? "".concat(Math.round(a / 1000), "s") : "".concat(a, "ms");
+function d(b) {
+    var c = Math.abs(b);
+    return c >= a ? "".concat(Math.round(b / a), "d") : c >= 3600000 ? "".concat(Math.round(b / 3600000), "h") : c >= 60000 ? "".concat(Math.round(b / 60000), "m") : c >= 1000 ? "".concat(Math.round(b / 1000), "s") : "".concat(b, "ms");
 }
-function b(b) {
-    var a = Math.abs(b);
-    return a >= 86400000 ? c(b, a, 86400000, "day") : a >= 3600000 ? c(b, a, 3600000, "hour") : a >= 60000 ? c(b, a, 60000, "minute") : a >= 1000 ? c(b, a, 1000, "second") : "".concat(b, " ms");
+function e(c) {
+    var b = Math.abs(c);
+    return b >= a ? f(c, b, a, "day") : b >= 3600000 ? f(c, b, 3600000, "hour") : b >= 60000 ? f(c, b, 60000, "minute") : b >= 1000 ? f(c, b, 1000, "second") : "".concat(c, " ms");
 }
-function c(b, c, a, d) {
+function f(b, c, a, d) {
     return "".concat(Math.round(b / a), " ").concat(d).concat(c >= 1.5 * a ? "s" : "");
 }
-function d(a) {
+function g(a) {
     return "object" == typeof a && null !== a && "message" in a;
 }
diff --git a/crates/swc/tests/vercel/full/react-instantsearch/2/output/index.js b/crates/swc/tests/vercel/full/react-instantsearch/2/output/index.js
index 6024d1f19f..7f0c654845 100644
--- a/crates/swc/tests/vercel/full/react-instantsearch/2/output/index.js
+++ b/crates/swc/tests/vercel/full/react-instantsearch/2/output/index.js
@@ -37,7 +37,7 @@ export default function n(e) {
             return !i(a) && !k(a);
         }).reduce(function(a, b) {
             return b.getSearchParameters(a);
-        }, G), c = x.getWidgets().filter(function(a) {
+        }, H), c = x.getWidgets().filter(function(a) {
             return Boolean(a.getSearchParameters);
         }).filter(function(a) {
             var b = i(a) && j(a, p), c = k(a) && l(a, p);
@@ -65,7 +65,7 @@ export default function n(e) {
             derivedParameters: e
         };
     }, B = function() {
-        if (!E) {
+        if (!F) {
             var a = s(r.state), b = a.mainParameters, c = a.derivedParameters;
             r.derivedHelpers.slice().forEach(function(a) {
                 a.detach();
@@ -84,7 +84,7 @@ export default function n(e) {
             var f = y.getState(), g = !r.derivedHelpers.length, b = f.results ? f.results : {};
             b = !g && b.getFacetByName ? {} : b, b = g ? e.results : a.objectSpread({}, b, a.defineProperty({}, c, e.results));
             var d = y.getState(), h = d.isSearchStalled;
-            r.hasPendingRequests() || (clearTimeout(F), F = null, h = !1), d.resultsFacetValues;
+            r.hasPendingRequests() || (clearTimeout(G), G = null, h = !1), d.resultsFacetValues;
             var i = a.objectWithoutProperties(d, [
                 "resultsFacetValues"
             ]);
@@ -97,7 +97,7 @@ export default function n(e) {
         };
     }, u = function(d) {
         var e = d.error, b = y.getState(), c = b.isSearchStalled;
-        r.hasPendingRequests() || (clearTimeout(F), c = !1), b.resultsFacetValues;
+        r.hasPendingRequests() || (clearTimeout(G), c = !1), b.resultsFacetValues;
         var f = a.objectWithoutProperties(b, [
             "resultsFacetValues"
         ]);
@@ -172,7 +172,7 @@ export default function n(e) {
         })));
     }, r = b(g, p, a.objectSpread({}, d));
     h(g), r.on("search", function() {
-        F || (F = setTimeout(function() {
+        !G && (G = setTimeout(function() {
             var b = y.getState(), c = (b.resultsFacetValues, a.objectWithoutProperties(b, [
                 "resultsFacetValues"
             ]));
@@ -183,7 +183,7 @@ export default function n(e) {
     }).on("result", t({
         indexId: p
     })).on("error", u);
-    var f, v, w, E = !1, F = null, G = r.state, x = c(function() {
+    var f, E, v, w, F = !1, G = null, H = r.state, x = c(function() {
         var b = A(y.getState().widgets);
         y.setState(a.objectSpread({}, y.getState(), {
             metadata: b,
@@ -307,13 +307,13 @@ export default function n(e) {
             h(a), r.setClient(a), B();
         },
         updateIndex: function(a) {
-            G = G.setIndex(a);
+            H = H.setIndex(a);
         },
         clearCache: function() {
             r.clearCache(), B();
         },
         skipSearch: function() {
-            E = !0;
+            F = !0;
         }
     };
 };
diff --git a/crates/swc_ecma_minifier/tests/compress.rs b/crates/swc_ecma_minifier/tests/compress.rs
index 9c89a3eb9b..4935983f89 100644
--- a/crates/swc_ecma_minifier/tests/compress.rs
+++ b/crates/swc_ecma_minifier/tests/compress.rs
@@ -108,6 +108,9 @@ impl TestMangleOptions {
 struct TestOptions {
     #[serde(default)]
     defaults: bool,
+
+    #[serde(default)]
+    passes: usize,
 }
 
 fn parse_compressor_config(cm: Lrc<SourceMap>, s: &str) -> (bool, CompressOptions) {
@@ -118,6 +121,7 @@ fn parse_compressor_config(cm: Lrc<SourceMap>, s: &str) -> (bool, CompressOption
 
     c.defaults = opts.defaults;
     c.const_to_let = Some(false);
+    c.passes = opts.passes;
 
     (c.module, c.into_config(cm))
 }
diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/issues/config.json b/crates/swc_ecma_minifier/tests/compress/fixture/issues/config.json
index 0804f8f8b5..ac4e89404c 100644
--- a/crates/swc_ecma_minifier/tests/compress/fixture/issues/config.json
+++ b/crates/swc_ecma_minifier/tests/compress/fixture/issues/config.json
@@ -1,4 +1,5 @@
 {
     "defaults": true,
-    "toplevel": true
+    "toplevel": true,
+    "passes": 0
 }