fix(npm): resolve linked packages not published to npm registry#33021
Merged
bartlomieju merged 1 commit intomainfrom Mar 30, 2026
Merged
fix(npm): resolve linked packages not published to npm registry#33021bartlomieju merged 1 commit intomainfrom
bartlomieju merged 1 commit intomainfrom
Conversation
When using the "links" field in deno.json to reference a local npm package that has not been published to the npm registry, resolution would fail with "npm package does not exist" because the code always fetched package info from the registry before checking link packages. Added a fallback mechanism that creates a synthetic NpmPackageInfo from link package data when the registry returns PackageNotExists. This is applied at all registry fetch call sites in the npm resolution code. Closes #33010 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
"links"indeno.jsonreferences a local npm package that has not been published to the npm registrypackage_info_or_link_fallback()helper that falls back to creating a syntheticNpmPackageInfofrom link package data when the registry returnsPackageNotExistsapi.package_info()call sites in the npm resolution code (snapshot.rsandgraph.rs)The link package data was already being properly parsed and stored, but the resolution code always fetched from the npm registry first. For unpublished packages, this failed before link packages were ever consulted.
Closes #33010
Test plan
libs/npm/resolution/graph.rs:link_package_not_on_registry(transitive dep) andlink_package_not_on_registry_as_root(root req)tests/specs/npm/link_npm_package_not_on_registry/link_npm_package_*spec tests pass (7/7)deno_npmcrate tests pass (179/179)🤖 Generated with Claude Code