perf(link-bins): replace p-settle with builtin Promise.allSettled (#9908)

This commit is contained in:
Tomer Aberbach
2025-08-26 20:03:19 -04:00
committed by GitHub
parent a42e9ff1fc
commit affdd5b5b9
4 changed files with 7 additions and 10 deletions

View File

@@ -0,0 +1,5 @@
---
"@pnpm/link-bins": patch
---
Replace `p-settle` with the builtin `Promise.allSettled`

View File

@@ -47,7 +47,6 @@
"is-subdir": "catalog:", "is-subdir": "catalog:",
"is-windows": "catalog:", "is-windows": "catalog:",
"normalize-path": "catalog:", "normalize-path": "catalog:",
"p-settle": "catalog:",
"ramda": "catalog:", "ramda": "catalog:",
"semver": "catalog:", "semver": "catalog:",
"symlink-dir": "catalog:" "symlink-dir": "catalog:"

View File

@@ -15,7 +15,6 @@ import rimraf from '@zkochan/rimraf'
import isSubdir from 'is-subdir' import isSubdir from 'is-subdir'
import isWindows from 'is-windows' import isWindows from 'is-windows'
import normalizePath from 'normalize-path' import normalizePath from 'normalize-path'
import pSettle from 'p-settle'
import isEmpty from 'ramda/src/isEmpty' import isEmpty from 'ramda/src/isEmpty'
import unnest from 'ramda/src/unnest' import unnest from 'ramda/src/unnest'
import groupBy from 'ramda/src/groupBy' import groupBy from 'ramda/src/groupBy'
@@ -143,11 +142,11 @@ async function _linkBins (
await fs.mkdir(binsDir, { recursive: true }) await fs.mkdir(binsDir, { recursive: true })
const results = await pSettle(allCmds.map(async cmd => linkBin(cmd, binsDir, opts))) const results = await Promise.allSettled(allCmds.map(async cmd => linkBin(cmd, binsDir, opts)))
// We want to create all commands that we can create before throwing an exception // We want to create all commands that we can create before throwing an exception
for (const result of results) { for (const result of results) {
if (result.isRejected) { if (result.status === 'rejected') {
throw result.reason throw result.reason
} }
} }

6
pnpm-lock.yaml generated
View File

@@ -561,9 +561,6 @@ catalogs:
p-queue: p-queue:
specifier: ^6.6.2 specifier: ^6.6.2
version: 6.6.2 version: 6.6.2
p-settle:
specifier: ^4.1.1
version: 4.1.1
parse-json: parse-json:
specifier: ^5.2.0 specifier: ^5.2.0
version: 5.2.0 version: 5.2.0
@@ -5399,9 +5396,6 @@ importers:
normalize-path: normalize-path:
specifier: 'catalog:' specifier: 'catalog:'
version: 3.0.0 version: 3.0.0
p-settle:
specifier: 'catalog:'
version: 4.1.1
ramda: ramda:
specifier: 'catalog:' specifier: 'catalog:'
version: '@pnpm/ramda@0.28.1' version: '@pnpm/ramda@0.28.1'