diff --git a/.changeset/dirty-cases-scream.md b/.changeset/dirty-cases-scream.md new file mode 100644 index 0000000000..77275415ac --- /dev/null +++ b/.changeset/dirty-cases-scream.md @@ -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). diff --git a/__fixtures__/with-git-protocol-dep/cache/metadata-v1.3/localhost+7769/is-number.v8 b/__fixtures__/with-git-protocol-dep/cache/metadata-v1.3/localhost+7769/is-number.v8 new file mode 100644 index 0000000000..2ff795d4d7 Binary files /dev/null and b/__fixtures__/with-git-protocol-dep/cache/metadata-v1.3/localhost+7769/is-number.v8 differ diff --git a/pkg-manager/resolve-dependencies/src/resolveDependencies.ts b/pkg-manager/resolve-dependencies/src/resolveDependencies.ts index 01fc07e2a3..6fc299aac4 100644 --- a/pkg-manager/resolve-dependencies/src/resolveDependencies.ts +++ b/pkg-manager/resolve-dependencies/src/resolveDependencies.ts @@ -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) }