-
This is the runtime pocketbase uses to allow javascript interop.
Pocketbase is the framework that makes me want to switch to golang. It just makes a lot of sense.
One thing that concerned me, though. How do I debug goja? It doesn't seem like I can set breakpoints as usual.
https://pocketbase.io/
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
-
I work on the D2 project ([0]) and we switched from other Javascript runners (v8go) to Goja. Using a JS runtime with a dependency on cgo means your Go program loses the (huge) benefit of cross-compiling to different architectures, since at build time it gets linked to the architecture-specific libc.
If you're interested in some production code with Goja, this is our code for calling RoughJS [1] from Go in order to produce the hand-drawn diagram look: [2]
[0] https://github.com/terrastruct/d2
-
-
I've been a pretty happy Otto[1] user for a number of years now.
The article makes no comparisons seemingly? I'm curious if there'd be any reason to switch.
https://github.com/robertkrimen/otto
-
I just dug through a lot of the issues and PRs in Goja, and eventually found that the grafana/k6 team recently forked Goja as Sobek [1], because the Goja dev has not been able to dedicate sufficient time to their PRs - namely ES Modules support [2], which was one of the only modern JS features outstanding [3]
So, Sobek seems to be the way forward...
[1] https://github.com/grafana/sobek/)
-
-
replicator
replicator is a toolkit for ingesting logical replication feeds into a CockroachDB cluster
I've been using goja in a logical replication tool to make it field-programmable by the end users. No two deployments look alike, so a great deal of flexibility is needed for ETL uses. There's a tendency for configuration languages to become Turing-complete, so we started with a Turing-complete language for configuration.
JS, or in Replicator's case, TypeScript (shout-out to esbuild), is sufficiently well-known that any dev group will have some experience with it. On the whole, I've been very impressed with how straightforward it's been to have user-scripts integrated into the processing pipeline.
https://github.com/cockroachdb/replicator/wiki/User-Scripts
-
-
While I'm sure Goja is great for just JavaScript, using something like wazero allows your app to support more languages (anything that compiles to WASM) while keeping the benefits of CGO.
https://wazero.io/
I've used Wazero myself on C++ -> WASM code but I'm sure you could use Emscripten or something to compile JavaScript to WASM.