diff --git a/.clj-kondo/config.edn b/.clj-kondo/config.edn index f5321b2f6..a2bc5ee81 100644 --- a/.clj-kondo/config.edn +++ b/.clj-kondo/config.edn @@ -17,6 +17,7 @@ {app.common.data.macros/export hooks.export/export potok.core/reify hooks.export/potok-reify app.util.services/defmethod hooks.export/service-defmethod + app.common.record/defrecord hooks.export/penpot-defrecord }} :output diff --git a/.clj-kondo/hooks/export.clj b/.clj-kondo/hooks/export.clj index f59bd669e..9486ed67c 100644 --- a/.clj-kondo/hooks/export.clj +++ b/.clj-kondo/hooks/export.clj @@ -39,6 +39,29 @@ other))] {:node result}))) + +(defn penpot-defrecord + [{:keys [:node]}] + (let [[rnode rtype rparams & other] (:children node) + + nodes [(api/token-node (symbol "do")) + (api/list-node + (into [(api/token-node (symbol (name (:value rnode)))) rtype rparams] other)) + (api/list-node + [(api/token-node (symbol "defn")) + (api/token-node (symbol (str "pos->" (:string-value rtype)))) + (api/vector-node + (->> (:children rparams) + (mapv (fn [t] + (api/token-node (symbol (str "_" (:string-value t)))))))) + (api/token-node nil)])] + + result (api/list-node nodes)] + + ;; (prn "=====>" (into {} rparams)) + ;; (prn (api/sexpr result)) + {:node result})) + (defn clojure-specify [{:keys [:node]}] (let [[rnode rtype & other] (:children node) @@ -48,7 +71,6 @@ other))] {:node result})) - (defn service-defmethod [{:keys [:node]}] (let [[rnode rtype ?meta & other] (:children node)