Skip to content

Conversation

@outslept
Copy link
Contributor

@outslept outslept commented Aug 8, 2025

I believe we should follow this to an extent https://nodejs.org/api/modules.html#all-together

This currently is a simplified subset for dependency graph analysis. We build an index of package.json files and resolve each dep by climbing parent directories to node_modules/<dep>/package.json. We do not implement package exports/imports, file/directory/index fallbacks, core modules, NODE_PATH/global folders, or proper realpath-based resolution; for symlinks we add a name-based alias. There may still be edge cases, but this should be more reliable and standardized than the previous two-pass approach. Drafting this to gather feedback.

UPD: I'll prepare a PR on the side to improve coverage. This should help to test this properly

UPD: https://github.com/npm/cli/tree/latest/workspaces/arborist - this is how npm handles same sort of operations. Way too smart for our case, but I'll see if we can adapt algo from there to our case and perhaps introduce a simple file cache

@pkg-pr-new
Copy link

pkg-pr-new bot commented Aug 8, 2025

Open in StackBlitz

npm i https://pkg.pr.new/e18e/cli/@e18e/cli@66

commit: 4b62acc

Seems fundamentally broken. Need to research how node/other projects resolve this. As mine is bad as well.
I honestly can't believe this is running so dang fast. But yeah.. I need to ensure the accuracy tho..
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.

1 participant