Conversation
For "my-alias": "npm:dep@1.0.0", bun outdated printed the row as dep but matched its name patterns against my-alias only, and bun why knew the package as dep only. bun outdated now matches a pattern against the package.json name and the package name, as bun update <name> does, and prints the row as my-alias@npm:dep. A negated pattern keeps the row only when neither name matches. The alias part of the cell is sized in terminal columns, because a package.json key can hold wide characters. bun why now also selects a package through the name of a dependency that resolves to it, and prints that name in the dependent's line: (requires my-alias@npm:dep@1.0.0). Both commands get the alias from DependencyExt::alias_for.
|
Warning Review paused — included plan limit reachedKeep your review moving with free on-demand reviews.
On-demand reviews are free for the next 2 days.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Promotion and pricing detailsOn-demand reviews are free for the next 2 days. After that, they cost $0.25 per reviewed file. Review limit detailsOr wait 5 minutes for your next included review. Limit details: You’ve used all 10 included reviews currently available. Review configuration: ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Essentials Run ID: 📒 Files selected for processing (8)
Comment |
|
Updated 11:52 AM PT - Sep 18th, 2026
✅ @robobun, your commit 71cbbae4f967a65a5660d35e23c26736835a14db passed in 🧪 To try this PR locally: bunx bun-pr 43338That installs a local version of the PR into your bun-43338 --bun |
|
Status How I reproduced it, on 1.4.3-canary (b52d513) and on main:
The same steps are in the two new tests, with the local verdaccio registry (
Both fail on the canary and pass on this branch. Both files pass in full with the debug build. |
Problem
"my-alias": "npm:dep@1.0.0",bun outdatedprints the row asdep.bun outdated depprints nothing andbun outdated my-aliasprints thedeprow.bun why my-aliasfails witherror: No packages matching 'my-alias' found in lockfile.bun why depworks and does not show the alias.collect_outdatedmatches patterns against the dependency name (src/runtime/cli/outdated_command.rs:403) and prints the package name (:419).bun whyselects by package name only (src/runtime/cli/why_command.rs:445).Fix
bun outdatedmatches a pattern against both names, asbun update <name>already does (src/install/update_scope.rs:453). A!patternkeeps a row only when neither name matches. An aliased row prints asmy-alias@npm:dep, the formbun addprints.bun whyalso selects a package through the name of a dependency that resolves to it. The dependent's line prints that name:(requires my-alias@npm:dep@1.0.0).DependencyExt::alias_for. The Notes list the other commands with the same gap. They do not change here.test/cli/install/bun-install-registry.test.ts(outdated) andtest/cli/install/bun-pm-why.test.tsfail on the 1.4.3 canary. Both full files pass. Self-reviewed: 6 concerns raised, 6 addressed, one in part (Notes).Background
"my-alias": "npm:dep@1.0.0"puts the registry packagedepinnode_modules/my-alias.my-alias, the package.json key) and the package name (dep).bun updateandbun addtake the dependency name. The registry versions belong to the package name. So the table shows both.Notes
Output after the fix, for
dependencies: {"my-alias": "npm:dep@1.0.0", "other": "1.0.0"}anddevDependencies: {"dev-alias": "npm:dep@1.0.0"}:bun outdated deplists both alias rows,bun outdated my-aliaslists one,bun outdated '!dep'lists onlyother,bun outdated '!my-*'listsotheranddev-alias@npm:dep (dev). Sopand!psplit the table in two.The printed form. The report suggested
my-alias (dep). I usedmy-alias@npm:depbecause the column already ends in(dev),(peer)or(optional), and becauseinstalled my-alias@npm:dep@1.0.0is whatbun addprints (print_installed_update_requestinsrc/install/lockfile/printer/tree_printer.rs). The row can be pasted intobun add my-alias@npm:dep@2.0.0.Where the alias goes in
bun why. The alias belongs to the edge, not to the package. One package can have several aliases and a dependent under its own name at once. So the header staysdep@1.0.0and each dependent line carries its own name for the package. The rule is "the dependency name differs from the resolved package name", so it also covers acatalog:alias, an overridden dependency, and a git, tarball or folder dependency whose key is not thenamein its package.json.Dependency::realname()does not see the first two.Width. An alias is a package.json key, so it can hold wide characters (
"別名": "npm:dep@1.0.0"installs). The alias part of the cell is measured in terminal columns. The test has such a row and checks that every line of the table has the sameBun.stringWidth.Other open PRs in the same lines.
outdated_command.rs. This PR adds the samevisible_widthhelper at the same place, so the second one to land only has to apply it to both names.collect_outdated. The second one to land keeps that PR's rule for combining patterns and this PR's two-name match for each pattern.bun whytests) rewritesbun-pm-why.test.ts. Its alias test asserts the behavior this PR changes (bun why alias-pkgexits 1). The second one to land has to carry the new alias test over.bun why) rebuilds the loop that fillsDependentInfo. The two PRs merge without a textual conflict in parts of that loop, but the result does not compile until the newaliasfield is set there, per target. The pre-pass that marks packages by dependency name should then also mark the served peer targets.Same gap, not changed here. Only the two-name rule is shared (
alias_for).bun update,bun outdatedandbun whystill have three glob dialects, and I did not unify them.bun patch:bun patch depprintserror: package dep not found.bun patch my-aliasworks and printsTo patch dep, edit the following folder: node_modules/my-alias. Reported separately.bun pm lsand thebun installsummary print the alias only (my-alias@1.0.0).bun update -ilists the alias only (update_interactive_command.rs,name: Box::from(name_slice)).bun auditcompares the dependency name with the advisory's package name when it marks a direct dependency (audit_command.rs). I did not run it against an advisory server.bun pm trust: install: trust npm: aliased packages by the same name in bun pm trust, the installer and bun.lock #39443 is open for it.bun install --yarn: yarn lockfile output ignores alias name #17089 is open for it.bun removeandbun update <name>are right as they are: the first edits a package.json key, the second already takes either name.Self-review. Six concerns were raised: the width of the alias, the two open PRs above, the two private copies of the alias rule, a warning not to merge the glob matchers, the unnamed sibling commands, and the
bun whyhelp text. All are addressed in the diff or in these Notes. One part is rejected: a sharedDisplayforalias@npm:pkg.bun add,bun outdatedandbun whycolor the parts differently, andbun whyprints the spec (alias@npm:dep@1.0.0), not the package name.Test notes. The new
whytest replacesshould handle npm aliases. That test accepted exit 1 throughelse { expect(true).toBe(true) }and used the public registry. The new one uses the local verdaccio registry, a root alias, a glob on the alias, and an alias declared by a registry package (alias-loop-1depends onalias-loop-2asalias1).Found on the way, fixed in other PRs:
bun why dep@1.0.0never matches (an exact name with a version): bun why: match an exact name that has a version #43284. The same compare serves the alias lookup, sobun why my-alias@1.0.0works when that lands. It also changes the signature ofmatches_name, so the second one to land updates the call in the pre-pass.nameprintsNo dependents foundfor every query: why: list a root package.json with no name as a dependent #43277. In such a projectbun why my-aliasnow finds the package and prints that same line, asbun why depdoes.bun outdated a bselects nothing because the patterns are AND-ed: outdated: list a dependency that matches any of the name patterns #43309.