esm: merge esm and cjs package.json caches#33229
esm: merge esm and cjs package.json caches#33229shackijj wants to merge 5 commits intonodejs:masterfrom
Conversation
|
@guybedford as discussed earlier in the issue, I tried to keep diffs down. Additionally, I'd move the following checks to |
adcfd60 to
c14e769
Compare
|
One test failed on MacOS (Build from tarball / test-tarball-macOS). It seems that the test does not relate the changes I made. Also, this job finished succefully (same MacOS environment). Can't reproduce this on my Mac as well. Is there a chance that the test is flaky? Is there a way to restrart ci pipeline without a new commit? @guybedford do you have any thought on that? |
guybedford
left a comment
There was a problem hiding this comment.
Thanks for keeping the diff manageable here, makes a big difference and it's looking really nice and simple.
We should just check the error / missing package.json cases carefully here, but this is looking almost good to go.
|
@shackijj those further refactorings sound really sensible to me too, if you want to add them in this PR too feel free. |
e149015 to
ce1005a
Compare
|
@guybedford I decided not to move the functions to a separate module until you approve the last changes that I made. Added test for ERR_INVALID_PACKAGE_CONFIG.
P.S. I believe we could document internalModuleReadJSON a bit better. |
guybedford
left a comment
There was a problem hiding this comment.
@shackijj this is looking really good and thorough thank you. I think we're nearly there.
Yes I think following the clear specification for when to throw invalid makes more sense than the perf optimization for esm. So the branching seems good to me.
guybedford
left a comment
There was a problem hiding this comment.
Looks great to me, and we just got that negative diff!
//cc @nodejs/modules-active-members if anyone else wants to review this PR.
add test for ERR_INVALID_PACKAGE_CONFIG error Refs: nodejs#30674
4f19db7 to
0227b07
Compare
|
@guybedford I rebased the branch and changed the history a bit as to follow the commit guideline. Also, the guideline states that I should add 'author ready' label to this PR. It seems that I don't have rights to add a label to PR. Could you please add it? |
test/fixtures/node_modules/invalid-pjson/package.json Refs: nodejs#30674
2b38d67 to
e5f3182
Compare
|
This looks great to me. //cc @addaleax for C++ review. |
d760659 to
0d947ec
Compare
|
The tests failed on MacOS with the following error It seems that the test is not related this fix and might be flaky. |
|
https://ci.nodejs.org/job/node-test-pull-request/31456/ is green, this can land. |
|
Landed in 8f10bb2. |
Relates to: #30674
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes