feat: add yarnpkg/nm/hoist export #6611
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's the problem this PR addresses?
Bundling
@yarnpkg/nm
(due to subdeps) is large and not needed when one needs only a few exports from./hoist
file:berry/packages/yarnpkg-nm/sources/buildNodeModulesTree.ts
Lines 1 to 4 in b3dfa91
But
hoist.ts
is a zero-dep lib:berry/packages/yarnpkg-nm/sources/hoist.ts
Lines 1 to 3 in b3dfa91
It's already built/distrubuted separately (see https://www.npmjs.com/package/@yarnpkg/nm?activeTab=code), just an entry in package.json was missing
Both its exports (and types) are already re-exported:
berry/packages/yarnpkg-nm/sources/index.ts
Lines 23 to 24 in b3dfa91
So this is not increasing public API surface, just adds a more convenient way to import it without pulling in the whole of
@yarnpkg/core
and@yarnpkg/pnp
How did you fix it?
Added
./hoist
to exports to point to./lib/hoist.js
Checklist