volta icon indicating copy to clipboard operation
volta copied to clipboard

Can we add support for Bun?

Open westtrade opened this issue 2 years ago • 24 comments

Bun is a drop in replacement for nodejs and it have dramatically reducing startup times and memory usage

https://bun.sh/

westtrade avatar Mar 19 '23 14:03 westtrade

Yeah I also think that would be an excellent idea, and I need it :)

t-ricci-digit avatar Mar 30 '23 14:03 t-ricci-digit

Hi @westtrade, that's definitely an interesting idea! If bun truly works as a drop-in replacement for Node, that could work well. We've avoided supporting Deno in the past since it doesn't fit the same use-cases as Node.

We likely will need an RFC to work out the design, since a lot of the assumptions in the code right now are around Node being the base of the platform.

charlespierce avatar Apr 19 '23 19:04 charlespierce

It's not quite mature enough imo. Needs a bit more api compliance and issues checked off.

ST33LDI9ITAL avatar Apr 24 '23 13:04 ST33LDI9ITAL

That sure seems promising & I was disappointed to see the lack of support. Then I realized bun doesn't support windows... Are there any other all-in-one toolkits for both JS & TS designed as a drop-in replacement for Node.js? That also makes the same promises such as "Instead of 1,000 node_modules for development, you only need bun"?

DerekZiemba avatar Aug 29 '23 18:08 DerekZiemba

@DerekZiemba Bun should have Windows support very soon according to its creator on X.

worldofgeese avatar Sep 03 '23 17:09 worldofgeese

Bun hit 1.0 - it's time :)

HazAT avatar Sep 09 '23 07:09 HazAT

@HazAT not quite. We're still waiting on this to merge.

worldofgeese avatar Sep 09 '23 08:09 worldofgeese

@HazAT not quite. We're still waiting on this to merge.

Why would Volta supporting Bun require Windows support?

niklas-paro avatar Sep 11 '23 08:09 niklas-paro

@HazAT not quite. We're still waiting on this to merge.

Why would Volta supporting Bun require Windows support?

To be consistent, imo.

Volta is marketed as cross-platform and should behave similarly on each platform that it is available on. If someone were to pin Bun@1 on MacOS, and a developer on Windows tried to use that repository - it wouldn't work.

I'm on Mac, and definitely want Bun support, but only if Volta remains seemlessly uncomplicated and non problematic across operating systems for what it supports. That's what users have come to expect today.

jstrese avatar Sep 11 '23 14:09 jstrese

Bun has shipped with Windows Experimental support

t-ricci-digit avatar Sep 15 '23 15:09 t-ricci-digit

@HazAT not quite. We're still https://github.com/oven-sh/bun/pull/4410

now it's merged

BitOfUniverse avatar Nov 27 '23 09:11 BitOfUniverse

As @charlespierce notes: this is not a straightforward “just do x” kind of design. I would love to see it implemented, but it probably needs an RFC, to answer questions like:

  • Does Volta support pinning Bun versions the same as it does Node versions, i.e. as a runtime?
  • Does Volta support pinning Bun versions the same as it does npm, yarn, and (kind of!) pnpm versions, i.e. as a package manager?
  • If both, how do those two relate?
  • If it supports pinning Bun as a runtime, should that also extend to pinning Deno as a runtime?

I think all of those are answerable, but they are also not obvious! Additionally, even an answer like “supports pinning Bun only as a package manager (at least for now)” needs to make sure it makes sure not to close off adding support for it as a runtime later—or explicitly chooses to permanently close off that support barring a significant breaking change!

We would welcome that RFC, but hopefully that clarifies why this one needs some design work!

chriskrycho avatar Nov 27 '23 16:11 chriskrycho

I am sorry if I am being naive, but

If I can pin Bun as a package manager, the runtime would be automatically available through the bun binary/symlink/shim. I would simply not pin Node.js in this case. And, since nothing in my dev scripts would be invoking node (they'd be invoking bun), it should work.

Am I wrong?

felipecrs avatar Nov 27 '23 16:11 felipecrs

That would almost work, and likely could be made to work! (I’ll elaborate on the gap even there below.)

The first and most important problem, though, is not that feature itself, but how it interacts with what it means to support pinning Bun as a package manager without pinning it as a runtime. If we just add support for pinning it as a package manager now, and then want to add support for it as a runtime later, if we are not careful about the design up front we could easily find ourselves backed into a corner and have to make a breaking change, which we would very much prefer to avoid.

The “almost” part is this: right now Volta assumes a fair number of things about how everything works and uses Node explicitly. We were not thinking about alternative runtimes when we built it! As a result, you actually cannot pin a version of npm, Yarn, or pnpm today unless you pin a Node version. That could be changed, but it is not “trivial”.

chriskrycho avatar Nov 27 '23 16:11 chriskrycho

Bun has release version 1.1, with windows support. So now it could be integrated to Volta?

manudss avatar Apr 03 '24 21:04 manudss

Speaking of which, they released their new bunx shim, which can also be used to fix https://github.com/volta-cli/volta/issues/579 and https://github.com/volta-cli/volta/issues/579.

felipecrs avatar Apr 03 '24 22:04 felipecrs