Repository navigation
fix(@angular/cli): support resolving subproject dependencies in bun workspaces - #34533
Merged
Merged
Conversation
…orkspaces When running `bun pm ls` inside a workspace member directory, Bun resolves the workspace root lockfile and outputs only the direct dependencies declared in the root `package.json`, along with `workspace:` references to member packages. Because subproject dependencies (such as `@angular/core`) are omitted from this output, commands like `ng update` and `ng add` fail to detect installed project dependencies when executed in a Bun workspace member. To resolve this, `parseBunDependencies` now ignores `workspace:` protocol entries, and the `bun` package manager descriptor enables `requiresManifestDependencyLookup`. When populating the dependency cache, `PackageManager` supplements the command output by reading `dependencies` and `devDependencies` from the working directory's `package.json` and resolving their installed manifests across ancestor `node_modules` directories up to the workspace lockfile or repository root. Additionally, `getPackageNameCommand` is configured for `bun` using `bun pm pkg get name` to provide the same CLI fallback as `npm` and `pnpm`. Fixes angular#34402
Unlike npm, `bun pm view` does not emit `npm ERR! code E404` or nested JSON error objects with a `code` property when a package, version, or dist-tag is missing from the registry. Instead, missing packages produce plain-text HTTP status lines on `stderr` (such as `404 Not Found: ...`), while missing versions or dist-tags produce flat JSON objects on `stdout` with a string `error` field (such as `{ "error": "No matching version found" }`). Because `parseNpmLikeError` did not recognize either format, querying a non-existent package or version under Bun threw an unhandled `PackageManagerError` instead of returning `null`.
This change introduces a dedicated `parseBunError` parser for the `bun` package manager descriptor that extracts structured error codes from both Bun's JSON error payloads and plain-text HTTP status messages, normalizing not-found responses to `E404`.
There was a problem hiding this comment.
Code Review
This pull request introduces a manifest-based dependency resolution mechanism to supplement package manager commands, specifically addressing limitations in bun pm ls where workspace member dependencies are not fully reported. It adds directory traversal logic to locate node_modules up to a lockfile or git root, implements Bun-specific error parsing, and updates corresponding tests. The review feedback suggests extending the dependency resolution logic to also scan optionalDependencies from package.json to ensure complete coverage.
alan-agius4
approved these changes
Oct 27, 2026
4 of 13 tasks
Collaborator
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.
When running
bun pm lsinside a workspace member directory, Bun resolves the workspace root lockfile and outputs only the direct dependencies declared in the rootpackage.json, along withworkspace:references to member packages. Because subproject dependencies (such as@angular/core) are omitted from this output, commands likeng updateandng addfail to detect installed project dependencies when executed in a Bun workspace member.To resolve this,
parseBunDependenciesnow ignoresworkspace:protocol entries, and thebunpackage manager descriptor enablesrequiresManifestDependencyLookup. When populating the dependency cache,PackageManagersupplements the command output by readingdependenciesanddevDependenciesfrom the working directory'spackage.jsonand resolving their installed manifests across ancestornode_modulesdirectories up to the workspace lockfile or repository root. Additionally,getPackageNameCommandis configured forbunusingbun pm pkg get nameto provide the same CLI fallback asnpmandpnpm.Fixes #34402