Add support for the Bun and pnpm package managers.
Description
Mirroring a similar contribution to shadow-cljs.
- Issue: https://github.com/thheller/shadow-cljs/issues/1196
- Pull Request: https://github.com/thheller/shadow-cljs/pull/1193
See the shadow-cljs issue for a more detailed "why".
This also adds support for node_modules indexing with the Bun runtime.
Testing
I've avoided adding additional tests in src/test/clojure/cljs/foreign/node_test.clj for the time being since I'm not sure how the ClojureScript CI environment is configured (not sure if Bun and pnpm are available).
Instead, I created a test repository with a barebones CLJS project using the fork (sourced in deps.edn with the git procurer).
https://github.com/commiterate/test-clojurescript-bun
This repository uses Emmy to create a Node.js application that just prints 21 (using Emmy's exp2 function) to stdout.
A reproducible shell is provided with Nix for additional testing by the ClojureScript team and others.
There's notes in the test repository's readme detailing some sharp edges with:
- Using the ClojureScript compiler build API with
tools.build(classpath issues breakingdeps.cljssearches). - Using the ClojureScript compiler CLI.
These might be of interest to the ClojureScript team for future improvements.