Test compatibility of CO2.js in with other js runtimes
mrchrisadams opened this issue · comments
One of the goals we had for CO2.js, and one of the reasons we invested a bunch of time in making it work as a hybrid library was to support a wide number of runtimes.
We currently support the nodejs runtime, and most modern browsers, but there are other runtimes that use javascript too.
Some examples below:
- Appscript - Google has some limited support for javascript in Google apps like Google Sheets. There are existing patterns and guides for using code from npm inside appscripts
- Bun should be compatible, and is an growing alternative to nodejs, that has a few nice features, like being fast to start, and having built in sqlite support
- Deno, Elsa are both both runtime for server-side javascript, and can create self-contained compiled binaries that remove the need to have a javascript runtime installed at all.
- Mongodb uses the same underlying javascript engine as Firefox, Spidermonkey. So, presumably these kinds of calcs could be executed in Mongodb itself, a little bit like how some folks like Crunchydata do Machine Learning inside Postgres . I'm very much out of my depth here though, and haven't used Mongodb in years, so I have no idea how complicated running your own js in Mongodb is.
Re: Deno - They are planning to have more seamless NPM & Node interoperability in the next couple of months.
https://deno.com/blog/changes#compatibility-with-node-and-npm
Untested yet, but we should be good in Deno as of 1.28
This will be good to eventually have documented on the docs site, but we'll keep a rolling list here for now.
- Deno
- Elsa
- Bun
- Appscript
- Cloudflare Workers
Here's a working demo in Deno:
https://github.com/fershad/co2js-deno-demo
Here's a working demo in Bun
https://github.com/fershad/co2js-bun-demo