This repository was archived by the owner on Jan 2, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 7 files changed +46
-15
lines changed Expand file tree Collapse file tree 7 files changed +46
-15
lines changed Original file line number Diff line number Diff line change 1- {:paths [" src" ]
1+ {:paths [" src" " resources " ]
22 :tasks {test {:doc " Run tests"
33 :task (clojure " -M:cljs:test" )}}}
Original file line number Diff line number Diff line change 1+ (ns no-core-vars )
2+
3+ ; ; The expectation is that when bundling this, it will only be a couple of bytes.
4+
5+ (defn foo []
6+ [])
7+
8+ (js/console.log (str (foo )))
Original file line number Diff line number Diff line change 1+ import { vector , str } from 'cherry-cljs/cljs.core.js'
2+
3+ function foo ( ) {
4+ return ( function ( ) {
5+ return vector ( ) ;
6+ } ) ( ) ;
7+ } ;
8+ console . log ( str ( foo ( ) ) ) ;
Original file line number Diff line number Diff line change 1- {:deps {borkdude/edamame {:mvn/version " 1.0.0" }}
1+ {:paths [" src" " resources" ]
2+ :deps {borkdude/edamame {:mvn/version " 1.0.0" }
3+ babashka/process {:mvn/version " 0.1.7" }
4+ }
25 :aliases
36 {:cljs {:extra-deps {thheller/shadow-cljs {:mvn/version " 2.19.6" }}}
47 :test ; ; added by neil
Original file line number Diff line number Diff line change 1+ {:vars #{map assoc str keyword symbol
2+ dissoc conj vector clj->js js->clj get
3+ hash-map array-map first rest next nth seq}
4+ :to-js {clj->js toJs
5+ js->cljs toCljs
6+ hash-map hashMap
7+ array-map arrayMap}}
Original file line number Diff line number Diff line change 2727(ns #^{:author " Allen Rohner"
2828 :doc " A library for generating javascript from Clojure." }
2929 cherry.transpiler
30- (:require [clojure.string :as str]
31- [com.reasonr.string :as rstr]
32- [edamame.core :as e])
33- (:use clojure.walk))
30+ (:require
31+ [clojure.edn :as edn]
32+ [clojure.java.io :as io]
33+ [clojure.string :as str]
34+ [clojure.walk :as walk]
35+ [com.reasonr.string :as rstr]
36+ [edamame.core :as e]))
3437
3538(defn- throwf [& message]
3639 (throw (Exception. (apply format message))))
98101 '? 'try 'break
99102 'await 'const 'defn 'let 'ns 'def]))
100103
101- (def core-vars (set '[map assoc str keyword symbol
102- dissoc conj vector clj->js js->clj get
103- hash-map array-map first rest next nth seq]))
104+ (def core-config (edn/read-string (slurp (io/resource " cherry/cljs.core.edn" ))))
104105
105- (def core->js '{clj->js toJs
106- js->cljs toCljs
107- hash-map hashMap
108- array-map arrayMap})
106+ (def core-vars (:vars core-config))
107+
108+ (def core->js (:to-js core-config))
109+
110+ (prn core->js)
109111
110112(def prefix-unary-operators (set ['!]))
111113
437439(defn- inner-walk [form]
438440 (cond
439441 (unquote? form) (handle-unquote form)
440- :else (walk inner-walk outer-walk form)))
442+ :else (walk/walk inner-walk outer-walk form)))
441443
442444(defn- outer-walk [form]
443445 (cond
446448 :else form))
447449
448450(defmacro quasiquote [form]
449- (let [post-form (walk inner-walk outer-walk form)]
451+ (let [post-form (walk/walk inner-walk outer-walk form)]
450452 post-form))
451453
452454(defmacro js*
Original file line number Diff line number Diff line change 22 '[cherry.transpiler :as cherry]
33 )
44
5+ (when-not (System/getProperty " babashka.version" )
6+ (require '[babashka.process.pprint]))
7+
58(def in-file (first *command-line-args*))
69(def out-file (:out-file (cherry/transpile-file {:in-file in-file})))
710
You can’t perform that action at this time.
0 commit comments