feat(editor): browse and install npm packages from the Dependencies panel - #489
Draft
DavidBabinec wants to merge 2 commits into
Draft
feat(editor): browse and install npm packages from the Dependencies panel#489DavidBabinec wants to merge 2 commits into
DavidBabinec wants to merge 2 commits into
Conversation
…anel The panel could only list what package.json already declared, so adding a package meant knowing its exact name and typing it. It now searches the registry, shows a package page with README, versions, dependencies and OSV advisories, and installs a chosen version. The browser never talks to a registry. A server-side proxy on the site.read floor owns the host, the credentials and the caching, so NPM_REGISTRY_URL points browsing, resolving and bun install at one registry.
CodeQL flags `url.includes('api.npmjs.org')` as incomplete URL substring
sanitization: the host can appear anywhere in the string, so a crafted URL
satisfies the check. It is mock routing rather than a security decision, but
matching the parsed host and pathname is both accurate and clearer.
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.
What
The Dependencies panel becomes a real registry browser: search npm, open a package page with README, versions, dependencies and OSV advisories, and install a chosen version. Installed rows show what still imports a package and whether an update exists.
Why
The panel could only list what
package.jsonalready declared, so adding a package meant knowing its exact name and typing it in. There was no way to discover a package, check whether it ships ESM, or see if it has a known vulnerability, without leaving the editor.The browser never talks to a registry. A server-side proxy on the
site.readfloor owns the host, credentials and caching, soNPM_REGISTRY_URLpoints browsing, resolving andbun installat one registry. Private registries get plain search and packuments; download counts, advisories and npmjs.com links are public-npm only.Verification
Notes
Four review rounds ran over this. The last one caught a shared cached load being cancelled by whichever caller happened to start it, which is covered by a test now.