diff --git a/calcit.cirru b/calcit.cirru index 307194e..543ab78 100644 --- a/calcit.cirru +++ b/calcit.cirru @@ -1,6 +1,6 @@ {} (:package |app) - :configs $ {} (:init-fn |app.server/main!) (:port 6001) (:reload-fn |app.server/reload!) (:version |0.8.7) + :configs $ {} (:init-fn |app.server/main!) (:port 6001) (:reload-fn |app.server/reload!) (:version |0.8.8) :modules $ [] |lilac/ |memof/ |recollect/ |cumulo-util.calcit/ |ws-edn.calcit/ |bisection-key/ :entries $ {} :client $ {} (:init-fn |app.client/main!) (:reload-fn |app.client/reload!) @@ -18916,48 +18916,63 @@ :data $ {} |T $ %{} :Leaf (:at 1512702419617) (:by nil) (:text |md5) |j $ %{} :Leaf (:at 1512705931557) (:by nil) (:text |file-content) - |r $ %{} :Expr (:at 1512702328818) (:by nil) + |r $ %{} :Expr (:at 1695056334719) (:by |S1lNv50FW) :data $ {} - |T $ %{} :Leaf (:at 1512702329281) (:by nil) (:text |if) - |j $ %{} :Expr (:at 1512702329520) (:by nil) + |D $ %{} :Leaf (:at 1695056335200) (:by |S1lNv50FW) (:text |if) + |L $ %{} :Expr (:at 1695056335502) (:by |S1lNv50FW) :data $ {} - |T $ %{} :Leaf (:at 1512702330929) (:by nil) (:text |not=) - |j $ %{} :Leaf (:at 1512702334483) (:by nil) (:text |new-md5) - |r $ %{} :Leaf (:at 1533921046212) (:by |root) (:text |@*calcit-md5) - |r $ %{} :Expr (:at 1512702349677) (:by nil) + |T $ %{} :Leaf (:at 1695056338366) (:by |S1lNv50FW) (:text |blank?) + |b $ %{} :Leaf (:at 1695056339956) (:by |S1lNv50FW) (:text |file-content) + |P $ %{} :Expr (:at 1695056346619) (:by |S1lNv50FW) :data $ {} - |T $ %{} :Leaf (:at 1512702431546) (:by nil) (:text |let) - |b $ %{} :Expr (:at 1512702431772) (:by nil) + |T $ %{} :Leaf (:at 1695056346619) (:by |S1lNv50FW) (:text |eprintln) + |b $ %{} :Expr (:at 1695056346619) (:by |S1lNv50FW) :data $ {} - |j $ %{} :Expr (:at 1512702439808) (:by nil) + |T $ %{} :Leaf (:at 1695056346619) (:by |S1lNv50FW) (:text |.!red) + |b $ %{} :Leaf (:at 1695056346619) (:by |S1lNv50FW) (:text |chalk) + |h $ %{} :Leaf (:at 1695056346619) (:by |S1lNv50FW) (:text "|\"got blank file on change, server might have staled") + |T $ %{} :Expr (:at 1512702328818) (:by nil) + :data $ {} + |T $ %{} :Leaf (:at 1512702329281) (:by nil) (:text |if) + |j $ %{} :Expr (:at 1512702329520) (:by nil) + :data $ {} + |T $ %{} :Leaf (:at 1512702330929) (:by nil) (:text |not=) + |j $ %{} :Leaf (:at 1512702334483) (:by nil) (:text |new-md5) + |r $ %{} :Leaf (:at 1533921046212) (:by |root) (:text |@*calcit-md5) + |r $ %{} :Expr (:at 1512702349677) (:by nil) + :data $ {} + |T $ %{} :Leaf (:at 1512702431546) (:by nil) (:text |let) + |b $ %{} :Expr (:at 1512702431772) (:by nil) :data $ {} - |T $ %{} :Leaf (:at 1533921047350) (:by |root) (:text |calcit) - |j $ %{} :Expr (:at 1512702442509) (:by nil) + |j $ %{} :Expr (:at 1512702439808) (:by nil) :data $ {} - |T $ %{} :Leaf (:at 1625686125697) (:by |S1lNv50FW) (:text |parse-cirru-edn) - |j $ %{} :Leaf (:at 1512702446822) (:by nil) (:text |file-content) - |f $ %{} :Expr (:at 1512703947620) (:by nil) - :data $ {} - |T $ %{} :Leaf (:at 1512703963190) (:by nil) (:text |println) - |j $ %{} :Expr (:at 1533921188733) (:by |root) + |T $ %{} :Leaf (:at 1533921047350) (:by |root) (:text |calcit) + |j $ %{} :Expr (:at 1512702442509) (:by nil) + :data $ {} + |T $ %{} :Leaf (:at 1625686125697) (:by |S1lNv50FW) (:text |parse-cirru-edn) + |j $ %{} :Leaf (:at 1512702446822) (:by nil) (:text |file-content) + |f $ %{} :Expr (:at 1512703947620) (:by nil) :data $ {} - |9 $ %{} :Leaf (:at 1644942288597) (:by |S1lNv50FW) (:text |.!blue) - |L $ %{} :Leaf (:at 1644942286206) (:by |S1lNv50FW) (:text |chalk) - |T $ %{} :Leaf (:at 1533921501407) (:by |root) (:text "|\"calcit storage file changed!") - |h $ %{} :Expr (:at 1512704174152) (:by nil) - :data $ {} - |T $ %{} :Leaf (:at 1512704175274) (:by nil) (:text |reset!) - |j $ %{} :Leaf (:at 1533921056913) (:by |root) (:text |*calcit-md5) - |r $ %{} :Leaf (:at 1512704184764) (:by nil) (:text |new-md5) - |j $ %{} :Expr (:at 1512702350929) (:by nil) - :data $ {} - |T $ %{} :Leaf (:at 1512702372483) (:by nil) (:text |dispatch!) - |j $ %{} :Expr (:at 1689419869799) (:by |S1lNv50FW) + |T $ %{} :Leaf (:at 1512703963190) (:by nil) (:text |println) + |j $ %{} :Expr (:at 1533921188733) (:by |root) + :data $ {} + |9 $ %{} :Leaf (:at 1644942288597) (:by |S1lNv50FW) (:text |.!blue) + |L $ %{} :Leaf (:at 1644942286206) (:by |S1lNv50FW) (:text |chalk) + |T $ %{} :Leaf (:at 1533921501407) (:by |root) (:text "|\"calcit storage file changed!") + |h $ %{} :Expr (:at 1512704174152) (:by nil) + :data $ {} + |T $ %{} :Leaf (:at 1512704175274) (:by nil) (:text |reset!) + |j $ %{} :Leaf (:at 1533921056913) (:by |root) (:text |*calcit-md5) + |r $ %{} :Leaf (:at 1512704184764) (:by nil) (:text |new-md5) + |j $ %{} :Expr (:at 1512702350929) (:by nil) :data $ {} - |D $ %{} :Leaf (:at 1689419870496) (:by |S1lNv50FW) (:text |::) - |T $ %{} :Leaf (:at 1512702388416) (:by nil) (:text |:watcher/file-change) - |b $ %{} :Leaf (:at 1689419875629) (:by |S1lNv50FW) (:text |calcit) - |n $ %{} :Leaf (:at 1689419906524) (:by |S1lNv50FW) (:text |nil) + |T $ %{} :Leaf (:at 1512702372483) (:by nil) (:text |dispatch!) + |j $ %{} :Expr (:at 1689419869799) (:by |S1lNv50FW) + :data $ {} + |D $ %{} :Leaf (:at 1689419870496) (:by |S1lNv50FW) (:text |::) + |T $ %{} :Leaf (:at 1512702388416) (:by nil) (:text |:watcher/file-change) + |b $ %{} :Leaf (:at 1689419875629) (:by |S1lNv50FW) (:text |calcit) + |n $ %{} :Leaf (:at 1689419906524) (:by |S1lNv50FW) (:text |nil) |reload! $ %{} :CodeEntry (:doc |) :code $ %{} :Expr (:at 1504777570689) (:by nil) :data $ {} @@ -33207,10 +33222,6 @@ :data $ {} |T $ %{} :Leaf (:at 1546180196666) (:by |root) (:text |dissoc) |j $ %{} :Leaf (:at 1504777570689) (:by |root) (:text |:saved-files) - |x $ %{} :Expr (:at 1518362608175) (:by |root) - :data $ {} - |T $ %{} :Leaf (:at 1546180186800) (:by |root) (:text |dissoc) - |j $ %{} :Leaf (:at 1518362610826) (:by |root) (:text |:repl) |expr? $ %{} :CodeEntry (:doc |) :code $ %{} :Expr (:at 1504777570689) (:by nil) :data $ {} @@ -34910,7 +34921,7 @@ |T $ %{} :Leaf (:at 1504777570689) (:by |root) (:text |do) |j $ %{} :Expr (:at 1504777570689) (:by nil) :data $ {} - |T $ %{} :Leaf (:at 1520345593272) (:by |root) (:text |println) + |T $ %{} :Leaf (:at 1695056373487) (:by |S1lNv50FW) (:text |eprintln) |r $ %{} :Expr (:at 1505982482700) (:by |root) :data $ {} |9 $ %{} :Leaf (:at 1644942378938) (:by |S1lNv50FW) (:text |.!red) diff --git a/compact.cirru b/compact.cirru index 579b823..0566a52 100644 --- a/compact.cirru +++ b/compact.cirru @@ -1,6 +1,6 @@ {} (:package |app) - :configs $ {} (:init-fn |app.server/main!) (:reload-fn |app.server/reload!) (:version |0.8.7) + :configs $ {} (:init-fn |app.server/main!) (:reload-fn |app.server/reload!) (:version |0.8.8) :modules $ [] |lilac/ |memof/ |recollect/ |cumulo-util.calcit/ |ws-edn.calcit/ |bisection-key/ :entries $ {} :client $ {} (:init-fn |app.client/main!) (:reload-fn |app.client/reload!) @@ -2881,12 +2881,14 @@ defn on-file-change! () $ let file-content $ fs/readFileSync storage-file "\"utf8" new-md5 $ md5 file-content - if (not= new-md5 @*calcit-md5) - let - calcit $ parse-cirru-edn file-content - println $ .!blue chalk "\"calcit storage file changed!" - reset! *calcit-md5 new-md5 - dispatch! (:: :watcher/file-change calcit) nil + if (blank? file-content) + eprintln $ .!red chalk "\"got blank file on change, server might have staled" + if (not= new-md5 @*calcit-md5) + let + calcit $ parse-cirru-edn file-content + println $ .!blue chalk "\"calcit storage file changed!" + reset! *calcit-md5 new-md5 + dispatch! (:: :watcher/file-change calcit) nil |reload! $ %{} :CodeEntry (:doc |) :code $ quote defn reload! () @@ -4863,7 +4865,7 @@ |db->string $ %{} :CodeEntry (:doc |) :code $ quote defn db->string (db) - format-cirru-edn $ -> db (dissoc :sessions) (dissoc :saved-files) (dissoc :repl) + format-cirru-edn $ -> db (dissoc :sessions) (dissoc :saved-files) |expr? $ %{} :CodeEntry (:doc |) :code $ quote defn expr? (x) (&record:matches? schema/CirruExpr x) @@ -5118,7 +5120,7 @@ persist-async! (:storage-file config/site) db-content started-time fn (e) do - println $ .!red chalk e + eprintln $ .!red chalk e js/console.error e dispatch! $ :: :notify/push-message [] :error $ aget e "\"message" diff --git a/package.json b/package.json index 12b944d..71a8b62 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@calcit/editor", - "version": "0.8.7", + "version": "0.8.8", "description": "Tree Editor for Calcit Language", "bin": { "ct": "./server.mjs"