Skip to content

feat(editor): browse and install npm packages from the Dependencies panel - #489

Draft
DavidBabinec wants to merge 2 commits into
mainfrom
feat/npm-registry-panel
Draft

feat(editor): browse and install npm packages from the Dependencies panel#489
DavidBabinec wants to merge 2 commits into
mainfrom
feat/npm-registry-panel

Conversation

@DavidBabinec

Copy link
Copy Markdown
Contributor

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.json already 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.read floor owns the host, credentials and caching, so NPM_REGISTRY_URL points browsing, resolving and bun install at one registry. Private registries get plain search and packuments; download counts, advisories and npmjs.com links are public-npm only.

Verification

bun run build   # clean
bun run lint    # clean
bun test        # 6895 pass, 0 fail
bunx playwright test --project=e2e runtime-dependencies   # 8 passed

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.

…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.
Comment thread server/handlers/cms/__tests__/registry.test.ts Fixed
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants