#7774·pocketbase

Feature Request - extract compilation to a interface function

Author: nathanstittCreated Jul 23, 2026Updated Jul 25, 2026

It would be nice if there was an optional ProgramSource hook to the jsvm plugin so an embedder can share compiled goja programs across multiple plugin instances

I'm exploring extending my tinycld framework that is based on pockbase to support per-org scripts.

I expect that most orgs will use the default set of scripts and not modify them at all. It would be nice if those orgs could share a single goja.Program

I did take a stab at implementing this here: https://github.com/pocketbase/pocketbase/compare/master...nathanstitt:feat/jsvm-programsource?expand=1 as a test which seems to work well locally.

Taking this idea a bit further it would also be nice if the compile function returned an interface that was compatible with both goja and the sobek fork which supports a bit more of es6 features.

If you'd like I can work up an implementation of that as well.

Thanks for all your work on the library, it has been wonderful to work with