Skip to content

perf(@angular/cli): avoid redundant package version resolution in ng add#32715

Open
clydin wants to merge 1 commit intoangular:mainfrom
clydin:cli/add-perf-registry
Open

perf(@angular/cli): avoid redundant package version resolution in ng add#32715
clydin wants to merge 1 commit intoangular:mainfrom
clydin:cli/add-perf-registry

Conversation

@clydin
Copy link
Member

@clydin clydin commented Mar 6, 2026

The ng add command would previously resolve the package version from the registry multiple times during execution. This change updates the package identifier with the exact version from the manifest once it has been fetched from the registry, preventing subsequent redundant lookups. Additionally, the already-parsed package identifier is now passed directly to the package manager's getManifest method.

@clydin clydin added the target: patch This PR is targeted for the next patch release label Mar 6, 2026
@angular-robot angular-robot bot added area: performance Issues related to performance area: @angular/cli labels Mar 6, 2026
Copy link

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

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 optimizes the ng add command by preventing redundant package version resolutions, ensuring subsequent operations use the exact resolved version and eliminating unnecessary registry lookups. However, the current implementation introduces a security risk by trusting the name and version fields from the package manifest to update the package identifier. This could lead to package substitution or path traversal attacks if a malicious manifest is provided. A validation check is required to ensure the manifest data aligns with the requested package.

@clydin clydin force-pushed the cli/add-perf-registry branch from c18d934 to 05c4898 Compare March 6, 2026 19:01
The `ng add` command would previously resolve the package version from the
registry multiple times during execution. This change updates the package
identifier with the exact version from the manifest once it has
been fetched from the registry, preventing subsequent redundant lookups.
Additionally, the already-parsed package identifier is now passed directly
to the package manager's `getManifest` method.
@clydin clydin force-pushed the cli/add-perf-registry branch from 05c4898 to 7040590 Compare March 6, 2026 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: @angular/cli area: performance Issues related to performance target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant