Closed AbhiPrasad closed 5 months ago
p-map
being esm-only does not preclude updating to it here. The blocker is engines
. Once we bump that in this repo we can update. Generally we only replace a library and roll our own solution when we absolutely have to. I don't think we will be accepting this PR, sorry.
The blocker is engines
Could you clarify why the blocker is engines? Are you waiting for require(esm)
support?
p-map
does not work in node 16, cacache does.
~ $ npm view cacache engines
{ node: '^16.14.0 || >=18.0.0' }
~ $ npm view p-map engines
{ node: '>=18' }
When investigating reducing the dependency count for the semantic-release library, I discovered that
npm
has quite the large dependency tree: https://github.com/43081j/ecosystem-cleanup/issues/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 onp-map@4.0.0
, which pulls inaggregate-error@3.1.0
. 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 https://github.com/npm/cacache/pull/266