diff --git a/crates/swc/src/builder.rs b/crates/swc/src/builder.rs index 2c0780bf671..3a8e5d9f892 100644 --- a/crates/swc/src/builder.rs +++ b/crates/swc/src/builder.rs @@ -24,9 +24,9 @@ use swc_ecma_transforms::{ modules, optimization::const_modules, pass::Optional, - Assumptions, + resolver, Assumptions, }; -use swc_ecma_visit::{as_folder, noop_visit_mut_type, VisitMut}; +use swc_ecma_visit::{as_folder, noop_visit_mut_type, VisitMut, VisitMutWith}; use crate::config::{CompiledPaths, GlobalPassOption, JsMinifyOptions, ModuleConfig}; @@ -408,6 +408,13 @@ impl VisitMut for MinifierPass { return; } + m.visit_mut_with(&mut hygiene()); + m.visit_mut_with(&mut resolver( + self.unresolved_mark, + self.top_level_mark, + false, + )); + m.map_with_mut(|m| { swc_ecma_minifier::optimize( m.into(), diff --git a/crates/swc/tests/fixture/issues-2xxx/2988/output/index.ts b/crates/swc/tests/fixture/issues-2xxx/2988/output/index.ts index d820d1b4edf..63ff6d30fda 100644 --- a/crates/swc/tests/fixture/issues-2xxx/2988/output/index.ts +++ b/crates/swc/tests/fixture/issues-2xxx/2988/output/index.ts @@ -1,15 +1,15 @@ export var Test; (function(t) { let e; - (function(e) { - e["Test"] = "1"; - e["Test2"] = "2"; - e["Test3"] = "3"; + (function(t) { + t["Test"] = "1"; + t["Test2"] = "2"; + t["Test3"] = "3"; })(e = t.testEnum || (t.testEnum = {})); let s; - (function(s) { - s["Test"] = "1"; - s["Test2"] = "2"; - s["Test3"] = "3"; + (function(t) { + t["Test"] = "1"; + t["Test2"] = "2"; + t["Test3"] = "3"; })(s = t.testEnum2 || (t.testEnum2 = {})); })(Test || (Test = {})); diff --git a/crates/swc/tests/fixture/issues-6xxx/6791/1/input/.swcrc b/crates/swc/tests/fixture/issues-6xxx/6791/1/input/.swcrc new file mode 100644 index 00000000000..18ad5ab7fea --- /dev/null +++ b/crates/swc/tests/fixture/issues-6xxx/6791/1/input/.swcrc @@ -0,0 +1,71 @@ +{ + "jsc": { + "parser": { + "syntax": "typescript", + "tsx": false + }, + "target": "es2022", + "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": true, + "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": { + "toplevel": true, + "keep_classnames": false, + "keep_fnames": false, + "keep_private_props": false, + "ie8": false, + "safari10": false + } + } + }, + "module": { + "type": "es6" + }, + "minify": false, + "isModule": true +} \ No newline at end of file diff --git a/crates/swc/tests/fixture/issues-6xxx/6791/1/input/input.ts b/crates/swc/tests/fixture/issues-6xxx/6791/1/input/input.ts new file mode 100644 index 00000000000..1111062e915 --- /dev/null +++ b/crates/swc/tests/fixture/issues-6xxx/6791/1/input/input.ts @@ -0,0 +1,7 @@ +import { test } from "test"; + +enum Test { + "Hello" = "World!", +} + +test(Test["Hello"]) diff --git a/crates/swc/tests/fixture/issues-6xxx/6791/1/output/input.ts b/crates/swc/tests/fixture/issues-6xxx/6791/1/output/input.ts new file mode 100644 index 00000000000..2ad0bccdc1a --- /dev/null +++ b/crates/swc/tests/fixture/issues-6xxx/6791/1/output/input.ts @@ -0,0 +1,3 @@ +var l; +import { test as o } from "test"; +(l || (l = {})).Hello = "World!", o(l.Hello); diff --git a/crates/swc/tests/fixture/sourcemap/003/output/index.js b/crates/swc/tests/fixture/sourcemap/003/output/index.js index db632fcc96f..9ef87719796 100644 --- a/crates/swc/tests/fixture/sourcemap/003/output/index.js +++ b/crates/swc/tests/fixture/sourcemap/003/output/index.js @@ -1 +1 @@ -import r from"@swc/helpers/src/_async_to_generator.mjs";import t from"@swc/helpers/src/_ts_generator.mjs";export default function e(r){var t=r.data;return React.createElement("div",null,t.foo)}export function getStaticProps(){return n.apply(this,arguments)}function n(){return(n=r(function(){return t(this,function(r){return[2,{props:{data:{foo:"bar"}}}]})})).apply(this,arguments)} +import t from"@swc/helpers/src/_async_to_generator.mjs";import r from"@swc/helpers/src/_ts_generator.mjs";export default function e(t){var r=t.data;return React.createElement("div",null,r.foo)}export function getStaticProps(){return n.apply(this,arguments)}function n(){return(n=t(function(){return r(this,function(t){return[2,{props:{data:{foo:"bar"}}}]})})).apply(this,arguments)} diff --git a/crates/swc/tests/tsc-references/ES5For-of17.2.minified.js b/crates/swc/tests/tsc-references/ES5For-of17.2.minified.js index 4a5b7ea0426..1ad1b59589a 100644 --- a/crates/swc/tests/tsc-references/ES5For-of17.2.minified.js +++ b/crates/swc/tests/tsc-references/ES5For-of17.2.minified.js @@ -2,9 +2,9 @@ for(var _i = 0, _iter = []; _i < _iter.length; _i++){ _iter[_i]; for(var _i1 = 0, _iter1 = [ - _$v + _$v1 ]; _i1 < _iter1.length; _i1++){ - var _$v = _iter1[_i1]; - _$v++; + var _$v1 = _iter1[_i1]; + _$v1++; } } diff --git a/crates/swc/tests/tsc-references/InvalidNonInstantiatedModule.2.minified.js b/crates/swc/tests/tsc-references/InvalidNonInstantiatedModule.2.minified.js index f72d5afa282..e3992c216ff 100644 --- a/crates/swc/tests/tsc-references/InvalidNonInstantiatedModule.2.minified.js +++ b/crates/swc/tests/tsc-references/InvalidNonInstantiatedModule.2.minified.js @@ -1 +1,2 @@ //// [InvalidNonInstantiatedModule.ts] +M; diff --git a/crates/swc/tests/tsc-references/anonymousDefaultExportsUmd.2.minified.js b/crates/swc/tests/tsc-references/anonymousDefaultExportsUmd.2.minified.js index a9e190f5427..8d6ef4585c1 100644 --- a/crates/swc/tests/tsc-references/anonymousDefaultExportsUmd.2.minified.js +++ b/crates/swc/tests/tsc-references/anonymousDefaultExportsUmd.2.minified.js @@ -3,11 +3,11 @@ "object" == typeof module && "object" == typeof module.exports ? factory(exports) : "function" == typeof define && define.amd ? define([ "exports" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.aTs = {}); -}(this, function(exports) { +}(this, function(exports1) { "use strict"; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 - }), Object.defineProperty(exports, "default", { + }), Object.defineProperty(exports1, "default", { enumerable: !0, get: ()=>_default }); @@ -19,12 +19,12 @@ "object" == typeof module && "object" == typeof module.exports ? factory(exports) : "function" == typeof define && define.amd ? define([ "exports" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.bTs = {}); -}(this, function(exports) { +}(this, function(exports1) { "use strict"; function _default() {} - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 - }), Object.defineProperty(exports, "default", { + }), Object.defineProperty(exports1, "default", { enumerable: !0, get: ()=>_default }); diff --git a/crates/swc/tests/tsc-references/asOpEmitParens.2.minified.js b/crates/swc/tests/tsc-references/asOpEmitParens.2.minified.js index 679082f3999..97ced9df0a6 100644 --- a/crates/swc/tests/tsc-references/asOpEmitParens.2.minified.js +++ b/crates/swc/tests/tsc-references/asOpEmitParens.2.minified.js @@ -1,2 +1,2 @@ //// [asOpEmitParens.ts] -x.y, new (x()); +x, x.y, new (x()); diff --git a/crates/swc/tests/tsc-references/asOperator3.2.minified.js b/crates/swc/tests/tsc-references/asOperator3.2.minified.js index 2631acf41c7..b58abd8053d 100644 --- a/crates/swc/tests/tsc-references/asOperator3.2.minified.js +++ b/crates/swc/tests/tsc-references/asOperator3.2.minified.js @@ -5,7 +5,7 @@ function _templateObject() { "Hello ", " World" ]); - return _templateObject = function _templateObject() { + return _templateObject = function() { return data; }, data; } @@ -13,7 +13,7 @@ function _templateObject1() { var data = _tagged_template_literal([ "Hello" ]); - return _templateObject1 = function _templateObject1() { + return _templateObject1 = function() { return data; }, data; } diff --git a/crates/swc/tests/tsc-references/asOperatorASI.2.minified.js b/crates/swc/tests/tsc-references/asOperatorASI.2.minified.js index 6caeb37a504..2c3486fbe83 100644 --- a/crates/swc/tests/tsc-references/asOperatorASI.2.minified.js +++ b/crates/swc/tests/tsc-references/asOperatorASI.2.minified.js @@ -5,7 +5,7 @@ function _templateObject() { var data = _tagged_template_literal([ "Hello world" ]); - return _templateObject = function _templateObject() { + return _templateObject = function() { return data; }, data; } diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithDiscriminatedUnion.2.minified.js b/crates/swc/tests/tsc-references/assignmentCompatWithDiscriminatedUnion.2.minified.js index e9fc7fe5d1c..6ea75597475 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithDiscriminatedUnion.2.minified.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithDiscriminatedUnion.2.minified.js @@ -1,14 +1,14 @@ //// [assignmentCompatWithDiscriminatedUnion.ts] var Example1, Example2, Example3, Example4, Example5, GH14865, GH30170, GH12052, GH18421, GH15907, GH20889, GH39357; Example1 || (Example1 = {}), t = s, Example2 || (Example2 = {}), t = s, Example3 || (Example3 = {}), t = s, Example4 || (Example4 = {}), t = s, Example5 || (Example5 = {}), t = s, function(GH14865) { - var b, a = { + var b1, a = { type: "A", data: "whatevs" }; - a.type, b.type, b = a; + a.type, b1.type, b1 = a; }(GH14865 || (GH14865 = {})), GH30170 || (GH30170 = {}), function(GH12052) { var getAxisType = function() { return "categorical"; }; getAxisType(), getAxisType(); -}(GH12052 || (GH12052 = {})), GH18421 || (GH18421 = {}), GH15907 || (GH15907 = {}), GH20889 || (GH20889 = {}), GH39357 || (GH39357 = {}); +}(GH12052 || (GH12052 = {})), GH18421 || (GH18421 = {}), GH15907 || (GH15907 = {}), GH20889 || (GH20889 = {}), GH39357 || (GH39357 = {}), ("a" === b || "b" === b) && b; diff --git a/crates/swc/tests/tsc-references/callChain.2.minified.js b/crates/swc/tests/tsc-references/callChain.2.minified.js index df0350c8775..4a6df3c18af 100644 --- a/crates/swc/tests/tsc-references/callChain.2.minified.js +++ b/crates/swc/tests/tsc-references/callChain.2.minified.js @@ -1,5 +1,5 @@ //// [callChain.ts] -var _o2, _o21, _o22, _o23, _o3_b, _o3_b1, _o3_b2, _o3_b3, _o3_b4, _o3_b5, _o3_b6, _o3_b7, _o3_b8, _o3_b9, _o3_b10, _o3_b11, _o5; +var _o2, _o21, _o22, _o23, _o3_b6, _o3_b7, _o3_b8, _o3_b9, _o3_b10, _o3_b11, _o3_b12, _o3_b13, _o3_b14, _o3_b15, _o3_b16, _o3_b17, _o5; null == o1 || o1(), null == o1 || o1(1), null == o1 || o1.apply(void 0, [ 1, 2 @@ -24,31 +24,31 @@ null == o1 || o1(), null == o1 || o1(1), null == o1 || o1.apply(void 0, [ 2, 3, 4 -]), null === (_o3_b = o3.b) || void 0 === _o3_b || _o3_b.call(o3).c, null === (_o3_b1 = o3.b) || void 0 === _o3_b1 || _o3_b1.call(o3, 1).c, null === (_o3_b2 = o3.b) || void 0 === _o3_b2 || _o3_b2.call.apply(_o3_b2, [ +]), null === (_o3_b6 = o3.b) || void 0 === _o3_b6 || _o3_b6.call(o3).c, null === (_o3_b7 = o3.b) || void 0 === _o3_b7 || _o3_b7.call(o3, 1).c, null === (_o3_b8 = o3.b) || void 0 === _o3_b8 || _o3_b8.call.apply(_o3_b8, [ o3, 1, 2 -]).c, null === (_o3_b3 = o3.b) || void 0 === _o3_b3 || _o3_b3.call.apply(_o3_b3, [ +]).c, null === (_o3_b9 = o3.b) || void 0 === _o3_b9 || _o3_b9.call.apply(_o3_b9, [ o3, 1, 2, 3, 4 -]).c, null === (_o3_b4 = o3.b) || void 0 === _o3_b4 || _o3_b4.call(o3).c, null === (_o3_b5 = o3.b) || void 0 === _o3_b5 || _o3_b5.call(o3, 1).c, null === (_o3_b6 = o3.b) || void 0 === _o3_b6 || _o3_b6.call.apply(_o3_b6, [ +]).c, null === (_o3_b10 = o3.b) || void 0 === _o3_b10 || _o3_b10.call(o3).c, null === (_o3_b11 = o3.b) || void 0 === _o3_b11 || _o3_b11.call(o3, 1).c, null === (_o3_b12 = o3.b) || void 0 === _o3_b12 || _o3_b12.call.apply(_o3_b12, [ o3, 1, 2 -]).c, null === (_o3_b7 = o3.b) || void 0 === _o3_b7 || _o3_b7.call.apply(_o3_b7, [ +]).c, null === (_o3_b13 = o3.b) || void 0 === _o3_b13 || _o3_b13.call.apply(_o3_b13, [ o3, 1, 2, 3, 4 -]).c, null === (_o3_b8 = o3.b) || void 0 === _o3_b8 || _o3_b8.call(o3).c, null === (_o3_b9 = o3.b) || void 0 === _o3_b9 || _o3_b9.call(o3, 1).c, null === (_o3_b10 = o3.b) || void 0 === _o3_b10 || _o3_b10.call.apply(_o3_b10, [ +]).c, null === (_o3_b14 = o3.b) || void 0 === _o3_b14 || _o3_b14.call(o3).c, null === (_o3_b15 = o3.b) || void 0 === _o3_b15 || _o3_b15.call(o3, 1).c, null === (_o3_b16 = o3.b) || void 0 === _o3_b16 || _o3_b16.call.apply(_o3_b16, [ o3, 1, 2 -]).c, null === (_o3_b11 = o3.b) || void 0 === _o3_b11 || _o3_b11.call.apply(_o3_b11, [ +]).c, null === (_o3_b17 = o3.b) || void 0 === _o3_b17 || _o3_b17.call.apply(_o3_b17, [ o3, 1, 2, diff --git a/crates/swc/tests/tsc-references/checkJsxGenericTagHasCorrectInferences.2.minified.js b/crates/swc/tests/tsc-references/checkJsxGenericTagHasCorrectInferences.2.minified.js index 59d9210694e..906d4b27fe2 100644 --- a/crates/swc/tests/tsc-references/checkJsxGenericTagHasCorrectInferences.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsxGenericTagHasCorrectInferences.2.minified.js @@ -1,2 +1,3 @@ //// [file.tsx] import * as React from "react"; +GenericComponent, GenericComponent, GenericComponent, GenericComponent; diff --git a/crates/swc/tests/tsc-references/classExtendsItself.2.minified.js b/crates/swc/tests/tsc-references/classExtendsItself.2.minified.js index 65c01bf5e2d..b5709b956a0 100644 --- a/crates/swc/tests/tsc-references/classExtendsItself.2.minified.js +++ b/crates/swc/tests/tsc-references/classExtendsItself.2.minified.js @@ -2,3 +2,4 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; +C1, D1, E1; diff --git a/crates/swc/tests/tsc-references/classStaticBlock24(module=umd).2.minified.js b/crates/swc/tests/tsc-references/classStaticBlock24(module=umd).2.minified.js index 7f84bacc0be..1b892199c4c 100644 --- a/crates/swc/tests/tsc-references/classStaticBlock24(module=umd).2.minified.js +++ b/crates/swc/tests/tsc-references/classStaticBlock24(module=umd).2.minified.js @@ -4,11 +4,11 @@ "exports", "@swc/helpers/src/_class_call_check.mjs" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.classStaticBlock24Ts = {}, global.classCallCheckMjs); -}(this, function(exports, _classCallCheck) { +}(this, function(exports1, _classCallCheck) { "use strict"; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 - }), Object.defineProperty(exports, "C", { + }), Object.defineProperty(exports1, "C", { enumerable: !0, get: function() { return C; diff --git a/crates/swc/tests/tsc-references/commonTypeIntersection.2.minified.js b/crates/swc/tests/tsc-references/commonTypeIntersection.2.minified.js index 592a51a791e..281bd442c0b 100644 --- a/crates/swc/tests/tsc-references/commonTypeIntersection.2.minified.js +++ b/crates/swc/tests/tsc-references/commonTypeIntersection.2.minified.js @@ -1 +1,2 @@ //// [commonTypeIntersection.ts] +x1, x2; diff --git a/crates/swc/tests/tsc-references/comparisonOperatorWithIntersectionType.2.minified.js b/crates/swc/tests/tsc-references/comparisonOperatorWithIntersectionType.2.minified.js index 9da6da94d55..9523c9c2c1f 100644 --- a/crates/swc/tests/tsc-references/comparisonOperatorWithIntersectionType.2.minified.js +++ b/crates/swc/tests/tsc-references/comparisonOperatorWithIntersectionType.2.minified.js @@ -1 +1,2 @@ //// [comparisonOperatorWithIntersectionType.ts] +a, b; diff --git a/crates/swc/tests/tsc-references/compoundExponentiationAssignmentLHSCanBeAssigned1.2.minified.js b/crates/swc/tests/tsc-references/compoundExponentiationAssignmentLHSCanBeAssigned1.2.minified.js index afdaf334247..00377112b50 100644 --- a/crates/swc/tests/tsc-references/compoundExponentiationAssignmentLHSCanBeAssigned1.2.minified.js +++ b/crates/swc/tests/tsc-references/compoundExponentiationAssignmentLHSCanBeAssigned1.2.minified.js @@ -2,4 +2,4 @@ var E, a, b, c, x1, x2, x3; !function(E) { E[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c"; -}(E || (E = {})), x1 = Math.pow(x1, a), x1 = Math.pow(x1, b), x1 = Math.pow(x1, c), x1 = Math.pow(x1, null), x1 = Math.pow(x1, void 0), x2 = Math.pow(x2, a), x2 = Math.pow(x2, b), x2 = Math.pow(x2, c), x2 = Math.pow(x2, null), x2 = Math.pow(x2, void 0), x3 = Math.pow(x3, a), x3 = Math.pow(x3, b), x3 = Math.pow(x3, c), x3 = Math.pow(x3, null), x3 = Math.pow(x3, void 0); +}(E || (E = {})), x1 = Math.pow(x1 = Math.pow(x1 = Math.pow(x1 = Math.pow(x1 = Math.pow(x1, a), b), c), null), void 0), x2 = Math.pow(x2 = Math.pow(x2 = Math.pow(x2 = Math.pow(x2 = Math.pow(x2, a), b), c), null), void 0), x3 = Math.pow(x3 = Math.pow(x3 = Math.pow(x3 = Math.pow(x3 = Math.pow(x3, a), b), c), null), void 0); diff --git a/crates/swc/tests/tsc-references/compoundExponentiationAssignmentLHSCannotBeAssigned.2.minified.js b/crates/swc/tests/tsc-references/compoundExponentiationAssignmentLHSCannotBeAssigned.2.minified.js index 8bd643049ba..3ee1677269f 100644 --- a/crates/swc/tests/tsc-references/compoundExponentiationAssignmentLHSCannotBeAssigned.2.minified.js +++ b/crates/swc/tests/tsc-references/compoundExponentiationAssignmentLHSCannotBeAssigned.2.minified.js @@ -2,4 +2,4 @@ var E, a, b, x1, x2, x3, x4, x5, x6; !function(E) { E[E.a = 0] = "a", E[E.b = 1] = "b"; -}(E || (E = {})), x1 = Math.pow(x1, a), x1 = Math.pow(x1, b), x1 = Math.pow(x1, !0), x1 = Math.pow(x1, 0), x1 = Math.pow(x1, ""), x1 = Math.pow(x1, E.a), x1 = Math.pow(x1, {}), x1 = Math.pow(x1, null), x1 = Math.pow(x1, void 0), x2 = Math.pow(x2, a), x2 = Math.pow(x2, b), x2 = Math.pow(x2, !0), x2 = Math.pow(x2, 0), x2 = Math.pow(x2, ""), x2 = Math.pow(x2, E.a), x2 = Math.pow(x2, {}), x2 = Math.pow(x2, null), x2 = Math.pow(x2, void 0), x3 = Math.pow(x3, a), x3 = Math.pow(x3, b), x3 = Math.pow(x3, !0), x3 = Math.pow(x3, 0), x3 = Math.pow(x3, ""), x3 = Math.pow(x3, E.a), x3 = Math.pow(x3, {}), x3 = Math.pow(x3, null), x3 = Math.pow(x3, void 0), x4 = Math.pow(x4, a), x4 = Math.pow(x4, b), x4 = Math.pow(x4, !0), x4 = Math.pow(x4, 0), x4 = Math.pow(x4, ""), x4 = Math.pow(x4, E.a), x4 = Math.pow(x4, {}), x4 = Math.pow(x4, null), x4 = Math.pow(x4, void 0), x5 = Math.pow(x5, b), x5 = Math.pow(x5, !0), x5 = Math.pow(x5, ""), x5 = Math.pow(x5, {}), x6 = Math.pow(x6, b), x6 = Math.pow(x6, !0), x6 = Math.pow(x6, ""), x6 = Math.pow(x6, {}); +}(E || (E = {})), x1 = Math.pow(x1 = Math.pow(x1 = Math.pow(x1 = Math.pow(x1 = Math.pow(x1 = Math.pow(x1 = Math.pow(x1 = Math.pow(x1 = Math.pow(x1, a), b), !0), 0), ""), E.a), {}), null), void 0), x2 = Math.pow(x2 = Math.pow(x2 = Math.pow(x2 = Math.pow(x2 = Math.pow(x2 = Math.pow(x2 = Math.pow(x2 = Math.pow(x2 = Math.pow(x2, a), b), !0), 0), ""), E.a), {}), null), void 0), x3 = Math.pow(x3 = Math.pow(x3 = Math.pow(x3 = Math.pow(x3 = Math.pow(x3 = Math.pow(x3 = Math.pow(x3 = Math.pow(x3 = Math.pow(x3, a), b), !0), 0), ""), E.a), {}), null), void 0), x4 = Math.pow(x4 = Math.pow(x4 = Math.pow(x4 = Math.pow(x4 = Math.pow(x4 = Math.pow(x4 = Math.pow(x4 = Math.pow(x4 = Math.pow(x4, a), b), !0), 0), ""), E.a), {}), null), void 0), x5 = Math.pow(x5 = Math.pow(x5 = Math.pow(x5 = Math.pow(x5, b), !0), ""), {}), x6 = Math.pow(x6 = Math.pow(x6 = Math.pow(x6 = Math.pow(x6, b), !0), ""), {}); diff --git a/crates/swc/tests/tsc-references/constAssertions.2.minified.js b/crates/swc/tests/tsc-references/constAssertions.2.minified.js index a03509d21e3..28d76367b15 100644 --- a/crates/swc/tests/tsc-references/constAssertions.2.minified.js +++ b/crates/swc/tests/tsc-references/constAssertions.2.minified.js @@ -2,4 +2,4 @@ function ff2(x, y) { return `${x}-${y}`; } -id(1), ff2('foo', 'bar'), ff2('foo', '0'), ff2('top', 'left'); +d, id(1), ff2('foo', 'bar'), ff2('foo', '0'), ff2('top', 'left'); diff --git a/crates/swc/tests/tsc-references/controlFlowForInStatement2.2.minified.js b/crates/swc/tests/tsc-references/controlFlowForInStatement2.2.minified.js index 0b7ce6f3397..7bc2691ef7d 100644 --- a/crates/swc/tests/tsc-references/controlFlowForInStatement2.2.minified.js +++ b/crates/swc/tests/tsc-references/controlFlowForInStatement2.2.minified.js @@ -1 +1,2 @@ //// [controlFlowForInStatement2.ts] +"a" in c && c, "a" in c && c, "b" in c && c, "b" in c && c; diff --git a/crates/swc/tests/tsc-references/controlFlowInOperator.2.minified.js b/crates/swc/tests/tsc-references/controlFlowInOperator.2.minified.js index e72c7309ae4..ab770409de0 100644 --- a/crates/swc/tests/tsc-references/controlFlowInOperator.2.minified.js +++ b/crates/swc/tests/tsc-references/controlFlowInOperator.2.minified.js @@ -1,2 +1,2 @@ //// [controlFlowInOperator.ts] -"a" in c && c.a, "a" in c && c.a; +"a" in c && (c, c.a), "d" in c && c, "a" in c && (c, c.a), "d" in c && c; diff --git a/crates/swc/tests/tsc-references/controlFlowNullishCoalesce.2.minified.js b/crates/swc/tests/tsc-references/controlFlowNullishCoalesce.2.minified.js index 7959c40e1c5..56084f302b4 100644 --- a/crates/swc/tests/tsc-references/controlFlowNullishCoalesce.2.minified.js +++ b/crates/swc/tests/tsc-references/controlFlowNullishCoalesce.2.minified.js @@ -1,3 +1,3 @@ //// [controlFlowNullishCoalesce.ts] var a; -null != o || (a = 1), a.toString(); +null != o ? o : a = 1, a.toString(), null == o || o; diff --git a/crates/swc/tests/tsc-references/controlFlowOptionalChain.2.minified.js b/crates/swc/tests/tsc-references/controlFlowOptionalChain.2.minified.js index 7a2fb3ec1c7..7b33d264cc2 100644 --- a/crates/swc/tests/tsc-references/controlFlowOptionalChain.2.minified.js +++ b/crates/swc/tests/tsc-references/controlFlowOptionalChain.2.minified.js @@ -4,7 +4,7 @@ import _type_of from "@swc/helpers/src/_type_of.mjs"; function someFunction(someOptionalObject) { (null == someOptionalObject ? void 0 : someOptionalObject.someProperty) !== lastSomeProperty && (console.log(someOptionalObject), console.log(someOptionalObject.someProperty), lastSomeProperty = null == someOptionalObject ? void 0 : someOptionalObject.someProperty); } -null == o || o[a = 1], a.toString(), null == o || o.x[b = 1], b.toString(), null == o || o(c = 1), c.toString(), null == o || o.x(d = 1), d.toString(), null == f || f(x), f(x), f(x), (null == o2 ? void 0 : o2.f(x)) ? (o2.f, null == o2 || o2.f, null == o2 || o2.f(x)) : (null == o2 || o2.f, o2.f), null == o2 || o2.f, o2.f, (null == o3 ? void 0 : o3.x) === 1 ? (o3.x, null == o3 || o3.x) : (null == o3 || o3.x, o3.x), null == o3 || o3.x, o3.x, (null === (_o4_x = o4.x) || void 0 === _o4_x ? void 0 : _o4_x.y) ? (o4.x, o4.x.y, null === (_o4_x2 = o4.x) || void 0 === _o4_x2 || _o4_x2.y) : (o4.x, null === (_o4_x3 = o4.x) || void 0 === _o4_x3 || _o4_x3.y, o4.x.y), o4.x, null === (_o4_x1 = o4.x) || void 0 === _o4_x1 || _o4_x1.y, o4.x.y, (null === (_o5_x_y_z = null === (_o5_x = o5.x) || void 0 === _o5_x ? void 0 : _o5_x.y.z) || void 0 === _o5_x_y_z ? void 0 : _o5_x_y_z.w) ? (o5.x, o5.x.y, o5.x.y.z, o5.x.y.z.w, null === (_o5_x_y_z2 = o5.x.y.z) || void 0 === _o5_x_y_z2 || _o5_x_y_z2.w, null === (_o5_x4 = o5.x) || void 0 === _o5_x4 || _o5_x4.y.z.w, null === (_o5_x_y_z3 = null === (_o5_x5 = o5.x) || void 0 === _o5_x5 ? void 0 : _o5_x5.y.z) || void 0 === _o5_x_y_z3 || _o5_x_y_z3.w) : (o5.x, null === (_o5_x6 = o5.x) || void 0 === _o5_x6 || _o5_x6.y, null === (_o5_x7 = o5.x) || void 0 === _o5_x7 || _o5_x7.y.z, null === (_o5_x_y_z4 = null === (_o5_x8 = o5.x) || void 0 === _o5_x8 ? void 0 : _o5_x8.y.z) || void 0 === _o5_x_y_z4 || _o5_x_y_z4.w, o5.x.y, o5.x.y.z.w), o5.x, null === (_o5_x1 = o5.x) || void 0 === _o5_x1 || _o5_x1.y, null === (_o5_x2 = o5.x) || void 0 === _o5_x2 || _o5_x2.y.z, null === (_o5_x_y_z1 = null === (_o5_x3 = o5.x) || void 0 === _o5_x3 ? void 0 : _o5_x3.y.z) || void 0 === _o5_x_y_z1 || _o5_x_y_z1.w, o5.x.y, o5.x.y.z.w, (null == o6 ? void 0 : o6.f()) || null == o6 || o6.f, o6.f, null == o6 || o6.f, o6.f, someFunction({ +null == o || o[a = 1], a.toString(), null == o || o.x[b = 1], b.toString(), null == o || o(c = 1), c.toString(), null == o || o.x(d = 1), d.toString(), null == f || f(x), x, f, f(x), x, f, f(x), (null == o2 ? void 0 : o2.f(x)) ? (x, o2.f, null == o2 || o2.f, null == o2 || o2.f(x)) : (x, o2, null == o2 || o2.f, o2.f), x, o2, null == o2 || o2.f, o2.f, (null == o3 ? void 0 : o3.x) === 1 ? (o3, o3.x, null == o3 || o3.x) : (o3, null == o3 || o3.x, o3.x), o3, null == o3 || o3.x, o3.x, (null === (_o4_x = o4.x) || void 0 === _o4_x ? void 0 : _o4_x.y) ? (o4.x, o4.x.y, null === (_o4_x2 = o4.x) || void 0 === _o4_x2 || _o4_x2.y) : (o4.x, null === (_o4_x3 = o4.x) || void 0 === _o4_x3 || _o4_x3.y, o4.x.y), o4.x, null === (_o4_x1 = o4.x) || void 0 === _o4_x1 || _o4_x1.y, o4.x.y, (null === (_o5_x_y_z = null === (_o5_x = o5.x) || void 0 === _o5_x ? void 0 : _o5_x.y.z) || void 0 === _o5_x_y_z ? void 0 : _o5_x_y_z.w) ? (o5.x, o5.x.y, o5.x.y.z, o5.x.y.z.w, null === (_o5_x_y_z2 = o5.x.y.z) || void 0 === _o5_x_y_z2 || _o5_x_y_z2.w, null === (_o5_x4 = o5.x) || void 0 === _o5_x4 || _o5_x4.y.z.w, null === (_o5_x_y_z3 = null === (_o5_x5 = o5.x) || void 0 === _o5_x5 ? void 0 : _o5_x5.y.z) || void 0 === _o5_x_y_z3 || _o5_x_y_z3.w) : (o5.x, null === (_o5_x6 = o5.x) || void 0 === _o5_x6 || _o5_x6.y, null === (_o5_x7 = o5.x) || void 0 === _o5_x7 || _o5_x7.y.z, null === (_o5_x_y_z4 = null === (_o5_x8 = o5.x) || void 0 === _o5_x8 ? void 0 : _o5_x8.y.z) || void 0 === _o5_x_y_z4 || _o5_x_y_z4.w, o5.x.y, o5.x.y.z.w), o5.x, null === (_o5_x1 = o5.x) || void 0 === _o5_x1 || _o5_x1.y, null === (_o5_x2 = o5.x) || void 0 === _o5_x2 || _o5_x2.y.z, null === (_o5_x_y_z1 = null === (_o5_x3 = o5.x) || void 0 === _o5_x3 ? void 0 : _o5_x3.y.z) || void 0 === _o5_x_y_z1 || _o5_x_y_z1.w, o5.x.y, o5.x.y.z.w, (null == o6 ? void 0 : o6.f()) ? (o6, o6.f) : (o6, null == o6 || o6.f, o6.f), o6, null == o6 || o6.f, o6.f, someFunction({ someProperty: 42 }), someFunction(void 0); for(var _o4_x, _o4_x1, _o5_x_y_z, _o5_x, _o5_x1, _o5_x2, _o5_x_y_z1, _o5_x3, _arr_i, a, b, c, d, _o4_x2, _o4_x3, _o5_x_y_z2, _o5_x4, _o5_x_y_z3, _o5_x5, _o5_x6, _o5_x7, _o5_x_y_z4, _o5_x8, lastSomeProperty, _arr_i1, i = 0; (null === (_arr_i = arr[i]) || void 0 === _arr_i ? void 0 : _arr_i.tag) === "left";)i += 1, (null === (_arr_i1 = arr[i]) || void 0 === _arr_i1 ? void 0 : _arr_i1.tag) === "right" && console.log("I should ALSO be reachable"); diff --git a/crates/swc/tests/tsc-references/decoratedDefaultExportsGetExportedUmd.2.minified.js b/crates/swc/tests/tsc-references/decoratedDefaultExportsGetExportedUmd.2.minified.js index cc1e8bde1f7..5edded9efe5 100644 --- a/crates/swc/tests/tsc-references/decoratedDefaultExportsGetExportedUmd.2.minified.js +++ b/crates/swc/tests/tsc-references/decoratedDefaultExportsGetExportedUmd.2.minified.js @@ -4,12 +4,12 @@ "exports", "@swc/helpers/src/_ts_decorate.mjs" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.aTs = {}, global.tsDecorateMjs); -}(this, function(exports, _tsDecorate) { +}(this, function(exports1, _tsDecorate) { "use strict"; var decorator; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 - }), Object.defineProperty(exports, "default", { + }), Object.defineProperty(exports1, "default", { enumerable: !0, get: ()=>Foo }), _tsDecorate = _tsDecorate.default; @@ -25,12 +25,12 @@ "exports", "@swc/helpers/src/_ts_decorate.mjs" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.bTs = {}, global.tsDecorateMjs); -}(this, function(exports, _tsDecorate) { +}(this, function(exports1, _tsDecorate) { "use strict"; var decorator; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 - }), Object.defineProperty(exports, "default", { + }), Object.defineProperty(exports1, "default", { enumerable: !0, get: ()=>_class }), _tsDecorate = _tsDecorate.default; diff --git a/crates/swc/tests/tsc-references/defaultExportInAwaitExpression01.2.minified.js b/crates/swc/tests/tsc-references/defaultExportInAwaitExpression01.2.minified.js index bc4c3a3e0ea..ed3320675ac 100644 --- a/crates/swc/tests/tsc-references/defaultExportInAwaitExpression01.2.minified.js +++ b/crates/swc/tests/tsc-references/defaultExportInAwaitExpression01.2.minified.js @@ -3,11 +3,11 @@ "object" == typeof module && "object" == typeof module.exports ? factory(exports) : "function" == typeof define && define.amd ? define([ "exports" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.aTs = {}); -}(this, function(exports) { +}(this, function(exports1) { "use strict"; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 - }), Object.defineProperty(exports, "default", { + }), Object.defineProperty(exports1, "default", { enumerable: !0, get: ()=>_default }); @@ -23,9 +23,9 @@ "@swc/helpers/src/_interop_require_default.mjs", "./a" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.bTs = {}, global.asyncToGeneratorMjs, global.interopRequireDefaultMjs, global.a); -}(this, function(exports, _asyncToGenerator, _interopRequireDefault, _a) { +}(this, function(exports1, _asyncToGenerator, _interopRequireDefault, _a) { "use strict"; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 }), _asyncToGenerator = _asyncToGenerator.default, _a = (_interopRequireDefault = _interopRequireDefault.default)(_a), _asyncToGenerator(function*() { yield _a.default; diff --git a/crates/swc/tests/tsc-references/defaultExportsGetExportedUmd.2.minified.js b/crates/swc/tests/tsc-references/defaultExportsGetExportedUmd.2.minified.js index c8be4a1c692..aa21b6114aa 100644 --- a/crates/swc/tests/tsc-references/defaultExportsGetExportedUmd.2.minified.js +++ b/crates/swc/tests/tsc-references/defaultExportsGetExportedUmd.2.minified.js @@ -3,11 +3,11 @@ "object" == typeof module && "object" == typeof module.exports ? factory(exports) : "function" == typeof define && define.amd ? define([ "exports" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.aTs = {}); -}(this, function(exports) { +}(this, function(exports1) { "use strict"; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 - }), Object.defineProperty(exports, "default", { + }), Object.defineProperty(exports1, "default", { enumerable: !0, get: ()=>Foo }); @@ -19,12 +19,12 @@ "object" == typeof module && "object" == typeof module.exports ? factory(exports) : "function" == typeof define && define.amd ? define([ "exports" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.bTs = {}); -}(this, function(exports) { +}(this, function(exports1) { "use strict"; function foo() {} - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 - }), Object.defineProperty(exports, "default", { + }), Object.defineProperty(exports1, "default", { enumerable: !0, get: ()=>foo }); diff --git a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment2.2.minified.js b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment2.2.minified.js index b00317eb84f..d858d064665 100644 --- a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment2.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment2.2.minified.js @@ -1,10 +1,10 @@ //// [destructuringArrayBindingPatternAndAssignment2.ts] import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; import _to_consumable_array from "@swc/helpers/src/_to_consumable_array.mjs"; -var _ref_ = (_sliced_to_array([][0], 1)[0], _sliced_to_array([][1], 1)); -_sliced_to_array(_ref_[0], 1)[0]; -var _undefined = _sliced_to_array(void 0, 2), _undefined_ = (_sliced_to_array(_undefined[0], 1)[0], _sliced_to_array(_undefined[1], 1)); -_sliced_to_array(_undefined_[0], 1)[0]; +var _ref_1 = (_sliced_to_array([][0], 1)[0], _sliced_to_array([][1], 1)); +_sliced_to_array(_ref_1[0], 1)[0]; +var _undefined = _sliced_to_array(void 0, 2), _undefined_1 = (_sliced_to_array(_undefined[0], 1)[0], _sliced_to_array(_undefined[1], 1)); +_sliced_to_array(_undefined_1[0], 1)[0]; var _bar = _sliced_to_array([ 1, 2, diff --git a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment3.2.minified.js b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment3.2.minified.js index bcbc520a3e4..50916538401 100644 --- a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment3.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment3.2.minified.js @@ -1,15 +1,15 @@ //// [destructuringArrayBindingPatternAndAssignment3.ts] import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; -var tmp = [ +var tmp2 = [ 1 -][2], e = void 0 === tmp ? e : tmp; +][2], e = void 0 === tmp2 ? e : tmp2; !function(param) { var _param = _sliced_to_array(param, 2); _param[0], _param[1]; }([ 1 ]), function(param) { - var _param = _sliced_to_array(param, 3), tmp = (_param[0], _param[1], _param[2]), e = void 0 === tmp ? e : tmp; + var _param = _sliced_to_array(param, 3), tmp1 = (_param[0], _param[1], _param[2]), e = void 0 === tmp1 ? e : tmp1; }([ 1 ]), function(param) { diff --git a/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es5).2.minified.js b/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es5).2.minified.js index 3cdd60a0021..8e9c48681af 100644 --- a/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es5).2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es5).2.minified.js @@ -10,13 +10,13 @@ var trace = [], order = function(n) { (void 0 === tmp ? order(0) : tmp)[order(1)]; var tmp1 = {}; (void 0 === tmp1 ? order(0) : tmp1)[order(1)]; -var _ref = {}, _order = order(0), _order1 = order(2), tmp2 = _ref[_order]; -(void 0 === tmp2 ? order(1) : tmp2)[_order1], _object_without_properties(_ref, [ +var _ref3 = {}, _order = order(0), _order1 = order(2), tmp2 = _ref3[_order]; +(void 0 === tmp2 ? order(1) : tmp2)[_order1], _object_without_properties(_ref3, [ _order ].map(_to_property_key)); -var _ref1 = [ +var _ref5 = [ { x: 1 } -], _ref2 = _sliced_to_array(_ref1, 2); -_object_destructuring_empty(_ref2[0]), _ref2[1], _extends({}, _object_destructuring_empty(_ref1[0])); +], _ref6 = _sliced_to_array(_ref5, 2); +_object_destructuring_empty(_ref6[0]), _ref6[1], _extends({}, _object_destructuring_empty(_ref5[0])); diff --git a/crates/swc/tests/tsc-references/destructuringObjectAssignmentPatternWithNestedSpread(target=es5).2.minified.js b/crates/swc/tests/tsc-references/destructuringObjectAssignmentPatternWithNestedSpread(target=es5).2.minified.js index 2358f04a793..2ce8f71da4e 100644 --- a/crates/swc/tests/tsc-references/destructuringObjectAssignmentPatternWithNestedSpread(target=es5).2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringObjectAssignmentPatternWithNestedSpread(target=es5).2.minified.js @@ -1,5 +1,5 @@ //// [destructuringObjectAssignmentPatternWithNestedSpread.ts] -var _c, ref, d; +var _c, ref1, d; import _object_without_properties from "@swc/helpers/src/_object_without_properties.mjs"; _object_without_properties((_c = { x: { @@ -8,4 +8,4 @@ _object_without_properties((_c = { } }).x, [ "a" -]), (void 0 === (ref = _c.x) ? d : ref).a; +]), (void 0 === (ref1 = _c.x) ? d : ref1).a; diff --git a/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5.2.minified.js b/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5.2.minified.js index f7f5997e3c7..e7cd29fb765 100644 --- a/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5.2.minified.js @@ -12,12 +12,12 @@ var tmp = { (void 0 === tmp ? { b11: "string" } : tmp).b11; -var _ref1 = [ +var _ref2 = [ void 0, void 0, void 0 ]; -_ref1[0], _ref1[1], _ref1[2]; +_ref2[0], _ref2[1], _ref2[2]; var _concat = _sliced_to_array([ 1, "string" diff --git a/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5iterable.2.minified.js b/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5iterable.2.minified.js index f992333bef1..4ee266c8804 100644 --- a/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5iterable.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5iterable.2.minified.js @@ -12,12 +12,12 @@ var tmp = { (void 0 === tmp ? { b11: "string" } : tmp).b11; -var _ref1 = [ +var _ref2 = [ void 0, void 0, void 0 ]; -_ref1[0], _ref1[1], _ref1[2]; +_ref2[0], _ref2[1], _ref2[2]; var _concat = _sliced_to_array([ 1, "string" diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments01.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments01.2.minified.js index 7d297571fa8..1b168847d55 100644 --- a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments01.2.minified.js +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments01.2.minified.js @@ -1 +1,2 @@ //// [emitArrowFunctionWhenUsingArguments01.ts] +arguments; diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments02.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments02.2.minified.js index 53c79ff8686..83f510a2d71 100644 --- a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments02.2.minified.js +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments02.2.minified.js @@ -1 +1,2 @@ //// [emitArrowFunctionWhenUsingArguments02.ts] +arguments; diff --git a/crates/swc/tests/tsc-references/emitCompoundExponentiationOperator1.2.minified.js b/crates/swc/tests/tsc-references/emitCompoundExponentiationOperator1.2.minified.js index e35899f04d9..61b9b48e123 100644 --- a/crates/swc/tests/tsc-references/emitCompoundExponentiationOperator1.2.minified.js +++ b/crates/swc/tests/tsc-references/emitCompoundExponentiationOperator1.2.minified.js @@ -1,3 +1,3 @@ //// [emitCompoundExponentiationOperator1.ts] var comp; -comp = Math.pow(comp, 1), comp = Math.pow(comp, Math.pow(comp, comp)), comp = Math.pow(comp, Math.pow(comp, Math.pow(comp, 2))), comp = Math.pow(comp, Math.pow(comp, comp) + 2), comp = Math.pow(comp, Math.pow(comp, comp) - 2), comp = Math.pow(comp, 2 * Math.pow(comp, comp)), comp = Math.pow(comp, Math.pow(comp, comp) / 2), comp = Math.pow(comp, Math.pow(comp, comp) % 2), comp = Math.pow(comp, Math.pow(comp - 2, 5)), comp = Math.pow(comp, Math.pow(comp + 2, 5)), comp = Math.pow(comp, Math.pow(2 * comp, 5)), comp = Math.pow(comp, Math.pow(comp / 2, 5)), comp = Math.pow(comp, Math.pow(comp % 2, 5)), comp = Math.pow(comp, Math.pow(comp, 7)), comp = Math.pow(comp, Math.pow(comp, 3)), comp = Math.pow(comp, Math.pow(comp, 10)), comp = Math.pow(comp, Math.pow(comp, 2.5)), comp = Math.pow(comp, Math.pow(comp, 1)); +comp = Math.pow(comp = Math.pow(comp = Math.pow(comp = Math.pow(comp = Math.pow(comp = Math.pow(comp = Math.pow(comp = Math.pow(comp = Math.pow(comp = Math.pow(comp = Math.pow(comp = Math.pow(comp = Math.pow(comp = Math.pow(comp = Math.pow(comp = Math.pow(comp = Math.pow(comp = Math.pow(comp, 1), Math.pow(comp, comp)), Math.pow(comp, Math.pow(comp, 2))), Math.pow(comp, comp) + 2), Math.pow(comp, comp) - 2), 2 * Math.pow(comp, comp)), Math.pow(comp, comp) / 2), Math.pow(comp, comp) % 2), Math.pow(comp - 2, 5)), Math.pow(comp + 2, 5)), Math.pow(2 * comp, 5)), Math.pow(comp / 2, 5)), Math.pow(comp % 2, 5)), Math.pow(comp, 7)), Math.pow(comp, 3)), Math.pow(comp, 10)), Math.pow(comp, 2.5)), Math.pow(comp, 1)); diff --git a/crates/swc/tests/tsc-references/emitCompoundExponentiationOperator2.2.minified.js b/crates/swc/tests/tsc-references/emitCompoundExponentiationOperator2.2.minified.js index db064803311..7a90e21a279 100644 --- a/crates/swc/tests/tsc-references/emitCompoundExponentiationOperator2.2.minified.js +++ b/crates/swc/tests/tsc-references/emitCompoundExponentiationOperator2.2.minified.js @@ -1,3 +1,3 @@ //// [emitCompoundExponentiationOperator2.ts] var comp; -comp = Math.pow(comp, 1), comp = Math.pow(comp, comp = Math.pow(comp, 1)), comp = Math.pow(comp, comp = Math.pow(comp, 3)), comp = Math.pow(comp, comp = Math.pow(comp, -1)), comp = Math.pow(comp, comp = Math.pow(comp, 2)), comp = Math.pow(comp, comp = Math.pow(comp, 0.5)), comp = Math.pow(comp, comp = Math.pow(comp, 3)), comp = Math.pow(comp, comp = Math.pow(comp, -1)), comp = Math.pow(comp, comp = Math.pow(comp, 2)), comp = Math.pow(comp, comp = Math.pow(comp, 0.5)), comp = Math.pow(comp, comp = Math.pow(comp, 9)), comp = Math.pow(comp, comp = Math.pow(comp, -15)), comp = Math.pow(comp, comp = Math.pow(comp, 32)), comp = Math.pow(comp, comp = Math.pow(comp, 0.015625)), comp = Math.pow(comp, comp = Math.pow(comp, 27)), comp = Math.pow(comp, comp = Math.pow(comp, 1)), comp = Math.pow(comp, comp = Math.pow(comp, 32)), comp = Math.pow(comp, comp = Math.pow(comp, 0.015625)); +comp = Math.pow(comp = Math.pow(comp = Math.pow(comp = Math.pow(comp = Math.pow(comp = Math.pow(comp = Math.pow(comp = Math.pow(comp = Math.pow(comp = Math.pow(comp = Math.pow(comp = Math.pow(comp = Math.pow(comp = Math.pow(comp = Math.pow(comp = Math.pow(comp = Math.pow(comp = Math.pow(comp, 1), comp = Math.pow(comp, 1)), comp = Math.pow(comp, 3)), comp = Math.pow(comp, -1)), comp = Math.pow(comp, 2)), comp = Math.pow(comp, 0.5)), comp = Math.pow(comp, 3)), comp = Math.pow(comp, -1)), comp = Math.pow(comp, 2)), comp = Math.pow(comp, 0.5)), comp = Math.pow(comp, 9)), comp = Math.pow(comp, -15)), comp = Math.pow(comp, 32)), comp = Math.pow(comp, 0.015625)), comp = Math.pow(comp, 27)), comp = Math.pow(comp, 1)), comp = Math.pow(comp, 32)), comp = Math.pow(comp, 0.015625)); diff --git a/crates/swc/tests/tsc-references/emitExponentiationOperatorInTempalteString4.2.minified.js b/crates/swc/tests/tsc-references/emitExponentiationOperatorInTempalteString4.2.minified.js index bda695ea4ca..ce6585864ba 100644 --- a/crates/swc/tests/tsc-references/emitExponentiationOperatorInTempalteString4.2.minified.js +++ b/crates/swc/tests/tsc-references/emitExponentiationOperatorInTempalteString4.2.minified.js @@ -1,4 +1,4 @@ //// [emitExponentiationOperatorInTempalteString4.ts] import _type_of from "@swc/helpers/src/_type_of.mjs"; var t1 = 10; -++t1, t1++, --t1, _type_of(Math.pow(t1, Math.pow(10, t1))), "".concat(Math.pow(t1, -10), " hello world ").concat(Math.pow(t1, -10)), "".concat(Math.pow(-t1, 10) - t1, " hello world ").concat(Math.pow(-t1, 10) - t1), "".concat(Math.pow(-++t1, 10) - t1, " hello world ").concat(Math.pow(t1, Math.pow(-++t1, -t1))), "".concat(Math.pow(-t1++, 10) - t1, " hello world ").concat(Math.pow(10, Math.pow(-t1++, -t1))), "".concat(Math.pow(~t1, Math.pow(10, --t1)), " hello world ").concat(Math.pow(~t1, Math.pow(10, --t1))), "".concat(_type_of(Math.pow(t1, Math.pow(10, t1))), " hello world ").concat(_type_of(Math.pow(t1, Math.pow(10, t1)))), ++t1, t1++, --t1, _type_of(Math.pow(t1, Math.pow(10, t1))); +++t1, t1++, _type_of(Math.pow(--t1, Math.pow(10, t1))), "".concat(Math.pow(t1, -10), " hello world ").concat(Math.pow(t1, -10)), "".concat(Math.pow(-t1, 10) - t1, " hello world ").concat(Math.pow(-t1, 10) - t1), "".concat(Math.pow(-++t1, 10) - t1, " hello world ").concat(Math.pow(t1, Math.pow(-++t1, -t1))), "".concat(Math.pow(-t1++, 10) - t1, " hello world ").concat(Math.pow(10, Math.pow(-t1++, -t1))), "".concat(Math.pow(~t1, Math.pow(10, --t1)), " hello world ").concat(Math.pow(~t1, Math.pow(10, --t1))), "".concat(_type_of(Math.pow(t1, Math.pow(10, t1))), " hello world ").concat(_type_of(Math.pow(t1, Math.pow(10, t1)))), ++t1, t1++, _type_of(Math.pow(--t1, Math.pow(10, t1))); diff --git a/crates/swc/tests/tsc-references/emptyAssignmentPatterns02_ES5.2.minified.js b/crates/swc/tests/tsc-references/emptyAssignmentPatterns02_ES5.2.minified.js index 4c2bb9edfdd..cfd6268730a 100644 --- a/crates/swc/tests/tsc-references/emptyAssignmentPatterns02_ES5.2.minified.js +++ b/crates/swc/tests/tsc-references/emptyAssignmentPatterns02_ES5.2.minified.js @@ -1,5 +1,5 @@ //// [emptyAssignmentPatterns02_ES5.ts] -var a, ref; +var a, ref1; import _object_destructuring_empty from "@swc/helpers/src/_object_destructuring_empty.mjs"; import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; -_object_destructuring_empty((a.x, a.y, a.z, a)), _sliced_to_array(((ref = _sliced_to_array(a, 3))[0], ref[1], ref[2], ref), 0); +_object_destructuring_empty((a.x, a.y, a.z, a)), _sliced_to_array(((ref1 = _sliced_to_array(a, 3))[0], ref1[1], ref1[2], ref1), 0); diff --git a/crates/swc/tests/tsc-references/emptyAssignmentPatterns02_ES5iterable.2.minified.js b/crates/swc/tests/tsc-references/emptyAssignmentPatterns02_ES5iterable.2.minified.js index 5c23f0e9f6a..dfb2b50e748 100644 --- a/crates/swc/tests/tsc-references/emptyAssignmentPatterns02_ES5iterable.2.minified.js +++ b/crates/swc/tests/tsc-references/emptyAssignmentPatterns02_ES5iterable.2.minified.js @@ -1,5 +1,5 @@ //// [emptyAssignmentPatterns02_ES5iterable.ts] -var a, ref; +var a, ref1; import _object_destructuring_empty from "@swc/helpers/src/_object_destructuring_empty.mjs"; import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; -_object_destructuring_empty((a.x, a.y, a.z, a)), _sliced_to_array(((ref = _sliced_to_array(a, 3))[0], ref[1], ref[2], ref), 0); +_object_destructuring_empty((a.x, a.y, a.z, a)), _sliced_to_array(((ref1 = _sliced_to_array(a, 3))[0], ref1[1], ref1[2], ref1), 0); diff --git a/crates/swc/tests/tsc-references/emptyAssignmentPatterns04_ES5.2.minified.js b/crates/swc/tests/tsc-references/emptyAssignmentPatterns04_ES5.2.minified.js index d0495319bbc..866aba2fab7 100644 --- a/crates/swc/tests/tsc-references/emptyAssignmentPatterns04_ES5.2.minified.js +++ b/crates/swc/tests/tsc-references/emptyAssignmentPatterns04_ES5.2.minified.js @@ -1,5 +1,5 @@ //// [emptyAssignmentPatterns04_ES5.ts] -var a, ref, ref1; +var a, ref, ref2; import _object_destructuring_empty from "@swc/helpers/src/_object_destructuring_empty.mjs"; import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; -(ref = _object_destructuring_empty(a)).x, ref.y, ref.z, (ref1 = _sliced_to_array(_sliced_to_array(a, 0), 3))[0], ref1[1], ref1[2]; +(ref = _object_destructuring_empty(a)).x, ref.y, ref.z, (ref2 = _sliced_to_array(_sliced_to_array(a, 0), 3))[0], ref2[1], ref2[2]; diff --git a/crates/swc/tests/tsc-references/emptyAssignmentPatterns04_ES5iterable.2.minified.js b/crates/swc/tests/tsc-references/emptyAssignmentPatterns04_ES5iterable.2.minified.js index 12a0982edf2..e7bbfc92153 100644 --- a/crates/swc/tests/tsc-references/emptyAssignmentPatterns04_ES5iterable.2.minified.js +++ b/crates/swc/tests/tsc-references/emptyAssignmentPatterns04_ES5iterable.2.minified.js @@ -1,5 +1,5 @@ //// [emptyAssignmentPatterns04_ES5iterable.ts] -var a, ref, ref1; +var a, ref, ref2; import _object_destructuring_empty from "@swc/helpers/src/_object_destructuring_empty.mjs"; import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; -(ref = _object_destructuring_empty(a)).x, ref.y, ref.z, (ref1 = _sliced_to_array(_sliced_to_array(a, 0), 3))[0], ref1[1], ref1[2]; +(ref = _object_destructuring_empty(a)).x, ref.y, ref.z, (ref2 = _sliced_to_array(_sliced_to_array(a, 0), 3))[0], ref2[1], ref2[2]; diff --git a/crates/swc/tests/tsc-references/enumClassification.2.minified.js b/crates/swc/tests/tsc-references/enumClassification.2.minified.js index adbd243e370..bd9a59856a4 100644 --- a/crates/swc/tests/tsc-references/enumClassification.2.minified.js +++ b/crates/swc/tests/tsc-references/enumClassification.2.minified.js @@ -4,9 +4,7 @@ var E01, E02, E03, E04, E05, E06, E07, E08, E10, E11, E12, E20; E01[E01.A = 0] = "A"; }(E01 || (E01 = {})), function(E02) { E02[E02.A = 123] = "A"; -}(E02 || (E02 = {})), function(E03) { - E03.A = "hello"; -}(E03 || (E03 = {})), function(E04) { +}(E02 || (E02 = {})), (E03 || (E03 = {})).A = "hello", function(E04) { E04[E04.A = 0] = "A", E04[E04.B = 1] = "B", E04[E04.C = 2] = "C"; }(E04 || (E04 = {})), function(E05) { E05[E05.A = 0] = "A", E05[E05.B = 10] = "B", E05[E05.C = 11] = "C"; diff --git a/crates/swc/tests/tsc-references/enumConstantMemberWithString.2.minified.js b/crates/swc/tests/tsc-references/enumConstantMemberWithString.2.minified.js index 6a8b067da4a..5eff9afc848 100644 --- a/crates/swc/tests/tsc-references/enumConstantMemberWithString.2.minified.js +++ b/crates/swc/tests/tsc-references/enumConstantMemberWithString.2.minified.js @@ -6,10 +6,6 @@ var T1, T2, T3, T4, T5, T6; T2.a = "1", T2.b = "12"; }(T2 || (T2 = {})), function(T3) { T3.a = "1", T3.b = "12", T3[T3.c = 1] = "c", T3[T3.d = 3] = "d"; -}(T3 || (T3 = {})), function(T4) { - T4.a = "1"; -}(T4 || (T4 = {})), function(T5) { - T5.a = "12"; -}(T5 || (T5 = {})), function(T6) { +}(T3 || (T3 = {})), (T4 || (T4 = {})).a = "1", (T5 || (T5 = {})).a = "12", function(T6) { T6.a = "1", T6.b = "12"; }(T6 || (T6 = {})); diff --git a/crates/swc/tests/tsc-references/enumConstantMemberWithStringEmitDeclaration.2.minified.js b/crates/swc/tests/tsc-references/enumConstantMemberWithStringEmitDeclaration.2.minified.js index 4fe980124ac..7bdf13fcaf4 100644 --- a/crates/swc/tests/tsc-references/enumConstantMemberWithStringEmitDeclaration.2.minified.js +++ b/crates/swc/tests/tsc-references/enumConstantMemberWithStringEmitDeclaration.2.minified.js @@ -6,10 +6,6 @@ var T1, T2, T3, T4, T5, T6; T2.a = "1", T2.b = "12"; }(T2 || (T2 = {})), function(T3) { T3.a = "1", T3.b = "12"; -}(T3 || (T3 = {})), function(T4) { - T4.a = "1"; -}(T4 || (T4 = {})), function(T5) { - T5.a = "12"; -}(T5 || (T5 = {})), function(T6) { +}(T3 || (T3 = {})), (T4 || (T4 = {})).a = "1", (T5 || (T5 = {})).a = "12", function(T6) { T6.a = "1", T6.b = "12"; }(T6 || (T6 = {})); diff --git a/crates/swc/tests/tsc-references/enumConstantMemberWithTemplateLiterals.2.minified.js b/crates/swc/tests/tsc-references/enumConstantMemberWithTemplateLiterals.2.minified.js index 740582ef706..fc6a5095f93 100644 --- a/crates/swc/tests/tsc-references/enumConstantMemberWithTemplateLiterals.2.minified.js +++ b/crates/swc/tests/tsc-references/enumConstantMemberWithTemplateLiterals.2.minified.js @@ -1,12 +1,8 @@ //// [enumConstantMemberWithTemplateLiterals.ts] var T1, T2, T3, T4, T5, T6, T7; -!function(T1) { - T1.a = "1"; -}(T1 || (T1 = {})), function(T2) { +(T1 || (T1 = {})).a = "1", function(T2) { T2.a = "1", T2.b = "2", T2[T2.c = 3] = "c"; -}(T2 || (T2 = {})), function(T3) { - T3.a = "11"; -}(T3 || (T3 = {})), function(T4) { +}(T2 || (T2 = {})), (T3 || (T3 = {})).a = "11", function(T4) { T4.a = "1", T4.b = "11", T4.c = "12", T4.d = "21", T4.e = "211"; }(T4 || (T4 = {})), function(T5) { T5.a = "1", T5.b = "12", T5.c = "123", T5[T5.d = 1] = "d", T5[T5.e = "1" - "1"] = "e", T5.f = "11", T5[T5.g = "123"] = "g", T5[T5.h = 1] = "h"; diff --git a/crates/swc/tests/tsc-references/enumConstantMemberWithTemplateLiteralsEmitDeclaration.2.minified.js b/crates/swc/tests/tsc-references/enumConstantMemberWithTemplateLiteralsEmitDeclaration.2.minified.js index 5f59f3a99f9..cca81b31e95 100644 --- a/crates/swc/tests/tsc-references/enumConstantMemberWithTemplateLiteralsEmitDeclaration.2.minified.js +++ b/crates/swc/tests/tsc-references/enumConstantMemberWithTemplateLiteralsEmitDeclaration.2.minified.js @@ -1,12 +1,8 @@ //// [enumConstantMemberWithTemplateLiteralsEmitDeclaration.ts] var T1, T2, T3, T4, T5, T6, T7; -!function(T1) { - T1.a = "1"; -}(T1 || (T1 = {})), function(T2) { +(T1 || (T1 = {})).a = "1", function(T2) { T2.a = "1", T2.b = "2", T2[T2.c = 3] = "c"; -}(T2 || (T2 = {})), function(T3) { - T3.a = "11"; -}(T3 || (T3 = {})), function(T4) { +}(T2 || (T2 = {})), (T3 || (T3 = {})).a = "11", function(T4) { T4.a = "1", T4.b = "11", T4.c = "12", T4.d = "21", T4.e = "211"; }(T4 || (T4 = {})), function(T5) { T5.a = "1", T5.b = "12", T5.c = "123", T5[T5.d = 1] = "d"; diff --git a/crates/swc/tests/tsc-references/exponentiationOperatorWithTemplateStringInvalid.2.minified.js b/crates/swc/tests/tsc-references/exponentiationOperatorWithTemplateStringInvalid.2.minified.js index a5e4c0b390b..853cb0423de 100644 --- a/crates/swc/tests/tsc-references/exponentiationOperatorWithTemplateStringInvalid.2.minified.js +++ b/crates/swc/tests/tsc-references/exponentiationOperatorWithTemplateStringInvalid.2.minified.js @@ -1,3 +1 @@ //// [exponentiationOperatorWithTemplateStringInvalid.ts] -var k = 10; -k = Math.pow(k, "".concat(3)), k = Math.pow(k, "2".concat(3)), k = Math.pow(k, "2".concat(3, "4")), k = Math.pow(k, "2".concat(3, "4")); diff --git a/crates/swc/tests/tsc-references/exponentiationOperatorWithTemplateStringInvalidES6.2.minified.js b/crates/swc/tests/tsc-references/exponentiationOperatorWithTemplateStringInvalidES6.2.minified.js index 5d1a986deee..a44a1c74ec7 100644 --- a/crates/swc/tests/tsc-references/exponentiationOperatorWithTemplateStringInvalidES6.2.minified.js +++ b/crates/swc/tests/tsc-references/exponentiationOperatorWithTemplateStringInvalidES6.2.minified.js @@ -1,3 +1,2 @@ //// [exponentiationOperatorWithTemplateStringInvalidES6.ts] -var k = 10; -k = Math.pow(k, "3"), k = Math.pow(k, "23"), k = Math.pow(k, "234"), kj = Math.pow(kj, "234"); +kj = Math.pow(kj, "234"); diff --git a/crates/swc/tests/tsc-references/exportAsNamespace1(module=umd).2.minified.js b/crates/swc/tests/tsc-references/exportAsNamespace1(module=umd).2.minified.js index 47d7eca1c19..5af2816dc7c 100644 --- a/crates/swc/tests/tsc-references/exportAsNamespace1(module=umd).2.minified.js +++ b/crates/swc/tests/tsc-references/exportAsNamespace1(module=umd).2.minified.js @@ -3,16 +3,16 @@ "object" == typeof module && "object" == typeof module.exports ? factory(exports) : "function" == typeof define && define.amd ? define([ "exports" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.0Ts = {}); -}(this, function(exports) { +}(this, function(exports1) { "use strict"; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 }), function(target, all) { for(var name in all)Object.defineProperty(target, name, { enumerable: !0, get: all[name] }); - }(exports, { + }(exports1, { a: function() { return a; }, @@ -29,11 +29,11 @@ "@swc/helpers/src/_interop_require_wildcard.mjs", "./0" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.1Ts = {}, global.interopRequireWildcardMjs, global["0"]); -}(this, function(exports, _interopRequireWildcard, _0) { +}(this, function(exports1, _interopRequireWildcard, _0) { "use strict"; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 - }), Object.defineProperty(exports, "ns", { + }), Object.defineProperty(exports1, "ns", { enumerable: !0, get: function() { return _0; @@ -47,9 +47,9 @@ "@swc/helpers/src/_interop_require_wildcard.mjs", "./1" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.2Ts = {}, global.interopRequireWildcardMjs, global["1"]); -}(this, function(exports, _interopRequireWildcard, _1) { +}(this, function(exports1, _interopRequireWildcard, _1) { "use strict"; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 }), (_1 = (_interopRequireWildcard = _interopRequireWildcard.default)(_1)).ns.a, _1.ns.b; }); diff --git a/crates/swc/tests/tsc-references/exportAsNamespace2(module=umd).2.minified.js b/crates/swc/tests/tsc-references/exportAsNamespace2(module=umd).2.minified.js index 47d7eca1c19..5af2816dc7c 100644 --- a/crates/swc/tests/tsc-references/exportAsNamespace2(module=umd).2.minified.js +++ b/crates/swc/tests/tsc-references/exportAsNamespace2(module=umd).2.minified.js @@ -3,16 +3,16 @@ "object" == typeof module && "object" == typeof module.exports ? factory(exports) : "function" == typeof define && define.amd ? define([ "exports" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.0Ts = {}); -}(this, function(exports) { +}(this, function(exports1) { "use strict"; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 }), function(target, all) { for(var name in all)Object.defineProperty(target, name, { enumerable: !0, get: all[name] }); - }(exports, { + }(exports1, { a: function() { return a; }, @@ -29,11 +29,11 @@ "@swc/helpers/src/_interop_require_wildcard.mjs", "./0" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.1Ts = {}, global.interopRequireWildcardMjs, global["0"]); -}(this, function(exports, _interopRequireWildcard, _0) { +}(this, function(exports1, _interopRequireWildcard, _0) { "use strict"; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 - }), Object.defineProperty(exports, "ns", { + }), Object.defineProperty(exports1, "ns", { enumerable: !0, get: function() { return _0; @@ -47,9 +47,9 @@ "@swc/helpers/src/_interop_require_wildcard.mjs", "./1" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.2Ts = {}, global.interopRequireWildcardMjs, global["1"]); -}(this, function(exports, _interopRequireWildcard, _1) { +}(this, function(exports1, _interopRequireWildcard, _1) { "use strict"; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 }), (_1 = (_interopRequireWildcard = _interopRequireWildcard.default)(_1)).ns.a, _1.ns.b; }); diff --git a/crates/swc/tests/tsc-references/exportAsNamespace3(module=umd).2.minified.js b/crates/swc/tests/tsc-references/exportAsNamespace3(module=umd).2.minified.js index 797dd51029b..2130a1878ea 100644 --- a/crates/swc/tests/tsc-references/exportAsNamespace3(module=umd).2.minified.js +++ b/crates/swc/tests/tsc-references/exportAsNamespace3(module=umd).2.minified.js @@ -3,16 +3,16 @@ "object" == typeof module && "object" == typeof module.exports ? factory(exports) : "function" == typeof define && define.amd ? define([ "exports" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.0Ts = {}); -}(this, function(exports) { +}(this, function(exports1) { "use strict"; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 }), function(target, all) { for(var name in all)Object.defineProperty(target, name, { enumerable: !0, get: all[name] }); - }(exports, { + }(exports1, { a: function() { return a; }, @@ -29,11 +29,11 @@ "@swc/helpers/src/_interop_require_wildcard.mjs", "./0" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.1Ts = {}, global.interopRequireWildcardMjs, global["0"]); -}(this, function(exports, _interopRequireWildcard, _0) { +}(this, function(exports1, _interopRequireWildcard, _0) { "use strict"; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 - }), Object.defineProperty(exports, "ns", { + }), Object.defineProperty(exports1, "ns", { enumerable: !0, get: function() { return _0; @@ -52,9 +52,9 @@ "@swc/helpers/src/_interop_require_wildcard.mjs", "./1" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.2Ts = {}, global.interopRequireWildcardMjs, global["1"]); -}(this, function(exports, _interopRequireWildcard, _1) { +}(this, function(exports1, _interopRequireWildcard, _1) { "use strict"; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 }), (_1 = (_interopRequireWildcard = _interopRequireWildcard.default)(_1)).ns.a, _1.ns.b; }); diff --git a/crates/swc/tests/tsc-references/exportAsNamespace4(module=umd).2.minified.js b/crates/swc/tests/tsc-references/exportAsNamespace4(module=umd).2.minified.js index 6f1c74f4c77..e073e02edc6 100644 --- a/crates/swc/tests/tsc-references/exportAsNamespace4(module=umd).2.minified.js +++ b/crates/swc/tests/tsc-references/exportAsNamespace4(module=umd).2.minified.js @@ -3,16 +3,16 @@ "object" == typeof module && "object" == typeof module.exports ? factory(exports) : "function" == typeof define && define.amd ? define([ "exports" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.0Ts = {}); -}(this, function(exports) { +}(this, function(exports1) { "use strict"; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 }), function(target, all) { for(var name in all)Object.defineProperty(target, name, { enumerable: !0, get: all[name] }); - }(exports, { + }(exports1, { a: function() { return a; }, @@ -29,11 +29,11 @@ "@swc/helpers/src/_interop_require_wildcard.mjs", "./0" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.1Ts = {}, global.interopRequireWildcardMjs, global["0"]); -}(this, function(exports, _interopRequireWildcard, _0) { +}(this, function(exports1, _interopRequireWildcard, _0) { "use strict"; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 - }), Object.defineProperty(exports, "default", { + }), Object.defineProperty(exports1, "default", { enumerable: !0, get: function() { return _0; @@ -47,11 +47,11 @@ "@swc/helpers/src/_interop_require_wildcard.mjs", "./0" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.11Ts = {}, global.interopRequireWildcardMjs, global["0"]); -}(this, function(exports, _interopRequireWildcard, _0) { +}(this, function(exports1, _interopRequireWildcard, _0) { "use strict"; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 - }), Object.defineProperty(exports, "default", { + }), Object.defineProperty(exports1, "default", { enumerable: !0, get: function() { return _default; @@ -67,9 +67,9 @@ "./1", "./11" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.2Ts = {}, global.interopRequireDefaultMjs, global["1"], global["11"]); -}(this, function(exports, _interopRequireDefault, _1, _11) { +}(this, function(exports1, _interopRequireDefault, _1, _11) { "use strict"; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 }), _1 = (_interopRequireDefault = _interopRequireDefault.default)(_1), _11 = _interopRequireDefault(_11), _1.default.a, _11.default.a, _1.default.b, _11.default.b; }); diff --git a/crates/swc/tests/tsc-references/exportClassNameWithObjectUMD.2.minified.js b/crates/swc/tests/tsc-references/exportClassNameWithObjectUMD.2.minified.js index 8e3320231a4..ca9e1c3800b 100644 --- a/crates/swc/tests/tsc-references/exportClassNameWithObjectUMD.2.minified.js +++ b/crates/swc/tests/tsc-references/exportClassNameWithObjectUMD.2.minified.js @@ -4,11 +4,11 @@ "exports", "@swc/helpers/src/_class_call_check.mjs" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.exportClassNameWithObjectUMDTs = {}, global.classCallCheckMjs); -}(this, function(exports, _classCallCheck) { +}(this, function(exports1, _classCallCheck) { "use strict"; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 - }), Object.defineProperty(exports, "Object", { + }), Object.defineProperty(exports1, "Object", { enumerable: !0, get: function() { return Object; diff --git a/crates/swc/tests/tsc-references/for-of53.2.minified.js b/crates/swc/tests/tsc-references/for-of53.2.minified.js index ea7ac682eab..33ed7cbf343 100644 --- a/crates/swc/tests/tsc-references/for-of53.2.minified.js +++ b/crates/swc/tests/tsc-references/for-of53.2.minified.js @@ -1,2 +1,2 @@ //// [for-of53.ts] -for (let v of []); +for (let v1 of []); diff --git a/crates/swc/tests/tsc-references/for-of54.2.minified.js b/crates/swc/tests/tsc-references/for-of54.2.minified.js index ce80d333804..1f79e882a05 100644 --- a/crates/swc/tests/tsc-references/for-of54.2.minified.js +++ b/crates/swc/tests/tsc-references/for-of54.2.minified.js @@ -1,2 +1,2 @@ //// [for-of54.ts] -for (let v of []); +for (let v1 of []); diff --git a/crates/swc/tests/tsc-references/genericContextualTypes1.2.minified.js b/crates/swc/tests/tsc-references/genericContextualTypes1.2.minified.js index 3ade5bda71a..41774cc51d6 100644 --- a/crates/swc/tests/tsc-references/genericContextualTypes1.2.minified.js +++ b/crates/swc/tests/tsc-references/genericContextualTypes1.2.minified.js @@ -1,5 +1,5 @@ //// [genericContextualTypes1.ts] -wrap(list), wrap(function(x) { +list, wrap(list), wrap(function(x) { return [ x ]; diff --git a/crates/swc/tests/tsc-references/importCallExpressionES5UMD.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionES5UMD.2.minified.js index a7b1533859b..e7096db080b 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionES5UMD.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionES5UMD.2.minified.js @@ -3,14 +3,14 @@ "object" == typeof module && "object" == typeof module.exports ? factory(exports) : "function" == typeof define && define.amd ? define([ "exports" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.0Ts = {}); -}(this, function(exports) { +}(this, function(exports1) { "use strict"; function foo() { return "foo"; } - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 - }), Object.defineProperty(exports, "foo", { + }), Object.defineProperty(exports1, "foo", { enumerable: !0, get: function() { return foo; @@ -24,16 +24,16 @@ "@swc/helpers/src/_class_call_check.mjs", "@swc/helpers/src/_interop_require_wildcard.mjs" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.1Ts = {}, global.classCallCheckMjs, global.interopRequireWildcardMjs); -}(this, function(exports, _classCallCheck, _interopRequireWildcard) { +}(this, function(exports1, _classCallCheck, _interopRequireWildcard) { "use strict"; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 }), function(target, all) { for(var name in all)Object.defineProperty(target, name, { enumerable: !0, get: all[name] }); - }(exports, { + }(exports1, { p2: function() { return p2; }, diff --git a/crates/swc/tests/tsc-references/importCallExpressionES6UMD.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionES6UMD.2.minified.js index 24bd5a09801..70a1182fe92 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionES6UMD.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionES6UMD.2.minified.js @@ -3,14 +3,14 @@ "object" == typeof module && "object" == typeof module.exports ? factory(exports) : "function" == typeof define && define.amd ? define([ "exports" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.0Ts = {}); -}(this, function(exports) { +}(this, function(exports1) { "use strict"; function foo() { return "foo"; } - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 - }), Object.defineProperty(exports, "foo", { + }), Object.defineProperty(exports1, "foo", { enumerable: !0, get: ()=>foo }); @@ -21,16 +21,16 @@ "exports", "@swc/helpers/src/_interop_require_wildcard.mjs" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.1Ts = {}, global.interopRequireWildcardMjs); -}(this, function(exports, _interopRequireWildcard) { +}(this, function(exports1, _interopRequireWildcard) { "use strict"; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 }), function(target, all) { for(var name in all)Object.defineProperty(target, name, { enumerable: !0, get: all[name] }); - }(exports, { + }(exports1, { p2: ()=>p2, D: ()=>D }), _interopRequireWildcard = _interopRequireWildcard.default, import("./0"), import("./0").then((zero)=>zero.foo()); diff --git a/crates/swc/tests/tsc-references/importCallExpressionInAMD4.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInAMD4.2.minified.js index 2ab0b30945c..eebe6178ce8 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInAMD4.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInAMD4.2.minified.js @@ -67,11 +67,9 @@ define([ ], (m)=>resolve(_interopRequireWildcard(m)), reject)), this.myModule.then((Zero)=>{ console.log(Zero.foo()); }, async (err)=>{ - console.log(err); - let one = await new Promise((resolve, reject)=>require([ + console.log(err), console.log((await new Promise((resolve, reject)=>require([ "./1" - ], (m)=>resolve(_interopRequireWildcard(m)), reject)); - console.log(one.backup()); + ], (m)=>resolve(_interopRequireWildcard(m)), reject))).backup()); }); } } diff --git a/crates/swc/tests/tsc-references/importCallExpressionInCJS5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInCJS5.2.minified.js index 363620f16e2..b9fa4e2bcfc 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInCJS5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInCJS5.2.minified.js @@ -47,9 +47,7 @@ class D { Promise.resolve().then(()=>_interopRequireWildcard(require("./0"))), this.myModule.then((Zero)=>{ console.log(Zero.foo()); }, async (err)=>{ - console.log(err); - let one = await Promise.resolve().then(()=>_interopRequireWildcard(require("./1"))); - console.log(one.backup()); + console.log(err), console.log((await Promise.resolve().then(()=>_interopRequireWildcard(require("./1")))).backup()); }); } } diff --git a/crates/swc/tests/tsc-references/importCallExpressionInSystem4.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInSystem4.2.minified.js index f785884a1fb..573ab529eb0 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInSystem4.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInSystem4.2.minified.js @@ -43,9 +43,7 @@ System.register([], function(_export, _context) { _context.import("./0"), this.myModule.then((Zero)=>{ console.log(Zero.foo()); }, async (err)=>{ - console.log(err); - let one = await import("./1"); - console.log(one.backup()); + console.log(err), console.log((await import("./1")).backup()); }); } }); diff --git a/crates/swc/tests/tsc-references/importCallExpressionInUMD1.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInUMD1.2.minified.js index ff0e92c035b..dd1febf36cb 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInUMD1.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInUMD1.2.minified.js @@ -3,14 +3,14 @@ "object" == typeof module && "object" == typeof module.exports ? factory(exports) : "function" == typeof define && define.amd ? define([ "exports" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.0Ts = {}); -}(this, function(exports) { +}(this, function(exports1) { "use strict"; function foo() { return "foo"; } - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 - }), Object.defineProperty(exports, "foo", { + }), Object.defineProperty(exports1, "foo", { enumerable: !0, get: ()=>foo }); @@ -21,11 +21,11 @@ "exports", "@swc/helpers/src/_interop_require_wildcard.mjs" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.1Ts = {}, global.interopRequireWildcardMjs); -}(this, function(exports, _interopRequireWildcard) { +}(this, function(exports1, _interopRequireWildcard) { "use strict"; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 - }), Object.defineProperty(exports, "p2", { + }), Object.defineProperty(exports1, "p2", { enumerable: !0, get: ()=>p2 }), _interopRequireWildcard = _interopRequireWildcard.default, import("./0"), import("./0").then((zero)=>zero.foo()); diff --git a/crates/swc/tests/tsc-references/importCallExpressionInUMD2.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInUMD2.2.minified.js index 2c53f213a03..1fd1ed32fc7 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInUMD2.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInUMD2.2.minified.js @@ -3,11 +3,11 @@ "object" == typeof module && "object" == typeof module.exports ? factory(exports) : "function" == typeof define && define.amd ? define([ "exports" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.0Ts = {}); -}(this, function(exports) { +}(this, function(exports1) { "use strict"; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 - }), Object.defineProperty(exports, "B", { + }), Object.defineProperty(exports1, "B", { enumerable: !0, get: ()=>B }); @@ -23,9 +23,9 @@ "exports", "@swc/helpers/src/_interop_require_wildcard.mjs" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.2Ts = {}, global.interopRequireWildcardMjs); -}(this, function(exports, _interopRequireWildcard) { +}(this, function(exports1, _interopRequireWildcard) { "use strict"; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 }), _interopRequireWildcard = _interopRequireWildcard.default, function(x) { x.then((value)=>{ diff --git a/crates/swc/tests/tsc-references/importCallExpressionInUMD3.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInUMD3.2.minified.js index 82e2d0a9010..563b6579de8 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInUMD3.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInUMD3.2.minified.js @@ -3,11 +3,11 @@ "object" == typeof module && "object" == typeof module.exports ? factory(exports) : "function" == typeof define && define.amd ? define([ "exports" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.0Ts = {}); -}(this, function(exports) { +}(this, function(exports1) { "use strict"; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 - }), Object.defineProperty(exports, "B", { + }), Object.defineProperty(exports1, "B", { enumerable: !0, get: ()=>B }); @@ -23,9 +23,9 @@ "exports", "@swc/helpers/src/_interop_require_wildcard.mjs" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.2Ts = {}, global.interopRequireWildcardMjs); -}(this, function(exports, _interopRequireWildcard) { +}(this, function(exports1, _interopRequireWildcard) { "use strict"; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 }), _interopRequireWildcard = _interopRequireWildcard.default, async function() { class C extends (await import("./0")).B { diff --git a/crates/swc/tests/tsc-references/importCallExpressionInUMD4.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInUMD4.2.minified.js index 2e03d192d35..dd9f8864755 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInUMD4.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInUMD4.2.minified.js @@ -3,16 +3,16 @@ "object" == typeof module && "object" == typeof module.exports ? factory(exports) : "function" == typeof define && define.amd ? define([ "exports" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.0Ts = {}); -}(this, function(exports) { +}(this, function(exports1) { "use strict"; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 }), function(target, all) { for(var name in all)Object.defineProperty(target, name, { enumerable: !0, get: all[name] }); - }(exports, { + }(exports1, { B: ()=>B, foo: ()=>foo }); @@ -30,14 +30,14 @@ "object" == typeof module && "object" == typeof module.exports ? factory(exports) : "function" == typeof define && define.amd ? define([ "exports" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.1Ts = {}); -}(this, function(exports) { +}(this, function(exports1) { "use strict"; function backup() { return "backup"; } - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 - }), Object.defineProperty(exports, "backup", { + }), Object.defineProperty(exports1, "backup", { enumerable: !0, get: ()=>backup }); @@ -48,11 +48,11 @@ "exports", "@swc/helpers/src/_interop_require_wildcard.mjs" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.2Ts = {}, global.interopRequireWildcardMjs); -}(this, function(exports, _interopRequireWildcard) { +}(this, function(exports1, _interopRequireWildcard) { "use strict"; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 - }), Object.defineProperty(exports, "D", { + }), Object.defineProperty(exports1, "D", { enumerable: !0, get: ()=>D }), _interopRequireWildcard = _interopRequireWildcard.default; @@ -62,9 +62,7 @@ import("./0"), this.myModule.then((Zero)=>{ console.log(Zero.foo()); }, async (err)=>{ - console.log(err); - let one = await import("./1"); - console.log(one.backup()); + console.log(err), console.log((await import("./1")).backup()); }); } } diff --git a/crates/swc/tests/tsc-references/importCallExpressionInUMD5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInUMD5.2.minified.js index 1d1ace14d78..eb184531685 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInUMD5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInUMD5.2.minified.js @@ -3,14 +3,14 @@ "object" == typeof module && "object" == typeof module.exports ? factory(exports) : "function" == typeof define && define.amd ? define([ "exports" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.0Ts = {}); -}(this, function(exports) { +}(this, function(exports1) { "use strict"; function foo() { return "foo"; } - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 - }), Object.defineProperty(exports, "foo", { + }), Object.defineProperty(exports1, "foo", { enumerable: !0, get: ()=>foo }); @@ -22,9 +22,9 @@ "@swc/helpers/src/_async_to_generator.mjs", "@swc/helpers/src/_interop_require_wildcard.mjs" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.1Ts = {}, global.asyncToGeneratorMjs, global.interopRequireWildcardMjs); -}(this, function(exports, _asyncToGenerator, _interopRequireWildcard) { +}(this, function(exports1, _asyncToGenerator, _interopRequireWildcard) { "use strict"; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 }), _asyncToGenerator = _asyncToGenerator.default, _interopRequireWildcard = _interopRequireWildcard.default; }); diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedUMD.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionNestedUMD.2.minified.js index de285737d71..737c1c9119e 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedUMD.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedUMD.2.minified.js @@ -3,11 +3,11 @@ "object" == typeof module && "object" == typeof module.exports ? factory(exports) : "function" == typeof define && define.amd ? define([ "exports" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.fooTs = {}); -}(this, function(exports) { +}(this, function(exports1) { "use strict"; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 - }), Object.defineProperty(exports, "default", { + }), Object.defineProperty(exports1, "default", { enumerable: !0, get: ()=>_default }); @@ -20,9 +20,9 @@ "@swc/helpers/src/_async_to_generator.mjs", "@swc/helpers/src/_interop_require_wildcard.mjs" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.indexTs = {}, global.asyncToGeneratorMjs, global.interopRequireWildcardMjs); -}(this, function(exports, _asyncToGenerator, _interopRequireWildcard) { +}(this, function(exports1, _asyncToGenerator, _interopRequireWildcard) { "use strict"; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 }), _asyncToGenerator = _asyncToGenerator.default, _interopRequireWildcard = _interopRequireWildcard.default; }); diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedUMD2.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionNestedUMD2.2.minified.js index fc2ebf405dc..2dc8d673a05 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedUMD2.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedUMD2.2.minified.js @@ -3,11 +3,11 @@ "object" == typeof module && "object" == typeof module.exports ? factory(exports) : "function" == typeof define && define.amd ? define([ "exports" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.fooTs = {}); -}(this, function(exports) { +}(this, function(exports1) { "use strict"; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 - }), Object.defineProperty(exports, "default", { + }), Object.defineProperty(exports1, "default", { enumerable: !0, get: function() { return _default; @@ -23,9 +23,9 @@ "@swc/helpers/src/_interop_require_wildcard.mjs", "@swc/helpers/src/_ts_generator.mjs" ], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.indexTs = {}, global.asyncToGeneratorMjs, global.interopRequireWildcardMjs, global.tsGeneratorMjs); -}(this, function(exports, _asyncToGenerator, _interopRequireWildcard, _tsGenerator) { +}(this, function(exports1, _asyncToGenerator, _interopRequireWildcard, _tsGenerator) { "use strict"; - Object.defineProperty(exports, "__esModule", { + Object.defineProperty(exports1, "__esModule", { value: !0 }), _asyncToGenerator = _asyncToGenerator.default, _interopRequireWildcard = _interopRequireWildcard.default, _tsGenerator = _tsGenerator.default; }); diff --git a/crates/swc/tests/tsc-references/importClause_default.2.minified.js b/crates/swc/tests/tsc-references/importClause_default.2.minified.js index b97f2541be9..81a31dfb040 100644 --- a/crates/swc/tests/tsc-references/importClause_default.2.minified.js +++ b/crates/swc/tests/tsc-references/importClause_default.2.minified.js @@ -6,5 +6,5 @@ var A = function A() { }; export { A as default }; //// [/b.ts] -new A(); +new A(), A; export { }; diff --git a/crates/swc/tests/tsc-references/independentPropertyVariance.2.minified.js b/crates/swc/tests/tsc-references/independentPropertyVariance.2.minified.js index b3722a3cad4..1977eced9fa 100644 --- a/crates/swc/tests/tsc-references/independentPropertyVariance.2.minified.js +++ b/crates/swc/tests/tsc-references/independentPropertyVariance.2.minified.js @@ -1 +1,2 @@ //// [independentPropertyVariance.ts] +x, y; diff --git a/crates/swc/tests/tsc-references/inferFromBindingPattern.2.minified.js b/crates/swc/tests/tsc-references/inferFromBindingPattern.2.minified.js index d4c16e1733d..9e7a8fbce85 100644 --- a/crates/swc/tests/tsc-references/inferFromBindingPattern.2.minified.js +++ b/crates/swc/tests/tsc-references/inferFromBindingPattern.2.minified.js @@ -3,7 +3,7 @@ import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; f1(), _sliced_to_array(f2(), 1)[0], f3().x, _sliced_to_array([ 42 ], 1)[0], _sliced_to_array(selectJohn(), 1)[0]; -var _selectJohn = _sliced_to_array(selectJohn(), 2); -_selectJohn[0], _selectJohn[1]; +var _selectJohn1 = _sliced_to_array(selectJohn(), 2); +_selectJohn1[0], _selectJohn1[1]; var _john = _sliced_to_array(selectJohn(), 2); _john[0], _john[1], makeTuple(stringy()), _sliced_to_array(makeTuple(stringy()), 1)[0]; diff --git a/crates/swc/tests/tsc-references/intersectionReduction.2.minified.js b/crates/swc/tests/tsc-references/intersectionReduction.2.minified.js index 7e52e5dbc59..763b96c6948 100644 --- a/crates/swc/tests/tsc-references/intersectionReduction.2.minified.js +++ b/crates/swc/tests/tsc-references/intersectionReduction.2.minified.js @@ -1,3 +1,10 @@ //// [intersectionReduction.ts] -var Tag1, Tag2; -ab.kind, f10(a1), f10(a2), Tag1 || (Tag1 = {}), Tag2 || (Tag2 = {}), s2 = s1 = s2, t2 = t1 = t2; +ab.kind, x, f10(a1), f10(a2); +var Tag1, Tag2, x2 = { + a: "foo", + b: !0 +}; +({ + a: "foo", + b: 42 +})[k] = "bar", x2[k] = "bar", Tag1 || (Tag1 = {}), Tag2 || (Tag2 = {}), s2 = s1 = s2, t2 = t1 = t2, shouldBeB; diff --git a/crates/swc/tests/tsc-references/intersectionReductionStrict.2.minified.js b/crates/swc/tests/tsc-references/intersectionReductionStrict.2.minified.js index 96a86c6b1a9..fa8ffdb4a80 100644 --- a/crates/swc/tests/tsc-references/intersectionReductionStrict.2.minified.js +++ b/crates/swc/tests/tsc-references/intersectionReductionStrict.2.minified.js @@ -1,3 +1,10 @@ //// [intersectionReductionStrict.ts] -var Tag1, Tag2; -ab.kind, Tag1 || (Tag1 = {}), Tag2 || (Tag2 = {}), s2 = s1 = s2, t2 = t1 = t2; +ab.kind, x; +var Tag1, Tag2, x2 = { + a: "foo", + b: !0 +}; +({ + a: "foo", + b: 42 +})[k] = "bar", x2[k] = "bar", Tag1 || (Tag1 = {}), Tag2 || (Tag2 = {}), s2 = s1 = s2, t2 = t1 = t2; diff --git a/crates/swc/tests/tsc-references/intersectionWithIndexSignatures.2.minified.js b/crates/swc/tests/tsc-references/intersectionWithIndexSignatures.2.minified.js index 360123bea61..bfb6d52871e 100644 --- a/crates/swc/tests/tsc-references/intersectionWithIndexSignatures.2.minified.js +++ b/crates/swc/tests/tsc-references/intersectionWithIndexSignatures.2.minified.js @@ -1,2 +1,2 @@ //// [intersectionWithIndexSignatures.ts] -ta1 = sa1, ta1 = sa2, ta2 = sa1, ta2 = sa2, tb1 = sb1, q.asd.a.substr(1), q.asd.b, tt = ss; +ta1 = sa1, ta1 = sa2, ta2 = sa1, ta2 = sa2, tb1 = sb1, q.asd.a.substr(1), q.asd.b, q, tt = ss; diff --git a/crates/swc/tests/tsc-references/jsxReactTestSuite.2.minified.js b/crates/swc/tests/tsc-references/jsxReactTestSuite.2.minified.js index d2e4799e391..bd84166467c 100644 --- a/crates/swc/tests/tsc-references/jsxReactTestSuite.2.minified.js +++ b/crates/swc/tests/tsc-references/jsxReactTestSuite.2.minified.js @@ -1,28 +1,28 @@ //// [jsxReactTestSuite.tsx] import _extends from "@swc/helpers/src/_extends.mjs"; -this.props.children, this.props.children; +this.props.children, Component, foo, bar, Composite, this.props.children, Composite, Composite2; var x = React.createElement("div", { attr1: "foobar", attr2: "foobarbazbug", attr3: "foobarbazbug", attr4: "baz" }); -Namespace.Component, Namespace.DeepNamespace.Component, _extends({}, x, { +Component, Namespace.Component, Namespace.DeepNamespace.Component, Component, _extends({}, x, { y: 2, z: !0 -}), _extends({}, this.props, { +}), Component, _extends({}, this.props, { sound: "moo" -}), _extends({}, x), _extends({}, x, { +}), Component, y, Component, _extends({}, x), Component, _extends({}, x, { y: 2 -}), _extends({}, x, { +}), Component, _extends({}, x, { y: 2, z: !0 -}), _extends({ +}), Component, _extends({ x: 1 -}, y), _extends({ +}, y), Component, _extends({ x: 1, y: "2" -}, z, z), _extends({ +}, z, z), Child, Component, _extends({ x: "1" }, z = { y: 2 diff --git a/crates/swc/tests/tsc-references/logicalAssignment1(target=es2015).2.minified.js b/crates/swc/tests/tsc-references/logicalAssignment1(target=es2015).2.minified.js index a7c885451db..84bef276885 100644 --- a/crates/swc/tests/tsc-references/logicalAssignment1(target=es2015).2.minified.js +++ b/crates/swc/tests/tsc-references/logicalAssignment1(target=es2015).2.minified.js @@ -1,2 +1,2 @@ //// [logicalAssignment1.ts] -a && (a = "foo"), b || (b = "foo"), null != c || (c = "foo"), d && (d = 42), e || (e = 42), null != f || (f = 42), g && (g = 42), h || (h = 42), null != i || (i = 42); +a && (a = "foo"), b || (b = "foo"), null != c ? c : c = "foo", d && (d = 42), e || (e = 42), null != f ? f : f = 42, g && (g = 42), h || (h = 42), null != i ? i : i = 42; diff --git a/crates/swc/tests/tsc-references/logicalAssignment2(target=es2015).2.minified.js b/crates/swc/tests/tsc-references/logicalAssignment2(target=es2015).2.minified.js index abbfb1ad92f..8816ffe051b 100644 --- a/crates/swc/tests/tsc-references/logicalAssignment2(target=es2015).2.minified.js +++ b/crates/swc/tests/tsc-references/logicalAssignment2(target=es2015).2.minified.js @@ -1,3 +1,3 @@ //// [logicalAssignment2.ts] -var _a, _b, _c, _a_foo, _b_foo, _c_foo, _a_foo_bar, _b_foo_bar, _c_foo_bar, _baz, _, _baz1; -(_a = a).baz && (_a.baz = result.baz), (_b = b).baz || (_b.baz = result.baz), null !== (_baz = (_c = c).baz) && void 0 !== _baz || (_c.baz = result.baz), (_a_foo = a.foo).baz && (_a_foo.baz = result.foo.baz), (_b_foo = b.foo).baz || (_b_foo.baz = result.foo.baz), null !== (_ = (_c_foo = c.foo).baz) && void 0 !== _ || (_c_foo.baz = result.foo.baz), (_a_foo_bar = a.foo.bar()).baz && (_a_foo_bar.baz = result.foo.bar().baz), (_b_foo_bar = b.foo.bar()).baz || (_b_foo_bar.baz = result.foo.bar().baz), null !== (_baz1 = (_c_foo_bar = c.foo.bar()).baz) && void 0 !== _baz1 || (_c_foo_bar.baz = result.foo.bar().baz); +var _a, _b, _c, _a_foo, _b_foo, _c_foo, _a_foo_bar, _b_foo_bar, _c_foo_bar, _baz3, _, _baz4; +(_a = a).baz && (_a.baz = result.baz), (_b = b).baz || (_b.baz = result.baz), null !== (_baz3 = (_c = c).baz) && void 0 !== _baz3 || (_c.baz = result.baz), (_a_foo = a.foo).baz && (_a_foo.baz = result.foo.baz), (_b_foo = b.foo).baz || (_b_foo.baz = result.foo.baz), null !== (_ = (_c_foo = c.foo).baz) && void 0 !== _ || (_c_foo.baz = result.foo.baz), (_a_foo_bar = a.foo.bar()).baz && (_a_foo_bar.baz = result.foo.bar().baz), (_b_foo_bar = b.foo.bar()).baz || (_b_foo_bar.baz = result.foo.bar().baz), null !== (_baz4 = (_c_foo_bar = c.foo.bar()).baz) && void 0 !== _baz4 || (_c_foo_bar.baz = result.foo.bar().baz); diff --git a/crates/swc/tests/tsc-references/mappedTypeOverlappingStringEnumKeys.2.minified.js b/crates/swc/tests/tsc-references/mappedTypeOverlappingStringEnumKeys.2.minified.js index bba9cb48d63..a345bc04931 100644 --- a/crates/swc/tests/tsc-references/mappedTypeOverlappingStringEnumKeys.2.minified.js +++ b/crates/swc/tests/tsc-references/mappedTypeOverlappingStringEnumKeys.2.minified.js @@ -2,6 +2,4 @@ var TerrestrialAnimalTypes, AlienAnimalTypes; !function(TerrestrialAnimalTypes) { TerrestrialAnimalTypes.CAT = "cat", TerrestrialAnimalTypes.DOG = "dog"; -}(TerrestrialAnimalTypes || (TerrestrialAnimalTypes = {})), function(AlienAnimalTypes) { - AlienAnimalTypes.CAT = "cat"; -}(AlienAnimalTypes || (AlienAnimalTypes = {})), TerrestrialAnimalTypes.CAT, AlienAnimalTypes.CAT; +}(TerrestrialAnimalTypes || (TerrestrialAnimalTypes = {})), (AlienAnimalTypes || (AlienAnimalTypes = {})).CAT = "cat", TerrestrialAnimalTypes.CAT, AlienAnimalTypes.CAT; diff --git a/crates/swc/tests/tsc-references/mixinClassesMembers.2.minified.js b/crates/swc/tests/tsc-references/mixinClassesMembers.2.minified.js index acee3e1e35d..6d0bfcb8e14 100644 --- a/crates/swc/tests/tsc-references/mixinClassesMembers.2.minified.js +++ b/crates/swc/tests/tsc-references/mixinClassesMembers.2.minified.js @@ -4,3 +4,4 @@ import _get from "@swc/helpers/src/_get.mjs"; import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; +Mixed1, Mixed3; diff --git a/crates/swc/tests/tsc-references/neverTypeErrors1.2.minified.js b/crates/swc/tests/tsc-references/neverTypeErrors1.2.minified.js index 09c29702952..7616f200dd3 100644 --- a/crates/swc/tests/tsc-references/neverTypeErrors1.2.minified.js +++ b/crates/swc/tests/tsc-references/neverTypeErrors1.2.minified.js @@ -12,4 +12,4 @@ try { if (_didIteratorError) throw _iteratorError; } } -for(var n in f4()); +for(var n1 in f4()); diff --git a/crates/swc/tests/tsc-references/neverTypeErrors2.2.minified.js b/crates/swc/tests/tsc-references/neverTypeErrors2.2.minified.js index 903cf45450c..9969ba48602 100644 --- a/crates/swc/tests/tsc-references/neverTypeErrors2.2.minified.js +++ b/crates/swc/tests/tsc-references/neverTypeErrors2.2.minified.js @@ -12,4 +12,4 @@ try { if (_didIteratorError) throw _iteratorError; } } -for(var n in f4()); +for(var n1 in f4()); diff --git a/crates/swc/tests/tsc-references/noUncheckedIndexedAccessDestructuring.2.minified.js b/crates/swc/tests/tsc-references/noUncheckedIndexedAccessDestructuring.2.minified.js index 7f5c1a0b249..fefc57a32d9 100644 --- a/crates/swc/tests/tsc-references/noUncheckedIndexedAccessDestructuring.2.minified.js +++ b/crates/swc/tests/tsc-references/noUncheckedIndexedAccessDestructuring.2.minified.js @@ -5,9 +5,9 @@ import _object_without_properties from "@swc/helpers/src/_object_without_propert import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; import _to_array from "@swc/helpers/src/_to_array.mjs"; _sliced_to_array(strArray, 1)[0].toString(), _to_array(strArray).slice(0).push(void 0), _to_array(strArray).slice(2).push(void 0), strMap.t1.toString(), _extends({}, _object_destructuring_empty(strMap)).z.toString(); -var ref, x = numMapPoint.x, y = numMapPoint.y, z = numMapPoint.z; +var ref3, x = numMapPoint.x, y = numMapPoint.y, z = numMapPoint.z; x.toFixed(), y.toFixed(), z.toFixed(); var x1 = numMapPoint.x, q = _object_without_properties(numMapPoint, [ "x" ]); -x1.toFixed(), q.y.toFixed(), q.z.toFixed(), target_string = _sliced_to_array(strArray, 1)[0], target_string_undef = _sliced_to_array(strArray, 1)[0], target_string_arr = _to_array(strArray).slice(3), (ref = numMapPoint).x, ref.y, ref.z, numMapPoint.q; +x1.toFixed(), q.y.toFixed(), q.z.toFixed(), target_string = _sliced_to_array(strArray, 1)[0], target_string_undef = _sliced_to_array(strArray, 1)[0], target_string_arr = _to_array(strArray).slice(3), (ref3 = numMapPoint).x, ref3.y, ref3.z, numMapPoint.q; diff --git a/crates/swc/tests/tsc-references/nonPrimitiveStrictNull.2.minified.js b/crates/swc/tests/tsc-references/nonPrimitiveStrictNull.2.minified.js index cd08440615d..e2a94a941eb 100644 --- a/crates/swc/tests/tsc-references/nonPrimitiveStrictNull.2.minified.js +++ b/crates/swc/tests/tsc-references/nonPrimitiveStrictNull.2.minified.js @@ -1,3 +1,3 @@ //// [nonPrimitiveStrictNull.ts] var a; -a.toString, a = void 0, a = null, a = b, a = c, a = a = d, "object" != typeof b && b.toString(), "object" == typeof b && (a = b), "object" == typeof d && (b = d), d.toString(), d.toString(), d.toString(), d.toString(); +a.toString, a = void 0, a = null, a = b, a = c, a = a = d, "object" != typeof b && b.toString(), "object" == typeof b && (a = b), "object" == typeof d && (b = d), d.toString(), d, d.toString(), d, d.toString(), d.toString(); diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperator1.2.minified.js b/crates/swc/tests/tsc-references/nullishCoalescingOperator1.2.minified.js index b3b4e9773f0..c543ceda77b 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperator1.2.minified.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperator1.2.minified.js @@ -1,2 +1,2 @@ //// [nullishCoalescingOperator1.ts] -foo(), foo(), foo(); +null != a1 && a1, null != a2 && a2, null != a3 && a3, null != a4 && a4, null != b1 && b1, null != b2 && b2, null != b3 && b3, null != b4 && b4, null == c1 || c1, null == c2 || c2, null == c3 || c3, null == c4 || c4, null != d1 && d1, null != d2 && d2, null != d3 && d3, null != d4 && d4, foo(), foo(), foo(); diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperator11.2.minified.js b/crates/swc/tests/tsc-references/nullishCoalescingOperator11.2.minified.js index e49b28ffd14..6a30b1c2e24 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperator11.2.minified.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperator11.2.minified.js @@ -1,2 +1,2 @@ //// [nullishCoalescingOperator11.ts] -null != f11 || f11.toFixed(); +null != f11 ? f11 : f11.toFixed(); diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperator2.2.minified.js b/crates/swc/tests/tsc-references/nullishCoalescingOperator2.2.minified.js index 1f6477878b8..ac5e644aced 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperator2.2.minified.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperator2.2.minified.js @@ -1 +1,2 @@ //// [nullishCoalescingOperator2.ts] +null != a1 && a1, null != a2 && a2, null != a3 && a3, null != a4 && a4, null != a5 && a5, null != a6 && a6, null != a7 && a7, null != a8 && a8, null != a9 && a9; diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperator3.2.minified.js b/crates/swc/tests/tsc-references/nullishCoalescingOperator3.2.minified.js index cfb11fbf35e..0a314f3f6f8 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperator3.2.minified.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperator3.2.minified.js @@ -1 +1,3 @@ //// [nullishCoalescingOperator3.ts] +var _ref, _ref1, _ref2, _ref3; +null !== (_ref3 = null !== (_ref2 = null !== (_ref1 = null !== (_ref = null != a1 ? a1 : a2) && void 0 !== _ref ? _ref : a3) && void 0 !== _ref1 ? _ref1 : a4) && void 0 !== _ref2 ? _ref2 : a5) && void 0 !== _ref3 || a6; diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperator4.2.minified.js b/crates/swc/tests/tsc-references/nullishCoalescingOperator4.2.minified.js index c88525e724a..c53da95832b 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperator4.2.minified.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperator4.2.minified.js @@ -1,2 +1,2 @@ //// [nullishCoalescingOperator4.ts] -null != a1 || a1.toLowerCase(), a1 || a1.toLocaleUpperCase(); +null != a1 ? a1 : a1.toLowerCase(), a1 || a1.toLocaleUpperCase(); diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperator7.2.minified.js b/crates/swc/tests/tsc-references/nullishCoalescingOperator7.2.minified.js index 00e79ba2ce1..7fb029b43f2 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperator7.2.minified.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperator7.2.minified.js @@ -1 +1,2 @@ //// [nullishCoalescingOperator7.ts] +a, null != a && a, (null != a ? a : "foo") ? null != b && b : null != c && c; diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperator8.2.minified.js b/crates/swc/tests/tsc-references/nullishCoalescingOperator8.2.minified.js index be38fd560c2..d01661f989d 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperator8.2.minified.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperator8.2.minified.js @@ -1,3 +1,3 @@ //// [nullishCoalescingOperator8.ts] -var _a_m, _ref; -a.p, a.m(), null !== (_ref = null !== (_a_m = a.m()) && void 0 !== _a_m ? _a_m : b.p) && void 0 !== _ref || b.m(); +var _a_m1, _ref; +a.p, a.m(), null !== (_ref = null !== (_a_m1 = a.m()) && void 0 !== _a_m1 ? _a_m1 : b.p) && void 0 !== _ref || b.m(); diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperator9.2.minified.js b/crates/swc/tests/tsc-references/nullishCoalescingOperator9.2.minified.js index 1fe269df614..9bf2a36f0ca 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperator9.2.minified.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperator9.2.minified.js @@ -1 +1,2 @@ //// [nullishCoalescingOperator9.ts] +f, null != f && f; diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperator_es2020.2.minified.js b/crates/swc/tests/tsc-references/nullishCoalescingOperator_es2020.2.minified.js index 3429217f8d6..ab37ff6a940 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperator_es2020.2.minified.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperator_es2020.2.minified.js @@ -1 +1,2 @@ //// [nullishCoalescingOperator_es2020.ts] +a1, a2, a3, a4, a5, a6, a7, a8, a9, (a ?? b) || c, c || (a ?? b), (a ?? b) || c, c || (a ?? b), (a ?? b) || c, c || (a ?? b), (a ?? b) && c, c && (a ?? b), (a ?? b) && c, c && (a ?? b), (a ?? b) && c, c && (a ?? b); diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperator_not_strict.2.minified.js b/crates/swc/tests/tsc-references/nullishCoalescingOperator_not_strict.2.minified.js index f7a0e15b03e..f5160d52c29 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperator_not_strict.2.minified.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperator_not_strict.2.minified.js @@ -1 +1,2 @@ //// [nullishCoalescingOperator_not_strict.ts] +null != a1 && a1, null != a2 && a2, null != a3 && a3, null != a4 && a4, null != a5 && a5, null != a6 && a6, null != a7 && a7, null != a8 && a8, null != a9 && a9; diff --git a/crates/swc/tests/tsc-references/objectLiteralNormalization.2.minified.js b/crates/swc/tests/tsc-references/objectLiteralNormalization.2.minified.js index 4efd32ec71d..8f3ae8142d0 100644 --- a/crates/swc/tests/tsc-references/objectLiteralNormalization.2.minified.js +++ b/crates/swc/tests/tsc-references/objectLiteralNormalization.2.minified.js @@ -32,7 +32,7 @@ a2.a, a2.b, a2 = { var b2 = _object_spread_props(_object_spread({}, b1), { z: 55 }); -_object_spread({}, b2); +_object_spread({}, b2), opts; var d1 = { kind: "a", pos: { diff --git a/crates/swc/tests/tsc-references/objectRestForOf.2.minified.js b/crates/swc/tests/tsc-references/objectRestForOf.2.minified.js index a6b5daa04f4..bf721a827a1 100644 --- a/crates/swc/tests/tsc-references/objectRestForOf.2.minified.js +++ b/crates/swc/tests/tsc-references/objectRestForOf.2.minified.js @@ -3,15 +3,15 @@ let array, xx; import _object_spread from "@swc/helpers/src/_object_spread.mjs"; import _object_spread_props from "@swc/helpers/src/_object_spread_props.mjs"; import _object_without_properties from "@swc/helpers/src/_object_without_properties.mjs"; -for (let _ref1 of array){ - var _ref, { x } = _ref1; - _object_without_properties(_ref1, [ +for (let _ref of array){ + var _ref1, { x } = _ref; + _object_without_properties(_ref, [ "x" ]); } -for (var _ref1 of array)_object_without_properties(_ref = _ref1, [ +for (var _ref of array)_object_without_properties(_ref1 = _ref, [ "x" -]), { x: xx } = _ref; +]), { x: xx } = _ref1; for (let norest of array.map((a)=>_object_spread_props(_object_spread({}, a), { x: 'a string' })))norest.x, norest.y; diff --git a/crates/swc/tests/tsc-references/optionalChainingInference.2.minified.js b/crates/swc/tests/tsc-references/optionalChainingInference.2.minified.js index 9f7cb853877..54c62ef9058 100644 --- a/crates/swc/tests/tsc-references/optionalChainingInference.2.minified.js +++ b/crates/swc/tests/tsc-references/optionalChainingInference.2.minified.js @@ -1,18 +1,33 @@ //// [optionalChainingInference.ts] -unbox({ +var b1 = { value: null == su ? void 0 : su.length -}), unbox({ +}; +unbox(b1); +var b2 = { value: null == su ? void 0 : su.length -}), unbox({ +}; +unbox(b2); +var b3 = { value: null == su ? void 0 : su.length -}), unbox({ +}; +unbox(b3); +var b4 = { value: null == fnu ? void 0 : fnu() -}), unbox({ +}; +unbox(b4); +var b5 = { value: null == su ? void 0 : su.length -}), unbox({ +}; +unbox(b5); +var b6 = { value: null == osu ? void 0 : osu.prop.length -}), unbox({ +}; +unbox(b6); +var b7 = { value: null == osu ? void 0 : osu.prop.length -}), unbox({ +}; +unbox(b7); +var b8 = { value: null == ofnu ? void 0 : ofnu.prop() -}); +}; +unbox(b8); diff --git a/crates/swc/tests/tsc-references/optionalPropertyAssignableToStringIndexSignature.2.minified.js b/crates/swc/tests/tsc-references/optionalPropertyAssignableToStringIndexSignature.2.minified.js index b406d500263..bb41f317fc4 100644 --- a/crates/swc/tests/tsc-references/optionalPropertyAssignableToStringIndexSignature.2.minified.js +++ b/crates/swc/tests/tsc-references/optionalPropertyAssignableToStringIndexSignature.2.minified.js @@ -1,2 +1,2 @@ //// [optionalPropertyAssignableToStringIndexSignature.ts] -stringDictionary = optionalProperties, stringDictionary = undefinedProperties, probablyArray = numberLiteralKeys; +stringDictionary = optionalProperties, stringDictionary = undefinedProperties, probablyArray = numberLiteralKeys, optionalUndefined; diff --git a/crates/swc/tests/tsc-references/override3.2.minified.js b/crates/swc/tests/tsc-references/override3.2.minified.js index ccc46bc5d01..0d11f57b863 100644 --- a/crates/swc/tests/tsc-references/override3.2.minified.js +++ b/crates/swc/tests/tsc-references/override3.2.minified.js @@ -2,3 +2,4 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; +B, D, D; diff --git a/crates/swc/tests/tsc-references/parserNotRegex2.2.minified.js b/crates/swc/tests/tsc-references/parserNotRegex2.2.minified.js index 905d76051b9..04f128ed61b 100644 --- a/crates/swc/tests/tsc-references/parserNotRegex2.2.minified.js +++ b/crates/swc/tests/tsc-references/parserNotRegex2.2.minified.js @@ -1,2 +1,2 @@ //// [parserNotRegex2.ts] -B(C(), function() {}, function() {}); +A, B(C(), function() {}, function() {}); diff --git a/crates/swc/tests/tsc-references/privateNamesUnique-1.2.minified.js b/crates/swc/tests/tsc-references/privateNamesUnique-1.2.minified.js index 968bf3ef474..a97c07fe14b 100644 --- a/crates/swc/tests/tsc-references/privateNamesUnique-1.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNamesUnique-1.2.minified.js @@ -1,9 +1,9 @@ //// [privateNamesUnique-1.ts] import _class_private_field_init from "@swc/helpers/src/_class_private_field_init.mjs"; -var _foo = new WeakMap(); +var _foo1 = new WeakMap(); new class { constructor(){ - _class_private_field_init(this, _foo, { + _class_private_field_init(this, _foo1, { writable: !0, value: void 0 }); diff --git a/crates/swc/tests/tsc-references/privateNamesUnique-4.2.minified.js b/crates/swc/tests/tsc-references/privateNamesUnique-4.2.minified.js index 6d935cbc63a..d9704b7adc1 100644 --- a/crates/swc/tests/tsc-references/privateNamesUnique-4.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNamesUnique-4.2.minified.js @@ -1,2 +1,3 @@ //// [privateNamesUnique-4.ts] import _class_private_field_init from "@swc/helpers/src/_class_private_field_init.mjs"; +a; diff --git a/crates/swc/tests/tsc-references/privateNamesUnique-5.2.minified.js b/crates/swc/tests/tsc-references/privateNamesUnique-5.2.minified.js index e5db5a7ab19..0f9bd879365 100644 --- a/crates/swc/tests/tsc-references/privateNamesUnique-5.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNamesUnique-5.2.minified.js @@ -1,9 +1,9 @@ //// [privateNamesUnique-5.ts] import _class_private_field_init from "@swc/helpers/src/_class_private_field_init.mjs"; -var _foo = new WeakMap(); +var _foo1 = new WeakMap(); new class { constructor(){ - _class_private_field_init(this, _foo, { + _class_private_field_init(this, _foo1, { writable: !0, value: void 0 }); diff --git a/crates/swc/tests/tsc-references/propertyOverridesAccessors4.2.minified.js b/crates/swc/tests/tsc-references/propertyOverridesAccessors4.2.minified.js index deac13d2381..4a713bd2467 100644 --- a/crates/swc/tests/tsc-references/propertyOverridesAccessors4.2.minified.js +++ b/crates/swc/tests/tsc-references/propertyOverridesAccessors4.2.minified.js @@ -4,3 +4,4 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _define_property from "@swc/helpers/src/_define_property.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; +Animal; diff --git a/crates/swc/tests/tsc-references/restElementWithAssignmentPattern3.2.minified.js b/crates/swc/tests/tsc-references/restElementWithAssignmentPattern3.2.minified.js index 7064e1d0418..b90164ce3ed 100644 --- a/crates/swc/tests/tsc-references/restElementWithAssignmentPattern3.2.minified.js +++ b/crates/swc/tests/tsc-references/restElementWithAssignmentPattern3.2.minified.js @@ -1,8 +1,8 @@ //// [restElementWithAssignmentPattern3.ts] -var ref; +var ref1; import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; import _to_array from "@swc/helpers/src/_to_array.mjs"; -(ref = _sliced_to_array(_to_array([ +(ref1 = _sliced_to_array(_to_array([ "", 1 -]).slice(0), 2))[0], ref[1]; +]).slice(0), 2))[0], ref1[1]; diff --git a/crates/swc/tests/tsc-references/restElementWithAssignmentPattern4.2.minified.js b/crates/swc/tests/tsc-references/restElementWithAssignmentPattern4.2.minified.js index 9c2cfa2cdef..5f3d56418c2 100644 --- a/crates/swc/tests/tsc-references/restElementWithAssignmentPattern4.2.minified.js +++ b/crates/swc/tests/tsc-references/restElementWithAssignmentPattern4.2.minified.js @@ -1,7 +1,7 @@ //// [restElementWithAssignmentPattern4.ts] -var ref; +var ref1; import _to_array from "@swc/helpers/src/_to_array.mjs"; -(ref = _to_array([ +(ref1 = _to_array([ "", 1 -]).slice(0))[0], ref.b; +]).slice(0))[0], ref1.b; diff --git a/crates/swc/tests/tsc-references/stringLiteralTypesAndParenthesizedExpressions01.2.minified.js b/crates/swc/tests/tsc-references/stringLiteralTypesAndParenthesizedExpressions01.2.minified.js index 796eea6ff2f..7e04f3182be 100644 --- a/crates/swc/tests/tsc-references/stringLiteralTypesAndParenthesizedExpressions01.2.minified.js +++ b/crates/swc/tests/tsc-references/stringLiteralTypesAndParenthesizedExpressions01.2.minified.js @@ -1 +1,2 @@ //// [stringLiteralTypesAndParenthesizedExpressions01.ts] +myRandBool, myRandBool; diff --git a/crates/swc/tests/tsc-references/subtypingWithConstructSignatures.2.minified.js b/crates/swc/tests/tsc-references/subtypingWithConstructSignatures.2.minified.js index 5765923a923..8cf20b482c3 100644 --- a/crates/swc/tests/tsc-references/subtypingWithConstructSignatures.2.minified.js +++ b/crates/swc/tests/tsc-references/subtypingWithConstructSignatures.2.minified.js @@ -1,6 +1,6 @@ //// [subtypingWithConstructSignatures.ts] var ConstructSignature; !function(ConstructSignature) { - var rarg2, r3arg1, r4arg1; - foo1(void 0), foo1(rarg2), foo2(r3arg1), foo2(r4arg1); + var rarg1, rarg2, r3arg1, r4arg1; + foo1(rarg1), foo1(rarg2), foo2(r3arg1), foo2(r4arg1); }(ConstructSignature || (ConstructSignature = {})); diff --git a/crates/swc/tests/tsc-references/subtypingWithConstructSignatures3.2.minified.js b/crates/swc/tests/tsc-references/subtypingWithConstructSignatures3.2.minified.js index 0cea9ba0786..f48b16544ea 100644 --- a/crates/swc/tests/tsc-references/subtypingWithConstructSignatures3.2.minified.js +++ b/crates/swc/tests/tsc-references/subtypingWithConstructSignatures3.2.minified.js @@ -4,9 +4,9 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; !function(Errors) { - var r2arg1, r3arg1, r4arg1, r5arg1, r6arg1, r7arg1, r7arg3, r8arg, r9arg; - foo2(void 0), foo7(r2arg1), foo8(r3arg1), foo10(r4arg1), foo11(r5arg1), foo12(r6arg1), foo15(r7arg1), foo15(r7arg3), foo16(r8arg), foo17(r9arg); + var r1arg1, r2arg1, r3arg1, r4arg1, r5arg1, r6arg1, r7arg1, r7arg3, r8arg, r9arg; + foo2(r1arg1), foo7(r2arg1), foo8(r3arg1), foo10(r4arg1), foo11(r5arg1), foo12(r6arg1), foo15(r7arg1), foo15(r7arg3), foo16(r8arg), foo17(r9arg); }(Errors || (Errors = {})), function(WithGenericSignaturesInBaseType) { - var r3arg2; - foo2(void 0), foo3(r3arg2); + var r2arg2, r3arg2; + foo2(r2arg2), foo3(r3arg2); }(WithGenericSignaturesInBaseType || (WithGenericSignaturesInBaseType = {})); diff --git a/crates/swc/tests/tsc-references/symbolProperty51.2.minified.js b/crates/swc/tests/tsc-references/symbolProperty51.2.minified.js index fbe9ba44a51..c357cb50c28 100644 --- a/crates/swc/tests/tsc-references/symbolProperty51.2.minified.js +++ b/crates/swc/tests/tsc-references/symbolProperty51.2.minified.js @@ -1,3 +1,3 @@ //// [symbolProperty51.ts] var M; -M || (M = {}), Symbol.iterator; +M || (M = {}); diff --git a/crates/swc/tests/tsc-references/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.2.minified.js b/crates/swc/tests/tsc-references/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.2.minified.js index 786771f733c..6810ad15fa0 100644 --- a/crates/swc/tests/tsc-references/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.2.minified.js +++ b/crates/swc/tests/tsc-references/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.2.minified.js @@ -4,7 +4,7 @@ function _templateObject() { var data = _tagged_template_literal([ "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n" ]); - return _templateObject = function _templateObject() { + return _templateObject = function() { return data; }, data; } diff --git a/crates/swc/tests/tsc-references/taggedTemplateStringsTypeArgumentInference.2.minified.js b/crates/swc/tests/tsc-references/taggedTemplateStringsTypeArgumentInference.2.minified.js index 13099b54a30..0ea59c59e68 100644 --- a/crates/swc/tests/tsc-references/taggedTemplateStringsTypeArgumentInference.2.minified.js +++ b/crates/swc/tests/tsc-references/taggedTemplateStringsTypeArgumentInference.2.minified.js @@ -4,7 +4,7 @@ function _templateObject() { var data = _tagged_template_literal([ "" ]); - return _templateObject = function _templateObject() { + return _templateObject = function() { return data; }, data; } @@ -12,7 +12,7 @@ function _templateObject1() { var data = _tagged_template_literal([ "" ]); - return _templateObject1 = function _templateObject1() { + return _templateObject1 = function() { return data; }, data; } @@ -21,7 +21,7 @@ function _templateObject2() { "", "" ]); - return _templateObject2 = function _templateObject2() { + return _templateObject2 = function() { return data; }, data; } @@ -30,7 +30,7 @@ function _templateObject3() { "", "" ]); - return _templateObject3 = function _templateObject3() { + return _templateObject3 = function() { return data; }, data; } @@ -39,7 +39,7 @@ function _templateObject4() { "", "" ]); - return _templateObject4 = function _templateObject4() { + return _templateObject4 = function() { return data; }, data; } @@ -48,7 +48,7 @@ function _templateObject5() { "", "" ]); - return _templateObject5 = function _templateObject5() { + return _templateObject5 = function() { return data; }, data; } @@ -57,7 +57,7 @@ function _templateObject6() { "", "" ]); - return _templateObject6 = function _templateObject6() { + return _templateObject6 = function() { return data; }, data; } @@ -66,7 +66,7 @@ function _templateObject7() { "", "" ]); - return _templateObject7 = function _templateObject7() { + return _templateObject7 = function() { return data; }, data; } @@ -75,7 +75,7 @@ function _templateObject8() { "", "" ]); - return _templateObject8 = function _templateObject8() { + return _templateObject8 = function() { return data; }, data; } @@ -85,7 +85,7 @@ function _templateObject9() { "", "" ]); - return _templateObject9 = function _templateObject9() { + return _templateObject9 = function() { return data; }, data; } @@ -95,7 +95,7 @@ function _templateObject10() { "", "" ]); - return _templateObject10 = function _templateObject10() { + return _templateObject10 = function() { return data; }, data; } @@ -105,7 +105,7 @@ function _templateObject11() { "", "" ]); - return _templateObject11 = function _templateObject11() { + return _templateObject11 = function() { return data; }, data; } @@ -115,7 +115,7 @@ function _templateObject12() { " ", "" ]); - return _templateObject12 = function _templateObject12() { + return _templateObject12 = function() { return data; }, data; } @@ -125,7 +125,7 @@ function _templateObject13() { "", "" ]); - return _templateObject13 = function _templateObject13() { + return _templateObject13 = function() { return data; }, data; } @@ -135,7 +135,7 @@ function _templateObject14() { "", "" ]); - return _templateObject14 = function _templateObject14() { + return _templateObject14 = function() { return data; }, data; } @@ -146,7 +146,7 @@ function _templateObject15() { "", "" ]); - return _templateObject15 = function _templateObject15() { + return _templateObject15 = function() { return data; }, data; } @@ -157,7 +157,7 @@ function _templateObject16() { "", "" ]); - return _templateObject16 = function _templateObject16() { + return _templateObject16 = function() { return data; }, data; } @@ -168,7 +168,7 @@ function _templateObject17() { "", "" ]); - return _templateObject17 = function _templateObject17() { + return _templateObject17 = function() { return data; }, data; } @@ -179,7 +179,7 @@ function _templateObject18() { "", "" ]); - return _templateObject18 = function _templateObject18() { + return _templateObject18 = function() { return data; }, data; } @@ -190,7 +190,7 @@ function _templateObject19() { "", "" ]); - return _templateObject19 = function _templateObject19() { + return _templateObject19 = function() { return data; }, data; } @@ -201,7 +201,7 @@ function _templateObject20() { "", "" ]); - return _templateObject20 = function _templateObject20() { + return _templateObject20 = function() { return data; }, data; } @@ -210,7 +210,7 @@ function _templateObject21() { "", "" ]); - return _templateObject21 = function _templateObject21() { + return _templateObject21 = function() { return data; }, data; } @@ -221,7 +221,7 @@ function _templateObject22() { "", "" ]); - return _templateObject22 = function _templateObject22() { + return _templateObject22 = function() { return data; }, data; } @@ -232,7 +232,7 @@ function _templateObject23() { "", "" ]); - return _templateObject23 = function _templateObject23() { + return _templateObject23 = function() { return data; }, data; } @@ -243,7 +243,7 @@ function _templateObject24() { "", "" ]); - return _templateObject24 = function _templateObject24() { + return _templateObject24 = function() { return data; }, data; } @@ -254,7 +254,7 @@ function _templateObject25() { "", "" ]); - return _templateObject25 = function _templateObject25() { + return _templateObject25 = function() { return data; }, data; } @@ -265,7 +265,7 @@ function _templateObject26() { "", "" ]); - return _templateObject26 = function _templateObject26() { + return _templateObject26 = function() { return data; }, data; } @@ -276,7 +276,7 @@ function _templateObject27() { "", "" ]); - return _templateObject27 = function _templateObject27() { + return _templateObject27 = function() { return data; }, data; } diff --git a/crates/swc/tests/tsc-references/taggedTemplateStringsWithIncompatibleTypedTags.2.minified.js b/crates/swc/tests/tsc-references/taggedTemplateStringsWithIncompatibleTypedTags.2.minified.js index 7b09a3e37f5..fd690bbda91 100644 --- a/crates/swc/tests/tsc-references/taggedTemplateStringsWithIncompatibleTypedTags.2.minified.js +++ b/crates/swc/tests/tsc-references/taggedTemplateStringsWithIncompatibleTypedTags.2.minified.js @@ -5,7 +5,7 @@ function _templateObject() { var data = _tagged_template_literal([ "abc" ]); - return _templateObject = function _templateObject() { + return _templateObject = function() { return data; }, data; } @@ -15,7 +15,7 @@ function _templateObject1() { "def", "ghi" ]); - return _templateObject1 = function _templateObject1() { + return _templateObject1 = function() { return data; }, data; } @@ -23,7 +23,7 @@ function _templateObject2() { var data = _tagged_template_literal([ "abc" ]); - return _templateObject2 = function _templateObject2() { + return _templateObject2 = function() { return data; }, data; } @@ -33,7 +33,7 @@ function _templateObject3() { "def", "ghi" ]); - return _templateObject3 = function _templateObject3() { + return _templateObject3 = function() { return data; }, data; } @@ -41,7 +41,7 @@ function _templateObject4() { var data = _tagged_template_literal([ "abc" ]); - return _templateObject4 = function _templateObject4() { + return _templateObject4 = function() { return data; }, data; } @@ -51,7 +51,7 @@ function _templateObject5() { "def", "ghi" ]); - return _templateObject5 = function _templateObject5() { + return _templateObject5 = function() { return data; }, data; } @@ -59,7 +59,7 @@ function _templateObject6() { var data = _tagged_template_literal([ "abc" ]); - return _templateObject6 = function _templateObject6() { + return _templateObject6 = function() { return data; }, data; } @@ -69,7 +69,7 @@ function _templateObject7() { "def", "ghi" ]); - return _templateObject7 = function _templateObject7() { + return _templateObject7 = function() { return data; }, data; } @@ -79,7 +79,7 @@ function _templateObject8() { "def", "ghi" ]); - return _templateObject8 = function _templateObject8() { + return _templateObject8 = function() { return data; }, data; } @@ -89,7 +89,7 @@ function _templateObject9() { "def", "ghi" ]); - return _templateObject9 = function _templateObject9() { + return _templateObject9 = function() { return data; }, data; } @@ -99,7 +99,7 @@ function _templateObject10() { "def", "ghi" ]); - return _templateObject10 = function _templateObject10() { + return _templateObject10 = function() { return data; }, data; } @@ -109,7 +109,7 @@ function _templateObject11() { "def", "ghi" ]); - return _templateObject11 = function _templateObject11() { + return _templateObject11 = function() { return data; }, data; } diff --git a/crates/swc/tests/tsc-references/taggedTemplateStringsWithManyCallAndMemberExpressions.2.minified.js b/crates/swc/tests/tsc-references/taggedTemplateStringsWithManyCallAndMemberExpressions.2.minified.js index 22108ad2e1d..bc82d929d56 100644 --- a/crates/swc/tests/tsc-references/taggedTemplateStringsWithManyCallAndMemberExpressions.2.minified.js +++ b/crates/swc/tests/tsc-references/taggedTemplateStringsWithManyCallAndMemberExpressions.2.minified.js @@ -6,7 +6,7 @@ function _templateObject() { "abc", "def" ]); - return _templateObject = function _templateObject() { + return _templateObject = function() { return data; }, data; } diff --git a/crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution1.2.minified.js b/crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution1.2.minified.js index 24e584655dd..2bf3a9892c3 100644 --- a/crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution1.2.minified.js +++ b/crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution1.2.minified.js @@ -4,7 +4,7 @@ function _templateObject() { var data = _tagged_template_literal([ "" ]); - return _templateObject = function _templateObject() { + return _templateObject = function() { return data; }, data; } @@ -13,7 +13,7 @@ function _templateObject1() { "", "" ]); - return _templateObject1 = function _templateObject1() { + return _templateObject1 = function() { return data; }, data; } @@ -23,7 +23,7 @@ function _templateObject2() { "", "" ]); - return _templateObject2 = function _templateObject2() { + return _templateObject2 = function() { return data; }, data; } @@ -33,7 +33,7 @@ function _templateObject3() { "", "" ]); - return _templateObject3 = function _templateObject3() { + return _templateObject3 = function() { return data; }, data; } @@ -43,7 +43,7 @@ function _templateObject4() { "", "" ]); - return _templateObject4 = function _templateObject4() { + return _templateObject4 = function() { return data; }, data; } @@ -54,7 +54,7 @@ function _templateObject5() { "", "" ]); - return _templateObject5 = function _templateObject5() { + return _templateObject5 = function() { return data; }, data; } diff --git a/crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution2.2.minified.js b/crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution2.2.minified.js index d2287fcdf1f..aa0bf633af4 100644 --- a/crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution2.2.minified.js +++ b/crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution2.2.minified.js @@ -5,7 +5,7 @@ function _templateObject() { "", "" ]); - return _templateObject = function _templateObject() { + return _templateObject = function() { return data; }, data; } @@ -14,7 +14,7 @@ function _templateObject1() { "", "" ]); - return _templateObject1 = function _templateObject1() { + return _templateObject1 = function() { return data; }, data; } diff --git a/crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution3.2.minified.js b/crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution3.2.minified.js index 3da22f38ac2..fd761501010 100644 --- a/crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution3.2.minified.js +++ b/crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution3.2.minified.js @@ -5,7 +5,7 @@ function _templateObject() { "", "" ]); - return _templateObject = function _templateObject() { + return _templateObject = function() { return data; }, data; } @@ -14,7 +14,7 @@ function _templateObject1() { "", "" ]); - return _templateObject1 = function _templateObject1() { + return _templateObject1 = function() { return data; }, data; } @@ -24,7 +24,7 @@ function _templateObject2() { "", "" ]); - return _templateObject2 = function _templateObject2() { + return _templateObject2 = function() { return data; }, data; } @@ -34,7 +34,7 @@ function _templateObject3() { "", "" ]); - return _templateObject3 = function _templateObject3() { + return _templateObject3 = function() { return data; }, data; } @@ -44,7 +44,7 @@ function _templateObject4() { "", "" ]); - return _templateObject4 = function _templateObject4() { + return _templateObject4 = function() { return data; }, data; } @@ -54,7 +54,7 @@ function _templateObject5() { "", "" ]); - return _templateObject5 = function _templateObject5() { + return _templateObject5 = function() { return data; }, data; } @@ -63,7 +63,7 @@ function _templateObject6() { "", "" ]); - return _templateObject6 = function _templateObject6() { + return _templateObject6 = function() { return data; }, data; } @@ -74,7 +74,7 @@ function _templateObject7() { "", "" ]); - return _templateObject7 = function _templateObject7() { + return _templateObject7 = function() { return data; }, data; } @@ -85,7 +85,7 @@ function _templateObject8() { "", "" ]); - return _templateObject8 = function _templateObject8() { + return _templateObject8 = function() { return data; }, data; } @@ -94,7 +94,7 @@ function _templateObject9() { "", "" ]); - return _templateObject9 = function _templateObject9() { + return _templateObject9 = function() { return data; }, data; } @@ -105,7 +105,7 @@ function _templateObject10() { "", "" ]); - return _templateObject10 = function _templateObject10() { + return _templateObject10 = function() { return data; }, data; } @@ -116,7 +116,7 @@ function _templateObject11() { "", "" ]); - return _templateObject11 = function _templateObject11() { + return _templateObject11 = function() { return data; }, data; } @@ -124,7 +124,7 @@ function _templateObject12() { var data = _tagged_template_literal([ "" ]); - return _templateObject12 = function _templateObject12() { + return _templateObject12 = function() { return data; }, data; } @@ -134,7 +134,7 @@ function _templateObject13() { "", "" ]); - return _templateObject13 = function _templateObject13() { + return _templateObject13 = function() { return data; }, data; } @@ -144,7 +144,7 @@ function _templateObject14() { "", "" ]); - return _templateObject14 = function _templateObject14() { + return _templateObject14 = function() { return data; }, data; } @@ -154,7 +154,7 @@ function _templateObject15() { "", "" ]); - return _templateObject15 = function _templateObject15() { + return _templateObject15 = function() { return data; }, data; } @@ -164,7 +164,7 @@ function _templateObject16() { "", "" ]); - return _templateObject16 = function _templateObject16() { + return _templateObject16 = function() { return data; }, data; } @@ -174,7 +174,7 @@ function _templateObject17() { "", "" ]); - return _templateObject17 = function _templateObject17() { + return _templateObject17 = function() { return data; }, data; } @@ -184,7 +184,7 @@ function _templateObject18() { "", "" ]); - return _templateObject18 = function _templateObject18() { + return _templateObject18 = function() { return data; }, data; } @@ -194,7 +194,7 @@ function _templateObject19() { "", "" ]); - return _templateObject19 = function _templateObject19() { + return _templateObject19 = function() { return data; }, data; } @@ -203,7 +203,7 @@ function _templateObject20() { "", "" ]); - return _templateObject20 = function _templateObject20() { + return _templateObject20 = function() { return data; }, data; } @@ -212,7 +212,7 @@ function _templateObject21() { "", "" ]); - return _templateObject21 = function _templateObject21() { + return _templateObject21 = function() { return data; }, data; } diff --git a/crates/swc/tests/tsc-references/taggedTemplateStringsWithTagNamedDeclare.2.minified.js b/crates/swc/tests/tsc-references/taggedTemplateStringsWithTagNamedDeclare.2.minified.js index 1d5011a71f0..197f124c31a 100644 --- a/crates/swc/tests/tsc-references/taggedTemplateStringsWithTagNamedDeclare.2.minified.js +++ b/crates/swc/tests/tsc-references/taggedTemplateStringsWithTagNamedDeclare.2.minified.js @@ -5,7 +5,7 @@ function _templateObject() { "Hello ", " world!" ]); - return _templateObject = function _templateObject() { + return _templateObject = function() { return data; }, data; } diff --git a/crates/swc/tests/tsc-references/taggedTemplateStringsWithTagsTypedAsAny.2.minified.js b/crates/swc/tests/tsc-references/taggedTemplateStringsWithTagsTypedAsAny.2.minified.js index a8627f59641..6b63330e03d 100644 --- a/crates/swc/tests/tsc-references/taggedTemplateStringsWithTagsTypedAsAny.2.minified.js +++ b/crates/swc/tests/tsc-references/taggedTemplateStringsWithTagsTypedAsAny.2.minified.js @@ -5,7 +5,7 @@ function _templateObject() { var data = _tagged_template_literal([ "abc" ]); - return _templateObject = function _templateObject() { + return _templateObject = function() { return data; }, data; } @@ -15,7 +15,7 @@ function _templateObject1() { "def", "ghi" ]); - return _templateObject1 = function _templateObject1() { + return _templateObject1 = function() { return data; }, data; } @@ -23,7 +23,7 @@ function _templateObject2() { var data = _tagged_template_literal([ "abc" ]); - return _templateObject2 = function _templateObject2() { + return _templateObject2 = function() { return data; }, data; } @@ -33,7 +33,7 @@ function _templateObject3() { "def", "ghi" ]); - return _templateObject3 = function _templateObject3() { + return _templateObject3 = function() { return data; }, data; } @@ -41,7 +41,7 @@ function _templateObject4() { var data = _tagged_template_literal([ "abc" ]); - return _templateObject4 = function _templateObject4() { + return _templateObject4 = function() { return data; }, data; } @@ -51,7 +51,7 @@ function _templateObject5() { "def", "ghi" ]); - return _templateObject5 = function _templateObject5() { + return _templateObject5 = function() { return data; }, data; } @@ -59,7 +59,7 @@ function _templateObject6() { var data = _tagged_template_literal([ "abc" ]); - return _templateObject6 = function _templateObject6() { + return _templateObject6 = function() { return data; }, data; } @@ -69,7 +69,7 @@ function _templateObject7() { "def", "ghi" ]); - return _templateObject7 = function _templateObject7() { + return _templateObject7 = function() { return data; }, data; } @@ -77,7 +77,7 @@ function _templateObject8() { var data = _tagged_template_literal([ "abc" ]); - return _templateObject8 = function _templateObject8() { + return _templateObject8 = function() { return data; }, data; } @@ -87,7 +87,7 @@ function _templateObject9() { "def", "ghi" ]); - return _templateObject9 = function _templateObject9() { + return _templateObject9 = function() { return data; }, data; } @@ -97,7 +97,7 @@ function _templateObject10() { "def", "ghi" ]); - return _templateObject10 = function _templateObject10() { + return _templateObject10 = function() { return data; }, data; } @@ -107,7 +107,7 @@ function _templateObject11() { "def", "ghi" ]); - return _templateObject11 = function _templateObject11() { + return _templateObject11 = function() { return data; }, data; } diff --git a/crates/swc/tests/tsc-references/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.2.minified.js b/crates/swc/tests/tsc-references/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.2.minified.js index a3928a55b6e..7351a2ffc78 100644 --- a/crates/swc/tests/tsc-references/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.2.minified.js +++ b/crates/swc/tests/tsc-references/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.2.minified.js @@ -5,7 +5,7 @@ function _templateObject() { "", "" ]); - return _templateObject = function _templateObject() { + return _templateObject = function() { return data; }, data; } diff --git a/crates/swc/tests/tsc-references/taggedTemplateStringsWithTypedTags.2.minified.js b/crates/swc/tests/tsc-references/taggedTemplateStringsWithTypedTags.2.minified.js index 8b1949d2659..864af2f69ae 100644 --- a/crates/swc/tests/tsc-references/taggedTemplateStringsWithTypedTags.2.minified.js +++ b/crates/swc/tests/tsc-references/taggedTemplateStringsWithTypedTags.2.minified.js @@ -5,7 +5,7 @@ function _templateObject() { var data = _tagged_template_literal([ "abc" ]); - return _templateObject = function _templateObject() { + return _templateObject = function() { return data; }, data; } @@ -15,7 +15,7 @@ function _templateObject1() { "def", "ghi" ]); - return _templateObject1 = function _templateObject1() { + return _templateObject1 = function() { return data; }, data; } @@ -23,7 +23,7 @@ function _templateObject2() { var data = _tagged_template_literal([ "abc" ]); - return _templateObject2 = function _templateObject2() { + return _templateObject2 = function() { return data; }, data; } @@ -33,7 +33,7 @@ function _templateObject3() { "def", "ghi" ]); - return _templateObject3 = function _templateObject3() { + return _templateObject3 = function() { return data; }, data; } @@ -41,7 +41,7 @@ function _templateObject4() { var data = _tagged_template_literal([ "abc" ]); - return _templateObject4 = function _templateObject4() { + return _templateObject4 = function() { return data; }, data; } @@ -51,7 +51,7 @@ function _templateObject5() { "def", "ghi" ]); - return _templateObject5 = function _templateObject5() { + return _templateObject5 = function() { return data; }, data; } @@ -59,7 +59,7 @@ function _templateObject6() { var data = _tagged_template_literal([ "abc" ]); - return _templateObject6 = function _templateObject6() { + return _templateObject6 = function() { return data; }, data; } @@ -69,7 +69,7 @@ function _templateObject7() { "def", "ghi" ]); - return _templateObject7 = function _templateObject7() { + return _templateObject7 = function() { return data; }, data; } @@ -79,7 +79,7 @@ function _templateObject8() { "def", "ghi" ]); - return _templateObject8 = function _templateObject8() { + return _templateObject8 = function() { return data; }, data; } @@ -89,7 +89,7 @@ function _templateObject9() { "def", "ghi" ]); - return _templateObject9 = function _templateObject9() { + return _templateObject9 = function() { return data; }, data; } diff --git a/crates/swc/tests/tsc-references/taggedTemplateUntypedTagCall01.2.minified.js b/crates/swc/tests/tsc-references/taggedTemplateUntypedTagCall01.2.minified.js index 81d0e8c2397..c6913c17611 100644 --- a/crates/swc/tests/tsc-references/taggedTemplateUntypedTagCall01.2.minified.js +++ b/crates/swc/tests/tsc-references/taggedTemplateUntypedTagCall01.2.minified.js @@ -5,7 +5,7 @@ function _templateObject() { var data = _tagged_template_literal([ "Hello world!" ]); - return _templateObject = function _templateObject() { + return _templateObject = function() { return data; }, data; } diff --git a/crates/swc/tests/tsc-references/taggedTemplateWithConstructableTag01.2.minified.js b/crates/swc/tests/tsc-references/taggedTemplateWithConstructableTag01.2.minified.js index c3a578c3f4e..95a0855b03f 100644 --- a/crates/swc/tests/tsc-references/taggedTemplateWithConstructableTag01.2.minified.js +++ b/crates/swc/tests/tsc-references/taggedTemplateWithConstructableTag01.2.minified.js @@ -5,7 +5,7 @@ function _templateObject() { var data = _tagged_template_literal([ "Hello world!" ]); - return _templateObject = function _templateObject() { + return _templateObject = function() { return data; }, data; } diff --git a/crates/swc/tests/tsc-references/taggedTemplateWithConstructableTag02.2.minified.js b/crates/swc/tests/tsc-references/taggedTemplateWithConstructableTag02.2.minified.js index 29733fb5434..0b50dba24c5 100644 --- a/crates/swc/tests/tsc-references/taggedTemplateWithConstructableTag02.2.minified.js +++ b/crates/swc/tests/tsc-references/taggedTemplateWithConstructableTag02.2.minified.js @@ -5,7 +5,7 @@ function _templateObject() { var data = _tagged_template_literal([ "Hello world!" ]); - return _templateObject = function _templateObject() { + return _templateObject = function() { return data; }, data; } diff --git a/crates/swc/tests/tsc-references/templateLiteralTypes2.2.minified.js b/crates/swc/tests/tsc-references/templateLiteralTypes2.2.minified.js index 38b596b54db..2bd7e09cd12 100644 --- a/crates/swc/tests/tsc-references/templateLiteralTypes2.2.minified.js +++ b/crates/swc/tests/tsc-references/templateLiteralTypes2.2.minified.js @@ -1,2 +1,4 @@ //// [templateLiteralTypes2.ts] -takesLiteral("foo.bar.baz"), takesLiteral("foo.bar.baz"), takesLiteral("foo.bar.".concat(someString)), takesLiteral("foo.bar.".concat(someString)), takesLiteral("foo.bar.".concat(someUnion)); +takesLiteral("foo.bar.baz"), takesLiteral("foo.bar.baz"), takesLiteral("foo.bar.".concat(someString)); +var id4 = "foo.bar.".concat(someString); +takesLiteral(id4), takesLiteral("foo.bar.".concat(someUnion)); diff --git a/crates/swc/tests/tsc-references/templateStringInTaggedTemplate.2.minified.js b/crates/swc/tests/tsc-references/templateStringInTaggedTemplate.2.minified.js index 6c0eda79a10..262f7f964e6 100644 --- a/crates/swc/tests/tsc-references/templateStringInTaggedTemplate.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringInTaggedTemplate.2.minified.js @@ -5,7 +5,7 @@ function _templateObject() { "I ", " THE TEMPLATE PORTION" ]); - return _templateObject = function _templateObject() { + return _templateObject = function() { return data; }, data; } diff --git a/crates/swc/tests/tsc-references/thisTypeInFunctions3.2.minified.js b/crates/swc/tests/tsc-references/thisTypeInFunctions3.2.minified.js index 4e7441c2c04..ad716b47ddb 100644 --- a/crates/swc/tests/tsc-references/thisTypeInFunctions3.2.minified.js +++ b/crates/swc/tests/tsc-references/thisTypeInFunctions3.2.minified.js @@ -2,3 +2,4 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; +Base; diff --git a/crates/swc/tests/tsc-references/thisTypeInObjectLiterals2.2.minified.js b/crates/swc/tests/tsc-references/thisTypeInObjectLiterals2.2.minified.js index 4d5fc00a2f5..a13e9929556 100644 --- a/crates/swc/tests/tsc-references/thisTypeInObjectLiterals2.2.minified.js +++ b/crates/swc/tests/tsc-references/thisTypeInObjectLiterals2.2.minified.js @@ -47,8 +47,8 @@ var p11 = defineProp(p1, "bar", { get: function() { return this.x; }, - set: function(value) { - this.x = value; + set: function(value1) { + this.x = value1; } }); p11.bar = p11.bar + 1; @@ -60,8 +60,8 @@ var p12 = defineProps(p1, { get: function() { return this.x; }, - set: function(value) { - this.x = value; + set: function(value1) { + this.x = value1; } } }); @@ -86,7 +86,7 @@ var vue = new Vue({ get: function() { return "hi"; }, - set: function(value) {} + set: function(value1) {} } } }); diff --git a/crates/swc/tests/tsc-references/tsxExternalModuleEmit2.2.minified.js b/crates/swc/tests/tsc-references/tsxExternalModuleEmit2.2.minified.js index 65a86a66447..3ca53b1e745 100644 --- a/crates/swc/tests/tsc-references/tsxExternalModuleEmit2.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxExternalModuleEmit2.2.minified.js @@ -8,4 +8,4 @@ Object.defineProperty(exports, "__esModule", { value: !0 }); var _extends = require("@swc/helpers/lib/_extends.js").default, _mod = (0, require("@swc/helpers/lib/_interop_require_default.js").default)(require("mod")); -_mod.default, _extends({}, _mod.default); +Foo, _mod.default, Foo, _extends({}, _mod.default); diff --git a/crates/swc/tests/tsc-references/tsxReactEmit3.2.minified.js b/crates/swc/tests/tsc-references/tsxReactEmit3.2.minified.js index 6af6d9beba8..2dc9c2dc400 100644 --- a/crates/swc/tests/tsc-references/tsxReactEmit3.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxReactEmit3.2.minified.js @@ -1 +1,2 @@ //// [test.tsx] +Foo, Bar, Bar, Bar, Bar; diff --git a/crates/swc/tests/tsc-references/tsxReactEmit6.2.minified.js b/crates/swc/tests/tsc-references/tsxReactEmit6.2.minified.js index 81b9e026122..8cf69d13ffe 100644 --- a/crates/swc/tests/tsc-references/tsxReactEmit6.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxReactEmit6.2.minified.js @@ -9,8 +9,8 @@ Object.defineProperty(exports, "__esModule", { }); var M, _extends = require("@swc/helpers/lib/_extends.js").default; !function(M) { - var React; - M.React = React; + var React1; + M.React = React1; }(M || (M = {})), M || (M = {}), _extends({ x: "" }, void 0, { diff --git a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload1.2.minified.js b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload1.2.minified.js index 4e1488a2986..50a40c2f060 100644 --- a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload1.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload1.2.minified.js @@ -7,5 +7,5 @@ define([ "use strict"; Object.defineProperty(exports, "__esModule", { value: !0 - }); + }), OneThing, OneThing, OneThing, OneThing, OneThing, TestingOneThing, TestingOneThing, TestingOneThing, TestingOneThing, TestingOneThing, TestingOptional, TestingOptional, TestingOptional, TestingOptional, TestingOptional, TestingOptional; }); diff --git a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload2.2.minified.js b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload2.2.minified.js index e80a2ed479c..d2e67a5b31a 100644 --- a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload2.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload2.2.minified.js @@ -8,25 +8,25 @@ define([ "use strict"; Object.defineProperty(exports, "__esModule", { value: !0 - }); + }), _extends = _extends.default; var defaultObj, obj = { yy: 10, yy1: "hello" }, obj1 = { yy: !0 }; - (_extends = _extends.default)({}, obj), _extends({}, {}), _extends({}, obj1, obj), _extends({}, obj1, { + OneThing, OneThing, _extends({}, obj), OneThing, _extends({}, {}), OneThing, _extends({}, obj1, obj), OneThing, _extends({}, obj1, { yy: 42 }, { yy1: "hi" - }), _extends({}, obj1, { + }), OneThing, _extends({}, obj1, { yy: 10000, yy1: "true" - }), _extends({}, defaultObj, { + }), OneThing, _extends({}, defaultObj, { yy: !0 - }, obj), _extends({}, { + }, obj), OneThing, OneThing, _extends({}, { "ignore-prop": 200 - }), _extends({}, { + }), OneThing, _extends({}, { yy: 500, "ignore-prop": "hello" }, { diff --git a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload3.2.minified.js b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload3.2.minified.js index 8a7f172547d..fb482b92869 100644 --- a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload3.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload3.2.minified.js @@ -8,11 +8,11 @@ define([ var obj2; Object.defineProperty(exports, "__esModule", { value: !0 - }), (_extends = _extends.default)({}, obj2), _extends({ + }), _extends = _extends.default, ZeroThingOrTwoThing, ZeroThingOrTwoThing, ZeroThingOrTwoThing, _extends({}, obj2), ZeroThingOrTwoThing, _extends({ yy: 1000 - }, obj2), _extends({}, obj2, { + }, obj2), ZeroThingOrTwoThing, _extends({}, obj2, { yy: 1000 - }), _extends({}, obj2, { + }), ThreeThing, ThreeThing, ThreeThing, _extends({}, obj2, { y2: 10 }); }); diff --git a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload4.2.minified.js b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload4.2.minified.js index 8d4481b4978..22d63d419a9 100644 --- a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload4.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload4.2.minified.js @@ -8,22 +8,22 @@ define([ "use strict"; Object.defineProperty(exports, "__esModule", { value: !0 - }); + }), _extends = _extends.default; var obj2, obj = { yy: 10, yy1: "hello" }; - (_extends = _extends.default)({}, obj, { + OneThing, OneThing, OneThing, _extends({}, obj, { yy1: !0 - }), _extends({}, obj, { + }), OneThing, _extends({}, obj, { extra: "extra attr" - }), _extends({}, obj, { + }), OneThing, _extends({}, obj, { y1: 10000 - }), _extends({}, obj, { + }), OneThing, _extends({}, obj, { yy: !0 - }), _extends({}, obj2, { + }), OneThing, _extends({}, obj2, { extra: "extra attr" - }), _extends({}, obj2, { + }), OneThing, _extends({}, obj2, { yy: !0 - }); + }), TestingOneThing, TestingOneThing, TestingOptional, TestingOptional, TestingOptional, TestingOptional; }); diff --git a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentsWithTypeArguments1.2.minified.js b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentsWithTypeArguments1.2.minified.js index e9e89d611c9..75c3a597be6 100644 --- a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentsWithTypeArguments1.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentsWithTypeArguments1.2.minified.js @@ -8,5 +8,5 @@ define([ "use strict"; Object.defineProperty(exports, "__esModule", { value: !0 - }), _extends = _extends.default; + }), _extends = _extends.default, InferParamComponent; }); diff --git a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentsWithTypeArguments2.2.minified.js b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentsWithTypeArguments2.2.minified.js index e9e89d611c9..75c3a597be6 100644 --- a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentsWithTypeArguments2.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentsWithTypeArguments2.2.minified.js @@ -8,5 +8,5 @@ define([ "use strict"; Object.defineProperty(exports, "__esModule", { value: !0 - }), _extends = _extends.default; + }), _extends = _extends.default, InferParamComponent; }); diff --git a/crates/swc/tests/tsc-references/typeArgumentsWithStringLiteralTypes01.2.minified.js b/crates/swc/tests/tsc-references/typeArgumentsWithStringLiteralTypes01.2.minified.js index 87945721dcf..ea3e11d0f14 100644 --- a/crates/swc/tests/tsc-references/typeArgumentsWithStringLiteralTypes01.2.minified.js +++ b/crates/swc/tests/tsc-references/typeArgumentsWithStringLiteralTypes01.2.minified.js @@ -1,16 +1,22 @@ //// [typeArgumentsWithStringLiteralTypes01.ts] var n1, n2, n3; +function fun1(x, y) { + return randBool() ? x : y; +} +function fun2(x, y) { + return randBool() ? x : y; +} function fun3() { for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; return args[+randBool()]; } !function(n1) { - var a = n1.a = randBool() ? "Hello" : "World", b = n1.b = (randBool(), "Hello"), c = n1.c = randBool() ? "Hello" : "World", d = n1.d = (randBool(), "Hello"), e = n1.e = fun3("Hello", "Hello", "World", "Foo"); + var a = n1.a = fun1("Hello", "World"), b = n1.b = fun1("Hello", "Hello"), c = n1.c = fun2("Hello", "World"), d = n1.d = fun2("Hello", "Hello"), e = n1.e = fun3("Hello", "Hello", "World", "Foo"); a = takeReturnString(a), b = takeReturnString(b), c = takeReturnString(c), d = takeReturnString(d), e = takeReturnString(e), a = takeReturnHello(a), b = takeReturnHello(b), c = takeReturnHello(c), d = takeReturnHello(d), e = takeReturnHello(e), a = takeReturnHelloWorld(a), b = takeReturnHelloWorld(b), c = takeReturnHelloWorld(c), d = takeReturnHelloWorld(d), e = takeReturnHelloWorld(e); }(n1 || (n1 = {})), function(n2) { - var a = n2.a = (randBool(), "Hello"), b = n2.b = randBool() ? "Hello" : "World", c = n2.c = (randBool(), "Hello"), d = n2.d = randBool() ? "Hello" : "World", e = n2.e = fun3("Hello", "World"); + var a = n2.a = fun1("Hello", "Hello"), b = n2.b = fun1("Hello", "World"), c = n2.c = fun2("Hello", "Hello"), d = n2.d = fun2("Hello", "World"), e = n2.e = fun3("Hello", "World"); a = takeReturnString(a), b = takeReturnString(b), c = takeReturnString(c), d = takeReturnString(d), e = takeReturnString(e), a = takeReturnHello(a), b = takeReturnHello(b), c = takeReturnHello(c), d = takeReturnHello(d), e = takeReturnHello(e), a = takeReturnHelloWorld(a), b = takeReturnHelloWorld(b), c = takeReturnHelloWorld(c), d = takeReturnHelloWorld(d), e = takeReturnHelloWorld(e); }(n2 || (n2 = {})), function(n3) { - var a = n3.a = randBool() ? "Hello" : "World", b = n3.b = randBool() ? "World" : "Hello", c = n3.c = (randBool(), "Hello"), d = n3.d = (randBool(), "World"), e = n3.e = fun3("Hello", "World"); + var a = n3.a = fun2("Hello", "World"), b = n3.b = fun2("World", "Hello"), c = n3.c = fun2("Hello", "Hello"), d = n3.d = fun2("World", "World"), e = n3.e = fun3("Hello", "World"); a = takeReturnString(a), b = takeReturnString(b), c = takeReturnString(c), d = takeReturnString(d), e = takeReturnString(e), a = takeReturnHello(a), b = takeReturnHello(b), c = takeReturnHello(c), d = takeReturnHello(d), e = takeReturnHello(e), a = takeReturnHelloWorld(a), b = takeReturnHelloWorld(b), c = takeReturnHelloWorld(c), d = takeReturnHelloWorld(d), e = takeReturnHelloWorld(e); }(n3 || (n3 = {})); diff --git a/crates/swc/tests/tsc-references/unionAndIntersectionInference2.2.minified.js b/crates/swc/tests/tsc-references/unionAndIntersectionInference2.2.minified.js index b56a451dcad..5720c51fbf7 100644 --- a/crates/swc/tests/tsc-references/unionAndIntersectionInference2.2.minified.js +++ b/crates/swc/tests/tsc-references/unionAndIntersectionInference2.2.minified.js @@ -1,3 +1,3 @@ //// [unionAndIntersectionInference2.ts] -var b1, c1, d1, e1, a2, b2, c2, d2; -f1(void 0), f1(b1), f1(c1), f1(d1), f1(e1), f2(a2), f2(b2), f2(c2), f2(d2); +var a1, b1, c1, d1, e1, a2, b2, c2, d2; +f1(a1), f1(b1), f1(c1), f1(d1), f1(e1), f2(a2), f2(b2), f2(c2), f2(d2); diff --git a/crates/swc/tests/tsc-references/uniqueSymbols.2.minified.js b/crates/swc/tests/tsc-references/uniqueSymbols.2.minified.js index c33d8036b58..6877e61c602 100644 --- a/crates/swc/tests/tsc-references/uniqueSymbols.2.minified.js +++ b/crates/swc/tests/tsc-references/uniqueSymbols.2.minified.js @@ -1,6 +1,6 @@ //// [uniqueSymbols.ts] const constCall = Symbol(); -Symbol(), Symbol(), Symbol(); +Symbol(), Symbol(), Symbol(), constType, constType, constType, constType; class C { static readonlyStaticCall = Symbol(); static readonlyStaticTypeAndCall = Symbol(); @@ -8,7 +8,7 @@ class C { readonlyCall = Symbol(); readwriteCall = Symbol(); } -C.readonlyStaticCall, C.readonlyStaticType, C.readonlyStaticTypeAndCall, C.readwriteStaticCall, C.readonlyStaticCall, C.readonlyStaticType, C.readonlyStaticTypeAndCall, C.readwriteStaticCall, c.readonlyCall, c.readwriteCall, c.readonlyCall, c.readwriteCall, c.readonlyCall, c.readwriteCall, i.readonlyType, i.readonlyType, i.readonlyType, l.readonlyType, l.nested.readonlyNestedType, l.readonlyType, l.nested.readonlyNestedType, l.readonlyType, l.nested.readonlyNestedType, Promise.resolve(constCall), f(s), f(N.s), f(N.s), N.s, N.s, N.s, N.s, (p = s)=>p; +C.readonlyStaticCall, C.readonlyStaticType, C.readonlyStaticTypeAndCall, C.readwriteStaticCall, C.readonlyStaticCall, C.readonlyStaticType, C.readonlyStaticTypeAndCall, C.readwriteStaticCall, c.readonlyCall, c.readwriteCall, c.readonlyCall, c.readwriteCall, c.readonlyCall, c.readwriteCall, i.readonlyType, i.readonlyType, i.readonlyType, l.readonlyType, l.nested.readonlyNestedType, l.readonlyType, l.nested.readonlyNestedType, l.readonlyType, l.nested.readonlyNestedType, Promise.resolve(constCall), f(s), f(N.s), f(N.s), s, N.s, N.s, s, N.s, N.s, (p = s)=>p; class C0 { static a = s; static b = N.s; @@ -38,4 +38,4 @@ class C0 { return p; } } -o[s], o[N.s], o[N.s], f(s), f(N.s), f(N.s), g(s), g(N.s), g(N.s), N.s, N.s, 2 * Math.random() && N.s, 2 * Math.random() && N.s, N.s; +o[s], o[N.s], o[N.s], f(s), f(N.s), f(N.s), g(s), g(N.s), g(N.s), s, N.s, N.s, 2 * Math.random() && s, 2 * Math.random() && N.s, 2 * Math.random() && N.s, s, N.s; diff --git a/crates/swc/tests/tsc-references/uniqueSymbolsDeclarations.2.minified.js b/crates/swc/tests/tsc-references/uniqueSymbolsDeclarations.2.minified.js index 11add4c804a..65073f33cc0 100644 --- a/crates/swc/tests/tsc-references/uniqueSymbolsDeclarations.2.minified.js +++ b/crates/swc/tests/tsc-references/uniqueSymbolsDeclarations.2.minified.js @@ -1,6 +1,6 @@ //// [uniqueSymbolsDeclarations.ts] const constCall = Symbol(); -Symbol(), Symbol(), Symbol(); +Symbol(), Symbol(), Symbol(), constType, constType, constType, constType; class C { static readonlyStaticCall = Symbol(); static readonlyStaticTypeAndCall = Symbol(); @@ -8,7 +8,7 @@ class C { readonlyCall = Symbol(); readwriteCall = Symbol(); } -C.readonlyStaticCall, C.readonlyStaticType, C.readonlyStaticTypeAndCall, C.readwriteStaticCall, C.readonlyStaticCall, C.readonlyStaticType, C.readonlyStaticTypeAndCall, C.readwriteStaticCall, c.readonlyCall, c.readwriteCall, c.readonlyCall, c.readwriteCall, c.readonlyCall, c.readwriteCall, i.readonlyType, i.readonlyType, i.readonlyType, l.readonlyType, l.nested.readonlyNestedType, l.readonlyType, l.nested.readonlyNestedType, l.readonlyType, l.nested.readonlyNestedType, Promise.resolve(constCall), f(s), f(N.s), f(N.s), N.s, N.s, N.s, N.s, (p = s)=>p; +C.readonlyStaticCall, C.readonlyStaticType, C.readonlyStaticTypeAndCall, C.readwriteStaticCall, C.readonlyStaticCall, C.readonlyStaticType, C.readonlyStaticTypeAndCall, C.readwriteStaticCall, c.readonlyCall, c.readwriteCall, c.readonlyCall, c.readwriteCall, c.readonlyCall, c.readwriteCall, i.readonlyType, i.readonlyType, i.readonlyType, l.readonlyType, l.nested.readonlyNestedType, l.readonlyType, l.nested.readonlyNestedType, l.readonlyType, l.nested.readonlyNestedType, Promise.resolve(constCall), f(s), f(N.s), f(N.s), s, N.s, N.s, s, N.s, N.s, (p = s)=>p; class C0 { static a = s; static b = N.s; @@ -38,4 +38,4 @@ class C0 { return p; } } -o[s], o[N.s], o[N.s], f(s), f(N.s), f(N.s), g(s), g(N.s), g(N.s), N.s, N.s, 2 * Math.random() && N.s, 2 * Math.random() && N.s, N.s; +o[s], o[N.s], o[N.s], f(s), f(N.s), f(N.s), g(s), g(N.s), g(N.s), s, N.s, N.s, 2 * Math.random() && s, 2 * Math.random() && N.s, 2 * Math.random() && N.s, s, N.s; diff --git a/crates/swc/tests/tsc-references/unknownType2.2.minified.js b/crates/swc/tests/tsc-references/unknownType2.2.minified.js index 02c28743b05..360099d6863 100644 --- a/crates/swc/tests/tsc-references/unknownType2.2.minified.js +++ b/crates/swc/tests/tsc-references/unknownType2.2.minified.js @@ -1,6 +1,6 @@ //// [unknownType2.ts] var NumberEnum, StringEnum, u = void 0; -5 === u && u.toString(10), function(NumberEnum) { +5 === u && u.toString(10), symb, aString, aBoolean, aNumber, anObject, anObjectLiteral, aUnion, anIntersection, aFunction, function(NumberEnum) { NumberEnum[NumberEnum.A = 0] = "A", NumberEnum[NumberEnum.B = 1] = "B", NumberEnum[NumberEnum.C = 2] = "C"; }(NumberEnum || (NumberEnum = {})), function(StringEnum) { StringEnum.A = "A", StringEnum.B = "B", StringEnum.C = "C"; diff --git a/crates/swc/tests/tsc-references/voidParamAssignmentCompatibility.2.minified.js b/crates/swc/tests/tsc-references/voidParamAssignmentCompatibility.2.minified.js index 354423dcfdc..5e082d3ef6c 100644 --- a/crates/swc/tests/tsc-references/voidParamAssignmentCompatibility.2.minified.js +++ b/crates/swc/tests/tsc-references/voidParamAssignmentCompatibility.2.minified.js @@ -1,2 +1,2 @@ //// [voidParamAssignmentCompatibility.ts] -o.method; +g, o.method; diff --git a/crates/swc/tests/vercel/full/next-31419/1/output/index.js b/crates/swc/tests/vercel/full/next-31419/1/output/index.js index 59ba1d37403..1ca989af50d 100644 --- a/crates/swc/tests/vercel/full/next-31419/1/output/index.js +++ b/crates/swc/tests/vercel/full/next-31419/1/output/index.js @@ -3,29 +3,29 @@ import n from "@swc/helpers/src/_ts_generator.mjs"; import t from "@swc/helpers/src/_ts_values.mjs"; Promise.all(assignAll).then(function() { var e = r(function(r) { - var e, s, i, c, o, u; - return n(this, function(a) { - switch(a.label){ + var e, s, i, c, o; + return n(this, function(u) { + switch(u.label){ case 0: - for(c in e = function(u) { - var t; + for(c in e = function(t) { + var e; return n(this, function(n) { switch(n.label){ case 0: - return t = r[u], s += "'".concat(t.id, "', "), [ + return e = r[t], s += "'".concat(e.id, "', "), [ 4, - listOfUser(t.id) + listOfUser(e.id) ]; case 1: return n.sent().forEach(function(r) { - insertQuery += 'INSERT INTO "TABLE"("UUID", id, other_ids_here) VALUES (\''.concat(uuidv4(), "', '").concat(t.id, "', now());"); + insertQuery += 'INSERT INTO "TABLE"("UUID", id, other_ids_here) VALUES (\''.concat(uuidv4(), "', '").concat(e.id, "', now());"); }), [ 2 ]; } }); }, s = 'DELETE FROM "TABLE" WHERE "UUID" IN ( ', i = [], r); - o = 0, a.label = 1; + o = 0, u.label = 1; case 1: if (!(o < i.length)) return [ 3, @@ -33,10 +33,10 @@ Promise.all(assignAll).then(function() { ]; return [ 5, - t(e(u = i[o])) + t(e(i[o])) ]; case 2: - a.label = 3; + u.label = 3; case 3: return o++, [ 3, diff --git a/crates/swc/tests/vercel/full/react-autowhatever/2/output/index.js b/crates/swc/tests/vercel/full/react-autowhatever/2/output/index.js index 5caf9bdb194..5c94c411fb4 100644 --- a/crates/swc/tests/vercel/full/react-autowhatever/2/output/index.js +++ b/crates/swc/tests/vercel/full/react-autowhatever/2/output/index.js @@ -4,27 +4,27 @@ Object.defineProperty(exports, "__esModule", { }), Object.defineProperty(exports, "default", { enumerable: !0, get: function() { - return o; + return l; } }); -var e = require("@swc/helpers/lib/_class_call_check.js").default, t = require("@swc/helpers/lib/_inherits.js").default, r = require("@swc/helpers/lib/_interop_require_wildcard.js").default, i = require("@swc/helpers/lib/_object_spread.js").default, s = require("@swc/helpers/lib/_object_spread_props.js").default, n = require("@swc/helpers/lib/_create_super.js").default, l = require("react/jsx-runtime"), o = function(r) { +var e = require("@swc/helpers/lib/_class_call_check.js").default, t = require("@swc/helpers/lib/_inherits.js").default, r = require("@swc/helpers/lib/_interop_require_wildcard.js").default, i = require("@swc/helpers/lib/_object_spread.js").default, s = require("@swc/helpers/lib/_object_spread_props.js").default, n = require("@swc/helpers/lib/_create_super.js").default, c = require("react/jsx-runtime"), l = function(r) { "use strict"; - t(c, r); - var o = n(c); - function c() { + t(o, r); + var l = n(o); + function o() { var t; - return e(this, c), t = o.apply(this, arguments), t.storeHighlightedItemReference = function(e) { + return e(this, o), t = l.apply(this, arguments), t.storeHighlightedItemReference = function(e) { t.props.onHighlightedItemChange(null === e ? null : e.item); }, t; } - var u = c.prototype; + var u = o.prototype; return u.shouldComponentUpdate = function(e) { return compareObjects(e, this.props, [ "itemProps" ]); }, u.render = function() { - var e = this, t = this.props, r = t.items, n = t.itemProps, o = t.renderItem, c = t.renderItemData, u = t.sectionIndex, a = t.highlightedItemIndex, d = t.getItemId, p = t.theme, m = t.keyPrefix, h = null === u ? m : "".concat(m, "section-").concat(u, "-"), f = "function" == typeof n; - return (0, l.jsx)("ul", s(i({ + var e = this, t = this.props, r = t.items, n = t.itemProps, l = t.renderItem, o = t.renderItemData, u = t.sectionIndex, a = t.highlightedItemIndex, d = t.getItemId, p = t.theme, m = t.keyPrefix, h = null === u ? m : "".concat(m, "section-").concat(u, "-"), f = "function" == typeof n; + return (0, c.jsx)("ul", s(i({ role: "listbox" }, p("".concat(h, "items-list"), "itemsList")), { children: r.map(function(t, r) { @@ -35,20 +35,20 @@ var e = require("@swc/helpers/lib/_class_call_check.js").default, t = require("@ id: d(u, r), "aria-selected": m }, p(I, "item", 0 === r && "itemFirst", m && "itemHighlighted"), _); - return m && (g.ref = e.storeHighlightedItemReference), (0, l.jsx)(Item, s(i({}, g), { + return m && (g.ref = e.storeHighlightedItemReference), (0, c.jsx)(Item, s(i({}, g), { sectionIndex: u, isHighlighted: m, itemIndex: r, item: t, - renderItem: o, - renderItemData: c + renderItem: l, + renderItemData: o })); }) })); - }, c; + }, o; }(r(require("react")).Component); -o.propTypes = { +l.propTypes = { items: 500 -}, o.defaultProps = { +}, l.defaultProps = { sectionIndex: null -}, new o(); +}, new l(); diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/6791/1/config.json b/crates/swc_ecma_minifier/tests/fixture/issues/6791/1/config.json new file mode 100644 index 00000000000..a6932e18c0f --- /dev/null +++ b/crates/swc_ecma_minifier/tests/fixture/issues/6791/1/config.json @@ -0,0 +1,46 @@ +{ + "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": true, + "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 +} diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/6791/1/input.js b/crates/swc_ecma_minifier/tests/fixture/issues/6791/1/input.js new file mode 100644 index 00000000000..7e3b5434b8b --- /dev/null +++ b/crates/swc_ecma_minifier/tests/fixture/issues/6791/1/input.js @@ -0,0 +1,6 @@ +import { test } from "test"; +var Test; +(function (Test) { + Test["Hello"] = "World!"; +})(Test || (Test = {})); +test(Test["Hello"]); diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/6791/1/mangle.json b/crates/swc_ecma_minifier/tests/fixture/issues/6791/1/mangle.json new file mode 100644 index 00000000000..9fa9d303874 --- /dev/null +++ b/crates/swc_ecma_minifier/tests/fixture/issues/6791/1/mangle.json @@ -0,0 +1,3 @@ +{ + "toplevel": true +} diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/6791/1/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/6791/1/output.js new file mode 100644 index 00000000000..c432e9f2e9f --- /dev/null +++ b/crates/swc_ecma_minifier/tests/fixture/issues/6791/1/output.js @@ -0,0 +1,6 @@ +var o; +import { test as l } from "test"; +!function(o) { + o.Hello = "World!"; +}(o || (o = {})); +l(o.Hello);