This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-12-02
Channels
- # adventofcode (97)
- # announcements (11)
- # babashka (18)
- # beginners (34)
- # biff (5)
- # cljfx (5)
- # clojure-europe (4)
- # clojure-uk (2)
- # clojurescript (7)
- # community-development (2)
- # hyperfiddle (8)
- # introduce-yourself (1)
- # music (2)
- # off-topic (2)
- # polylith (3)
- # practicalli (1)
- # releases (1)
- # shadow-cljs (28)
- # squint (1)
Once, I complained that things like Solid.JS with ClojureScript might be close to impossible, because ClojureScript is "outside" the way JS works (with Babel, bundlers, etc). I decided to explore if I could make some elaborate hack to support at least Babel. And... here it is: I called it Babble https://gitlab.com/mauricioszabo/babble. It does have some very primitive support for SolidJS, now I have to battle-test in a real... something. Not sure yet what I will build 😄
This seems cool. Just to clarify, you are working on your own compiler tool like Babel that can do similar things like solidjs (or svelte?) does where it compiles your own custom built features written in cljs (like your version of signals or jsx or whatever) into javascript? so at a lower level than something like a solidjs wrapper (https://github.com/roman01la/solid-cljs and others mentioned here: https://www.reddit.com/r/Clojure/comments/10ywila/clojurescript_bindings_to_solidjs/) so that those bindings wouldn't be needed, you could just build out the cljs version of solidjs yourself?
I think your readme means to say "Like Babel, but for ClojureScript" instead of reiterating the "Babbel" name
Nice hack :) For anyone looking for alternatives, solid-js is pretty easy with #squint and #cherry since they can transform to jsx: https://github.com/squint-cljs/squint/blob/main/examples/solid-js/src/App.cljs
@U3Y18N0UC Perhaps it's worth exploring to use GraalVM Polyglot, they support JS too. Don't know how Node specific the babel stuff is that you're using but if it can run in GraalJS, might be worth trying
So, @U9J50BY4C - it's literally Babel - I'm not working in a different compiler. The trick is to run Babel while we're in Java-land, and to make it work correctly while we need to interpolate ClojureScript variables, and to work in string fragments instead of full files.
And yes, Babel is very node-specific - it uses require and NPM stuff and resolves that in runtime, so I indeed need node - only GraalJS won't work (but I found a different lib that works and is maintained too)
I'm going to add support in squint for compiling jsx straight to react calls too since that would be better for the browser REPL
Yes, I basically did the hack because I use a lot the Shadow-CLJS "hot reload" and the REPL. There are other solutions to fix this problem with Babel - like generating a JSX "by hand", compile the project via Shadow with the ESM target, and then run babel on top of it - maybe even add a Shadow-CLJS hook for it. With the hook, it almost worked - but I lost the hot-reload because Shadow sends the JSX, pre-babel version to the browser (I need to refresh the page to actually work).