cherry
cherry copied to clipboard
Experimental ClojureScript to ES6 module compiler
When cherry.embed/compile-string is called within HTML ``` import {compile_string} from "./out/main.js"; console.log(compile_string('(require ["A"]) (equire ["A"])')) ``` `main.js` being a CLJS advanced Shadow compiled ES6 module, the output on the console...
``` (ns test.utils) ``` ``` (ns test.cherry-test (:require [test.utils :as t-utils])) ``` ``` $ npx cherry compile test/cherry_test.cljs ``` ``` file:///Users/alex/code/cherry-test/node_modules/cherry-cljs/lib/compiler.js:188 qy=function(a){a=$APP.z(a);var b=$APP.A(a);a=$APP.C(a);var c=$APP.ah(a);a=$APP.Qe.g(c,$APP.py);var d=$APP.Qe.g(c,$APP.qs);c=b.split("$",2);b=$APP.D.l(c,0,null);c=$APP.D.l(c,1,null);c=$APP.z($APP.q(c)?c.split("."):null);var e=$APP.A(c);$APP.C(c);c=$APP.v.h($APP.q($APP.q(d)?$APP.Sd.g("default",e):d)?Ox(nr.l?nr.l("import %s from '%s'",d,b):nr.call(null,"import %s...
See https://github.com/clojure/clojurescript/blob/b7ede4bce3e273ab85155fdd8463c291a6f81d43/src/main/clojure/cljs/core.cljc#L2676C1-L2703C17 This will be a better way of emitting JS object literals than relying on metadata for users Similarly `array`: https://github.com/clojure/clojurescript/blob/b7ede4bce3e273ab85155fdd8463c291a6f81d43/src/main/clojure/cljs/core.cljc#L2592