-
Notifications
You must be signed in to change notification settings - Fork 26
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
Handle mapped exports #82
Conversation
💚 CLA has been signed |
9a198f3
to
8629f9b
Compare
8629f9b
to
942ea29
Compare
942ea29
to
3e1d176
Compare
cla/check |
@gtback do you have any insight on how to get the CLA issue resolved? Our legal team says we have signed it and added myself and @bizob2828 to the CLA. |
cla/check |
cla/check |
🎉 one CI step complete. Now we just need to kick off the test runs. |
@jsumners-nr This is on my radar, I just haven't had a chance to look yet. Sorry about the delay. |
Awesome. Thank you. |
This builds on elastic#82 This first commit is a breaking test case to discuss.
@jsumners-nr Again, sorry for the delay. I was away at a work thing one of those weeks. Thanks for this PR. I agree this should handle package entry points using "exports" (https://nodejs.org/api/packages.html#package-entry-points). I pushed a branch with a couple commits on top of yours for discussion:
The first commit adds a test case that breaks your proposed fix -- assuming I'm not missing something. Basically, I added this to the "exports" in package.json: "./bar": {
"require": "./dist/cjs/bar.cjs",
"import": "./dist/esm/bar.js"
} In this case, the normalization that you were proposing does not result in matching a In the second commit, I have a counter proposal that I think might work. I'd like your feedback on it. |
Good catch. I completely overlooked files nested in a subdirectory.
Looks good to me. |
Are we going to apply your fix to this PR? |
Yes, I should get there tomorrow. |
@jsumners-nr Would you like to test this with your upstream? |
Earliest I can do that is next week. |
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.
/me LGTM's some of my own commits
PR elastic#82 originally included code to ignore the resolved file extension. This PR restores that functionality.
PR elastic#82 originally included code to ignore the resolved file extension. This PR restores that functionality.
This PR fixes an issue with mapped exports. Basically, if a module exports multiple versions of the same source then the commonjs export will end up with a file extension added. When the file extension is added, it breaks the allow list lookup and results in the hook never being applied.