-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(es/minifier): Respect toplevel
and module
options
#7671
Conversation
@@ -15415,27 +15415,27 @@ | |||
} | |||
]); | |||
for(var i = 0; i < lastLevelTicks.length - 1; i++){ | |||
var approxInterval1, approxInterval2, approxInterval3, startTick = lastLevelTicks[i].value, endTick = lastLevelTicks[i + 1].value; | |||
var approxInterval1, startTick = lastLevelTicks[i].value, endTick = lastLevelTicks[i + 1].value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No observable effect
}(), function(exports) { | ||
exports.default = void 0, exports.default = String; | ||
}(), (void 0).__esModule = !0, (void 0).__esModule = !0, (void 0).__esModule = !0; | ||
}(), exports.default = null, (void 0).exports = exports.default, (void 0).default = void 0, exports1.default = void 0, (void 0).exports = exports1.default, exports2.default = void 0, (void 0).exports = exports2.default, exports3.default = void 0, exports3.default = String, exports4.default = void 0, exports4.default = String, (void 0).__esModule = !0, (void 0).__esModule = !0, (void 0).__esModule = !0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Intended.
@@ -12,6 +12,7 @@ export var modifiers = { | |||
0 | |||
]; | |||
else { | |||
var offset1, popperOffsets, referenceOffsets; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test case doesn't enable unused
or side_effect
.
console.log((o.a = 3, { | ||
x: o.a, | ||
y: o.b | ||
})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sequences
take effect without being configured.
}, { | ||
x: c.a, | ||
y: c.b | ||
})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
b: 2 | ||
}).a, | ||
y: o.b | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
terser cannot handle duplicate idents.
@@ -1,3 +1,3 @@ | |||
var unused; | |||
const CONST_FOO = !1; | |||
var moo, bar; | |||
var moo; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
}; | ||
var f0 = ()=>0; | ||
var f1 = ()=>{}; | ||
var f2 = ()=>{}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused pass is enabled when side_effects
set to true in swc.
for(var k in "12"){ | ||
var b = void 0; | ||
void ((b >>= 1) && (a = "FAIL"), b = 2); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Effectively the same.
...ma_minifier/tests/terser/compress/identity/inline_identity_dont_lose_this_when_arg/output.js
Show resolved
Hide resolved
crates/swc_ecma_minifier/tests/terser/compress/identity/inline_identity_lose_this/output.js
Show resolved
Hide resolved
, y = 3; | ||
console.log(2, y, 4, 2 * y, 8, 4 * y, 2, g(), 4); | ||
const g = ()=>y, y = 3; | ||
console.log(2, y, 4, 2 * y, 8, 4 * y, 2, y, 4); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TopLevel
and Module
toplevel
and Module
toplevel
and Module
toplevel
and module
options
toplevel
and module
optionstoplevel
and module
options
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! CI is failing
swc-bump:
- swc_ecma_minifier
Yeah, TSC tests need update. It would be one thousand lines of update, mostly removing top level use strict. |
It's weird. I cannot reproduce the CI failure, seems like it's comparing to pre updated tests. |
I'll update them by myself. Thank you again for the work! |
I'll fix CI with another PR because I'm not sure about the way to reproduce test failure locally |
Description:
BREAKING CHANGE:
Related issue (if exists):