Skip to content

fix(arborist): simplify rootDeclaredDeps initialization#9097

Merged
wraithgar merged 1 commit intonpm:latestfrom
manzoorwanijk:chore/root-declared-deps-object-assign
Mar 10, 2026
Merged

fix(arborist): simplify rootDeclaredDeps initialization#9097
wraithgar merged 1 commit intonpm:latestfrom
manzoorwanijk:chore/root-declared-deps-object-assign

Conversation

@manzoorwanijk
Copy link
Contributor

Summary

Simplifies the #rootDeclaredDeps initialization in isolated-reifier.js by using Object.assign instead of multiple Object.keys spread calls.

Suggested in #9095 (comment).

Before

this.#rootDeclaredDeps = new Set([
  ...Object.keys(rootPkg.dependencies || {}),
  ...(!omit.has('dev') ? Object.keys(rootPkg.devDependencies || {}) : []),
  ...(!omit.has('optional') ? Object.keys(rootPkg.optionalDependencies || {}) : []),
  ...(!omit.has('peer') ? Object.keys(rootPkg.peerDependencies || {}) : []),
])

After

this.#rootDeclaredDeps = new Set(Object.keys(Object.assign({},
  rootPkg.dependencies,
  (!omit.has('dev') && rootPkg.devDependencies),
  (!omit.has('optional') && rootPkg.optionalDependencies),
  (!omit.has('peer') && rootPkg.peerDependencies),
)))

@manzoorwanijk manzoorwanijk force-pushed the chore/root-declared-deps-object-assign branch from ca9e2f2 to 62568a1 Compare March 10, 2026 16:51
@wraithgar wraithgar changed the title chore(arborist): simplify rootDeclaredDeps initialization fix(arborist): simplify rootDeclaredDeps initialization Mar 10, 2026
@wraithgar
Copy link
Member

chore is reserved for changes that would not be part of the published package. Things like workspace changes, changes to tests only, etc.

@wraithgar wraithgar merged commit 3b70a9d into npm:latest Mar 10, 2026
17 checks passed
@manzoorwanijk
Copy link
Contributor Author

chore is reserved for changes that would not be part of the published package. Things like workspace changes, changes to tests only, etc.

Noted. Thanks

@manzoorwanijk manzoorwanijk deleted the chore/root-declared-deps-object-assign branch March 10, 2026 17:01
@github-actions github-actions bot mentioned this pull request Mar 10, 2026
manzoorwanijk added a commit to manzoorwanijk/npm-cli that referenced this pull request Mar 10, 2026
wraithgar pushed a commit that referenced this pull request Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants