Why not just run it as is, in the Magma module?
@mikec has made it so that the two modules can run side-by-side in the latest build. And if you didn't want to run it as Magma, you can quickly update it to be ran under Fougerite's new Jint.
No need to reinvent the wheel, is there? Not sure...