feat(cli): add deno list subcommand to list declared dependencies#34972
Merged
Conversation
bartlomieju
commented
Jun 15, 2026
Member
Author
There was a problem hiding this comment.
DENO_HELP is not updated with list subcommand in "Dependency management" section
bartlomieju
commented
Jun 15, 2026
- Add the list subcommand to the Dependency management section of the top-level help output. - Remove the --json flag and its (newly invented) output format. Rather than ship a Deno-specific JSON shape, JSON output can be reintroduced later in an existing, tool-consumable format. Rework the prod/dev/ filter spec tests to assert against the table output instead.
- Add a jsr dependency (@denotest/add) to the list spec fixture and a dedicated 'jsr' test, covering the previously untested DepKind::Jsr flat and tree paths. Update flat/prod/depth expectations since jsr roots sort before npm. - Comment the npm_by_base first-wins behavior for packages present with distinct peer sets, and note the ASCII byte-width assumption in the flat table.
# Conflicts: # cli/factory.rs
The jsr -> npm edges in the dependency tree were built directly from the lockfile `specifiers` value (`name@<resolved>`). When the npm dependency carries a peer suffix, that value can be formatted differently from the `content.npm` key (e.g. `[email protected]` vs `name@version_peer@1`), so the child id didn't match any npm node and the whole subtree was dropped from `deno list --depth N`. Prefer an exact match on the npm key (pins the precise peer variant) and fall back to mapping the base `name@version` onto its node via the same `npm_by_base` table that root resolution uses.
# Conflicts: # cli/args/flags.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Deno has no equivalent of
npm ls/pnpm listfor inspecting aproject's declared dependencies.
deno infois close but answers adifferent question: it walks the module graph from an entrypoint and
reports every module reached, at file granularity. There is no way to
ask "what packages does this project depend on?" straight from the
manifest, without an entrypoint, grouped by package and version.
This adds a
deno listsubcommand that reads the dependencies declaredin
deno.jsonimports andpackage.jsondependencies/devDependencies, resolves their current versions, and
prints them. By default it shows a flat table of direct dependencies;
--depth Nrenders the resolved dependency tree N levels deep (forboth npm and jsr, sourced from the lockfile).
--prodand--devfilter by dependency kind, positional name filters support wildcards
and
!negation (reusing the same matcher asdeno outdated), and--recursiveincludes all workspace members.The dependency enumeration and version resolution reuse the existing
DepManagerthat backsdeno outdated, so this is mostly a newpresentation layer plus flag wiring.
Closes #26517