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.
When investigating reducing the dependency count for the semantic-release library, I discovered that
npm
has quite the large dependency tree: es-tooling/ecosystem-cleanup#64One area of improvement here is to remove the dependency on the
p-map
library and replace it with a smaller, simpler helper.Right now
cacache
relies on[email protected]
, which pulls in[email protected]
. Newer versions ofp-map
don't pull this inaggregate-error
at all, but that is not feasible to use because thiscacache
is CJS only, andp-map
5.x
and above are ESM only.Given
cacache
supports"^16.14.0 || >=18.0.0"
as per it'spackage.json
engines
field, it doesn't make sense for it to pull in a polyfill foraggregate-error
(Node.js 15+ adds support for the built-inAggregateError
.To replace
pMap
which we used from thep-map
library, I introduced amapWithPromise
helper. It doesn't have all the functionality ofpMap
, but it works well for the use cases inlib/verify.js
. In addition it should be slightly faster thanpMap
because of it is simpler. (let me know and I'm happy to bench mark to get exact numbers).This change should help eliminate 25 KB / 4 deps from the module graph of
cacache
.References
Supercedes #266