mirror of https://github.com/logseq/logseq
Convert roam namespaces to cljs
The clj functionality was only for tests and those tests no longer exist for clj. Also removed unused dependencypull/5192/head
parent
823b8ec39e
commit
ca9cc2454f
1
deps.edn
1
deps.edn
|
@ -1,7 +1,6 @@
|
||||||
{:paths ["src/main" "src/electron" "src/workspaces" "templates"]
|
{:paths ["src/main" "src/electron" "src/workspaces" "templates"]
|
||||||
:deps
|
:deps
|
||||||
{org.clojure/clojure {:mvn/version "1.10.0"}
|
{org.clojure/clojure {:mvn/version "1.10.0"}
|
||||||
cheshire/cheshire {:mvn/version "5.10.0"}
|
|
||||||
rum/rum {:mvn/version "0.12.9"}
|
rum/rum {:mvn/version "0.12.9"}
|
||||||
datascript/datascript {:mvn/version "1.3.8"}
|
datascript/datascript {:mvn/version "1.3.8"}
|
||||||
datascript-transit/datascript-transit {:mvn/version "0.3.0"}
|
datascript-transit/datascript-transit {:mvn/version "0.3.0"}
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
(ns frontend.external
|
(ns frontend.external
|
||||||
;; Wonky cljs detection
|
|
||||||
#_:clj-kondo/ignore
|
|
||||||
(:require [frontend.external.roam :refer [->Roam]]
|
(:require [frontend.external.roam :refer [->Roam]]
|
||||||
[frontend.external.protocol :as protocol]))
|
[frontend.external.protocol :as protocol]))
|
||||||
|
|
|
@ -1,12 +1,6 @@
|
||||||
(ns frontend.external.roam
|
(ns frontend.external.roam
|
||||||
;; TODO: Convert this ns and upstream dependents to .cljs. .clj was only for tests
|
(:require [cljs-bean.core :as bean]
|
||||||
;; and those tests have been removed
|
|
||||||
(:require #?(:cljs [cljs-bean.core :as bean]
|
|
||||||
:clj [cheshire.core :as json])
|
|
||||||
;; TODO: clj-kondo incorrectly thinks these requires are unused
|
|
||||||
#_:clj-kondo/ignore
|
|
||||||
[frontend.external.protocol :as protocol]
|
[frontend.external.protocol :as protocol]
|
||||||
#_:clj-kondo/ignore
|
|
||||||
[frontend.date :as date]
|
[frontend.date :as date]
|
||||||
[medley.core :as medley]
|
[medley.core :as medley]
|
||||||
[clojure.walk :as walk]
|
[clojure.walk :as walk]
|
||||||
|
@ -42,12 +36,8 @@
|
||||||
(defn macro-transform
|
(defn macro-transform
|
||||||
[text]
|
[text]
|
||||||
(string/replace text macro-pattern (fn [[original text]]
|
(string/replace text macro-pattern (fn [[original text]]
|
||||||
;; Disable clj warning since clj is unused
|
|
||||||
#_:clj-kondo/ignore
|
|
||||||
(let [[name arg] (gp-util/split-first ":" text)]
|
(let [[name arg] (gp-util/split-first ":" text)]
|
||||||
(if name
|
(if name
|
||||||
;; TODO: Why unresolved var
|
|
||||||
#_:clj-kondo/ignore
|
|
||||||
(let [name (text/page-ref-un-brackets! name)]
|
(let [name (text/page-ref-un-brackets! name)]
|
||||||
(util/format "{{%s %s}}" name arg))
|
(util/format "{{%s %s}}" name arg))
|
||||||
original)))))
|
original)))))
|
||||||
|
@ -109,11 +99,8 @@
|
||||||
|
|
||||||
(defn json->edn
|
(defn json->edn
|
||||||
[raw-string]
|
[raw-string]
|
||||||
#?(:cljs (-> raw-string js/JSON.parse bean/->clj)
|
(-> raw-string js/JSON.parse bean/->clj))
|
||||||
:clj (-> raw-string json/parse-string clojure.walk/keywordize-keys)))
|
|
||||||
|
|
||||||
#?(:cljs
|
|
||||||
(do
|
|
||||||
(defn ->file
|
(defn ->file
|
||||||
[page-data]
|
[page-data]
|
||||||
(let [{:keys [create-time title children edit-time]} page-data
|
(let [{:keys [create-time title children edit-time]} page-data
|
||||||
|
@ -150,7 +137,7 @@
|
||||||
(defrecord Roam []
|
(defrecord Roam []
|
||||||
protocol/External
|
protocol/External
|
||||||
(toMarkdownFiles [_this content _config]
|
(toMarkdownFiles [_this content _config]
|
||||||
(-> content json->edn ->files)))))
|
(-> content json->edn ->files)))
|
||||||
|
|
||||||
(comment
|
(comment
|
||||||
(defonce test-roam-json (frontend.db/get-file "same.json"))
|
(defonce test-roam-json (frontend.db/get-file "same.json"))
|
Loading…
Reference in New Issue