fix: the add command should not fail, when blockExoticSubdeps is true (#10327)

close #10324
This commit is contained in:
Zoltan Kochan
2025-12-17 11:24:32 +01:00
committed by GitHub
parent c5fbddee05
commit e46a652939
3 changed files with 10 additions and 3 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/resolve-dependencies": patch
"pnpm": patch
---
Don't fail on `pnpm add`, when `blockExoticSubdeps` is set to `true` [#10324](https://github.com/pnpm/pnpm/issues/10324).

View File

Binary file not shown.

View File

@@ -1390,7 +1390,8 @@ async function resolveDependency (
if (
ctx.blockExoticSubdeps &&
options.currentDepth > 0 &&
!isNonExoticDep(pkgResponse.body.resolvedVia)
pkgResponse.body.resolvedVia != null && // This is already coming from the lockfile, we skip the check in this case for now. Should be fixed later.
isExoticDep(pkgResponse.body.resolvedVia)
) {
const error = new PnpmError(
'EXOTIC_SUBDEP',
@@ -1807,6 +1808,6 @@ const NON_EXOTIC_RESOLVED_VIA = new Set([
'workspace',
])
function isNonExoticDep (resolvedVia: string | undefined): boolean {
return resolvedVia != null && NON_EXOTIC_RESOLVED_VIA.has(resolvedVia)
function isExoticDep (resolvedVia: string): boolean {
return !NON_EXOTIC_RESOLVED_VIA.has(resolvedVia)
}