mirror of
https://github.com/pnpm/pnpm.git
synced 2026-06-01 12:41:16 -04:00
fix(list): limit manifest reads for large workspaces (#11692)
This commit is contained in:
7
.changeset/olive-spies-listen.md
Normal file
7
.changeset/olive-spies-listen.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
"@pnpm/deps.inspection.list": patch
|
||||
"@pnpm/workspace.project-manifest-reader": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
Limit concurrent project manifest reads while listing large workspaces to avoid `EMFILE` errors.
|
||||
3
pnpm-lock.yaml
generated
3
pnpm-lock.yaml
generated
@@ -9638,6 +9638,9 @@ importers:
|
||||
json5:
|
||||
specifier: 'catalog:'
|
||||
version: 2.2.3
|
||||
p-limit:
|
||||
specifier: 'catalog:'
|
||||
version: 7.3.0
|
||||
parse-json:
|
||||
specifier: 'catalog:'
|
||||
version: 8.3.0
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
"fast-deep-equal": "catalog:",
|
||||
"is-windows": "catalog:",
|
||||
"json5": "catalog:",
|
||||
"p-limit": "catalog:",
|
||||
"parse-json": "catalog:",
|
||||
"read-yaml-file": "catalog:",
|
||||
"strip-bom": "catalog:"
|
||||
|
||||
@@ -9,6 +9,7 @@ import { writeProjectManifest } from '@pnpm/workspace.project-manifest-writer'
|
||||
import detectIndent from 'detect-indent'
|
||||
import equal from 'fast-deep-equal'
|
||||
import isWindows from 'is-windows'
|
||||
import pLimit from 'p-limit'
|
||||
import { readYamlFile } from 'read-yaml-file'
|
||||
|
||||
import {
|
||||
@@ -18,15 +19,19 @@ import {
|
||||
|
||||
export type WriteProjectManifest = (manifest: ProjectManifest, force?: boolean) => Promise<void>
|
||||
|
||||
const limitProjectManifestReads = pLimit(4)
|
||||
|
||||
export async function safeReadProjectManifestOnly (projectDir: string): Promise<ProjectManifest | null> {
|
||||
try {
|
||||
return await readProjectManifestOnly(projectDir)
|
||||
} catch (err: any) { // eslint-disable-line
|
||||
if ((err as NodeJS.ErrnoException).code === 'ERR_PNPM_NO_IMPORTER_MANIFEST_FOUND') {
|
||||
return null
|
||||
return limitProjectManifestReads(async () => {
|
||||
try {
|
||||
return await readProjectManifestOnly(projectDir)
|
||||
} catch (err: any) { // eslint-disable-line
|
||||
if ((err as NodeJS.ErrnoException).code === 'ERR_PNPM_NO_IMPORTER_MANIFEST_FOUND') {
|
||||
return null
|
||||
}
|
||||
throw err
|
||||
}
|
||||
throw err
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export async function readProjectManifest (projectDir: string): Promise<{
|
||||
|
||||
Reference in New Issue
Block a user