-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix: include namespace variable paths during try-catch deoptimization #6216
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
fix: include namespace variable paths during try-catch deoptimization #6216
Conversation
Fixes regression introduced in #5842 (v4.34.7). Add a check in `MemberExpression.include` to call `this.variable.includePath(UNKNOWN_PATH, context)` when `includeChildrenRecursively` is true, ensuring namespace properties are preserved. This mirrors the change made to `IdentifierBase.include` in #5842, which added the same check. `MemberExpression` was missing this handling for its namespace variable.
|
@schwing is attempting to deploy a commit to the rollup-js Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
lukastaegert
left a comment
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.
Ouch, nice catch, and thank you for the well-crafted fix! Will merge this right away if CI agrees.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6216 +/- ##
=======================================
Coverage 98.76% 98.76%
=======================================
Files 271 271
Lines 10660 10662 +2
Branches 2852 2853 +1
=======================================
+ Hits 10528 10530 +2
Misses 89 89
Partials 43 43 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This PR has been released as part of [email protected]. You can test it via |
|
Thanks for the quick response @lukastaegert! Glad I could contribute something back. |
This PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers:
Description
Fixes regression introduced in #5842 (v4.34.7).
Found this issue when importing a third party module that exports like
export * as ns from './values.js';. This worked through version v4.34.6, with the issue introduced in v4.34.7 continuing through current latest version v4.53.5 as of this writing.Add a check in
MemberExpression.includeto callthis.variable.includePath(UNKNOWN_PATH, context)whenincludeChildrenRecursivelyis true, ensuring namespace properties are preserved.This mirrors the change made to
IdentifierBase.includein #5842, which added the same check.MemberExpressionwas missing this handling for its namespace variable.Added two tests, one for each case I found while debugging,
export * as ns from './values.js';andimport * as ns from './dep.js';.Repl for reproducing the issue
Uncomment the last line to see the difference in the resulting
const foo =.https://rollupjs.org/repl/?version=4.53.5&shareable=eyJleGFtcGxlIjpudWxsLCJtb2R1bGVzIjpbeyJjb2RlIjoiaW1wb3J0IHsgbnMgfSBmcm9tICcuL2RlcC5qcyc7XG5cbmZ1bmN0aW9uIHJ1bkluVHJ5Q2F0Y2goZm4pIHtcblx0dHJ5IHtcblx0XHRyZXR1cm4gZm4oKTtcblx0fSBjYXRjaCB7fVxufVxuXG5mdW5jdGlvbiBnZXRCYXIob2JqKSB7XG5cdHJldHVybiBvYmouYmFyO1xufVxuXG4vLyBUaGlzIHJlc3VsdHMgaW4gYGNvbnN0IGZvbyA9IHsgfTtgXG5ydW5JblRyeUNhdGNoKCgpID0-IGdldEJhcihucy5mb28pKTtcblxuLy8gVW5jb21tZW50aW5nIHRoaXMgcmVzdWx0cyBpbiBgY29uc3QgZm9vID0geyBiYXI6ICdiYXonIH07YCBcbi8vZ2V0QmFyKG5zLmZvbyk7IiwiaXNFbnRyeSI6dHJ1ZSwibmFtZSI6Im1haW4uanMifSx7ImNvZGUiOiJleHBvcnQgKiBhcyBucyBmcm9tICcuL3ZhbHVlcy5qcyc7IiwiaXNFbnRyeSI6ZmFsc2UsIm5hbWUiOiJkZXAuanMifSx7ImNvZGUiOiJleHBvcnQgY29uc3QgZm9vID0geyBiYXI6ICdiYXonIH07IiwiaXNFbnRyeSI6ZmFsc2UsIm5hbWUiOiJ2YWx1ZXMuanMifV0sIm9wdGlvbnMiOnsib3V0cHV0Ijp7ImZvcm1hdCI6ImVzIn0sInRyZWVzaGFrZSI6dHJ1ZX19