Skip to content

fix(arborist): simplify rootDeclaredDeps initialization - #9097

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

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

Conversation

@manzoorwanijk

Copy link
Copy Markdown
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 =newSet([
...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 =newSet(Object.keys(Object.assign({},rootPkg.dependencies,(!omit.has('dev')&&rootPkg.devDependencies),(!omit.has('optional')&&rootPkg.optionalDependencies),(!omit.has('peer')&&rootPkg.peerDependencies),)))

@manzoorwanijk
manzoorwanijk requested a review from a team as a code ownerMarch 10, 2026 16:43
@manzoorwanijk
manzoorwanijkforce-pushed the chore/root-declared-deps-object-assign branch from 6c8c95b to ca9e2f2CompareMarch 10, 2026 16:46
@manzoorwanijk
manzoorwanijkforce-pushed the chore/root-declared-deps-object-assign branch from ca9e2f2 to 62568a1CompareMarch 10, 2026 16:51
@wraithgarwraithgar changed the title chore(arborist): simplify rootDeclaredDeps initializationfix(arborist): simplify rootDeclaredDeps initializationMar 10, 2026
@wraithgar

Copy link
Copy Markdown
Contributor

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:latestMar 10, 2026
17 checks passed
@manzoorwanijk

Copy link
Copy Markdown
ContributorAuthor

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-actionsgithub-actionsBot 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
@github-actionsgithub-actionsBot mentioned this pull request May 27, 2026
Sign up for freeto 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

@manzoorwanijk@wraithgar