It seems that Bare is also built on top of V8 and libuv, much like Node.js.
Bare is built on top of https://github.com/holepunchto/libjs, which provides low-level bindings to V8 in an engine independent manner, and https://github.com/libuv/libuv, which provides an asynchronous I/O event loop. (from their README)
Moreover, you actually need Node.js and npm to install and run it. You need another JavaScript runtime as a prerequisite to install this JavaScript runtime…
npm i -g bare (also from their README)
I don't get it – is it worth it to choose Bare over a more established and welly-maintained solution?
npm allows for simple distribution of the prebuilt binaries, but is by no means a requirement and neither is Node.js. It's just a convenient way to ship things; npm is an excellent package manager!
The marketing website is so confusing, and the name doesn't help.
There is nothing that node can't do in the few presented bullet points, so really I'm confused. Maybe it's the size of the runtime?
The point of Bare isn't to do what Node.js already does. If that had been the case we'd just have continued using Node.js. The point of Bare is that on its own it can't really do anything. To do actually useful stuff, you have to resort to userland modules and those can evolve independently of Bare itself. Contrast that with the Node.js standard library which is tied to a particular version of Node.js and brings with it tons of legacy that's still there for the sake of backwards compatibility. Bare has none of that, not just because it's newer but because it ships with nothing but a handful of solid fundamentals that we don't expect will evolve much, if at all.
As someone who isn't well versed in this Node ecosystem, why is omitting a standard library a separate project? It sounds like something you'd do as a Node feature, or variant of Node, or some command line switch or env var or whatever else is needed to avoid whatever it is you are trying to avoid.
There's no way to not bring along the entire Node.js standard library when you're using Node.js. It also doesn't provide a way to fully abstract over the underlying JavaScript engine, which Bare needs to be able to support swapping out the underlying JavaScript engine without any code changes. See https://news.ycombinator.com/item?id=43559532 for more on that.
Same. The "runs on mobile" part I assume is Android only? How do I develop something for iOS that uses Bear? Seems like a limitation they wouldn't be able to lift but maybe I'm missing something
Update: from home page
> Built for Mobile
> Embedding a JavaScript runtime on mobile is easy with Bare Kit. Bare Kit allows you to create "worklets" or isolated Bare threads which expose an IPC with bindings for Android and iOS. With React Native, you install `react-native-bare-kit` and create a `Worklet` instance passing the JavaScript you want to run.
Bare supports both iOS and Android, yes. Bare Kit provides some convenient abstractions for integrating Bare with native application frameworks like Swift UI and the Android service architecture, but plain Bare runs just fine on iOS and Android out of the box. There's even prebuilt binaries for both platforms.
Bare runs on iOS, yes. The tricky part with iOS in particular is loading of native addons. Bare solves this through https://github.com/holepunchto/bare-link which is capable of generating XCFrameworks on-demand that can then be linked with and signed as part of the application bundle.
Some background context that might be useful for other readers wondering what they're looking at:
1. One of the core contributors on this is an individual who has essentially been the driving force for P2P applications in JS-land (the "hyper" stack, like hyperswarm and hyperdrive). See: https://github.com/mafintosh
2. To that end, the target userbase is something like an "It-Just-Works P2P Developer". You want a cross-platform solution that allows you to host networked applications on your device, in JS.
I'm not very knowledgeable about this domain. I built a small "dat" application years ago.
What does this offer as an alternative to node? I’m looking at the supported platforms page and the list is essentially the same as the node ones… does it have a wasm target? An embedded target? What’s new here?
Bare itself only adds a few missing pieces on top to support a wider ecosystem of modules:
1. A module system supporting both CJS and ESM with bidirectional interoperability between the two.
2. A native addon system supporting both statically and dynamically linked addons.
3. Light-weight thread support with synchronous joins and shared array buffer support.
Everything else if left to userland modules to implement using these primitives, keeping the runtime itself succinct and bare.
There is nothing stopping node from running on mobile and IIRC quite a few apps embed it as a part of electron or similar frameworks.
If i understand correctly bare can instead use much smaller engines like quickjs (and maybe libjs), but I'm not sure how the stdlib situation is for those.