Skip to content

chore(arborist): make getBundler traversal Set-only - #10274

Closed
jeffwidman wants to merge 1 commit into
npm:latestfrom
jeffwidman:jeffwidman-simplify-getbundler-traversal
Closed

jeffwidman wants to merge 1 commit into
npm:latestfrom
jeffwidman:jeffwidman-simplify-getbundler-traversal

Conversation

@jeffwidman

@jeffwidman jeffwidman commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Summary

npm/cli#10127 changed Node#getBundler() to use a Set for normal traversal, but intentionally retained precautionary compatibility for callers that explicitly pass an array.

This follow-up treats the optional traversal argument as internal recursion state and makes it Set-only. It removes the array-specific branch and the compatibility-only regression test, while preserving the default traversal behavior.

The compatibility question and tradeoff were discussed in this comment. This PR leaves it to maintainers to decide whether and when that API simplification is appropriate.

Validation

  • Direct Node checks passed for default traversal, independent default calls, pre-visited Set handling, and rejection of an explicit array.
  • node --check workspaces/arborist/lib/node.js
  • node --check workspaces/arborist/test/node.js

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@jeffwidman
jeffwidman requested a review from a team as a code owner November 10, 2026 23:24
@jeffwidman jeffwidman changed the title refactor(arborist): make getBundler traversal Set-only chore(arborist): make getBundler traversal Set-only Nov 11, 2026
@nkolev92

Copy link
Copy Markdown
Contributor

Let's keep it as is.

Someone could in theory be calling it and I don't want to introduce unnecessary risk.
Not worried about the type annotation.

Thanks for being persistent and following up here :)

@nkolev92 nkolev92 closed this Nov 11, 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