fix: ignore non-array bundle[d]Dependencies fields

This commit is contained in:
Zoltan Kochan
2020-09-02 00:14:15 +03:00
parent b540e8b875
commit 8242401c7f
3 changed files with 9 additions and 2 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/resolve-dependencies": patch
"supi": patch
---
Ignore non-array bundle[d]Dependencies fields. Fixes a regression caused by https://github.com/pnpm/pnpm/commit/5322cf9b39f637536aa4775aa64dd4e9a4156d8a

View File

@@ -8,7 +8,8 @@ export interface WantedDependency {
}
export default function getNonDevWantedDependencies (pkg: DependencyManifest) {
const bundledDeps = new Set(pkg.bundleDependencies ?? pkg.bundledDependencies ?? [])
const bd = pkg.bundleDependencies ?? pkg.bundleDependencies
const bundledDeps = new Set(Array.isArray(bd) ? bd : [])
bundledDeps.add(pkg.name)
const filterDeps = getNotBundledDeps.bind(null, bundledDeps)
return getWantedDependenciesFromGivenSet(

View File

@@ -153,7 +153,7 @@ function toLockfileDependency (
if (pkg.os) {
result['os'] = pkg.os
}
if (pkg.bundledDependencies != null || pkg.bundleDependencies != null) {
if (Array.isArray(pkg.bundledDependencies) || Array.isArray(pkg.bundleDependencies)) {
result['bundledDependencies'] = pkg.bundledDependencies ?? pkg.bundleDependencies
}
if (pkg.deprecated) {