Announcing Eucalypt! π
This is the story of how I replaced React & Reagent with 720 lines of slop-coded Squint-cljs and got a 10kb build size. πΉ
- I wanted to enter the js13k game jam.
- I wanted to use "ClojureScript".
- I wanted to use "Reagent".
Is there some way I could build a <13kb artifact to satisfy the rules with these constraints? It seemed impossible.
Solution: I forked Mr Clean and slop-coded it into compiling with Squint.
Outcome: Eucalypt is a Reagent-compatible-ish Squint-cljs library for building frontends with tiny (~10kb) artifacts.
Demos: 15kb single-file HTML artifact with demos, including a port of Reagent's TODO MVC.
Tests: 90/90 Reagent-form tests pass (don't be fooled though, see below).
Try it:
npm create eucalypt myapp
cd myapp
npm install
npm run watch
npm run build
Caveats & warnings. Experimental! If you squint hard enough it looks like Reagent, but it certainly isn't. It's very much a scrappy fiddle. "Slop-coded" means this library was built by 1. creating failing test cases 2. using various LLMs to fix the code until all tests pass. I spent literally TENS of dollars on magic computer-brain credits. πΈ I did this while concentrating on other things and I haven't spent a lot of time groking the code. If this development process makes you uncomfortable (as it makes me uncomfortable) then you should probably take care when running it.
Do not be fooled by the β¨ 90/90 passing tests β¨ - it's almost certainly bug-ridden. π It's probably not for production systems, unless yeeting slop-code onto your live server is a thing at your company. It might be appropriate for small bits of frontend, demos, or gamejam entries where size is important and your particular Reagent form happens to not segfault and delete all your files. Ok, have lawyer-proofed this enough? π It's not my fault it was the magic computer brain your honour!
All that said, it's pretty fun being able to write Reagent-like code and stay under the magic 14kb TCP slow-start package size. It would be great to get some human eyeballs & brains on this and clean it up, find more failing Reagent forms, add more tests etc. PRs most welcome!
Assume the code is terrible and your fix will be appreciated. Note that the goal is not a one-to-one replacement for the whole Reagent API, but the 80% most commonly used (at the moment it's just r/atom
and r/render
and form-1 and form-2 components). I would like it to remain under-engineered and simple.
Bonus addenda: Borkdude's LLM-generated game demos:
Plot twist: I never did finish my gamejam game. π
πββοΈ