This seems to conflate the manifest/import package name with pnpm’s resolved package-source name.
pnpm documents that packages can be installed from alternate sources:
Assistant
I'll start by exploring the repository structure.
Assistant
Now let me set up the reproduction fixture while it builds.
Assistant
Now let me create the new module.
Assistant
Now wire it into the resolver.
Assistant
Now add the wrapper helper and update the NpmPackage construction sites.
Assistant
Now update the main resolve_specifier branches.
Assistant
Now let's run the broader test suite (core + cli) to check for regressions.
Assistant
All checks pass. Let me review the checklist explicitly:
Yes. I built the CLI, created the issue's fixture ( catalog with / , two workspace apps, imports of and ) plus the pnpm layout (symlinks into and ). produced exactly the reported output: unused , unlisted .
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
npm:<name>@<version> can resolve a declared dependency through a different npm package name
package sources are part of pnpm’s supported dependency model, not separate source imports
So if @std/csv is declared and imported, Fallow should credit @std/csv, even if pnpm resolves it to @jsr/std__csv internally. Same for unstorage resolving to unstorage-nightly.
Dependency usage should match against the declared/import name, not only the resolved source package name.
Fallow version
2.85.0
Operating system
macOS
Configuration
toml
Interface
No new interfaces are introduced.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work.
For example, if you made a mistake and want to revert your changes, you can use git checkout <file> to restore the file to its original state.
You can also reset all changes in the repository using git reset --hard command.
Additionally, you can use git stash and git stash pop to temporarily save your changes and restore them later.
Finally, you can see the changes that you've made (which will be submitted when you call submit) using git status or git diff commands.
However you don't need to use git add or git commit before submitting your changes. In fact,
submit only submits currently unstaged changes because it uses git diff to get the changes that need to be submitted.
CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
If an error was reported in the issue description, I have successfully reproduced it.
If an error was reported in the issue description, I have confirmed that my fix resolves the error.
I have thought about edge cases and made sure my fix handles them as well.
I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass.
I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /fallow, current file: none) bash-$
2. Confirmed my fix resolves it: Yes. After the change, both lists are empty (unresolved_imports also empty) for: the catalog form, the direct "@std/csv": "jsr:1.0.6" / "unstorage": "npm:unstorage-nightly@…" manifest form, per-app node_modules symlinks, and root-hoisted symlinks. The fix adds crates/graph/src/resolve/package_source.rs: when the package name derived from the resolved (canonicalized) node_modules path differs from the imported specifier's package name, it verifies that a node_modules/<declared-name> entry reachable from the importing file really points at that resolved package directory, and if so credits the declared name. Both names are preserved — the resolved path keeps the source name while dependency usage is credited to the declared/import name.
3. Edge cases: Handled/verified — identical names short-circuit before any filesystem work (no perf cost on the common path); relative/absolute and #/@/-style path-alias specifiers are ignored; scoped names are joined component-wise (Windows-safe); nested .pnpm store paths and plain node_modules paths both map to the right package root; an unrelated node_modules/<name> that does not point at the resolved package keeps the resolved name (no over-crediting); a tsconfig paths alias mapping react → node_modules/preact/compat behaves identically before and after the change (verified against a pristine build); projects without node_modules are unaffected; workspace/internal-module resolution paths are untouched.
4. Ran existing tests: Yes. cargo test --workspace --all-targets --no-fail-fast, cargo clippy --workspace --all-targets, and cargo fmt --check all pass, except fix_batch_aborts_when_a_target_directory_is_read_only, which I verified also fails on the pristine tree (it runs as root, so read-only dirs don't block writes), and one flaky resolves_yarn_sidecar_without_node_modules_bin that passes in isolation and is unrelated to this change.