diff --git a/deps.edn b/deps.edn index a3acc8fb..d82b72cf 100644 --- a/deps.edn +++ b/deps.edn @@ -3,17 +3,17 @@ ;; see https://github.com/clj-kondo/clj-kondo/blob/master/doc/config.md#exporting-and-importing-configuration "src/clj-kondo"] - :deps {edn-query-language/eql {:mvn/version "1.0.2"} - com.taoensso/timbre {:mvn/version "6.5.0"} - com.taoensso/encore {:mvn/version "3.127.0"} + :deps {edn-query-language/eql {:mvn/version "1.0.2"} + com.taoensso/timbre {:mvn/version "6.5.0"} + com.taoensso/encore {:mvn/version "3.127.0"} - com.cognitect/transit-clj {:mvn/version "1.0.329"} - com.cognitect/transit-cljs {:mvn/version "0.8.280"} - com.fulcrologic/guardrails {:mvn/version "1.2.9"} + com.cognitect/transit-clj {:mvn/version "1.0.329"} + com.cognitect/transit-cljs {:mvn/version "0.8.280"} + com.fulcrologic/guardrails {:mvn/version "1.2.9"} - org.clojure/clojure {:mvn/version "1.11.3" :scope "provided"} - org.clojure/clojurescript {:mvn/version "1.11.132" :scope "provided"} - org.clojure/core.async {:mvn/version "1.3.610"}} + org.clojure/clojure {:mvn/version "1.11.3" :scope "provided"} + org.clojure/clojurescript {:mvn/version "1.11.132" :scope "provided"} + org.clojure/core.async {:mvn/version "1.3.610"}} :aliases {:test {:extra-paths ["src/test"] :extra-deps {org.clojure/test.check {:mvn/version "1.1.1"} @@ -30,15 +30,15 @@ :exclusions [com.fulcrologic/fulcro]}}} :dev {:extra-paths ["src/dev" "resources" "src/todomvc"] - :extra-deps {thheller/shadow-cljs {:mvn/version "2.28.20"} - com.wsscode/pathom {:mvn/version "2.3.1"} - com.fulcrologic/fulcro-websockets {:mvn/version "3.2.0" - :exclusions [com.fulcrologic/fulcro]} - com.fulcrologic/fulcro-inspect {:mvn/version "0.2.0"} - binaryage/devtools {:mvn/version "1.0.6"} - ring/ring-core {:mvn/version "1.8.1"} - org.immutant/web {:mvn/version "2.1.10"} - org.clojure/tools.namespace {:mvn/version "1.0.0"}}} + :extra-deps {thheller/shadow-cljs {:mvn/version "2.28.20"} + com.wsscode/pathom {:mvn/version "2.3.1"} + com.fulcrologic/fulcro-websockets {:mvn/version "3.2.0" + :exclusions [com.fulcrologic/fulcro]} + com.fulcrologic/fulcro-inspect {:mvn/version "1.0.0"} + binaryage/devtools {:mvn/version "1.0.6"} + ring/ring-core {:mvn/version "1.8.1"} + org.immutant/web {:mvn/version "2.1.10"} + org.clojure/tools.namespace {:mvn/version "1.0.0"}}} :build {:deps {io.github.seancorfield/build-clj {:tag "v0.6.7" :sha "22c2d09"}} :ns-default build}}} diff --git a/src/main/com/fulcrologic/fulcro/inspect/devtool_api.cljc b/src/main/com/fulcrologic/fulcro/inspect/devtool_api.cljc index 0dba4e54..4b87b68d 100644 --- a/src/main/com/fulcrologic/fulcro/inspect/devtool_api.cljc +++ b/src/main/com/fulcrologic/fulcro/inspect/devtool_api.cljc @@ -1,10 +1,21 @@ (ns com.fulcrologic.fulcro.inspect.devtool-api + #?(:cljs (:require-macros com.fulcrologic.fulcro.inspect.devtool-api)) "These are declarations of the remote mutations that are callable on the Fulcro Inspect Dev tool. Internal use. They are declared in the Fulcro project so the internals can be connected to the Inspect Devtool without having the dev tool be a release build requirement." (:require - [com.fulcrologic.devtools.common.resolvers :refer [remote-mutations]])) + [com.fulcrologic.fulcro.mutations :as m])) + +#?(:clj + (defmacro remote-mutations [& syms] + (let [declarations (mapv + (fn [sym] + `(m/defmutation ~sym [_#] + (~'devtool-remote [_env#] true))) + syms)] + `(do + ~@declarations)))) (remote-mutations app-started diff --git a/src/main/com/fulcrologic/fulcro/inspect/inspect_client.cljc b/src/main/com/fulcrologic/fulcro/inspect/inspect_client.cljc index c7861fab..1474abb8 100644 --- a/src/main/com/fulcrologic/fulcro/inspect/inspect_client.cljc +++ b/src/main/com/fulcrologic/fulcro/inspect/inspect_client.cljc @@ -13,7 +13,6 @@ #?(:cljs (:require-macros com.fulcrologic.fulcro.inspect.inspect-client)) (:require [com.fulcrologic.fulcro.inspect.devtool-api :as devtool] - [taoensso.timbre :as log] [com.fulcrologic.fulcro.inspect.diff :as diff] [com.fulcrologic.fulcro.inspect.tools :as fit] #?@(:cljs [[goog.object :as gobj]]))) diff --git a/src/main/com/fulcrologic/fulcro/inspect/target_impl.cljc b/src/main/com/fulcrologic/fulcro/inspect/target_impl.cljc index e1280fcf..4c9fc3de 100644 --- a/src/main/com/fulcrologic/fulcro/inspect/target_impl.cljc +++ b/src/main/com/fulcrologic/fulcro/inspect/target_impl.cljc @@ -20,17 +20,6 @@ [taoensso.encore :as enc] [taoensso.timbre :as log])) -;; TASK: Cleanup. Need to figure out the cross-references of namespaces and make sure things are in the right spot. -;; * Inspect can require fulcro namespaces -;; * Fulcro namespaces can require inspect LIBRARY namespaces ONLY -;; * Fulcro namespaces should avoid directly using the devtools remote nses, except where it is using inspect nses -;; This should make it so if you DON'T have inspect on the classpath, as long as you don't try to enable inspect you -;; should not get errors. -;; TASK: Test that an app can NOT include inspect or devtools remove in its deps -;; TASK: Figure out how people are supposed to do dev-time vs release time Inspect code (different app creation nses?). Actually, -;; is it OK for us to keep inspect on the classpath: will the lack of a preload get us optimal release code without overhead? -;; add-devtool-remote! seems like it will get schemas/protocols/resolvers. Perhaps ido??? - (defonce apps* (atom {})) (defmulti handle-inspect-event (fn [tconn app event] (:type event))) @@ -60,12 +49,9 @@ (dp/transmit! tconn app-uuid [(devtool/optimistic-action (assoc event :fulcro.inspect.client/tx-ref [:network-history/id [app-uuid-key app-uuid]]))]))) -;; TASK: Fix app labels. Currently just using app id. Label should default to the root class name -:fulcro.inspect.core/app-id (defmutation connected [{:devtool/keys [connection] :fulcro/keys [app]} {::mk/keys [target-id connected?]}] {::pc/sym `bi/devtool-connected} - (log/info "CONNECTED" target-id connected?) (let [networking (remotes app) state* (state-atom app) id (app-uuid app)] @@ -77,27 +63,6 @@ :history/version (record-history-entry! app @state*) :history/value @state*}})]))) -;; TASK: Not used...when do we query for this? -(defresolver page-apps-resolver [env input] - {::pc/output [{:page/apps [app-uuid-key - :fulcro.inspect.client/remotes - {:fulcro.inspect.client/initial-history-step [app-uuid-key - :history/value - :history/version]}]}]} - {:page/apps - (mapv - (fn [app] - (let [state (app-state app) - version (record-history-entry! app state) - remote-names (remotes app)] - {app-uuid-key (app-uuid app) - ;; app label - :fulcro.inspect.client/remotes (sort-by (juxt #(not= :remote %) str) (keys remote-names)) - :fulcro.inspect.client/initial-history-step {app-uuid-key (app-uuid app) - :history/version version - :history/value state}})) - (vals @apps*))}) - (defmutation reset-app [{:fulcro/keys [app]} {:history/keys [version]}] {::pc/sym `target/reset-app} (let [render! (ah/app-algorithm app :schedule-render!)] @@ -107,7 +72,7 @@ (render! app {:force-root? true})) (log/error "Reset failed. No target state ID supplied")))) -;; TASK: Test if this works, since we might want to avoid the diff system. Or at least test diff with huge app state and see the overhead +;; TODO: Test if this works, since we might want to avoid the diff system. Or at least test diff with huge app state and see the overhead (defresolver history-resolver [env {:history/keys [id]}] {::pc/input #{:history/id} ::pc/output [app-uuid-key @@ -130,7 +95,7 @@ (not diff?) (assoc :history/value value))) (log/error "Failed to resolve history step.")))) -;; TASK: Did we used to run EQL transactions from inspect AS transactions? If so, fix. +;; FIXME: Did we used to run EQL transactions from inspect AS transactions? If so, fix. (defmutation run-transaction [env params] {::pc/sym `target/run-transaction} (let [{:keys [tx tx-ref]} params @@ -166,7 +131,7 @@ (async/go (async/>! result-channel body)))})) (do - (log/info "Request not attempted.") + (log/trace "Request not attempted.") (async/go (async/>! result-channel {:error "Unable to run network request"})))) result-channel))