-
Notifications
You must be signed in to change notification settings - Fork 27
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
Support RollupJS reexports property checks #41
Conversation
if (ch !== 33/*!*/) break; | ||
pos += 1; | ||
ch = commentWhitespace(); | ||
if (source.startsWith(id, pos)) { |
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.
Which tool uses exports.hasOwnProperty
?
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.
RollupJS just does this now as per #38. I'm not sure if there's anything for the collision case, that's why I added the Object.hasOwnProperty
as well in case that gets added in future //cc @lukastaegert.
}); | ||
|
||
Object.keys(external6).forEach(function (k) { | ||
if (k !== 'default' && !external6.hasOwnProperty(k)) exports[k] = external6[k]; |
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.
It's exports.hasOwnProperty
not external6.hasOwnProperty
😅
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.
Thanks for spotting this, wish we'd got this on the first review! Posted #59.
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.
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.
Thanks! I think it works correctly now.
Fixes #38.
This extends the
p !== 'default'
pattern to add the!exports.hasOwnProperty(p)
reexports check as well. I've also included a check forObject.hasOwnProperty.call(exports, p)
for the case if RollupJS ever decides to use this form as well.//cc @nicolo-ribaudo for review. I've also refactored the Babel hasOwnProperty check here making the
prototype
optional.