r/Clojure • u/Borkdude • Aug 18 '22
ClavaScript: a ClojureScript syntax to JS compiler
Introducing ClavaScript, a ClojureScript syntax to JavaScript compiler!
The primary use case for clava (its short name, not to be confused with Calva) is to produce JavaScript using ClojureScript syntax while producing ultra-small bundle sizes, by leveraging the JS platform directly. Clava does not protect you from the pitfalls of JS (mutability, equality), but lets you use the concepts you already know from ClojureScript and maps them more or less directly to JS where this makes sense. It comes with a standard library which has many of the core functions you know: map-indexed , for example, works like you would expect, but returns a mutable JS array instead of an immutable vector.
Repo: https://github.com/clavascript/clavascript
Npm: npm install clavascript
Read Differences with ClojureScript for... well, the differences with ClojureScript.
It has support for async/await and JSX.
Clava is open to contribution, especially in the area of porting core functions.
An example of a SolidJS app written using Clava:
https://clavascript.github.io/demos/clava/solidjs/ (source)
Give it a spin and let us know what you think.
1
u/lucywang000 Aug 20 '22
May I ask how does it compare with nbb? https://github.com/babashka/nbb