Bare: Run JavaScript Everywhere
pears.com
pears.com
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?Isn't the problem always just ios for cross platform - is bare running on iOS? Can you shed some light on this?
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.
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
See previous discussion on the "dat" protocol, built on top of the aforementioned (https://news.ycombinator.com/item?id=22909998).
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.
As you pointed out it's hard to determine why Bare other than it isn't Node.
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.
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.
[1]: https://github.com/holepunchto/bare#architectureThis is bare https://github.com/holepunchto/bare
For 10 instances of our app, it is easily 10x10 = 100 MB of saving with Bare.