by ushakov · 3y ago · 0 comments
* Written Zig, an unstable programming language
* Segfaults and crashes are common
* Doesn’t work on windows (edit: fixed in v1)
* The web-server is based on uWS, a third-party dependency maintained by one person
* Vendor-specific APIs like Bun.serve, Bun.file, etc. You can call Node APIs in Bun, but you cannot call Bun APIs in Node
* Tries to be everything at once: a bundler, a compiler, a package manager, a runtime, a testing framework, etc.
* A VC-baked effort. If the funds run dry there is no Bun anymoreThis is confusingly worded, and I didn't understand what you were trying to say before I watched the video announcement.
"Bun" is a runtime, "JS" is a language that's implemented by multiple runtimes (including Bun, npm, and browsers). It makes no sense to say "you can't call the Bun APIs in JS" because calling them in JS is the only way to do it in the first place.
What you seem to mean is "you can't call Bun APIs from other runtimes" which is... kind of obvious? And also kind of an empty complaint, since Bun is primarily an npm replacement, and npm does the same thing[1]
What does this mean? Every JS runtime (node, deno, bun etc.) has its own set of APIs and they are generally not cross-compatible. The code for all the Bun APIs is open source so I'm not sure what makes them proprietary.
> You can call JS in Bun, but you cannot call Bun APIs in JS
Bad use of terminology. JS is the language, JavaScript/ECMAScript, and every JS runtime (node, bun, deno etc.) is using it. So you definitely can call Bun APIs in JS.
if (typeof Bun === "undefined") {
// Node.js code
} else {
// Bun code
}
If you are writing a lot of Bun-specific code, yeah that will only work on Bun ofc. But I like that now I can add some small snippets of bun-optimized code in my libraries.Otherwise, normally you'd use ESM APIs > Node.js APIs > Bun APIs, like if you are hashing something, right?