~bptato/monoucha

High level QuickJS wrapper in Nim
Version 0.9.1
fromjs: add type information to JSArrayBufferView + some bindings
test: update results

clone

read-only
https://git.sr.ht/~bptato/monoucha
read/write
git@git.sr.ht:~bptato/monoucha

You can also use your local clone with git send-email.

#Monoucha: seamless Nim-QuickJS integration

Monoucha is a wrapper library to simplify the process of embedding the QuickJS-NG JavaScript engine into Nim programs.

#Quick start

Include Monoucha in your project using either Nimble or as a git submodule.

requires "monoucha"

Then,

  • There is a manual. Please read the manual.
  • Examples from the manual, organized as unit tests.

#Warning

At the time of writing, Monoucha only works with refc. This means you have to put the following in your nim.cfg:

--mm:refc

If you do not do this, you will be rewarded with strange crashes as your program grows.

#Dependencies

monoucha depends on the nim-results library.

QuickJS-NG is already included in this repository; you do not need to install it separately.

#Q&A

  • Cool, so how do I use this thing?

I'm working on a manual. Please read the manual.

  • I'm getting weird memory errors?

You did not read the above instructions, you have to set --mm:refc.

Monoucha does not (and never did) work with ORC, or other memory managers for that matter. You must use refc.

(If you are still experiencing issues, please open a ticket here and I'll look into it.)

  • I already have QuickJS-NG, why are you not linking to my system library?

Monoucha does not actually use stock QuickJS-NG, but a fork that tracks upstream.

This fork includes some GC modifications necessary for the synchronization of the Nim and QuickJS runtimes.

  • Can I compile Nim to JS and execute Nim from Nim?

Possibilities are endless, but this looks like a better solution.

  • Can I use Monoucha with [insert JS engine] instead of QuickJS?

No. Feel free to fork and adapt it to whatever engine you want, but here we only support QuickJS.

  • What is a monoucha?

A kind of tea, from the town once called Monou. You pronounce it as mo-no-u-cha.

Yes, it's a pun.

#License

QuickJS was written by Fabrice Bellard and Charlie Gordon, and is maintained as QuickJS-NG by Ben Noordhuis and Saúl Ibarra Corretgé.

QuickJS-NG is distributed in this repository under the terms of the MIT license. See the monoucha/qjs/LICENSE file for details.

Monoucha is released into the public domain. See the UNLICENSE file for details.

Do not follow this link