-
Notifications
You must be signed in to change notification settings - Fork 17
Description
#101 has me seeing again that pnpm and other alternative package managers are apparently creating node_modules trees that Node.js import and require find acceptable, but that our "find all the packages in node_modules" package, Arborist, a component of npm, handles differently.
I don't know exactly what those differences are. I believe all the current frontrunners—npm, pnpm, yarn, bun—now extensively use symlinks to cached copies of packages. But I haven't seen or done a comparative study of how the trees they create differ.
I wonder how difficult it would be to re-implement just the recursive descent of node_modules that we need, independent of Arborist. At the same time, I've learned enough to suspect that's likely far more nuanced than it appears:
- We would still need to differentiate production and development dependencies.
- Especially with symlinks galore, we'd need to detect cycles.
- npm and Arborist support Windows, Mac, and Linux. We'd need to be attuned to what
node:fsdoes and doesn't abstract there. - This is fundamentally a filesystem task, and filesystems mean quirky edge cases galore.