fix(install): install binaries for packages installed multiple times

Merged
DY
2y ago
+1209-867

What does this PR do?

Currently bun will link binaries for a package only once. This change will link binaries for each copy of the package.

Other changes in this pr:

  • Links binaries in alphabetical order per node_modules/.bin folder for determinism.
  • Skips linking binaries when the target does not exist
  • removes usages of getFdPath in bin linking code. absolute paths are used (relative path is still used for link target)
  • cleans up .bunx and .exe files when unlinking on windows
  • normalizes shebang line ending

fixes #11799
fixes #12113
fixes #1125
fixes #2516

How did you verify your code works?

added a test