Skip to content
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

Merged
merged 2 commits into from Jul 20, 2023

Conversation

Austaras
Copy link
Member

Description:

BREAKING CHANGE:

Related issue (if exists):

@@ -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;
Copy link
Member Author

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;
Copy link
Member Author

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;
Copy link
Member Author

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
}));
Copy link
Member Author

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
}));
Copy link
Member Author

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
});
Copy link
Member Author

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;
Copy link
Member Author

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 = ()=>{};
Copy link
Member Author

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);
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Effectively the same.

@kdy1 kdy1 requested a review from jridgewell July 18, 2023 06:28
@kdy1 kdy1 added this to the Planned milestone Jul 18, 2023
, 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);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jridgewell
jridgewell previously approved these changes Jul 18, 2023
@kdy1 kdy1 changed the title refact(es/minifier): Respect TopLevel and Module fix(es/minifier): Respect toplevel and Module Jul 19, 2023
@kdy1 kdy1 changed the title fix(es/minifier): Respect toplevel and Module fix(es/minifier): Respect toplevel and module options Jul 19, 2023
@kdy1 kdy1 changed the title fix(es/minifier): Respect toplevel and module options refactor(es/minifier): Respect toplevel and module options Jul 19, 2023
kdy1
kdy1 previously approved these changes Jul 19, 2023
Copy link
Member

@kdy1 kdy1 left a 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

@kdy1 kdy1 self-assigned this Jul 19, 2023
@Austaras
Copy link
Member Author

Yeah, TSC tests need update. It would be one thousand lines of update, mostly removing top level use strict.

@Austaras Austaras dismissed stale reviews from kdy1 and jridgewell via ad960a9 July 19, 2023 05:37
@Austaras
Copy link
Member Author

It's weird. I cannot reproduce the CI failure, seems like it's comparing to pre updated tests.

@kdy1
Copy link
Member

kdy1 commented Jul 19, 2023

I'll update them by myself. Thank you again for the work!

@kdy1 kdy1 merged commit 9893bd2 into swc-project:main Jul 20, 2023
124 of 125 checks passed
@kdy1
Copy link
Member

kdy1 commented Jul 20, 2023

I'll fix CI with another PR because I'm not sure about the way to reproduce test failure locally

@kdy1 kdy1 modified the milestones: Planned, v1.3.71 Jul 25, 2023
@swc-project swc-project locked as resolved and limited conversation to collaborators Aug 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants