Skip to content

fix(@angular/cli): support resolving subproject dependencies in bun workspaces - #34533

Merged
alan-agius4 merged 2 commits into
angular:mainfrom
clydin:fix/bun-workspace-dependencies
Oct 27, 2026
Merged

alan-agius4 merged 2 commits into
angular:mainfrom
clydin:fix/bun-workspace-dependencies

Conversation

@clydin

@clydin clydin commented Oct 26, 2026

Copy link
Copy Markdown
Member

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 #34402

…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`.
@clydin clydin added the target: patch This PR is targeted for the next patch release label Oct 26, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread packages/angular/cli/src/package-managers/manifest-dependencies.ts
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Oct 26, 2026
@clydin
clydin requested a review from alan-agius4 October 26, 2026 22:46
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Oct 27, 2026
@alan-agius4
alan-agius4 merged commit 322777d into angular:main Oct 27, 2026
43 checks passed
@alan-agius4

Copy link
Copy Markdown
Collaborator

This PR was merged into the repository. The changes were merged into the following branches:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/cli target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ng update: "Package '@angular/core' is not a dependency" in a bun workspace member

2 participants